fix another logic error

In my efforts to guard RestoreGlobalState, I accidentally negated the IsPowered
condition.
This commit is contained in:
lat9nq
2020-06-25 14:39:56 -04:00
parent 3b62d75257
commit 20eef91cd4
4 changed files with 32 additions and 34 deletions

View File

@@ -145,44 +145,44 @@ bool IsGPULevelHigh() {
void RestoreGlobalState() {
// If a game is running, DO NOT restore the global settings state
if (!Core::System::GetInstance().IsPoweredOn()) {
if (Core::System::GetInstance().IsPoweredOn()) {
return;
}
// Audio
Settings::values.enable_audio_stretching.SetGlobal(true);
Settings::values.volume.SetGlobal(true);
values.enable_audio_stretching.SetGlobal(true);
values.volume.SetGlobal(true);
// Core
Settings::values.use_multi_core.SetGlobal(true);
values.use_multi_core.SetGlobal(true);
// Renderer
Settings::values.renderer_backend.SetGlobal(true);
Settings::values.renderer_debug.SetGlobal(true);
Settings::values.vulkan_device.SetGlobal(true);
Settings::values.aspect_ratio.SetGlobal(true);
Settings::values.max_anisotropy.SetGlobal(true);
Settings::values.use_frame_limit.SetGlobal(true);
Settings::values.frame_limit.SetGlobal(true);
Settings::values.use_disk_shader_cache.SetGlobal(true);
Settings::values.gpu_accuracy.SetGlobal(true);
Settings::values.use_asynchronous_gpu_emulation.SetGlobal(true);
Settings::values.use_vsync.SetGlobal(true);
Settings::values.use_assembly_shaders.SetGlobal(true);
Settings::values.use_fast_gpu_time.SetGlobal(true);
Settings::values.force_30fps_mode.SetGlobal(true);
Settings::values.bg_red.SetGlobal(true);
Settings::values.bg_green.SetGlobal(true);
Settings::values.bg_blue.SetGlobal(true);
values.renderer_backend.SetGlobal(true);
values.renderer_debug.SetGlobal(true);
values.vulkan_device.SetGlobal(true);
values.aspect_ratio.SetGlobal(true);
values.max_anisotropy.SetGlobal(true);
values.use_frame_limit.SetGlobal(true);
values.frame_limit.SetGlobal(true);
values.use_disk_shader_cache.SetGlobal(true);
values.gpu_accuracy.SetGlobal(true);
values.use_asynchronous_gpu_emulation.SetGlobal(true);
values.use_vsync.SetGlobal(true);
values.use_assembly_shaders.SetGlobal(true);
values.use_fast_gpu_time.SetGlobal(true);
values.force_30fps_mode.SetGlobal(true);
values.bg_red.SetGlobal(true);
values.bg_green.SetGlobal(true);
values.bg_blue.SetGlobal(true);
// System
Settings::values.current_user.SetGlobal(true);
Settings::values.language_index.SetGlobal(true);
Settings::values.region_index.SetGlobal(true);
Settings::values.time_zone_index.SetGlobal(true);
Settings::values.rng_seed.SetGlobal(true);
Settings::values.custom_rtc.SetGlobal(true);
Settings::values.sound_index.SetGlobal(true);
values.current_user.SetGlobal(true);
values.language_index.SetGlobal(true);
values.region_index.SetGlobal(true);
values.time_zone_index.SetGlobal(true);
values.rng_seed.SetGlobal(true);
values.custom_rtc.SetGlobal(true);
values.sound_index.SetGlobal(true);
}
} // namespace Settings

View File

@@ -1264,7 +1264,7 @@ QVariant Config::ReadSetting(const QString& name, const QVariant& default_value)
template <typename Type>
void Config::ReadSettingGlobal(Settings::Setting<Type>& setting, const QString& name) {
bool use_global = qt_config->value(name + QStringLiteral("/use_global"), true).toBool();
setting.SetGlobal(use_global || global);
setting.SetGlobal(use_global);
if (global || !use_global) {
setting.SetValue(ReadSetting(name).value<Type>());
}
@@ -1286,8 +1286,6 @@ void Config::ReadSettingGlobal(Type& setting, const QString& name,
bool use_global = qt_config->value(name + QStringLiteral("/use_global"), true).toBool();
if (global || !use_global) {
setting = ReadSetting(name, default_value).value<Type>();
} else {
setting = default_value.value<Type>();
}
}

View File

@@ -55,10 +55,10 @@ void ConfigurePerGame::ApplyConfiguration() {
ui->graphicsAdvancedTab->ApplyConfiguration();
ui->audioTab->ApplyConfiguration();
game_config->Save();
Settings::Apply();
Settings::LogSettings();
game_config->Save();
}
void ConfigurePerGame::changeEvent(QEvent* event) {

View File

@@ -1550,7 +1550,7 @@ void GMainWindow::OnGameListOpenPerGameProperties(const std::string& file) {
game_list->PopulateAsync(UISettings::values.game_dirs);
}
// Do not cause the global config to write local settings
// Do not cause the global config to write local settings into the config file
Settings::RestoreGlobalState();
if (!Core::System::GetInstance().IsPoweredOn()) {