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
This commit is contained in:
fig02
2024-11-17 17:02:07 -05:00
committed by GitHub
parent cf4dc98cc9
commit 17edb82c0d
168 changed files with 652 additions and 606 deletions
+10 -8
View File
@@ -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);