From 2cae9e13cd615500e22bbe01e99fc0ca07744c37 Mon Sep 17 00:00:00 2001 From: HailSanta Date: Sun, 28 Jan 2024 20:48:52 -0500 Subject: [PATCH] fix building with DX_DEBUG_MENU 0 --- src/cam_main.c | 6 ++++++ src/dx/debug_menu.c | 22 ---------------------- src/dx/debug_menu.h | 2 -- src/dx/profiling.c | 2 +- src/dx/utils.c | 23 +++++++++++++++++++++++ src/dx/utils.h | 5 +++++ src/filemenu/filemenu_main.c | 2 +- ver/us/splat.yaml | 1 + 8 files changed, 37 insertions(+), 26 deletions(-) create mode 100644 src/dx/utils.c create mode 100644 src/dx/utils.h diff --git a/src/cam_main.c b/src/cam_main.c index 7e54e8aa2d..b96b4952af 100644 --- a/src/cam_main.c +++ b/src/cam_main.c @@ -206,9 +206,13 @@ void render_frame(s32 isSecondPass) { } if (!(camera->flags & CAMERA_FLAG_RENDER_MODELS)) { GFX_PROFILER_START(PROFILER_TIME_SUB_GFX_MODELS); + #if DX_DEBUG_MENU if (!dx_debug_should_hide_models()) { render_models(); } + #else + render_models(); + #endif GFX_PROFILER_COMPLETE(PROFILER_TIME_SUB_GFX_MODELS); } GFX_PROFILER_START(PROFILER_TIME_SUB_GFX_PLAYER); @@ -221,7 +225,9 @@ void render_frame(s32 isSecondPass) { render_effects_world(); GFX_PROFILER_SWITCH(PROFILER_TIME_SUB_GFX_EFFECTS, PROFILER_TIME_SUB_GFX_RENDER_TASKS); execute_render_tasks(); + #if DX_DEBUG_MENU dx_debug_draw_collision(); + #endif GFX_PROFILER_SWITCH(PROFILER_TIME_SUB_GFX_RENDER_TASKS, PROFILER_TIME_SUB_GFX_HUD_ELEMENTS); render_transformed_hud_elements(); } else { diff --git a/src/dx/debug_menu.c b/src/dx/debug_menu.c index a2bd629cb9..91226ea232 100644 --- a/src/dx/debug_menu.c +++ b/src/dx/debug_menu.c @@ -151,28 +151,6 @@ void dx_debug_draw_box(s32 posX, s32 posY, s32 sizeX, s32 sizeY, int style, s32 0, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, NULL, 0, NULL, SCREEN_WIDTH, SCREEN_HEIGHT, NULL); } -u8 dx_ascii_char_to_msg(u8 in) { - switch (in) { - case '\0': return MSG_CHAR_READ_END; - case ' ': case '\t': return MSG_CHAR_READ_SPACE; - case '\n': return MSG_CHAR_READ_ENDL; - default: - if (in < 0x20) { - return MSG_CHAR_NOTE; - } - return in - 0x20; - } -} - -u8* dx_string_to_msg(u8* msg, const u8* str) { - while (*str) { - *msg++ = dx_ascii_char_to_msg(*str++); - } - - *msg = MSG_CHAR_READ_END; - return msg; -} - void dx_debug_draw_ascii(char* text, s32 color, s32 posX, s32 posY) { char buf[128] = { MSG_CHAR_READ_FUNCTION, MSG_READ_FUNC_SIZE, 12, 12 diff --git a/src/dx/debug_menu.h b/src/dx/debug_menu.h index 81635fa388..e1a11d16ce 100644 --- a/src/dx/debug_menu.h +++ b/src/dx/debug_menu.h @@ -14,8 +14,6 @@ b32 dx_debug_should_hide_models(); void dx_debug_set_map_info(char* mapName, s32 entryID); void dx_debug_set_battle_info(s32 battleID, char* stageName); -u8* dx_string_to_msg(u8* msg, const u8* str); - #define debug_print(text) dx_hashed_debug_printf(__FILE__,__LINE__,text) #define debug_printf(fmt, args...) dx_hashed_debug_printf(__FILE__,__LINE__,fmt,args) diff --git a/src/dx/profiling.c b/src/dx/profiling.c index b6b4b838a2..27c61980d8 100644 --- a/src/dx/profiling.c +++ b/src/dx/profiling.c @@ -1,7 +1,7 @@ // Stolen from HackerSM64 #include "profiling.h" -#include "dx/debug_menu.h" +#include "dx/utils.h" #include "game_modes.h" #ifdef USE_PROFILER diff --git a/src/dx/utils.c b/src/dx/utils.c new file mode 100644 index 0000000000..235bac9e00 --- /dev/null +++ b/src/dx/utils.c @@ -0,0 +1,23 @@ +#include "dx/utils.h" + +u8 dx_ascii_char_to_msg(u8 in) { + switch (in) { + case '\0': return MSG_CHAR_READ_END; + case ' ': case '\t': return MSG_CHAR_READ_SPACE; + case '\n': return MSG_CHAR_READ_ENDL; + default: + if (in < 0x20) { + return MSG_CHAR_NOTE; + } + return in - 0x20; + } +} + +u8* dx_string_to_msg(u8* msg, const u8* str) { + while (*str) { + *msg++ = dx_ascii_char_to_msg(*str++); + } + + *msg = MSG_CHAR_READ_END; + return msg; +} diff --git a/src/dx/utils.h b/src/dx/utils.h new file mode 100644 index 0000000000..fd0ed3e8da --- /dev/null +++ b/src/dx/utils.h @@ -0,0 +1,5 @@ +#include "common.h" + +u8* dx_string_to_msg(u8* msg, const u8* str); + +u8 dx_ascii_char_to_msg(u8 in); diff --git a/src/filemenu/filemenu_main.c b/src/filemenu/filemenu_main.c index c848825784..996fa0299e 100644 --- a/src/filemenu/filemenu_main.c +++ b/src/filemenu/filemenu_main.c @@ -5,7 +5,7 @@ #include "fio.h" #include "game_modes.h" #include "dx/config.h" -#include "dx/debug_menu.h" +#include "dx/utils.h" extern HudScript HES_Spirit1; extern HudScript HES_Spirit2; diff --git a/ver/us/splat.yaml b/ver/us/splat.yaml index 00d34718dd..841a0bc1cf 100644 --- a/ver/us/splat.yaml +++ b/ver/us/splat.yaml @@ -103,6 +103,7 @@ segments: - [auto, c, fio] - [auto, c, curtains] - [auto, c, crash_screen] + - [auto, c, dx/utils] - [auto, c, dx/backtrace] - [auto, c, dx/debug_menu] - [auto, c, dx/profiling]