From 5026dda9cae68dafcce784efadb196fa6bc70379 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Wed, 23 Nov 2022 00:34:50 +1000 Subject: [PATCH] Qt: Fix Enable Per-Game Settings option --- pcsx2-qt/Settings/EmulationSettingsWidget.cpp | 9 ++++++++- pcsx2/Frontend/FullscreenUI.cpp | 7 +++++-- pcsx2/VMManager.cpp | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/pcsx2-qt/Settings/EmulationSettingsWidget.cpp b/pcsx2-qt/Settings/EmulationSettingsWidget.cpp index 63eebc73a3..278701f1a9 100644 --- a/pcsx2-qt/Settings/EmulationSettingsWidget.cpp +++ b/pcsx2-qt/Settings/EmulationSettingsWidget.cpp @@ -49,10 +49,17 @@ EmulationSettingsWidget::EmulationSettingsWidget(SettingsDialog* dialog, QWidget SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.cheats, "EmuCore", "EnableCheats", false); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.widescreenPatches, "EmuCore", "EnableWideScreenPatches", false); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.noInterlacingPatches, "EmuCore", "EnableNoInterlacingPatches", false); - SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.perGameSettings, "EmuCore", "EnablePerGameSettings", true); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.hostFilesystem, "EmuCore", "HostFs", false); SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.warnAboutUnsafeSettings, "EmuCore", "WarnAboutUnsafeSettings", true); + // Per-game settings is special, we don't want to bind it if we're editing per-game settings. + m_ui.perGameSettings->setEnabled(!dialog->isPerGameSettings()); + if (!dialog->isPerGameSettings()) + { + SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.perGameSettings, "EmuCore", "EnablePerGameSettings", true); + connect(m_ui.perGameSettings, &QCheckBox::stateChanged, g_emu_thread, &EmuThread::reloadGameSettings); + } + dialog->registerWidgetHelp(m_ui.normalSpeed, tr("Normal Speed"), "100%", tr("Sets the target emulation speed. It is not guaranteed that this speed will be reached, " "and if not, the emulator will run as fast as it can manage.")); diff --git a/pcsx2/Frontend/FullscreenUI.cpp b/pcsx2/Frontend/FullscreenUI.cpp index 3de29b659d..877dbc00f4 100644 --- a/pcsx2/Frontend/FullscreenUI.cpp +++ b/pcsx2/Frontend/FullscreenUI.cpp @@ -2633,8 +2633,11 @@ void FullscreenUI::DrawEmulationSettingsPage() "EnableWideScreenPatches", false); DrawToggleSetting(bsi, "Enable No-Interlacing Patches", "Enables loading no-interlacing patches from pnach files.", "EmuCore", "EnableNoInterlacingPatches", false); - DrawToggleSetting(bsi, "Enable Per-Game Settings", "Enables loading ini overlays from gamesettings, or custom settings per-game.", - "EmuCore", "EnablePerGameSettings", true); + if (DrawToggleSetting(bsi, "Enable Per-Game Settings", "Enables loading ini overlays from gamesettings, or custom settings per-game.", + "EmuCore", "EnablePerGameSettings", IsEditingGameSettings(bsi))) + { + Host::RunOnCPUThread(&VMManager::ReloadGameSettings); + } DrawToggleSetting(bsi, "Enable Host Filesystem", "Enables access to files from the host: namespace in the virtual machine.", "EmuCore", "HostFs", false); DrawToggleSetting(bsi, "Warn About Unsafe Settings", "Displays warnings when settings are enabled which may break games.", "EmuCore", diff --git a/pcsx2/VMManager.cpp b/pcsx2/VMManager.cpp index e3ef7af60b..69237aafce 100644 --- a/pcsx2/VMManager.cpp +++ b/pcsx2/VMManager.cpp @@ -421,7 +421,7 @@ void VMManager::RequestDisplaySize(float scale /*= 0.0f*/) bool VMManager::UpdateGameSettingsLayer() { std::unique_ptr new_interface; - if (s_game_crc != 0) + if (s_game_crc != 0 && Host::GetBaseBoolSettingValue("EmuCore", "EnablePerGameSettings", true)) { std::string filename(GetGameSettingsPath(s_game_serial.c_str(), s_game_crc)); if (!FileSystem::FileExists(filename.c_str()))