diff --git a/src/Ryujinx/AppHost.cs b/src/Ryujinx/AppHost.cs index 100022d07c..d0a274546c 100644 --- a/src/Ryujinx/AppHost.cs +++ b/src/Ryujinx/AppHost.cs @@ -1210,15 +1210,9 @@ namespace Ryujinx.Ava case KeyboardHotkeyState.CycleControllersPlayer6: case KeyboardHotkeyState.CycleControllersPlayer7: case KeyboardHotkeyState.CycleControllersPlayer8: - Dispatcher.UIThread.Invoke(() => { - var player = currentHotkeyState - KeyboardHotkeyState.CycleControllersPlayer1; - var ivm = new UI.ViewModels.Input.InputViewModel(); - ivm.LoadDevices(); - ivm.PlayerId = (Ryujinx.Common.Configuration.Hid.PlayerIndex) player; - ivm.Device = (ivm.Device + 1) % ivm.Devices.Count; - ivm.Save(); - Console.WriteLine($"Cycling controller for player {ivm.PlayerId} to {ivm.Devices[ivm.Device].Name}"); - }); + var player = currentHotkeyState - KeyboardHotkeyState.CycleControllersPlayer1; + var ivm = new UI.ViewModels.Input.InputViewModel(); + Dispatcher.UIThread.Invoke(() => ivm.CyclePlayerDevice(player)); break; case KeyboardHotkeyState.None: (_keyboardInterface as AvaloniaKeyboard).Clear(); diff --git a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs index 221e9d0448..c2bbc6477b 100644 --- a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs @@ -885,5 +885,13 @@ namespace Ryujinx.Ava.UI.ViewModels.Input AvaloniaKeyboardDriver.Dispose(); } + + public void CyclePlayerDevice(int player) + { + LoadDevices(); + PlayerId = (PlayerIndex)player; + Device = (Device + 1) % Devices.Count; + Save(); + } } }