mirror of https://github.com/PrimeDecomp/prime.git
parent
d26b7a4753
commit
e11b88ea1e
|
@ -1531,9 +1531,9 @@ lbl_803525B0:
|
|||
|
||||
.global __ct__14CGameAllocatorFv
|
||||
__ct__14CGameAllocatorFv:
|
||||
/* 803525CC 0034F52C 3C A0 80 3F */ lis r5, lbl_803ED9C0@ha
|
||||
/* 803525CC 0034F52C 3C A0 80 3F */ lis r5, __vt__10IAllocator@ha
|
||||
/* 803525D0 0034F530 3C 80 80 3F */ lis r4, lbl_803EF6D8@ha
|
||||
/* 803525D4 0034F534 38 A5 D9 C0 */ addi r5, r5, lbl_803ED9C0@l
|
||||
/* 803525D4 0034F534 38 A5 D9 C0 */ addi r5, r5, __vt__10IAllocator@l
|
||||
/* 803525D8 0034F538 38 00 00 00 */ li r0, 0
|
||||
/* 803525DC 0034F53C 90 A3 00 00 */ stw r5, 0(r3)
|
||||
/* 803525E0 0034F540 38 84 F6 D8 */ addi r4, r4, lbl_803EF6D8@l
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
.section .data
|
||||
|
||||
.global lbl_803ED9C0
|
||||
lbl_803ED9C0:
|
||||
.global __vt__10IAllocator
|
||||
__vt__10IAllocator:
|
||||
# ROM: 0x3EA9C0
|
||||
.4byte 0
|
||||
.4byte 0
|
||||
|
@ -32,9 +32,9 @@ __dt__10IAllocatorFv:
|
|||
/* 80315CA4 00312C04 93 E1 00 0C */ stw r31, 0xc(r1)
|
||||
/* 80315CA8 00312C08 7C 7F 1B 79 */ or. r31, r3, r3
|
||||
/* 80315CAC 00312C0C 41 82 00 1C */ beq lbl_80315CC8
|
||||
/* 80315CB0 00312C10 3C A0 80 3F */ lis r5, lbl_803ED9C0@ha
|
||||
/* 80315CB0 00312C10 3C A0 80 3F */ lis r5, __vt__10IAllocator@ha
|
||||
/* 80315CB4 00312C14 7C 80 07 35 */ extsh. r0, r4
|
||||
/* 80315CB8 00312C18 38 05 D9 C0 */ addi r0, r5, lbl_803ED9C0@l
|
||||
/* 80315CB8 00312C18 38 05 D9 C0 */ addi r0, r5, __vt__10IAllocator@l
|
||||
/* 80315CBC 00312C1C 90 1F 00 00 */ stw r0, 0(r31)
|
||||
/* 80315CC0 00312C20 40 81 00 08 */ ble lbl_80315CC8
|
||||
/* 80315CC4 00312C24 4B FF FC 6D */ bl Free__7CMemoryFPCv
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
#ifndef _IALLOCATOR_HPP
|
||||
#define _IALLOCATOR_HPP
|
||||
|
||||
#include "Kyoto/Alloc/CMemory.hpp"
|
||||
#include "types.h"
|
||||
|
||||
class COsContext;
|
||||
class CCallStack;
|
||||
|
||||
class IAllocator {
|
||||
public:
|
||||
enum EHint {
|
||||
kHI_Unk = (1 << 0),
|
||||
kHI_RoundUpLen = (1 << 1),
|
||||
};
|
||||
enum EScope {
|
||||
kSC_Unk0,
|
||||
};
|
||||
enum EType {
|
||||
kTP_Unk0
|
||||
};
|
||||
|
||||
struct SMetrics {
|
||||
u32 x0_heapSize;
|
||||
u32 x4_;
|
||||
u32 x8_;
|
||||
u32 xc_;
|
||||
u32 x10_;
|
||||
u32 x14_heapSize2; // Remaining heap size?
|
||||
u32 x18_;
|
||||
u32 x1c_;
|
||||
u32 x20_;
|
||||
u32 x24_;
|
||||
u32 x28_;
|
||||
u32 x2c_smallNumAllocs;
|
||||
u32 x30_smallAllocatedSize;
|
||||
u32 x34_smallRemainingSize;
|
||||
u32 x38_mediumNumAllocs;
|
||||
u32 x3c_mediumAllocatedSize;
|
||||
u32 x40_mediumBlocksAvailable;
|
||||
u32 x44_;
|
||||
u32 x48_;
|
||||
u32 x4c_;
|
||||
u32 x50_mediumTotalAllocated;
|
||||
u32 x54_fakeStatics;
|
||||
SMetrics(u32 heapSize, u32 unk1, u32 unk2, u32 unk3, u32 unk4, u32 heapSize2, u32 unk5, u32 unk6, u32 unk7,
|
||||
u32 unk8, u32 unk9, u32 smallAllocNumAllocs, u32 smallAllocAllocatedSize, u32 smallAllocRemainingSize,
|
||||
u32 mediumAllocNumAllocs, u32 mediumAllocAllocatedSize, u32 mediumAllocBlocksAvailable, u32 unk10, u32 unk11, u32 unk12,
|
||||
u32 mediumAllocTotalAllocated, u32 fakeStatics);
|
||||
};
|
||||
|
||||
struct SAllocInfo {
|
||||
void* x0_infoPtr;
|
||||
u32 x4_len;
|
||||
bool x8_hasPrevious;
|
||||
bool x9_;
|
||||
const char* xc_fileAndLne;
|
||||
const char* x10_type;
|
||||
};
|
||||
|
||||
typedef const bool (*FOutOfMemoryCb)(void*, u32);
|
||||
typedef const bool (*FEnumAllocationsCb)(const SAllocInfo& info, const void* ptr);
|
||||
virtual ~IAllocator();
|
||||
|
||||
virtual bool Initialize(COsContext& ctx) = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
virtual void* Alloc(unsigned long size, EHint hint, EScope scope, EType type, const CCallStack& cs) = 0;
|
||||
virtual void Free(const void* ptr) = 0;
|
||||
virtual void ReleaseAll() = 0;
|
||||
virtual void* AllocSecondary(unsigned long size, EHint hint, EScope scope, EType type, const CCallStack& cs) = 0;
|
||||
virtual void 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 SAllocInfo GetAllocInfo(const void* ptr) const = 0;
|
||||
virtual void OffsetFakeStatics(s32 offset) = 0;
|
||||
virtual SMetrics GetMetrics() const = 0;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -537,7 +537,7 @@ KYOTO :=\
|
|||
$(BUILD_DIR)/asm/Kyoto/CCrc32.o\
|
||||
$(BUILD_DIR)/asm/Kyoto/Alloc/CCircularBuffer.o\
|
||||
$(BUILD_DIR)/asm/Kyoto/Alloc/CMemory.o\
|
||||
$(BUILD_DIR)/asm/Kyoto/Alloc/IAllocator.o\
|
||||
$(BUILD_DIR)/src/Kyoto/Alloc/IAllocator.o\
|
||||
$(BUILD_DIR)/asm/Kyoto/PVS/CPVSVisOctree.o\
|
||||
$(BUILD_DIR)/asm/Kyoto/PVS/CPVSVisSet.o\
|
||||
$(BUILD_DIR)/asm/Kyoto/Particles/CColorElement.o\
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
#include "Kyoto/Alloc/IAllocator.hpp"
|
||||
|
||||
#include "Kyoto/Basics/COsContext.hpp"
|
||||
|
||||
|
||||
IAllocator::~IAllocator() {
|
||||
|
||||
}
|
||||
|
||||
IAllocator::SMetrics::SMetrics(u32 heapSize, u32 unk1, u32 unk2, u32 unk3, u32 unk4, u32 heapSize2, u32 unk5, u32 unk6,
|
||||
u32 unk7, u32 unk8, u32 unk9, u32 smallAllocNumAllocs, u32 smallAllocAllocatedSize,
|
||||
u32 smallAllocRemainingSize, u32 mediumAllocNumAllocs, u32 mediumAllocAllocatedSize,
|
||||
u32 mediumAllocBlocksAvailable, u32 unk10, u32 unk11, u32 unk12,
|
||||
u32 mediumAllocTotalAllocated, u32 fakeStatics)
|
||||
: x0_heapSize(heapSize)
|
||||
, x4_(unk1)
|
||||
, x8_(unk2)
|
||||
, xc_(unk3)
|
||||
, x10_(unk4)
|
||||
, x14_heapSize2(heapSize2)
|
||||
, x18_(unk5)
|
||||
, x1c_(unk6)
|
||||
, x20_(unk7)
|
||||
, x24_(unk8)
|
||||
, x28_(unk9)
|
||||
, x2c_smallNumAllocs(smallAllocNumAllocs)
|
||||
, x30_smallAllocatedSize(smallAllocAllocatedSize)
|
||||
, x34_smallRemainingSize(smallAllocRemainingSize)
|
||||
, x38_mediumNumAllocs(mediumAllocNumAllocs)
|
||||
, x3c_mediumAllocatedSize(mediumAllocAllocatedSize)
|
||||
, x40_mediumBlocksAvailable(mediumAllocBlocksAvailable)
|
||||
, x44_(unk10)
|
||||
, x48_(unk11)
|
||||
, x4c_(unk12)
|
||||
, x50_mediumTotalAllocated(mediumAllocTotalAllocated)
|
||||
, x54_fakeStatics(fakeStatics) {}
|
Loading…
Reference in New Issue