Change puppyprint log function calls to defines (#632)

This commit is contained in:
Fazana
2023-06-07 12:58:22 +01:00
committed by GitHub
parent 42cf450ba8
commit 57f7338e6a
5 changed files with 13 additions and 21 deletions

View File

@@ -2186,9 +2186,7 @@ void play_music(u8 player, u16 seqArgs, u16 fadeTimer) {
// Abort if the queue is already full. // Abort if the queue is already full.
if (sBackgroundMusicQueueSize >= MAX_BACKGROUND_MUSIC_QUEUE_SIZE) { if (sBackgroundMusicQueueSize >= MAX_BACKGROUND_MUSIC_QUEUE_SIZE) {
#ifdef PUPPYPRINT_DEBUG
append_puppyprint_log("Sequence queue full, aborting."); append_puppyprint_log("Sequence queue full, aborting.");
#endif
return; return;
} }

View File

@@ -1437,13 +1437,7 @@ void audio_reset_session(void) {
gAudioLoadLock = AUDIO_LOCK_NOT_LOADING; gAudioLoadLock = AUDIO_LOCK_NOT_LOADING;
} }
#endif #endif
#ifdef PUPPYPRINT_DEBUG append_puppyprint_log("Audio Initialised in %d" PP_CYCLE_STRING ".", (s32)PP_CYCLE_CONV(osGetTime() - first));
#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
sAudioIsInitialized = TRUE; sAudioIsInitialized = TRUE;
} }

View File

@@ -826,9 +826,7 @@ static void level_cmd_puppyvolume(void) {
if ((sPuppyVolumeStack[gPuppyVolumeCount] = mem_pool_alloc(gPuppyMemoryPool, sizeof(struct sPuppyVolume))) == NULL) { if ((sPuppyVolumeStack[gPuppyVolumeCount] = mem_pool_alloc(gPuppyMemoryPool, sizeof(struct sPuppyVolume))) == NULL) {
sCurrentCmd = CMD_NEXT; sCurrentCmd = CMD_NEXT;
gPuppyError |= PUPPY_ERROR_POOL_FULL; gPuppyError |= PUPPY_ERROR_POOL_FULL;
#ifdef PUPPYPRINT_DEBUG
append_puppyprint_log("Puppycamera volume allocation failed."); append_puppyprint_log("Puppycamera volume allocation failed.");
#endif
return; return;
} }
@@ -876,9 +874,7 @@ static void level_cmd_puppylight_node(void) {
#ifdef PUPPYLIGHTS #ifdef PUPPYLIGHTS
gPuppyLights[gNumLights] = mem_pool_alloc(gLightsPool, sizeof(struct PuppyLight)); gPuppyLights[gNumLights] = mem_pool_alloc(gLightsPool, sizeof(struct PuppyLight));
if (gPuppyLights[gNumLights] == NULL) { if (gPuppyLights[gNumLights] == NULL) {
#ifdef PUPPYPRINT_DEBUG
append_puppyprint_log("Puppylight allocation failed."); append_puppyprint_log("Puppylight allocation failed.");
#endif
sCurrentCmd = CMD_NEXT; sCurrentCmd = CMD_NEXT;
return; return;
} }

View File

@@ -1287,13 +1287,7 @@ s32 init_level(void) {
puppylights_allocate(); puppylights_allocate();
#endif #endif
#ifdef PUPPYPRINT_DEBUG append_puppyprint_log("Level loaded in %d" PP_CYCLE_STRING ".", (s32)(PP_CYCLE_CONV(osGetTime() - first)));
#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
return TRUE; return TRUE;
} }

View File

@@ -13,10 +13,21 @@
#define PUPPYPRINT_ADD_COUNTER(x) x++ #define PUPPYPRINT_ADD_COUNTER(x) x++
#define PUPPYPRINT_GET_SNAPSHOT() u32 first = osGetCount() #define PUPPYPRINT_GET_SNAPSHOT() u32 first = osGetCount()
#define PUPPYPRINT_GET_SNAPSHOT_TYPE(type) u32 first = profiler_get_delta(type) #define PUPPYPRINT_GET_SNAPSHOT_TYPE(type) u32 first = profiler_get_delta(type)
void append_puppyprint_log(const char *str, ...);
#else #else
#define PUPPYPRINT_ADD_COUNTER(x) #define PUPPYPRINT_ADD_COUNTER(x)
#define PUPPYPRINT_GET_SNAPSHOT() #define PUPPYPRINT_GET_SNAPSHOT()
#define PUPPYPRINT_GET_SNAPSHOT_TYPE(type) #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 #endif
struct PPTextFont { struct PPTextFont {
@@ -130,7 +141,6 @@ extern void prepare_blank_box(void);
extern void finish_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(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 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 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 print_small_text_buffered(s32 x, s32 y, const char *str, u8 align, s32 amount, u8 font);
extern void puppyprint_print_deferred(void); extern void puppyprint_print_deferred(void);