From ecb077d6e5cbef13bd63ea859668e9a32743b00f Mon Sep 17 00:00:00 2001 From: PringlesGang Date: Tue, 3 Sep 2024 23:42:23 +0200 Subject: [PATCH] Fixed bug where system menu would hijack control when submenu opened directly --- src/games/cclcc/systemmenu.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/games/cclcc/systemmenu.cpp b/src/games/cclcc/systemmenu.cpp index e96b65db6..a344b14dd 100644 --- a/src/games/cclcc/systemmenu.cpp +++ b/src/games/cclcc/systemmenu.cpp @@ -58,12 +58,18 @@ void SystemMenu::Show() { State = Showing; MenuTransition.StartIn(); MainItems->Show(); - if (UI::FocusedMenu != 0) { - LastFocusedMenu = UI::FocusedMenu; - LastFocusedMenu->IsFocused = false; + + // If the function was called due to a submenu opening directly, + // then don't take over focus + if (!(ScrWork[SW_SYSMENUCT] == 32 && ScrWork[SW_SYSSUBMENUCT] || + ScrWork[2151])) { + if (UI::FocusedMenu != 0) { + LastFocusedMenu = UI::FocusedMenu; + LastFocusedMenu->IsFocused = false; + } + IsFocused = true; + UI::FocusedMenu = this; } - IsFocused = true; - UI::FocusedMenu = this; } }