diff --git a/src/game/main.h b/src/game/main.h index 6028cbdb..c533b6ab 100644 --- a/src/game/main.h +++ b/src/game/main.h @@ -63,11 +63,12 @@ extern struct SPTask *gActiveSPTask; extern u32 gNumVblanks; extern s8 gResetTimer; extern s8 gNmiResetBarsTimer; -extern s8 gDebugLevelSelect; extern s8 D_8032C650; extern s8 gShowProfiler; extern s8 gShowDebugText; +#define gDebugLevelSelect (CVarGetInteger("gEnableDebugMode", 0) == 1) + void exec_display_list(struct SPTask *spTask); #endif // MAIN_H diff --git a/src/menu/title_screen.c b/src/menu/title_screen.c index e640ea0e..0c7d6694 100644 --- a/src/menu/title_screen.c +++ b/src/menu/title_screen.c @@ -143,7 +143,7 @@ s16 intro_level_select(void) { // ... the level select quit combo is being pressed, which uses START. If this // is the case, quit the menu instead. if (gPlayer1Controller->buttonDown == QUIT_LEVEL_SELECT_COMBO) { - gDebugLevelSelect = FALSE; + // CVarSetInteger("gEnableDebugMode", 0); return -1; } play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource); diff --git a/src/port/Variables.cpp b/src/port/Variables.cpp index ffce12a3..1fccfaa4 100644 --- a/src/port/Variables.cpp +++ b/src/port/Variables.cpp @@ -15,7 +15,6 @@ u64 osClockRate = 62500000; s8 gShowProfiler = FALSE; s8 gShowDebugText = FALSE; -s8 gDebugLevelSelect = FALSE; OSIoMesg gDmaIoMesg; OSMesg gMainReceivedMesg; diff --git a/src/port/ui/ImguiUI.cpp b/src/port/ui/ImguiUI.cpp index bbc13e4d..d7ffb150 100644 --- a/src/port/ui/ImguiUI.cpp +++ b/src/port/ui/ImguiUI.cpp @@ -305,6 +305,44 @@ void DrawEnhancementsMenu() { } } +void DrawDebugMenu() { + if (ImGui::BeginMenu("Developer")) { + + UIWidgets::PaddedEnhancementCheckbox("Enable level selector", "gEnableDebugMode", true, false); + UIWidgets::Tooltip("Enable the level selector in the main menu"); + UIWidgets::Spacer(0); + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(12.0f, 6.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0, 0)); + ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f); + ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f)); + if (GameUI::mStatsWindow) { + if (ImGui::Button( + GameUI::GetWindowButtonText("Stats", CVarGetInteger("gStatsEnabled", 0)).c_str(), + ImVec2(-1.0f, 0.0f))) { + GameUI::mStatsWindow->ToggleVisibility(); + } + UIWidgets::Tooltip("Shows the stats window, with your FPS and frametimes, and the OS " + "you're playing on"); + } + if (GameUI::mConsoleWindow) { + if (ImGui::Button( + GameUI::GetWindowButtonText("Console", CVarGetInteger("gConsoleEnabled", 0)) + .c_str(), + ImVec2(-1.0f, 0.0f))) { + GameUI::mConsoleWindow->ToggleVisibility(); + } + UIWidgets::Tooltip("Enables the console window, allowing you to input commands, type " + "help for some examples"); + } + + ImGui::PopStyleVar(3); + ImGui::PopStyleColor(1); + + ImGui::EndMenu(); + } +} + + void GameMenuBar::DrawElement() { if(ImGui::BeginMenuBar()){ DrawMenuBarIcon(); @@ -323,6 +361,9 @@ void GameMenuBar::DrawElement() { DrawEnhancementsMenu(); + ImGui::SetCursorPosY(0.0f); + DrawDebugMenu(); + ImGui::PopStyleVar(1); ImGui::EndMenuBar(); }