mirror of
https://github.com/Ryubing/Ryujinx.git
synced 2025-03-10 09:04:23 +00:00
misc: chore: make some cleaner extensions for converting to/from ui/hle enums
This commit is contained in:
parent
b0c0e8f7ad
commit
27cdf876a2
@ -1,6 +1,7 @@
|
||||
using CommandLine;
|
||||
using Gommon;
|
||||
using Ryujinx.Ava.Systems.Configuration;
|
||||
using Ryujinx.Ava.Systems.Configuration.System;
|
||||
using Ryujinx.Common.Configuration;
|
||||
using Ryujinx.Common.Configuration.Hid;
|
||||
using Ryujinx.HLE;
|
||||
@ -37,7 +38,7 @@ namespace Ryujinx.Headless
|
||||
EnableInternetAccess = configurationState.System.EnableInternetAccess;
|
||||
|
||||
if (NeedsOverride(nameof(DisableFsIntegrityChecks)))
|
||||
DisableFsIntegrityChecks = configurationState.System.EnableFsIntegrityChecks;
|
||||
DisableFsIntegrityChecks = !configurationState.System.EnableFsIntegrityChecks;
|
||||
|
||||
if (NeedsOverride(nameof(FsGlobalAccessLogMode)))
|
||||
FsGlobalAccessLogMode = configurationState.System.FsGlobalAccessLogMode;
|
||||
@ -58,10 +59,10 @@ namespace Ryujinx.Headless
|
||||
DisableDockedMode = !configurationState.System.EnableDockedMode;
|
||||
|
||||
if (NeedsOverride(nameof(SystemLanguage)))
|
||||
SystemLanguage = (SystemLanguage)(int)configurationState.System.Language.Value;
|
||||
SystemLanguage = configurationState.System.Language.Value.ToHLE();
|
||||
|
||||
if (NeedsOverride(nameof(SystemRegion)))
|
||||
SystemRegion = (RegionCode)(int)configurationState.System.Region.Value;
|
||||
SystemRegion = configurationState.System.Region.Value.ToHLE();
|
||||
|
||||
if (NeedsOverride(nameof(SystemTimeZone)))
|
||||
SystemTimeZone = configurationState.System.TimeZone;
|
||||
|
@ -9,6 +9,7 @@ using Ryujinx.Ava.UI.Helpers;
|
||||
using Ryujinx.Ava.UI.Windows;
|
||||
using Ryujinx.Ava.Utilities;
|
||||
using Ryujinx.Ava.Systems.Configuration;
|
||||
using Ryujinx.Ava.Systems.Configuration.System;
|
||||
using Ryujinx.Ava.Utilities.SystemInfo;
|
||||
using Ryujinx.Common;
|
||||
using Ryujinx.Common.Configuration;
|
||||
@ -282,16 +283,16 @@ namespace Ryujinx.Ava
|
||||
|
||||
// Check if region was overridden.
|
||||
if (CommandLineState.OverrideSystemRegion is not null)
|
||||
if (Enum.TryParse(CommandLineState.OverrideSystemRegion, true, out Ryujinx.HLE.HOS.SystemState.RegionCode result))
|
||||
if (Enum.TryParse(CommandLineState.OverrideSystemRegion, true, out HLE.HOS.SystemState.RegionCode result))
|
||||
{
|
||||
ConfigurationState.Instance.System.Region.Value = (Systems.Configuration.System.Region)result;
|
||||
ConfigurationState.Instance.System.Region.Value = result.ToUI();
|
||||
}
|
||||
|
||||
//Check if language was overridden.
|
||||
if (CommandLineState.OverrideSystemLanguage is not null)
|
||||
if (Enum.TryParse(CommandLineState.OverrideSystemLanguage, true, out Ryujinx.HLE.HOS.SystemState.SystemLanguage result))
|
||||
if (Enum.TryParse(CommandLineState.OverrideSystemLanguage, true, out HLE.HOS.SystemState.SystemLanguage result))
|
||||
{
|
||||
ConfigurationState.Instance.System.Language.Value = (Systems.Configuration.System.Language)result;
|
||||
ConfigurationState.Instance.System.Language.Value = result.ToUI();
|
||||
}
|
||||
|
||||
// Check if hardware-acceleration was overridden.
|
||||
|
@ -25,4 +25,13 @@ namespace Ryujinx.Ava.Systems.Configuration.System
|
||||
TraditionalChinese,
|
||||
BrazilianPortuguese,
|
||||
}
|
||||
|
||||
public static class LanguageEnumHelper
|
||||
{
|
||||
public static Language ToUI(this HLE.HOS.SystemState.SystemLanguage hleLanguage)
|
||||
=> (Language)hleLanguage;
|
||||
|
||||
public static HLE.HOS.SystemState.SystemLanguage ToHLE(this Language uiLanguage)
|
||||
=> (HLE.HOS.SystemState.SystemLanguage)uiLanguage;
|
||||
}
|
||||
}
|
||||
|
@ -14,4 +14,13 @@ namespace Ryujinx.Ava.Systems.Configuration.System
|
||||
Korea,
|
||||
Taiwan,
|
||||
}
|
||||
|
||||
public static class RegionEnumHelper
|
||||
{
|
||||
public static Region ToUI(this HLE.HOS.SystemState.RegionCode hleRegion)
|
||||
=> (Region)hleRegion;
|
||||
|
||||
public static HLE.HOS.SystemState.RegionCode ToHLE(this Region uiRegion)
|
||||
=> (HLE.HOS.SystemState.RegionCode)uiRegion;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user