mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-04-24 06:47:44 +02:00
misc: chore: make some cleaner extensions for converting to/from ui/hle enums
This commit is contained in:
parent
b0c0e8f7ad
commit
27cdf876a2
4 changed files with 27 additions and 7 deletions
|
@ -1,6 +1,7 @@
|
||||||
using CommandLine;
|
using CommandLine;
|
||||||
using Gommon;
|
using Gommon;
|
||||||
using Ryujinx.Ava.Systems.Configuration;
|
using Ryujinx.Ava.Systems.Configuration;
|
||||||
|
using Ryujinx.Ava.Systems.Configuration.System;
|
||||||
using Ryujinx.Common.Configuration;
|
using Ryujinx.Common.Configuration;
|
||||||
using Ryujinx.Common.Configuration.Hid;
|
using Ryujinx.Common.Configuration.Hid;
|
||||||
using Ryujinx.HLE;
|
using Ryujinx.HLE;
|
||||||
|
@ -37,7 +38,7 @@ namespace Ryujinx.Headless
|
||||||
EnableInternetAccess = configurationState.System.EnableInternetAccess;
|
EnableInternetAccess = configurationState.System.EnableInternetAccess;
|
||||||
|
|
||||||
if (NeedsOverride(nameof(DisableFsIntegrityChecks)))
|
if (NeedsOverride(nameof(DisableFsIntegrityChecks)))
|
||||||
DisableFsIntegrityChecks = configurationState.System.EnableFsIntegrityChecks;
|
DisableFsIntegrityChecks = !configurationState.System.EnableFsIntegrityChecks;
|
||||||
|
|
||||||
if (NeedsOverride(nameof(FsGlobalAccessLogMode)))
|
if (NeedsOverride(nameof(FsGlobalAccessLogMode)))
|
||||||
FsGlobalAccessLogMode = configurationState.System.FsGlobalAccessLogMode;
|
FsGlobalAccessLogMode = configurationState.System.FsGlobalAccessLogMode;
|
||||||
|
@ -58,10 +59,10 @@ namespace Ryujinx.Headless
|
||||||
DisableDockedMode = !configurationState.System.EnableDockedMode;
|
DisableDockedMode = !configurationState.System.EnableDockedMode;
|
||||||
|
|
||||||
if (NeedsOverride(nameof(SystemLanguage)))
|
if (NeedsOverride(nameof(SystemLanguage)))
|
||||||
SystemLanguage = (SystemLanguage)(int)configurationState.System.Language.Value;
|
SystemLanguage = configurationState.System.Language.Value.ToHLE();
|
||||||
|
|
||||||
if (NeedsOverride(nameof(SystemRegion)))
|
if (NeedsOverride(nameof(SystemRegion)))
|
||||||
SystemRegion = (RegionCode)(int)configurationState.System.Region.Value;
|
SystemRegion = configurationState.System.Region.Value.ToHLE();
|
||||||
|
|
||||||
if (NeedsOverride(nameof(SystemTimeZone)))
|
if (NeedsOverride(nameof(SystemTimeZone)))
|
||||||
SystemTimeZone = configurationState.System.TimeZone;
|
SystemTimeZone = configurationState.System.TimeZone;
|
||||||
|
|
|
@ -9,6 +9,7 @@ using Ryujinx.Ava.UI.Helpers;
|
||||||
using Ryujinx.Ava.UI.Windows;
|
using Ryujinx.Ava.UI.Windows;
|
||||||
using Ryujinx.Ava.Utilities;
|
using Ryujinx.Ava.Utilities;
|
||||||
using Ryujinx.Ava.Systems.Configuration;
|
using Ryujinx.Ava.Systems.Configuration;
|
||||||
|
using Ryujinx.Ava.Systems.Configuration.System;
|
||||||
using Ryujinx.Ava.Utilities.SystemInfo;
|
using Ryujinx.Ava.Utilities.SystemInfo;
|
||||||
using Ryujinx.Common;
|
using Ryujinx.Common;
|
||||||
using Ryujinx.Common.Configuration;
|
using Ryujinx.Common.Configuration;
|
||||||
|
@ -282,16 +283,16 @@ namespace Ryujinx.Ava
|
||||||
|
|
||||||
// Check if region was overridden.
|
// Check if region was overridden.
|
||||||
if (CommandLineState.OverrideSystemRegion is not null)
|
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.
|
//Check if language was overridden.
|
||||||
if (CommandLineState.OverrideSystemLanguage is not null)
|
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.
|
// Check if hardware-acceleration was overridden.
|
||||||
|
|
|
@ -25,4 +25,13 @@ namespace Ryujinx.Ava.Systems.Configuration.System
|
||||||
TraditionalChinese,
|
TraditionalChinese,
|
||||||
BrazilianPortuguese,
|
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,
|
Korea,
|
||||||
Taiwan,
|
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…
Add table
Reference in a new issue