CommonLibSSE (Parapets fork)
GSysAllocPaged.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/G/GSysAllocBase.h"
4 
5 namespace RE
6 {
7  class GHeapMemVisitor;
8  class GHeapSegVisitor;
9 
11  {
12  public:
13  static constexpr auto RTTI{ RTTI_GSysAllocPaged };
14 
15  struct Info
16  {
17  public:
18  // members
19  std::size_t minAlign; // 00
20  std::size_t maxAlign; // 08
21  std::size_t granularity; // 10
22  std::size_t sysDirectThreshold; // 18
23  std::size_t maxHeapGranularity; // 20
24  bool hasRealloc; // 28
25  };
26  static_assert(sizeof(Info) == 0x30);
27 
28  // override (GSysAllocBase)
29  bool InitHeapEngine(const void* a_heapDesc) override; // 01
30  void ShutdownHeapEngine() override; // 02
31 
32  // add
33  virtual void GetInfo(Info* a_info) const = 0; // 03
34  virtual void* Alloc(std::size_t a_size, std::size_t a_align) = 0; // 04
35  virtual bool Free(void* a_ptr, std::size_t a_size, std::size_t a_align) = 0; // 05
36  virtual bool ReallocInPlace(
37  [[maybe_unused]] void* a_oldPtr,
38  [[maybe_unused]] std::size_t a_oldSize,
39  [[maybe_unused]] std::size_t a_newSize,
40  [[maybe_unused]] std::size_t a_align) { return false; } // 06
41  virtual void* AllocSysDirect(
42  [[maybe_unused]] std::size_t a_size,
43  [[maybe_unused]] std::size_t a_alignment,
44  [[maybe_unused]] std::size_t* a_actualSize,
45  [[maybe_unused]] std::size_t* a_actualAlign) { return nullptr; } // 07
46  virtual bool FreeSysDirect(
47  [[maybe_unused]] void* a_ptr,
48  [[maybe_unused]] std::size_t a_size,
49  [[maybe_unused]] std::size_t a_alignment) { return false; } // 08
50  [[nodiscard]] virtual std::size_t GetBase() const { return 0; } // 09
51  [[nodiscard]] virtual std::size_t GetSize() const { return 0; } // 0A
52  [[nodiscard]] virtual std::size_t GetFootprint() const { return 0; } // 0B
53  [[nodiscard]] virtual std::size_t GetUsedSpace() const { return 0; } // 0C
54  virtual void VisitMem([[maybe_unused]] GHeapMemVisitor* a_visitor) const { return; } // 0D
55  virtual void VisitSegments(
56  [[maybe_unused]] GHeapSegVisitor* a_visitor,
57  [[maybe_unused]] std::size_t a_catSeg,
58  [[maybe_unused]] std::size_t a_catUnused) const { return; } // 0E
59  };
60  static_assert(sizeof(GSysAllocPaged) == 0x8);
61 }
Definition: GSysAllocBase.h:6
Definition: GSysAllocPaged.h:11
bool InitHeapEngine(const void *a_heapDesc) override
virtual bool FreeSysDirect([[maybe_unused]] void *a_ptr, [[maybe_unused]] std::size_t a_size, [[maybe_unused]] std::size_t a_alignment)
Definition: GSysAllocPaged.h:46
virtual std::size_t GetUsedSpace() const
Definition: GSysAllocPaged.h:53
virtual bool Free(void *a_ptr, std::size_t a_size, std::size_t a_align)=0
void ShutdownHeapEngine() override
virtual std::size_t GetFootprint() const
Definition: GSysAllocPaged.h:52
virtual bool ReallocInPlace([[maybe_unused]] void *a_oldPtr, [[maybe_unused]] std::size_t a_oldSize, [[maybe_unused]] std::size_t a_newSize, [[maybe_unused]] std::size_t a_align)
Definition: GSysAllocPaged.h:36
virtual std::size_t GetSize() const
Definition: GSysAllocPaged.h:51
virtual std::size_t GetBase() const
Definition: GSysAllocPaged.h:50
virtual void * Alloc(std::size_t a_size, std::size_t a_align)=0
virtual void VisitMem([[maybe_unused]] GHeapMemVisitor *a_visitor) const
Definition: GSysAllocPaged.h:54
virtual void * AllocSysDirect([[maybe_unused]] std::size_t a_size, [[maybe_unused]] std::size_t a_alignment, [[maybe_unused]] std::size_t *a_actualSize, [[maybe_unused]] std::size_t *a_actualAlign)
Definition: GSysAllocPaged.h:41
virtual void VisitSegments([[maybe_unused]] GHeapSegVisitor *a_visitor, [[maybe_unused]] std::size_t a_catSeg, [[maybe_unused]] std::size_t a_catUnused) const
Definition: GSysAllocPaged.h:55
virtual void GetInfo(Info *a_info) const =0
static constexpr auto RTTI
Definition: GSysAllocPaged.h:13
Definition: AbsorbEffect.h:6
constexpr REL::ID RTTI_GSysAllocPaged
Definition: Offsets_RTTI.h:4859
Definition: GSysAllocPaged.h:16
std::size_t granularity
Definition: GSysAllocPaged.h:21
std::size_t maxAlign
Definition: GSysAllocPaged.h:20
bool hasRealloc
Definition: GSysAllocPaged.h:24
std::size_t minAlign
Definition: GSysAllocPaged.h:19
std::size_t sysDirectThreshold
Definition: GSysAllocPaged.h:22
std::size_t maxHeapGranularity
Definition: GSysAllocPaged.h:23