mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-01-30 23:10:14 -05:00
GameState_, GameAlloc_, SystemArena_ & ZeldaArena_
This commit is contained in:
parent
4606929b31
commit
0d85caaf7e
@ -987,13 +987,13 @@ void Lights_GlowCheck(GlobalContext* globalCtx);
|
||||
void Lights_DrawGlow(GlobalContext* globalCtx);
|
||||
void ZeldaArena_CheckPointer(void* ptr, size_t size, const char* name, const char* action);
|
||||
void* ZeldaArena_Malloc(size_t size);
|
||||
void* ZeldaArena_MallocDebug(size_t size, const char* file, s32 line);
|
||||
void* ZeldaArena_MallocDebug(size_t size);
|
||||
void* ZeldaArena_MallocR(size_t size);
|
||||
void* ZeldaArena_MallocRDebug(size_t size, const char* file, s32 line);
|
||||
void* ZeldaArena_MallocRDebug(size_t size);
|
||||
void* ZeldaArena_Realloc(void* ptr, size_t newSize);
|
||||
void* ZeldaArena_ReallocDebug(void* ptr, size_t newSize, const char* file, s32 line);
|
||||
void* ZeldaArena_ReallocDebug(void* ptr, size_t newSize);
|
||||
void ZeldaArena_Free(void* ptr);
|
||||
void ZeldaArena_FreeDebug(void* ptr, const char* file, s32 line);
|
||||
void ZeldaArena_FreeDebug(void* ptr);
|
||||
void* ZeldaArena_Calloc(size_t num, size_t size);
|
||||
void ZeldaArena_Display();
|
||||
void ZeldaArena_GetSizes(u32* outMaxFree, u32* outFree, u32* outAlloc);
|
||||
@ -1600,9 +1600,9 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g
|
||||
void GameState_Destroy(GameState* gameState);
|
||||
GameStateFunc GameState_GetInit(GameState* gameState);
|
||||
u32 GameState_IsRunning(GameState* gameState);
|
||||
void* GameState_Alloc(GameState* gameState, size_t size, char* file, s32 line);
|
||||
void* GameState_Alloc(GameState* gameState, size_t size);
|
||||
void func_800C55D0(GameAlloc* this);
|
||||
void* GameAlloc_MallocDebug(GameAlloc* this, size_t size, const char* file, s32 line);
|
||||
void* GameAlloc_MallocDebug(GameAlloc* this, size_t size);
|
||||
void* GameAlloc_Malloc(GameAlloc* this, size_t size);
|
||||
void GameAlloc_Free(GameAlloc* this, void* data);
|
||||
void GameAlloc_Cleanup(GameAlloc* this);
|
||||
@ -2175,13 +2175,13 @@ f32 roundf(f32 x);
|
||||
f32 nearbyintf(f32 x);*/
|
||||
void SystemArena_CheckPointer(void* ptr, size_t size, const char* name, const char* action);
|
||||
void* SystemArena_Malloc(size_t size);
|
||||
void* SystemArena_MallocDebug(size_t size, const char* file, s32 line);
|
||||
void* SystemArena_MallocDebug(size_t size);
|
||||
void* SystemArena_MallocR(size_t size);
|
||||
void* SystemArena_MallocRDebug(size_t size, const char* file, s32 line);
|
||||
void* SystemArena_MallocRDebug(size_t size);
|
||||
void* SystemArena_Realloc(void* ptr, size_t newSize);
|
||||
void* SystemArena_ReallocDebug(void* ptr, size_t newSize, const char* file, s32 line);
|
||||
void* SystemArena_ReallocDebug(void* ptr, size_t newSize);
|
||||
void SystemArena_Free(void* ptr);
|
||||
void SystemArena_FreeDebug(void* ptr, const char* file, s32 line);
|
||||
void SystemArena_FreeDebug(void* ptr);
|
||||
void* SystemArena_Calloc(size_t num, size_t size);
|
||||
void SystemArena_Display(void);
|
||||
void SystemArena_GetSizes(u32* outMaxFree, u32* outFree, u32* outAlloc);
|
||||
|
@ -111,7 +111,7 @@
|
||||
#define LOG_FLOAT(exp, value) ((void)0)
|
||||
#endif
|
||||
|
||||
// LogUtils as macro
|
||||
// LogUtils
|
||||
#ifndef NDEBUG
|
||||
#define LOG_POINTER(val, max, ptr, name) LogUtils_LogPointer(val, max, ptr, name, __FILE__, __LINE__)
|
||||
#define LOG_CHECK_BOUNDARY(name, value, unk) LogUtils_CheckBoundary(name, value, unk, __FILE__, __LINE__)
|
||||
|
@ -431,7 +431,7 @@ void GameState_InitArena(GameState* gameState, size_t size) {
|
||||
void* arena;
|
||||
|
||||
osSyncPrintf("ハイラル確保 サイズ=%u バイト\n"); // "Hyrule reserved size = %u bytes"
|
||||
arena = GameAlloc_MallocDebug(&gameState->alloc, size, __FILE__, __LINE__);
|
||||
arena = GameAlloc_MallocDebug(&gameState->alloc, size);
|
||||
if (arena != NULL) {
|
||||
THA_Ct(&gameState->tha, arena, size);
|
||||
osSyncPrintf("ハイラル確保成功\n"); // "Successful Hyral"
|
||||
@ -466,7 +466,7 @@ void GameState_Realloc(GameState* gameState, size_t size) {
|
||||
}
|
||||
|
||||
osSyncPrintf("ハイラル再確保 サイズ=%u バイト\n", size); // "Hyral reallocate size = %u bytes"
|
||||
gameArena = GameAlloc_MallocDebug(alloc, size, __FILE__, __LINE__);
|
||||
gameArena = GameAlloc_MallocDebug(alloc, size);
|
||||
if (gameArena != NULL) {
|
||||
THA_Ct(&gameState->tha, gameArena, size);
|
||||
osSyncPrintf("ハイラル再確保成功\n"); // "Successful reacquisition of Hyrule"
|
||||
@ -569,7 +569,7 @@ u32 GameState_IsRunning(GameState* gameState) {
|
||||
return gameState->running;
|
||||
}
|
||||
|
||||
void* GameState_Alloc(GameState* gameState, size_t size, char* file, s32 line)
|
||||
void* GameState_Alloc(GameState* gameState, size_t size)
|
||||
{
|
||||
void* ret;
|
||||
|
||||
@ -590,7 +590,7 @@ void* GameState_Alloc(GameState* gameState, size_t size, char* file, s32 line)
|
||||
}
|
||||
if (ret != NULL) {
|
||||
osSyncPrintf(VT_FGCOL(GREEN));
|
||||
osSyncPrintf("game_alloc(%08x) %08x-%08x [%s:%d]\n", size, ret, (uintptr_t)ret + size, file, line);
|
||||
osSyncPrintf("game_alloc(%08x) %08x-%08x [%s:%d]\n", size, ret, (uintptr_t)ret + size, __FILE__, __LINE__);
|
||||
osSyncPrintf(VT_RST);
|
||||
}
|
||||
return ret;
|
||||
|
@ -12,8 +12,8 @@ void GameAlloc_Log(GameAlloc* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void* GameAlloc_MallocDebug(GameAlloc* this, size_t size, const char* file, s32 line) {
|
||||
GameAllocEntry* ptr = SystemArena_MallocDebug(size + sizeof(GameAllocEntry), file, line);
|
||||
void* GameAlloc_MallocDebug(GameAlloc* this, size_t size) {
|
||||
GameAllocEntry* ptr = SystemArena_MallocDebug(size + sizeof(GameAllocEntry));
|
||||
|
||||
if (ptr != NULL) {
|
||||
ptr->size = size;
|
||||
@ -29,7 +29,7 @@ void* GameAlloc_MallocDebug(GameAlloc* this, size_t size, const char* file, s32
|
||||
}
|
||||
|
||||
void* GameAlloc_Malloc(GameAlloc* this, size_t size) {
|
||||
GameAllocEntry* ptr = SystemArena_MallocDebug(size + sizeof(GameAllocEntry), __FILE__, __LINE__);
|
||||
GameAllocEntry* ptr = SystemArena_MallocDebug(size + sizeof(GameAllocEntry));
|
||||
|
||||
if (ptr != NULL) {
|
||||
ptr->size = size;
|
||||
@ -54,7 +54,7 @@ void GameAlloc_Free(GameAlloc* this, void* data) {
|
||||
ptr->prev->next = ptr->next;
|
||||
ptr->next->prev = ptr->prev;
|
||||
this->head = this->base.prev;
|
||||
SystemArena_FreeDebug(ptr, __FILE__, __LINE__);
|
||||
SystemArena_FreeDebug(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ void GameAlloc_Cleanup(GameAlloc* this) {
|
||||
while (&this->base != next) {
|
||||
cur = next;
|
||||
next = next->next;
|
||||
SystemArena_FreeDebug(cur, __FILE__, __LINE__);
|
||||
SystemArena_FreeDebug(cur);
|
||||
}
|
||||
|
||||
this->head = &this->base;
|
||||
|
@ -454,7 +454,7 @@ static void RunFrame()
|
||||
size = runFrameContext.ovl->instanceSize;
|
||||
osSyncPrintf("クラスサイズ=%dバイト\n", size); // "Class size = %d bytes"
|
||||
|
||||
runFrameContext.gameState = SystemArena_MallocDebug(size, __FILE__, __LINE__);
|
||||
runFrameContext.gameState = SystemArena_MallocDebug(size);
|
||||
|
||||
if (!runFrameContext.gameState)
|
||||
{
|
||||
@ -495,7 +495,7 @@ static void RunFrame()
|
||||
|
||||
runFrameContext.nextOvl = Graph_GetNextGameState(runFrameContext.gameState);
|
||||
GameState_Destroy(runFrameContext.gameState);
|
||||
SystemArena_FreeDebug(runFrameContext.gameState, __FILE__, __LINE__);
|
||||
SystemArena_FreeDebug(runFrameContext.gameState);
|
||||
Overlay_FreeGameState(runFrameContext.ovl);
|
||||
}
|
||||
Graph_Destroy(&runFrameContext.gfxCtx);
|
||||
|
@ -7,7 +7,7 @@ ListAlloc* ListAlloc_Init(ListAlloc* this) {
|
||||
}
|
||||
|
||||
void* ListAlloc_Alloc(ListAlloc* this, size_t size) {
|
||||
ListAlloc* ptr = SystemArena_MallocDebug(size + sizeof(ListAlloc), __FILE__, __LINE__);
|
||||
ListAlloc* ptr = SystemArena_MallocDebug(size + sizeof(ListAlloc));
|
||||
ListAlloc* next;
|
||||
|
||||
if (ptr == NULL) {
|
||||
@ -49,7 +49,7 @@ void ListAlloc_Free(ListAlloc* this, void* data) {
|
||||
this->next = ptr->prev;
|
||||
}
|
||||
|
||||
SystemArena_FreeDebug(ptr, __FILE__, __LINE__);
|
||||
SystemArena_FreeDebug(ptr);
|
||||
}
|
||||
|
||||
void ListAlloc_FreeAll(ListAlloc* this) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "global.h"
|
||||
|
||||
void* Overlay_AllocateAndLoad(uintptr_t vRomStart, uintptr_t vRomEnd, void* vRamStart, void* vRamEnd) {
|
||||
void* allocatedVRamAddr = SystemArena_MallocRDebug((intptr_t)vRamEnd - (intptr_t)vRamStart, __FILE__, __LINE__);
|
||||
void* allocatedVRamAddr = SystemArena_MallocRDebug((intptr_t)vRamEnd - (intptr_t)vRamStart);
|
||||
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
osSyncPrintf("OVL:SPEC(%08x-%08x) REAL(%08x-%08x) OFFSET(%08x)\n", vRamStart, vRamEnd, allocatedVRamAddr,
|
||||
|
@ -75,7 +75,7 @@ void Main(void* arg) {
|
||||
debugHeapSize = (0x80600000 - (uintptr_t)debugHeap);
|
||||
} else {
|
||||
debugHeapSize = 0x400;
|
||||
debugHeap = SystemArena_MallocDebug(debugHeapSize, __FILE__, __LINE__);
|
||||
debugHeap = SystemArena_MallocDebug(debugHeapSize);
|
||||
}
|
||||
|
||||
debugHeapSize = 1024 * 64;
|
||||
|
@ -22,7 +22,7 @@ MtxF* sMatrixStack; // "Matrix_stack"
|
||||
MtxF* sCurrentMatrix; // "Matrix_now"
|
||||
|
||||
void Matrix_Init(GameState* gameState) {
|
||||
sCurrentMatrix = GameState_Alloc(gameState, 20 * sizeof(MtxF), __FILE__, __LINE__);
|
||||
sCurrentMatrix = GameState_Alloc(gameState, 20 * sizeof(MtxF));
|
||||
sMatrixStack = sCurrentMatrix;
|
||||
}
|
||||
|
||||
|
@ -29,8 +29,8 @@ void* SystemArena_Malloc(size_t size) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void* SystemArena_MallocDebug(size_t size, const char* file, s32 line) {
|
||||
void* ptr = __osMallocDebug(&gSystemArena, size, file, line);
|
||||
void* SystemArena_MallocDebug(size_t size) {
|
||||
void* ptr = __osMallocDebug(&gSystemArena, size, __FILE__, __LINE__);
|
||||
|
||||
SystemArena_CheckPointer(ptr, size, "malloc_DEBUG", "確保"); // "Secure"
|
||||
return ptr;
|
||||
@ -43,8 +43,8 @@ void* SystemArena_MallocR(size_t size) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void* SystemArena_MallocRDebug(size_t size, const char* file, s32 line) {
|
||||
void* ptr = __osMallocRDebug(&gSystemArena, size, file, line);
|
||||
void* SystemArena_MallocRDebug(size_t size) {
|
||||
void* ptr = __osMallocRDebug(&gSystemArena, size, __FILE__, __LINE__);
|
||||
|
||||
SystemArena_CheckPointer(ptr, size, "malloc_r_DEBUG", "確保"); // "Secure"
|
||||
return ptr;
|
||||
@ -56,8 +56,8 @@ void* SystemArena_Realloc(void* ptr, size_t newSize) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void* SystemArena_ReallocDebug(void* ptr, size_t newSize, const char* file, s32 line) {
|
||||
ptr = __osReallocDebug(&gSystemArena, ptr, newSize, file, line);
|
||||
void* SystemArena_ReallocDebug(void* ptr, size_t newSize) {
|
||||
ptr = __osReallocDebug(&gSystemArena, ptr, newSize, __FILE__, __LINE__);
|
||||
SystemArena_CheckPointer(ptr, newSize, "realloc_DEBUG", "再確保"); // "Re-securing"
|
||||
return ptr;
|
||||
}
|
||||
@ -66,8 +66,8 @@ void SystemArena_Free(void* ptr) {
|
||||
__osFree(&gSystemArena, ptr);
|
||||
}
|
||||
|
||||
void SystemArena_FreeDebug(void* ptr, const char* file, s32 line) {
|
||||
__osFreeDebug(&gSystemArena, ptr, file, line);
|
||||
void SystemArena_FreeDebug(void* ptr) {
|
||||
__osFreeDebug(&gSystemArena, ptr, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void* SystemArena_Calloc(size_t num, size_t size) {
|
||||
|
@ -104,7 +104,7 @@ void Overlay_FreeGameState(GameStateOverlay* overlayEntry) {
|
||||
overlayEntry->unk_24 = NULL;
|
||||
}
|
||||
|
||||
SystemArena_FreeDebug(overlayEntry->loadedRamAddr, __FILE__, __LINE__);
|
||||
SystemArena_FreeDebug(overlayEntry->loadedRamAddr);
|
||||
overlayEntry->loadedRamAddr = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -2889,7 +2889,7 @@ void func_80031C3C(ActorContext* actorCtx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
if (actorCtx->absoluteSpace != NULL) {
|
||||
ZeldaArena_FreeDebug(actorCtx->absoluteSpace, __FILE__, __LINE__);
|
||||
ZeldaArena_FreeDebug(actorCtx->absoluteSpace);
|
||||
actorCtx->absoluteSpace = NULL;
|
||||
}
|
||||
|
||||
@ -2980,7 +2980,7 @@ void Actor_FreeOverlay(ActorOverlay* actorOverlay) {
|
||||
if (HREG(20) != 0) {
|
||||
osSyncPrintf("オーバーレイ解放します\n"); // "Overlay deallocated"
|
||||
}
|
||||
ZeldaArena_FreeDebug(actorOverlay->loadedRamAddr, __FILE__, __LINE__);
|
||||
ZeldaArena_FreeDebug(actorOverlay->loadedRamAddr);
|
||||
actorOverlay->loadedRamAddr = NULL;
|
||||
}
|
||||
}
|
||||
@ -3039,7 +3039,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId
|
||||
|
||||
if (actorCtx->absoluteSpace == NULL) {
|
||||
// "AMF: absolute magic field"
|
||||
actorCtx->absoluteSpace = ZeldaArena_MallocRDebug(AM_FIELD_SIZE, "AMF:絶対魔法領域", 0);
|
||||
actorCtx->absoluteSpace = ZeldaArena_MallocRDebug(AM_FIELD_SIZE);
|
||||
if (HREG(20) != 0) {
|
||||
// "Absolute magic field reservation - %d bytes reserved"
|
||||
osSyncPrintf("絶対魔法領域確保 %d バイト確保\n", AM_FIELD_SIZE);
|
||||
@ -3048,9 +3048,9 @@ Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId
|
||||
|
||||
overlayEntry->loadedRamAddr = actorCtx->absoluteSpace;
|
||||
} else if (overlayEntry->allocType & ALLOCTYPE_PERMANENT) {
|
||||
overlayEntry->loadedRamAddr = ZeldaArena_MallocRDebug(overlaySize, name, 0);
|
||||
overlayEntry->loadedRamAddr = ZeldaArena_MallocRDebug(overlaySize);
|
||||
} else {
|
||||
overlayEntry->loadedRamAddr = ZeldaArena_MallocDebug(overlaySize, name, 0);
|
||||
overlayEntry->loadedRamAddr = ZeldaArena_MallocDebug(overlaySize);
|
||||
}
|
||||
|
||||
if (overlayEntry->loadedRamAddr == NULL) {
|
||||
@ -3092,7 +3092,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId
|
||||
return NULL;
|
||||
}
|
||||
|
||||
actor = ZeldaArena_MallocDebug(actorInit->instanceSize, name, 1);
|
||||
actor = ZeldaArena_MallocDebug(actorInit->instanceSize);
|
||||
|
||||
if (actor == NULL) {
|
||||
// "Actor class cannot be reserved! %s <size=%d bytes>"
|
||||
@ -3236,7 +3236,7 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalC
|
||||
|
||||
newHead = Actor_RemoveFromCategory(globalCtx, actorCtx, actor);
|
||||
|
||||
ZeldaArena_FreeDebug(actor, __FILE__, __LINE__);
|
||||
ZeldaArena_FreeDebug(actor);
|
||||
|
||||
/* if (overlayEntry->vramStart == 0) {
|
||||
if (HREG(20) != 0) {
|
||||
@ -3414,15 +3414,15 @@ void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, GlobalContext* globalCtx)
|
||||
u32 objectIdsSize;
|
||||
|
||||
matricesSize = (count + 1) * sizeof(*bodyBreak->matrices);
|
||||
bodyBreak->matrices = ZeldaArena_MallocDebug(matricesSize, __FILE__, __LINE__);
|
||||
bodyBreak->matrices = ZeldaArena_MallocDebug(matricesSize);
|
||||
|
||||
if (bodyBreak->matrices != NULL) {
|
||||
dListsSize = (count + 1) * sizeof(*bodyBreak->dLists);
|
||||
bodyBreak->dLists = ZeldaArena_MallocDebug(dListsSize, __FILE__, __LINE__);
|
||||
bodyBreak->dLists = ZeldaArena_MallocDebug(dListsSize);
|
||||
|
||||
if (bodyBreak->dLists != NULL) {
|
||||
objectIdsSize = (count + 1) * sizeof(*bodyBreak->objectIds);
|
||||
bodyBreak->objectIds = ZeldaArena_MallocDebug(objectIdsSize, __FILE__, __LINE__);
|
||||
bodyBreak->objectIds = ZeldaArena_MallocDebug(objectIdsSize);
|
||||
|
||||
if (bodyBreak->objectIds != NULL) {
|
||||
memset((u8*)bodyBreak->matrices,0, matricesSize);
|
||||
@ -3435,15 +3435,15 @@ void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, GlobalContext* globalCtx)
|
||||
}
|
||||
|
||||
if (bodyBreak->matrices != NULL) {
|
||||
ZeldaArena_FreeDebug(bodyBreak->matrices, __FILE__, __LINE__);
|
||||
ZeldaArena_FreeDebug(bodyBreak->matrices);
|
||||
}
|
||||
|
||||
if (bodyBreak->dLists != NULL) {
|
||||
ZeldaArena_FreeDebug(bodyBreak->dLists, __FILE__, __LINE__);
|
||||
ZeldaArena_FreeDebug(bodyBreak->dLists);
|
||||
}
|
||||
|
||||
if (bodyBreak->objectIds != NULL) {
|
||||
ZeldaArena_FreeDebug(bodyBreak->objectIds, __FILE__, __LINE__);
|
||||
ZeldaArena_FreeDebug(bodyBreak->objectIds);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3510,9 +3510,9 @@ s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, GlobalContext* glob
|
||||
|
||||
bodyBreak->val = BODYBREAK_STATUS_FINISHED;
|
||||
|
||||
ZeldaArena_FreeDebug(bodyBreak->matrices, __FILE__, __LINE__);
|
||||
ZeldaArena_FreeDebug(bodyBreak->dLists, __FILE__, __LINE__);
|
||||
ZeldaArena_FreeDebug(bodyBreak->objectIds, __FILE__, __LINE__);
|
||||
ZeldaArena_FreeDebug(bodyBreak->matrices);
|
||||
ZeldaArena_FreeDebug(bodyBreak->dLists);
|
||||
ZeldaArena_FreeDebug(bodyBreak->objectIds);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2428,7 +2428,7 @@ void SSNodeList_Alloc(GlobalContext* globalCtx, SSNodeList* this, s32 tblMax, s3
|
||||
|
||||
ASSERT(this->tbl != NULL);
|
||||
|
||||
this->polyCheckTbl = GameState_Alloc(&globalCtx->state, numPolys, __FILE__, __LINE__);
|
||||
this->polyCheckTbl = GameState_Alloc(&globalCtx->state, numPolys);
|
||||
|
||||
ASSERT(this->polyCheckTbl != NULL);
|
||||
}
|
||||
|
@ -6757,7 +6757,7 @@ s32 Camera_Special9(Camera* camera) {
|
||||
}
|
||||
|
||||
Camera* Camera_Create(View* view, CollisionContext* colCtx, GlobalContext* globalCtx) {
|
||||
Camera* newCamera = ZeldaArena_MallocDebug(sizeof(*newCamera), __FILE__, __LINE__);
|
||||
Camera* newCamera = ZeldaArena_MallocDebug(sizeof(*newCamera));
|
||||
|
||||
if (newCamera != NULL) {
|
||||
osSyncPrintf(VT_FGCOL(BLUE) "camera: create --- allocate %d byte" VT_RST "\n", sizeof(*newCamera) * 4);
|
||||
@ -6771,7 +6771,7 @@ Camera* Camera_Create(View* view, CollisionContext* colCtx, GlobalContext* globa
|
||||
void Camera_Destroy(Camera* camera) {
|
||||
if (camera != NULL) {
|
||||
osSyncPrintf(VT_FGCOL(BLUE) "camera: destroy ---" VT_RST "\n");
|
||||
ZeldaArena_FreeDebug(camera, __FILE__, __LINE__);
|
||||
ZeldaArena_FreeDebug(camera);
|
||||
} else {
|
||||
osSyncPrintf(VT_COL(YELLOW, BLACK) "camera: destroy: already cleared\n" VT_RST);
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ s32 Collider_FreeJntSph(GlobalContext* globalCtx, ColliderJntSph* collider) {
|
||||
|
||||
collider->count = 0;
|
||||
if (collider->elements != NULL) {
|
||||
ZeldaArena_FreeDebug(collider->elements, __FILE__, __LINE__);
|
||||
ZeldaArena_FreeDebug(collider->elements);
|
||||
}
|
||||
collider->elements = NULL;
|
||||
return 1;
|
||||
@ -367,7 +367,7 @@ s32 Collider_SetJntSphToActor(GlobalContext* globalCtx, ColliderJntSph* dest, Co
|
||||
|
||||
Collider_SetBaseToActor(globalCtx, &dest->base, &src->base);
|
||||
dest->count = src->count;
|
||||
dest->elements = ZeldaArena_MallocDebug(src->count * sizeof(ColliderJntSphElement), __FILE__, __LINE__);
|
||||
dest->elements = ZeldaArena_MallocDebug(src->count * sizeof(ColliderJntSphElement));
|
||||
|
||||
if (dest->elements == NULL) {
|
||||
dest->count = 0;
|
||||
@ -396,7 +396,7 @@ s32 Collider_SetJntSphAllocType1(GlobalContext* globalCtx, ColliderJntSph* dest,
|
||||
|
||||
Collider_SetBaseType1(globalCtx, &dest->base, actor, &src->base);
|
||||
dest->count = src->count;
|
||||
dest->elements = ZeldaArena_MallocDebug(src->count * sizeof(ColliderJntSphElement), __FILE__, __LINE__);
|
||||
dest->elements = ZeldaArena_MallocDebug(src->count * sizeof(ColliderJntSphElement));
|
||||
|
||||
if (dest->elements == NULL) {
|
||||
dest->count = 0;
|
||||
@ -424,7 +424,7 @@ s32 Collider_SetJntSphAlloc(GlobalContext* globalCtx, ColliderJntSph* dest, Acto
|
||||
|
||||
Collider_SetBase(globalCtx, &dest->base, actor, &src->base);
|
||||
dest->count = src->count;
|
||||
dest->elements = ZeldaArena_MallocDebug(src->count * sizeof(ColliderJntSphElement), __FILE__, __LINE__);
|
||||
dest->elements = ZeldaArena_MallocDebug(src->count * sizeof(ColliderJntSphElement));
|
||||
|
||||
if (dest->elements == NULL) {
|
||||
dest->count = 0;
|
||||
@ -702,7 +702,7 @@ s32 Collider_FreeTris(GlobalContext* globalCtx, ColliderTris* tris) {
|
||||
|
||||
tris->count = 0;
|
||||
if (tris->elements != NULL) {
|
||||
ZeldaArena_FreeDebug(tris->elements, __FILE__, __LINE__);
|
||||
ZeldaArena_FreeDebug(tris->elements);
|
||||
}
|
||||
tris->elements = NULL;
|
||||
return 1;
|
||||
@ -734,7 +734,7 @@ s32 Collider_SetTrisAllocType1(GlobalContext* globalCtx, ColliderTris* dest, Act
|
||||
|
||||
Collider_SetBaseType1(globalCtx, &dest->base, actor, &src->base);
|
||||
dest->count = src->count;
|
||||
dest->elements = ZeldaArena_MallocDebug(dest->count * sizeof(ColliderTrisElement), __FILE__, __LINE__);
|
||||
dest->elements = ZeldaArena_MallocDebug(dest->count * sizeof(ColliderTrisElement));
|
||||
if (dest->elements == NULL) {
|
||||
dest->count = 0;
|
||||
osSyncPrintf(VT_FGCOL(RED));
|
||||
@ -760,7 +760,7 @@ s32 Collider_SetTrisAlloc(GlobalContext* globalCtx, ColliderTris* dest, Actor* a
|
||||
|
||||
Collider_SetBase(globalCtx, &dest->base, actor, &src->base);
|
||||
dest->count = src->count;
|
||||
dest->elements = ZeldaArena_MallocDebug(dest->count * sizeof(ColliderTrisElement), __FILE__, __LINE__);
|
||||
dest->elements = ZeldaArena_MallocDebug(dest->count * sizeof(ColliderTrisElement));
|
||||
|
||||
if (dest->elements == NULL) {
|
||||
osSyncPrintf(VT_FGCOL(RED));
|
||||
|
@ -34,7 +34,7 @@ void func_801109B0(GlobalContext* globalCtx) {
|
||||
// "Permanent PARAMETER Segment = %x"
|
||||
osSyncPrintf("常駐PARAMETERセグメント=%x\n", parameterSize);
|
||||
|
||||
interfaceCtx->parameterSegment = GameState_Alloc(&globalCtx->state, parameterSize, __FILE__, __LINE__);
|
||||
interfaceCtx->parameterSegment = GameState_Alloc(&globalCtx->state, parameterSize);
|
||||
|
||||
osSyncPrintf("parameter->parameterSegment=%x\n", interfaceCtx->parameterSegment);
|
||||
|
||||
@ -42,7 +42,7 @@ void func_801109B0(GlobalContext* globalCtx) {
|
||||
DmaMgr_SendRequest1(interfaceCtx->parameterSegment, (uintptr_t)_parameter_staticSegmentRomStart, parameterSize,
|
||||
__FILE__, 162);
|
||||
|
||||
interfaceCtx->doActionSegment = GameState_Alloc(&globalCtx->state, 0x480, __FILE__, __LINE__);
|
||||
interfaceCtx->doActionSegment = GameState_Alloc(&globalCtx->state, 0x480);
|
||||
|
||||
osSyncPrintf("DOアクション テクスチャ初期=%x\n", 0x480); // "DO Action Texture Initialization"
|
||||
osSyncPrintf("parameter->do_actionSegment=%x\n", interfaceCtx->doActionSegment);
|
||||
@ -75,7 +75,7 @@ void func_801109B0(GlobalContext* globalCtx) {
|
||||
//0x180);
|
||||
|
||||
interfaceCtx->iconItemSegment = GameState_Alloc(
|
||||
&globalCtx->state, 0x1000 * ARRAY_COUNT(gSaveContext.equips.buttonItems), __FILE__, __LINE__);
|
||||
&globalCtx->state, 0x1000 * ARRAY_COUNT(gSaveContext.equips.buttonItems));
|
||||
|
||||
// "Icon Item Texture Initialization = %x"
|
||||
osSyncPrintf("アイコンアイテム テクスチャ初期=%x\n", 0x4000);
|
||||
@ -171,7 +171,7 @@ void Message_Init(GlobalContext* globalCtx) {
|
||||
|
||||
View_Init(&msgCtx->view, globalCtx->state.gfxCtx);
|
||||
|
||||
msgCtx->textboxSegment = GameState_Alloc(&globalCtx->state, 0x2200, __FILE__, __LINE__);
|
||||
msgCtx->textboxSegment = GameState_Alloc(&globalCtx->state, 0x2200);
|
||||
|
||||
osSyncPrintf("message->fukidashiSegment=%x\n", msgCtx->textboxSegment);
|
||||
|
||||
|
@ -37,7 +37,7 @@ char regChar[] = " SOPQMYDUIZCNKXcsiWAVHGmnBdkb";
|
||||
void func_800636C0(void) {
|
||||
s32 i;
|
||||
|
||||
gGameInfo = (GameInfo*)SystemArena_MallocDebug(sizeof(GameInfo), __FILE__, __LINE__);
|
||||
gGameInfo = (GameInfo*)SystemArena_MallocDebug(sizeof(GameInfo));
|
||||
gGameInfo->regPage = 0;
|
||||
gGameInfo->regGroup = 0;
|
||||
gGameInfo->regCur = 0;
|
||||
|
@ -17,7 +17,7 @@ void EffectSs_InitInfo(GlobalContext* globalCtx, s32 tableSize) {
|
||||
}
|
||||
|
||||
sEffectSsInfo.table =
|
||||
GameState_Alloc(&globalCtx->state, tableSize * sizeof(EffectSs), __FILE__, __LINE__);
|
||||
GameState_Alloc(&globalCtx->state, tableSize * sizeof(EffectSs));
|
||||
ASSERT(sEffectSsInfo.table != NULL);
|
||||
|
||||
sEffectSsInfo.searchStartIndex = 0;
|
||||
@ -54,7 +54,7 @@ void EffectSs_ClearAll(GlobalContext* globalCtx) {
|
||||
addr = overlay->loadedRamAddr;
|
||||
|
||||
if (addr != NULL) {
|
||||
ZeldaArena_FreeDebug(addr, __FILE__, __LINE__);
|
||||
ZeldaArena_FreeDebug(addr);
|
||||
}
|
||||
|
||||
overlay->loadedRamAddr = NULL;
|
||||
@ -191,7 +191,7 @@ void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* init
|
||||
initInfo = overlayEntry->initInfo;
|
||||
} else {
|
||||
if (overlayEntry->loadedRamAddr == NULL) {
|
||||
overlayEntry->loadedRamAddr = ZeldaArena_MallocRDebug(overlaySize, __FILE__, __LINE__);
|
||||
overlayEntry->loadedRamAddr = ZeldaArena_MallocRDebug(overlaySize);
|
||||
|
||||
if (overlayEntry->loadedRamAddr == NULL) {
|
||||
osSyncPrintf(VT_FGCOL(RED));
|
||||
|
@ -111,19 +111,19 @@ void TransitionUnk_Destroy(TransitionUnk* this) {
|
||||
Sleep_Msec(100);
|
||||
|
||||
if (this->unk_0C != NULL) {
|
||||
SystemArena_FreeDebug(this->unk_0C, __FILE__, __LINE__);
|
||||
SystemArena_FreeDebug(this->unk_0C);
|
||||
this->unk_0C = NULL;
|
||||
}
|
||||
if (this->vtxFrame1 != NULL) {
|
||||
SystemArena_FreeDebug(this->vtxFrame1, __FILE__, __LINE__);
|
||||
SystemArena_FreeDebug(this->vtxFrame1);
|
||||
this->vtxFrame1 = NULL;
|
||||
}
|
||||
if (this->vtxFrame2 != NULL) {
|
||||
SystemArena_FreeDebug(this->vtxFrame2, __FILE__, __LINE__);
|
||||
SystemArena_FreeDebug(this->vtxFrame2);
|
||||
this->vtxFrame2 = NULL;
|
||||
}
|
||||
if (this->gfx != NULL) {
|
||||
SystemArena_FreeDebug(this->gfx, __FILE__, __LINE__);
|
||||
SystemArena_FreeDebug(this->gfx);
|
||||
this->gfx = NULL;
|
||||
}
|
||||
}
|
||||
@ -134,27 +134,27 @@ TransitionUnk* TransitionUnk_Init(TransitionUnk* this, s32 row, s32 col) {
|
||||
this->frame = 0;
|
||||
this->row = row;
|
||||
this->col = col;
|
||||
this->unk_0C = SystemArena_MallocDebug((row + 1) * sizeof(TransitionUnkData) * (col + 1), __FILE__, __LINE__);
|
||||
this->vtxFrame1 = SystemArena_MallocDebug((row + 1) * sizeof(Vtx) * (col + 1), __FILE__, __LINE__);
|
||||
this->vtxFrame2 = SystemArena_MallocDebug((row + 1) * sizeof(Vtx) * (col + 1), __FILE__, __LINE__);
|
||||
this->gfx = SystemArena_MallocDebug((this->col * (1 + this->row * 9) + 2) * sizeof(Gfx), __FILE__, __LINE__);
|
||||
this->unk_0C = SystemArena_MallocDebug((row + 1) * sizeof(TransitionUnkData) * (col + 1));
|
||||
this->vtxFrame1 = SystemArena_MallocDebug((row + 1) * sizeof(Vtx) * (col + 1));
|
||||
this->vtxFrame2 = SystemArena_MallocDebug((row + 1) * sizeof(Vtx) * (col + 1));
|
||||
this->gfx = SystemArena_MallocDebug((this->col * (1 + this->row * 9) + 2) * sizeof(Gfx));
|
||||
|
||||
if (this->unk_0C == NULL || this->vtxFrame1 == NULL || this->vtxFrame2 == NULL || this->gfx == NULL) {
|
||||
osSyncPrintf("fbdemo_init allocation error\n");
|
||||
if (this->unk_0C != NULL) {
|
||||
SystemArena_FreeDebug(this->unk_0C, __FILE__, __LINE__);
|
||||
SystemArena_FreeDebug(this->unk_0C);
|
||||
this->unk_0C = NULL;
|
||||
}
|
||||
if (this->vtxFrame1 != NULL) {
|
||||
SystemArena_FreeDebug(this->vtxFrame1, __FILE__, __LINE__);
|
||||
SystemArena_FreeDebug(this->vtxFrame1);
|
||||
this->vtxFrame1 = NULL;
|
||||
}
|
||||
if (this->vtxFrame2 != NULL) {
|
||||
SystemArena_FreeDebug(this->vtxFrame2, __FILE__, __LINE__);
|
||||
SystemArena_FreeDebug(this->vtxFrame2);
|
||||
this->vtxFrame2 = NULL;
|
||||
}
|
||||
if (this->gfx != NULL) {
|
||||
SystemArena_FreeDebug(this->gfx, __FILE__, __LINE__);
|
||||
SystemArena_FreeDebug(this->gfx);
|
||||
this->gfx = NULL;
|
||||
}
|
||||
return NULL;
|
||||
|
@ -23,8 +23,7 @@ s32 SkelCurve_Init(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, SkelCurv
|
||||
skelCurve->limbCount = limbList->limbCount;
|
||||
skelCurve->limbList = SEGMENTED_TO_VIRTUAL(limbList->limbs);
|
||||
|
||||
skelCurve->transforms = ZeldaArena_MallocDebug(sizeof(*skelCurve->transforms) * skelCurve->limbCount,
|
||||
__FILE__, __LINE__);
|
||||
skelCurve->transforms = ZeldaArena_MallocDebug(sizeof(*skelCurve->transforms) * skelCurve->limbCount);
|
||||
ASSERT(skelCurve->transforms != NULL);
|
||||
skelCurve->animCurFrame = 0.0f;
|
||||
return 1;
|
||||
@ -32,7 +31,7 @@ s32 SkelCurve_Init(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, SkelCurv
|
||||
|
||||
void SkelCurve_Destroy(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve) {
|
||||
if (skelCurve->transforms != NULL) {
|
||||
ZeldaArena_FreeDebug(skelCurve->transforms, __FILE__, __LINE__);
|
||||
ZeldaArena_FreeDebug(skelCurve->transforms);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ void KaleidoManager_Init(GlobalContext* globalCtx) {
|
||||
osSyncPrintf("KaleidoArea の最大サイズは %d バイトを確保します\n", largestSize);
|
||||
osSyncPrintf(VT_RST);
|
||||
|
||||
sKaleidoAreaPtr = GameState_Alloc(&globalCtx->state, largestSize, __FILE__, __LINE__);
|
||||
sKaleidoAreaPtr = GameState_Alloc(&globalCtx->state, largestSize);
|
||||
LOG_CHECK_NULL_POINTER("KaleidoArea_allocp", sKaleidoAreaPtr);
|
||||
|
||||
osSyncPrintf(VT_FGCOL(GREEN));
|
||||
|
@ -28,8 +28,8 @@ void* ZeldaArena_Malloc(size_t size) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void* ZeldaArena_MallocDebug(size_t size, const char* file, s32 line) {
|
||||
void* ptr = __osMallocDebug(&sZeldaArena, size, file, line);
|
||||
void* ZeldaArena_MallocDebug(size_t size) {
|
||||
void* ptr = __osMallocDebug(&sZeldaArena, size, __FILE__, __LINE__);
|
||||
|
||||
ZeldaArena_CheckPointer(ptr, size, "zelda_malloc_DEBUG", "確保"); // "Secure"
|
||||
return ptr;
|
||||
@ -42,8 +42,8 @@ void* ZeldaArena_MallocR(size_t size) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void* ZeldaArena_MallocRDebug(size_t size, const char* file, s32 line) {
|
||||
void* ptr = __osMallocRDebug(&sZeldaArena, size, file, line);
|
||||
void* ZeldaArena_MallocRDebug(size_t size) {
|
||||
void* ptr = __osMallocRDebug(&sZeldaArena, size, __FILE__, __LINE__);
|
||||
|
||||
ZeldaArena_CheckPointer(ptr, size, "zelda_malloc_r_DEBUG", "確保"); // "Secure"
|
||||
return ptr;
|
||||
@ -55,8 +55,8 @@ void* ZeldaArena_Realloc(void* ptr, size_t newSize) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void* ZeldaArena_ReallocDebug(void* ptr, size_t newSize, const char* file, s32 line) {
|
||||
ptr = __osReallocDebug(&sZeldaArena, ptr, newSize, file, line);
|
||||
void* ZeldaArena_ReallocDebug(void* ptr, size_t newSize) {
|
||||
ptr = __osReallocDebug(&sZeldaArena, ptr, newSize, __FILE__, __LINE__);
|
||||
ZeldaArena_CheckPointer(ptr, newSize, "zelda_realloc_DEBUG", "再確保"); // "Re-securing"
|
||||
return ptr;
|
||||
}
|
||||
@ -65,8 +65,8 @@ void ZeldaArena_Free(void* ptr) {
|
||||
__osFree(&sZeldaArena, ptr);
|
||||
}
|
||||
|
||||
void ZeldaArena_FreeDebug(void* ptr, const char* file, s32 line) {
|
||||
__osFreeDebug(&sZeldaArena, ptr, file, line);
|
||||
void ZeldaArena_FreeDebug(void* ptr) {
|
||||
__osFreeDebug(&sZeldaArena, ptr, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void* ZeldaArena_Calloc(size_t num, size_t size) {
|
||||
|
@ -516,7 +516,7 @@ void Map_Init(GlobalContext* globalCtx) {
|
||||
interfaceCtx->unk_258 = -1;
|
||||
interfaceCtx->unk_25A = -1;
|
||||
|
||||
interfaceCtx->mapSegment = GameState_Alloc(&globalCtx->state, 0x1000, __FILE__, __LINE__);
|
||||
interfaceCtx->mapSegment = GameState_Alloc(&globalCtx->state, 0x1000);
|
||||
// "MAP texture initialization scene_data_ID=%d mapSegment=%x"
|
||||
osSyncPrintf("\n\n\nMAP テクスチャ初期化 scene_data_ID=%d\nmapSegment=%x\n\n", globalCtx->sceneNum,
|
||||
interfaceCtx->mapSegment, globalCtx);
|
||||
|
@ -58,7 +58,7 @@ void MapMark_Init(GlobalContext* globalCtx) {
|
||||
MapMarkDataOverlay* overlay = &sMapMarkDataOvl;
|
||||
u32 overlaySize = (uintptr_t)overlay->vramEnd - (uintptr_t)overlay->vramStart;
|
||||
|
||||
overlay->loadedRamAddr = GameState_Alloc(&globalCtx->state, overlaySize, __FILE__, __LINE__);
|
||||
overlay->loadedRamAddr = GameState_Alloc(&globalCtx->state, overlaySize);
|
||||
LOG_CHECK_NULL_POINTER("dlftbl->allocp", overlay->loadedRamAddr);
|
||||
|
||||
Overlay_Load(overlay->vromStart, overlay->vromEnd, overlay->vramStart, overlay->vramEnd, overlay->loadedRamAddr);
|
||||
|
@ -365,7 +365,7 @@ void Gameplay_Init(GameState* thisx) {
|
||||
|
||||
osSyncPrintf("ZELDA ALLOC SIZE=%x\n", THA_GetSize(&globalCtx->state.tha));
|
||||
zAllocSize = THA_GetSize(&globalCtx->state.tha);
|
||||
zAlloc = GameState_Alloc(&globalCtx->state, zAllocSize, __FILE__, __LINE__);
|
||||
zAlloc = GameState_Alloc(&globalCtx->state, zAllocSize);
|
||||
zAllocAligned = (zAlloc + 8) & ~0xF;
|
||||
ZeldaArena_Init(zAllocAligned, zAllocSize - zAllocAligned + zAlloc);
|
||||
// "Zelda Heap"
|
||||
@ -1465,7 +1465,7 @@ void* Gameplay_LoadFile(GlobalContext* globalCtx, RomFile* file) {
|
||||
void* allocp;
|
||||
|
||||
size = file->vromEnd - file->vromStart;
|
||||
allocp = GameState_Alloc(&globalCtx->state, size, __FILE__, __LINE__);
|
||||
allocp = GameState_Alloc(&globalCtx->state, size);
|
||||
DmaMgr_SendRequest1(allocp, file->vromStart, size, __FILE__, __LINE__);
|
||||
|
||||
return allocp;
|
||||
|
@ -550,7 +550,7 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) {
|
||||
osSyncPrintf(VT_FGCOL(YELLOW));
|
||||
// "Room buffer size=%08x(%5.1fK)"
|
||||
osSyncPrintf("部屋バッファサイズ=%08x(%5.1fK)\n", maxRoomSize, maxRoomSize / 1024.0f);
|
||||
roomCtx->bufPtrs[0] = GameState_Alloc(&globalCtx->state, maxRoomSize, __FILE__, __LINE__);
|
||||
roomCtx->bufPtrs[0] = GameState_Alloc(&globalCtx->state, maxRoomSize);
|
||||
// "Room buffer initial pointer=%08x"
|
||||
osSyncPrintf("部屋バッファ開始ポインタ=%08x\n", roomCtx->bufPtrs[0]);
|
||||
roomCtx->bufPtrs[1] = (void*)((intptr_t)roomCtx->bufPtrs[0] + maxRoomSize);
|
||||
|
@ -79,7 +79,7 @@ void Sample_SetupView(SampleContext* this) {
|
||||
void Sample_LoadTitleStatic(SampleContext* this) {
|
||||
size_t size = _title_staticSegmentRomEnd - _title_staticSegmentRomStart;
|
||||
|
||||
this->staticSegment = GameState_Alloc(&this->state, size, __FILE__, __LINE__);
|
||||
this->staticSegment = GameState_Alloc(&this->state, size);
|
||||
DmaMgr_SendRequest1(this->staticSegment, _title_staticSegmentRomStart, size, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ void Object_InitBank(GlobalContext* globalCtx, ObjectContext* objectCtx) {
|
||||
osSyncPrintf(VT_RST);
|
||||
|
||||
objectCtx->spaceStart = objectCtx->status[0].segment =
|
||||
GameState_Alloc(&globalCtx->state, spaceSize, __FILE__, __LINE__);
|
||||
GameState_Alloc(&globalCtx->state, spaceSize);
|
||||
objectCtx->spaceEnd = (void*)((uintptr_t)objectCtx->spaceStart + spaceSize);
|
||||
|
||||
objectCtx->mainKeepIndex = Object_Spawn(objectCtx, OBJECT_GAMEPLAY_KEEP);
|
||||
|
@ -1099,8 +1099,8 @@ void SkelAnime_InitLink(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkel
|
||||
}
|
||||
|
||||
if (jointTable == NULL) {
|
||||
skelAnime->jointTable = ZeldaArena_MallocDebug(allocSize, __FILE__, __LINE__);
|
||||
skelAnime->morphTable = ZeldaArena_MallocDebug(allocSize, __FILE__, __LINE__);
|
||||
skelAnime->jointTable = ZeldaArena_MallocDebug(allocSize);
|
||||
skelAnime->morphTable = ZeldaArena_MallocDebug(allocSize);
|
||||
} else {
|
||||
ASSERT(limbBufCount == limbCount);
|
||||
|
||||
@ -1427,9 +1427,9 @@ s32 SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeade
|
||||
skelAnime->skeleton = SEGMENTED_TO_VIRTUAL(skeletonHeader->segment);
|
||||
if (jointTable == NULL) {
|
||||
skelAnime->jointTable =
|
||||
ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->jointTable), __FILE__, __LINE__);
|
||||
ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->jointTable));
|
||||
skelAnime->morphTable =
|
||||
ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->morphTable), __FILE__, __LINE__);
|
||||
ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->morphTable));
|
||||
} else {
|
||||
ASSERT(limbCount == skelAnime->limbCount);
|
||||
skelAnime->jointTable = jointTable;
|
||||
@ -1462,10 +1462,10 @@ s32 SkelAnime_InitFlex(GlobalContext* globalCtx, SkelAnime* skelAnime, FlexSkele
|
||||
|
||||
if (jointTable == NULL) {
|
||||
skelAnime->jointTable =
|
||||
ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->jointTable), __FILE__, __LINE__);
|
||||
ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->jointTable));
|
||||
|
||||
skelAnime->morphTable =
|
||||
ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->morphTable), __FILE__, __LINE__);
|
||||
ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->morphTable));
|
||||
} else {
|
||||
ASSERT(limbCount == skelAnime->limbCount);
|
||||
skelAnime->jointTable = jointTable;
|
||||
@ -1496,9 +1496,9 @@ s32 SkelAnime_InitSkin(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonH
|
||||
skelAnime->limbCount = skeletonHeader->limbCount + 1;
|
||||
skelAnime->skeleton = SEGMENTED_TO_VIRTUAL(skeletonHeader->segment);
|
||||
skelAnime->jointTable =
|
||||
ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->jointTable), __FILE__, __LINE__);
|
||||
ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->jointTable));
|
||||
skelAnime->morphTable =
|
||||
ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->morphTable), __FILE__, __LINE__);
|
||||
ZeldaArena_MallocDebug(skelAnime->limbCount * sizeof(*skelAnime->morphTable));
|
||||
if ((skelAnime->jointTable == NULL) || (skelAnime->morphTable == NULL)) {
|
||||
osSyncPrintf(VT_FGCOL(RED));
|
||||
// "Memory allocation error"
|
||||
@ -1892,13 +1892,13 @@ s32 Animation_OnFrame(SkelAnime* skelAnime, f32 frame) {
|
||||
*/
|
||||
void SkelAnime_Free(SkelAnime* skelAnime, GlobalContext* globalCtx) {
|
||||
if (skelAnime->jointTable != NULL) {
|
||||
ZeldaArena_FreeDebug(skelAnime->jointTable, __FILE__, __LINE__);
|
||||
ZeldaArena_FreeDebug(skelAnime->jointTable);
|
||||
} else {
|
||||
osSyncPrintf("now_joint あきまへん!!\n"); // "now_joint is freed! !"
|
||||
}
|
||||
|
||||
if (skelAnime->morphTable != NULL) {
|
||||
ZeldaArena_FreeDebug(skelAnime->morphTable, __FILE__, __LINE__);
|
||||
ZeldaArena_FreeDebug(skelAnime->morphTable);
|
||||
} else {
|
||||
osSyncPrintf("morf_joint あきまへん!!\n"); // "morf_joint is freed !!"
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ void Skin_Init(GlobalContext* globalCtx, Skin* skin, SkeletonHeader* skeletonHea
|
||||
skeleton = SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment);
|
||||
limbCount = skin->skeletonHeader->limbCount;
|
||||
|
||||
skin->vtxTable = ZeldaArena_MallocDebug(limbCount * sizeof(SkinLimbVtx), __FILE__, __LINE__);
|
||||
skin->vtxTable = ZeldaArena_MallocDebug(limbCount * sizeof(SkinLimbVtx));
|
||||
|
||||
ASSERT(skin->vtxTable != NULL);
|
||||
|
||||
@ -70,11 +70,11 @@ void Skin_Init(GlobalContext* globalCtx, Skin* skin, SkeletonHeader* skeletonHea
|
||||
vtxEntry->index = 0;
|
||||
|
||||
vtxEntry->buf[0] =
|
||||
ZeldaArena_MallocDebug(animatedLimbData->totalVtxCount * sizeof(Vtx), __FILE__, __LINE__);
|
||||
ZeldaArena_MallocDebug(animatedLimbData->totalVtxCount * sizeof(Vtx));
|
||||
ASSERT(vtxEntry->buf[0] != NULL);
|
||||
|
||||
vtxEntry->buf[1] =
|
||||
ZeldaArena_MallocDebug(animatedLimbData->totalVtxCount * sizeof(Vtx), __FILE__, __LINE__);
|
||||
ZeldaArena_MallocDebug(animatedLimbData->totalVtxCount * sizeof(Vtx));
|
||||
ASSERT(vtxEntry->buf[1] != NULL);
|
||||
|
||||
Skin_InitAnimatedLimb(globalCtx, skin, i);
|
||||
@ -93,17 +93,17 @@ void Skin_Free(GlobalContext* globalCtx, Skin* skin) {
|
||||
|
||||
for (i = 0; i < skin->limbCount; i++) {
|
||||
if (skin->vtxTable[i].buf[0] != NULL) {
|
||||
ZeldaArena_FreeDebug(skin->vtxTable[i].buf[0], __FILE__, __LINE__);
|
||||
ZeldaArena_FreeDebug(skin->vtxTable[i].buf[0]);
|
||||
skin->vtxTable[i].buf[0] = NULL;
|
||||
}
|
||||
if (skin->vtxTable[i].buf[1] != NULL) {
|
||||
ZeldaArena_FreeDebug(skin->vtxTable[i].buf[1], __FILE__, __LINE__);
|
||||
ZeldaArena_FreeDebug(skin->vtxTable[i].buf[1]);
|
||||
skin->vtxTable[i].buf[1] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (skin->vtxTable != NULL) {
|
||||
ZeldaArena_FreeDebug(skin->vtxTable, __FILE__, __LINE__);
|
||||
ZeldaArena_FreeDebug(skin->vtxTable);
|
||||
}
|
||||
|
||||
SkelAnime_Free(&skin->skelAnime, globalCtx);
|
||||
|
@ -23,7 +23,7 @@ void View_ViewportToVp(Vp* dest, Viewport* src) {
|
||||
}
|
||||
|
||||
View* View_New(GraphicsContext* gfxCtx) {
|
||||
View* view = SystemArena_MallocDebug(sizeof(View), __FILE__, __LINE__);
|
||||
View* view = SystemArena_MallocDebug(sizeof(View));
|
||||
|
||||
if (view != NULL) {
|
||||
memset(view, 0, sizeof(View));
|
||||
@ -34,7 +34,7 @@ View* View_New(GraphicsContext* gfxCtx) {
|
||||
}
|
||||
|
||||
void View_Free(View* view) {
|
||||
SystemArena_FreeDebug(view, __FILE__, __LINE__);
|
||||
SystemArena_FreeDebug(view);
|
||||
}
|
||||
|
||||
void View_Init(View* view, GraphicsContext* gfxCtx) {
|
||||
|
@ -23,7 +23,7 @@ void VisMono_Init(VisMono* this) {
|
||||
}
|
||||
|
||||
void VisMono_Destroy(VisMono* this) {
|
||||
SystemArena_FreeDebug(this->monoDl, __FILE__, __LINE__);
|
||||
SystemArena_FreeDebug(this->monoDl);
|
||||
}
|
||||
|
||||
void VisMono_UpdateTexture(VisMono* this, u16* tex) {
|
||||
@ -124,12 +124,12 @@ void VisMono_DrawOld(VisMono* this) {
|
||||
Gfx* glistpEnd;
|
||||
|
||||
if (!this->tlut) {
|
||||
this->tlut = SystemArena_MallocDebug(256 * sizeof(u16), __FILE__, __LINE__);
|
||||
this->tlut = SystemArena_MallocDebug(256 * sizeof(u16));
|
||||
VisMono_UpdateTexture(this, this->tlut);
|
||||
}
|
||||
|
||||
if (!this->monoDl) {
|
||||
this->monoDl = SystemArena_MallocDebug(DLSIZE * sizeof(Gfx), __FILE__, __LINE__);
|
||||
this->monoDl = SystemArena_MallocDebug(DLSIZE * sizeof(Gfx));
|
||||
glistpEnd = VisMono_DrawTexture(this, this->monoDl);
|
||||
ASSERT(glistpEnd <= this->monoDl + DLSIZE);
|
||||
}
|
||||
|
@ -960,24 +960,24 @@ void Skybox_Init(GameState* state, SkyboxContext* skyboxCtx, s16 skyboxId) {
|
||||
osSyncPrintf(VT_FGCOL(GREEN));
|
||||
|
||||
if (skyboxCtx->unk_140 != 0) {
|
||||
skyboxCtx->dListBuf = GameState_Alloc(state, 8 * 150 * sizeof(Gfx), __FILE__, __LINE__);
|
||||
skyboxCtx->dListBuf = GameState_Alloc(state, 8 * 150 * sizeof(Gfx));
|
||||
ASSERT(skyboxCtx->dListBuf != NULL);
|
||||
|
||||
skyboxCtx->roomVtx = GameState_Alloc(state, 256 * sizeof(Vtx), __FILE__, __LINE__);
|
||||
skyboxCtx->roomVtx = GameState_Alloc(state, 256 * sizeof(Vtx));
|
||||
ASSERT(skyboxCtx->roomVtx != NULL);
|
||||
|
||||
func_800AEFC8(skyboxCtx, skyboxId);
|
||||
} else {
|
||||
skyboxCtx->dListBuf = GameState_Alloc(state, 12 * 150 * sizeof(Gfx), __FILE__, __LINE__);
|
||||
skyboxCtx->dListBuf = GameState_Alloc(state, 12 * 150 * sizeof(Gfx));
|
||||
ASSERT(skyboxCtx->dListBuf != NULL);
|
||||
|
||||
if (skyboxId == SKYBOX_CUTSCENE_MAP) {
|
||||
skyboxCtx->roomVtx = GameState_Alloc(state, 192 * sizeof(Vtx), __FILE__, __LINE__);
|
||||
skyboxCtx->roomVtx = GameState_Alloc(state, 192 * sizeof(Vtx));
|
||||
ASSERT(skyboxCtx->roomVtx != NULL);
|
||||
|
||||
func_800AF178(skyboxCtx, 6);
|
||||
} else {
|
||||
skyboxCtx->roomVtx = GameState_Alloc(state, 160 * sizeof(Vtx), __FILE__, __LINE__);
|
||||
skyboxCtx->roomVtx = GameState_Alloc(state, 160 * sizeof(Vtx));
|
||||
ASSERT(skyboxCtx->roomVtx != NULL);
|
||||
|
||||
func_800AF178(skyboxCtx, 5);
|
||||
|
@ -103,7 +103,7 @@ void EffDust_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
this->scalingFactor = 20.0f;
|
||||
break;
|
||||
default:
|
||||
SystemArena_FreeDebug(this, __FILE__, __LINE__);
|
||||
SystemArena_FreeDebug(this);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -9524,7 +9524,7 @@ void Player_Init(Actor* thisx, GlobalContext* globalCtx2) {
|
||||
Player_SetEquipmentData(globalCtx, this);
|
||||
this->prevBoots = this->currentBoots;
|
||||
Player_InitCommon(this, globalCtx, gPlayerSkelHeaders[((void)0, gSaveContext.linkAge)]);
|
||||
this->giObjectSegment = (void*)(((uintptr_t)ZeldaArena_MallocDebug(0x3008, __FILE__, __LINE__) + 8) & ~0xF);
|
||||
this->giObjectSegment = (void*)(((uintptr_t)ZeldaArena_MallocDebug(0x3008) + 8) & ~0xF);
|
||||
|
||||
sp50 = gSaveContext.respawnFlag;
|
||||
|
||||
|
@ -1949,12 +1949,12 @@ void FileChoose_Init(GameState* thisx) {
|
||||
SREG(30) = 1;
|
||||
osSyncPrintf("SIZE=%x\n", size);
|
||||
|
||||
this->staticSegment = GameState_Alloc(&this->state, size, __FILE__, __LINE__);
|
||||
this->staticSegment = GameState_Alloc(&this->state, size);
|
||||
ASSERT(this->staticSegment != NULL);
|
||||
DmaMgr_SendRequest1(this->staticSegment, (u32)_title_staticSegmentRomStart, size, __FILE__, __LINE__);
|
||||
|
||||
size = (u32)_parameter_staticSegmentRomEnd - (u32)_parameter_staticSegmentRomStart;
|
||||
this->parameterSegment = GameState_Alloc(&this->state, size, __FILE__, __LINE__);
|
||||
this->parameterSegment = GameState_Alloc(&this->state, size);
|
||||
ASSERT(this->parameterSegment != NULL);
|
||||
DmaMgr_SendRequest1(this->parameterSegment, (u32)_parameter_staticSegmentRomStart, size, __FILE__,
|
||||
__LINE__);
|
||||
|
@ -626,7 +626,7 @@ void Select_Init(GameState* thisx) {
|
||||
}
|
||||
R_UPDATE_RATE = 1;
|
||||
#if !defined(_MSC_VER) && !defined(__GNUC__)
|
||||
this->staticSegment = GameState_Alloc(&this->state, size, __FILE__, __LINE__);
|
||||
this->staticSegment = GameState_Alloc(&this->state, size);
|
||||
DmaMgr_SendRequest1(this->staticSegment, _z_select_staticSegmentRomStart, size, __FILE__, __LINE__);
|
||||
#endif
|
||||
gSaveContext.cutsceneIndex = 0x8000;
|
||||
|
@ -331,7 +331,7 @@ void Title_Init(GameState* thisx) {
|
||||
|
||||
quote = SetQuote();
|
||||
|
||||
//this->staticSegment = GameState_Alloc(&this->state, size, __FILE__, __LINE__);
|
||||
//this->staticSegment = GameState_Alloc(&this->state, size);
|
||||
osSyncPrintf("z_title.c\n");
|
||||
//ASSERT(this->staticSegment != NULL);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user