mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-06-09 22:09:15 +00:00
Update keyboard localisation refactor snapshot
This commit is contained in:
@@ -151,6 +151,9 @@ namespace Ryujinx.Ava.UI.Helpers
|
||||
keyString = key.ToString();
|
||||
}
|
||||
|
||||
break;
|
||||
case PhysicalKey physicalKey:
|
||||
keyString = PhysicalKeyLabelHelper.GetString(physicalKey);
|
||||
break;
|
||||
case GamepadInputId gamepadInputId:
|
||||
if (_gamepadInputIdMap.TryGetValue(gamepadInputId, out localeKey))
|
||||
|
||||
131
src/Ryujinx/UI/Helpers/PhysicalKeyLabelHelper.cs
Normal file
131
src/Ryujinx/UI/Helpers/PhysicalKeyLabelHelper.cs
Normal file
@@ -0,0 +1,131 @@
|
||||
using Avalonia.Input;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using Ryujinx.Ava.Input;
|
||||
using Ryujinx.Common.Configuration.Hid;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using AvaPhysicalKey = Avalonia.Input.PhysicalKey;
|
||||
using ConfigPhysicalKey = Ryujinx.Common.Configuration.Hid.PhysicalKey;
|
||||
using InputKey = Ryujinx.Input.Key;
|
||||
|
||||
namespace Ryujinx.Ava.UI.Helpers
|
||||
{
|
||||
internal static class PhysicalKeyLabelHelper
|
||||
{
|
||||
private static readonly Dictionary<ConfigPhysicalKey, LocaleKeys> _localizedKeysMap = new()
|
||||
{
|
||||
[ConfigPhysicalKey.Unknown] = LocaleKeys.KeyboardLayout_KeyUnknown,
|
||||
[ConfigPhysicalKey.ShiftLeft] = LocaleKeys.KeyboardLayout_KeyShiftLeft,
|
||||
[ConfigPhysicalKey.ShiftRight] = LocaleKeys.KeyboardLayout_KeyShiftRight,
|
||||
[ConfigPhysicalKey.ControlLeft] = LocaleKeys.KeyboardLayout_KeyControlLeft,
|
||||
[ConfigPhysicalKey.ControlRight] = LocaleKeys.KeyboardLayout_KeyControlRight,
|
||||
[ConfigPhysicalKey.AltLeft] = LocaleKeys.KeyboardLayout_KeyAltLeft,
|
||||
[ConfigPhysicalKey.AltRight] = LocaleKeys.KeyboardLayout_KeyAltRight,
|
||||
[ConfigPhysicalKey.WinLeft] = LocaleKeys.KeyboardLayout_KeyWinLeft,
|
||||
[ConfigPhysicalKey.WinRight] = LocaleKeys.KeyboardLayout_KeyWinRight,
|
||||
[ConfigPhysicalKey.Up] = LocaleKeys.KeyboardLayout_KeyUp,
|
||||
[ConfigPhysicalKey.Down] = LocaleKeys.KeyboardLayout_KeyDown,
|
||||
[ConfigPhysicalKey.Left] = LocaleKeys.KeyboardLayout_KeyLeft,
|
||||
[ConfigPhysicalKey.Right] = LocaleKeys.KeyboardLayout_KeyRight,
|
||||
[ConfigPhysicalKey.Enter] = LocaleKeys.KeyboardLayout_KeyEnter,
|
||||
[ConfigPhysicalKey.Escape] = LocaleKeys.KeyboardLayout_KeyEscape,
|
||||
[ConfigPhysicalKey.Space] = LocaleKeys.KeyboardLayout_KeySpace,
|
||||
[ConfigPhysicalKey.Tab] = LocaleKeys.KeyboardLayout_KeyTab,
|
||||
[ConfigPhysicalKey.BackSpace] = LocaleKeys.KeyboardLayout_KeyBackSpace,
|
||||
[ConfigPhysicalKey.Insert] = LocaleKeys.KeyboardLayout_KeyInsert,
|
||||
[ConfigPhysicalKey.Delete] = LocaleKeys.KeyboardLayout_KeyDelete,
|
||||
[ConfigPhysicalKey.PageUp] = LocaleKeys.KeyboardLayout_KeyPageUp,
|
||||
[ConfigPhysicalKey.PageDown] = LocaleKeys.KeyboardLayout_KeyPageDown,
|
||||
[ConfigPhysicalKey.Home] = LocaleKeys.KeyboardLayout_KeyHome,
|
||||
[ConfigPhysicalKey.End] = LocaleKeys.KeyboardLayout_KeyEnd,
|
||||
[ConfigPhysicalKey.CapsLock] = LocaleKeys.KeyboardLayout_KeyCapsLock,
|
||||
[ConfigPhysicalKey.ScrollLock] = LocaleKeys.KeyboardLayout_KeyScrollLock,
|
||||
[ConfigPhysicalKey.PrintScreen] = LocaleKeys.KeyboardLayout_KeyPrintScreen,
|
||||
[ConfigPhysicalKey.Pause] = LocaleKeys.KeyboardLayout_KeyPause,
|
||||
[ConfigPhysicalKey.NumLock] = LocaleKeys.KeyboardLayout_KeyNumLock,
|
||||
[ConfigPhysicalKey.Clear] = LocaleKeys.KeyboardLayout_KeyClear,
|
||||
[ConfigPhysicalKey.Keypad0] = LocaleKeys.KeyboardLayout_KeyKeypad0,
|
||||
[ConfigPhysicalKey.Keypad1] = LocaleKeys.KeyboardLayout_KeyKeypad1,
|
||||
[ConfigPhysicalKey.Keypad2] = LocaleKeys.KeyboardLayout_KeyKeypad2,
|
||||
[ConfigPhysicalKey.Keypad3] = LocaleKeys.KeyboardLayout_KeyKeypad3,
|
||||
[ConfigPhysicalKey.Keypad4] = LocaleKeys.KeyboardLayout_KeyKeypad4,
|
||||
[ConfigPhysicalKey.Keypad5] = LocaleKeys.KeyboardLayout_KeyKeypad5,
|
||||
[ConfigPhysicalKey.Keypad6] = LocaleKeys.KeyboardLayout_KeyKeypad6,
|
||||
[ConfigPhysicalKey.Keypad7] = LocaleKeys.KeyboardLayout_KeyKeypad7,
|
||||
[ConfigPhysicalKey.Keypad8] = LocaleKeys.KeyboardLayout_KeyKeypad8,
|
||||
[ConfigPhysicalKey.Keypad9] = LocaleKeys.KeyboardLayout_KeyKeypad9,
|
||||
[ConfigPhysicalKey.KeypadDivide] = LocaleKeys.KeyboardLayout_KeyKeypadDivide,
|
||||
[ConfigPhysicalKey.KeypadMultiply] = LocaleKeys.KeyboardLayout_KeyKeypadMultiply,
|
||||
[ConfigPhysicalKey.KeypadSubtract] = LocaleKeys.KeyboardLayout_KeyKeypadSubtract,
|
||||
[ConfigPhysicalKey.KeypadAdd] = LocaleKeys.KeyboardLayout_KeyKeypadAdd,
|
||||
[ConfigPhysicalKey.KeypadDecimal] = LocaleKeys.KeyboardLayout_KeyKeypadDecimal,
|
||||
[ConfigPhysicalKey.KeypadEnter] = LocaleKeys.KeyboardLayout_KeyKeypadEnter,
|
||||
[ConfigPhysicalKey.Unbound] = LocaleKeys.KeyboardLayout_KeyUnbound,
|
||||
};
|
||||
|
||||
public static string GetString(ConfigPhysicalKey key)
|
||||
{
|
||||
if (_localizedKeysMap.TryGetValue(key, out LocaleKeys localeKey))
|
||||
{
|
||||
return GetLocalizedString(localeKey);
|
||||
}
|
||||
|
||||
if (TryGetPrintableKeySymbol(key, out string label))
|
||||
{
|
||||
return label;
|
||||
}
|
||||
|
||||
return key.ToString();
|
||||
}
|
||||
|
||||
private static bool TryGetPrintableKeySymbol(ConfigPhysicalKey key, out string label)
|
||||
{
|
||||
// The legacy enum name for the ISO extra key is misleading, so give it a distinct physical label.
|
||||
if (key == ConfigPhysicalKey.Grave)
|
||||
{
|
||||
label = "<>";
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!AvaloniaKeyboardMappingHelper.TryGetAvaPhysicalKey((InputKey)(int)key, out AvaPhysicalKey avaPhysicalKey))
|
||||
{
|
||||
label = string.Empty;
|
||||
return false;
|
||||
}
|
||||
|
||||
label = PhysicalKeyExtensions.ToQwertyKeySymbol(avaPhysicalKey, false);
|
||||
|
||||
if (string.IsNullOrEmpty(label) || label.Length != 1 || char.IsControl(label[0]))
|
||||
{
|
||||
label = string.Empty;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (char.IsLetter(label[0]))
|
||||
{
|
||||
label = char.ToUpperInvariant(label[0]).ToString();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static string GetLocalizedString(LocaleKeys localeKey)
|
||||
{
|
||||
if (OperatingSystem.IsMacOS())
|
||||
{
|
||||
localeKey = localeKey switch
|
||||
{
|
||||
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
|
||||
};
|
||||
}
|
||||
|
||||
return LocaleManager.Instance[localeKey];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,88 +13,88 @@ namespace Ryujinx.Ava.UI.Models.Input
|
||||
public PlayerIndex PlayerIndex { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key LeftStickUp { get; set; }
|
||||
public partial PhysicalKey LeftStickUp { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key LeftStickDown { get; set; }
|
||||
public partial PhysicalKey LeftStickDown { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key LeftStickLeft { get; set; }
|
||||
public partial PhysicalKey LeftStickLeft { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key LeftStickRight { get; set; }
|
||||
public partial PhysicalKey LeftStickRight { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key LeftStickButton { get; set; }
|
||||
public partial PhysicalKey LeftStickButton { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key RightStickUp { get; set; }
|
||||
public partial PhysicalKey RightStickUp { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key RightStickDown { get; set; }
|
||||
public partial PhysicalKey RightStickDown { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key RightStickLeft { get; set; }
|
||||
public partial PhysicalKey RightStickLeft { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key RightStickRight { get; set; }
|
||||
public partial PhysicalKey RightStickRight { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key RightStickButton { get; set; }
|
||||
public partial PhysicalKey RightStickButton { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key DpadUp { get; set; }
|
||||
public partial PhysicalKey DpadUp { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key DpadDown { get; set; }
|
||||
public partial PhysicalKey DpadDown { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key DpadLeft { get; set; }
|
||||
public partial PhysicalKey DpadLeft { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key DpadRight { get; set; }
|
||||
public partial PhysicalKey DpadRight { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key ButtonMinus { get; set; }
|
||||
public partial PhysicalKey ButtonMinus { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key ButtonPlus { get; set; }
|
||||
public partial PhysicalKey ButtonPlus { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key ButtonA { get; set; }
|
||||
public partial PhysicalKey ButtonA { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key ButtonB { get; set; }
|
||||
public partial PhysicalKey ButtonB { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key ButtonX { get; set; }
|
||||
public partial PhysicalKey ButtonX { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key ButtonY { get; set; }
|
||||
public partial PhysicalKey ButtonY { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key ButtonL { get; set; }
|
||||
public partial PhysicalKey ButtonL { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key ButtonR { get; set; }
|
||||
public partial PhysicalKey ButtonR { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key ButtonZl { get; set; }
|
||||
public partial PhysicalKey ButtonZl { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key ButtonZr { get; set; }
|
||||
public partial PhysicalKey ButtonZr { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key LeftButtonSl { get; set; }
|
||||
public partial PhysicalKey LeftButtonSl { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key LeftButtonSr { get; set; }
|
||||
public partial PhysicalKey LeftButtonSr { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key RightButtonSl { get; set; }
|
||||
public partial PhysicalKey RightButtonSl { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial Key RightButtonSr { get; set; }
|
||||
public partial PhysicalKey RightButtonSr { get; set; }
|
||||
|
||||
public KeyboardInputConfig(InputConfig config)
|
||||
{
|
||||
@@ -153,7 +153,7 @@ namespace Ryujinx.Ava.UI.Models.Input
|
||||
Backend = InputBackendType.WindowKeyboard,
|
||||
PlayerIndex = PlayerIndex,
|
||||
ControllerType = ControllerType,
|
||||
LeftJoycon = new LeftJoyconCommonConfig<Key>
|
||||
LeftJoycon = new LeftJoyconCommonConfig<PhysicalKey>
|
||||
{
|
||||
DpadUp = DpadUp,
|
||||
DpadDown = DpadDown,
|
||||
@@ -165,7 +165,7 @@ namespace Ryujinx.Ava.UI.Models.Input
|
||||
ButtonSl = LeftButtonSl,
|
||||
ButtonSr = LeftButtonSr,
|
||||
},
|
||||
RightJoycon = new RightJoyconCommonConfig<Key>
|
||||
RightJoycon = new RightJoyconCommonConfig<PhysicalKey>
|
||||
{
|
||||
ButtonA = ButtonA,
|
||||
ButtonB = ButtonB,
|
||||
@@ -177,7 +177,7 @@ namespace Ryujinx.Ava.UI.Models.Input
|
||||
ButtonR = ButtonR,
|
||||
ButtonZr = ButtonZr,
|
||||
},
|
||||
LeftJoyconStick = new JoyconConfigKeyboardStick<Key>
|
||||
LeftJoyconStick = new JoyconConfigKeyboardStick<PhysicalKey>
|
||||
{
|
||||
StickUp = LeftStickUp,
|
||||
StickDown = LeftStickDown,
|
||||
@@ -185,7 +185,7 @@ namespace Ryujinx.Ava.UI.Models.Input
|
||||
StickLeft = LeftStickLeft,
|
||||
StickButton = LeftStickButton,
|
||||
},
|
||||
RightJoyconStick = new JoyconConfigKeyboardStick<Key>
|
||||
RightJoyconStick = new JoyconConfigKeyboardStick<PhysicalKey>
|
||||
{
|
||||
StickUp = RightStickUp,
|
||||
StickDown = RightStickDown,
|
||||
|
||||
@@ -154,42 +154,42 @@ namespace Ryujinx.Ava.UI.Models.Input
|
||||
{
|
||||
KeyboardStateSnapshot snapshot = keyboard.GetKeyboardStateSnapshot();
|
||||
|
||||
if (snapshot.IsPressed((Key)KeyboardConfig.LeftStickRight))
|
||||
if (snapshot.IsPressed(KeyboardConfig.LeftStickRight.ToInputKey()))
|
||||
{
|
||||
leftBuffer.Item1 += 1;
|
||||
}
|
||||
|
||||
if (snapshot.IsPressed((Key)KeyboardConfig.LeftStickLeft))
|
||||
if (snapshot.IsPressed(KeyboardConfig.LeftStickLeft.ToInputKey()))
|
||||
{
|
||||
leftBuffer.Item1 -= 1;
|
||||
}
|
||||
|
||||
if (snapshot.IsPressed((Key)KeyboardConfig.LeftStickUp))
|
||||
if (snapshot.IsPressed(KeyboardConfig.LeftStickUp.ToInputKey()))
|
||||
{
|
||||
leftBuffer.Item2 += 1;
|
||||
}
|
||||
|
||||
if (snapshot.IsPressed((Key)KeyboardConfig.LeftStickDown))
|
||||
if (snapshot.IsPressed(KeyboardConfig.LeftStickDown.ToInputKey()))
|
||||
{
|
||||
leftBuffer.Item2 -= 1;
|
||||
}
|
||||
|
||||
if (snapshot.IsPressed((Key)KeyboardConfig.RightStickRight))
|
||||
if (snapshot.IsPressed(KeyboardConfig.RightStickRight.ToInputKey()))
|
||||
{
|
||||
rightBuffer.Item1 += 1;
|
||||
}
|
||||
|
||||
if (snapshot.IsPressed((Key)KeyboardConfig.RightStickLeft))
|
||||
if (snapshot.IsPressed(KeyboardConfig.RightStickLeft.ToInputKey()))
|
||||
{
|
||||
rightBuffer.Item1 -= 1;
|
||||
}
|
||||
|
||||
if (snapshot.IsPressed((Key)KeyboardConfig.RightStickUp))
|
||||
if (snapshot.IsPressed(KeyboardConfig.RightStickUp.ToInputKey()))
|
||||
{
|
||||
rightBuffer.Item2 += 1;
|
||||
}
|
||||
|
||||
if (snapshot.IsPressed((Key)KeyboardConfig.RightStickDown))
|
||||
if (snapshot.IsPressed(KeyboardConfig.RightStickDown.ToInputKey()))
|
||||
{
|
||||
rightBuffer.Item2 -= 1;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ using System.Linq;
|
||||
using System.Text.Json;
|
||||
using ConfigGamepadInputId = Ryujinx.Common.Configuration.Hid.Controller.GamepadInputId;
|
||||
using ConfigStickInputId = Ryujinx.Common.Configuration.Hid.Controller.StickInputId;
|
||||
using Key = Ryujinx.Common.Configuration.Hid.Key;
|
||||
using PhysicalKey = Ryujinx.Common.Configuration.Hid.PhysicalKey;
|
||||
|
||||
namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||
{
|
||||
@@ -290,7 +290,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||
{
|
||||
_mainWindow = RyujinxApp.MainWindow;
|
||||
|
||||
AvaloniaKeyboardDriver = new AvaloniaKeyboardDriver(owner);
|
||||
AvaloniaKeyboardDriver = new AvaloniaKeyboardDriver(owner, KeyboardInputMode.Physical);
|
||||
|
||||
_mainWindow.InputManager.GamepadDriver.OnGamepadConnected += HandleOnGamepadConnected;
|
||||
_mainWindow.InputManager.GamepadDriver.OnGamepadDisconnected += HandleOnGamepadDisconnected;
|
||||
@@ -677,46 +677,46 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||
Id = id,
|
||||
Name = name,
|
||||
ControllerType = ControllerType.ProController,
|
||||
LeftJoycon = new LeftJoyconCommonConfig<Key>
|
||||
LeftJoycon = new LeftJoyconCommonConfig<PhysicalKey>
|
||||
{
|
||||
DpadUp = Key.Up,
|
||||
DpadDown = Key.Down,
|
||||
DpadLeft = Key.Left,
|
||||
DpadRight = Key.Right,
|
||||
ButtonMinus = Key.Minus,
|
||||
ButtonL = Key.E,
|
||||
ButtonZl = Key.Q,
|
||||
ButtonSl = Key.Unbound,
|
||||
ButtonSr = Key.Unbound,
|
||||
DpadUp = PhysicalKey.Up,
|
||||
DpadDown = PhysicalKey.Down,
|
||||
DpadLeft = PhysicalKey.Left,
|
||||
DpadRight = PhysicalKey.Right,
|
||||
ButtonMinus = PhysicalKey.Minus,
|
||||
ButtonL = PhysicalKey.E,
|
||||
ButtonZl = PhysicalKey.Q,
|
||||
ButtonSl = PhysicalKey.Unbound,
|
||||
ButtonSr = PhysicalKey.Unbound,
|
||||
},
|
||||
LeftJoyconStick =
|
||||
new JoyconConfigKeyboardStick<Key>
|
||||
new JoyconConfigKeyboardStick<PhysicalKey>
|
||||
{
|
||||
StickUp = Key.W,
|
||||
StickDown = Key.S,
|
||||
StickLeft = Key.A,
|
||||
StickRight = Key.D,
|
||||
StickButton = Key.F,
|
||||
StickUp = PhysicalKey.W,
|
||||
StickDown = PhysicalKey.S,
|
||||
StickLeft = PhysicalKey.A,
|
||||
StickRight = PhysicalKey.D,
|
||||
StickButton = PhysicalKey.F,
|
||||
},
|
||||
RightJoycon = new RightJoyconCommonConfig<Key>
|
||||
RightJoycon = new RightJoyconCommonConfig<PhysicalKey>
|
||||
{
|
||||
ButtonA = Key.Z,
|
||||
ButtonB = Key.X,
|
||||
ButtonX = Key.C,
|
||||
ButtonY = Key.V,
|
||||
ButtonPlus = Key.Plus,
|
||||
ButtonR = Key.U,
|
||||
ButtonZr = Key.O,
|
||||
ButtonSl = Key.Unbound,
|
||||
ButtonSr = Key.Unbound,
|
||||
ButtonA = PhysicalKey.Z,
|
||||
ButtonB = PhysicalKey.X,
|
||||
ButtonX = PhysicalKey.C,
|
||||
ButtonY = PhysicalKey.V,
|
||||
ButtonPlus = PhysicalKey.Plus,
|
||||
ButtonR = PhysicalKey.U,
|
||||
ButtonZr = PhysicalKey.O,
|
||||
ButtonSl = PhysicalKey.Unbound,
|
||||
ButtonSr = PhysicalKey.Unbound,
|
||||
},
|
||||
RightJoyconStick = new JoyconConfigKeyboardStick<Key>
|
||||
RightJoyconStick = new JoyconConfigKeyboardStick<PhysicalKey>
|
||||
{
|
||||
StickUp = Key.I,
|
||||
StickDown = Key.K,
|
||||
StickLeft = Key.J,
|
||||
StickRight = Key.L,
|
||||
StickButton = Key.H,
|
||||
StickUp = PhysicalKey.I,
|
||||
StickDown = PhysicalKey.K,
|
||||
StickLeft = PhysicalKey.J,
|
||||
StickRight = PhysicalKey.L,
|
||||
StickButton = PhysicalKey.H,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ using Ryujinx.Input.Assigner;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Button = Ryujinx.Input.Button;
|
||||
using Key = Ryujinx.Common.Configuration.Hid.Key;
|
||||
using PhysicalKey = Ryujinx.Common.Configuration.Hid.PhysicalKey;
|
||||
|
||||
namespace Ryujinx.Ava.UI.Views.Input
|
||||
{
|
||||
@@ -78,88 +78,88 @@ namespace Ryujinx.Ava.UI.Views.Input
|
||||
switch (button.Name)
|
||||
{
|
||||
case "ButtonZl":
|
||||
ViewModel.Config.ButtonZl = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.ButtonZl = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "ButtonL":
|
||||
ViewModel.Config.ButtonL = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.ButtonL = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "ButtonMinus":
|
||||
ViewModel.Config.ButtonMinus = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.ButtonMinus = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "LeftStickButton":
|
||||
ViewModel.Config.LeftStickButton = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.LeftStickButton = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "LeftStickUp":
|
||||
ViewModel.Config.LeftStickUp = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.LeftStickUp = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "LeftStickDown":
|
||||
ViewModel.Config.LeftStickDown = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.LeftStickDown = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "LeftStickRight":
|
||||
ViewModel.Config.LeftStickRight = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.LeftStickRight = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "LeftStickLeft":
|
||||
ViewModel.Config.LeftStickLeft = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.LeftStickLeft = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "DpadUp":
|
||||
ViewModel.Config.DpadUp = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.DpadUp = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "DpadDown":
|
||||
ViewModel.Config.DpadDown = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.DpadDown = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "DpadLeft":
|
||||
ViewModel.Config.DpadLeft = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.DpadLeft = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "DpadRight":
|
||||
ViewModel.Config.DpadRight = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.DpadRight = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "LeftButtonSr":
|
||||
ViewModel.Config.LeftButtonSr = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.LeftButtonSr = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "LeftButtonSl":
|
||||
ViewModel.Config.LeftButtonSl = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.LeftButtonSl = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "RightButtonSr":
|
||||
ViewModel.Config.RightButtonSr = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.RightButtonSr = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "RightButtonSl":
|
||||
ViewModel.Config.RightButtonSl = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.RightButtonSl = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "ButtonZr":
|
||||
ViewModel.Config.ButtonZr = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.ButtonZr = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "ButtonR":
|
||||
ViewModel.Config.ButtonR = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.ButtonR = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "ButtonPlus":
|
||||
ViewModel.Config.ButtonPlus = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.ButtonPlus = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "ButtonA":
|
||||
ViewModel.Config.ButtonA = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.ButtonA = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "ButtonB":
|
||||
ViewModel.Config.ButtonB = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.ButtonB = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "ButtonX":
|
||||
ViewModel.Config.ButtonX = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.ButtonX = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "ButtonY":
|
||||
ViewModel.Config.ButtonY = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.ButtonY = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "RightStickButton":
|
||||
ViewModel.Config.RightStickButton = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.RightStickButton = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "RightStickUp":
|
||||
ViewModel.Config.RightStickUp = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.RightStickUp = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "RightStickDown":
|
||||
ViewModel.Config.RightStickDown = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.RightStickDown = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "RightStickRight":
|
||||
ViewModel.Config.RightStickRight = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.RightStickRight = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
case "RightStickLeft":
|
||||
ViewModel.Config.RightStickLeft = buttonValue.AsHidType<Key>();
|
||||
ViewModel.Config.RightStickLeft = buttonValue.AsHidType<PhysicalKey>();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -207,34 +207,34 @@ namespace Ryujinx.Ava.UI.Views.Input
|
||||
{
|
||||
Dictionary<string, Action> buttonActions = new()
|
||||
{
|
||||
{ "ButtonZl", () => ViewModel.Config.ButtonZl = Key.Unbound },
|
||||
{ "ButtonL", () => ViewModel.Config.ButtonL = Key.Unbound },
|
||||
{ "ButtonMinus", () => ViewModel.Config.ButtonMinus = Key.Unbound },
|
||||
{ "LeftStickButton", () => ViewModel.Config.LeftStickButton = Key.Unbound },
|
||||
{ "LeftStickUp", () => ViewModel.Config.LeftStickUp = Key.Unbound },
|
||||
{ "LeftStickDown", () => ViewModel.Config.LeftStickDown = Key.Unbound },
|
||||
{ "LeftStickRight", () => ViewModel.Config.LeftStickRight = Key.Unbound },
|
||||
{ "LeftStickLeft", () => ViewModel.Config.LeftStickLeft = Key.Unbound },
|
||||
{ "DpadUp", () => ViewModel.Config.DpadUp = Key.Unbound },
|
||||
{ "DpadDown", () => ViewModel.Config.DpadDown = Key.Unbound },
|
||||
{ "DpadLeft", () => ViewModel.Config.DpadLeft = Key.Unbound },
|
||||
{ "DpadRight", () => ViewModel.Config.DpadRight = Key.Unbound },
|
||||
{ "LeftButtonSr", () => ViewModel.Config.LeftButtonSr = Key.Unbound },
|
||||
{ "LeftButtonSl", () => ViewModel.Config.LeftButtonSl = Key.Unbound },
|
||||
{ "RightButtonSr", () => ViewModel.Config.RightButtonSr = Key.Unbound },
|
||||
{ "RightButtonSl", () => ViewModel.Config.RightButtonSl = Key.Unbound },
|
||||
{ "ButtonZr", () => ViewModel.Config.ButtonZr = Key.Unbound },
|
||||
{ "ButtonR", () => ViewModel.Config.ButtonR = Key.Unbound },
|
||||
{ "ButtonPlus", () => ViewModel.Config.ButtonPlus = Key.Unbound },
|
||||
{ "ButtonA", () => ViewModel.Config.ButtonA = Key.Unbound },
|
||||
{ "ButtonB", () => ViewModel.Config.ButtonB = Key.Unbound },
|
||||
{ "ButtonX", () => ViewModel.Config.ButtonX = Key.Unbound },
|
||||
{ "ButtonY", () => ViewModel.Config.ButtonY = Key.Unbound },
|
||||
{ "RightStickButton", () => ViewModel.Config.RightStickButton = Key.Unbound },
|
||||
{ "RightStickUp", () => ViewModel.Config.RightStickUp = Key.Unbound },
|
||||
{ "RightStickDown", () => ViewModel.Config.RightStickDown = Key.Unbound },
|
||||
{ "RightStickRight", () => ViewModel.Config.RightStickRight = Key.Unbound },
|
||||
{ "RightStickLeft", () => ViewModel.Config.RightStickLeft = Key.Unbound }
|
||||
{ "ButtonZl", () => ViewModel.Config.ButtonZl = PhysicalKey.Unbound },
|
||||
{ "ButtonL", () => ViewModel.Config.ButtonL = PhysicalKey.Unbound },
|
||||
{ "ButtonMinus", () => ViewModel.Config.ButtonMinus = PhysicalKey.Unbound },
|
||||
{ "LeftStickButton", () => ViewModel.Config.LeftStickButton = PhysicalKey.Unbound },
|
||||
{ "LeftStickUp", () => ViewModel.Config.LeftStickUp = PhysicalKey.Unbound },
|
||||
{ "LeftStickDown", () => ViewModel.Config.LeftStickDown = PhysicalKey.Unbound },
|
||||
{ "LeftStickRight", () => ViewModel.Config.LeftStickRight = PhysicalKey.Unbound },
|
||||
{ "LeftStickLeft", () => ViewModel.Config.LeftStickLeft = PhysicalKey.Unbound },
|
||||
{ "DpadUp", () => ViewModel.Config.DpadUp = PhysicalKey.Unbound },
|
||||
{ "DpadDown", () => ViewModel.Config.DpadDown = PhysicalKey.Unbound },
|
||||
{ "DpadLeft", () => ViewModel.Config.DpadLeft = PhysicalKey.Unbound },
|
||||
{ "DpadRight", () => ViewModel.Config.DpadRight = PhysicalKey.Unbound },
|
||||
{ "LeftButtonSr", () => ViewModel.Config.LeftButtonSr = PhysicalKey.Unbound },
|
||||
{ "LeftButtonSl", () => ViewModel.Config.LeftButtonSl = PhysicalKey.Unbound },
|
||||
{ "RightButtonSr", () => ViewModel.Config.RightButtonSr = PhysicalKey.Unbound },
|
||||
{ "RightButtonSl", () => ViewModel.Config.RightButtonSl = PhysicalKey.Unbound },
|
||||
{ "ButtonZr", () => ViewModel.Config.ButtonZr = PhysicalKey.Unbound },
|
||||
{ "ButtonR", () => ViewModel.Config.ButtonR = PhysicalKey.Unbound },
|
||||
{ "ButtonPlus", () => ViewModel.Config.ButtonPlus = PhysicalKey.Unbound },
|
||||
{ "ButtonA", () => ViewModel.Config.ButtonA = PhysicalKey.Unbound },
|
||||
{ "ButtonB", () => ViewModel.Config.ButtonB = PhysicalKey.Unbound },
|
||||
{ "ButtonX", () => ViewModel.Config.ButtonX = PhysicalKey.Unbound },
|
||||
{ "ButtonY", () => ViewModel.Config.ButtonY = PhysicalKey.Unbound },
|
||||
{ "RightStickButton", () => ViewModel.Config.RightStickButton = PhysicalKey.Unbound },
|
||||
{ "RightStickUp", () => ViewModel.Config.RightStickUp = PhysicalKey.Unbound },
|
||||
{ "RightStickDown", () => ViewModel.Config.RightStickDown = PhysicalKey.Unbound },
|
||||
{ "RightStickRight", () => ViewModel.Config.RightStickRight = PhysicalKey.Unbound },
|
||||
{ "RightStickLeft", () => ViewModel.Config.RightStickLeft = PhysicalKey.Unbound }
|
||||
};
|
||||
|
||||
if (buttonActions.TryGetValue(_currentAssigner.ToggledButton.Name, out Action action))
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Ryujinx.Ava.UI.Views.Settings
|
||||
}
|
||||
}
|
||||
|
||||
_avaloniaKeyboardDriver = new AvaloniaKeyboardDriver(this);
|
||||
_avaloniaKeyboardDriver = new AvaloniaKeyboardDriver(this, KeyboardInputMode.Semantic);
|
||||
}
|
||||
|
||||
protected override void OnPointerReleased(PointerReleasedEventArgs e)
|
||||
|
||||
@@ -30,6 +30,7 @@ using Ryujinx.HLE.HOS;
|
||||
using Ryujinx.HLE.HOS.Services.Account.Acc;
|
||||
using Ryujinx.Input.HLE;
|
||||
using Ryujinx.Input.SDL3;
|
||||
using Ryujinx.Input;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -105,7 +106,7 @@ namespace Ryujinx.Ava.UI.Windows
|
||||
|
||||
if (Program.PreviewerDetached)
|
||||
{
|
||||
InputManager = new InputManager(new AvaloniaKeyboardDriver(this), new SDL3GamepadDriver());
|
||||
InputManager = new InputManager(new AvaloniaKeyboardDriver(this, KeyboardInputMode.Semantic), new SDL3GamepadDriver());
|
||||
|
||||
_ = this.GetObservable(IsActiveProperty).Subscribe(it => ViewModel.IsActive = it);
|
||||
this.ScalingChanged += OnScalingChanged;
|
||||
|
||||
Reference in New Issue
Block a user