diff --git a/src/Ryujinx.Common/Configuration/Hid/LeftJoyconCommonConfig.cs b/src/Ryujinx.Common/Configuration/Hid/LeftJoyconCommonConfig.cs index 1404535555..978873659f 100644 --- a/src/Ryujinx.Common/Configuration/Hid/LeftJoyconCommonConfig.cs +++ b/src/Ryujinx.Common/Configuration/Hid/LeftJoyconCommonConfig.cs @@ -3,6 +3,7 @@ namespace Ryujinx.Common.Configuration.Hid public class LeftJoyconCommonConfig { public TButton ButtonMinus { get; set; } + public TButton ButtonScreenshot { get; set; } public TButton ButtonL { get; set; } public TButton ButtonZl { get; set; } public TButton ButtonSl { get; set; } diff --git a/src/Ryujinx.Gtk3/Input/GTK3/GTK3Keyboard.cs b/src/Ryujinx.Gtk3/Input/GTK3/GTK3Keyboard.cs index ff7a2c3b6c..a56f4369ca 100644 --- a/src/Ryujinx.Gtk3/Input/GTK3/GTK3Keyboard.cs +++ b/src/Ryujinx.Gtk3/Input/GTK3/GTK3Keyboard.cs @@ -166,6 +166,7 @@ namespace Ryujinx.Input.GTK3 _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadLeft, (Key)_configuration.LeftJoycon.DpadLeft)); _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadRight, (Key)_configuration.LeftJoycon.DpadRight)); _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Minus, (Key)_configuration.LeftJoycon.ButtonMinus)); + _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Misc1, (Key)_configuration.LeftJoycon.ButtonScreenshot)); _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftShoulder, (Key)_configuration.LeftJoycon.ButtonL)); _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftTrigger, (Key)_configuration.LeftJoycon.ButtonZl)); _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleRightTrigger0, (Key)_configuration.LeftJoycon.ButtonSr)); diff --git a/src/Ryujinx.Gtk3/UI/RendererWidgetBase.cs b/src/Ryujinx.Gtk3/UI/RendererWidgetBase.cs index 12139e87d9..1f13af066a 100644 --- a/src/Ryujinx.Gtk3/UI/RendererWidgetBase.cs +++ b/src/Ryujinx.Gtk3/UI/RendererWidgetBase.cs @@ -15,6 +15,7 @@ using Ryujinx.UI.Common.Helper; using Ryujinx.UI.Widgets; using SkiaSharp; using System; +using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; @@ -73,11 +74,14 @@ namespace Ryujinx.UI private HideCursorMode _hideCursorMode; private readonly InputManager _inputManager; private readonly IKeyboard _keyboardInterface; + private readonly List _gamepadInterfaces; private readonly GraphicsDebugLevel _glLogLevel; private string _gpuBackendName; private string _gpuDriverName; private bool _isMouseInClient; + private int _gamepadsChanged; // use atomically via Interlocked + public RendererWidgetBase(InputManager inputManager, GraphicsDebugLevel glLogLevel) { var mouseDriver = new GTK3MouseDriver(this); @@ -88,6 +92,13 @@ namespace Ryujinx.UI TouchScreenManager = _inputManager.CreateTouchScreenManager(); _keyboardInterface = (IKeyboard)_inputManager.KeyboardDriver.GetGamepad("0"); + _gamepadInterfaces = new List(); + + _inputManager.GamepadDriver.OnGamepadConnected += GamepadConnected; + _inputManager.GamepadDriver.OnGamepadDisconnected += GamepadDisconnected; + + RefreshGamepads(); + WaitEvent = new ManualResetEvent(false); _glLogLevel = glLogLevel; @@ -649,6 +660,11 @@ namespace Ryujinx.UI }); } + if (Interlocked.Exchange(ref _gamepadsChanged, 0) == 1) + { + RefreshGamepads(); + } + NpadManager.Update(ConfigurationState.Instance.Graphics.AspectRatio.Value.ToFloat()); if ((Toplevel as MainWindow).IsFocused) @@ -767,7 +783,8 @@ namespace Ryujinx.UI state |= KeyboardHotkeyState.ToggleVSync; } - if (_keyboardInterface.IsPressed((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.Screenshot)) + if (_keyboardInterface.IsPressed((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.Screenshot) || + ButtonPressedOnAnyGamepad(GamepadButtonInputId.Misc1)) { state |= KeyboardHotkeyState.Screenshot; } @@ -809,5 +826,37 @@ namespace Ryujinx.UI return state; } + + private void GamepadConnected(string id) + { + Interlocked.Exchange(ref _gamepadsChanged, 1); + } + + private void GamepadDisconnected(string id) + { + Interlocked.Exchange(ref _gamepadsChanged, 1); + } + + private void RefreshGamepads() + { + _gamepadInterfaces.Clear(); + + foreach (string id in _inputManager.GamepadDriver.GamepadsIds) + { + _gamepadInterfaces.Add(_inputManager.GamepadDriver.GetGamepad(id)); + } + } + + private bool ButtonPressedOnAnyGamepad(GamepadButtonInputId button) + { + foreach (IGamepad gamepad in _gamepadInterfaces) + { + if (gamepad.IsPressed(button)) + { + return true; + } + } + return false; + } } } diff --git a/src/Ryujinx.Gtk3/UI/Windows/ControllerWindow.cs b/src/Ryujinx.Gtk3/UI/Windows/ControllerWindow.cs index d0b8266f42..24abcea804 100644 --- a/src/Ryujinx.Gtk3/UI/Windows/ControllerWindow.cs +++ b/src/Ryujinx.Gtk3/UI/Windows/ControllerWindow.cs @@ -84,6 +84,7 @@ namespace Ryujinx.UI.Windows [GUI] ToggleButton _dpadLeft; [GUI] ToggleButton _dpadRight; [GUI] ToggleButton _minus; + [GUI] ToggleButton _screenshot; [GUI] ToggleButton _l; [GUI] ToggleButton _zL; [GUI] ToggleButton _rStick; @@ -165,6 +166,7 @@ namespace Ryujinx.UI.Windows _dpadLeft.Clicked += Button_Pressed; _dpadRight.Clicked += Button_Pressed; _minus.Clicked += Button_Pressed; + _screenshot.Clicked += Button_Pressed; _l.Clicked += Button_Pressed; _zL.Clicked += Button_Pressed; _lSl.Clicked += Button_Pressed; @@ -400,6 +402,7 @@ namespace Ryujinx.UI.Windows _dpadLeft.Label = "Unbound"; _dpadRight.Label = "Unbound"; _minus.Label = "Unbound"; + _screenshot.Label = "Unbound"; _l.Label = "Unbound"; _zL.Label = "Unbound"; _lSl.Label = "Unbound"; @@ -460,6 +463,7 @@ namespace Ryujinx.UI.Windows _dpadLeft.Label = keyboardConfig.LeftJoycon.DpadLeft.ToString(); _dpadRight.Label = keyboardConfig.LeftJoycon.DpadRight.ToString(); _minus.Label = keyboardConfig.LeftJoycon.ButtonMinus.ToString(); + _screenshot.Label = keyboardConfig.LeftJoycon.ButtonScreenshot.ToString(); _l.Label = keyboardConfig.LeftJoycon.ButtonL.ToString(); _zL.Label = keyboardConfig.LeftJoycon.ButtonZl.ToString(); _lSl.Label = keyboardConfig.LeftJoycon.ButtonSl.ToString(); @@ -498,6 +502,7 @@ namespace Ryujinx.UI.Windows _dpadLeft.Label = controllerConfig.LeftJoycon.DpadLeft.ToString(); _dpadRight.Label = controllerConfig.LeftJoycon.DpadRight.ToString(); _minus.Label = controllerConfig.LeftJoycon.ButtonMinus.ToString(); + _screenshot.Label = controllerConfig.LeftJoycon.ButtonScreenshot.ToString(); _l.Label = controllerConfig.LeftJoycon.ButtonL.ToString(); _zL.Label = controllerConfig.LeftJoycon.ButtonZl.ToString(); _lSl.Label = controllerConfig.LeftJoycon.ButtonSl.ToString(); @@ -566,6 +571,7 @@ namespace Ryujinx.UI.Windows Enum.TryParse(_dpadLeft.Label, out Key lDPadLeft); Enum.TryParse(_dpadRight.Label, out Key lDPadRight); Enum.TryParse(_minus.Label, out Key lButtonMinus); + Enum.TryParse(_screenshot.Label, out Key lButtonScreenshot); Enum.TryParse(_l.Label, out Key lButtonL); Enum.TryParse(_zL.Label, out Key lButtonZl); Enum.TryParse(_lSl.Label, out Key lButtonSl); @@ -597,6 +603,7 @@ namespace Ryujinx.UI.Windows LeftJoycon = new LeftJoyconCommonConfig { ButtonMinus = lButtonMinus, + ButtonScreenshot = lButtonScreenshot, ButtonL = lButtonL, ButtonZl = lButtonZl, ButtonSl = lButtonSl, @@ -643,6 +650,7 @@ namespace Ryujinx.UI.Windows Enum.TryParse(_lStick.Label, out ConfigStickInputId lStick); Enum.TryParse(_lStickButton.Label, out ConfigGamepadInputId lStickButton); Enum.TryParse(_minus.Label, out ConfigGamepadInputId lButtonMinus); + Enum.TryParse(_screenshot.Label, out ConfigGamepadInputId lButtonScreenshot); Enum.TryParse(_l.Label, out ConfigGamepadInputId lButtonL); Enum.TryParse(_zL.Label, out ConfigGamepadInputId lButtonZl); Enum.TryParse(_lSl.Label, out ConfigGamepadInputId lButtonSl); @@ -710,6 +718,7 @@ namespace Ryujinx.UI.Windows LeftJoycon = new LeftJoyconCommonConfig { ButtonMinus = lButtonMinus, + ButtonScreenshot = lButtonScreenshot, ButtonL = lButtonL, ButtonZl = lButtonZl, ButtonSl = lButtonSl, @@ -997,6 +1006,7 @@ namespace Ryujinx.UI.Windows DpadLeft = Key.Left, DpadRight = Key.Right, ButtonMinus = Key.Minus, + ButtonScreenshot = Key.Unbound, // keyboard already has a default screenshot configured via ConfigurationState.Hid.Hotkeys.Screenshot, so no gamepad mapping needed ButtonL = Key.E, ButtonZl = Key.Q, ButtonSl = Key.Unbound, @@ -1057,6 +1067,7 @@ namespace Ryujinx.UI.Windows DpadLeft = ConfigGamepadInputId.DpadLeft, DpadRight = ConfigGamepadInputId.DpadRight, ButtonMinus = ConfigGamepadInputId.Minus, + ButtonScreenshot = ConfigGamepadInputId.Misc1, ButtonL = ConfigGamepadInputId.LeftShoulder, ButtonZl = ConfigGamepadInputId.LeftTrigger, ButtonSl = ConfigGamepadInputId.Unbound, diff --git a/src/Ryujinx.Gtk3/UI/Windows/ControllerWindow.glade b/src/Ryujinx.Gtk3/UI/Windows/ControllerWindow.glade index e433f5cc46..4df1ed61c8 100644 --- a/src/Ryujinx.Gtk3/UI/Windows/ControllerWindow.glade +++ b/src/Ryujinx.Gtk3/UI/Windows/ControllerWindow.glade @@ -475,6 +475,31 @@ 4 + + + 80 + True + False + Screenshot + + + 0 + 6 + + + + + + 70 + True + True + True + + + 1 + 6 + + False diff --git a/src/Ryujinx.Headless.SDL2/Program.cs b/src/Ryujinx.Headless.SDL2/Program.cs index 07995dbdd7..897dbe0320 100644 --- a/src/Ryujinx.Headless.SDL2/Program.cs +++ b/src/Ryujinx.Headless.SDL2/Program.cs @@ -161,6 +161,7 @@ namespace Ryujinx.Headless.SDL2 DpadLeft = Key.Left, DpadRight = Key.Right, ButtonMinus = Key.Minus, + ButtonScreenshot = Key.Unbound, // keyboard already has a default screenshot configured via ConfigurationState.Hid.Hotkeys.Screenshot, so no gamepad mapping needed ButtonL = Key.E, ButtonZl = Key.Q, ButtonSl = Key.Unbound, @@ -221,6 +222,7 @@ namespace Ryujinx.Headless.SDL2 DpadLeft = ConfigGamepadInputId.DpadLeft, DpadRight = ConfigGamepadInputId.DpadRight, ButtonMinus = ConfigGamepadInputId.Minus, + ButtonScreenshot = ConfigGamepadInputId.Misc1, ButtonL = ConfigGamepadInputId.LeftShoulder, ButtonZl = ConfigGamepadInputId.LeftTrigger, ButtonSl = ConfigGamepadInputId.Unbound, diff --git a/src/Ryujinx.Input.SDL2/SDL2Gamepad.cs b/src/Ryujinx.Input.SDL2/SDL2Gamepad.cs index 187ca48dd7..817a41b8b6 100644 --- a/src/Ryujinx.Input.SDL2/SDL2Gamepad.cs +++ b/src/Ryujinx.Input.SDL2/SDL2Gamepad.cs @@ -244,6 +244,7 @@ namespace Ryujinx.Input.SDL2 _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadLeft, (GamepadButtonInputId)_configuration.LeftJoycon.DpadLeft)); _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadRight, (GamepadButtonInputId)_configuration.LeftJoycon.DpadRight)); _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Minus, (GamepadButtonInputId)_configuration.LeftJoycon.ButtonMinus)); + _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Misc1, (GamepadButtonInputId)_configuration.LeftJoycon.ButtonScreenshot)); _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftShoulder, (GamepadButtonInputId)_configuration.LeftJoycon.ButtonL)); _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftTrigger, (GamepadButtonInputId)_configuration.LeftJoycon.ButtonZl)); _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleRightTrigger0, (GamepadButtonInputId)_configuration.LeftJoycon.ButtonSr)); diff --git a/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs b/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs index bc0a7e6607..5c1a2f90f3 100644 --- a/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs +++ b/src/Ryujinx.Input.SDL2/SDL2Keyboard.cs @@ -372,6 +372,7 @@ namespace Ryujinx.Input.SDL2 _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadLeft, (Key)_configuration.LeftJoycon.DpadLeft)); _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadRight, (Key)_configuration.LeftJoycon.DpadRight)); _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Minus, (Key)_configuration.LeftJoycon.ButtonMinus)); + _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Misc1, (Key)_configuration.LeftJoycon.ButtonScreenshot)); _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftShoulder, (Key)_configuration.LeftJoycon.ButtonL)); _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftTrigger, (Key)_configuration.LeftJoycon.ButtonZl)); _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleRightTrigger0, (Key)_configuration.LeftJoycon.ButtonSr)); diff --git a/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs b/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs index 8420dc5d98..26f0cd82ca 100644 --- a/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs +++ b/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs @@ -888,6 +888,7 @@ namespace Ryujinx.UI.Common.Configuration DpadLeft = Key.Left, DpadRight = Key.Right, ButtonMinus = Key.Minus, + ButtonScreenshot = Key.Unbound, // keyboard already has a default screenshot configured via ConfigurationState.Hid.Hotkeys.Screenshot, so no gamepad mapping needed ButtonL = Key.E, ButtonZl = Key.Q, ButtonSl = Key.Unbound, @@ -1117,6 +1118,7 @@ namespace Ryujinx.UI.Common.Configuration DpadLeft = Key.Left, DpadRight = Key.Right, ButtonMinus = Key.Minus, + ButtonScreenshot = Key.Unbound, // keyboard already has a default screenshot configured via ConfigurationState.Hid.Hotkeys.Screenshot, so no gamepad mapping needed ButtonL = Key.E, ButtonZl = Key.Q, ButtonSl = Key.Unbound, diff --git a/src/Ryujinx/AppHost.cs b/src/Ryujinx/AppHost.cs index 0db8ef4143..4973e751d6 100644 --- a/src/Ryujinx/AppHost.cs +++ b/src/Ryujinx/AppHost.cs @@ -82,6 +82,7 @@ namespace Ryujinx.Ava private readonly MainWindowViewModel _viewModel; private readonly IKeyboard _keyboardInterface; + private readonly List _gamepadInterfaces; private readonly TopLevel _topLevel; public RendererHost RendererHost; @@ -89,6 +90,8 @@ namespace Ryujinx.Ava private float _newVolume; private KeyboardHotkeyState _prevHotkeyState; + private int _gamepadsChanged; // use atomically via Interlocked + private long _lastCursorMoveTime; private bool _isCursorInRenderer = true; private bool _ignoreCursorState = false; @@ -160,6 +163,13 @@ namespace Ryujinx.Ava _keyboardInterface = (IKeyboard)_inputManager.KeyboardDriver.GetGamepad("0"); + _gamepadInterfaces = new List(); + + _inputManager.GamepadDriver.OnGamepadConnected += GamepadConnected; + _inputManager.GamepadDriver.OnGamepadDisconnected += GamepadDisconnected; + + RefreshGamepads(); + NpadManager = _inputManager.CreateNpadManager(); TouchScreenManager = _inputManager.CreateTouchScreenManager(); ApplicationPath = applicationPath; @@ -1103,6 +1113,11 @@ namespace Ryujinx.Ava return false; } + if (Interlocked.Exchange(ref _gamepadsChanged, 0) == 1) + { + RefreshGamepads(); + } + NpadManager.Update(ConfigurationState.Instance.Graphics.AspectRatio.Value.ToFloat()); if (_viewModel.IsActive) @@ -1241,7 +1256,8 @@ namespace Ryujinx.Ava { state = KeyboardHotkeyState.ToggleVSync; } - else if (_keyboardInterface.IsPressed((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.Screenshot)) + else if (_keyboardInterface.IsPressed((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.Screenshot) || + ButtonPressedOnAnyGamepad(GamepadButtonInputId.Misc1)) { state = KeyboardHotkeyState.Screenshot; } @@ -1276,5 +1292,37 @@ namespace Ryujinx.Ava return state; } + + private void GamepadConnected(string id) + { + Interlocked.Exchange(ref _gamepadsChanged, 1); + } + + private void GamepadDisconnected(string id) + { + Interlocked.Exchange(ref _gamepadsChanged, 1); + } + + private void RefreshGamepads() + { + _gamepadInterfaces.Clear(); + + foreach (string id in _inputManager.GamepadDriver.GamepadsIds) + { + _gamepadInterfaces.Add(_inputManager.GamepadDriver.GetGamepad(id)); + } + } + + private bool ButtonPressedOnAnyGamepad(GamepadButtonInputId button) + { + foreach (IGamepad gamepad in _gamepadInterfaces) + { + if (gamepad.IsPressed(button)) + { + return true; + } + } + return false; + } } } diff --git a/src/Ryujinx/Assets/Locales/de_DE.json b/src/Ryujinx/Assets/Locales/de_DE.json index 4012931985..55a60ac36d 100644 --- a/src/Ryujinx/Assets/Locales/de_DE.json +++ b/src/Ryujinx/Assets/Locales/de_DE.json @@ -233,6 +233,8 @@ "ControllerSettingsDPadDown": "Runter", "ControllerSettingsDPadLeft": "Links", "ControllerSettingsDPadRight": "Rechts", + "ControllerSettingsRawScreenshot": "Unbearbeiteter Screenshot", + "ControllerSettingsRawScreenshotTooltip": "Macht ein Bildschirmfoto, ohne das Spiel zu informieren, sodass keine Wasserzeichen hinzugefĆ¼gt werden.", "ControllerSettingsStickButton": "Button", "ControllerSettingsStickUp": "Hoch", "ControllerSettingsStickDown": "Runter", diff --git a/src/Ryujinx/Assets/Locales/en_US.json b/src/Ryujinx/Assets/Locales/en_US.json index 74e18056ba..df2efad8a4 100644 --- a/src/Ryujinx/Assets/Locales/en_US.json +++ b/src/Ryujinx/Assets/Locales/en_US.json @@ -234,6 +234,8 @@ "ControllerSettingsDPadDown": "Down", "ControllerSettingsDPadLeft": "Left", "ControllerSettingsDPadRight": "Right", + "ControllerSettingsRawScreenshot": "Raw Screenshot", + "ControllerSettingsRawScreenshotTooltip": "Takes a screenshot without informing the game, so no watermarks will be added.", "ControllerSettingsStickButton": "Button", "ControllerSettingsStickUp": "Up", "ControllerSettingsStickDown": "Down", diff --git a/src/Ryujinx/Input/AvaloniaKeyboard.cs b/src/Ryujinx/Input/AvaloniaKeyboard.cs index ff88de79e4..f44599a23d 100644 --- a/src/Ryujinx/Input/AvaloniaKeyboard.cs +++ b/src/Ryujinx/Input/AvaloniaKeyboard.cs @@ -128,6 +128,7 @@ namespace Ryujinx.Ava.Input _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadLeft, (Key)_configuration.LeftJoycon.DpadLeft)); _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadRight, (Key)_configuration.LeftJoycon.DpadRight)); _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Minus, (Key)_configuration.LeftJoycon.ButtonMinus)); + _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Misc1, (Key)_configuration.LeftJoycon.ButtonScreenshot)); _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftShoulder, (Key)_configuration.LeftJoycon.ButtonL)); _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftTrigger, (Key)_configuration.LeftJoycon.ButtonZl)); _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleRightTrigger0, (Key)_configuration.LeftJoycon.ButtonSr)); diff --git a/src/Ryujinx/UI/Models/Input/GamepadInputConfig.cs b/src/Ryujinx/UI/Models/Input/GamepadInputConfig.cs index 833670bdc4..561ce78afc 100644 --- a/src/Ryujinx/UI/Models/Input/GamepadInputConfig.cs +++ b/src/Ryujinx/UI/Models/Input/GamepadInputConfig.cs @@ -178,6 +178,17 @@ namespace Ryujinx.Ava.UI.Models.Input } } + private GamepadInputId _buttonScreenshot; + public GamepadInputId ButtonScreenshot + { + get => _buttonScreenshot; + set + { + _buttonScreenshot = value; + OnPropertyChanged(); + } + } + private GamepadInputId _buttonL; public GamepadInputId ButtonL { @@ -440,6 +451,7 @@ namespace Ryujinx.Ava.UI.Models.Input DpadRight = controllerInput.LeftJoycon.DpadRight; ButtonL = controllerInput.LeftJoycon.ButtonL; ButtonMinus = controllerInput.LeftJoycon.ButtonMinus; + ButtonScreenshot = controllerInput.LeftJoycon.ButtonScreenshot; LeftButtonSl = controllerInput.LeftJoycon.ButtonSl; LeftButtonSr = controllerInput.LeftJoycon.ButtonSr; ButtonZl = controllerInput.LeftJoycon.ButtonZl; @@ -502,6 +514,7 @@ namespace Ryujinx.Ava.UI.Models.Input DpadRight = DpadRight, ButtonL = ButtonL, ButtonMinus = ButtonMinus, + ButtonScreenshot = ButtonScreenshot, ButtonSl = LeftButtonSl, ButtonSr = LeftButtonSr, ButtonZl = ButtonZl, diff --git a/src/Ryujinx/UI/Models/Input/KeyboardInputConfig.cs b/src/Ryujinx/UI/Models/Input/KeyboardInputConfig.cs index 66f1f62a22..357e3aab74 100644 --- a/src/Ryujinx/UI/Models/Input/KeyboardInputConfig.cs +++ b/src/Ryujinx/UI/Models/Input/KeyboardInputConfig.cs @@ -381,6 +381,7 @@ namespace Ryujinx.Ava.UI.Models.Input DpadRight = DpadRight, ButtonL = ButtonL, ButtonMinus = ButtonMinus, + ButtonScreenshot = Key.Unbound, // keyboard screenshot configured via ConfigurationState.Hid.Hotkeys.Screenshot, so no gamepad mapping needed ButtonZl = ButtonZl, ButtonSl = LeftButtonSl, ButtonSr = LeftButtonSr, diff --git a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs index 89cc6496d5..1a1a71f574 100644 --- a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs @@ -545,6 +545,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input DpadLeft = Key.Left, DpadRight = Key.Right, ButtonMinus = Key.Minus, + ButtonScreenshot = Key.Unbound, // keyboard already has a default screenshot configured via ConfigurationState.Hid.Hotkeys.Screenshot, so no gamepad mapping needed ButtonL = Key.E, ButtonZl = Key.Q, ButtonSl = Key.Unbound, @@ -605,6 +606,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input DpadLeft = ConfigGamepadInputId.DpadLeft, DpadRight = ConfigGamepadInputId.DpadRight, ButtonMinus = ConfigGamepadInputId.Minus, + ButtonScreenshot = ConfigGamepadInputId.Misc1, ButtonL = ConfigGamepadInputId.LeftShoulder, ButtonZl = ConfigGamepadInputId.LeftTrigger, ButtonSl = ConfigGamepadInputId.Unbound, diff --git a/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml b/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml index 08bdf90f4c..1533f08ff5 100644 --- a/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml +++ b/src/Ryujinx/UI/Views/Input/ControllerInputView.axaml @@ -311,6 +311,36 @@ + + + + + + + + + + + + (); break; + case "ButtonScreenshot": + viewModel.Config.ButtonScreenshot = buttonValue.AsHidType(); + break; case "LeftStickButton": viewModel.Config.LeftStickButton = buttonValue.AsHidType(); break;