From 12600a85ec049f589d23dbcd28aee8ecead5b038 Mon Sep 17 00:00:00 2001 From: Ion Agorria Date: Fri, 22 Sep 2023 02:12:28 +0200 Subject: [PATCH] Fix ET content detection and switch content back in Community menu --- Source/Game/GameContent.cpp | 2 +- Source/UserInterface/MainMenu.cpp | 33 ++++++++++++++++++++++++------- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/Source/Game/GameContent.cpp b/Source/Game/GameContent.cpp index 7f7427f8e..e5749d190 100644 --- a/Source/Game/GameContent.cpp +++ b/Source/Game/GameContent.cpp @@ -578,7 +578,7 @@ void detectGameContent() { data.mod_name = entry_path.filename().u8string(); std::string path_ini = data.path + PATH_SEP + "mod.ini"; - bool is_content_ET = isContentET(data.path); + bool is_content_ET = isContentET(data.path + PATH_SEP); if (get_content_entry(path_ini)) { //Load mandatory .ini fields IniManager mod_ini = IniManager(path_ini.c_str(), true); diff --git a/Source/UserInterface/MainMenu.cpp b/Source/UserInterface/MainMenu.cpp index 3adfb43d0..5c7f86251 100644 --- a/Source/UserInterface/MainMenu.cpp +++ b/Source/UserInterface/MainMenu.cpp @@ -1381,13 +1381,32 @@ void CShellIconManager::SwitchMenuScreens(int id_off, int id_on) { } gameShell->cancelMouseLook(); - if (id_on == SQSH_MM_START_SCR && terGameContentAvailable != terGameContentSelect) { - //Content is selected and user wants to go main menu, switch back to default and restart - std::vector args; - args.emplace_back("tmp_start_splash=0"); - request_application_restart(&args); - //We play splash since "we are leaving the content" and user may not see content specific splash otherwise - id_on = SQSH_MM_SPLASH_LAST; + //Content is selected and user wants to go some menu that needs default content to be restored + if (terGameContentAvailable != terGameContentSelect) { + std::string initial_menu; + switch (id_on) { + case SQSH_MM_START_SCR: + //These are just in case + case SQSH_MM_BATTLE_SCR: + case SQSH_MM_MULTIPLAYER_LIST_SCR: + case SQSH_MM_ADDONS_SCR: + initial_menu = "START"; + break; + //Required if user clicks on Community from Credits menu + case SQSH_MM_COMMUNITY_SCR: + initial_menu = "COMMUNITY"; + break; + } + if (!initial_menu.empty()) { + std::vector args; + args.emplace_back("tmp_start_splash=0"); + if (initial_menu != "START") { + args.emplace_back("tmp_initial_menu=" + initial_menu); + } + request_application_restart(&args); + //We play splash since "we are leaving the content" and user may not see content specific splash otherwise + id_on = SQSH_MM_SPLASH_LAST; + } } menuChangingDone = false;