Qt: Fix Apply Game Settings option

This commit is contained in:
Connor McLaughlin 2022-07-23 00:13:55 +10:00
parent c90824f8e9
commit 75b4891f78
4 changed files with 19 additions and 5 deletions

View file

@ -168,6 +168,7 @@ void Settings::Load(SettingsInterface& si)
create_save_state_backups = si.GetBoolValue("Main", "CreateSaveStateBackups", true); create_save_state_backups = si.GetBoolValue("Main", "CreateSaveStateBackups", true);
confim_power_off = si.GetBoolValue("Main", "ConfirmPowerOff", true); confim_power_off = si.GetBoolValue("Main", "ConfirmPowerOff", true);
load_devices_from_save_states = si.GetBoolValue("Main", "LoadDevicesFromSaveStates", false); load_devices_from_save_states = si.GetBoolValue("Main", "LoadDevicesFromSaveStates", false);
apply_compatibility_settings = si.GetBoolValue("Main", "ApplyCompatibilitySettings", true);
apply_game_settings = si.GetBoolValue("Main", "ApplyGameSettings", true); apply_game_settings = si.GetBoolValue("Main", "ApplyGameSettings", true);
auto_load_cheats = si.GetBoolValue("Main", "AutoLoadCheats", true); auto_load_cheats = si.GetBoolValue("Main", "AutoLoadCheats", true);
disable_all_enhancements = si.GetBoolValue("Main", "DisableAllEnhancements", false); disable_all_enhancements = si.GetBoolValue("Main", "DisableAllEnhancements", false);
@ -385,6 +386,7 @@ void Settings::Save(SettingsInterface& si) const
si.SetBoolValue("Main", "CreateSaveStateBackups", create_save_state_backups); si.SetBoolValue("Main", "CreateSaveStateBackups", create_save_state_backups);
si.SetBoolValue("Main", "ConfirmPowerOff", confim_power_off); si.SetBoolValue("Main", "ConfirmPowerOff", confim_power_off);
si.SetBoolValue("Main", "LoadDevicesFromSaveStates", load_devices_from_save_states); si.SetBoolValue("Main", "LoadDevicesFromSaveStates", load_devices_from_save_states);
si.SetBoolValue("Main", "ApplyCompatibilitySettings", apply_compatibility_settings);
si.SetBoolValue("Main", "ApplyGameSettings", apply_game_settings); si.SetBoolValue("Main", "ApplyGameSettings", apply_game_settings);
si.SetBoolValue("Main", "AutoLoadCheats", auto_load_cheats); si.SetBoolValue("Main", "AutoLoadCheats", auto_load_cheats);
si.SetBoolValue("Main", "DisableAllEnhancements", disable_all_enhancements); si.SetBoolValue("Main", "DisableAllEnhancements", disable_all_enhancements);

View file

@ -70,6 +70,7 @@ struct Settings
bool create_save_state_backups = false; bool create_save_state_backups = false;
bool confim_power_off = true; bool confim_power_off = true;
bool load_devices_from_save_states = false; bool load_devices_from_save_states = false;
bool apply_compatibility_settings = true;
bool apply_game_settings = true; bool apply_game_settings = true;
bool auto_load_cheats = true; bool auto_load_cheats = true;
bool disable_all_enhancements = false; bool disable_all_enhancements = false;

View file

@ -825,7 +825,7 @@ void System::LoadSettings(bool display_osd_messages)
Host::LoadSettings(si, lock); Host::LoadSettings(si, lock);
// apply compatibility settings // apply compatibility settings
if (g_settings.apply_game_settings && !s_running_game_code.empty()) if (g_settings.apply_compatibility_settings && !s_running_game_code.empty())
{ {
const GameDatabase::Entry* entry = GameDatabase::GetEntryForSerial(s_running_game_code); const GameDatabase::Entry* entry = GameDatabase::GetEntryForSerial(s_running_game_code);
if (entry) if (entry)
@ -848,6 +848,14 @@ void System::ApplySettings(bool display_osd_messages)
const Settings old_config(std::move(g_settings)); const Settings old_config(std::move(g_settings));
g_settings = Settings(); g_settings = Settings();
LoadSettings(display_osd_messages); LoadSettings(display_osd_messages);
// If we've disabled/enabled game settings, we need to reload without it.
if (g_settings.apply_game_settings != old_config.apply_game_settings)
{
UpdateGameSettingsLayer();
LoadSettings(display_osd_messages);
}
CheckForSettingsChanges(old_config); CheckForSettingsChanges(old_config);
Host::CheckForSettingsChanges(old_config); Host::CheckForSettingsChanges(old_config);
@ -867,7 +875,7 @@ bool System::ReloadGameSettings(bool display_osd_messages)
bool System::UpdateGameSettingsLayer() bool System::UpdateGameSettingsLayer()
{ {
std::unique_ptr<INISettingsInterface> new_interface; std::unique_ptr<INISettingsInterface> new_interface;
if (!s_running_game_code.empty()) if (g_settings.apply_game_settings && !s_running_game_code.empty())
{ {
std::string filename(GetGameSettingsPath(s_running_game_code)); std::string filename(GetGameSettingsPath(s_running_game_code));
if (FileSystem::FileExists(filename.c_str())) if (FileSystem::FileExists(filename.c_str()))

View file

@ -201,10 +201,12 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(SettingsDialog* dialog, QWidget*
addBooleanTweakOption(dialog, m_ui.tweakOptionTable, tr("Disable All Enhancements"), "Main", "DisableAllEnhancements", addBooleanTweakOption(dialog, m_ui.tweakOptionTable, tr("Disable All Enhancements"), "Main", "DisableAllEnhancements",
false); false);
addBooleanTweakOption(dialog, m_ui.tweakOptionTable, tr("Show Status Indicators"), "Display", "ShowStatusIndicators",
true);
addBooleanTweakOption(dialog, m_ui.tweakOptionTable, tr("Show Enhancement Settings"), "Display", "ShowEnhancements", addBooleanTweakOption(dialog, m_ui.tweakOptionTable, tr("Show Enhancement Settings"), "Display", "ShowEnhancements",
false); false);
addBooleanTweakOption(dialog, m_ui.tweakOptionTable, tr("Show Status Indicators"), "Display", "ShowStatusIndicators",
true);
addBooleanTweakOption(dialog, m_ui.tweakOptionTable, tr("Apply Compatibility Settings"), "Main",
"ApplyCompatibilitySettings", true);
addIntRangeTweakOption(dialog, m_ui.tweakOptionTable, tr("Display FPS Limit"), "Display", "MaxFPS", 0, 1000, 0); addIntRangeTweakOption(dialog, m_ui.tweakOptionTable, tr("Display FPS Limit"), "Display", "MaxFPS", 0, 1000, 0);
addMSAATweakOption(dialog, m_ui.tweakOptionTable, tr("Multisample Antialiasing")); addMSAATweakOption(dialog, m_ui.tweakOptionTable, tr("Multisample Antialiasing"));
@ -281,8 +283,9 @@ void AdvancedSettingsWidget::onResetToDefaultClicked()
int i = 0; int i = 0;
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Disable all enhancements setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Disable all enhancements
setBooleanTweakOption(m_ui.tweakOptionTable, i++, true); // Show status indicators
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Show enhancement settings setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Show enhancement settings
setBooleanTweakOption(m_ui.tweakOptionTable, i++, true); // Show status indicators
setBooleanTweakOption(m_ui.tweakOptionTable, i++, true); // Apply compatibility settings
setIntRangeTweakOption(m_ui.tweakOptionTable, i++, 0); // Display FPS limit setIntRangeTweakOption(m_ui.tweakOptionTable, i++, 0); // Display FPS limit
setChoiceTweakOption(m_ui.tweakOptionTable, i++, 0); // Multisample antialiasing setChoiceTweakOption(m_ui.tweakOptionTable, i++, 0); // Multisample antialiasing
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // PGXP vertex cache setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // PGXP vertex cache