Skip to content

Commit

Permalink
fix building with DX_DEBUG_MENU 0
Browse files Browse the repository at this point in the history
  • Loading branch information
HailSanta authored and HailSanta committed Jan 29, 2024
1 parent ce6cfdd commit 2cae9e1
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 26 deletions.
6 changes: 6 additions & 0 deletions src/cam_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 {
Expand Down
22 changes: 0 additions & 22 deletions src/dx/debug_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/dx/debug_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion src/dx/profiling.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down
23 changes: 23 additions & 0 deletions src/dx/utils.c
Original file line number Diff line number Diff line change
@@ -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;
}
5 changes: 5 additions & 0 deletions src/dx/utils.h
Original file line number Diff line number Diff line change
@@ -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);
2 changes: 1 addition & 1 deletion src/filemenu/filemenu_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions ver/us/splat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 2cae9e1

Please sign in to comment.