Implement GetRegionCode and add the RegionCode to settings (#999)

This implement `GetRegionCode` accordingly to RE. I've added a setting in the GUI and a field in the Configuration file with a way to update the Configuration file if needed.
This commit is contained in:
Ac_K 2020-03-19 23:37:55 +01:00 committed by GitHub
parent 561d64e5bf
commit 32d3f3f690
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 156 additions and 6 deletions

View file

@ -148,6 +148,11 @@ namespace Ryujinx.Configuration
/// </summary>
public ReactiveObject<Language> Language { get; private set; }
/// <summary>
/// Change System Region
/// </summary>
public ReactiveObject<Region> Region { get; private set; }
/// <summary>
/// Enables or disables Docked Mode
/// </summary>
@ -176,6 +181,7 @@ namespace Ryujinx.Configuration
public SystemSection()
{
Language = new ReactiveObject<Language>();
Region = new ReactiveObject<Region>();
EnableDockedMode = new ReactiveObject<bool>();
EnableMulticoreScheduling = new ReactiveObject<bool>();
EnableFsIntegrityChecks = new ReactiveObject<bool>();
@ -289,7 +295,7 @@ namespace Ryujinx.Configuration
{
ConfigurationFileFormat configurationFile = new ConfigurationFileFormat
{
Version = 1,
Version = 2,
GraphicsShadersDumpPath = Graphics.ShadersDumpPath,
LoggingEnableDebug = Logger.EnableDebug,
LoggingEnableStub = Logger.EnableStub,
@ -301,6 +307,7 @@ namespace Ryujinx.Configuration
LoggingFilteredClasses = Logger.FilteredClasses,
EnableFileLog = Logger.EnableFileLog,
SystemLanguage = System.Language,
SystemRegion = System.Region,
DockedMode = System.EnableDockedMode,
EnableDiscordIntegration = EnableDiscordIntegration,
EnableVsync = Graphics.EnableVsync,
@ -346,6 +353,7 @@ namespace Ryujinx.Configuration
Logger.FilteredClasses.Value = new LogClass[] { };
Logger.EnableFileLog.Value = true;
System.Language.Value = Language.AmericanEnglish;
System.Region.Value = Region.USA;
System.EnableDockedMode.Value = false;
EnableDiscordIntegration.Value = true;
Graphics.EnableVsync.Value = true;
@ -440,9 +448,11 @@ namespace Ryujinx.Configuration
};
}
public void Load(ConfigurationFileFormat configurationFileFormat)
public void Load(ConfigurationFileFormat configurationFileFormat, string configurationFilePath)
{
if (configurationFileFormat.Version != 1 && configurationFileFormat.Version != 0)
bool configurationFileUpdated = false;
if (configurationFileFormat.Version < 0 || configurationFileFormat.Version > 2)
{
Common.Logging.Logger.PrintWarning(LogClass.Application, $"Unsupported configuration version {configurationFileFormat.Version}, loading default.");
@ -451,6 +461,15 @@ namespace Ryujinx.Configuration
return;
}
if (configurationFileFormat.Version < 2)
{
Common.Logging.Logger.PrintWarning(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, needs to be updated.");
configurationFileFormat.SystemRegion = Region.USA;
configurationFileUpdated = true;
}
Graphics.ShadersDumpPath.Value = configurationFileFormat.GraphicsShadersDumpPath;
Logger.EnableDebug.Value = configurationFileFormat.LoggingEnableDebug;
Logger.EnableStub.Value = configurationFileFormat.LoggingEnableStub;
@ -462,6 +481,7 @@ namespace Ryujinx.Configuration
Logger.FilteredClasses.Value = configurationFileFormat.LoggingFilteredClasses;
Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog;
System.Language.Value = configurationFileFormat.SystemLanguage;
System.Region.Value = configurationFileFormat.SystemRegion;
System.EnableDockedMode.Value = configurationFileFormat.DockedMode;
System.EnableDockedMode.Value = configurationFileFormat.DockedMode;
EnableDiscordIntegration.Value = configurationFileFormat.EnableDiscordIntegration;
@ -487,6 +507,13 @@ namespace Ryujinx.Configuration
Hid.EnableKeyboard.Value = configurationFileFormat.EnableKeyboard;
Hid.KeyboardControls.Value = configurationFileFormat.KeyboardControls;
Hid.JoystickControls.Value = configurationFileFormat.JoystickControls;
if (configurationFileUpdated)
{
ToFileFormat().SaveConfig(configurationFilePath);
Common.Logging.Logger.PrintWarning(LogClass.Application, "Configuration file is updated!");
}
}
public static void Initialize()