mirror of
https://github.com/PrimeDecomp/prime.git
synced 2025-12-20 16:59:11 +00:00
@@ -11,6 +11,7 @@ class COsContext;
|
||||
class CGameAllocator : public IAllocator {
|
||||
public:
|
||||
class SGameMemInfo {
|
||||
friend class CGameAllocator;
|
||||
public:
|
||||
SGameMemInfo(SGameMemInfo* prev, SGameMemInfo* next, SGameMemInfo* nextFree, uint len, const char* fileAndLine, const char* type)
|
||||
: x0_priorGuard(0xefefefef)
|
||||
@@ -46,6 +47,10 @@ public:
|
||||
}
|
||||
|
||||
bool IsAllocated() const { return ((size_t)x10_prev) & 1; }
|
||||
|
||||
bool IsPostGuardIntact() const { return x1c_postGuard == 0xeaeaeaea; }
|
||||
bool IsPriorGuardIntact() const { return x0_priorGuard == 0xefefefef; }
|
||||
|
||||
private:
|
||||
int x0_priorGuard;
|
||||
size_t x4_len;
|
||||
@@ -75,7 +80,7 @@ public:
|
||||
bool FreeSecondary(const void* ptr) override;
|
||||
void ReleaseAllSecondary() override;
|
||||
void SetOutOfMemoryCallback(FOutOfMemoryCb cb, const void* target) override;
|
||||
void EnumAllocations(FEnumAllocationsCb func, const void* ptr, bool b) const override;
|
||||
int EnumAllocations(FEnumAllocationsCb func, const void* ptr, bool b) const override;
|
||||
SAllocInfo GetAllocInfo(const void* ptr) const override;
|
||||
SMetrics GetMetrics() const override;
|
||||
void OffsetFakeStatics(int offset) override;
|
||||
|
||||
@@ -12,7 +12,6 @@ public:
|
||||
void* Alloc(uint size);
|
||||
bool Free(const void* ptr);
|
||||
|
||||
private:
|
||||
bool PtrWithinPool(const void* ptr) const {
|
||||
return u32((reinterpret_cast< const u8* >(ptr) - reinterpret_cast< u8* >(x0_mainData)) / 4) < x8_numBlocks;
|
||||
}
|
||||
|
||||
@@ -58,12 +58,21 @@ public:
|
||||
};
|
||||
|
||||
struct SAllocInfo {
|
||||
void* x0_infoPtr;
|
||||
const void* x0_infoPtr;
|
||||
uint x4_len;
|
||||
bool x8_hasPrevious;
|
||||
bool x8_isAllocated;
|
||||
bool x9_;
|
||||
const char* xc_fileAndLne;
|
||||
const char* xc_fileAndLine;
|
||||
const char* x10_type;
|
||||
|
||||
SAllocInfo(const void* ptr, uint len, bool isAllocated, bool b2, const char* fileAndLine,
|
||||
const char* type)
|
||||
: x0_infoPtr(ptr)
|
||||
, x4_len(len)
|
||||
, x8_isAllocated(isAllocated)
|
||||
, x9_(b2)
|
||||
, xc_fileAndLine(fileAndLine)
|
||||
, x10_type(type) {}
|
||||
};
|
||||
|
||||
typedef const bool (*FOutOfMemoryCb)(const void*, uint);
|
||||
@@ -81,7 +90,7 @@ public:
|
||||
virtual bool FreeSecondary(const void* ptr) = 0;
|
||||
virtual void ReleaseAllSecondary() = 0;
|
||||
virtual void SetOutOfMemoryCallback(FOutOfMemoryCb cb, const void* data) = 0;
|
||||
virtual void EnumAllocations(FEnumAllocationsCb func, const void* ptr, bool b) const = 0;
|
||||
virtual int EnumAllocations(FEnumAllocationsCb func, const void* ptr, bool b) const = 0;
|
||||
virtual SAllocInfo GetAllocInfo(const void* ptr) const = 0;
|
||||
virtual void OffsetFakeStatics(int offset) = 0;
|
||||
virtual SMetrics GetMetrics() const = 0;
|
||||
|
||||
Reference in New Issue
Block a user