Skip to content

Commit

Permalink
Fix ET content detection and switch content back in Community menu
Browse files Browse the repository at this point in the history
  • Loading branch information
IonAgorria committed Sep 22, 2023
1 parent 8401fac commit 12600a8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Source/Game/GameContent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
33 changes: 26 additions & 7 deletions Source/UserInterface/MainMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> 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<std::string> 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;
Expand Down

0 comments on commit 12600a8

Please sign in to comment.