mirror of
https://github.com/Ryubing/Ryujinx.git
synced 2025-03-15 10:34:47 +00:00
Addition: Device Name and ID are displayed when the controller is turned off, but the controller is configured.
Added the "Name" property for controllers. Changed the controller setup message to be more informative.
This commit is contained in:
parent
7a43dcb513
commit
db08498a89
7 changed files with 65 additions and 19 deletions
|
@ -21,6 +21,11 @@ namespace Ryujinx.Common.Configuration.Hid
|
|||
/// </summary>
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Controller name
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Controller's Type
|
||||
/// </summary>
|
||||
|
|
|
@ -6922,6 +6922,31 @@
|
|||
"zh_TW": "輸入裝置"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "ControllerSettingsWaitingConnectDevice",
|
||||
"Translations": {
|
||||
"ar_SA": "",
|
||||
"de_DE": "",
|
||||
"el_GR": "",
|
||||
"en_US": "Configuration found:\n\nName:\t{0}\nGUID:\t{1}\n\n Waiting for controller connection...",
|
||||
"es_ES": "",
|
||||
"fr_FR": "",
|
||||
"he_IL": "",
|
||||
"it_IT": "",
|
||||
"ja_JP": "",
|
||||
"ko_KR": "",
|
||||
"no_NO": "",
|
||||
"pl_PL": "",
|
||||
"pt_BR": "",
|
||||
"ru_RU": "",
|
||||
"sv_SE": "",
|
||||
"th_TH": "",
|
||||
"tr_TR": "",
|
||||
"uk_UA": "",
|
||||
"zh_CN": "",
|
||||
"zh_TW": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": "ControllerSettingsRefresh",
|
||||
"Translations": {
|
||||
|
@ -24473,4 +24498,4 @@
|
|||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -269,6 +269,7 @@ namespace Ryujinx.Ava.Systems.Configuration
|
|||
Version = InputConfig.CurrentVersion,
|
||||
Backend = InputBackendType.WindowKeyboard,
|
||||
Id = "0",
|
||||
Name = "Keyboard",
|
||||
PlayerIndex = PlayerIndex.Player1,
|
||||
ControllerType = ControllerType.ProController,
|
||||
LeftJoycon = new LeftJoyconCommonConfig<Key>
|
||||
|
|
|
@ -22,6 +22,8 @@ namespace Ryujinx.Ava.UI.Models.Input
|
|||
public float StrongRumble { get; set; }
|
||||
|
||||
public string Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public ControllerType ControllerType { get; set; }
|
||||
public PlayerIndex PlayerIndex { get; set; }
|
||||
|
||||
|
@ -111,6 +113,7 @@ namespace Ryujinx.Ava.UI.Models.Input
|
|||
if (config != null)
|
||||
{
|
||||
Id = config.Id;
|
||||
Name = config.Name;
|
||||
ControllerType = config.ControllerType;
|
||||
PlayerIndex = config.PlayerIndex;
|
||||
|
||||
|
@ -201,6 +204,7 @@ namespace Ryujinx.Ava.UI.Models.Input
|
|||
StandardControllerInputConfig config = new()
|
||||
{
|
||||
Id = Id,
|
||||
Name = Name,
|
||||
Backend = InputBackendType.GamepadSDL2,
|
||||
PlayerIndex = PlayerIndex,
|
||||
ControllerType = ControllerType,
|
||||
|
|
|
@ -2,12 +2,14 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
|||
using Ryujinx.Ava.UI.ViewModels;
|
||||
using Ryujinx.Common.Configuration.Hid;
|
||||
using Ryujinx.Common.Configuration.Hid.Keyboard;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Ryujinx.Ava.UI.Models.Input
|
||||
{
|
||||
public partial class KeyboardInputConfig : BaseModel
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public ControllerType ControllerType { get; set; }
|
||||
public PlayerIndex PlayerIndex { get; set; }
|
||||
|
||||
|
@ -53,6 +55,7 @@ namespace Ryujinx.Ava.UI.Models.Input
|
|||
if (config != null)
|
||||
{
|
||||
Id = config.Id;
|
||||
Name = config.Name;
|
||||
ControllerType = config.ControllerType;
|
||||
PlayerIndex = config.PlayerIndex;
|
||||
|
||||
|
@ -100,6 +103,7 @@ namespace Ryujinx.Ava.UI.Models.Input
|
|||
StandardKeyboardInputConfig config = new()
|
||||
{
|
||||
Id = Id,
|
||||
Name = Name,
|
||||
Backend = InputBackendType.WindowKeyboard,
|
||||
PlayerIndex = PlayerIndex,
|
||||
ControllerType = ControllerType,
|
||||
|
|
|
@ -51,6 +51,8 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
private int _device;
|
||||
private object _configViewModel;
|
||||
[ObservableProperty] private string _profileName;
|
||||
[ObservableProperty] private bool _notificationIsVisible; // Automatically call the NotificationView property with OnPropertyChanged()
|
||||
[ObservableProperty] private string _notificationText; // Automatically call the NotificationText property with OnPropertyChanged()
|
||||
private bool _isLoaded;
|
||||
|
||||
private static readonly InputConfigJsonSerializerContext _serializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
||||
|
@ -95,6 +97,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
public bool _isChangeTrackingActive;
|
||||
|
||||
public bool _isModified;
|
||||
|
||||
public bool IsModified
|
||||
{
|
||||
get => _isModified;
|
||||
|
@ -107,7 +110,6 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
|
||||
public event Action NotifyChangesEvent;
|
||||
|
||||
|
||||
public string _profileChoose;
|
||||
public string ProfileChoose
|
||||
{
|
||||
|
@ -288,18 +290,6 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
|
||||
public InputConfig Config { get; set; }
|
||||
|
||||
public bool _notificationView;
|
||||
|
||||
public bool NotificationView
|
||||
{
|
||||
get => _notificationView;
|
||||
set
|
||||
{
|
||||
_notificationView = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public InputViewModel(UserControl owner) : this()
|
||||
{
|
||||
if (Program.PreviewerDetached)
|
||||
|
@ -367,7 +357,18 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
// This function allows you to output a message about the device configuration found in the file
|
||||
// NOTE: if the configuration is found, we display the message "Waiting for controller connection",
|
||||
// but only if the id gamepad belongs to the selected player
|
||||
NotificationView = Config != null && Devices.FirstOrDefault(d => d.Id == Config.Id).Id != Config.Id && Config.PlayerIndex == PlayerId;
|
||||
NotificationIsVisible = Config != null && Devices.FirstOrDefault(d => d.Id == Config.Id).Id != Config.Id && Config.PlayerIndex == PlayerId;
|
||||
if (NotificationIsVisible)
|
||||
{
|
||||
if (string.IsNullOrEmpty(Config.Name))
|
||||
{
|
||||
NotificationText = $"{LocaleManager.Instance[LocaleKeys.ControllerSettingsWaitingConnectDevice].Format("No information", Config.Id)}";
|
||||
}
|
||||
else
|
||||
{
|
||||
NotificationText = $"{LocaleManager.Instance[LocaleKeys.ControllerSettingsWaitingConnectDevice].Format(Config.Name, Config.Id)}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -386,7 +387,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
{
|
||||
// "Disabled" mode is available after unbinding the device
|
||||
// NOTE: the IsModified flag to be able to apply the settings.
|
||||
NotificationView = false;
|
||||
NotificationIsVisible = false;
|
||||
IsModified = true;
|
||||
}
|
||||
|
||||
|
@ -656,12 +657,14 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
if (activeDevice.Type == DeviceType.Keyboard)
|
||||
{
|
||||
string id = activeDevice.Id;
|
||||
string name = activeDevice.Name;
|
||||
|
||||
config = new StandardKeyboardInputConfig
|
||||
{
|
||||
Version = InputConfig.CurrentVersion,
|
||||
Backend = InputBackendType.WindowKeyboard,
|
||||
Id = id,
|
||||
Name = name,
|
||||
ControllerType = ControllerType.ProController,
|
||||
LeftJoycon = new LeftJoyconCommonConfig<Key>
|
||||
{
|
||||
|
@ -711,12 +714,14 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
bool isNintendoStyle = Devices.ToList().FirstOrDefault(x => x.Id == activeDevice.Id).Name.Contains("Nintendo");
|
||||
|
||||
string id = activeDevice.Id.Split(" ")[0];
|
||||
string name = activeDevice.Name;
|
||||
|
||||
config = new StandardControllerInputConfig
|
||||
{
|
||||
Version = InputConfig.CurrentVersion,
|
||||
Backend = InputBackendType.GamepadSDL2,
|
||||
Id = id,
|
||||
Name = name,
|
||||
ControllerType = ControllerType.ProController,
|
||||
DeadzoneLeft = 0.1f,
|
||||
DeadzoneRight = 0.1f,
|
||||
|
@ -991,6 +996,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||
: (ConfigViewModel as ControllerInputViewModel).Config.GetConfig();
|
||||
config.ControllerType = Controllers[_controller].Type;
|
||||
config.PlayerIndex = _playerId;
|
||||
config.Name = device.Name;
|
||||
|
||||
int i = newConfig.FindIndex(x => x.PlayerIndex == PlayerId);
|
||||
if (i == -1)
|
||||
|
|
|
@ -201,17 +201,18 @@
|
|||
</Grid>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<ContentControl IsVisible="{Binding NotificationView}">
|
||||
<ContentControl IsVisible="{Binding NotificationIsVisible}">
|
||||
<ContentControl.Content>
|
||||
|
||||
<StackPanel>
|
||||
<TextBlock
|
||||
Margin="5,20,0,0"
|
||||
Text="{ext:Locale ControllerSettingsDisableDeviceForSaving}" />
|
||||
Text="{Binding NotificationText}" />
|
||||
<Button
|
||||
MinWidth="0"
|
||||
Width="90"
|
||||
Height="27"
|
||||
Margin="5,10,0,0"
|
||||
Margin="0,10,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Command="{Binding UnlinkDevice}">
|
||||
<TextBlock
|
||||
|
|
Loading…
Add table
Reference in a new issue