mirror of
https://git.743378673.xyz/MeloNX/MeloNX.git
synced 2025-07-16 04:06:28 +02:00
Fix GetDesiredLanguage and expose a way to set the desired language, default to english
This commit is contained in:
parent
f73a182b20
commit
071754aaeb
5 changed files with 83 additions and 63 deletions
|
@ -1,7 +1,30 @@
|
|||
using System;
|
||||
|
||||
namespace Ryujinx.Core.OsHle
|
||||
{
|
||||
class SystemStateMgr
|
||||
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 static string[] AudioOutputs = new string[]
|
||||
{
|
||||
"AudioTvOutput",
|
||||
|
@ -9,13 +32,22 @@ namespace Ryujinx.Core.OsHle
|
|||
"AudioBuiltInSpeakerOutput"
|
||||
};
|
||||
|
||||
public string ActiveAudioOutput { get; private set; }
|
||||
internal long DesiredLanguageCode { get; private set; }
|
||||
|
||||
internal string ActiveAudioOutput { get; private set; }
|
||||
|
||||
public SystemStateMgr()
|
||||
{
|
||||
SetLanguage(SystemLanguage.AmericanEnglish);
|
||||
|
||||
SetAudioOutputAsBuiltInSpeaker();
|
||||
}
|
||||
|
||||
public void SetLanguage(SystemLanguage Language)
|
||||
{
|
||||
DesiredLanguageCode = GetLanguageCode((int)Language);
|
||||
}
|
||||
|
||||
public void SetAudioOutputAsTv()
|
||||
{
|
||||
ActiveAudioOutput = AudioOutputs[0];
|
||||
|
@ -30,5 +62,23 @@ namespace Ryujinx.Core.OsHle
|
|||
{
|
||||
ActiveAudioOutput = AudioOutputs[2];
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue