mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-16 07:47:44 +01:00
Move cycle controllers code to InputViewModel
This commit is contained in:
parent
6a555ee9f7
commit
e911876f76
2 changed files with 11 additions and 9 deletions
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue