diff options
| author | Ac_K <Acoustik666@gmail.com> | 2020-03-19 23:37:55 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-20 09:37:55 +1100 |
| commit | 32d3f3f69024835d375401222b9abfbd32db37a5 (patch) | |
| tree | 6871397cced80d299a4c479fc86839b15d7eae94 /Ryujinx.Common/Configuration | |
| parent | 561d64e5bfd549c05b65c7bad87362bc03607363 (diff) | |
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.
Diffstat (limited to 'Ryujinx.Common/Configuration')
| -rw-r--r-- | Ryujinx.Common/Configuration/ConfigurationFileFormat.cs | 5 | ||||
| -rw-r--r-- | Ryujinx.Common/Configuration/ConfigurationState.cs | 33 | ||||
| -rw-r--r-- | Ryujinx.Common/Configuration/System/Region.cs | 13 |
3 files changed, 48 insertions, 3 deletions
diff --git a/Ryujinx.Common/Configuration/ConfigurationFileFormat.cs b/Ryujinx.Common/Configuration/ConfigurationFileFormat.cs index 1a9407cb..a18db16a 100644 --- a/Ryujinx.Common/Configuration/ConfigurationFileFormat.cs +++ b/Ryujinx.Common/Configuration/ConfigurationFileFormat.cs @@ -74,6 +74,11 @@ namespace Ryujinx.Configuration public Language SystemLanguage { get; set; } /// <summary> + /// Change System Region + /// </summary> + public Region SystemRegion { get; set; } + + /// <summary> /// Enables or disables Docked Mode /// </summary> public bool DockedMode { get; set; } diff --git a/Ryujinx.Common/Configuration/ConfigurationState.cs b/Ryujinx.Common/Configuration/ConfigurationState.cs index 050b4973..0f7b4084 100644 --- a/Ryujinx.Common/Configuration/ConfigurationState.cs +++ b/Ryujinx.Common/Configuration/ConfigurationState.cs @@ -149,6 +149,11 @@ namespace Ryujinx.Configuration 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> public ReactiveObject<bool> EnableDockedMode { get; private set; } @@ -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() diff --git a/Ryujinx.Common/Configuration/System/Region.cs b/Ryujinx.Common/Configuration/System/Region.cs new file mode 100644 index 00000000..54b1c36f --- /dev/null +++ b/Ryujinx.Common/Configuration/System/Region.cs @@ -0,0 +1,13 @@ +namespace Ryujinx.Configuration.System +{ + public enum Region + { + Japan, + USA, + Europe, + Australia, + China, + Korea, + Taiwan + } +} |
