From 30d7253e26c3ea7a8015819a33f0f4c1d1f98167 Mon Sep 17 00:00:00 2001 From: Willi Schinmeyer Date: Fri, 6 Sep 2024 12:58:31 +0200 Subject: [PATCH 1/2] Add raw screenshot gamepad button This triggers the same raw screenshot as the keyboard hotkey, i.e. the game is not informed of the intent to screenshot, so it cannot add watermarks etc. The button can be configured using both the regular UI and GTK. Includes English and German translations. An alternate approach is proposed in draft PR #4503: Allow triggering all hotkeys using the gamepad. Re: #5952 --- .../Hid/LeftJoyconCommonConfig.cs | 1 + src/Ryujinx.Gtk3/Input/GTK3/GTK3Keyboard.cs | 1 + src/Ryujinx.Gtk3/UI/RendererWidgetBase.cs | 51 ++++++++++++++++++- .../UI/Windows/ControllerWindow.cs | 11 ++++ .../UI/Windows/ControllerWindow.glade | 25 +++++++++ src/Ryujinx.Headless.SDL2/Program.cs | 2 + src/Ryujinx.Input.SDL2/SDL2Gamepad.cs | 1 + src/Ryujinx.Input.SDL2/SDL2Keyboard.cs | 1 + .../Configuration/ConfigurationState.cs | 2 + src/Ryujinx/AppHost.cs | 50 +++++++++++++++++- src/Ryujinx/Assets/Locales/de_DE.json | 2 + src/Ryujinx/Assets/Locales/en_US.json | 2 + src/Ryujinx/Input/AvaloniaKeyboard.cs | 1 + .../UI/Models/Input/GamepadInputConfig.cs | 13 +++++ .../UI/Models/Input/KeyboardInputConfig.cs | 1 + .../UI/ViewModels/Input/InputViewModel.cs | 2 + .../UI/Views/Input/ControllerInputView.axaml | 30 +++++++++++ .../Views/Input/ControllerInputView.axaml.cs | 3 ++ 18 files changed, 197 insertions(+), 2 deletions(-) diff --git a/src/Ryujinx.Common/Configuration/Hid/LeftJoyconCommonConfig.cs b/src/Ryujinx.Common/Configuration/Hid/LeftJoyconCommonConfig.cs index 140453555..978873659 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 ff7a2c3b6..a56f4369c 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 12139e87d..1f13af066 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 d0b8266f4..24abcea80 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 e433f5cc4..4df1ed61c 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 07995dbdd..897dbe032 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 187ca48dd..817a41b8b 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 bc0a7e660..5c1a2f90f 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 8420dc5d9..26f0cd82c 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 0db8ef414..4973e751d 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 401293198..55a60ac36 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 74e18056b..df2efad8a 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 ff88de79e..f44599a23 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 833670bdc..561ce78af 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 66f1f62a2..357e3aab7 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 89cc6496d..1a1a71f57 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 08bdf90f4..1533f08ff 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; From ede3f0f5b807055ba6b0b8bf473fca12ffa5ff7d Mon Sep 17 00:00:00 2001 From: Willi Schinmeyer Date: Fri, 6 Sep 2024 21:11:04 +0200 Subject: [PATCH 2/2] Correct raw screenshot tooltip Watermarks are actually applied by the OS, not the game, as the tooltip previously wrongly stated. However, per #5952, games can also react to screenshots, which also is not supported. --- src/Ryujinx/Assets/Locales/de_DE.json | 2 +- src/Ryujinx/Assets/Locales/en_US.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Ryujinx/Assets/Locales/de_DE.json b/src/Ryujinx/Assets/Locales/de_DE.json index 55a60ac36..1edd10277 100644 --- a/src/Ryujinx/Assets/Locales/de_DE.json +++ b/src/Ryujinx/Assets/Locales/de_DE.json @@ -234,7 +234,7 @@ "ControllerSettingsDPadLeft": "Links", "ControllerSettingsDPadRight": "Rechts", "ControllerSettingsRawScreenshot": "Unbearbeiteter Screenshot", - "ControllerSettingsRawScreenshotTooltip": "Macht ein Bildschirmfoto, ohne das Spiel zu informieren, sodass keine Wasserzeichen hinzugefügt werden.", + "ControllerSettingsRawScreenshotTooltip": "Macht ein Bildschirmfoto ohne Wasserzeichen etc.", "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 df2efad8a..22f2ac183 100644 --- a/src/Ryujinx/Assets/Locales/en_US.json +++ b/src/Ryujinx/Assets/Locales/en_US.json @@ -235,7 +235,7 @@ "ControllerSettingsDPadLeft": "Left", "ControllerSettingsDPadRight": "Right", "ControllerSettingsRawScreenshot": "Raw Screenshot", - "ControllerSettingsRawScreenshotTooltip": "Takes a screenshot without informing the game, so no watermarks will be added.", + "ControllerSettingsRawScreenshotTooltip": "Takes a screenshot without any watermarks etc.", "ControllerSettingsStickButton": "Button", "ControllerSettingsStickUp": "Up", "ControllerSettingsStickDown": "Down",