See merge request ryubing/ryujinx!214
This commit is contained in:
GreemDev
2025-11-11 12:55:36 -06:00
parent 49c70efdd5
commit 6b814fb973
171 changed files with 6011 additions and 6335 deletions

View File

@@ -4,55 +4,50 @@ using Ryujinx.Ava.UI.Models.Input;
using Ryujinx.Ava.UI.Views.Input;
using Ryujinx.Common.Utilities;
using Ryujinx.UI.Views.Input;
using System.Drawing;
namespace Ryujinx.Ava.UI.ViewModels.Input
{
public partial class ControllerInputViewModel : BaseModel
{
private GamepadInputConfig _config;
public GamepadInputConfig Config
{
get => _config;
get;
set
{
_config = value;
field = value;
OnPropertyChanged();
}
}
private StickVisualizer _visualizer;
public StickVisualizer Visualizer
{
get => _visualizer;
get;
set
{
_visualizer = value;
field = value;
OnPropertyChanged();
}
}
private bool _isLeft;
public bool IsLeft
{
get => _isLeft;
get;
set
{
_isLeft = value;
field = value;
OnPropertyChanged();
OnPropertyChanged(nameof(HasSides));
}
}
private bool _isRight;
public bool IsRight
{
get => _isRight;
get;
set
{
_isRight = value;
field = value;
OnPropertyChanged();
OnPropertyChanged(nameof(HasSides));
}
@@ -60,8 +55,8 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
public bool HasSides => IsLeft ^ IsRight;
[ObservableProperty] private SvgImage _image;
[ObservableProperty]
public partial SvgImage Image { get; set; }
public InputViewModel ParentModel { get; }
public ControllerInputViewModel(InputViewModel model, GamepadInputConfig config, StickVisualizer visualizer)
@@ -75,7 +70,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
if (args.PropertyName is nameof(Config.UseRainbowLed))
{
if (Config is { UseRainbowLed: true, TurnOffLed: false, EnableLedChanging: true })
Rainbow.Updated += (ref Color color) => ParentModel.SelectedGamepad.SetLed((uint)color.ToArgb());
Rainbow.Updated += (ref color) => ParentModel.SelectedGamepad.SetLed((uint)color.ToArgb());
else
{
Rainbow.Reset();

View File

@@ -48,36 +48,41 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
private int _controller;
private string _controllerImage;
private int _device;
private object _configViewModel;
private bool _isChangeTrackingActive;
private string _chosenProfile;
[ObservableProperty] private bool _isModified;
[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()
[ObservableProperty]
public partial bool IsModified { get; set; }
[ObservableProperty]
public partial string ProfileName { get; set; }
[ObservableProperty]
public partial bool NotificationIsVisible { get; set; } // Automatically call the NotificationView property with OnPropertyChanged()
[ObservableProperty]
public partial string NotificationText { get; set; } // Automatically call the NotificationText property with OnPropertyChanged()
private bool _isLoaded;
private static readonly InputConfigJsonSerializerContext _serializerContext = new(JsonHelper.GetDefaultSerializerOptions());
public IGamepadDriver AvaloniaKeyboardDriver { get; }
private IGamepad _selectedGamepad;
public IGamepad SelectedGamepad
{
get => _selectedGamepad;
get;
private set
{
Rainbow.Reset();
_selectedGamepad = value;
field = value;
if (ConfigViewModel is ControllerInputViewModel { Config.UseRainbowLed: true })
Rainbow.Updated += (ref Color color) => _selectedGamepad.SetLed((uint)color.ToArgb());
Rainbow.Updated += (ref Color color) => field.SetLed((uint)color.ToArgb());
OnPropertiesChanged(nameof(HasLed), nameof(CanClearLed));
}
}
public StickVisualizer VisualStick { get; private set; }
public ObservableCollection<PlayerModel> PlayerIndexes { get; set; }
@@ -99,15 +104,15 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
public bool CanClearLed => SelectedGamepad.Name.ContainsIgnoreCase("DualSense");
public event Action NotifyChangesEvent;
public string ChosenProfile
{
get => _chosenProfile;
get;
set
{
// When you select a profile, the settings from the profile will be applied.
// To save the settings, you still need to click the apply button
_chosenProfile = value;
field = value;
LoadProfile();
OnPropertyChanged();
}
@@ -115,10 +120,10 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
public object ConfigViewModel
{
get => _configViewModel;
get;
set
{
_configViewModel = value;
field = value;
VisualStick.UpdateConfig(value);

View File

@@ -6,49 +6,45 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
{
public partial class KeyboardInputViewModel : BaseModel
{
private KeyboardInputConfig _config;
public KeyboardInputConfig Config
{
get => _config;
get;
set
{
_config = value;
field = value;
OnPropertyChanged();
}
}
private StickVisualizer _visualizer;
public StickVisualizer Visualizer
{
get => _visualizer;
get;
set
{
_visualizer = value;
field = value;
OnPropertyChanged();
}
}
private bool _isLeft;
public bool IsLeft
{
get => _isLeft;
get;
set
{
_isLeft = value;
field = value;
OnPropertyChanged();
OnPropertyChanged(nameof(HasSides));
}
}
private bool _isRight;
public bool IsRight
{
get => _isRight;
get;
set
{
_isRight = value;
field = value;
OnPropertyChanged();
OnPropertyChanged(nameof(HasSides));
}
@@ -56,7 +52,8 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
public bool HasSides => IsLeft ^ IsRight;
[ObservableProperty] private SvgImage _image;
[ObservableProperty]
public partial SvgImage Image { get; set; }
public readonly InputViewModel ParentModel;

View File

@@ -23,8 +23,11 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
ParentModel.SelectedGamepad.SetLed(LedColor.ToUInt32());
});
[ObservableProperty] private bool _enableLedChanging;
[ObservableProperty] private Color _ledColor;
[ObservableProperty]
public partial bool EnableLedChanging { get; set; }
[ObservableProperty]
public partial Color LedColor { get; set; }
public string RainbowSpeedText => RainbowSpeed.ToString(CultureInfo.CurrentCulture).Truncate(4, string.Empty);
@@ -41,27 +44,23 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
public bool ShowLedColorPicker => !TurnOffLed && !UseRainbowLed;
private bool _turnOffLed;
public bool TurnOffLed
{
get => _turnOffLed;
get;
set
{
_turnOffLed = value;
field = value;
OnPropertyChanged();
OnPropertyChanged(nameof(ShowLedColorPicker));
}
}
private bool _useRainbowLed;
public bool UseRainbowLed
{
get => _useRainbowLed;
get;
set
{
_useRainbowLed = value;
field = value;
OnPropertyChanged();
OnPropertyChanged(nameof(ShowLedColorPicker));
}

View File

@@ -4,20 +4,28 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
{
public partial class MotionInputViewModel : BaseModel
{
[ObservableProperty] private int _slot;
[ObservableProperty]
public partial int Slot { get; set; }
[ObservableProperty] private int _altSlot;
[ObservableProperty]
public partial int AltSlot { get; set; }
[ObservableProperty] private string _dsuServerHost;
[ObservableProperty]
public partial string DsuServerHost { get; set; }
[ObservableProperty] private int _dsuServerPort;
[ObservableProperty]
public partial int DsuServerPort { get; set; }
[ObservableProperty] private bool _mirrorInput;
[ObservableProperty]
public partial bool MirrorInput { get; set; }
[ObservableProperty] private int _sensitivity;
[ObservableProperty]
public partial int Sensitivity { get; set; }
[ObservableProperty] private double _gyroDeadzone;
[ObservableProperty]
public partial double GyroDeadzone { get; set; }
[ObservableProperty] private bool _enableCemuHookMotion;
[ObservableProperty]
public partial bool EnableCemuHookMotion { get; set; }
}
}

View File

@@ -4,8 +4,10 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
{
public partial class RumbleInputViewModel : BaseModel
{
[ObservableProperty] private float _strongRumble;
[ObservableProperty]
public partial float StrongRumble { get; set; }
[ObservableProperty] private float _weakRumble;
[ObservableProperty]
public partial float WeakRumble { get; set; }
}
}