CommonLibSSE (Parapets fork)
Loading...
Searching...
No Matches
GSysAllocPaged.h
Go to the documentation of this file.
1#pragma once
2
4
5namespace 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 {
31 using func_t = decltype(&GSysAllocPaged::InitHeapEngine);
33 return func(this, a_heapDesc);
34 }
35
36 void ShutdownHeapEngine() override // 02
37 {
38 using func_t = decltype(&GSysAllocPaged::ShutdownHeapEngine);
40 return func(this);
41 }
42
43 // add
44 virtual void GetInfo(Info* a_info) const = 0; // 03
45 virtual void* Alloc(std::size_t a_size, std::size_t a_align) = 0; // 04
46 virtual bool Free(void* a_ptr, std::size_t a_size, std::size_t a_align) = 0; // 05
47 virtual bool ReallocInPlace(
48 [[maybe_unused]] void* a_oldPtr,
49 [[maybe_unused]] std::size_t a_oldSize,
50 [[maybe_unused]] std::size_t a_newSize,
51 [[maybe_unused]] std::size_t a_align) { return false; } // 06
52 virtual void* AllocSysDirect(
53 [[maybe_unused]] std::size_t a_size,
54 [[maybe_unused]] std::size_t a_alignment,
55 [[maybe_unused]] std::size_t* a_actualSize,
56 [[maybe_unused]] std::size_t* a_actualAlign) { return nullptr; } // 07
57 virtual bool FreeSysDirect(
58 [[maybe_unused]] void* a_ptr,
59 [[maybe_unused]] std::size_t a_size,
60 [[maybe_unused]] std::size_t a_alignment) { return false; } // 08
61 [[nodiscard]] virtual std::size_t GetBase() const { return 0; } // 09
62 [[nodiscard]] virtual std::size_t GetSize() const { return 0; } // 0A
63 [[nodiscard]] virtual std::size_t GetFootprint() const { return 0; } // 0B
64 [[nodiscard]] virtual std::size_t GetUsedSpace() const { return 0; } // 0C
65 virtual void VisitMem([[maybe_unused]] GHeapMemVisitor* a_visitor) const { return; } // 0D
66 virtual void VisitSegments(
67 [[maybe_unused]] GHeapSegVisitor* a_visitor,
68 [[maybe_unused]] std::size_t a_catSeg,
69 [[maybe_unused]] std::size_t a_catUnused) const { return; } // 0E
70 };
71 static_assert(sizeof(GSysAllocPaged) == 0x8);
72}
Definition: GSysAllocBase.h:6
Definition: GSysAllocPaged.h:11
bool InitHeapEngine(const void *a_heapDesc) override
Definition: GSysAllocPaged.h:29
virtual void VisitMem(GHeapMemVisitor *a_visitor) const
Definition: GSysAllocPaged.h:65
virtual std::size_t GetUsedSpace() const
Definition: GSysAllocPaged.h:64
virtual bool FreeSysDirect(void *a_ptr, std::size_t a_size, std::size_t a_alignment)
Definition: GSysAllocPaged.h:57
virtual bool Free(void *a_ptr, std::size_t a_size, std::size_t a_align)=0
void ShutdownHeapEngine() override
Definition: GSysAllocPaged.h:36
virtual std::size_t GetFootprint() const
Definition: GSysAllocPaged.h:63
virtual void * AllocSysDirect(std::size_t a_size, std::size_t a_alignment, std::size_t *a_actualSize, std::size_t *a_actualAlign)
Definition: GSysAllocPaged.h:52
virtual void VisitSegments(GHeapSegVisitor *a_visitor, std::size_t a_catSeg, std::size_t a_catUnused) const
Definition: GSysAllocPaged.h:66
virtual std::size_t GetSize() const
Definition: GSysAllocPaged.h:62
virtual std::size_t GetBase() const
Definition: GSysAllocPaged.h:61
virtual void * Alloc(std::size_t a_size, std::size_t a_align)=0
virtual void GetInfo(Info *a_info) const =0
virtual bool ReallocInPlace(void *a_oldPtr, std::size_t a_oldSize, std::size_t a_newSize, std::size_t a_align)
Definition: GSysAllocPaged.h:47
static constexpr auto RTTI
Definition: GSysAllocPaged.h:13
Definition: Relocation.h:858
constexpr REL::ID InitHeapEngine(static_cast< std::uint64_t >(84557))
constexpr REL::ID ShutdownHeapEngine(static_cast< std::uint64_t >(84559))
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