Added autorestart of the emulator if it is necessary to change the graphic multi-thread.

Code cleaning
This commit is contained in:
Vova
2025-02-11 14:06:31 +10:00
parent 0399af0ff9
commit 1ca5407c22
7 changed files with 192 additions and 11 deletions

View File

@@ -1523,10 +1523,16 @@ namespace Ryujinx.Ava.UI.ViewModels
}
}
public void InitializeUserConfig(ApplicationData application)
public bool InitializeUserConfig(ApplicationData application)
{
// Code where conditions will be met before loading the user configuration
// Code where conditions will be met before loading the user configuration (Global Config)
BackendThreading backendThreadingValue = ConfigurationState.Instance.Graphics.BackendThreading.Value;
string BackendThreadingInit = Program.BackendThreadingArg;
if (BackendThreadingInit is null)
{
BackendThreadingInit = ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString();
}
// If a configuration is found in the "/games/xxxxxxxxxxxxxx" folder, the program will load the user setting.
string idGame = application.IdBaseString;
@@ -1537,19 +1543,29 @@ namespace Ryujinx.Ava.UI.ViewModels
}
// Code where conditions will be executed after loading user configuration
if (ConfigurationState.Instance.Graphics.BackendThreading != backendThreadingValue)
if (ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString() != BackendThreadingInit)
{
/*
* The function to restart the emulator together with the selected game
Task.Run(async () => await Rebooter.RebootAppWithGame(application.Path));
*/
List<string> Arguments = new List<string>
{
"--bt", ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString() // BackendThreading
};
Rebooter.RebootAppWithGame(application.Path, Arguments);
return true;
}
return false;
}
public async Task LoadApplication(ApplicationData application, bool startFullscreen = false, BlitStruct<ApplicationControlProperty>? customNacpData = null)
{
InitializeUserConfig(application);
if (InitializeUserConfig(application))
{
return;
}
if (AppHost != null)
{