mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2025-10-03 08:55:51 -05:00
Move solution and projects to src
This commit is contained in:
42
src/Ryujinx.HLE/HOS/SystemState/AppletStateMgr.cs
Normal file
42
src/Ryujinx.HLE/HOS/SystemState/AppletStateMgr.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||
using Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.SystemState
|
||||
{
|
||||
class AppletStateMgr
|
||||
{
|
||||
public ConcurrentQueue<AppletMessage> Messages { get; }
|
||||
|
||||
public FocusState FocusState { get; private set; }
|
||||
|
||||
public KEvent MessageEvent { get; }
|
||||
|
||||
public IdDictionary AppletResourceUserIds { get; }
|
||||
|
||||
public IdDictionary IndirectLayerHandles { get; }
|
||||
|
||||
public AppletStateMgr(Horizon system)
|
||||
{
|
||||
Messages = new ConcurrentQueue<AppletMessage>();
|
||||
MessageEvent = new KEvent(system.KernelContext);
|
||||
|
||||
AppletResourceUserIds = new IdDictionary();
|
||||
IndirectLayerHandles = new IdDictionary();
|
||||
}
|
||||
|
||||
public void SetFocus(bool isFocused)
|
||||
{
|
||||
FocusState = isFocused ? FocusState.InFocus : FocusState.OutOfFocus;
|
||||
|
||||
Messages.Enqueue(AppletMessage.FocusStateChanged);
|
||||
|
||||
if (isFocused)
|
||||
{
|
||||
Messages.Enqueue(AppletMessage.ChangeIntoForeground);
|
||||
}
|
||||
|
||||
MessageEvent.ReadableEvent.Signal();
|
||||
}
|
||||
}
|
||||
}
|
8
src/Ryujinx.HLE/HOS/SystemState/ColorSet.cs
Normal file
8
src/Ryujinx.HLE/HOS/SystemState/ColorSet.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Ryujinx.HLE.HOS.SystemState
|
||||
{
|
||||
public enum ColorSet
|
||||
{
|
||||
BasicWhite = 0,
|
||||
BasicBlack = 1
|
||||
}
|
||||
}
|
25
src/Ryujinx.HLE/HOS/SystemState/KeyboardLayout.cs
Normal file
25
src/Ryujinx.HLE/HOS/SystemState/KeyboardLayout.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace Ryujinx.HLE.HOS.SystemState
|
||||
{
|
||||
// nn::settings::KeyboardLayout
|
||||
public enum KeyboardLayout
|
||||
{
|
||||
Default = 0,
|
||||
EnglishUs,
|
||||
EnglishUsInternational,
|
||||
EnglishUk,
|
||||
French,
|
||||
FrenchCa,
|
||||
Spanish,
|
||||
SpanishLatin,
|
||||
German,
|
||||
Italian,
|
||||
Portuguese,
|
||||
Russian,
|
||||
Korean,
|
||||
ChineseSimplified,
|
||||
ChineseTraditional,
|
||||
|
||||
Min = Default,
|
||||
Max = ChineseTraditional
|
||||
}
|
||||
}
|
17
src/Ryujinx.HLE/HOS/SystemState/RegionCode.cs
Normal file
17
src/Ryujinx.HLE/HOS/SystemState/RegionCode.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace Ryujinx.HLE.HOS.SystemState
|
||||
{
|
||||
// nn::settings::RegionCode
|
||||
public enum RegionCode
|
||||
{
|
||||
Japan,
|
||||
USA,
|
||||
Europe,
|
||||
Australia,
|
||||
China,
|
||||
Korea,
|
||||
Taiwan,
|
||||
|
||||
Min = Japan,
|
||||
Max = Taiwan
|
||||
}
|
||||
}
|
24
src/Ryujinx.HLE/HOS/SystemState/SystemLanguage.cs
Normal file
24
src/Ryujinx.HLE/HOS/SystemState/SystemLanguage.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
namespace Ryujinx.HLE.HOS.SystemState
|
||||
{
|
||||
public enum SystemLanguage
|
||||
{
|
||||
Japanese,
|
||||
AmericanEnglish,
|
||||
French,
|
||||
German,
|
||||
Italian,
|
||||
Spanish,
|
||||
Chinese,
|
||||
Korean,
|
||||
Dutch,
|
||||
Portuguese,
|
||||
Russian,
|
||||
Taiwanese,
|
||||
BritishEnglish,
|
||||
CanadianFrench,
|
||||
LatinAmericanSpanish,
|
||||
SimplifiedChinese,
|
||||
TraditionalChinese,
|
||||
BrazilianPortuguese
|
||||
}
|
||||
}
|
90
src/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs
Normal file
90
src/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
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",
|
||||
"pt-BR"
|
||||
};
|
||||
|
||||
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.TraditionalChinese,
|
||||
SystemLanguage.Chinese or
|
||||
SystemLanguage.SimplifiedChinese => TitleLanguage.SimplifiedChinese,
|
||||
_ => Enum.Parse<TitleLanguage>(Enum.GetName<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;
|
||||
}
|
||||
}
|
||||
}
|
22
src/Ryujinx.HLE/HOS/SystemState/TitleLanguage.cs
Normal file
22
src/Ryujinx.HLE/HOS/SystemState/TitleLanguage.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace Ryujinx.HLE.HOS.SystemState
|
||||
{
|
||||
public enum TitleLanguage
|
||||
{
|
||||
AmericanEnglish,
|
||||
BritishEnglish,
|
||||
Japanese,
|
||||
French,
|
||||
German,
|
||||
LatinAmericanSpanish,
|
||||
Spanish,
|
||||
Italian,
|
||||
Dutch,
|
||||
CanadianFrench,
|
||||
Portuguese,
|
||||
Russian,
|
||||
Korean,
|
||||
TraditionalChinese,
|
||||
SimplifiedChinese,
|
||||
BrazilianPortuguese
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user