Compare commits
3 Commits
Canary-1.2
...
feature/av
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d64bf7d93c | ||
|
|
52338db1e8 | ||
|
|
aa01f70f46 |
@@ -1,58 +0,0 @@
|
|||||||
using Gommon;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace Ryujinx.Common.Helper
|
|
||||||
{
|
|
||||||
public class RefEvent<T>
|
|
||||||
{
|
|
||||||
public delegate void Handler(ref T arg);
|
|
||||||
|
|
||||||
private readonly Lock _subLock = new();
|
|
||||||
private readonly List<Handler> _subscriptions = [];
|
|
||||||
|
|
||||||
public bool HasSubscribers
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
lock (_subLock)
|
|
||||||
return _subscriptions.Count != 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IReadOnlyList<Handler> Subscriptions
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
lock (_subLock)
|
|
||||||
return _subscriptions;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Add(Handler subscriber)
|
|
||||||
{
|
|
||||||
Guard.Require(subscriber, nameof(subscriber));
|
|
||||||
lock (_subLock)
|
|
||||||
_subscriptions.Add(subscriber);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Remove(Handler subscriber)
|
|
||||||
{
|
|
||||||
Guard.Require(subscriber, nameof(subscriber));
|
|
||||||
lock (_subLock)
|
|
||||||
_subscriptions.Remove(subscriber);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Clear()
|
|
||||||
{
|
|
||||||
lock (_subLock)
|
|
||||||
_subscriptions.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Call(ref T arg)
|
|
||||||
{
|
|
||||||
foreach (Handler subscription in Subscriptions)
|
|
||||||
subscription(ref arg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using Gommon;
|
using Gommon;
|
||||||
using Ryujinx.Common.Helper;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@@ -56,7 +55,7 @@ namespace Ryujinx.Common.Utilities
|
|||||||
{
|
{
|
||||||
_color = HsbToRgb((_color.GetHue() + Speed) / 360);
|
_color = HsbToRgb((_color.GetHue() + Speed) / 360);
|
||||||
|
|
||||||
_updatedHandler.Call(ref _color);
|
_updatedHandler.Call(_color.ToArgb());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,13 +67,13 @@ namespace Ryujinx.Common.Utilities
|
|||||||
_color = Color.Blue;
|
_color = Color.Blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static event RefEvent<Color>.Handler Updated
|
public static event Action<int> Updated
|
||||||
{
|
{
|
||||||
add => _updatedHandler.Add(value);
|
add => _updatedHandler.Add(value);
|
||||||
remove => _updatedHandler.Remove(value);
|
remove => _updatedHandler.Remove(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly RefEvent<Color> _updatedHandler = new();
|
private static readonly Event<int> _updatedHandler = new();
|
||||||
|
|
||||||
private static Color HsbToRgb(float hue, float saturation = 1, float brightness = 1)
|
private static Color HsbToRgb(float hue, float saturation = 1, float brightness = 1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ using Ryujinx.Common.Configuration.Hid;
|
|||||||
using Ryujinx.Common.Configuration.Hid.Controller;
|
using Ryujinx.Common.Configuration.Hid.Controller;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Common.Utilities;
|
using Ryujinx.Common.Utilities;
|
||||||
|
using Ryujinx.HLE.HOS.Services.Hid;
|
||||||
|
using SDL2;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
@@ -10,7 +12,7 @@ using static SDL2.SDL;
|
|||||||
|
|
||||||
namespace Ryujinx.Input.SDL2
|
namespace Ryujinx.Input.SDL2
|
||||||
{
|
{
|
||||||
public class SDL2Gamepad : IGamepad
|
class SDL2Gamepad : IGamepad
|
||||||
{
|
{
|
||||||
private bool HasConfiguration => _configuration != null;
|
private bool HasConfiguration => _configuration != null;
|
||||||
|
|
||||||
@@ -111,7 +113,7 @@ namespace Ryujinx.Input.SDL2
|
|||||||
byte blue = packedRgb > 0 ? (byte)(packedRgb % 256) : (byte)0;
|
byte blue = packedRgb > 0 ? (byte)(packedRgb % 256) : (byte)0;
|
||||||
|
|
||||||
if (SDL_GameControllerSetLED(_gamepadHandle, red, green, blue) != 0)
|
if (SDL_GameControllerSetLED(_gamepadHandle, red, green, blue) != 0)
|
||||||
Logger.Error?.Print(LogClass.Hid, "LED setting failed; probably in the middle of disconnecting.");
|
Logger.Error?.Print(LogClass.Hid, "LED is not supported on this game controller.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private GamepadFeaturesFlag GetFeaturesFlag()
|
private GamepadFeaturesFlag GetFeaturesFlag()
|
||||||
|
|||||||
13
src/Ryujinx/Assets/Styles/CheckboxMenuItemStyle.axaml
Normal file
13
src/Ryujinx/Assets/Styles/CheckboxMenuItemStyle.axaml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<Styles xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
<Style Selector="MenuItem.withCheckbox Viewbox#PART_IconPresenter">
|
||||||
|
<Setter Property="MaxHeight" Value="36" />
|
||||||
|
<Setter Property="MinHeight" Value="36" />
|
||||||
|
<Setter Property="MaxWidth" Value="36" />
|
||||||
|
<Setter Property="MinWidth" Value="36" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="MenuItem.withCheckbox ContentPresenter#PART_HeaderPresenter">
|
||||||
|
<Setter Property="Padding" Value="-10,0,0,0" />
|
||||||
|
</Style>
|
||||||
|
</Styles>
|
||||||
|
|
||||||
@@ -218,15 +218,6 @@
|
|||||||
<Setter Property="BorderBrush"
|
<Setter Property="BorderBrush"
|
||||||
Value="{DynamicResource ThemeControlBorderColor}" />
|
Value="{DynamicResource ThemeControlBorderColor}" />
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="MenuItem.withCheckbox Viewbox#PART_IconPresenter">
|
|
||||||
<Setter Property="MaxHeight" Value="36" />
|
|
||||||
<Setter Property="MinHeight" Value="36" />
|
|
||||||
<Setter Property="MaxWidth" Value="36" />
|
|
||||||
<Setter Property="MinWidth" Value="36" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="MenuItem.withCheckbox ContentPresenter#PART_HeaderPresenter">
|
|
||||||
<Setter Property="Padding" Value="-10,0,0,0" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="TabItem > ScrollViewer">
|
<Style Selector="TabItem > ScrollViewer">
|
||||||
<Setter Property="Background"
|
<Setter Property="Background"
|
||||||
Value="{DynamicResource ThemeBackgroundColor}" />
|
Value="{DynamicResource ThemeBackgroundColor}" />
|
||||||
|
|||||||
@@ -112,12 +112,8 @@ namespace Ryujinx.Ava
|
|||||||
// Hook unhandled exception and process exit events.
|
// Hook unhandled exception and process exit events.
|
||||||
AppDomain.CurrentDomain.UnhandledException += (sender, e)
|
AppDomain.CurrentDomain.UnhandledException += (sender, e)
|
||||||
=> ProcessUnhandledException(sender, e.ExceptionObject as Exception, e.IsTerminating);
|
=> ProcessUnhandledException(sender, e.ExceptionObject as Exception, e.IsTerminating);
|
||||||
TaskScheduler.UnobservedTaskException += (sender, e)
|
|
||||||
=> ProcessUnhandledException(sender, e.Exception, false);
|
|
||||||
AppDomain.CurrentDomain.ProcessExit += (_, _) => Exit();
|
AppDomain.CurrentDomain.ProcessExit += (_, _) => Exit();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Setup base data directory.
|
// Setup base data directory.
|
||||||
AppDataManager.Initialize(CommandLineState.BaseDirPathArg);
|
AppDataManager.Initialize(CommandLineState.BaseDirPathArg);
|
||||||
|
|
||||||
@@ -287,6 +283,8 @@ namespace Ryujinx.Ava
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (isTerminating)
|
if (isTerminating)
|
||||||
Exit();
|
Exit();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,11 +123,13 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</AvaloniaResource>
|
</AvaloniaResource>
|
||||||
<AvaloniaResource Include="Assets\Styles\Styles.xaml" />
|
<AvaloniaResource Include="Assets\Styles\Styles.xaml" />
|
||||||
|
<AvaloniaResource Include="Assets\Styles\CheckboxMenuItemStyle.axaml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="Assets\locales.json" />
|
<None Remove="Assets\locales.json" />
|
||||||
<None Remove="Assets\Styles\Themes.xaml" />
|
<None Remove="Assets\Styles\Themes.xaml" />
|
||||||
|
<None Remove="Assets\Styles\CheckboxMenuItemStyle.xaml" />
|
||||||
<None Remove="Assets\Icons\Controller_JoyConLeft.svg" />
|
<None Remove="Assets\Icons\Controller_JoyConLeft.svg" />
|
||||||
<None Remove="Assets\Icons\Controller_JoyConPair.svg" />
|
<None Remove="Assets\Icons\Controller_JoyConPair.svg" />
|
||||||
<None Remove="Assets\Icons\Controller_JoyConRight.svg" />
|
<None Remove="Assets\Icons\Controller_JoyConRight.svg" />
|
||||||
@@ -149,6 +151,7 @@
|
|||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Assets\locales.json" />
|
<EmbeddedResource Include="Assets\locales.json" />
|
||||||
<EmbeddedResource Include="Assets\Styles\Styles.xaml" />
|
<EmbeddedResource Include="Assets\Styles\Styles.xaml" />
|
||||||
|
<EmbeddedResource Include="Assets\Styles\CheckboxMenuItemStyle.axaml" />
|
||||||
<EmbeddedResource Include="Assets\Icons\Controller_JoyConLeft.svg" />
|
<EmbeddedResource Include="Assets\Icons\Controller_JoyConLeft.svg" />
|
||||||
<EmbeddedResource Include="Assets\Icons\Controller_JoyConPair.svg" />
|
<EmbeddedResource Include="Assets\Icons\Controller_JoyConPair.svg" />
|
||||||
<EmbeddedResource Include="Assets\Icons\Controller_JoyConRight.svg" />
|
<EmbeddedResource Include="Assets\Icons\Controller_JoyConRight.svg" />
|
||||||
|
|||||||
@@ -16,5 +16,6 @@
|
|||||||
<Application.Styles>
|
<Application.Styles>
|
||||||
<sty:FluentAvaloniaTheme PreferUserAccentColor="True" PreferSystemTheme="False" />
|
<sty:FluentAvaloniaTheme PreferUserAccentColor="True" PreferSystemTheme="False" />
|
||||||
<StyleInclude Source="/Assets/Styles/Styles.xaml" />
|
<StyleInclude Source="/Assets/Styles/Styles.xaml" />
|
||||||
|
<StyleInclude Source="/Assets/Styles/CheckboxMenuItemStyle.axaml"/>
|
||||||
</Application.Styles>
|
</Application.Styles>
|
||||||
</Application>
|
</Application>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using Ryujinx.Ava.UI.ViewModels;
|
using Ryujinx.Ava.UI.ViewModels;
|
||||||
using System.IO;
|
using System.Globalization;
|
||||||
|
|
||||||
namespace Ryujinx.Ava.UI.Models
|
namespace Ryujinx.Ava.UI.Models
|
||||||
{
|
{
|
||||||
@@ -21,6 +21,11 @@ namespace Ryujinx.Ava.UI.Models
|
|||||||
public string Path { get; }
|
public string Path { get; }
|
||||||
public string Name { get; }
|
public string Name { get; }
|
||||||
|
|
||||||
|
public string FormattedName =>
|
||||||
|
InSd && ulong.TryParse(Name, NumberStyles.HexNumber, null, out ulong applicationId)
|
||||||
|
? $"Atmosphère: {System.IO.Path.GetFileNameWithoutExtension(RyujinxApp.MainWindow.ApplicationLibrary.GetNameForApplicationId(applicationId))}"
|
||||||
|
: Name;
|
||||||
|
|
||||||
public ModModel(string path, string name, bool enabled, bool inSd)
|
public ModModel(string path, string name, bool enabled, bool inSd)
|
||||||
{
|
{
|
||||||
Path = path;
|
Path = path;
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
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.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.UI.Views.Input;
|
using Ryujinx.UI.Views.Input;
|
||||||
using System.Drawing;
|
|
||||||
|
|
||||||
namespace Ryujinx.Ava.UI.ViewModels.Input
|
namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||||
{
|
{
|
||||||
@@ -47,23 +48,6 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||||||
ParentModel = model;
|
ParentModel = model;
|
||||||
model.NotifyChangesEvent += OnParentModelChanged;
|
model.NotifyChangesEvent += OnParentModelChanged;
|
||||||
OnParentModelChanged();
|
OnParentModelChanged();
|
||||||
config.PropertyChanged += (_, args) =>
|
|
||||||
{
|
|
||||||
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());
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Rainbow.Reset();
|
|
||||||
|
|
||||||
if (Config.TurnOffLed)
|
|
||||||
ParentModel.SelectedGamepad.ClearLed();
|
|
||||||
else
|
|
||||||
ParentModel.SelectedGamepad.SetLed(Config.LedColor.ToUInt32());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Config = config;
|
Config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ using Ryujinx.Input;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Drawing;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
@@ -64,13 +63,7 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||||||
get => _selectedGamepad;
|
get => _selectedGamepad;
|
||||||
private set
|
private set
|
||||||
{
|
{
|
||||||
Rainbow.Reset();
|
|
||||||
|
|
||||||
_selectedGamepad = value;
|
_selectedGamepad = value;
|
||||||
|
|
||||||
if (ConfigViewModel is ControllerInputViewModel { Config.UseRainbowLed: true })
|
|
||||||
Rainbow.Updated += (ref Color color) => _selectedGamepad.SetLed((uint)color.ToArgb());
|
|
||||||
|
|
||||||
OnPropertiesChanged(nameof(HasLed), nameof(CanClearLed));
|
OnPropertiesChanged(nameof(HasLed), nameof(CanClearLed));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
using Gommon;
|
|
||||||
using Humanizer;
|
|
||||||
using Ryujinx.Ava.UI.Helpers;
|
using Ryujinx.Ava.UI.Helpers;
|
||||||
using Ryujinx.Ava.Utilities.Configuration;
|
|
||||||
using System;
|
|
||||||
using System.Globalization;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace Ryujinx.Ava.UI.ViewModels.Input
|
namespace Ryujinx.Ava.UI.ViewModels.Input
|
||||||
{
|
{
|
||||||
@@ -28,19 +22,6 @@ namespace Ryujinx.Ava.UI.ViewModels.Input
|
|||||||
[ObservableProperty] private bool _enableLedChanging;
|
[ObservableProperty] private bool _enableLedChanging;
|
||||||
[ObservableProperty] private Color _ledColor;
|
[ObservableProperty] private Color _ledColor;
|
||||||
|
|
||||||
public string RainbowSpeedText => RainbowSpeed.ToString(CultureInfo.CurrentCulture);
|
|
||||||
|
|
||||||
public float RainbowSpeed
|
|
||||||
{
|
|
||||||
get => ConfigurationState.Instance.Hid.RainbowSpeed;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
ConfigurationState.Instance.Hid.RainbowSpeed.Value = value;
|
|
||||||
OnPropertyChanged();
|
|
||||||
OnPropertyChanged(nameof(RainbowSpeedText));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool ShowLedColorPicker => !TurnOffLed && !UseRainbowLed;
|
public bool ShowLedColorPicker => !TurnOffLed && !UseRainbowLed;
|
||||||
|
|
||||||
private bool _turnOffLed;
|
private bool _turnOffLed;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
x:Class="Ryujinx.UI.Views.Input.LedInputView">
|
x:Class="Ryujinx.UI.Views.Input.LedInputView">
|
||||||
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
|
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
|
||||||
<StackPanel Orientation="Horizontal" IsVisible="{Binding ParentModel.CanClearLed}">
|
<StackPanel Orientation="Horizontal" IsVisible="{Binding ParentModel.CanClearLed}">
|
||||||
<TextBlock MinWidth="75" MaxWidth="200" Text="{ext:Locale ControllerSettingsLedColorDisable}" />
|
<TextBlock MinWidth="75" MaxWidth="150" Text="{ext:Locale ControllerSettingsLedColorDisable}" />
|
||||||
<CheckBox
|
<CheckBox
|
||||||
Margin="5"
|
Margin="5"
|
||||||
MinWidth="0"
|
MinWidth="0"
|
||||||
@@ -20,32 +20,15 @@
|
|||||||
</CheckBox>
|
</CheckBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Orientation="Horizontal" IsEnabled="{Binding !TurnOffLed}">
|
<StackPanel Orientation="Horizontal" IsEnabled="{Binding !TurnOffLed}">
|
||||||
<TextBlock MinWidth="75" MaxWidth="200" Text="{ext:Locale ControllerSettingsLedColorRainbow}" />
|
<TextBlock MinWidth="75" MaxWidth="150" Text="{ext:Locale ControllerSettingsLedColorRainbow}" />
|
||||||
<CheckBox
|
<CheckBox
|
||||||
Margin="5"
|
Margin="5"
|
||||||
MinWidth="0"
|
MinWidth="0"
|
||||||
IsChecked="{Binding UseRainbowLed, Mode=TwoWay}">
|
IsChecked="{Binding UseRainbowLed, Mode=TwoWay}">
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Orientation="Horizontal" IsEnabled="{Binding !TurnOffLed}">
|
|
||||||
<TextBlock MinWidth="75" MaxWidth="200" Text="Rainbow Speed" />
|
|
||||||
<Slider HorizontalAlignment="Center"
|
|
||||||
Value="{Binding RainbowSpeed}"
|
|
||||||
Width="175"
|
|
||||||
Margin="0,-3,0,0"
|
|
||||||
Height="32"
|
|
||||||
Padding="0,-5"
|
|
||||||
TickFrequency="0.25"
|
|
||||||
IsSnapToTickEnabled="True"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Minimum="1"
|
|
||||||
Maximum="10" />
|
|
||||||
<TextBlock Margin="5,0"
|
|
||||||
MinWidth="75"
|
|
||||||
Text="{Binding RainbowSpeed}"/>
|
|
||||||
</StackPanel>
|
|
||||||
<StackPanel Orientation="Horizontal" IsEnabled="{Binding ShowLedColorPicker}">
|
<StackPanel Orientation="Horizontal" IsEnabled="{Binding ShowLedColorPicker}">
|
||||||
<TextBlock MinWidth="75" MaxWidth="200" Text="{ext:Locale ControllerSettingsLedColor}" />
|
<TextBlock MinWidth="75" MaxWidth="150" Text="{ext:Locale ControllerSettingsLedColor}" />
|
||||||
<ui:ColorPickerButton
|
<ui:ColorPickerButton
|
||||||
Margin="5"
|
Margin="5"
|
||||||
IsMoreButtonVisible="False"
|
IsMoreButtonVisible="False"
|
||||||
|
|||||||
@@ -134,13 +134,8 @@ namespace Ryujinx.Ava.UI.Views.Main
|
|||||||
{
|
{
|
||||||
Window.SettingsWindow = new(Window.VirtualFileSystem, Window.ContentManager);
|
Window.SettingsWindow = new(Window.VirtualFileSystem, Window.ContentManager);
|
||||||
|
|
||||||
Rainbow.Enable();
|
|
||||||
|
|
||||||
await Window.SettingsWindow.ShowDialog(Window);
|
await Window.SettingsWindow.ShowDialog(Window);
|
||||||
|
|
||||||
Rainbow.Disable();
|
|
||||||
Rainbow.Reset();
|
|
||||||
|
|
||||||
Window.SettingsWindow = null;
|
Window.SettingsWindow = null;
|
||||||
|
|
||||||
ViewModel.LoadConfigurableHotKeys();
|
ViewModel.LoadConfigurableHotKeys();
|
||||||
|
|||||||
@@ -81,7 +81,7 @@
|
|||||||
MaxLines="2"
|
MaxLines="2"
|
||||||
TextWrapping="Wrap"
|
TextWrapping="Wrap"
|
||||||
TextTrimming="CharacterEllipsis"
|
TextTrimming="CharacterEllipsis"
|
||||||
Text="{Binding Name}" />
|
Text="{Binding FormattedName}" />
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Spacing="10"
|
Spacing="10"
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ namespace Ryujinx.Ava.UI.Windows
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
this.AttachDevTools(new KeyGesture(Key.F12, KeyModifiers.Alt));
|
this.AttachDevTools(new KeyGesture(Key.F12, KeyModifiers.Alt));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SettingsWindow()
|
public SettingsWindow()
|
||||||
|
|||||||
@@ -111,6 +111,30 @@ namespace Ryujinx.Ava.Utilities.AppLibrary
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a name for an available content file based on the Application ID '<paramref name="id"/>'.
|
||||||
|
/// <br/><br/>
|
||||||
|
/// For Applications, this returns the localized name of the app found in the file.
|
||||||
|
/// For DLCs, this returns the name of the file that contains the DLC, minus the file extension.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The Application ID to search for.</param>
|
||||||
|
/// <remarks>
|
||||||
|
/// If the provided Application ID does not have a corresponding Application OR DLC file,
|
||||||
|
/// <paramref name="id"/> formatted as hexadecimal is returned.
|
||||||
|
/// </remarks>
|
||||||
|
/// <returns>A formatted Application name, or <paramref name="id"/> as hexadecimal if none is found.</returns>
|
||||||
|
public string GetNameForApplicationId(ulong id)
|
||||||
|
{
|
||||||
|
DynamicData.Kernel.Optional<ApplicationData> appData = Applications.Lookup(id);
|
||||||
|
if (appData.HasValue)
|
||||||
|
return appData.Value.Name;
|
||||||
|
|
||||||
|
if (DownloadableContents.Keys.FindFirst(x => x.TitleId == id).TryGet(out DownloadableContentModel dlcData))
|
||||||
|
return dlcData.FileName;
|
||||||
|
|
||||||
|
return id.ToString("X16");
|
||||||
|
}
|
||||||
|
|
||||||
/// <exception cref="LibHac.Common.Keys.MissingKeyException">The configured key set is missing a key.</exception>
|
/// <exception cref="LibHac.Common.Keys.MissingKeyException">The configured key set is missing a key.</exception>
|
||||||
/// <exception cref="InvalidDataException">The NCA header could not be decrypted.</exception>
|
/// <exception cref="InvalidDataException">The NCA header could not be decrypted.</exception>
|
||||||
/// <exception cref="NotSupportedException">The NCA version is not supported.</exception>
|
/// <exception cref="NotSupportedException">The NCA version is not supported.</exception>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Ryujinx.Ava.Utilities.Configuration.System;
|
using Ryujinx.Ava.Utilities.Configuration.System;
|
||||||
using Ryujinx.Ava.Utilities.Configuration.UI;
|
using Ryujinx.Ava.Utilities.Configuration.UI;
|
||||||
|
using Ryujinx.Common;
|
||||||
using Ryujinx.Common.Configuration;
|
using Ryujinx.Common.Configuration;
|
||||||
using Ryujinx.Common.Configuration.Hid;
|
using Ryujinx.Common.Configuration.Hid;
|
||||||
using Ryujinx.Common.Configuration.Multiplayer;
|
using Ryujinx.Common.Configuration.Multiplayer;
|
||||||
@@ -7,6 +8,7 @@ using Ryujinx.Common.Logging;
|
|||||||
using Ryujinx.Common.Utilities;
|
using Ryujinx.Common.Utilities;
|
||||||
using Ryujinx.HLE;
|
using Ryujinx.HLE;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Text.Json.Nodes;
|
||||||
|
|
||||||
namespace Ryujinx.Ava.Utilities.Configuration
|
namespace Ryujinx.Ava.Utilities.Configuration
|
||||||
{
|
{
|
||||||
@@ -15,7 +17,7 @@ namespace Ryujinx.Ava.Utilities.Configuration
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current version of the file format
|
/// The current version of the file format
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const int CurrentVersion = 62;
|
public const int CurrentVersion = 61;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Version of the configuration file format
|
/// Version of the configuration file format
|
||||||
@@ -374,16 +376,25 @@ namespace Ryujinx.Ava.Utilities.Configuration
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public KeyboardHotkeys Hotkeys { get; set; }
|
public KeyboardHotkeys Hotkeys { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Legacy keyboard control bindings
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Kept for file format compatibility (to avoid possible failure when parsing configuration on old versions)</remarks>
|
||||||
|
/// TODO: Remove this when those older versions aren't in use anymore.
|
||||||
|
public List<JsonObject> KeyboardConfig { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Legacy controller control bindings
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Kept for file format compatibility (to avoid possible failure when parsing configuration on old versions)</remarks>
|
||||||
|
/// TODO: Remove this when those older versions aren't in use anymore.
|
||||||
|
public List<JsonObject> ControllerConfig { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Input configurations
|
/// Input configurations
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<InputConfig> InputConfig { get; set; }
|
public List<InputConfig> InputConfig { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The speed of spectrum cycling for the Rainbow LED feature.
|
|
||||||
/// </summary>
|
|
||||||
public float RainbowSpeed { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Graphics backend
|
/// Graphics backend
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -140,7 +140,6 @@ namespace Ryujinx.Ava.Utilities.Configuration
|
|||||||
Hid.EnableMouse.Value = cff.EnableMouse;
|
Hid.EnableMouse.Value = cff.EnableMouse;
|
||||||
Hid.Hotkeys.Value = cff.Hotkeys;
|
Hid.Hotkeys.Value = cff.Hotkeys;
|
||||||
Hid.InputConfig.Value = cff.InputConfig ?? [];
|
Hid.InputConfig.Value = cff.InputConfig ?? [];
|
||||||
Hid.RainbowSpeed.Value = cff.RainbowSpeed;
|
|
||||||
|
|
||||||
Multiplayer.LanInterfaceId.Value = cff.MultiplayerLanInterfaceId;
|
Multiplayer.LanInterfaceId.Value = cff.MultiplayerLanInterfaceId;
|
||||||
Multiplayer.Mode.Value = cff.MultiplayerMode;
|
Multiplayer.Mode.Value = cff.MultiplayerMode;
|
||||||
@@ -428,8 +427,7 @@ namespace Ryujinx.Ava.Utilities.Configuration
|
|||||||
LedColor = new Color(255, 5, 1, 253).ToUInt32()
|
LedColor = new Color(255, 5, 1, 253).ToUInt32()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}),
|
})
|
||||||
(62, static cff => cff.RainbowSpeed = 1f)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ using Ryujinx.Common.Configuration.Hid;
|
|||||||
using Ryujinx.Common.Configuration.Multiplayer;
|
using Ryujinx.Common.Configuration.Multiplayer;
|
||||||
using Ryujinx.Common.Helper;
|
using Ryujinx.Common.Helper;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Common.Utilities;
|
|
||||||
using Ryujinx.HLE;
|
using Ryujinx.HLE;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -446,19 +445,12 @@ namespace Ryujinx.Ava.Utilities.Configuration
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ReactiveObject<List<InputConfig>> InputConfig { get; private set; }
|
public ReactiveObject<List<InputConfig>> InputConfig { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The speed of spectrum cycling for the Rainbow LED feature.
|
|
||||||
/// </summary>
|
|
||||||
public ReactiveObject<float> RainbowSpeed { get; }
|
|
||||||
|
|
||||||
public HidSection()
|
public HidSection()
|
||||||
{
|
{
|
||||||
EnableKeyboard = new ReactiveObject<bool>();
|
EnableKeyboard = new ReactiveObject<bool>();
|
||||||
EnableMouse = new ReactiveObject<bool>();
|
EnableMouse = new ReactiveObject<bool>();
|
||||||
Hotkeys = new ReactiveObject<KeyboardHotkeys>();
|
Hotkeys = new ReactiveObject<KeyboardHotkeys>();
|
||||||
InputConfig = new ReactiveObject<List<InputConfig>>();
|
InputConfig = new ReactiveObject<List<InputConfig>>();
|
||||||
RainbowSpeed = new ReactiveObject<float>();
|
|
||||||
RainbowSpeed.Event += (_, args) => Rainbow.Speed = args.NewValue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -130,8 +130,9 @@ namespace Ryujinx.Ava.Utilities.Configuration
|
|||||||
EnableKeyboard = Hid.EnableKeyboard,
|
EnableKeyboard = Hid.EnableKeyboard,
|
||||||
EnableMouse = Hid.EnableMouse,
|
EnableMouse = Hid.EnableMouse,
|
||||||
Hotkeys = Hid.Hotkeys,
|
Hotkeys = Hid.Hotkeys,
|
||||||
|
KeyboardConfig = [],
|
||||||
|
ControllerConfig = [],
|
||||||
InputConfig = Hid.InputConfig,
|
InputConfig = Hid.InputConfig,
|
||||||
RainbowSpeed = Hid.RainbowSpeed,
|
|
||||||
GraphicsBackend = Graphics.GraphicsBackend,
|
GraphicsBackend = Graphics.GraphicsBackend,
|
||||||
PreferredGpu = Graphics.PreferredGpu,
|
PreferredGpu = Graphics.PreferredGpu,
|
||||||
MultiplayerLanInterfaceId = Multiplayer.LanInterfaceId,
|
MultiplayerLanInterfaceId = Multiplayer.LanInterfaceId,
|
||||||
@@ -254,7 +255,6 @@ namespace Ryujinx.Ava.Utilities.Configuration
|
|||||||
VolumeUp = Key.Unbound,
|
VolumeUp = Key.Unbound,
|
||||||
VolumeDown = Key.Unbound,
|
VolumeDown = Key.Unbound,
|
||||||
};
|
};
|
||||||
Hid.RainbowSpeed.Value = 1f;
|
|
||||||
Hid.InputConfig.Value =
|
Hid.InputConfig.Value =
|
||||||
[
|
[
|
||||||
new StandardKeyboardInputConfig
|
new StandardKeyboardInputConfig
|
||||||
|
|||||||
Reference in New Issue
Block a user