mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2024-12-24 12:25:45 +00:00
b72f7de405
* aoc: Fixes some inconsistencies This PR fixes an wrong returned value (introduced in #2414) which cause some DLC not recognized in some games like Super Robot War T. Additionnally to that, I've removed the EventHandle check too, because it could cause some issues, but sadly it doesn't do the job so I reverted the changes. It should fix Diablo III: Eternal Collection. * Fix loop * Revert TitleLanguage change * write only available ids
89 lines
No EOL
2.4 KiB
C#
89 lines
No EOL
2.4 KiB
C#
using System;
|
|
|
|
namespace Ryujinx.HLE.HOS.SystemState
|
|
{
|
|
public class SystemStateMgr
|
|
{
|
|
internal static string[] LanguageCodes = new string[]
|
|
{
|
|
"ja",
|
|
"en-US",
|
|
"fr",
|
|
"de",
|
|
"it",
|
|
"es",
|
|
"zh-CN",
|
|
"ko",
|
|
"nl",
|
|
"pt",
|
|
"ru",
|
|
"zh-TW",
|
|
"en-GB",
|
|
"fr-CA",
|
|
"es-419",
|
|
"zh-Hans",
|
|
"zh-Hant"
|
|
};
|
|
|
|
internal long DesiredKeyboardLayout { get; private set; }
|
|
|
|
internal SystemLanguage DesiredSystemLanguage { get; private set; }
|
|
|
|
internal long DesiredLanguageCode { get; private set; }
|
|
|
|
internal uint DesiredRegionCode { get; private set; }
|
|
|
|
public TitleLanguage DesiredTitleLanguage { get; private set; }
|
|
|
|
public bool DockedMode { get; set; }
|
|
|
|
public ColorSet ThemeColor { get; set; }
|
|
|
|
public string DeviceNickName { get; set; }
|
|
|
|
public SystemStateMgr()
|
|
{
|
|
// TODO: Let user specify fields.
|
|
DesiredKeyboardLayout = (long)KeyboardLayout.Default;
|
|
DeviceNickName = "Ryujinx's Switch";
|
|
}
|
|
|
|
public void SetLanguage(SystemLanguage language)
|
|
{
|
|
DesiredSystemLanguage = language;
|
|
DesiredLanguageCode = GetLanguageCode((int)DesiredSystemLanguage);
|
|
|
|
DesiredTitleLanguage = language switch
|
|
{
|
|
SystemLanguage.Taiwanese or
|
|
SystemLanguage.TraditionalChinese => TitleLanguage.Taiwanese,
|
|
SystemLanguage.Chinese or
|
|
SystemLanguage.SimplifiedChinese => TitleLanguage.Chinese,
|
|
_ => Enum.Parse<TitleLanguage>(Enum.GetName(typeof(SystemLanguage), language)),
|
|
};
|
|
}
|
|
|
|
public void SetRegion(RegionCode region)
|
|
{
|
|
DesiredRegionCode = (uint)region;
|
|
}
|
|
|
|
internal static long GetLanguageCode(int index)
|
|
{
|
|
if ((uint)index >= LanguageCodes.Length)
|
|
{
|
|
throw new ArgumentOutOfRangeException(nameof(index));
|
|
}
|
|
|
|
long code = 0;
|
|
int shift = 0;
|
|
|
|
foreach (char chr in LanguageCodes[index])
|
|
{
|
|
code |= (long)(byte)chr << shift++ * 8;
|
|
}
|
|
|
|
return code;
|
|
}
|
|
}
|
|
} |