Qt: Add option to disable per-game settings

This commit is contained in:
Connor McLaughlin 2020-08-21 00:08:40 +10:00
parent 5fca2d1d1c
commit bca609a2a6
6 changed files with 43 additions and 18 deletions

View File

@ -358,6 +358,7 @@ void HostInterface::SetDefaultSettings(SettingsInterface& si)
si.SetBoolValue("Main", "SaveStateOnExit", true);
si.SetBoolValue("Main", "ConfirmPowerOff", true);
si.SetBoolValue("Main", "LoadDevicesFromSaveStates", false);
si.SetBoolValue("Main", "ApplyGameSettings", true);
si.SetStringValue("CPU", "ExecutionMode", Settings::GetCPUExecutionModeName(Settings::DEFAULT_CPU_EXECUTION_MODE));
si.SetBoolValue("CPU", "RecompilerMemoryExceptions", false);

View File

@ -84,6 +84,7 @@ void Settings::Load(SettingsInterface& si)
save_state_on_exit = si.GetBoolValue("Main", "SaveStateOnExit", true);
confim_power_off = si.GetBoolValue("Main", "ConfirmPowerOff", true);
load_devices_from_save_states = si.GetBoolValue("Main", "LoadDevicesFromSaveStates", false);
apply_game_settings = si.GetBoolValue("Main", "ApplyGameSettings", true);
cpu_execution_mode =
ParseCPUExecutionMode(
@ -200,6 +201,7 @@ void Settings::Save(SettingsInterface& si) const
si.SetBoolValue("Main", "SaveStateOnExit", save_state_on_exit);
si.SetBoolValue("Main", "ConfirmPowerOff", confim_power_off);
si.SetBoolValue("Main", "LoadDevicesFromSaveStates", load_devices_from_save_states);
si.SetBoolValue("Main", "ApplyGameSettings", apply_game_settings);
si.SetStringValue("CPU", "ExecutionMode", GetCPUExecutionModeName(cpu_execution_mode));
si.SetBoolValue("CPU", "RecompilerMemoryExceptions", cpu_recompiler_memory_exceptions);

View File

@ -78,6 +78,7 @@ struct Settings
bool save_state_on_exit = true;
bool confim_power_off = true;
bool load_devices_from_save_states = false;
bool apply_game_settings = true;
GPURenderer gpu_renderer = GPURenderer::Software;
std::string gpu_adapter;

View File

@ -16,12 +16,15 @@ GeneralSettingsWidget::GeneralSettingsWidget(QtHostInterface* host_interface, QW
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.confirmPowerOff, "Main", "ConfirmPowerOff", true);
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.loadDevicesFromSaveStates, "Main",
"LoadDevicesFromSaveStates", false);
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.applyGameSettings, "Main", "ApplyGameSettings",
true);
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.showOSDMessages, "Display", "ShowOSDMessages",
true);
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.showFPS, "Display", "ShowFPS", false);
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.showVPS, "Display", "ShowVPS", false);
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.showSpeed, "Display", "ShowSpeed", false);
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.showResolution, "Display", "ShowResolution", false);
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.showResolution, "Display", "ShowResolution",
false);
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.enableSpeedLimiter, "Main", "SpeedLimiterEnabled",
true);
@ -57,6 +60,10 @@ GeneralSettingsWidget::GeneralSettingsWidget(QtHostInterface* host_interface, QW
tr("When enabled, memory cards and controllers will be overwritten when save states are loaded. This can "
"result in lost saves, and controller type mismatches. For deterministic save states, enable this option, "
"otherwise leave disabled."));
dialog->registerWidgetHelp(
m_ui.applyGameSettings, tr("Apply Per-Game Settings"), tr("Checked"),
tr("When enabled, per-game settings will be applied, and incompatible enhancements will be disabled. You should "
"leave this option enabled except when testing enhancements with incompatible games."));
dialog->registerWidgetHelp(
m_ui.enableSpeedLimiter, tr("Enable Speed Limiter"), tr("Checked"),
tr("Throttles the emulation speed to the chosen speed above. If unchecked, the emulator will "
@ -82,15 +89,19 @@ GeneralSettingsWidget::GeneralSettingsWidget(QtHostInterface* host_interface, QW
tr("Shows the current emulation speed of the system in the top-right corner of the display as a percentage."));
// Since this one is compile-time selected, we don't put it in the .ui file.
const int last_row_count = m_ui.formLayout_4->rowCount();
int current_col = 1;
int current_row = m_ui.formLayout_4->rowCount() - current_col;
#ifdef WITH_DISCORD_PRESENCE
{
QCheckBox* enableDiscordPresence = new QCheckBox(tr("Enable Discord Presence"), m_ui.groupBox_4);
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, enableDiscordPresence, "Main",
"EnableDiscordPresence");
m_ui.formLayout_4->addWidget(enableDiscordPresence, last_row_count, 0);
m_ui.formLayout_4->addWidget(enableDiscordPresence, current_row, current_col);
dialog->registerWidgetHelp(enableDiscordPresence, tr("Enable Discord Presence"), tr("Unchecked"),
tr("Shows the game you are currently playing as part of your profile in Discord."));
current_col++;
current_row += (current_col / 2);
current_col %= 2;
}
#endif
if (AutoUpdaterDialog::isSupported())
@ -98,10 +109,13 @@ GeneralSettingsWidget::GeneralSettingsWidget(QtHostInterface* host_interface, QW
QCheckBox* enableDiscordPresence = new QCheckBox(tr("Enable Automatic Update Check"), m_ui.groupBox_4);
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, enableDiscordPresence, "AutoUpdater",
"CheckAtStartup", true);
m_ui.formLayout_4->addWidget(enableDiscordPresence, last_row_count, 1);
m_ui.formLayout_4->addWidget(enableDiscordPresence, current_row, current_col);
dialog->registerWidgetHelp(enableDiscordPresence, tr("Enable Automatic Update Check"), tr("Checked"),
tr("Automatically checks for updates to the program on startup. Updates can be deferred "
"until later or skipped entirely."));
current_col++;
current_row += (current_col / 2);
current_col %= 2;
}
}

View File

@ -32,6 +32,20 @@
<string>Behaviour</string>
</property>
<layout class="QGridLayout" name="formLayout_4">
<item row="0" column="1">
<widget class="QCheckBox" name="confirmPowerOff">
<property name="text">
<string>Confirm Power Off</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="renderToMain">
<property name="text">
<string>Render To Main Window</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="pauseOnStart">
<property name="text">
@ -39,10 +53,10 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="confirmPowerOff">
<item row="2" column="0">
<widget class="QCheckBox" name="startFullscreen">
<property name="text">
<string>Confirm Power Off</string>
<string>Start Fullscreen</string>
</property>
</widget>
</item>
@ -60,17 +74,10 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="startFullscreen">
<item row="3" column="0">
<widget class="QCheckBox" name="applyGameSettings">
<property name="text">
<string>Start Fullscreen</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="renderToMain">
<property name="text">
<string>Render To Main Window</string>
<string>Apply Per-Game Settings</string>
</property>
</widget>
</item>

View File

@ -2029,7 +2029,7 @@ bool CommonHostInterface::SaveScreenshot(const char* filename /* = nullptr */, b
void CommonHostInterface::ApplyGameSettings(bool display_osd_messages)
{
// this gets called while booting, so can't use valid
if (System::IsShutdown() || System::GetRunningCode().empty())
if (System::IsShutdown() || System::GetRunningCode().empty() || !g_settings.apply_game_settings)
return;
const GameSettings::Entry* gs = m_game_list->GetGameSettings(System::GetRunningPath(), System::GetRunningCode());