diff --git a/assets/Locales/Root.json b/assets/Locales/Root.json index a189fbe51..edd46a146 100644 --- a/assets/Locales/Root.json +++ b/assets/Locales/Root.json @@ -6206,9 +6206,9 @@ "ar_SA": "", "de_DE": "", "el_GR": "", - "en_US": "You can assign devices to specific players by clicking the gear icon next to each input device.", - "es_ES": "Puedes asignar dispositivos a jugadores específicos haciendo clic en el icono de engranaje junto a cada dispositivo de entrada.", - "fr_FR": "Vous pouvez assigner des périphériques à des joueurs spécifiques en cliquant sur l'icône d'engrenage à côté de chaque périphérique d'entrée.", + "en_US": "All currently connected input devices have been assigned to the following Players:\n\n{0}\n\nYou can assign devices to specific players by clicking the gear icon next to each input device.", + "es_ES": "Todos los dispositivos de entrada conectados actualmente se han asignado a los siguientes jugadores:\n\n{0}\n\nPuedes asignar dispositivos a jugadores específicos haciendo clic en el icono de engranaje junto a cada dispositivo de entrada.", + "fr_FR": "Tous les périphériques d'entrée actuellement connectés ont été assignés aux joueurs suivants :\n\n{0}\n\nVous pouvez assigner des périphériques à des joueurs spécifiques en cliquant sur l'icône d'engrenage à côté de chaque périphérique d'entrée.", "he_IL": "", "it_IT": "", "ja_JP": "", diff --git a/src/Ryujinx.Input/HLE/NpadController.cs b/src/Ryujinx.Input/HLE/NpadController.cs index dcdd8493f..ed5a5e082 100644 --- a/src/Ryujinx.Input/HLE/NpadController.cs +++ b/src/Ryujinx.Input/HLE/NpadController.cs @@ -417,8 +417,8 @@ namespace Ryujinx.Input.HLE bool motionWasDisabled = oldConfig?.Motion == null; bool leftMotionMissing = _leftMotionInput == null; bool isJoyconPairNeedingRightMotion = newConfig.ControllerType == ConfigControllerType.JoyconPair && _rightMotionInput == null; - bool motionEnabledChanged = oldConfig.Motion.EnableMotion != newConfig.Motion.EnableMotion; - bool motionBackendChanged = oldConfig.Motion.MotionBackend != newConfig.Motion.MotionBackend; + bool motionEnabledChanged = !motionWasDisabled && oldConfig?.Motion?.EnableMotion != newConfig.Motion.EnableMotion; + bool motionBackendChanged = !motionWasDisabled && oldConfig?.Motion?.MotionBackend != newConfig.Motion.MotionBackend; return motionWasDisabled || leftMotionMissing || @@ -769,7 +769,7 @@ namespace Ryujinx.Input.HLE { foreach (string gamepadId in gamepadDriver.GamepadsIds) { - if (gamepadId == assignedController.Id) + if (string.Equals(gamepadId, assignedController.Id, StringComparison.Ordinal)) { yield return assignedController; break; @@ -784,7 +784,7 @@ namespace Ryujinx.Input.HLE { foreach (string gamepadId in gamepadDriver.GamepadsIds) { - if (gamepadId == config.Id) + if (string.Equals(gamepadId, config.Id, StringComparison.Ordinal)) { yield return new AssignedInputDevice { diff --git a/src/Ryujinx.Input/HLE/NpadManager.cs b/src/Ryujinx.Input/HLE/NpadManager.cs index 3e9d2faf8..fcc527c80 100644 --- a/src/Ryujinx.Input/HLE/NpadManager.cs +++ b/src/Ryujinx.Input/HLE/NpadManager.cs @@ -109,6 +109,11 @@ namespace Ryujinx.Input.HLE private void HandleOnGamepadConnected(string id) { + List requestedInputConfig; + List playerInputAssignments; + bool enableKeyboard; + bool enableMouse; + lock (_lock) { for (int i = 0; i < _controllers.Length; i++) @@ -119,10 +124,15 @@ namespace Ryujinx.Input.HLE _controllers[i] = null; } } + + requestedInputConfig = _requestedInputConfig; + playerInputAssignments = _playerInputAssignments; + enableKeyboard = _enableKeyboard; + enableMouse = _enableMouse; } // Force input reload - ReloadConfiguration(_requestedInputConfig, _playerInputAssignments, _enableKeyboard, _enableMouse); + ReloadConfiguration(requestedInputConfig, playerInputAssignments, enableKeyboard, enableMouse); } private bool PlayerHasAssignedControllerId(PlayerIndex playerIndex, string id) diff --git a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs index b7c04335c..06b324b9e 100644 --- a/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/Input/InputViewModel.cs @@ -207,7 +207,9 @@ namespace Ryujinx.Ava.UI.ViewModels.Input private async void ShowDynamicInputSwapFirstUseWarning() { - string message = LocaleManager.Instance[LocaleKeys.DialogDynamicInputSwapDeviceAssignmentsHint]; + string message = LocaleManager.Instance.UpdateAndGetDynamicValue( + LocaleKeys.DialogDynamicInputSwapDeviceAssignmentsHint, + BuildDynamicInputSwapFirstUseAssignmentSummary()); CheckBoxDialogResult result = await ContentDialogHelper.CreateCheckBoxDialog( LocaleManager.Instance[LocaleKeys.ControllerSettingsAssignedInputDevices], @@ -221,6 +223,15 @@ namespace Ryujinx.Ava.UI.ViewModels.Input } } + private string BuildDynamicInputSwapFirstUseAssignmentSummary() + { + return string.Join( + Environment.NewLine, + PlayerInputDevices + .Where(device => device.HasAssignedToPlayers) + .Select(device => $"{device.Name} - {device.AssignedToPlayers}")); + } + public bool AllowDuplicateDeviceAssignment { get => _allowDuplicateDeviceAssignment ?? GetSavedAllowDuplicateDeviceAssignment(); @@ -853,15 +864,6 @@ namespace Ryujinx.Ava.UI.ViewModels.Input { PlayerInputAssignment normalizedOtherAssignment = GetWorkingPlayerInputAssignment(otherPlayer); - // Only include players who participate in dynamic input swap. - // Players with dynamic swap disabled manage their device through - // the traditional InputConfig and should not appear in the - // Assigned Devices menu for other players. - if (!normalizedOtherAssignment.EnableDynamicInputSwap) - { - continue; - } - string playerName = GetPlayerDisplayName(otherPlayer); foreach (AssignedInputDevice device in normalizedOtherAssignment.Devices) @@ -940,11 +942,6 @@ namespace Ryujinx.Ava.UI.ViewModels.Input string currentPlayerName = GetPlayerDisplayName(_playerId); - if (!AllowDuplicateDeviceAssignment) - { - return currentPlayerName; - } - return assignedOtherPlayers != null && assignedOtherPlayers.Count > 0 ? $"{currentPlayerName}, {string.Join(", ", assignedOtherPlayers.OrderBy(name => ExtractPlayerNumber(name)))}" : currentPlayerName; diff --git a/src/Ryujinx/UI/Views/Input/AssignedDevicesInputView.axaml b/src/Ryujinx/UI/Views/Input/AssignedDevicesInputView.axaml index 556e50916..1b12c48e3 100644 --- a/src/Ryujinx/UI/Views/Input/AssignedDevicesInputView.axaml +++ b/src/Ryujinx/UI/Views/Input/AssignedDevicesInputView.axaml @@ -19,59 +19,74 @@ BorderThickness="1" CornerRadius="5" HorizontalAlignment="Stretch"> - + + + + + + + + + - + + + HorizontalAlignment="Right" + TextWrapping="Wrap" + Text="{Binding AssignedToPlayers}" + IsVisible="{Binding HasAssignedToPlayers}" /> - + - + - - +