settings: restore global state when necessary
Upon closing a game or the game properties dialog, we need to restore all global settings to the original global state so that we can properly open the configuration dialog or boot a different game.
This commit is contained in:
@@ -143,4 +143,41 @@ bool IsGPULevelHigh() {
|
||||
return values.gpu_accuracy == GPUAccuracy::Extreme || values.gpu_accuracy == GPUAccuracy::High;
|
||||
}
|
||||
|
||||
void RestoreGlobalState() {
|
||||
// Audio
|
||||
Settings::values.enable_audio_stretching.SetGlobal(true);
|
||||
Settings::values.volume.SetGlobal(true);
|
||||
|
||||
// Core
|
||||
Settings::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);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
} // namespace Settings
|
||||
|
||||
@@ -401,8 +401,8 @@ public:
|
||||
bool UsingGlobal() const {
|
||||
return use_global;
|
||||
};
|
||||
Type GetValue() const {
|
||||
if (use_global) {
|
||||
Type GetValue(bool need_global = false) const {
|
||||
if (use_global || need_global) {
|
||||
return global;
|
||||
}
|
||||
return local;
|
||||
@@ -547,4 +547,6 @@ std::string GetTimeZoneString();
|
||||
void Apply();
|
||||
void LogSettings();
|
||||
|
||||
void RestoreGlobalState();
|
||||
|
||||
} // namespace Settings
|
||||
|
||||
@@ -1049,12 +1049,8 @@ void GMainWindow::BootGame(const QString& filename) {
|
||||
return;
|
||||
}
|
||||
|
||||
//~ const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID();
|
||||
|
||||
// Swap settings to use game configuration if need be
|
||||
// REMOVE: Settings::SwapConfigValues(Settings::ValuesSwapTarget::ToGame);
|
||||
// Load per game settings
|
||||
Config per_game_config(fmt::format("{:016X}", title_id) + ".ini", false);
|
||||
// REMOVE: Settings::SwapConfigValues(Settings::ValuesSwapTarget::ToGlobal);
|
||||
|
||||
UpdateStatusButtons();
|
||||
|
||||
@@ -1149,6 +1145,9 @@ void GMainWindow::ShutdownGame() {
|
||||
// The emulation is stopped, so closing the window or not does not matter anymore
|
||||
disconnect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame);
|
||||
|
||||
// If any settings are set to use their per-game counterparts, switch back to global
|
||||
Settings::RestoreGlobalState();
|
||||
|
||||
// Update the GUI
|
||||
ui.action_Start->setEnabled(false);
|
||||
ui.action_Start->setText(tr("Start"));
|
||||
|
||||
Reference in New Issue
Block a user