Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 332bcdfaf1 |
@@ -5,15 +5,34 @@ using System.Runtime.InteropServices;
|
|||||||
|
|
||||||
namespace Ryujinx.Common.Helper
|
namespace Ryujinx.Common.Helper
|
||||||
{
|
{
|
||||||
|
public enum OperatingSystemType
|
||||||
|
{
|
||||||
|
MacOS,
|
||||||
|
Linux,
|
||||||
|
Windows
|
||||||
|
}
|
||||||
|
|
||||||
public static class RunningPlatform
|
public static class RunningPlatform
|
||||||
{
|
{
|
||||||
|
public static readonly OperatingSystemType CurrentOS
|
||||||
|
= IsMacOS
|
||||||
|
? OperatingSystemType.MacOS
|
||||||
|
: IsWindows
|
||||||
|
? OperatingSystemType.Windows
|
||||||
|
: IsLinux
|
||||||
|
? OperatingSystemType.Linux
|
||||||
|
: throw new PlatformNotSupportedException();
|
||||||
|
|
||||||
|
public static Architecture Architecture => RuntimeInformation.OSArchitecture;
|
||||||
|
public static Architecture CurrentProcessArchitecture => RuntimeInformation.ProcessArchitecture;
|
||||||
|
|
||||||
public static bool IsMacOS => OperatingSystem.IsMacOS();
|
public static bool IsMacOS => OperatingSystem.IsMacOS();
|
||||||
public static bool IsWindows => OperatingSystem.IsWindows();
|
public static bool IsWindows => OperatingSystem.IsWindows();
|
||||||
public static bool IsLinux => OperatingSystem.IsLinux();
|
public static bool IsLinux => OperatingSystem.IsLinux();
|
||||||
|
|
||||||
public static bool IsArm => RuntimeInformation.OSArchitecture is Architecture.Arm64;
|
public static bool IsArm => Architecture is Architecture.Arm64;
|
||||||
|
|
||||||
public static bool IsX64 => RuntimeInformation.OSArchitecture is Architecture.X64;
|
public static bool IsX64 => Architecture is Architecture.X64;
|
||||||
|
|
||||||
public static bool IsIntelMac => IsMacOS && IsX64;
|
public static bool IsIntelMac => IsMacOS && IsX64;
|
||||||
public static bool IsArmMac => IsMacOS && IsArm;
|
public static bool IsArmMac => IsMacOS && IsArm;
|
||||||
|
|||||||
@@ -1,260 +0,0 @@
|
|||||||
using Ryujinx.Ava.UI.ViewModels;
|
|
||||||
using Ryujinx.Ava.UI.ViewModels.Input;
|
|
||||||
using Ryujinx.Input;
|
|
||||||
using System;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Ryujinx.Ava.UI.Models.Input
|
|
||||||
{
|
|
||||||
public class StickVisualizer : BaseModel, IDisposable
|
|
||||||
{
|
|
||||||
public const int DrawStickPollRate = 50; // Milliseconds per poll.
|
|
||||||
public const int DrawStickCircumference = 5;
|
|
||||||
public const float DrawStickScaleFactor = DrawStickCanvasCenter;
|
|
||||||
public const int DrawStickCanvasSize = 100;
|
|
||||||
public const int DrawStickBorderSize = DrawStickCanvasSize + 5;
|
|
||||||
public const float DrawStickCanvasCenter = (DrawStickCanvasSize - DrawStickCircumference) / 2;
|
|
||||||
public const float MaxVectorLength = DrawStickCanvasSize / 2;
|
|
||||||
|
|
||||||
public CancellationTokenSource PollTokenSource;
|
|
||||||
public CancellationToken PollToken;
|
|
||||||
|
|
||||||
private static float _vectorLength;
|
|
||||||
private static float _vectorMultiplier;
|
|
||||||
|
|
||||||
private bool disposedValue;
|
|
||||||
|
|
||||||
private DeviceType _type;
|
|
||||||
public DeviceType Type
|
|
||||||
{
|
|
||||||
get => _type;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_type = value;
|
|
||||||
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private GamepadInputConfig _gamepadConfig;
|
|
||||||
public GamepadInputConfig GamepadConfig
|
|
||||||
{
|
|
||||||
get => _gamepadConfig;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_gamepadConfig = value;
|
|
||||||
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private KeyboardInputConfig _keyboardConfig;
|
|
||||||
public KeyboardInputConfig KeyboardConfig
|
|
||||||
{
|
|
||||||
get => _keyboardConfig;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_keyboardConfig = value;
|
|
||||||
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private (float, float) _uiStickLeft;
|
|
||||||
public (float, float) UiStickLeft
|
|
||||||
{
|
|
||||||
get => (_uiStickLeft.Item1 * DrawStickScaleFactor, _uiStickLeft.Item2 * DrawStickScaleFactor);
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_uiStickLeft = value;
|
|
||||||
|
|
||||||
OnPropertyChanged();
|
|
||||||
OnPropertyChanged(nameof(UiStickRightX));
|
|
||||||
OnPropertyChanged(nameof(UiStickRightY));
|
|
||||||
OnPropertyChanged(nameof(UiDeadzoneRight));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private (float, float) _uiStickRight;
|
|
||||||
public (float, float) UiStickRight
|
|
||||||
{
|
|
||||||
get => (_uiStickRight.Item1 * DrawStickScaleFactor, _uiStickRight.Item2 * DrawStickScaleFactor);
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_uiStickRight = value;
|
|
||||||
|
|
||||||
OnPropertyChanged();
|
|
||||||
OnPropertyChanged(nameof(UiStickLeftX));
|
|
||||||
OnPropertyChanged(nameof(UiStickLeftY));
|
|
||||||
OnPropertyChanged(nameof(UiDeadzoneLeft));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public float UiStickLeftX => ClampVector(UiStickLeft).Item1;
|
|
||||||
public float UiStickLeftY => ClampVector(UiStickLeft).Item2;
|
|
||||||
public float UiStickRightX => ClampVector(UiStickRight).Item1;
|
|
||||||
public float UiStickRightY => ClampVector(UiStickRight).Item2;
|
|
||||||
|
|
||||||
public int UiStickCircumference => DrawStickCircumference;
|
|
||||||
public int UiCanvasSize => DrawStickCanvasSize;
|
|
||||||
public int UiStickBorderSize => DrawStickBorderSize;
|
|
||||||
|
|
||||||
public float? UiDeadzoneLeft => _gamepadConfig?.DeadzoneLeft * DrawStickCanvasSize - DrawStickCircumference;
|
|
||||||
public float? UiDeadzoneRight => _gamepadConfig?.DeadzoneRight * DrawStickCanvasSize - DrawStickCircumference;
|
|
||||||
|
|
||||||
private InputViewModel Parent;
|
|
||||||
|
|
||||||
public StickVisualizer(InputViewModel parent)
|
|
||||||
{
|
|
||||||
Parent = parent;
|
|
||||||
|
|
||||||
PollTokenSource = new CancellationTokenSource();
|
|
||||||
PollToken = PollTokenSource.Token;
|
|
||||||
|
|
||||||
Task.Run(Initialize, PollToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateConfig(object config)
|
|
||||||
{
|
|
||||||
if (config is ControllerInputViewModel padConfig)
|
|
||||||
{
|
|
||||||
GamepadConfig = padConfig.Config;
|
|
||||||
Type = DeviceType.Controller;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (config is KeyboardInputViewModel keyConfig)
|
|
||||||
{
|
|
||||||
KeyboardConfig = keyConfig.Config;
|
|
||||||
Type = DeviceType.Keyboard;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Type = DeviceType.None;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task Initialize()
|
|
||||||
{
|
|
||||||
(float, float) leftBuffer;
|
|
||||||
(float, float) rightBuffer;
|
|
||||||
|
|
||||||
while (!PollToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
leftBuffer = (0f, 0f);
|
|
||||||
rightBuffer = (0f, 0f);
|
|
||||||
|
|
||||||
switch (Type)
|
|
||||||
{
|
|
||||||
case DeviceType.Keyboard:
|
|
||||||
IKeyboard keyboard = (IKeyboard)Parent.AvaloniaKeyboardDriver.GetGamepad("0");
|
|
||||||
|
|
||||||
if (keyboard != null)
|
|
||||||
{
|
|
||||||
KeyboardStateSnapshot snapshot = keyboard.GetKeyboardStateSnapshot();
|
|
||||||
|
|
||||||
if (snapshot.IsPressed((Key)KeyboardConfig.LeftStickRight))
|
|
||||||
{
|
|
||||||
leftBuffer.Item1 += 1;
|
|
||||||
}
|
|
||||||
if (snapshot.IsPressed((Key)KeyboardConfig.LeftStickLeft))
|
|
||||||
{
|
|
||||||
leftBuffer.Item1 -= 1;
|
|
||||||
}
|
|
||||||
if (snapshot.IsPressed((Key)KeyboardConfig.LeftStickUp))
|
|
||||||
{
|
|
||||||
leftBuffer.Item2 += 1;
|
|
||||||
}
|
|
||||||
if (snapshot.IsPressed((Key)KeyboardConfig.LeftStickDown))
|
|
||||||
{
|
|
||||||
leftBuffer.Item2 -= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (snapshot.IsPressed((Key)KeyboardConfig.RightStickRight))
|
|
||||||
{
|
|
||||||
rightBuffer.Item1 += 1;
|
|
||||||
}
|
|
||||||
if (snapshot.IsPressed((Key)KeyboardConfig.RightStickLeft))
|
|
||||||
{
|
|
||||||
rightBuffer.Item1 -= 1;
|
|
||||||
}
|
|
||||||
if (snapshot.IsPressed((Key)KeyboardConfig.RightStickUp))
|
|
||||||
{
|
|
||||||
rightBuffer.Item2 += 1;
|
|
||||||
}
|
|
||||||
if (snapshot.IsPressed((Key)KeyboardConfig.RightStickDown))
|
|
||||||
{
|
|
||||||
rightBuffer.Item2 -= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
UiStickLeft = leftBuffer;
|
|
||||||
UiStickRight = rightBuffer;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DeviceType.Controller:
|
|
||||||
IGamepad controller = Parent.SelectedGamepad;
|
|
||||||
|
|
||||||
if (controller != null)
|
|
||||||
{
|
|
||||||
leftBuffer = controller.GetStick((StickInputId)GamepadConfig.LeftJoystick);
|
|
||||||
rightBuffer = controller.GetStick((StickInputId)GamepadConfig.RightJoystick);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DeviceType.None:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new ArgumentException($"Unable to poll device type \"{Type}\"");
|
|
||||||
}
|
|
||||||
|
|
||||||
UiStickLeft = leftBuffer;
|
|
||||||
UiStickRight = rightBuffer;
|
|
||||||
|
|
||||||
await Task.Delay(DrawStickPollRate, PollToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
PollTokenSource.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static (float, float) ClampVector((float, float) vect)
|
|
||||||
{
|
|
||||||
_vectorMultiplier = 1;
|
|
||||||
_vectorLength = MathF.Sqrt((vect.Item1 * vect.Item1) + (vect.Item2 * vect.Item2));
|
|
||||||
|
|
||||||
if (_vectorLength > MaxVectorLength)
|
|
||||||
{
|
|
||||||
_vectorMultiplier = MaxVectorLength / _vectorLength;
|
|
||||||
}
|
|
||||||
|
|
||||||
vect.Item1 = vect.Item1 * _vectorMultiplier + DrawStickCanvasCenter;
|
|
||||||
vect.Item2 = vect.Item2 * _vectorMultiplier + DrawStickCanvasCenter;
|
|
||||||
|
|
||||||
return vect;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (!disposedValue)
|
|
||||||
{
|
|
||||||
if (disposing)
|
|
||||||
{
|
|
||||||
PollTokenSource.Cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
KeyboardConfig = null;
|
|
||||||
GamepadConfig = null;
|
|
||||||
Parent = null;
|
|
||||||
|
|
||||||
disposedValue = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
Dispose(disposing: true);
|
|
||||||
GC.SuppressFinalize(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +1,5 @@
|
|||||||
using Avalonia.Svg.Skia;
|
using Avalonia.Svg.Skia;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
|
||||||
using FluentAvalonia.UI.Controls;
|
|
||||||
using Ryujinx.Ava.Input;
|
|
||||||
using Ryujinx.Ava.UI.Helpers;
|
|
||||||
using Ryujinx.Ava.UI.Models.Input;
|
using Ryujinx.Ava.UI.Models.Input;
|
||||||
using Ryujinx.Ava.UI.Views.Input;
|
using Ryujinx.Ava.UI.Views.Input;
|
||||||
using Ryujinx.Common.Utilities;
|
using Ryujinx.Common.Utilities;
|
||||||
@@ -14,30 +10,8 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||||||
{
|
{
|
||||||
public partial class ControllerInputViewModel : BaseModel
|
public partial class ControllerInputViewModel : BaseModel
|
||||||
{
|
{
|
||||||
private GamepadInputConfig _config;
|
[ObservableProperty] private GamepadInputConfig _config;
|
||||||
public GamepadInputConfig Config
|
|
||||||
{
|
|
||||||
get => _config;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_config = value;
|
|
||||||
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private StickVisualizer _visualizer;
|
|
||||||
public StickVisualizer Visualizer
|
|
||||||
{
|
|
||||||
get => _visualizer;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_visualizer = value;
|
|
||||||
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool _isLeft;
|
private bool _isLeft;
|
||||||
public bool IsLeft
|
public bool IsLeft
|
||||||
{
|
{
|
||||||
@@ -63,15 +37,14 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool HasSides => IsLeft ^ IsRight;
|
public bool HasSides => IsLeft ^ IsRight;
|
||||||
|
|
||||||
[ObservableProperty] private SvgImage _image;
|
[ObservableProperty] private SvgImage _image;
|
||||||
|
|
||||||
public InputViewModel ParentModel { get; }
|
public InputViewModel ParentModel { get; }
|
||||||
|
|
||||||
public ControllerInputViewModel(InputViewModel model, GamepadInputConfig config, StickVisualizer visualizer)
|
public ControllerInputViewModel(InputViewModel model, GamepadInputConfig config)
|
||||||
{
|
{
|
||||||
ParentModel = model;
|
ParentModel = model;
|
||||||
Visualizer = visualizer;
|
|
||||||
model.NotifyChangesEvent += OnParentModelChanged;
|
model.NotifyChangesEvent += OnParentModelChanged;
|
||||||
OnParentModelChanged();
|
OnParentModelChanged();
|
||||||
config.PropertyChanged += (_, args) =>
|
config.PropertyChanged += (_, args) =>
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||||||
private int _controller;
|
private int _controller;
|
||||||
private string _controllerImage;
|
private string _controllerImage;
|
||||||
private int _device;
|
private int _device;
|
||||||
private object _configViewModel;
|
[ObservableProperty] private object _configViewModel;
|
||||||
[ObservableProperty] private string _profileName;
|
[ObservableProperty] private string _profileName;
|
||||||
private bool _isLoaded;
|
private bool _isLoaded;
|
||||||
|
|
||||||
@@ -74,7 +74,6 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||||||
OnPropertiesChanged(nameof(HasLed), nameof(CanClearLed));
|
OnPropertiesChanged(nameof(HasLed), nameof(CanClearLed));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public StickVisualizer VisualStick { get; private set; }
|
|
||||||
|
|
||||||
public ObservableCollection<PlayerModel> PlayerIndexes { get; set; }
|
public ObservableCollection<PlayerModel> PlayerIndexes { get; set; }
|
||||||
public ObservableCollection<(DeviceType Type, string Id, string Name)> Devices { get; set; }
|
public ObservableCollection<(DeviceType Type, string Id, string Name)> Devices { get; set; }
|
||||||
@@ -95,19 +94,6 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||||||
public bool IsModified { get; set; }
|
public bool IsModified { get; set; }
|
||||||
public event Action NotifyChangesEvent;
|
public event Action NotifyChangesEvent;
|
||||||
|
|
||||||
public object ConfigViewModel
|
|
||||||
{
|
|
||||||
get => _configViewModel;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_configViewModel = value;
|
|
||||||
|
|
||||||
VisualStick.UpdateConfig(value);
|
|
||||||
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public PlayerIndex PlayerIdChoose
|
public PlayerIndex PlayerIdChoose
|
||||||
{
|
{
|
||||||
get => _playerIdChoose;
|
get => _playerIdChoose;
|
||||||
@@ -283,7 +269,6 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||||||
Devices = [];
|
Devices = [];
|
||||||
ProfilesList = [];
|
ProfilesList = [];
|
||||||
DeviceList = [];
|
DeviceList = [];
|
||||||
VisualStick = new StickVisualizer(this);
|
|
||||||
|
|
||||||
ControllerImage = ProControllerResource;
|
ControllerImage = ProControllerResource;
|
||||||
|
|
||||||
@@ -304,12 +289,12 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||||||
|
|
||||||
if (Config is StandardKeyboardInputConfig keyboardInputConfig)
|
if (Config is StandardKeyboardInputConfig keyboardInputConfig)
|
||||||
{
|
{
|
||||||
ConfigViewModel = new KeyboardInputViewModel(this, new KeyboardInputConfig(keyboardInputConfig), VisualStick);
|
ConfigViewModel = new KeyboardInputViewModel(this, new KeyboardInputConfig(keyboardInputConfig));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config is StandardControllerInputConfig controllerInputConfig)
|
if (Config is StandardControllerInputConfig controllerInputConfig)
|
||||||
{
|
{
|
||||||
ConfigViewModel = new ControllerInputViewModel(this, new GamepadInputConfig(controllerInputConfig), VisualStick);
|
ConfigViewModel = new ControllerInputViewModel(this, new GamepadInputConfig(controllerInputConfig));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -908,8 +893,6 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||||||
|
|
||||||
_mainWindow.ViewModel.AppHost?.NpadManager.UnblockInputUpdates();
|
_mainWindow.ViewModel.AppHost?.NpadManager.UnblockInputUpdates();
|
||||||
|
|
||||||
VisualStick.Dispose();
|
|
||||||
|
|
||||||
SelectedGamepad?.Dispose();
|
SelectedGamepad?.Dispose();
|
||||||
|
|
||||||
AvaloniaKeyboardDriver.Dispose();
|
AvaloniaKeyboardDriver.Dispose();
|
||||||
|
|||||||
@@ -6,29 +6,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||||||
{
|
{
|
||||||
public partial class KeyboardInputViewModel : BaseModel
|
public partial class KeyboardInputViewModel : BaseModel
|
||||||
{
|
{
|
||||||
private KeyboardInputConfig _config;
|
[ObservableProperty] private KeyboardInputConfig _config;
|
||||||
public KeyboardInputConfig Config
|
|
||||||
{
|
|
||||||
get => _config;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_config = value;
|
|
||||||
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private StickVisualizer _visualizer;
|
|
||||||
public StickVisualizer Visualizer
|
|
||||||
{
|
|
||||||
get => _visualizer;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_visualizer = value;
|
|
||||||
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool _isLeft;
|
private bool _isLeft;
|
||||||
public bool IsLeft
|
public bool IsLeft
|
||||||
@@ -60,10 +38,9 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||||||
|
|
||||||
public readonly InputViewModel ParentModel;
|
public readonly InputViewModel ParentModel;
|
||||||
|
|
||||||
public KeyboardInputViewModel(InputViewModel model, KeyboardInputConfig config, StickVisualizer visualizer)
|
public KeyboardInputViewModel(InputViewModel model, KeyboardInputConfig config)
|
||||||
{
|
{
|
||||||
ParentModel = model;
|
ParentModel = model;
|
||||||
Visualizer = visualizer;
|
|
||||||
model.NotifyChangesEvent += OnParentModelChanged;
|
model.NotifyChangesEvent += OnParentModelChanged;
|
||||||
OnParentModelChanged();
|
OnParentModelChanged();
|
||||||
Config = config;
|
Config = config;
|
||||||
|
|||||||
@@ -316,103 +316,17 @@
|
|||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch">
|
VerticalAlignment="Stretch">
|
||||||
<!-- Controller Picture -->
|
<!-- Controller Picture -->
|
||||||
|
<Image
|
||||||
|
Margin="0,10"
|
||||||
|
MaxHeight="300"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
Source="{Binding Image}" />
|
||||||
<Border
|
<Border
|
||||||
BorderBrush="{DynamicResource ThemeControlBorderColor}"
|
BorderBrush="{DynamicResource ThemeControlBorderColor}"
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
CornerRadius="5"
|
CornerRadius="5"
|
||||||
Margin="0,10"
|
|
||||||
MinHeight="90">
|
MinHeight="90">
|
||||||
<StackPanel Orientation="Vertical">
|
|
||||||
<Image
|
|
||||||
Margin="5,10"
|
|
||||||
MaxHeight="300"
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
VerticalAlignment="Stretch"
|
|
||||||
Source="{Binding Image}" />
|
|
||||||
<StackPanel
|
|
||||||
Margin="10"
|
|
||||||
Orientation="Horizontal"
|
|
||||||
Spacing="20"
|
|
||||||
HorizontalAlignment="Center">
|
|
||||||
<Border
|
|
||||||
BorderBrush="{DynamicResource ThemeControlBorderColor}"
|
|
||||||
BorderThickness="1"
|
|
||||||
CornerRadius="5"
|
|
||||||
Height="{Binding Visualizer.UiStickBorderSize}"
|
|
||||||
Width="{Binding Visualizer.UiStickBorderSize}"
|
|
||||||
IsVisible="{Binding IsLeft}">
|
|
||||||
<Canvas
|
|
||||||
Background="{DynamicResource ThemeBackgroundColor}"
|
|
||||||
Height="{Binding Visualizer.UiCanvasSize}"
|
|
||||||
Width="{Binding Visualizer.UiCanvasSize}">
|
|
||||||
<Grid
|
|
||||||
Height="{Binding Visualizer.UiCanvasSize}"
|
|
||||||
Width="{Binding Visualizer.UiCanvasSize}"
|
|
||||||
Background="{DynamicResource ThemeBackgroundColor}">
|
|
||||||
<Ellipse
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
Stroke="Black"
|
|
||||||
StrokeThickness="1"
|
|
||||||
Width="{Binding Visualizer.UiCanvasSize}"
|
|
||||||
Height="{Binding Visualizer.UiCanvasSize}" />
|
|
||||||
<Ellipse
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
Fill="Gray"
|
|
||||||
Opacity="100"
|
|
||||||
Height="{Binding Visualizer.UiDeadzoneLeft}"
|
|
||||||
Width="{Binding Visualizer.UiDeadzoneLeft}" />
|
|
||||||
</Grid>
|
|
||||||
<Ellipse
|
|
||||||
Fill="Red"
|
|
||||||
Width="{Binding Visualizer.UiStickCircumference}"
|
|
||||||
Height="{Binding Visualizer.UiStickCircumference}"
|
|
||||||
Canvas.Bottom="{Binding Visualizer.UiStickLeftY}"
|
|
||||||
Canvas.Left="{Binding Visualizer.UiStickLeftX}" />
|
|
||||||
</Canvas>
|
|
||||||
</Border>
|
|
||||||
<Border
|
|
||||||
BorderBrush="{DynamicResource ThemeControlBorderColor}"
|
|
||||||
BorderThickness="1"
|
|
||||||
CornerRadius="5"
|
|
||||||
Height="{Binding Visualizer.UiStickBorderSize}"
|
|
||||||
Width="{Binding Visualizer.UiStickBorderSize}"
|
|
||||||
IsVisible="{Binding IsRight}">
|
|
||||||
<Canvas
|
|
||||||
Background="{DynamicResource ThemeBackgroundColor}"
|
|
||||||
Height="{Binding Visualizer.UiCanvasSize}"
|
|
||||||
Width="{Binding Visualizer.UiCanvasSize}">
|
|
||||||
<Grid
|
|
||||||
Height="{Binding Visualizer.UiCanvasSize}"
|
|
||||||
Width="{Binding Visualizer.UiCanvasSize}"
|
|
||||||
Background="{DynamicResource ThemeBackgroundColor}">
|
|
||||||
<Ellipse
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
Stroke="Black"
|
|
||||||
StrokeThickness="1"
|
|
||||||
Width="{Binding Visualizer.UiCanvasSize}"
|
|
||||||
Height="{Binding Visualizer.UiCanvasSize}" />
|
|
||||||
<Ellipse
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
Fill="Gray"
|
|
||||||
Opacity="100"
|
|
||||||
Height="{Binding Visualizer.UiDeadzoneRight}"
|
|
||||||
Width="{Binding Visualizer.UiDeadzoneRight}" />
|
|
||||||
</Grid>
|
|
||||||
<Ellipse
|
|
||||||
Fill="Red"
|
|
||||||
Width="{Binding Visualizer.UiStickCircumference}"
|
|
||||||
Height="{Binding Visualizer.UiStickCircumference}"
|
|
||||||
Canvas.Bottom="{Binding Visualizer.UiStickRightY}"
|
|
||||||
Canvas.Left="{Binding Visualizer.UiStickRightX}" />
|
|
||||||
</Canvas>
|
|
||||||
</Border>
|
|
||||||
</StackPanel>
|
|
||||||
</StackPanel>
|
|
||||||
</Border>
|
|
||||||
<Border
|
|
||||||
BorderBrush="{DynamicResource ThemeControlBorderColor}"
|
|
||||||
BorderThickness="1"
|
|
||||||
CornerRadius="5">
|
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Margin="8"
|
Margin="8"
|
||||||
Orientation="Vertical">
|
Orientation="Vertical">
|
||||||
@@ -431,8 +345,8 @@
|
|||||||
Minimum="0"
|
Minimum="0"
|
||||||
Value="{Binding Config.TriggerThreshold, Mode=TwoWay}" />
|
Value="{Binding Config.TriggerThreshold, Mode=TwoWay}" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Width="25"
|
Width="25"
|
||||||
Text="{Binding Config.TriggerThreshold, StringFormat=\{0:0.00\}}" />
|
Text="{Binding Config.TriggerThreshold, StringFormat=\{0:0.00\}}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Orientation="Vertical"
|
Orientation="Vertical"
|
||||||
|
|||||||
@@ -309,79 +309,12 @@
|
|||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch">
|
VerticalAlignment="Stretch">
|
||||||
<!-- Controller Picture -->
|
<!-- Controller Picture -->
|
||||||
<Border
|
<Image
|
||||||
BorderBrush="{DynamicResource ThemeControlBorderColor}"
|
|
||||||
BorderThickness="1"
|
|
||||||
CornerRadius="5"
|
|
||||||
Margin="0,10"
|
Margin="0,10"
|
||||||
MinHeight="90">
|
MaxHeight="300"
|
||||||
<StackPanel
|
HorizontalAlignment="Stretch"
|
||||||
Margin="10"
|
VerticalAlignment="Stretch"
|
||||||
Orientation="Horizontal"
|
Source="{Binding Image}" />
|
||||||
Spacing="20"
|
|
||||||
HorizontalAlignment="Center">
|
|
||||||
<Border
|
|
||||||
BorderBrush="{DynamicResource ThemeControlBorderColor}"
|
|
||||||
BorderThickness="1"
|
|
||||||
CornerRadius="5"
|
|
||||||
Height="{Binding Visualizer.UiStickBorderSize}"
|
|
||||||
Width="{Binding Visualizer.UiStickBorderSize}"
|
|
||||||
IsVisible="{Binding IsLeft}">
|
|
||||||
<Canvas
|
|
||||||
Background="{DynamicResource ThemeBackgroundColor}"
|
|
||||||
Height="{Binding Visualizer.UiCanvasSize}"
|
|
||||||
Width="{Binding Visualizer.UiCanvasSize}">
|
|
||||||
<Grid
|
|
||||||
Height="{Binding Visualizer.UiCanvasSize}"
|
|
||||||
Width="{Binding Visualizer.UiCanvasSize}"
|
|
||||||
Background="{DynamicResource ThemeBackgroundColor}">
|
|
||||||
<Ellipse
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
Stroke="Black"
|
|
||||||
StrokeThickness="1"
|
|
||||||
Width="{Binding Visualizer.UiCanvasSize}"
|
|
||||||
Height="{Binding Visualizer.UiCanvasSize}"/>
|
|
||||||
</Grid>
|
|
||||||
<Ellipse
|
|
||||||
Fill="Red"
|
|
||||||
Width="{Binding Visualizer.UiStickCircumference}"
|
|
||||||
Height="{Binding Visualizer.UiStickCircumference}"
|
|
||||||
Canvas.Bottom="{Binding Visualizer.UiStickLeftY}"
|
|
||||||
Canvas.Left="{Binding Visualizer.UiStickLeftX}" />
|
|
||||||
</Canvas>
|
|
||||||
</Border>
|
|
||||||
<Border
|
|
||||||
BorderBrush="{DynamicResource ThemeControlBorderColor}"
|
|
||||||
BorderThickness="1"
|
|
||||||
CornerRadius="5"
|
|
||||||
Height="{Binding Visualizer.UiStickBorderSize}"
|
|
||||||
Width="{Binding Visualizer.UiStickBorderSize}"
|
|
||||||
IsVisible="{Binding IsRight}">
|
|
||||||
<Canvas
|
|
||||||
Background="{DynamicResource ThemeBackgroundColor}"
|
|
||||||
Height="{Binding Visualizer.UiCanvasSize}"
|
|
||||||
Width="{Binding Visualizer.UiCanvasSize}">
|
|
||||||
<Grid
|
|
||||||
Height="{Binding Visualizer.UiCanvasSize}"
|
|
||||||
Width="{Binding Visualizer.UiCanvasSize}"
|
|
||||||
Background="{DynamicResource ThemeBackgroundColor}">
|
|
||||||
<Ellipse
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
Stroke="Black"
|
|
||||||
StrokeThickness="1"
|
|
||||||
Width="{Binding Visualizer.UiCanvasSize}"
|
|
||||||
Height="{Binding Visualizer.UiCanvasSize}"/>
|
|
||||||
</Grid>
|
|
||||||
<Ellipse
|
|
||||||
Fill="Red"
|
|
||||||
Width="{Binding Visualizer.UiStickCircumference}"
|
|
||||||
Height="{Binding Visualizer.UiStickCircumference}"
|
|
||||||
Canvas.Bottom="{Binding Visualizer.UiStickRightY}"
|
|
||||||
Canvas.Left="{Binding Visualizer.UiStickRightX}" />
|
|
||||||
</Canvas>
|
|
||||||
</Border>
|
|
||||||
</StackPanel>
|
|
||||||
</Border>
|
|
||||||
<Border
|
<Border
|
||||||
BorderBrush="{DynamicResource ThemeControlBorderColor}"
|
BorderBrush="{DynamicResource ThemeControlBorderColor}"
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
|
xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
|
||||||
xmlns:helper="clr-namespace:Ryujinx.Common.Helper;assembly=Ryujinx.Common"
|
xmlns:helper="clr-namespace:Ryujinx.Common.Helper;assembly=Ryujinx.Common"
|
||||||
Width="1100"
|
Width="1100"
|
||||||
Height="850"
|
Height="768"
|
||||||
MinWidth="800"
|
MinWidth="800"
|
||||||
MinHeight="480"
|
MinHeight="480"
|
||||||
WindowStartupLocation="CenterOwner"
|
WindowStartupLocation="CenterOwner"
|
||||||
|
|||||||
+31
-10
@@ -43,17 +43,9 @@ namespace Ryujinx.Ava
|
|||||||
private const int ConnectionCount = 4;
|
private const int ConnectionCount = 4;
|
||||||
|
|
||||||
private static string _buildVer;
|
private static string _buildVer;
|
||||||
|
|
||||||
|
|
||||||
private static readonly string _platformExt =
|
private static readonly string _platformExt = BuildPlatformExtension();
|
||||||
RunningPlatform.IsMacOS
|
|
||||||
? "macos_universal.app.tar.gz"
|
|
||||||
: RunningPlatform.IsWindows
|
|
||||||
? "win_x64.zip"
|
|
||||||
: RunningPlatform.IsX64Linux
|
|
||||||
? "linux_x64.tar.gz"
|
|
||||||
: RunningPlatform.IsArmLinux
|
|
||||||
? "linux_arm64.tar.gz"
|
|
||||||
: throw new PlatformNotSupportedException();
|
|
||||||
|
|
||||||
private static string _buildUrl;
|
private static string _buildUrl;
|
||||||
private static long _buildSize;
|
private static long _buildSize;
|
||||||
@@ -780,5 +772,34 @@ namespace Ryujinx.Ava
|
|||||||
public static void CleanupUpdate() =>
|
public static void CleanupUpdate() =>
|
||||||
Directory.GetFiles(_homeDir, "*.ryuold", SearchOption.AllDirectories)
|
Directory.GetFiles(_homeDir, "*.ryuold", SearchOption.AllDirectories)
|
||||||
.ForEach(File.Delete);
|
.ForEach(File.Delete);
|
||||||
|
|
||||||
|
private static string BuildPlatformExtension()
|
||||||
|
{
|
||||||
|
if (RunningPlatform.IsMacOS)
|
||||||
|
return "macos_universal.app.tar.gz";
|
||||||
|
|
||||||
|
#pragma warning disable CS8509 // It is exhaustive for any values this can contain.
|
||||||
|
string osPrefix = RunningPlatform.CurrentOS switch
|
||||||
|
{
|
||||||
|
OperatingSystemType.Linux => "linux",
|
||||||
|
OperatingSystemType.Windows => "win"
|
||||||
|
};
|
||||||
|
|
||||||
|
string archSuffix = RunningPlatform.Architecture switch
|
||||||
|
{
|
||||||
|
Architecture.Arm64 => "arm64",
|
||||||
|
Architecture.X64 => "x64",
|
||||||
|
_ => throw new PlatformNotSupportedException($"Unknown architecture {Enum.GetName(RunningPlatform.Architecture)}."),
|
||||||
|
};
|
||||||
|
|
||||||
|
string fileExtension = RunningPlatform.CurrentOS switch
|
||||||
|
#pragma warning restore CS8509
|
||||||
|
{
|
||||||
|
OperatingSystemType.Linux => "tar.gz",
|
||||||
|
OperatingSystemType.Windows => "zip"
|
||||||
|
};
|
||||||
|
|
||||||
|
return $"{osPrefix}_{archSuffix}.{fileExtension}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user