diff options
Diffstat (limited to 'Ryujinx.Ava/Ui/ViewModels')
| -rw-r--r-- | Ryujinx.Ava/Ui/ViewModels/ControllerSettingsViewModel.cs | 24 | ||||
| -rw-r--r-- | Ryujinx.Ava/Ui/ViewModels/MainWindowViewModel.cs | 8 |
2 files changed, 27 insertions, 5 deletions
diff --git a/Ryujinx.Ava/Ui/ViewModels/ControllerSettingsViewModel.cs b/Ryujinx.Ava/Ui/ViewModels/ControllerSettingsViewModel.cs index 2422a031..c936fc54 100644 --- a/Ryujinx.Ava/Ui/ViewModels/ControllerSettingsViewModel.cs +++ b/Ryujinx.Ava/Ui/ViewModels/ControllerSettingsViewModel.cs @@ -43,6 +43,7 @@ namespace Ryujinx.Ava.Ui.ViewModels private PlayerIndex _playerId; private int _controller; + private int _controllerNumber = 0; private string _controllerImage; private int _device; private object _configuration; @@ -439,6 +440,14 @@ namespace Ryujinx.Ava.Ui.ViewModels return str; } + private static string GetShortGamepadId(string str) + { + const string Hyphen = "-"; + const int Offset = 1; + + return str.Substring(str.IndexOf(Hyphen) + Offset); + } + public void LoadDevices() { lock (Devices) @@ -451,9 +460,11 @@ namespace Ryujinx.Ava.Ui.ViewModels { using IGamepad gamepad = _mainWindow.InputManager.KeyboardDriver.GetGamepad(id); + Logger.Info?.Print(LogClass.Configuration, $"{GetShortGamepadName(gamepad.Name)} has been connected with ID: {gamepad.Id}"); + if (gamepad != null) { - Devices.Add((DeviceType.Keyboard, id, $"{GetShortGamepadName(gamepad.Name)} ({id})")); + Devices.Add((DeviceType.Keyboard, id, $"{GetShortGamepadName(gamepad.Name)}")); } } @@ -461,12 +472,21 @@ namespace Ryujinx.Ava.Ui.ViewModels { using IGamepad gamepad = _mainWindow.InputManager.GamepadDriver.GetGamepad(id); + Logger.Info?.Print(LogClass.Configuration, $"{GetShortGamepadName(gamepad.Name)} has been connected with ID: {gamepad.Id}"); + if (gamepad != null) { - Devices.Add((DeviceType.Controller, id, $"{GetShortGamepadName(gamepad.Name)} ({id})")); + if (Devices.Any(controller => GetShortGamepadId(controller.Id) == GetShortGamepadId(gamepad.Id))) + { + _controllerNumber++; + } + + Devices.Add((DeviceType.Controller, id, $"{GetShortGamepadName(gamepad.Name)} ({_controllerNumber})")); } } + _controllerNumber = 0; + DeviceList.AddRange(Devices.Select(x => x.Name)); Device = Math.Min(Device, DeviceList.Count); } diff --git a/Ryujinx.Ava/Ui/ViewModels/MainWindowViewModel.cs b/Ryujinx.Ava/Ui/ViewModels/MainWindowViewModel.cs index 98516159..3672f963 100644 --- a/Ryujinx.Ava/Ui/ViewModels/MainWindowViewModel.cs +++ b/Ryujinx.Ava/Ui/ViewModels/MainWindowViewModel.cs @@ -50,6 +50,7 @@ namespace Ryujinx.Ava.Ui.ViewModels private string _dockedStatusText; private string _fifoStatusText; private string _gameStatusText; + private string _volumeStatusText; private string _gpuStatusText; private bool _isAmiiboRequested; private bool _isGameRunning; @@ -385,11 +386,12 @@ namespace Ryujinx.Ava.Ui.ViewModels public string VolumeStatusText { - get + get => _volumeStatusText; + set { - string icon = Volume == 0 ? "🔇" : "🔊"; + _volumeStatusText = value; - return $"{icon} {(int)(Volume * 100)}%"; + OnPropertyChanged(); } } |
