diff --git a/src/Ryujinx.Gtk3/UI/Helper/ButtonValueHelper.cs b/src/Ryujinx.Gtk3/UI/Helper/ButtonHelper.cs similarity index 87% rename from src/Ryujinx.Gtk3/UI/Helper/ButtonValueHelper.cs rename to src/Ryujinx.Gtk3/UI/Helper/ButtonHelper.cs index dca37a82ea..c3afcaa49f 100644 --- a/src/Ryujinx.Gtk3/UI/Helper/ButtonValueHelper.cs +++ b/src/Ryujinx.Gtk3/UI/Helper/ButtonHelper.cs @@ -7,7 +7,7 @@ using StickInputId = Ryujinx.Common.Configuration.Hid.Controller.StickInputId; namespace Ryujinx.UI.Helper { - public static class ButtonValueHelper + public static class ButtonHelper { private static readonly Dictionary _keysMap = new() { @@ -117,35 +117,35 @@ namespace Ryujinx.UI.Helper { StickInputId.Unbound, "Unbound" }, }; - public static string ToString(ButtonValue buttonValue) + public static string ToString(Button button) { string keyString = ""; - if (buttonValue.Type == ButtonValueType.Key) + if (button.Type == ButtonType.Key) { - var key = buttonValue.AsHidType(); + var key = button.AsHidType(); - if (!_keysMap.TryGetValue(buttonValue.AsHidType(), out keyString)) + if (!_keysMap.TryGetValue(button.AsHidType(), out keyString)) { keyString = key.ToString(); } } - if (buttonValue.Type == ButtonValueType.GamepadButtonInputId) + if (button.Type == ButtonType.GamepadButtonInputId) { - var gamepadButton = buttonValue.AsHidType(); + var gamepadButton = button.AsHidType(); - if (!_gamepadInputIdMap.TryGetValue(buttonValue.AsHidType(), out keyString)) + if (!_gamepadInputIdMap.TryGetValue(button.AsHidType(), out keyString)) { keyString = gamepadButton.ToString(); } } - if (buttonValue.Type == ButtonValueType.StickId) + if (button.Type == ButtonType.StickId) { - var stickInput = buttonValue.AsHidType(); + var stickInput = button.AsHidType(); - if (!_stickInputIdMap.TryGetValue(buttonValue.AsHidType(), out keyString)) + if (!_stickInputIdMap.TryGetValue(button.AsHidType(), out keyString)) { keyString = stickInput.ToString(); } diff --git a/src/Ryujinx.Gtk3/UI/Windows/ControllerWindow.cs b/src/Ryujinx.Gtk3/UI/Windows/ControllerWindow.cs index e5a728a35e..7f91a3c900 100644 --- a/src/Ryujinx.Gtk3/UI/Windows/ControllerWindow.cs +++ b/src/Ryujinx.Gtk3/UI/Windows/ControllerWindow.cs @@ -18,6 +18,7 @@ using System.IO; using System.Reflection; using System.Text.Json; using System.Threading; +using Button = Ryujinx.Input.Button; using ConfigGamepadInputId = Ryujinx.Common.Configuration.Hid.Controller.GamepadInputId; using ConfigStickInputId = Ryujinx.Common.Configuration.Hid.Controller.StickInputId; using GUI = Gtk.Builder.ObjectAttribute; @@ -894,7 +895,7 @@ namespace Ryujinx.UI.Windows } } - string pressedButton = ButtonValueHelper.ToString(assigner.GetPressedButton() ?? new ButtonValue(Input.Key.Unknown)); + string pressedButton = ButtonHelper.ToString(assigner.GetPressedButton() ?? new Button(Input.Key.Unknown)); Application.Invoke(delegate { diff --git a/src/Ryujinx.Input/Assigner/GamepadButtonAssigner.cs b/src/Ryujinx.Input/Assigner/GamepadButtonAssigner.cs index bf8319a6a9..b51f9b90e0 100644 --- a/src/Ryujinx.Input/Assigner/GamepadButtonAssigner.cs +++ b/src/Ryujinx.Input/Assigner/GamepadButtonAssigner.cs @@ -59,7 +59,7 @@ namespace Ryujinx.Input.Assigner return _gamepad == null || !_gamepad.IsConnected; } - public ButtonValue? GetPressedButton() + public Button? GetPressedButton() { IEnumerable pressedButtons = _detector.GetPressedButtons(); diff --git a/src/Ryujinx.Input/Assigner/IButtonAssigner.cs b/src/Ryujinx.Input/Assigner/IButtonAssigner.cs index 6537171339..19f413b963 100644 --- a/src/Ryujinx.Input/Assigner/IButtonAssigner.cs +++ b/src/Ryujinx.Input/Assigner/IButtonAssigner.cs @@ -31,6 +31,6 @@ namespace Ryujinx.Input.Assigner /// Get the pressed button that was read in by the button assigner. /// /// The pressed button that was read - ButtonValue? GetPressedButton(); + Button? GetPressedButton(); } } diff --git a/src/Ryujinx.Input/Assigner/KeyboardKeyAssigner.cs b/src/Ryujinx.Input/Assigner/KeyboardKeyAssigner.cs index c66812ba03..8460bf320b 100644 --- a/src/Ryujinx.Input/Assigner/KeyboardKeyAssigner.cs +++ b/src/Ryujinx.Input/Assigner/KeyboardKeyAssigner.cs @@ -31,9 +31,9 @@ namespace Ryujinx.Input.Assigner return _keyboardState.IsPressed(Key.Escape); } - public ButtonValue? GetPressedButton() + public Button? GetPressedButton() { - ButtonValue? keyPressed = null; + Button? keyPressed = null; for (Key key = Key.Unknown; key < Key.Count; key++) { diff --git a/src/Ryujinx.Input/ButtonValue.cs b/src/Ryujinx.Input/Button.cs similarity index 52% rename from src/Ryujinx.Input/ButtonValue.cs rename to src/Ryujinx.Input/Button.cs index f34bbc9c39..4289901ce9 100644 --- a/src/Ryujinx.Input/ButtonValue.cs +++ b/src/Ryujinx.Input/Button.cs @@ -2,26 +2,26 @@ using System; namespace Ryujinx.Input { - public readonly struct ButtonValue + public readonly struct Button { - public readonly ButtonValueType Type; + public readonly ButtonType Type; private readonly uint _rawValue; - public ButtonValue(Key key) + public Button(Key key) { - Type = ButtonValueType.Key; + Type = ButtonType.Key; _rawValue = (uint)key; } - public ButtonValue(GamepadButtonInputId gamepad) + public Button(GamepadButtonInputId gamepad) { - Type = ButtonValueType.GamepadButtonInputId; + Type = ButtonType.GamepadButtonInputId; _rawValue = (uint)gamepad; } - public ButtonValue(StickInputId stick) + public Button(StickInputId stick) { - Type = ButtonValueType.StickId; + Type = ButtonType.StickId; _rawValue = (uint)stick; } diff --git a/src/Ryujinx.Input/ButtonValueType.cs b/src/Ryujinx.Input/ButtonType.cs similarity index 75% rename from src/Ryujinx.Input/ButtonValueType.cs rename to src/Ryujinx.Input/ButtonType.cs index 8315bacb41..25ef5eea81 100644 --- a/src/Ryujinx.Input/ButtonValueType.cs +++ b/src/Ryujinx.Input/ButtonType.cs @@ -1,6 +1,6 @@ namespace Ryujinx.Input { - public enum ButtonValueType + public enum ButtonType { Key, GamepadButtonInputId, diff --git a/src/Ryujinx/UI/Helpers/ButtonKeyAssigner.cs b/src/Ryujinx/UI/Helpers/ButtonKeyAssigner.cs index 54e0918a50..91e5c8448e 100644 --- a/src/Ryujinx/UI/Helpers/ButtonKeyAssigner.cs +++ b/src/Ryujinx/UI/Helpers/ButtonKeyAssigner.cs @@ -12,9 +12,9 @@ namespace Ryujinx.Ava.UI.Helpers internal class ButtonAssignedEventArgs : EventArgs { public ToggleButton Button { get; } - public ButtonValue? ButtonValue { get; } + public Button? ButtonValue { get; } - public ButtonAssignedEventArgs(ToggleButton button, ButtonValue? buttonValue) + public ButtonAssignedEventArgs(ToggleButton button, Button? buttonValue) { Button = button; ButtonValue = buttonValue; @@ -75,7 +75,7 @@ namespace Ryujinx.Ava.UI.Helpers await Dispatcher.UIThread.InvokeAsync(() => { - ButtonValue? pressedButton = assigner.GetPressedButton(); + Button? pressedButton = assigner.GetPressedButton(); if (_shouldUnbind) { diff --git a/src/Ryujinx/UI/Models/Input/ControllerInputConfig.cs b/src/Ryujinx/UI/Models/Input/GamepadInputConfig.cs similarity index 99% rename from src/Ryujinx/UI/Models/Input/ControllerInputConfig.cs rename to src/Ryujinx/UI/Models/Input/GamepadInputConfig.cs index 9fe29d37f6..833670bdc4 100644 --- a/src/Ryujinx/UI/Models/Input/ControllerInputConfig.cs +++ b/src/Ryujinx/UI/Models/Input/GamepadInputConfig.cs @@ -6,7 +6,7 @@ using System; namespace Ryujinx.Ava.UI.Models.Input { - public class ControllerInputConfig : BaseModel + public class GamepadInputConfig : BaseModel { public bool EnableCemuHookMotion { get; set; } public string DsuServerHost { get; set; } @@ -409,7 +409,7 @@ namespace Ryujinx.Ava.UI.Models.Input } } - public ControllerInputConfig(InputConfig config) + public GamepadInputConfig(InputConfig config) { if (config != null) { diff --git a/src/Ryujinx/UI/Models/Input/HotkeysConfig.cs b/src/Ryujinx/UI/Models/Input/HotkeyConfig.cs similarity index 97% rename from src/Ryujinx/UI/Models/Input/HotkeysConfig.cs rename to src/Ryujinx/UI/Models/Input/HotkeyConfig.cs index 534271d335..b5f53508bd 100644 --- a/src/Ryujinx/UI/Models/Input/HotkeysConfig.cs +++ b/src/Ryujinx/UI/Models/Input/HotkeyConfig.cs @@ -3,7 +3,7 @@ using Ryujinx.Common.Configuration.Hid; namespace Ryujinx.Ava.UI.Models.Input { - public class HotkeysConfig : BaseModel + public class HotkeyConfig : BaseModel { private Key _toggleVsync; public Key ToggleVsync @@ -104,7 +104,7 @@ namespace Ryujinx.Ava.UI.Models.Input } } - public HotkeysConfig(KeyboardHotkeys config) + public HotkeyConfig(KeyboardHotkeys config) { if (config != null) { diff --git a/src/Ryujinx/UI/ViewModels/Input/ControllerInputViewModel.cs b/src/Ryujinx/UI/ViewModels/Input/ControllerInputViewModel.cs index 0e23dfa76b..da892c4a92 100644 --- a/src/Ryujinx/UI/ViewModels/Input/ControllerInputViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/Input/ControllerInputViewModel.cs @@ -6,8 +6,8 @@ namespace Ryujinx.Ava.UI.ViewModels.Input { public class ControllerInputViewModel : BaseModel { - private ControllerInputConfig _config; - public ControllerInputConfig Config + private GamepadInputConfig _config; + public GamepadInputConfig Config { get => _config; set @@ -56,7 +56,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input public InputViewModel parentModel; - public ControllerInputViewModel(InputViewModel model, ControllerInputConfig config) + public ControllerInputViewModel(InputViewModel model, GamepadInputConfig config) { parentModel = model; model.NotifyChangesEvent += OnParentModelChanged; diff --git a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs index c2e7d342f9..74da459793 100644 --- a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs @@ -288,7 +288,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input if (Config is StandardControllerInputConfig controllerInputConfig) { - ConfigViewModel = new ControllerInputViewModel(this, new ControllerInputConfig(controllerInputConfig)); + ConfigViewModel = new ControllerInputViewModel(this, new GamepadInputConfig(controllerInputConfig)); } } diff --git a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs index 5e27f32ade..6074a5fdb3 100644 --- a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs @@ -236,12 +236,7 @@ namespace Ryujinx.Ava.UI.ViewModels get => new(_networkInterfaces.Keys); } - public AvaloniaList MultiplayerModes - { - get => new(Enum.GetNames()); - } - - public HotkeysConfig KeyboardHotkeys { get; set; } + public HotkeyConfig KeyboardHotkey { get; set; } public int NetworkInterfaceIndex { @@ -408,7 +403,7 @@ namespace Ryujinx.Ava.UI.ViewModels EnableMouse = config.Hid.EnableMouse; // Keyboard Hotkeys - KeyboardHotkeys = new HotkeysConfig(config.Hid.Hotkeys.Value); + KeyboardHotkey = new HotkeyConfig(config.Hid.Hotkeys.Value); // System Region = (int)config.System.Region.Value; @@ -495,7 +490,7 @@ namespace Ryujinx.Ava.UI.ViewModels config.Hid.EnableMouse.Value = EnableMouse; // Keyboard Hotkeys - config.Hid.Hotkeys.Value = KeyboardHotkeys.GetConfig(); + config.Hid.Hotkeys.Value = KeyboardHotkey.GetConfig(); // System config.System.Region.Value = (Region)Region; diff --git a/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml b/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml index cfd5d21dc3..bffcada055 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml +++ b/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml @@ -52,55 +52,55 @@ - + - + - + - + - + - + - + - + - + diff --git a/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs b/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs index 2a0eb17e53..788cf79e9e 100644 --- a/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs +++ b/src/Ryujinx/UI/Views/Settings/SettingsHotkeysView.axaml.cs @@ -84,31 +84,31 @@ namespace Ryujinx.Ava.UI.Views.Settings switch (button.Name) { case "ToggleVsync": - viewModel.KeyboardHotkeys.ToggleVsync = buttonValue.AsHidType(); + viewModel.KeyboardHotkey.ToggleVsync = buttonValue.AsHidType(); break; case "Screenshot": - viewModel.KeyboardHotkeys.Screenshot = buttonValue.AsHidType(); + viewModel.KeyboardHotkey.Screenshot = buttonValue.AsHidType(); break; case "ShowUI": - viewModel.KeyboardHotkeys.ShowUI = buttonValue.AsHidType(); + viewModel.KeyboardHotkey.ShowUI = buttonValue.AsHidType(); break; case "Pause": - viewModel.KeyboardHotkeys.Pause = buttonValue.AsHidType(); + viewModel.KeyboardHotkey.Pause = buttonValue.AsHidType(); break; case "ToggleMute": - viewModel.KeyboardHotkeys.ToggleMute = buttonValue.AsHidType(); + viewModel.KeyboardHotkey.ToggleMute = buttonValue.AsHidType(); break; case "ResScaleUp": - viewModel.KeyboardHotkeys.ResScaleUp = buttonValue.AsHidType(); + viewModel.KeyboardHotkey.ResScaleUp = buttonValue.AsHidType(); break; case "ResScaleDown": - viewModel.KeyboardHotkeys.ResScaleDown = buttonValue.AsHidType(); + viewModel.KeyboardHotkey.ResScaleDown = buttonValue.AsHidType(); break; case "VolumeUp": - viewModel.KeyboardHotkeys.VolumeUp = buttonValue.AsHidType(); + viewModel.KeyboardHotkey.VolumeUp = buttonValue.AsHidType(); break; case "VolumeDown": - viewModel.KeyboardHotkeys.VolumeDown = buttonValue.AsHidType(); + viewModel.KeyboardHotkey.VolumeDown = buttonValue.AsHidType(); break; } }