From 17edb82c0d22fb78135033f92a624bd6cde6f495 Mon Sep 17 00:00:00 2001 From: fig02 Date: Sun, 17 Nov 2024 17:02:07 -0500 Subject: Decouple Debug Features From gc-eu-mq-dbg (#2296) * rename OOT_DEBUG to DEBUG_FEATURES * makefile changes * add DEBUG_ASSETS * fix DEBUG_FEATURES usages * format * fix errors * review * fix problem and review2 * review * add DEBUG_FEATURES to DEBUG_ASSETS check * review * whoops * format --- src/code/debug_malloc.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/code/debug_malloc.c') diff --git a/src/code/debug_malloc.c b/src/code/debug_malloc.c index a1def050a..b6aa81b32 100644 --- a/src/code/debug_malloc.c +++ b/src/code/debug_malloc.c @@ -7,14 +7,16 @@ Arena sDebugArena; -#if OOT_DEBUG +#if DEBUG_FEATURES s32 gDebugArenaLogSeverity = LOG_SEVERITY_ERROR; void DebugArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action) { if (ptr == NULL) { if (gDebugArenaLogSeverity >= LOG_SEVERITY_ERROR) { PRINTF(T("%s: %u バイトの%sに失敗しました\n", "%s: %u bytes %s failed\n"), name, size, action); +#if PLATFORM_GC __osDisplayArena(&sDebugArena); +#endif return; } } else if (gDebugArenaLogSeverity >= LOG_SEVERITY_VERBOSE) { @@ -34,7 +36,7 @@ void* DebugArena_Malloc(u32 size) { return ptr; } -#if OOT_DEBUG +#if DEBUG_FEATURES void* DebugArena_MallocDebug(u32 size, const char* file, int line) { void* ptr = __osMallocDebug(&sDebugArena, size, file, line); @@ -50,7 +52,7 @@ void* DebugArena_MallocR(u32 size) { return ptr; } -#if OOT_DEBUG +#if DEBUG_FEATURES void* DebugArena_MallocRDebug(u32 size, const char* file, int line) { void* ptr = __osMallocRDebug(&sDebugArena, size, file, line); @@ -65,7 +67,7 @@ void* DebugArena_Realloc(void* ptr, u32 newSize) { return ptr; } -#if OOT_DEBUG +#if DEBUG_FEATURES void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, int line) { ptr = __osReallocDebug(&sDebugArena, ptr, newSize, file, line); DEBUG_ARENA_CHECK_POINTER(ptr, newSize, "debug_realloc_DEBUG", "再確保"); // "Re-securing" @@ -77,7 +79,7 @@ void DebugArena_Free(void* ptr) { __osFree(&sDebugArena, ptr); } -#if OOT_DEBUG +#if DEBUG_FEATURES void DebugArena_FreeDebug(void* ptr, const char* file, int line) { __osFreeDebug(&sDebugArena, ptr, file, line); } @@ -96,7 +98,7 @@ void* DebugArena_Calloc(u32 num, u32 size) { return ret; } -#if OOT_DEBUG +#if PLATFORM_GC && DEBUG_FEATURES void DebugArena_Display(void) { // Likely copypasted from ZeldaArena_Display, should say "Debug" PRINTF(T("ゼルダヒープ表示\n", "Zelda heap display\n")); @@ -113,14 +115,14 @@ void DebugArena_Check(void) { } void DebugArena_Init(void* start, u32 size) { -#if OOT_DEBUG +#if DEBUG_FEATURES gDebugArenaLogSeverity = LOG_SEVERITY_NOLOG; #endif __osMallocInit(&sDebugArena, start, size); } void DebugArena_Cleanup(void) { -#if OOT_DEBUG +#if DEBUG_FEATURES gDebugArenaLogSeverity = LOG_SEVERITY_NOLOG; #endif __osMallocCleanup(&sDebugArena); -- cgit v1.2.3