diff --git a/src/audio/external.c b/src/audio/external.c index e5a952170..a0fadc2f9 100644 --- a/src/audio/external.c +++ b/src/audio/external.c @@ -2186,9 +2186,7 @@ void play_music(u8 player, u16 seqArgs, u16 fadeTimer) { // Abort if the queue is already full. if (sBackgroundMusicQueueSize >= MAX_BACKGROUND_MUSIC_QUEUE_SIZE) { -#ifdef PUPPYPRINT_DEBUG append_puppyprint_log("Sequence queue full, aborting."); -#endif return; } diff --git a/src/audio/heap.c b/src/audio/heap.c index 2239bb2b7..205817501 100644 --- a/src/audio/heap.c +++ b/src/audio/heap.c @@ -1437,13 +1437,7 @@ void audio_reset_session(void) { gAudioLoadLock = AUDIO_LOCK_NOT_LOADING; } #endif -#ifdef PUPPYPRINT_DEBUG -#ifdef PUPPYPRINT_DEBUG_CYCLES - append_puppyprint_log("Audio Initialised in %dc.", (s32)(osGetTime() - first)); -#else - append_puppyprint_log("Audio Initialised in %dus.", (s32)OS_CYCLES_TO_USEC(osGetTime() - first)); -#endif -#endif + append_puppyprint_log("Audio Initialised in %d" PP_CYCLE_STRING ".", (s32)PP_CYCLE_CONV(osGetTime() - first)); sAudioIsInitialized = TRUE; } diff --git a/src/engine/level_script.c b/src/engine/level_script.c index 8b41a2d92..fc6280c6f 100644 --- a/src/engine/level_script.c +++ b/src/engine/level_script.c @@ -826,9 +826,7 @@ static void level_cmd_puppyvolume(void) { if ((sPuppyVolumeStack[gPuppyVolumeCount] = mem_pool_alloc(gPuppyMemoryPool, sizeof(struct sPuppyVolume))) == NULL) { sCurrentCmd = CMD_NEXT; gPuppyError |= PUPPY_ERROR_POOL_FULL; -#ifdef PUPPYPRINT_DEBUG append_puppyprint_log("Puppycamera volume allocation failed."); -#endif return; } @@ -876,9 +874,7 @@ static void level_cmd_puppylight_node(void) { #ifdef PUPPYLIGHTS gPuppyLights[gNumLights] = mem_pool_alloc(gLightsPool, sizeof(struct PuppyLight)); if (gPuppyLights[gNumLights] == NULL) { -#ifdef PUPPYPRINT_DEBUG append_puppyprint_log("Puppylight allocation failed."); -#endif sCurrentCmd = CMD_NEXT; return; } diff --git a/src/game/level_update.c b/src/game/level_update.c index 7ce902f0a..e2f7b0a7a 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -1287,13 +1287,7 @@ s32 init_level(void) { puppylights_allocate(); #endif -#ifdef PUPPYPRINT_DEBUG -#ifdef PUPPYPRINT_DEBUG_CYCLES - append_puppyprint_log("Level loaded in %dc", (s32)(osGetTime() - first)); -#else - append_puppyprint_log("Level loaded in %dus", (s32)(OS_CYCLES_TO_USEC(osGetTime() - first))); -#endif -#endif + append_puppyprint_log("Level loaded in %d" PP_CYCLE_STRING ".", (s32)(PP_CYCLE_CONV(osGetTime() - first))); return TRUE; } diff --git a/src/game/puppyprint.h b/src/game/puppyprint.h index 39708df6c..cbfa7b992 100644 --- a/src/game/puppyprint.h +++ b/src/game/puppyprint.h @@ -13,10 +13,21 @@ #define PUPPYPRINT_ADD_COUNTER(x) x++ #define PUPPYPRINT_GET_SNAPSHOT() u32 first = osGetCount() #define PUPPYPRINT_GET_SNAPSHOT_TYPE(type) u32 first = profiler_get_delta(type) +void append_puppyprint_log(const char *str, ...); #else #define PUPPYPRINT_ADD_COUNTER(x) #define PUPPYPRINT_GET_SNAPSHOT() #define PUPPYPRINT_GET_SNAPSHOT_TYPE(type) +#define append_puppyprint_log(...) +#endif + + +#ifdef PUPPYPRINT_DEBUG_CYCLES + #define PP_CYCLE_CONV(x) (x) + #define PP_CYCLE_STRING " cycles" +#else + #define PP_CYCLE_CONV(x) OS_CYCLES_TO_USEC(x) + #define PP_CYCLE_STRING "us" #endif struct PPTextFont { @@ -130,7 +141,6 @@ extern void prepare_blank_box(void); extern void finish_blank_box(void); extern void render_blank_box(s32 x1, s32 y1, s32 x2, s32 y2, u8 r, u8 g, u8 b, u8 a); extern void render_blank_box_rounded(s32 x1, s32 y1, s32 x2, s32 y2, u8 r, u8 g, u8 b, u8 a); -extern void append_puppyprint_log(const char *str, ...); extern char consoleLogTable[LOG_BUFFER_SIZE][255]; extern void print_small_text_buffered(s32 x, s32 y, const char *str, u8 align, s32 amount, u8 font); extern void puppyprint_print_deferred(void);