1
- #pragma once
1
+ // Disable ReSharper virtual destructor check, as the Allocators are just structs with pointers to functions which are
2
+ // copied around.
3
+ // ReSharper disable CppPolymorphicClassWithNonVirtualPublicDestructor
2
4
3
- #include < cstdint>
4
- #include < type_traits>
5
+ #pragma once
5
6
6
- #include < RED4ext/Detail/AddressHashes.hpp>
7
7
#include < RED4ext/Common.hpp>
8
+ #include < RED4ext/Detail/AddressHashes.hpp>
8
9
#include < RED4ext/Memory/Pools.hpp>
9
10
#include < RED4ext/Relocation.hpp>
10
11
12
+ #include < cstdint>
13
+ #include < type_traits>
14
+
11
15
namespace RED4ext
12
16
{
13
17
namespace Memory
@@ -28,7 +32,7 @@ struct IAllocator
28
32
uint32_t aAlignment) const = 0; // 16
29
33
virtual void Free (AllocationResult& aAllocation) const = 0; // 20
30
34
virtual void sub_28 (void * a1) const = 0; // 28
31
- virtual const uint32_t GetHandle () const = 0; // 30
35
+ virtual const uint32_t GetHandle () const = 0; // 30
32
36
33
37
[[deprecated(" Use 'GetHandle()' instead." )]] const uint32_t GetId () const
34
38
{
@@ -81,9 +85,9 @@ struct Allocator : IAllocator
81
85
static UniversalRelocFunc<alloc_t > alloc (Detail::AddressHashes::Memory_Vault_Alloc);
82
86
83
87
auto pool = T::Get ();
84
- auto storage = pool->storage ->GetAllocatorStorage <Vault>();
88
+ auto storage = pool->storage ->template GetAllocatorStorage <Vault>();
85
89
86
- AllocationResult result;
90
+ AllocationResult result = {} ;
87
91
alloc (storage, &result, aSize);
88
92
if (!result.memory )
89
93
{
@@ -99,9 +103,9 @@ struct Allocator : IAllocator
99
103
static UniversalRelocFunc<alloc_t > alloc (Detail::AddressHashes::Memory_Vault_AllocAligned);
100
104
101
105
auto pool = T::Get ();
102
- auto storage = pool->storage ->GetAllocatorStorage <Vault>();
106
+ auto storage = pool->storage ->template GetAllocatorStorage <Vault>();
103
107
104
- AllocationResult result;
108
+ AllocationResult result = {} ;
105
109
alloc (storage, &result, aSize, aAlignment);
106
110
if (!result.memory )
107
111
{
@@ -117,9 +121,9 @@ struct Allocator : IAllocator
117
121
static UniversalRelocFunc<realloc_t > realloc (Detail::AddressHashes::Memory_Vault_Realloc);
118
122
119
123
auto pool = T::Get ();
120
- auto storage = pool->storage ->GetAllocatorStorage <Vault>();
124
+ auto storage = pool->storage ->template GetAllocatorStorage <Vault>();
121
125
122
- AllocationResult result;
126
+ AllocationResult result = {} ;
123
127
realloc (storage, &result, aAllocation, aSize);
124
128
if (!result.memory && aSize)
125
129
{
@@ -136,9 +140,9 @@ struct Allocator : IAllocator
136
140
static UniversalRelocFunc<realloc_t > realloc (Detail::AddressHashes::Memory_Vault_ReallocAligned);
137
141
138
142
auto pool = T::Get ();
139
- auto storage = pool->storage ->GetAllocatorStorage <Vault>();
143
+ auto storage = pool->storage ->template GetAllocatorStorage <Vault>();
140
144
141
- AllocationResult result;
145
+ AllocationResult result = {} ;
142
146
realloc (storage, &result, aAllocation, aSize, aAlignment);
143
147
if (!result.memory && aSize)
144
148
{
@@ -154,7 +158,7 @@ struct Allocator : IAllocator
154
158
static UniversalRelocFunc<func_t > func (Detail::AddressHashes::Memory_Vault_Free);
155
159
156
160
auto pool = T::Get ();
157
- auto storage = pool->storage ->GetAllocatorStorage <Vault>();
161
+ auto storage = pool->storage ->template GetAllocatorStorage <Vault>();
158
162
func (storage, aAllocation);
159
163
}
160
164
@@ -164,7 +168,7 @@ struct Allocator : IAllocator
164
168
static UniversalRelocFunc<func_t > func (Detail::AddressHashes::Memory_Vault_Unk1);
165
169
166
170
auto pool = T::Get ();
167
- auto storage = pool->storage ->GetAllocatorStorage <Vault>();
171
+ auto storage = pool->storage ->template GetAllocatorStorage <Vault>();
168
172
func (storage, a2);
169
173
}
170
174
@@ -2712,14 +2716,4 @@ struct GPUM_Buffer_MorphTargetsAllocator : Allocator<GPUM_Buffer_MorphTargets>
2712
2716
{
2713
2717
};
2714
2718
} // namespace Memory
2715
-
2716
- struct [[deprecated(" Use 'Memory::IAllocator' instead." )]] IMemoryAllocator : Memory::IAllocator
2717
- {
2718
- struct [[deprecated (" Use 'Memory::AllocationResult' instead." )]] Result : Memory::AllocationResult{};
2719
- };
2720
-
2721
- struct [[deprecated(" Use 'Memory::EngineAllocator' instead." )]] EngineAllocator : Memory::EngineAllocator{};
2722
- struct [[deprecated(" Use 'Memory::RTTIAllocator' instead." )]] RTTIAllocator : Memory::RTTIAllocator{};
2723
- struct [[deprecated(" Use 'Memory::RTTIFunctionAllocator' instead." )]] RTTIFunctionAllocator
2724
- : Memory::RTTIFunctionAllocator{};
2725
2719
} // namespace RED4ext
0 commit comments