Compare commits

..

3 Commits

Author SHA1 Message Date
Babib3l
25306c221d Add UI keyboard trace logs for key state and rebinding 2026-03-30 20:07:22 +02:00
_Neo_
cd1ce67f89 Improve 1 locale ID 2026-03-30 20:25:41 +03:00
_Neo_
4c38af62ae Revert "Update Locale ID's for better readability"
Reverting the "readability" updates to the locale IDs due to helpful feedback from LotP. If these go get changed, then only in a similar MR.
2026-03-30 20:22:03 +03:00
6 changed files with 198 additions and 158 deletions

View File

@@ -47,7 +47,7 @@ If no json file exists for the specific part of the emulator you're working on,
}
},
{
"ID": "Key_Number9",
"ID": "KeyNumber9",
"Translations": {
"ar_SA": "٩",
"en_US": "9",

View File

@@ -1,7 +1,7 @@
{
"Locales": [
{
"ID": "Key_Unknown",
"ID": "KeyUnknown",
"Translations": {
"ar_SA": "مجهول",
"de_DE": "Unbekannt",
@@ -26,7 +26,7 @@
}
},
{
"ID": "Key_ShiftLeft",
"ID": "KeyShiftLeft",
"Translations": {
"ar_SA": "⇧ يسار",
"de_DE": "⇧ Links",
@@ -51,7 +51,7 @@
}
},
{
"ID": "Key_ShiftRight",
"ID": "KeyShiftRight",
"Translations": {
"ar_SA": "⇧ يمين",
"de_DE": "⇧ Rechts",
@@ -76,7 +76,7 @@
}
},
{
"ID": "Key_ControlLeft",
"ID": "KeyControlLeft",
"Translations": {
"ar_SA": "Ctrl الأيسر",
"de_DE": "Ctrl Links",
@@ -101,7 +101,7 @@
}
},
{
"ID": "Key_Mac_ControlLeft",
"ID": "KeyMacControlLeft",
"Translations": {
"ar_SA": "⌃ الأيسر",
"de_DE": "⌃ Links",
@@ -126,7 +126,7 @@
}
},
{
"ID": "Key_ControlRight",
"ID": "KeyControlRight",
"Translations": {
"ar_SA": "Ctrl الأيمن",
"de_DE": "Ctrl Rechts",
@@ -151,7 +151,7 @@
}
},
{
"ID": "Key_Mac_ControlRight",
"ID": "KeyMacControlRight",
"Translations": {
"ar_SA": "⌃ الأيمن",
"de_DE": "⌃ Rechts",
@@ -176,7 +176,7 @@
}
},
{
"ID": "Key_AltLeft",
"ID": "KeyAltLeft",
"Translations": {
"ar_SA": "Alt الأيسر",
"de_DE": "Alt Links",
@@ -201,7 +201,7 @@
}
},
{
"ID": "Key_Mac_AltLeft",
"ID": "KeyMacAltLeft",
"Translations": {
"ar_SA": "⌥ الأيسر",
"de_DE": "⌥ Links",
@@ -226,7 +226,7 @@
}
},
{
"ID": "Key_AltRight",
"ID": "KeyAltRight",
"Translations": {
"ar_SA": "Alt الأيمن",
"de_DE": "Alt Rechts",
@@ -251,7 +251,7 @@
}
},
{
"ID": "Key_Mac_AltRight",
"ID": "KeyMacAltRight",
"Translations": {
"ar_SA": "⌥ الأيمن",
"de_DE": "⌥ Rechts",
@@ -276,7 +276,7 @@
}
},
{
"ID": "Key_WinLeft",
"ID": "KeyWinLeft",
"Translations": {
"ar_SA": "⊞ الأيسر",
"de_DE": "⊞ Links",
@@ -301,7 +301,7 @@
}
},
{
"ID": "Key_Mac_WinLeft",
"ID": "KeyMacWinLeft",
"Translations": {
"ar_SA": "⌘ الأيسر",
"de_DE": "⌘ Links",
@@ -326,7 +326,7 @@
}
},
{
"ID": "Key_WinRight",
"ID": "KeyWinRight",
"Translations": {
"ar_SA": "⊞ الأيمن",
"de_DE": "⊞ Rechts",
@@ -351,7 +351,7 @@
}
},
{
"ID": "Key_Mac_WinRight",
"ID": "KeyMacWinRight",
"Translations": {
"ar_SA": "⌘ الأيمن",
"de_DE": "⌘ Rechts",
@@ -376,7 +376,7 @@
}
},
{
"ID": "Key_Up",
"ID": "KeyUp",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -401,7 +401,7 @@
}
},
{
"ID": "Key_Down",
"ID": "KeyDown",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -426,7 +426,7 @@
}
},
{
"ID": "Key_Left",
"ID": "KeyLeft",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -451,7 +451,7 @@
}
},
{
"ID": "Key_Right",
"ID": "KeyRight",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -476,7 +476,7 @@
}
},
{
"ID": "Key_Enter",
"ID": "KeyEnter",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -501,7 +501,7 @@
}
},
{
"ID": "Key_Escape",
"ID": "KeyEscape",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -526,7 +526,7 @@
}
},
{
"ID": "Key_Space",
"ID": "KeySpace",
"Translations": {
"ar_SA": "مسافة",
"de_DE": "Leertaste",
@@ -551,7 +551,7 @@
}
},
{
"ID": "Key_Tab",
"ID": "KeyTab",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -576,7 +576,7 @@
}
},
{
"ID": "Key_BackSpace",
"ID": "KeyBackSpace",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -601,7 +601,7 @@
}
},
{
"ID": "Key_Insert",
"ID": "KeyInsert",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -626,7 +626,7 @@
}
},
{
"ID": "Key_Delete",
"ID": "KeyDelete",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -651,7 +651,7 @@
}
},
{
"ID": "Key_PageUp",
"ID": "KeyPageUp",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -676,7 +676,7 @@
}
},
{
"ID": "Key_PageDown",
"ID": "KeyPageDown",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -701,7 +701,7 @@
}
},
{
"ID": "Key_Home",
"ID": "KeyHome",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -726,7 +726,7 @@
}
},
{
"ID": "Key_End",
"ID": "KeyEnd",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -751,7 +751,7 @@
}
},
{
"ID": "Key_CapsLock",
"ID": "KeyCapsLock",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -776,7 +776,7 @@
}
},
{
"ID": "Key_ScrollLock",
"ID": "KeyScrollLock",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -801,7 +801,7 @@
}
},
{
"ID": "Key_PrintScreen",
"ID": "KeyPrintScreen",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -826,7 +826,7 @@
}
},
{
"ID": "Key_Pause",
"ID": "KeyPause",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -851,7 +851,7 @@
}
},
{
"ID": "Key_NumLock",
"ID": "KeyNumLock",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -876,7 +876,7 @@
}
},
{
"ID": "Key_Clear",
"ID": "KeyClear",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -901,7 +901,7 @@
}
},
{
"ID": "Key_Keypad0",
"ID": "KeyKeypad0",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -926,7 +926,7 @@
}
},
{
"ID": "Key_Keypad1",
"ID": "KeyKeypad1",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -951,7 +951,7 @@
}
},
{
"ID": "Key_Keypad2",
"ID": "KeyKeypad2",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -976,7 +976,7 @@
}
},
{
"ID": "Key_Keypad3",
"ID": "KeyKeypad3",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -1001,7 +1001,7 @@
}
},
{
"ID": "Key_Keypad4",
"ID": "KeyKeypad4",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -1026,7 +1026,7 @@
}
},
{
"ID": "Key_Keypad5",
"ID": "KeyKeypad5",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -1051,7 +1051,7 @@
}
},
{
"ID": "Key_Keypad6",
"ID": "KeyKeypad6",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -1076,7 +1076,7 @@
}
},
{
"ID": "Key_Keypad7",
"ID": "KeyKeypad7",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -1101,7 +1101,7 @@
}
},
{
"ID": "Key_Keypad8",
"ID": "KeyKeypad8",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -1126,7 +1126,7 @@
}
},
{
"ID": "Key_Keypad9",
"ID": "KeyKeypad9",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -1151,7 +1151,7 @@
}
},
{
"ID": "Key_KeypadDivide",
"ID": "KeyKeypadDivide",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -1176,7 +1176,7 @@
}
},
{
"ID": "Key_KeypadMultiply",
"ID": "KeyKeypadMultiply",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -1201,7 +1201,7 @@
}
},
{
"ID": "Key_KeypadSubtract",
"ID": "KeyKeypadSubtract",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -1226,7 +1226,7 @@
}
},
{
"ID": "Key_KeypadAdd",
"ID": "KeyKeypadAdd",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -1251,7 +1251,7 @@
}
},
{
"ID": "Key_KeypadDecimal",
"ID": "KeyKeypadDecimal",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -1276,7 +1276,7 @@
}
},
{
"ID": "Key_KeypadEnter",
"ID": "KeyKeypadEnter",
"Translations": {
"ar_SA": null,
"de_DE": null,
@@ -1301,7 +1301,7 @@
}
},
{
"ID": "Key_Number0",
"ID": "KeyNumber0",
"Translations": {
"ar_SA": "٠",
"de_DE": "",
@@ -1326,7 +1326,7 @@
}
},
{
"ID": "Key_Number1",
"ID": "KeyNumber1",
"Translations": {
"ar_SA": "١",
"de_DE": "",
@@ -1351,7 +1351,7 @@
}
},
{
"ID": "Key_Number2",
"ID": "KeyNumber2",
"Translations": {
"ar_SA": "٢",
"de_DE": "",
@@ -1376,7 +1376,7 @@
}
},
{
"ID": "Key_Number3",
"ID": "KeyNumber3",
"Translations": {
"ar_SA": "٣",
"de_DE": "",
@@ -1401,7 +1401,7 @@
}
},
{
"ID": "Key_Number4",
"ID": "KeyNumber4",
"Translations": {
"ar_SA": "٤",
"de_DE": "",
@@ -1426,7 +1426,7 @@
}
},
{
"ID": "Key_Number5",
"ID": "KeyNumber5",
"Translations": {
"ar_SA": "٥",
"de_DE": "",
@@ -1451,7 +1451,7 @@
}
},
{
"ID": "Key_Number6",
"ID": "KeyNumber6",
"Translations": {
"ar_SA": "٦",
"de_DE": "",
@@ -1476,7 +1476,7 @@
}
},
{
"ID": "Key_Number7",
"ID": "KeyNumber7",
"Translations": {
"ar_SA": "٧",
"de_DE": "",
@@ -1501,7 +1501,7 @@
}
},
{
"ID": "Key_Number8",
"ID": "KeyNumber8",
"Translations": {
"ar_SA": "٨",
"de_DE": "",
@@ -1526,7 +1526,7 @@
}
},
{
"ID": "Key_Number9",
"ID": "KeyNumber9",
"Translations": {
"ar_SA": "٩",
"de_DE": "",
@@ -1551,7 +1551,7 @@
}
},
{
"ID": "Key_Tilde",
"ID": "KeyTilde",
"Translations": {
"ar_SA": "",
"de_DE": "",
@@ -1576,7 +1576,7 @@
}
},
{
"ID": "Key_Grave",
"ID": "KeyGrave",
"Translations": {
"ar_SA": "",
"de_DE": "",
@@ -1601,7 +1601,7 @@
}
},
{
"ID": "Key_Minus",
"ID": "KeyMinus",
"Translations": {
"ar_SA": "",
"de_DE": "",
@@ -1626,7 +1626,7 @@
}
},
{
"ID": "Key_Plus",
"ID": "KeyPlus",
"Translations": {
"ar_SA": "",
"de_DE": "",
@@ -1651,7 +1651,7 @@
}
},
{
"ID": "Key_BracketLeft",
"ID": "KeyBracketLeft",
"Translations": {
"ar_SA": "",
"de_DE": "",
@@ -1676,7 +1676,7 @@
}
},
{
"ID": "Key_BracketRight",
"ID": "KeyBracketRight",
"Translations": {
"ar_SA": "",
"de_DE": "",
@@ -1701,7 +1701,7 @@
}
},
{
"ID": "Key_Semicolon",
"ID": "KeySemicolon",
"Translations": {
"ar_SA": "",
"de_DE": "",
@@ -1726,7 +1726,7 @@
}
},
{
"ID": "Key_Quote",
"ID": "KeyQuote",
"Translations": {
"ar_SA": "",
"de_DE": "",
@@ -1751,7 +1751,7 @@
}
},
{
"ID": "Key_Comma",
"ID": "KeyComma",
"Translations": {
"ar_SA": "",
"de_DE": "",
@@ -1776,7 +1776,7 @@
}
},
{
"ID": "Key_Period",
"ID": "KeyPeriod",
"Translations": {
"ar_SA": "",
"de_DE": "",
@@ -1801,7 +1801,7 @@
}
},
{
"ID": "Key_Slash",
"ID": "KeySlash",
"Translations": {
"ar_SA": "",
"de_DE": "",
@@ -1826,7 +1826,7 @@
}
},
{
"ID": "Key_BackSlash",
"ID": "KeyBackSlash",
"Translations": {
"ar_SA": "",
"de_DE": "",
@@ -1851,7 +1851,7 @@
}
},
{
"ID": "Key_Unbound",
"ID": "KeyUnbound",
"Translations": {
"ar_SA": "غير مرتبط",
"de_DE": "Ungebunden",
@@ -1876,7 +1876,7 @@
}
},
{
"ID": "InputType_Keyboard",
"ID": "KeyboardInputMode",
"Translations": {
"ar_SA": "لوحة المفاتيح",
"de_DE": "Tastatur",

View File

@@ -1,3 +1,5 @@
using Ryujinx.Common.Logging;
namespace Ryujinx.Input.Assigner
{
/// <summary>
@@ -24,7 +26,21 @@ namespace Ryujinx.Input.Assigner
{
_keyboardState = _keyboard.GetKeyboardStateSnapshot();
_pressedButton ??= GetPressedButtonFromState() ?? GetPressedButtonFromBufferedPress();
if (_pressedButton is not null)
{
return;
}
Button? buttonFromState = GetPressedButtonFromState();
Button? buttonFromBufferedPress = buttonFromState is null ? GetPressedButtonFromBufferedPress() : null;
_pressedButton = buttonFromState ?? buttonFromBufferedPress;
if (_pressedButton is not null)
{
string source = buttonFromState is not null ? "state" : "buffered-press";
Logger.Debug?.Print(LogClass.UI, $"Keyboard assigner registered key={_pressedButton.Value.AsHidType<Key>()}, source={source}, cancelPressed={ShouldCancel()}");
}
}
public bool IsAnyButtonPressed()

View File

@@ -1,6 +1,7 @@
using Avalonia.Controls;
using Avalonia.Input;
using Ryujinx.Ava.Common.Locale;
using Ryujinx.Common.Logging;
using Ryujinx.Input;
using System;
using System.Collections.Generic;
@@ -12,6 +13,13 @@ namespace Ryujinx.Ava.Input
{
internal class AvaloniaKeyboardDriver : IKeyboardModeDriver
{
private enum PhysicalKeySource
{
Direct,
ObservedFallback,
Unknown,
}
private static readonly string[] _keyboardIdentifers = ["0"];
private readonly Control _control;
private readonly HashSet<Key> _semanticPressedKeys;
@@ -74,7 +82,7 @@ namespace Ryujinx.Ava.Input
return null;
}
return new AvaloniaKeyboard(this, _keyboardIdentifers[0], LocaleManager.Instance[LocaleKeys.KeyboardLayout_InputType_Keyboard], mode);
return new AvaloniaKeyboard(this, _keyboardIdentifers[0], LocaleManager.Instance[LocaleKeys.KeyboardLayout_KeyboardInputMode], mode);
}
public IEnumerable<IGamepad> GetGamepads() => [GetGamepad("0")];
@@ -193,9 +201,11 @@ namespace Ryujinx.Ava.Input
{
Key semanticKey = AvaloniaKeyboardMappingHelper.ToInputKey(args.Key);
Key resolvedSemanticKey = AvaloniaKeyboardMappingHelper.ToInputKey(args.PhysicalKey, args.Key);
ConfigPhysicalKey physicalKey = GetPhysicalInputKey(args, semanticKey);
ConfigPhysicalKey physicalKey = GetPhysicalInputKey(args, semanticKey, out PhysicalKeySource physicalKeySource);
bool semanticWasPressed = _semanticPressedKeys.Contains(resolvedSemanticKey);
bool physicalWasPressed = _physicalPressedKeys.Contains(physicalKey);
bool bufferedSemanticPress = false;
bool bufferedPhysicalPress = false;
UpdateKeyState(_semanticPressedKeys, resolvedSemanticKey, isPressed);
UpdateKeyState(_physicalPressedKeys, physicalKey, isPressed);
@@ -207,11 +217,13 @@ namespace Ryujinx.Ava.Input
if (!semanticWasPressed && resolvedSemanticKey is not Key.Unknown and not Key.Unbound)
{
_semanticPressedKeyQueue.Enqueue(resolvedSemanticKey);
bufferedSemanticPress = true;
}
if (!physicalWasPressed && physicalKey is not ConfigPhysicalKey.Unknown and not ConfigPhysicalKey.Unbound)
{
_physicalPressedKeyQueue.Enqueue((Key)(int)physicalKey);
bufferedPhysicalPress = true;
}
}
}
@@ -222,26 +234,38 @@ namespace Ryujinx.Ava.Input
{
_observedPhysicalKeysBySemanticKey[semanticKey] = physicalKey;
}
Logger.Trace?.Print(
LogClass.UI,
$"Keyboard {(isPressed ? "down" : "up")}: avaloniaKey={args.Key}, avaloniaPhysical={args.PhysicalKey}, keySymbol={FormatKeySymbol(args.KeySymbol)}, modifiers={args.KeyModifiers}, semantic={semanticKey}, resolvedSemantic={resolvedSemanticKey}, physical={physicalKey}, physicalSource={physicalKeySource}, bufferedSemantic={bufferedSemanticPress}, bufferedPhysical={bufferedPhysicalPress}, semanticPressed={_semanticPressedKeys.Count}, physicalPressed={_physicalPressedKeys.Count}");
}
private ConfigPhysicalKey GetPhysicalInputKey(KeyEventArgs args, Key semanticKey)
private ConfigPhysicalKey GetPhysicalInputKey(KeyEventArgs args, Key semanticKey, out PhysicalKeySource source)
{
Key key = AvaloniaKeyboardMappingHelper.ToInputKey(args.PhysicalKey);
if (key is >= Key.Unknown and < Key.Count)
{
source = PhysicalKeySource.Direct;
return (ConfigPhysicalKey)(int)key;
}
if (semanticKey is not Key.Unknown and not Key.Unbound &&
_observedPhysicalKeysBySemanticKey.TryGetValue(semanticKey, out ConfigPhysicalKey observedPhysicalKey))
{
source = PhysicalKeySource.ObservedFallback;
return observedPhysicalKey;
}
source = PhysicalKeySource.Unknown;
return ConfigPhysicalKey.Unknown;
}
private static string FormatKeySymbol(string keySymbol)
{
return string.IsNullOrEmpty(keySymbol) ? "<none>" : keySymbol;
}
public void Dispose()
{
Dispose(true);

View File

@@ -38,14 +38,14 @@ namespace Ryujinx.Ava.UI.Helpers
{ GamepadInputId.SingleRightTrigger0, LocaleKeys.GamepadSingleRightTrigger0},
{ GamepadInputId.SingleLeftTrigger1, LocaleKeys.GamepadSingleLeftTrigger1},
{ GamepadInputId.SingleRightTrigger1, LocaleKeys.GamepadSingleRightTrigger1},
{ GamepadInputId.Unbound, LocaleKeys.KeyboardLayout_Key_Unbound},
{ GamepadInputId.Unbound, LocaleKeys.KeyboardLayout_KeyUnbound},
};
private static readonly Dictionary<StickInputId, LocaleKeys> _stickInputIdMap = new()
{
{ StickInputId.Left, LocaleKeys.StickLeft},
{ StickInputId.Right, LocaleKeys.StickRight},
{ StickInputId.Unbound, LocaleKeys.KeyboardLayout_Key_Unbound},
{ StickInputId.Unbound, LocaleKeys.KeyboardLayout_KeyUnbound},
};
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)

View File

@@ -10,79 +10,79 @@ namespace Ryujinx.Ava.UI.Helpers
{
private static readonly Dictionary<InputKey, LocaleKeys> _sharedLocalizedKeysMap = new()
{
[InputKey.Unknown] = LocaleKeys.KeyboardLayout_Key_Unknown,
[InputKey.ShiftLeft] = LocaleKeys.KeyboardLayout_Key_ShiftLeft,
[InputKey.ShiftRight] = LocaleKeys.KeyboardLayout_Key_ShiftRight,
[InputKey.ControlLeft] = LocaleKeys.KeyboardLayout_Key_ControlLeft,
[InputKey.ControlRight] = LocaleKeys.KeyboardLayout_Key_ControlRight,
[InputKey.AltLeft] = LocaleKeys.KeyboardLayout_Key_AltLeft,
[InputKey.AltRight] = LocaleKeys.KeyboardLayout_Key_AltRight,
[InputKey.WinLeft] = LocaleKeys.KeyboardLayout_Key_WinLeft,
[InputKey.WinRight] = LocaleKeys.KeyboardLayout_Key_WinRight,
[InputKey.Up] = LocaleKeys.KeyboardLayout_Key_Up,
[InputKey.Down] = LocaleKeys.KeyboardLayout_Key_Down,
[InputKey.Left] = LocaleKeys.KeyboardLayout_Key_Left,
[InputKey.Right] = LocaleKeys.KeyboardLayout_Key_Right,
[InputKey.Enter] = LocaleKeys.KeyboardLayout_Key_Enter,
[InputKey.Escape] = LocaleKeys.KeyboardLayout_Key_Escape,
[InputKey.Space] = LocaleKeys.KeyboardLayout_Key_Space,
[InputKey.Tab] = LocaleKeys.KeyboardLayout_Key_Tab,
[InputKey.BackSpace] = LocaleKeys.KeyboardLayout_Key_BackSpace,
[InputKey.Insert] = LocaleKeys.KeyboardLayout_Key_Insert,
[InputKey.Delete] = LocaleKeys.KeyboardLayout_Key_Delete,
[InputKey.PageUp] = LocaleKeys.KeyboardLayout_Key_PageUp,
[InputKey.PageDown] = LocaleKeys.KeyboardLayout_Key_PageDown,
[InputKey.Home] = LocaleKeys.KeyboardLayout_Key_Home,
[InputKey.End] = LocaleKeys.KeyboardLayout_Key_End,
[InputKey.CapsLock] = LocaleKeys.KeyboardLayout_Key_CapsLock,
[InputKey.ScrollLock] = LocaleKeys.KeyboardLayout_Key_ScrollLock,
[InputKey.PrintScreen] = LocaleKeys.KeyboardLayout_Key_PrintScreen,
[InputKey.Pause] = LocaleKeys.KeyboardLayout_Key_Pause,
[InputKey.NumLock] = LocaleKeys.KeyboardLayout_Key_NumLock,
[InputKey.Clear] = LocaleKeys.KeyboardLayout_Key_Clear,
[InputKey.Keypad0] = LocaleKeys.KeyboardLayout_Key_Keypad0,
[InputKey.Keypad1] = LocaleKeys.KeyboardLayout_Key_Keypad1,
[InputKey.Keypad2] = LocaleKeys.KeyboardLayout_Key_Keypad2,
[InputKey.Keypad3] = LocaleKeys.KeyboardLayout_Key_Keypad3,
[InputKey.Keypad4] = LocaleKeys.KeyboardLayout_Key_Keypad4,
[InputKey.Keypad5] = LocaleKeys.KeyboardLayout_Key_Keypad5,
[InputKey.Keypad6] = LocaleKeys.KeyboardLayout_Key_Keypad6,
[InputKey.Keypad7] = LocaleKeys.KeyboardLayout_Key_Keypad7,
[InputKey.Keypad8] = LocaleKeys.KeyboardLayout_Key_Keypad8,
[InputKey.Keypad9] = LocaleKeys.KeyboardLayout_Key_Keypad9,
[InputKey.KeypadDivide] = LocaleKeys.KeyboardLayout_Key_KeypadDivide,
[InputKey.KeypadMultiply] = LocaleKeys.KeyboardLayout_Key_KeypadMultiply,
[InputKey.KeypadSubtract] = LocaleKeys.KeyboardLayout_Key_KeypadSubtract,
[InputKey.KeypadAdd] = LocaleKeys.KeyboardLayout_Key_KeypadAdd,
[InputKey.KeypadDecimal] = LocaleKeys.KeyboardLayout_Key_KeypadDecimal,
[InputKey.KeypadEnter] = LocaleKeys.KeyboardLayout_Key_KeypadEnter,
[InputKey.Unbound] = LocaleKeys.KeyboardLayout_Key_Unbound,
[InputKey.Unknown] = LocaleKeys.KeyboardLayout_KeyUnknown,
[InputKey.ShiftLeft] = LocaleKeys.KeyboardLayout_KeyShiftLeft,
[InputKey.ShiftRight] = LocaleKeys.KeyboardLayout_KeyShiftRight,
[InputKey.ControlLeft] = LocaleKeys.KeyboardLayout_KeyControlLeft,
[InputKey.ControlRight] = LocaleKeys.KeyboardLayout_KeyControlRight,
[InputKey.AltLeft] = LocaleKeys.KeyboardLayout_KeyAltLeft,
[InputKey.AltRight] = LocaleKeys.KeyboardLayout_KeyAltRight,
[InputKey.WinLeft] = LocaleKeys.KeyboardLayout_KeyWinLeft,
[InputKey.WinRight] = LocaleKeys.KeyboardLayout_KeyWinRight,
[InputKey.Up] = LocaleKeys.KeyboardLayout_KeyUp,
[InputKey.Down] = LocaleKeys.KeyboardLayout_KeyDown,
[InputKey.Left] = LocaleKeys.KeyboardLayout_KeyLeft,
[InputKey.Right] = LocaleKeys.KeyboardLayout_KeyRight,
[InputKey.Enter] = LocaleKeys.KeyboardLayout_KeyEnter,
[InputKey.Escape] = LocaleKeys.KeyboardLayout_KeyEscape,
[InputKey.Space] = LocaleKeys.KeyboardLayout_KeySpace,
[InputKey.Tab] = LocaleKeys.KeyboardLayout_KeyTab,
[InputKey.BackSpace] = LocaleKeys.KeyboardLayout_KeyBackSpace,
[InputKey.Insert] = LocaleKeys.KeyboardLayout_KeyInsert,
[InputKey.Delete] = LocaleKeys.KeyboardLayout_KeyDelete,
[InputKey.PageUp] = LocaleKeys.KeyboardLayout_KeyPageUp,
[InputKey.PageDown] = LocaleKeys.KeyboardLayout_KeyPageDown,
[InputKey.Home] = LocaleKeys.KeyboardLayout_KeyHome,
[InputKey.End] = LocaleKeys.KeyboardLayout_KeyEnd,
[InputKey.CapsLock] = LocaleKeys.KeyboardLayout_KeyCapsLock,
[InputKey.ScrollLock] = LocaleKeys.KeyboardLayout_KeyScrollLock,
[InputKey.PrintScreen] = LocaleKeys.KeyboardLayout_KeyPrintScreen,
[InputKey.Pause] = LocaleKeys.KeyboardLayout_KeyPause,
[InputKey.NumLock] = LocaleKeys.KeyboardLayout_KeyNumLock,
[InputKey.Clear] = LocaleKeys.KeyboardLayout_KeyClear,
[InputKey.Keypad0] = LocaleKeys.KeyboardLayout_KeyKeypad0,
[InputKey.Keypad1] = LocaleKeys.KeyboardLayout_KeyKeypad1,
[InputKey.Keypad2] = LocaleKeys.KeyboardLayout_KeyKeypad2,
[InputKey.Keypad3] = LocaleKeys.KeyboardLayout_KeyKeypad3,
[InputKey.Keypad4] = LocaleKeys.KeyboardLayout_KeyKeypad4,
[InputKey.Keypad5] = LocaleKeys.KeyboardLayout_KeyKeypad5,
[InputKey.Keypad6] = LocaleKeys.KeyboardLayout_KeyKeypad6,
[InputKey.Keypad7] = LocaleKeys.KeyboardLayout_KeyKeypad7,
[InputKey.Keypad8] = LocaleKeys.KeyboardLayout_KeyKeypad8,
[InputKey.Keypad9] = LocaleKeys.KeyboardLayout_KeyKeypad9,
[InputKey.KeypadDivide] = LocaleKeys.KeyboardLayout_KeyKeypadDivide,
[InputKey.KeypadMultiply] = LocaleKeys.KeyboardLayout_KeyKeypadMultiply,
[InputKey.KeypadSubtract] = LocaleKeys.KeyboardLayout_KeyKeypadSubtract,
[InputKey.KeypadAdd] = LocaleKeys.KeyboardLayout_KeyKeypadAdd,
[InputKey.KeypadDecimal] = LocaleKeys.KeyboardLayout_KeyKeypadDecimal,
[InputKey.KeypadEnter] = LocaleKeys.KeyboardLayout_KeyKeypadEnter,
[InputKey.Unbound] = LocaleKeys.KeyboardLayout_KeyUnbound,
};
private static readonly Dictionary<InputKey, LocaleKeys> _semanticPrintableKeysMap = new()
{
[InputKey.Number0] = LocaleKeys.KeyboardLayout_Key_Number0,
[InputKey.Number1] = LocaleKeys.KeyboardLayout_Key_Number1,
[InputKey.Number2] = LocaleKeys.KeyboardLayout_Key_Number2,
[InputKey.Number3] = LocaleKeys.KeyboardLayout_Key_Number3,
[InputKey.Number4] = LocaleKeys.KeyboardLayout_Key_Number4,
[InputKey.Number5] = LocaleKeys.KeyboardLayout_Key_Number5,
[InputKey.Number6] = LocaleKeys.KeyboardLayout_Key_Number6,
[InputKey.Number7] = LocaleKeys.KeyboardLayout_Key_Number7,
[InputKey.Number8] = LocaleKeys.KeyboardLayout_Key_Number8,
[InputKey.Number9] = LocaleKeys.KeyboardLayout_Key_Number9,
[InputKey.Tilde] = LocaleKeys.KeyboardLayout_Key_Tilde,
[InputKey.Grave] = LocaleKeys.KeyboardLayout_Key_Grave,
[InputKey.Minus] = LocaleKeys.KeyboardLayout_Key_Minus,
[InputKey.Plus] = LocaleKeys.KeyboardLayout_Key_Plus,
[InputKey.BracketLeft] = LocaleKeys.KeyboardLayout_Key_BracketLeft,
[InputKey.BracketRight] = LocaleKeys.KeyboardLayout_Key_BracketRight,
[InputKey.Semicolon] = LocaleKeys.KeyboardLayout_Key_Semicolon,
[InputKey.Quote] = LocaleKeys.KeyboardLayout_Key_Quote,
[InputKey.Comma] = LocaleKeys.KeyboardLayout_Key_Comma,
[InputKey.Period] = LocaleKeys.KeyboardLayout_Key_Period,
[InputKey.Slash] = LocaleKeys.KeyboardLayout_Key_Slash,
[InputKey.BackSlash] = LocaleKeys.KeyboardLayout_Key_BackSlash,
[InputKey.Number0] = LocaleKeys.KeyboardLayout_KeyNumber0,
[InputKey.Number1] = LocaleKeys.KeyboardLayout_KeyNumber1,
[InputKey.Number2] = LocaleKeys.KeyboardLayout_KeyNumber2,
[InputKey.Number3] = LocaleKeys.KeyboardLayout_KeyNumber3,
[InputKey.Number4] = LocaleKeys.KeyboardLayout_KeyNumber4,
[InputKey.Number5] = LocaleKeys.KeyboardLayout_KeyNumber5,
[InputKey.Number6] = LocaleKeys.KeyboardLayout_KeyNumber6,
[InputKey.Number7] = LocaleKeys.KeyboardLayout_KeyNumber7,
[InputKey.Number8] = LocaleKeys.KeyboardLayout_KeyNumber8,
[InputKey.Number9] = LocaleKeys.KeyboardLayout_KeyNumber9,
[InputKey.Tilde] = LocaleKeys.KeyboardLayout_KeyTilde,
[InputKey.Grave] = LocaleKeys.KeyboardLayout_KeyGrave,
[InputKey.Minus] = LocaleKeys.KeyboardLayout_KeyMinus,
[InputKey.Plus] = LocaleKeys.KeyboardLayout_KeyPlus,
[InputKey.BracketLeft] = LocaleKeys.KeyboardLayout_KeyBracketLeft,
[InputKey.BracketRight] = LocaleKeys.KeyboardLayout_KeyBracketRight,
[InputKey.Semicolon] = LocaleKeys.KeyboardLayout_KeySemicolon,
[InputKey.Quote] = LocaleKeys.KeyboardLayout_KeyQuote,
[InputKey.Comma] = LocaleKeys.KeyboardLayout_KeyComma,
[InputKey.Period] = LocaleKeys.KeyboardLayout_KeyPeriod,
[InputKey.Slash] = LocaleKeys.KeyboardLayout_KeySlash,
[InputKey.BackSlash] = LocaleKeys.KeyboardLayout_KeyBackSlash,
};
public static bool TryGetSemanticLabel(InputKey key, out string label)
@@ -126,12 +126,12 @@ namespace Ryujinx.Ava.UI.Helpers
{
localeKey = localeKey switch
{
LocaleKeys.KeyboardLayout_Key_ControlLeft => LocaleKeys.KeyboardLayout_Key_Mac_ControlLeft,
LocaleKeys.KeyboardLayout_Key_ControlRight => LocaleKeys.KeyboardLayout_Key_Mac_ControlRight,
LocaleKeys.KeyboardLayout_Key_AltLeft => LocaleKeys.KeyboardLayout_Key_Mac_AltLeft,
LocaleKeys.KeyboardLayout_Key_AltRight => LocaleKeys.KeyboardLayout_Key_Mac_AltRight,
LocaleKeys.KeyboardLayout_Key_WinLeft => LocaleKeys.KeyboardLayout_Key_Mac_WinLeft,
LocaleKeys.KeyboardLayout_Key_WinRight => LocaleKeys.KeyboardLayout_Key_Mac_WinRight,
LocaleKeys.KeyboardLayout_KeyControlLeft => LocaleKeys.KeyboardLayout_KeyMacControlLeft,
LocaleKeys.KeyboardLayout_KeyControlRight => LocaleKeys.KeyboardLayout_KeyMacControlRight,
LocaleKeys.KeyboardLayout_KeyAltLeft => LocaleKeys.KeyboardLayout_KeyMacAltLeft,
LocaleKeys.KeyboardLayout_KeyAltRight => LocaleKeys.KeyboardLayout_KeyMacAltRight,
LocaleKeys.KeyboardLayout_KeyWinLeft => LocaleKeys.KeyboardLayout_KeyMacWinLeft,
LocaleKeys.KeyboardLayout_KeyWinRight => LocaleKeys.KeyboardLayout_KeyMacWinRight,
_ => localeKey
};
}