From 90e499cc8c652a36bfe5f7bfcfe3ac1675c4aa68 Mon Sep 17 00:00:00 2001 From: Hyper <34012267+hyperbx@users.noreply.github.com> Date: Fri, 3 Jan 2025 00:46:11 +0000 Subject: [PATCH] options_menu: hide reset button during intro, fix pause menu reappearing --- UnleashedRecomp/ui/options_menu.cpp | 24 ++++++++++++++---------- UnleashedRecompResources | 2 +- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/UnleashedRecomp/ui/options_menu.cpp b/UnleashedRecomp/ui/options_menu.cpp index 8f86685..93b853f 100644 --- a/UnleashedRecomp/ui/options_menu.cpp +++ b/UnleashedRecomp/ui/options_menu.cpp @@ -569,7 +569,7 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef* conf DrawTextWithMarquee(g_seuratFont, size, textPos, min, max, textColour, configName.c_str(), g_rowSelectionTime, 0.9, Scale(250.0)); // Show reset button if this option is accessible or not a language option. - g_canReset = !g_lockedOnOption && g_selectedItem->GetName().find("Language") == std::string::npos && isAccessible; + g_canReset = g_isControlsVisible && !g_lockedOnOption && g_selectedItem->GetName().find("Language") == std::string::npos && isAccessible; } else { @@ -1040,17 +1040,27 @@ static void DrawInfoPanel() drawList->PopClipRect(); } +static void SetOptionsMenuVisible(bool isVisible) +{ + OptionsMenu::s_isVisible = isVisible; + *(bool*)g_memory.Translate(0x8328BB26) = !isVisible; +} + static bool DrawMilesElectric() { auto drawList = ImGui::GetForegroundDrawList(); auto& res = ImGui::GetIO().DisplaySize; + // Compensate for the lack of CSD UI dimming the background. + if (g_isStage) + drawList->AddRectFilled({ 0.0f, 0.0f }, res, IM_COL32(0, 0, 0, 127)); + auto scaleMotion = ComputeMotion(g_appearTime, 0, MILES_ELECTRIC_SCALE_DURATION); if (scaleMotion >= 1.0) { if (g_isClosing) - OptionsMenu::s_isVisible = false; + SetOptionsMenuVisible(false); return true; } @@ -1169,7 +1179,6 @@ void OptionsMenu::Draw() void OptionsMenu::Open(bool isPause, SWA::EMenuType pauseMenuType) { - s_isVisible = true; g_isClosing = false; s_isPause = isPause; s_pauseMenuType = pauseMenuType; @@ -1187,9 +1196,7 @@ void OptionsMenu::Open(bool isPause, SWA::EMenuType pauseMenuType) g_isEnterKeyBuffered = true; ResetSelection(); - - // Hide CSD UI. - *(bool*)g_memory.Translate(0x8328BB26) = false; + SetOptionsMenuVisible(true); std::array buttons = { @@ -1210,10 +1217,7 @@ void OptionsMenu::Close() // Skip Miles Electric animation at main menu. if (!g_isStage) - s_isVisible = false; - - // Show CSD UI. - *(bool*)g_memory.Translate(0x8328BB26) = true; + SetOptionsMenuVisible(false); ButtonGuide::Close(); Config::Save(); diff --git a/UnleashedRecompResources b/UnleashedRecompResources index 179dad7..9fcb849 160000 --- a/UnleashedRecompResources +++ b/UnleashedRecompResources @@ -1 +1 @@ -Subproject commit 179dad7bf4c95eaec2b5be911529d82fe80b15f1 +Subproject commit 9fcb849d7843b5247ed94b8fff451bc40de62ed2