From 0d85caaf7e342648c01a15fe21e93637352dc596 Mon Sep 17 00:00:00 2001 From: Baoulettes Date: Tue, 28 Jun 2022 22:09:15 +0200 Subject: [PATCH] GameState_, GameAlloc_, SystemArena_ & ZeldaArena_ --- soh/include/functions.h | 20 ++++++------ soh/include/macros.h | 2 +- soh/src/code/game.c | 8 ++--- soh/src/code/gamealloc.c | 10 +++--- soh/src/code/graph.c | 4 +-- soh/src/code/listalloc.c | 4 +-- soh/src/code/loadfragment2.c | 2 +- soh/src/code/main.c | 2 +- soh/src/code/sys_matrix.c | 2 +- soh/src/code/system_malloc.c | 16 +++++----- soh/src/code/z_DLF.c | 2 +- soh/src/code/z_actor.c | 32 +++++++++---------- soh/src/code/z_bgcheck.c | 2 +- soh/src/code/z_camera.c | 4 +-- soh/src/code/z_collision_check.c | 14 ++++---- soh/src/code/z_construct.c | 8 ++--- soh/src/code/z_debug.c | 2 +- soh/src/code/z_effect_soft_sprite.c | 6 ++-- soh/src/code/z_fbdemo.c | 24 +++++++------- soh/src/code/z_fcurve_data_skelanime.c | 5 ++- soh/src/code/z_kaleido_manager.c | 2 +- soh/src/code/z_malloc.c | 16 +++++----- soh/src/code/z_map_exp.c | 2 +- soh/src/code/z_map_mark.c | 2 +- soh/src/code/z_play.c | 4 +-- soh/src/code/z_room.c | 2 +- soh/src/code/z_sample.c | 2 +- soh/src/code/z_scene.c | 2 +- soh/src/code/z_skelanime.c | 20 ++++++------ soh/src/code/z_skin_awb.c | 12 +++---- soh/src/code/z_view.c | 4 +-- soh/src/code/z_vismono.c | 6 ++-- soh/src/code/z_vr_box.c | 10 +++--- .../overlays/actors/ovl_Eff_Dust/z_eff_dust.c | 2 +- .../actors/ovl_player_actor/z_player.c | 2 +- .../ovl_file_choose/z_file_choose.c | 4 +-- .../overlays/gamestates/ovl_select/z_select.c | 2 +- .../overlays/gamestates/ovl_title/z_title.c | 2 +- 38 files changed, 132 insertions(+), 133 deletions(-) diff --git a/soh/include/functions.h b/soh/include/functions.h index 58484abd0..d389f809e 100644 --- a/soh/include/functions.h +++ b/soh/include/functions.h @@ -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); diff --git a/soh/include/macros.h b/soh/include/macros.h index 9c20e9630..28ad50502 100644 --- a/soh/include/macros.h +++ b/soh/include/macros.h @@ -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__) diff --git a/soh/src/code/game.c b/soh/src/code/game.c index 3167764e9..eec4faacf 100644 --- a/soh/src/code/game.c +++ b/soh/src/code/game.c @@ -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; diff --git a/soh/src/code/gamealloc.c b/soh/src/code/gamealloc.c index ae44ee521..6307573b0 100644 --- a/soh/src/code/gamealloc.c +++ b/soh/src/code/gamealloc.c @@ -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; diff --git a/soh/src/code/graph.c b/soh/src/code/graph.c index 6d90e1cc1..490632611 100644 --- a/soh/src/code/graph.c +++ b/soh/src/code/graph.c @@ -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); diff --git a/soh/src/code/listalloc.c b/soh/src/code/listalloc.c index 2e10e0e83..cef8026d5 100644 --- a/soh/src/code/listalloc.c +++ b/soh/src/code/listalloc.c @@ -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) { diff --git a/soh/src/code/loadfragment2.c b/soh/src/code/loadfragment2.c index 28d56ddca..353c9d04c 100644 --- a/soh/src/code/loadfragment2.c +++ b/soh/src/code/loadfragment2.c @@ -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, diff --git a/soh/src/code/main.c b/soh/src/code/main.c index b9967db13..2fb5dffa1 100644 --- a/soh/src/code/main.c +++ b/soh/src/code/main.c @@ -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; diff --git a/soh/src/code/sys_matrix.c b/soh/src/code/sys_matrix.c index 80ff7253e..e3d3cba74 100644 --- a/soh/src/code/sys_matrix.c +++ b/soh/src/code/sys_matrix.c @@ -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; } diff --git a/soh/src/code/system_malloc.c b/soh/src/code/system_malloc.c index e8bfefed3..41f00828f 100644 --- a/soh/src/code/system_malloc.c +++ b/soh/src/code/system_malloc.c @@ -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) { diff --git a/soh/src/code/z_DLF.c b/soh/src/code/z_DLF.c index 9486cfe54..6a5d4c83d 100644 --- a/soh/src/code/z_DLF.c +++ b/soh/src/code/z_DLF.c @@ -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; } } diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index 7620b1f78..1a838ab9d 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -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 " @@ -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; } diff --git a/soh/src/code/z_bgcheck.c b/soh/src/code/z_bgcheck.c index 453663fc2..4705a2558 100644 --- a/soh/src/code/z_bgcheck.c +++ b/soh/src/code/z_bgcheck.c @@ -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); } diff --git a/soh/src/code/z_camera.c b/soh/src/code/z_camera.c index c89fb7463..0c5b1f53d 100644 --- a/soh/src/code/z_camera.c +++ b/soh/src/code/z_camera.c @@ -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); } diff --git a/soh/src/code/z_collision_check.c b/soh/src/code/z_collision_check.c index dd723bfd7..a372283e6 100644 --- a/soh/src/code/z_collision_check.c +++ b/soh/src/code/z_collision_check.c @@ -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)); diff --git a/soh/src/code/z_construct.c b/soh/src/code/z_construct.c index 80f0ee4f4..43339bf62 100644 --- a/soh/src/code/z_construct.c +++ b/soh/src/code/z_construct.c @@ -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); diff --git a/soh/src/code/z_debug.c b/soh/src/code/z_debug.c index 4cf762f40..aac0c25ac 100644 --- a/soh/src/code/z_debug.c +++ b/soh/src/code/z_debug.c @@ -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; diff --git a/soh/src/code/z_effect_soft_sprite.c b/soh/src/code/z_effect_soft_sprite.c index 768c7d318..646b0155d 100644 --- a/soh/src/code/z_effect_soft_sprite.c +++ b/soh/src/code/z_effect_soft_sprite.c @@ -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)); diff --git a/soh/src/code/z_fbdemo.c b/soh/src/code/z_fbdemo.c index 712c9cf63..61b56a1c8 100644 --- a/soh/src/code/z_fbdemo.c +++ b/soh/src/code/z_fbdemo.c @@ -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; diff --git a/soh/src/code/z_fcurve_data_skelanime.c b/soh/src/code/z_fcurve_data_skelanime.c index d3303db03..f7f3e3d58 100644 --- a/soh/src/code/z_fcurve_data_skelanime.c +++ b/soh/src/code/z_fcurve_data_skelanime.c @@ -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); } } diff --git a/soh/src/code/z_kaleido_manager.c b/soh/src/code/z_kaleido_manager.c index ded4def1e..4c3e139c5 100644 --- a/soh/src/code/z_kaleido_manager.c +++ b/soh/src/code/z_kaleido_manager.c @@ -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)); diff --git a/soh/src/code/z_malloc.c b/soh/src/code/z_malloc.c index acd4429c0..bf7b737ca 100644 --- a/soh/src/code/z_malloc.c +++ b/soh/src/code/z_malloc.c @@ -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) { diff --git a/soh/src/code/z_map_exp.c b/soh/src/code/z_map_exp.c index 1dcad4df0..fc25bc2d9 100644 --- a/soh/src/code/z_map_exp.c +++ b/soh/src/code/z_map_exp.c @@ -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); diff --git a/soh/src/code/z_map_mark.c b/soh/src/code/z_map_mark.c index d524f32e4..241ed867c 100644 --- a/soh/src/code/z_map_mark.c +++ b/soh/src/code/z_map_mark.c @@ -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); diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c index e500610c7..cb7662fef 100644 --- a/soh/src/code/z_play.c +++ b/soh/src/code/z_play.c @@ -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; diff --git a/soh/src/code/z_room.c b/soh/src/code/z_room.c index 79c8e1468..d1c4aca57 100644 --- a/soh/src/code/z_room.c +++ b/soh/src/code/z_room.c @@ -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); diff --git a/soh/src/code/z_sample.c b/soh/src/code/z_sample.c index c4d01991f..c0e688ad7 100644 --- a/soh/src/code/z_sample.c +++ b/soh/src/code/z_sample.c @@ -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__); } diff --git a/soh/src/code/z_scene.c b/soh/src/code/z_scene.c index 63370bb90..b5d72bfd3 100644 --- a/soh/src/code/z_scene.c +++ b/soh/src/code/z_scene.c @@ -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); diff --git a/soh/src/code/z_skelanime.c b/soh/src/code/z_skelanime.c index ef27aa95c..a1fb4c6b1 100644 --- a/soh/src/code/z_skelanime.c +++ b/soh/src/code/z_skelanime.c @@ -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 !!" } diff --git a/soh/src/code/z_skin_awb.c b/soh/src/code/z_skin_awb.c index a2da3703a..cade30623 100644 --- a/soh/src/code/z_skin_awb.c +++ b/soh/src/code/z_skin_awb.c @@ -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); diff --git a/soh/src/code/z_view.c b/soh/src/code/z_view.c index 7b9672dac..4745e24e4 100644 --- a/soh/src/code/z_view.c +++ b/soh/src/code/z_view.c @@ -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) { diff --git a/soh/src/code/z_vismono.c b/soh/src/code/z_vismono.c index a7a8bed0e..1fad2b2d2 100644 --- a/soh/src/code/z_vismono.c +++ b/soh/src/code/z_vismono.c @@ -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); } diff --git a/soh/src/code/z_vr_box.c b/soh/src/code/z_vr_box.c index ee9ea91d5..879905a8c 100644 --- a/soh/src/code/z_vr_box.c +++ b/soh/src/code/z_vr_box.c @@ -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); diff --git a/soh/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c b/soh/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c index 584ab281a..b425cd200 100644 --- a/soh/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c +++ b/soh/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c @@ -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; } diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index 58950a1cc..3f15b165f 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -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; diff --git a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index 5b4d14d40..b65b4985f 100644 --- a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -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__); diff --git a/soh/src/overlays/gamestates/ovl_select/z_select.c b/soh/src/overlays/gamestates/ovl_select/z_select.c index fa207154c..f0caef715 100644 --- a/soh/src/overlays/gamestates/ovl_select/z_select.c +++ b/soh/src/overlays/gamestates/ovl_select/z_select.c @@ -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; diff --git a/soh/src/overlays/gamestates/ovl_title/z_title.c b/soh/src/overlays/gamestates/ovl_title/z_title.c index 7f4b76232..b9d4cf0f3 100644 --- a/soh/src/overlays/gamestates/ovl_title/z_title.c +++ b/soh/src/overlays/gamestates/ovl_title/z_title.c @@ -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);