Only show the custom server option when necessary

This commit is contained in:
wiidev 2021-08-01 18:00:16 +01:00
parent bcfac02dd3
commit aca6510fdb
2 changed files with 25 additions and 9 deletions

View File

@ -200,7 +200,10 @@ void GameLoadSM::SetOptionNames()
Options->SetName(Idx++, "%s", tr( "Game Language" )); Options->SetName(Idx++, "%s", tr( "Game Language" ));
Options->SetName(Idx++, "%s", tr( "Ocarina" )); Options->SetName(Idx++, "%s", tr( "Ocarina" ));
Options->SetName(Idx++, "%s", tr( "Private Server" )); Options->SetName(Idx++, "%s", tr( "Private Server" ));
Options->SetName(Idx++, "%s", tr( "Custom Address" )); if(GameConfig.PrivateServer == PRIVSERV_CUSTOM)
{
Options->SetName(Idx++, "%s", tr( "Custom Address" ));
}
Options->SetName(Idx++, "%s", tr( "Parental Control" )); Options->SetName(Idx++, "%s", tr( "Parental Control" ));
Options->SetName(Idx++, "%s", tr( "Hooktype" )); Options->SetName(Idx++, "%s", tr( "Hooktype" ));
Options->SetName(Idx++, "%s", tr( "Wiird Debugger" )); Options->SetName(Idx++, "%s", tr( "Wiird Debugger" ));
@ -296,10 +299,13 @@ void GameLoadSM::SetOptionValues()
Options->SetValue(Idx++, "%s", tr(PrivServText[GameConfig.PrivateServer])); Options->SetValue(Idx++, "%s", tr(PrivServText[GameConfig.PrivateServer]));
//! Settings: Custom Address //! Settings: Custom Address
if(GameConfig.CustomAddress.size() == 0) if(GameConfig.PrivateServer == PRIVSERV_CUSTOM)
Options->SetValue(Idx++, tr("Use global")); {
else if(GameConfig.CustomAddress.size() == 0)
Options->SetValue(Idx++, "%s", GameConfig.CustomAddress.c_str()); Options->SetValue(Idx++, tr("Use global"));
else
Options->SetValue(Idx++, "%s", GameConfig.CustomAddress.c_str());
}
//! Settings: Parental Control //! Settings: Parental Control
Options->SetValue(Idx++, "%s", tr(ParentalText[GameConfig.parentalcontrol])); Options->SetValue(Idx++, "%s", tr(ParentalText[GameConfig.parentalcontrol]));
@ -479,10 +485,13 @@ int GameLoadSM::GetMenuInternal()
else if (ret == ++Idx) else if (ret == ++Idx)
{ {
if (++GameConfig.PrivateServer >= PRIVSERV_MAX_CHOICE) GameConfig.PrivateServer = INHERIT; if (++GameConfig.PrivateServer >= PRIVSERV_MAX_CHOICE) GameConfig.PrivateServer = INHERIT;
Options->ClearList();
SetOptionNames();
SetOptionValues();
} }
//! Settings: Custom Address //! Settings: Custom Address
else if (ret == ++Idx) else if (GameConfig.PrivateServer == PRIVSERV_CUSTOM && ret == ++Idx)
{ {
char entered[300]; char entered[300];
snprintf(entered, sizeof(entered), "%s", GameConfig.CustomAddress.c_str()); snprintf(entered, sizeof(entered), "%s", GameConfig.CustomAddress.c_str());

View File

@ -245,7 +245,10 @@ void LoaderSettings::SetOptionNames()
Options->SetName(Idx++, "%s", tr( "Patch Country Strings" )); Options->SetName(Idx++, "%s", tr( "Patch Country Strings" ));
Options->SetName(Idx++, "%s", tr( "Ocarina" )); Options->SetName(Idx++, "%s", tr( "Ocarina" ));
Options->SetName(Idx++, "%s", tr( "Private Server" )); Options->SetName(Idx++, "%s", tr( "Private Server" ));
Options->SetName(Idx++, "%s", tr( "Custom Address" )); if(Settings.PrivateServer == PRIVSERV_CUSTOM)
{
Options->SetName(Idx++, "%s", tr( "Custom Address" ));
}
Options->SetName(Idx++, "%s", tr( "Loader's IOS" )); Options->SetName(Idx++, "%s", tr( "Loader's IOS" ));
Options->SetName(Idx++, "%s", tr( "Game's IOS" )); Options->SetName(Idx++, "%s", tr( "Game's IOS" ));
Options->SetName(Idx++, "%s", tr( "Quick Boot" )); Options->SetName(Idx++, "%s", tr( "Quick Boot" ));
@ -346,7 +349,8 @@ void LoaderSettings::SetOptionValues()
Options->SetValue(Idx++, "%s", tr( PrivServText[Settings.PrivateServer] )); Options->SetValue(Idx++, "%s", tr( PrivServText[Settings.PrivateServer] ));
//! Settings: Custom Address //! Settings: Custom Address
Options->SetValue(Idx++, "%s", Settings.CustomAddress); if(Settings.PrivateServer == PRIVSERV_CUSTOM)
Options->SetValue(Idx++, "%s", Settings.CustomAddress);
//! Settings: Loader's IOS //! Settings: Loader's IOS
if (Settings.godmode) if (Settings.godmode)
@ -614,10 +618,13 @@ int LoaderSettings::GetMenuInternal()
else if (ret == ++Idx) else if (ret == ++Idx)
{ {
if (++Settings.PrivateServer >= PRIVSERV_MAX_CHOICE) Settings.PrivateServer = 0; if (++Settings.PrivateServer >= PRIVSERV_MAX_CHOICE) Settings.PrivateServer = 0;
Options->ClearList();
SetOptionNames();
SetOptionValues();
} }
//! Settings: Custom Address //! Settings: Custom Address
else if (ret == ++Idx) else if (Settings.PrivateServer == PRIVSERV_CUSTOM && ret == ++Idx)
{ {
char entered[300]; char entered[300];
snprintf(entered, sizeof(entered), "%s", Settings.CustomAddress); snprintf(entered, sizeof(entered), "%s", Settings.CustomAddress);