From 966860a4643a5adfb669135d8f1ac1f5de5cc150 Mon Sep 17 00:00:00 2001 From: Vova Date: Mon, 10 Feb 2025 15:25:19 +1000 Subject: [PATCH] Change: initialization of user configuration is now a separate function --- .../UI/ViewModels/MainWindowViewModel.cs | 33 +++++++++++++++---- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs index 4246a57a3..73455aa24 100644 --- a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs @@ -1523,8 +1523,34 @@ namespace Ryujinx.Ava.UI.ViewModels } } + public void InitializeUserConfig(ApplicationData application) + { + // Code where conditions will be met before loading the user configuration + BackendThreading backendThreadingValue = ConfigurationState.Instance.Graphics.BackendThreading.Value; + + // If a configuration is found in the "/games/xxxxxxxxxxxxxx" folder, the program will load the user setting. + string idGame = application.IdBaseString; + if (ConfigurationFileFormat.TryLoad(Program.GetDirGameUserConfig(idGame), out ConfigurationFileFormat configurationFileFormat)) + { + // Loads the user configuration, having previously changed the global configuration to the user configuration + ConfigurationState.Instance.Load(configurationFileFormat, Program.GetDirGameUserConfig(idGame, true, true), idGame); + } + + // Code where conditions will be executed after loading user configuration + if (ConfigurationState.Instance.Graphics.BackendThreading != backendThreadingValue) + { + /* + * The function to restart the emulator together with the selected game + Task.Run(async () => await Rebooter.RebootAppWithGame(application.Path)); + */ + } + } + public async Task LoadApplication(ApplicationData application, bool startFullscreen = false, BlitStruct? customNacpData = null) { + + InitializeUserConfig(application); + if (AppHost != null) { await ContentDialogHelper.CreateInfoDialog( @@ -1540,13 +1566,6 @@ namespace Ryujinx.Ava.UI.ViewModels #if RELEASE await PerformanceCheck(); #endif - - // If a configuration is found in the "/games/xxxxxxxxxxxxxx" folder, the program will load the user setting. - if (ConfigurationFileFormat.TryLoad(Program.GetDirGameUserConfig(application.IdBaseString), out ConfigurationFileFormat configurationFileFormat)) - { - // Loads the user configuration, having previously changed the global configuration to the user configuration - ConfigurationState.Instance.Load(configurationFileFormat, Program.GetDirGameUserConfig(application.IdBaseString, true, true), application.IdBaseString); - } Logger.RestartTime();