aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Ava/UI/Windows
diff options
context:
space:
mode:
authorTSR Berry <20988865+TSRBerry@users.noreply.github.com>2023-04-08 01:22:00 +0200
committerMary <thog@protonmail.com>2023-04-27 23:51:14 +0200
commitcee712105850ac3385cd0091a923438167433f9f (patch)
tree4a5274b21d8b7f938c0d0ce18736d3f2993b11b1 /src/Ryujinx.Ava/UI/Windows
parentcd124bda587ef09668a971fa1cac1c3f0cfc9f21 (diff)
Move solution and projects to src
Diffstat (limited to 'src/Ryujinx.Ava/UI/Windows')
-rw-r--r--src/Ryujinx.Ava/UI/Windows/AboutWindow.axaml247
-rw-r--r--src/Ryujinx.Ava/UI/Windows/AboutWindow.axaml.cs62
-rw-r--r--src/Ryujinx.Ava/UI/Windows/AmiiboWindow.axaml74
-rw-r--r--src/Ryujinx.Ava/UI/Windows/AmiiboWindow.axaml.cs59
-rw-r--r--src/Ryujinx.Ava/UI/Windows/CheatWindow.axaml106
-rw-r--r--src/Ryujinx.Ava/UI/Windows/CheatWindow.axaml.cs119
-rw-r--r--src/Ryujinx.Ava/UI/Windows/ContentDialogOverlayWindow.axaml25
-rw-r--r--src/Ryujinx.Ava/UI/Windows/ContentDialogOverlayWindow.axaml.cs25
-rw-r--r--src/Ryujinx.Ava/UI/Windows/ControllerSettingsWindow.axaml1169
-rw-r--r--src/Ryujinx.Ava/UI/Windows/ControllerSettingsWindow.axaml.cs181
-rw-r--r--src/Ryujinx.Ava/UI/Windows/DownloadableContentManagerWindow.axaml194
-rw-r--r--src/Ryujinx.Ava/UI/Windows/DownloadableContentManagerWindow.axaml.cs115
-rw-r--r--src/Ryujinx.Ava/UI/Windows/IconColorPicker.cs192
-rw-r--r--src/Ryujinx.Ava/UI/Windows/MainWindow.axaml206
-rw-r--r--src/Ryujinx.Ava/UI/Windows/MainWindow.axaml.cs441
-rw-r--r--src/Ryujinx.Ava/UI/Windows/MotionSettingsWindow.axaml141
-rw-r--r--src/Ryujinx.Ava/UI/Windows/MotionSettingsWindow.axaml.cs71
-rw-r--r--src/Ryujinx.Ava/UI/Windows/RumbleSettingsWindow.axaml57
-rw-r--r--src/Ryujinx.Ava/UI/Windows/RumbleSettingsWindow.axaml.cs57
-rw-r--r--src/Ryujinx.Ava/UI/Windows/SettingsWindow.axaml128
-rw-r--r--src/Ryujinx.Ava/UI/Windows/SettingsWindow.axaml.cs103
-rw-r--r--src/Ryujinx.Ava/UI/Windows/StyleableWindow.cs39
-rw-r--r--src/Ryujinx.Ava/UI/Windows/TitleUpdateWindow.axaml135
-rw-r--r--src/Ryujinx.Ava/UI/Windows/TitleUpdateWindow.axaml.cs96
24 files changed, 4042 insertions, 0 deletions
diff --git a/src/Ryujinx.Ava/UI/Windows/AboutWindow.axaml b/src/Ryujinx.Ava/UI/Windows/AboutWindow.axaml
new file mode 100644
index 00000000..7bd3e20d
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Windows/AboutWindow.axaml
@@ -0,0 +1,247 @@
+<UserControl
+ x:Class="Ryujinx.Ava.UI.Windows.AboutWindow"
+ xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:flex="clr-namespace:Avalonia.Flexbox;assembly=Avalonia.Flexbox"
+ xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
+ xmlns:viewModel="clr-namespace:Ryujinx.Ava.UI.ViewModels"
+ Width="550"
+ Height="260"
+ Margin="0,-12,0,0"
+ d:DesignHeight="260"
+ d:DesignWidth="550"
+ x:CompileBindings="True"
+ x:DataType="viewModel:AboutWindowViewModel"
+ Focusable="True"
+ mc:Ignorable="d">
+ <Design.DataContext>
+ <viewModel:AboutWindowViewModel />
+ </Design.DataContext>
+ <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <Grid
+ Grid.Column="0"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <StackPanel
+ Grid.Row="0"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch"
+ Spacing="10">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+ <Image
+ Grid.Column="0"
+ Height="80"
+ Source="resm:Ryujinx.Ui.Common.Resources.Logo_Ryujinx.png?assembly=Ryujinx.Ui.Common" />
+ <flex:FlexPanel
+ Grid.Column="2"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch"
+ Direction="Column"
+ JustifyContent="SpaceAround"
+ RowSpacing="2">
+ <TextBlock
+ FontSize="28"
+ FontWeight="Bold"
+ Text="Ryujinx"
+ TextAlignment="Left" />
+ <TextBlock Text="(REE-YOU-JINX)" TextAlignment="Left" />
+ </flex:FlexPanel>
+ </Grid>
+ <TextBlock
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ FontSize="10"
+ LineHeight="12"
+ Text="{Binding Version}"
+ TextAlignment="Center" />
+ </StackPanel>
+ <StackPanel
+ Grid.Row="2"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch"
+ Spacing="10">
+ <TextBlock
+ Width="200"
+ HorizontalAlignment="Center"
+ FontSize="10"
+ LineHeight="12"
+ Text="{locale:Locale AboutDisclaimerMessage}"
+ TextAlignment="Center"
+ TextWrapping="Wrap" />
+ <TextBlock
+ Name="AmiiboLabel"
+ Width="200"
+ HorizontalAlignment="Center"
+ FontSize="10"
+ LineHeight="12"
+ PointerPressed="AmiiboLabel_OnPointerPressed"
+ Text="{locale:Locale AboutAmiiboDisclaimerMessage}"
+ TextAlignment="Center"
+ TextWrapping="Wrap" />
+ <StackPanel
+ HorizontalAlignment="Center"
+ Orientation="Horizontal"
+ Spacing="10">
+ <Button
+ MinWidth="30"
+ MinHeight="30"
+ MaxWidth="30"
+ MaxHeight="30"
+ Padding="8"
+ Background="Transparent"
+ Click="Button_OnClick"
+ CornerRadius="15"
+ Tag="https://www.patreon.com/ryujinx"
+ ToolTip.Tip="{locale:Locale AboutPatreonUrlTooltipMessage}">
+ <Image Source="{Binding PatreonLogo}" />
+ </Button>
+ <Button
+ MinWidth="30"
+ MinHeight="30"
+ MaxWidth="30"
+ MaxHeight="30"
+ Padding="8"
+ Background="Transparent"
+ Click="Button_OnClick"
+ CornerRadius="15"
+ Tag="https://github.com/Ryujinx/Ryujinx"
+ ToolTip.Tip="{locale:Locale AboutGithubUrlTooltipMessage}">
+ <Image Source="{Binding GithubLogo}" />
+ </Button>
+ <Button
+ MinWidth="30"
+ MinHeight="30"
+ MaxWidth="30"
+ MaxHeight="30"
+ Padding="8"
+ Background="Transparent"
+ Click="Button_OnClick"
+ CornerRadius="15"
+ Tag="https://discordapp.com/invite/N2FmfVc"
+ ToolTip.Tip="{locale:Locale AboutDiscordUrlTooltipMessage}">
+ <Image Source="{Binding DiscordLogo}" />
+ </Button>
+ <Button
+ MinWidth="30"
+ MinHeight="30"
+ MaxWidth="30"
+ MaxHeight="30"
+ Padding="8"
+ Background="Transparent"
+ Click="Button_OnClick"
+ CornerRadius="15"
+ Tag="https://twitter.com/RyujinxEmu"
+ ToolTip.Tip="{locale:Locale AboutTwitterUrlTooltipMessage}">
+ <Image Source="{Binding TwitterLogo}" />
+ </Button>
+ <Button
+ MinWidth="30"
+ MinHeight="30"
+ MaxWidth="30"
+ MaxHeight="30"
+ Padding="8"
+ Background="Transparent"
+ Click="Button_OnClick"
+ CornerRadius="15"
+ Tag="https://www.ryujinx.org"
+ ToolTip.Tip="{locale:Locale AboutUrlTooltipMessage}">
+ <ui:SymbolIcon Foreground="{DynamicResource ThemeForegroundColor}" Symbol="Link" />
+ </Button>
+ </StackPanel>
+ </StackPanel>
+ </Grid>
+ <Border
+ Grid.Column="1"
+ Width="1"
+ Margin="20,0"
+ VerticalAlignment="Stretch"
+ BorderBrush="{DynamicResource ThemeControlBorderColor}"
+ BorderThickness="1,0,0,0" />
+ <Grid
+ Grid.Column="2"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <StackPanel
+ Grid.Row="0"
+ Margin="0,10,0,0"
+ Spacing="2">
+ <TextBlock
+ FontSize="15"
+ FontWeight="Bold"
+ Text="{locale:Locale AboutRyujinxAboutTitle}" />
+ <TextBlock
+ FontSize="10"
+ Text="{locale:Locale AboutRyujinxAboutContent}"
+ TextWrapping="Wrap" />
+ </StackPanel>
+ <StackPanel
+ Grid.Row="1"
+ Margin="0,10,0,0"
+ Spacing="2">
+ <TextBlock
+ FontSize="15"
+ FontWeight="Bold"
+ Text="{locale:Locale AboutRyujinxMaintainersTitle}" />
+ <TextBlock
+ FontSize="10"
+ Text="{Binding Developers}"
+ TextWrapping="Wrap" />
+ <Button
+ Padding="5"
+ HorizontalAlignment="Left"
+ Background="Transparent"
+ Click="Button_OnClick"
+ Tag="https://github.com/Ryujinx/Ryujinx/graphs/contributors?type=a">
+ <TextBlock
+ FontSize="10"
+ Text="{locale:Locale AboutRyujinxContributorsButtonHeader}"
+ TextAlignment="Right"
+ ToolTip.Tip="{locale:Locale AboutRyujinxMaintainersContentTooltipMessage}" />
+ </Button>
+ </StackPanel>
+ <StackPanel
+ Grid.Row="2"
+ Margin="0,10,0,0"
+ Spacing="2">
+ <TextBlock
+ FontSize="15"
+ FontWeight="Bold"
+ Text="{locale:Locale AboutRyujinxSupprtersTitle}" />
+ <ScrollViewer
+ Height="70"
+ HorizontalScrollBarVisibility="Disabled"
+ VerticalScrollBarVisibility="Visible">
+ <TextBlock
+ Name="SupportersTextBlock"
+ VerticalAlignment="Top"
+ FontSize="10"
+ Text="{Binding Supporters}"
+ TextWrapping="Wrap" />
+ </ScrollViewer>
+ </StackPanel>
+ </Grid>
+ </Grid>
+</UserControl> \ No newline at end of file
diff --git a/src/Ryujinx.Ava/UI/Windows/AboutWindow.axaml.cs b/src/Ryujinx.Ava/UI/Windows/AboutWindow.axaml.cs
new file mode 100644
index 00000000..36a28605
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Windows/AboutWindow.axaml.cs
@@ -0,0 +1,62 @@
+using Avalonia.Controls;
+using Avalonia.Input;
+using Avalonia.Interactivity;
+using Avalonia.Styling;
+using FluentAvalonia.UI.Controls;
+using Ryujinx.Ava.Common.Locale;
+using Ryujinx.Ava.UI.Helpers;
+using Ryujinx.Ava.UI.ViewModels;
+using Ryujinx.Ui.Common.Helper;
+using System.Threading.Tasks;
+using Button = Avalonia.Controls.Button;
+
+namespace Ryujinx.Ava.UI.Windows
+{
+ public partial class AboutWindow : UserControl
+ {
+ public AboutWindow()
+ {
+ DataContext = new AboutWindowViewModel();
+
+ InitializeComponent();
+ }
+
+ public static async Task Show()
+ {
+ ContentDialog contentDialog = new()
+ {
+ PrimaryButtonText = "",
+ SecondaryButtonText = "",
+ CloseButtonText = LocaleManager.Instance[LocaleKeys.UserProfilesClose],
+ Content = new AboutWindow()
+ };
+
+ Style closeButton = new(x => x.Name("CloseButton"));
+ closeButton.Setters.Add(new Setter(WidthProperty, 80d));
+
+ Style closeButtonParent = new(x => x.Name("CommandSpace"));
+ closeButtonParent.Setters.Add(new Setter(HorizontalAlignmentProperty, Avalonia.Layout.HorizontalAlignment.Right));
+
+ contentDialog.Styles.Add(closeButton);
+ contentDialog.Styles.Add(closeButtonParent);
+
+ await ContentDialogHelper.ShowAsync(contentDialog);
+ }
+
+ private void Button_OnClick(object sender, RoutedEventArgs e)
+ {
+ if (sender is Button button)
+ {
+ OpenHelper.OpenUrl(button.Tag.ToString());
+ }
+ }
+
+ private void AmiiboLabel_OnPointerPressed(object sender, PointerPressedEventArgs e)
+ {
+ if (sender is TextBlock)
+ {
+ OpenHelper.OpenUrl("https://amiiboapi.com");
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/Ryujinx.Ava/UI/Windows/AmiiboWindow.axaml b/src/Ryujinx.Ava/UI/Windows/AmiiboWindow.axaml
new file mode 100644
index 00000000..90d47b8e
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Windows/AmiiboWindow.axaml
@@ -0,0 +1,74 @@
+<window:StyleableWindow
+ xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:window="clr-namespace:Ryujinx.Ava.UI.Windows"
+ xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
+ xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
+ mc:Ignorable="d"
+ d:DesignWidth="400"
+ d:DesignHeight="350"
+ x:Class="Ryujinx.Ava.UI.Windows.AmiiboWindow"
+ CanResize="False"
+ WindowStartupLocation="CenterOwner"
+ Width="800"
+ MinHeight="650"
+ Height="650"
+ SizeToContent="Manual"
+ MinWidth="600"
+ Focusable="True">
+ <Design.DataContext>
+ <viewModels:AmiiboWindowViewModel />
+ </Design.DataContext>
+ <Grid Margin="15" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <Grid Grid.Row="1" HorizontalAlignment="Stretch">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition />
+ <ColumnDefinition />
+ </Grid.ColumnDefinitions>
+ <StackPanel Spacing="10" Orientation="Horizontal" HorizontalAlignment="Left">
+ <TextBlock VerticalAlignment="Center" Text="{locale:Locale AmiiboSeriesLabel}" />
+ <ComboBox SelectedIndex="{Binding SeriesSelectedIndex}" Items="{Binding AmiiboSeries}" MinWidth="100" />
+ </StackPanel>
+ <StackPanel Spacing="10" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
+ <TextBlock VerticalAlignment="Center" Text="{locale:Locale AmiiboCharacterLabel}" />
+ <ComboBox SelectedIndex="{Binding AmiiboSelectedIndex}" MinWidth="100" Items="{Binding AmiiboList}" />
+ </StackPanel>
+ </Grid>
+ <StackPanel Margin="20" Grid.Row="2">
+ <Image Source="{Binding AmiiboImage}" Height="350" Width="350" HorizontalAlignment="Center" />
+ <ScrollViewer MaxHeight="120" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"
+ Margin="20" VerticalAlignment="Top" HorizontalAlignment="Stretch">
+ <TextBlock TextWrapping="Wrap" Text="{Binding Usage}" HorizontalAlignment="Center"
+ TextAlignment="Center" />
+ </ScrollViewer>
+ </StackPanel>
+ <Grid Grid.Row="3">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+ <CheckBox Margin="10" Grid.Column="0" VerticalContentAlignment="Center" IsChecked="{Binding ShowAllAmiibo}"
+ Content="{locale:Locale AmiiboOptionsShowAllLabel}" />
+ <CheckBox Margin="10" VerticalContentAlignment="Center" Grid.Column="1" IsChecked="{Binding UseRandomUuid}"
+ Content="{locale:Locale AmiiboOptionsUsRandomTagLabel}" />
+
+ <Button Grid.Column="3" IsEnabled="{Binding EnableScanning}" Width="80"
+ Content="{locale:Locale AmiiboScanButtonLabel}" Name="ScanButton"
+ Click="ScanButton_Click" />
+ <Button Grid.Column="4" Margin="10,0" Width="80" Content="{locale:Locale InputDialogCancel}"
+ Name="CancelButton"
+ Click="CancelButton_Click" />
+ </Grid>
+ </Grid>
+</window:StyleableWindow> \ No newline at end of file
diff --git a/src/Ryujinx.Ava/UI/Windows/AmiiboWindow.axaml.cs b/src/Ryujinx.Ava/UI/Windows/AmiiboWindow.axaml.cs
new file mode 100644
index 00000000..206d0a7e
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Windows/AmiiboWindow.axaml.cs
@@ -0,0 +1,59 @@
+using Avalonia.Interactivity;
+using Ryujinx.Ava.Common.Locale;
+using Ryujinx.Ava.UI.ViewModels;
+using Ryujinx.Ui.Common.Models.Amiibo;
+
+namespace Ryujinx.Ava.UI.Windows
+{
+ public partial class AmiiboWindow : StyleableWindow
+ {
+ public AmiiboWindow(bool showAll, string lastScannedAmiiboId, string titleId)
+ {
+ ViewModel = new AmiiboWindowViewModel(this, lastScannedAmiiboId, titleId);
+
+ ViewModel.ShowAllAmiibo = showAll;
+
+ DataContext = ViewModel;
+
+ InitializeComponent();
+
+ Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance[LocaleKeys.Amiibo];
+ }
+
+ public AmiiboWindow()
+ {
+ ViewModel = new AmiiboWindowViewModel(this, string.Empty, string.Empty);
+
+ DataContext = ViewModel;
+
+ InitializeComponent();
+
+ if (Program.PreviewerDetached)
+ {
+ Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance[LocaleKeys.Amiibo];
+ }
+ }
+
+ public bool IsScanned { get; set; }
+ public AmiiboApi ScannedAmiibo { get; set; }
+ public AmiiboWindowViewModel ViewModel { get; set; }
+
+ private void ScanButton_Click(object sender, RoutedEventArgs e)
+ {
+ if (ViewModel.AmiiboSelectedIndex > -1)
+ {
+ AmiiboApi amiibo = ViewModel.AmiiboList[ViewModel.AmiiboSelectedIndex];
+ ScannedAmiibo = amiibo;
+ IsScanned = true;
+ Close();
+ }
+ }
+
+ private void CancelButton_Click(object sender, RoutedEventArgs e)
+ {
+ IsScanned = false;
+
+ Close();
+ }
+ }
+} \ No newline at end of file
diff --git a/src/Ryujinx.Ava/UI/Windows/CheatWindow.axaml b/src/Ryujinx.Ava/UI/Windows/CheatWindow.axaml
new file mode 100644
index 00000000..3557ed69
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Windows/CheatWindow.axaml
@@ -0,0 +1,106 @@
+<window:StyleableWindow
+ x:Class="Ryujinx.Ava.UI.Windows.CheatWindow"
+ xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:model="clr-namespace:Ryujinx.Ava.UI.Models"
+ xmlns:window="clr-namespace:Ryujinx.Ava.UI.Windows"
+ Width="500"
+ Height="500"
+ MinWidth="500"
+ MinHeight="500"
+ WindowStartupLocation="CenterOwner"
+ mc:Ignorable="d"
+ Focusable="True">
+ <Window.Styles>
+ <Style Selector="TreeViewItem">
+ <Setter Property="IsExpanded" Value="True" />
+ </Style>
+ </Window.Styles>
+ <Grid Name="CheatGrid" Margin="15">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <TextBlock
+ Grid.Row="1"
+ MaxWidth="500"
+ Margin="20,15,20,20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ LineHeight="18"
+ Text="{Binding Heading}"
+ TextAlignment="Center"
+ TextWrapping="Wrap" />
+ <Border
+ Grid.Row="2"
+ Margin="5"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch"
+ BorderBrush="Gray"
+ BorderThickness="1">
+ <TreeView
+ Name="CheatsView"
+ MinHeight="300"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch"
+ Items="{Binding LoadedCheats}">
+ <TreeView.Styles>
+ <Styles>
+ <Style Selector="TreeViewItem:empty /template/ ItemsPresenter">
+ <Setter Property="IsVisible" Value="False" />
+ </Style>
+ </Styles>
+ </TreeView.Styles>
+ <TreeView.DataTemplates>
+ <TreeDataTemplate DataType="model:CheatsList" ItemsSource="{Binding}">
+ <StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
+ <CheckBox MinWidth="20" IsChecked="{Binding IsEnabled}" />
+ <TextBlock Width="150" Text="{Binding BuildId}" />
+ <TextBlock Text="{Binding Path}" />
+ </StackPanel>
+ </TreeDataTemplate>
+ <DataTemplate x:DataType="model:CheatModel">
+ <StackPanel
+ Margin="0"
+ HorizontalAlignment="Left"
+ Orientation="Horizontal">
+ <CheckBox
+ MinWidth="20"
+ Margin="5,0"
+ Padding="0"
+ IsChecked="{Binding IsEnabled}" />
+ <TextBlock VerticalAlignment="Center" Text="{Binding CleanName}" />
+ </StackPanel>
+ </DataTemplate>
+ </TreeView.DataTemplates>
+ </TreeView>
+ </Border>
+ <DockPanel
+ Grid.Row="3"
+ Margin="0"
+ HorizontalAlignment="Stretch">
+ <DockPanel Margin="0" HorizontalAlignment="Right">
+ <Button
+ Name="SaveButton"
+ MinWidth="90"
+ Margin="5"
+ Command="{Binding Save}"
+ IsVisible="{Binding !NoCheatsFound}">
+ <TextBlock Text="{locale:Locale SettingsButtonSave}" />
+ </Button>
+ <Button
+ Name="CancelButton"
+ MinWidth="90"
+ Margin="5"
+ Command="{Binding Close}">
+ <TextBlock Text="{locale:Locale InputDialogCancel}" />
+ </Button>
+ </DockPanel>
+ </DockPanel>
+ </Grid>
+</window:StyleableWindow> \ No newline at end of file
diff --git a/src/Ryujinx.Ava/UI/Windows/CheatWindow.axaml.cs b/src/Ryujinx.Ava/UI/Windows/CheatWindow.axaml.cs
new file mode 100644
index 00000000..cb939763
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Windows/CheatWindow.axaml.cs
@@ -0,0 +1,119 @@
+using Avalonia.Collections;
+using Ryujinx.Ava.Common.Locale;
+using Ryujinx.Ava.UI.Models;
+using Ryujinx.HLE.FileSystem;
+using Ryujinx.HLE.HOS;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace Ryujinx.Ava.UI.Windows
+{
+ public partial class CheatWindow : StyleableWindow
+ {
+ private readonly string _enabledCheatsPath;
+ public bool NoCheatsFound { get; }
+
+ private AvaloniaList<CheatsList> LoadedCheats { get; }
+
+ public string Heading { get; }
+
+ public CheatWindow()
+ {
+ DataContext = this;
+
+ InitializeComponent();
+
+ Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance[LocaleKeys.CheatWindowTitle];
+ }
+
+ public CheatWindow(VirtualFileSystem virtualFileSystem, string titleId, string titleName)
+ {
+ LoadedCheats = new AvaloniaList<CheatsList>();
+
+ Heading = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.CheatWindowHeading, titleName, titleId.ToUpper());
+
+ InitializeComponent();
+
+ string modsBasePath = virtualFileSystem.ModLoader.GetModsBasePath();
+ string titleModsPath = virtualFileSystem.ModLoader.GetTitleDir(modsBasePath, titleId);
+ ulong titleIdValue = ulong.Parse(titleId, System.Globalization.NumberStyles.HexNumber);
+
+ _enabledCheatsPath = Path.Combine(titleModsPath, "cheats", "enabled.txt");
+
+ string[] enabled = { };
+
+ if (File.Exists(_enabledCheatsPath))
+ {
+ enabled = File.ReadAllLines(_enabledCheatsPath);
+ }
+
+ int cheatAdded = 0;
+
+ var mods = new ModLoader.ModCache();
+
+ ModLoader.QueryContentsDir(mods, new DirectoryInfo(Path.Combine(modsBasePath, "contents")), titleIdValue);
+
+ string currentCheatFile = string.Empty;
+ string buildId = string.Empty;
+ string parentPath = string.Empty;
+
+ CheatsList currentGroup = null;
+
+ foreach (var cheat in mods.Cheats)
+ {
+ if (cheat.Path.FullName != currentCheatFile)
+ {
+ currentCheatFile = cheat.Path.FullName;
+ parentPath = currentCheatFile.Replace(titleModsPath, "");
+
+ buildId = Path.GetFileNameWithoutExtension(currentCheatFile).ToUpper();
+ currentGroup = new CheatsList(buildId, parentPath);
+
+ LoadedCheats.Add(currentGroup);
+ }
+
+ var model = new CheatModel(cheat.Name, buildId, enabled.Contains($"{buildId}-{cheat.Name}"));
+ currentGroup?.Add(model);
+
+ cheatAdded++;
+ }
+
+ if (cheatAdded == 0)
+ {
+ NoCheatsFound = true;
+ }
+
+ DataContext = this;
+
+ Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance[LocaleKeys.CheatWindowTitle];
+ }
+
+ public void Save()
+ {
+ if (NoCheatsFound)
+ {
+ return;
+ }
+
+ List<string> enabledCheats = new List<string>();
+
+ foreach (var cheats in LoadedCheats)
+ {
+ foreach (var cheat in cheats)
+ {
+ if (cheat.IsEnabled)
+ {
+ enabledCheats.Add(cheat.BuildIdKey);
+ }
+ }
+ }
+
+ Directory.CreateDirectory(Path.GetDirectoryName(_enabledCheatsPath));
+
+ File.WriteAllLines(_enabledCheatsPath, enabledCheats);
+
+ Close();
+ }
+ }
+} \ No newline at end of file
diff --git a/src/Ryujinx.Ava/UI/Windows/ContentDialogOverlayWindow.axaml b/src/Ryujinx.Ava/UI/Windows/ContentDialogOverlayWindow.axaml
new file mode 100644
index 00000000..8b52bade
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Windows/ContentDialogOverlayWindow.axaml
@@ -0,0 +1,25 @@
+<window:StyleableWindow
+ xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
+ xmlns:window="clr-namespace:Ryujinx.Ava.UI.Windows"
+ mc:Ignorable="d"
+ d:DesignWidth="800"
+ d:DesignHeight="450"
+ x:Class="Ryujinx.Ava.UI.Windows.ContentDialogOverlayWindow"
+ Title="ContentDialogOverlayWindow"
+ Focusable="False">
+ <window:StyleableWindow.Styles>
+ <Style Selector="ui|ContentDialog /template/ Panel#LayoutRoot">
+ <Setter Property="Background"
+ Value="Transparent" />
+ </Style>
+ </window:StyleableWindow.Styles>
+ <ui:ContentDialog Name="ContentDialog"
+ IsPrimaryButtonEnabled="True"
+ IsSecondaryButtonEnabled="True"
+ IsVisible="False"
+ Focusable="True"/>
+</window:StyleableWindow>
diff --git a/src/Ryujinx.Ava/UI/Windows/ContentDialogOverlayWindow.axaml.cs b/src/Ryujinx.Ava/UI/Windows/ContentDialogOverlayWindow.axaml.cs
new file mode 100644
index 00000000..3f77124d
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Windows/ContentDialogOverlayWindow.axaml.cs
@@ -0,0 +1,25 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+using Avalonia.Media;
+
+namespace Ryujinx.Ava.UI.Windows
+{
+ public partial class ContentDialogOverlayWindow : StyleableWindow
+ {
+ public ContentDialogOverlayWindow()
+ {
+ InitializeComponent();
+#if DEBUG
+ this.AttachDevTools();
+#endif
+ ExtendClientAreaToDecorationsHint = true;
+ TransparencyLevelHint = WindowTransparencyLevel.Transparent;
+ WindowStartupLocation = WindowStartupLocation.Manual;
+ SystemDecorations = SystemDecorations.None;
+ ExtendClientAreaTitleBarHeightHint = 0;
+ Background = Brushes.Transparent;
+ CanResize = false;
+ }
+ }
+} \ No newline at end of file
diff --git a/src/Ryujinx.Ava/UI/Windows/ControllerSettingsWindow.axaml b/src/Ryujinx.Ava/UI/Windows/ControllerSettingsWindow.axaml
new file mode 100644
index 00000000..8a4d22ff
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Windows/ControllerSettingsWindow.axaml
@@ -0,0 +1,1169 @@
+<UserControl
+ x:Class="Ryujinx.Ava.UI.Windows.ControllerSettingsWindow"
+ xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
+ xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
+ xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch"
+ d:DesignHeight="800"
+ d:DesignWidth="800"
+ x:CompileBindings="False"
+ mc:Ignorable="d"
+ Focusable="True">
+ <Design.DataContext>
+ <viewModels:ControllerSettingsViewModel />
+ </Design.DataContext>
+ <UserControl.Resources>
+ <helpers:KeyValueConverter x:Key="Key" />
+ </UserControl.Resources>
+ <StackPanel
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch"
+ Orientation="Vertical">
+ <Grid Margin="2,2,2,5" HorizontalAlignment="Stretch">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="0.5*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+ <Border
+ Grid.Column="0"
+ Margin="0,0,2,0"
+ BorderBrush="{DynamicResource ThemeControlBorderColor}"
+ BorderThickness="1"
+ Padding="2,0">
+ <StackPanel
+ Margin="2"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Orientation="Vertical">
+ <TextBlock
+ Margin="0,0,0,4"
+ HorizontalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsPlayer}" />
+ <ComboBox
+ Name="PlayerIndexBox"
+ Width="150"
+ SelectionChanged="PlayerIndexBox_OnSelectionChanged"
+ Items="{Binding PlayerIndexes}"
+ SelectedIndex="{Binding PlayerId}">
+ <ComboBox.ItemTemplate>
+ <DataTemplate>
+ <TextBlock Text="{Binding Name}" />
+ </DataTemplate>
+ </ComboBox.ItemTemplate>
+ </ComboBox>
+ </StackPanel>
+ </Border>
+
+ <!-- Main Controller Settings -->
+ <Border
+ Grid.Column="1"
+ Margin="0,0,2,0"
+ BorderBrush="{DynamicResource ThemeControlBorderColor}"
+ BorderThickness="1"
+ Padding="2,0">
+ <StackPanel
+ Margin="2"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Center"
+ Orientation="Vertical">
+ <TextBlock
+ Margin="0,0,0,5"
+ HorizontalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsInputDevice}" />
+ <Grid HorizontalAlignment="Stretch">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+ <ComboBox
+ Name="DeviceBox"
+ HorizontalAlignment="Stretch"
+ Items="{Binding DeviceList}"
+ SelectedIndex="{Binding Device}" />
+ <Button
+ Grid.Column="1"
+ MinWidth="0"
+ Margin="5,0,0,0"
+ VerticalAlignment="Center"
+ Command="{Binding LoadDevices}">
+ <ui:SymbolIcon
+ Symbol="Refresh"
+ FontSize="15"
+ Height="20" />
+ </Button>
+ </Grid>
+ </StackPanel>
+ </Border>
+ <Border
+ Grid.Column="2"
+ Margin="0,0,2,0"
+ BorderBrush="{DynamicResource ThemeControlBorderColor}"
+ BorderThickness="1"
+ Padding="2,0">
+ <Grid
+ Margin="2"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Center">
+ <Grid.RowDefinitions>
+ <RowDefinition />
+ <RowDefinition />
+ </Grid.RowDefinitions>
+ <TextBlock
+ Margin="0,0,0,4"
+ HorizontalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsControllerType}" />
+ <ComboBox
+ Grid.Row="1"
+ HorizontalAlignment="Stretch"
+ Items="{Binding Controllers}"
+ SelectedIndex="{Binding Controller}">
+ <ComboBox.ItemTemplate>
+ <DataTemplate>
+ <TextBlock Text="{Binding Name}" />
+ </DataTemplate>
+ </ComboBox.ItemTemplate>
+ </ComboBox>
+ </Grid>
+ </Border>
+ <Border
+ Grid.Column="3"
+ BorderBrush="{DynamicResource ThemeControlBorderColor}"
+ BorderThickness="1"
+ Padding="2,0" >
+ <StackPanel
+ Margin="2"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Orientation="Vertical">
+ <TextBlock
+ Margin="0,0,0,4"
+ HorizontalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsProfile}" />
+ <StackPanel Orientation="Horizontal">
+ <ui:ComboBox
+ IsEditable="True"
+ Name="ProfileBox"
+ Width="100"
+ SelectedIndex="0"
+ Items="{Binding ProfilesList}"
+ Text="{Binding ProfileName}" />
+ <Button
+ MinWidth="0"
+ Margin="5,0,0,0"
+ VerticalAlignment="Center"
+ ToolTip.Tip="{locale:Locale ControllerSettingsLoadProfileToolTip}"
+ Command="{Binding LoadProfile}">
+ <ui:SymbolIcon
+ Symbol="Upload"
+ FontSize="15"
+ Height="20" />
+ </Button>
+ <Button
+ MinWidth="0"
+ Margin="5,0,0,0"
+ VerticalAlignment="Center"
+ ToolTip.Tip="{locale:Locale ControllerSettingsSaveProfileToolTip}"
+ Command="{Binding SaveProfile}">
+ <ui:SymbolIcon
+ Symbol="Save"
+ FontSize="15"
+ Height="20" />
+ </Button>
+ <Button
+ MinWidth="0"
+ Margin="5,0,0,0"
+ VerticalAlignment="Center"
+ ToolTip.Tip="{locale:Locale ControllerSettingsRemoveProfileToolTip}"
+ Command="{Binding RemoveProfile}">
+ <ui:SymbolIcon
+ Symbol="Delete"
+ FontSize="15"
+ Height="20" />
+ </Button>
+ </StackPanel>
+ </StackPanel>
+ </Border>
+ </Grid>
+
+ <!-- Button / JoyStick Settings -->
+ <Grid
+ Name="SettingButtons"
+ MinHeight="450"
+ IsVisible="{Binding ShowSettings}">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+
+ <!-- Left -->
+ <Grid
+ Margin="0,0,10,0"
+ Grid.Column="0"
+ VerticalAlignment="Stretch"
+ DockPanel.Dock="Left">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+
+ <!-- Left Triggers -->
+ <Border
+ Grid.Row="0"
+ BorderBrush="{DynamicResource ThemeControlBorderColor}"
+ BorderThickness="1"
+ IsVisible="{Binding IsLeft}">
+ <Grid Margin="10" HorizontalAlignment="Stretch">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition />
+ <ColumnDefinition />
+ </Grid.ColumnDefinitions>
+ <Grid.RowDefinitions>
+ <RowDefinition />
+ <RowDefinition />
+ </Grid.RowDefinitions>
+ <StackPanel
+ Margin="0,0,0,4"
+ Grid.Column="0"
+ Grid.Row="0"
+ Background="{DynamicResource ThemeDarkColor}"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsTriggerZL}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.ButtonZl, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <StackPanel
+ Grid.Column="0"
+ Grid.Row="1"
+ Background="{DynamicResource ThemeDarkColor}"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsTriggerL}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.ButtonL, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <StackPanel
+ Margin="0,0,0,4"
+ Grid.Column="1"
+ Grid.Row="0"
+ Background="{DynamicResource ThemeDarkColor}"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsButtonMinus}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.ButtonMinus, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ </Grid>
+ </Border>
+
+ <!-- Left Joystick -->
+ <Border
+ Grid.Row="1"
+ BorderBrush="{DynamicResource ThemeControlBorderColor}"
+ BorderThickness="1"
+ IsVisible="{Binding IsLeft}">
+ <StackPanel Margin="10" Orientation="Vertical">
+ <TextBlock
+ Margin="0,0,0,10"
+ HorizontalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsLStick}" />
+
+ <!-- Left Joystick Keyboard -->
+ <StackPanel IsVisible="{Binding !IsController}" Orientation="Vertical">
+
+ <!-- Left Joystick Button -->
+ <StackPanel Margin="0,0,0,4" Background="{DynamicResource ThemeDarkColor}" Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsLStickButton}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.LeftKeyboardStickButton, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+
+ <!-- Left Joystick Up -->
+ <StackPanel Margin="0,0,0,4" Background="{DynamicResource ThemeDarkColor}" Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsLStickUp}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.LeftStickUp, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+
+ <!-- Left Joystick Down -->
+ <StackPanel Margin="0,0,0,4" Background="{DynamicResource ThemeDarkColor}" Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsLStickDown}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.LeftStickDown, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+
+ <!-- Left Joystick Left -->
+ <StackPanel Margin="0,0,0,4" Background="{DynamicResource ThemeDarkColor}" Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsLStickLeft}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.LeftStickLeft, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+
+ <!-- Left Joystick Right -->
+ <StackPanel Margin="0,0,0,4" Background="{DynamicResource ThemeDarkColor}" Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsLStickRight}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.LeftStickRight, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ </StackPanel>
+
+ <!-- Left Joystick Controller -->
+ <StackPanel IsVisible="{Binding IsController}" Orientation="Vertical">
+
+ <!-- Left Joystick Button -->
+ <StackPanel Background="{DynamicResource ThemeDarkColor}" Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsLStickButton}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.LeftControllerStickButton, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+
+ <!-- Left Joystick Stick -->
+ <StackPanel Margin="0,4,0,4" Background="{DynamicResource ThemeDarkColor}" Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsLStickStick}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch"
+ Tag="stick">
+ <TextBlock
+ Text="{Binding Configuration.LeftJoystick, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <CheckBox IsChecked="{Binding Configuration.LeftInvertStickX}">
+ <TextBlock Text="{locale:Locale ControllerSettingsLStickInvertXAxis}" />
+ </CheckBox>
+ <CheckBox IsChecked="{Binding Configuration.LeftInvertStickY}">
+ <TextBlock Text="{locale:Locale ControllerSettingsLStickInvertYAxis}" />
+ </CheckBox>
+ <CheckBox IsChecked="{Binding Configuration.LeftRotate90}">
+ <TextBlock Text="{locale:Locale ControllerSettingsRotate90}" />
+ </CheckBox>
+ <Separator Margin="0,4,0,4" Height="1" />
+ <StackPanel Orientation="Vertical">
+ <TextBlock Text="{locale:Locale ControllerSettingsLStickDeadzone}" />
+ <StackPanel
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Orientation="Horizontal">
+ <Slider
+ Width="130"
+ Maximum="1"
+ TickFrequency="0.01"
+ IsSnapToTickEnabled="True"
+ Minimum="0"
+ Value="{Binding Configuration.DeadzoneLeft, Mode=TwoWay}" />
+ <TextBlock
+ VerticalAlignment="Center"
+ Text="{Binding Configuration.DeadzoneLeft, StringFormat=\{0:0.00\}}" />
+ </StackPanel>
+ <TextBlock Text="{locale:Locale ControllerSettingsStickRange}" />
+ <StackPanel
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Orientation="Horizontal">
+ <Slider
+ Width="130"
+ Maximum="2"
+ TickFrequency="0.01"
+ IsSnapToTickEnabled="True"
+ Minimum="0"
+ Value="{Binding Configuration.RangeLeft, Mode=TwoWay}" />
+ <TextBlock
+ VerticalAlignment="Center"
+ Text="{Binding Configuration.RangeLeft, StringFormat=\{0:0.00\}}" />
+ </StackPanel>
+ </StackPanel>
+ </StackPanel>
+ </StackPanel>
+ </Border>
+
+ <!-- Left DPad -->
+ <Border
+ Grid.Row="2"
+ BorderBrush="{DynamicResource ThemeControlBorderColor}"
+ BorderThickness="1"
+ VerticalAlignment="Top"
+ IsVisible="{Binding IsLeft}">
+ <StackPanel Margin="10" Orientation="Vertical">
+ <TextBlock
+ Margin="0,0,0,10"
+ HorizontalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsDPad}" />
+ <StackPanel Orientation="Vertical">
+ <!-- Left DPad Up -->
+ <StackPanel Margin="0,0,0,4" Background="{DynamicResource ThemeDarkColor}" Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsDPadUp}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.DpadUp, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+
+ <!-- Left DPad Down -->
+ <StackPanel Margin="0,0,0,4" Background="{DynamicResource ThemeDarkColor}" Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsDPadDown}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.DpadDown, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+
+ <!-- Left DPad Left -->
+ <StackPanel Margin="0,0,0,4" Background="{DynamicResource ThemeDarkColor}" Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsDPadLeft}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.DpadLeft, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+
+ <!-- Left DPad Right -->
+ <StackPanel Margin="0,0,0,4" Background="{DynamicResource ThemeDarkColor}" Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsDPadRight}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.DpadRight, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ </StackPanel>
+ </StackPanel>
+ </Border>
+ </Grid>
+
+ <!-- Triggers And Side Buttons-->
+ <StackPanel Grid.Column="1" HorizontalAlignment="Stretch">
+ <Border
+ BorderBrush="{DynamicResource ThemeControlBorderColor}"
+ BorderThickness="1">
+ <StackPanel Margin="10" Orientation="Vertical">
+ <TextBlock HorizontalAlignment="Center" Text="{locale:Locale ControllerSettingsTriggerThreshold}" />
+ <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
+ <Slider
+ Width="130"
+ Maximum="1"
+ TickFrequency="0.01"
+ IsSnapToTickEnabled="True"
+ Minimum="0"
+ Value="{Binding Configuration.TriggerThreshold, Mode=TwoWay}" />
+ <TextBlock Text="{Binding Configuration.TriggerThreshold, StringFormat=\{0:0.00\}}" />
+ </StackPanel>
+ <StackPanel
+ Margin="0,4,0,0"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Background="{DynamicResource ThemeDarkColor}"
+ IsVisible="{Binding !IsRight}"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsLeftSR}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.LeftButtonSr, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <StackPanel
+ Margin="0,4,0,0"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ IsVisible="{Binding !IsRight}"
+ Background="{DynamicResource ThemeDarkColor}"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsLeftSL}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.LeftButtonSl, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <StackPanel
+ Margin="0,4,0,0"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ IsVisible="{Binding !IsLeft}"
+ Background="{DynamicResource ThemeDarkColor}"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsRightSR}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.RightButtonSr, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <StackPanel
+ Margin="0,4,0,0"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ IsVisible="{Binding !IsLeft}"
+ Background="{DynamicResource ThemeDarkColor}"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsRightSL}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.RightButtonSl, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ </StackPanel>
+ </Border>
+
+ <!-- Controller Picture -->
+ <Image
+ Margin="0,10,0,0"
+ MaxHeight="250"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Top"
+ Source="{Binding Image}" />
+
+ <!-- Motion+Rumble -->
+ <StackPanel Margin="0,10,0,0" Orientation="Vertical" >
+ <Border
+ BorderBrush="{DynamicResource ThemeControlBorderColor}"
+ BorderThickness="1"
+ HorizontalAlignment="Stretch"
+ IsVisible="{Binding IsController}">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+ <CheckBox
+ Margin="10"
+ MinWidth="0"
+ Grid.Column="0"
+ IsChecked="{Binding Configuration.EnableMotion, Mode=TwoWay}">
+ <TextBlock Text="{locale:Locale ControllerSettingsMotion}" />
+ </CheckBox>
+ <Button Margin="10" Grid.Column="1" Command="{Binding ShowMotionConfig}">
+ <TextBlock Text="{locale:Locale ControllerSettingsConfigureGeneral}" />
+ </Button>
+ </Grid>
+ </Border>
+ <Border
+ BorderBrush="{DynamicResource ThemeControlBorderColor}"
+ BorderThickness="1"
+ HorizontalAlignment="Stretch"
+ IsVisible="{Binding IsController}">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+ <CheckBox
+ Margin="10"
+ MinWidth="0"
+ Grid.Column="0"
+ IsChecked="{Binding Configuration.EnableRumble, Mode=TwoWay}">
+ <TextBlock Text="{locale:Locale ControllerSettingsRumble}" />
+ </CheckBox>
+ <Button Margin="10" Grid.Column="1" Command="{Binding ShowRumbleConfig}">
+ <TextBlock Text="{locale:Locale ControllerSettingsConfigureGeneral}" />
+ </Button>
+ </Grid>
+ </Border>
+ </StackPanel>
+ </StackPanel>
+
+ <!--Right Controls-->
+ <Grid
+ Margin="10,0,0,0"
+ Grid.Column="2"
+ VerticalAlignment="Top"
+ HorizontalAlignment="Stretch" >
+ <Grid.RowDefinitions>
+ <RowDefinition />
+ <RowDefinition />
+ <RowDefinition />
+ <RowDefinition />
+ </Grid.RowDefinitions>
+ <Border
+ Grid.Row="0"
+ BorderBrush="{DynamicResource ThemeControlBorderColor}"
+ BorderThickness="1"
+ IsVisible="{Binding IsRight}">
+ <StackPanel Margin="10" Orientation="Vertical">
+ <Grid HorizontalAlignment="Stretch">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition />
+ <ColumnDefinition />
+ </Grid.ColumnDefinitions>
+ <Grid.RowDefinitions>
+ <RowDefinition />
+ <RowDefinition />
+ </Grid.RowDefinitions>
+ <StackPanel
+ Margin="0,0,0,4"
+ Grid.Column="1"
+ Grid.Row="0"
+ Background="{DynamicResource ThemeDarkColor}"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsTriggerZR}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.ButtonZr, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <StackPanel
+ Grid.Column="1"
+ Grid.Row="1"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Background="{DynamicResource ThemeDarkColor}"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsTriggerR}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.ButtonR, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <StackPanel
+ Margin="0,0,8,4"
+ Grid.Column="0"
+ Grid.Row="0"
+ HorizontalAlignment="Right"
+ VerticalAlignment="Center"
+ Background="{DynamicResource ThemeDarkColor}"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsButtonPlus}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.ButtonPlus, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ </Grid>
+ </StackPanel>
+ </Border>
+ <Border
+ Grid.Row="1"
+ BorderBrush="{DynamicResource ThemeControlBorderColor}"
+ BorderThickness="1"
+ IsVisible="{Binding IsRight}">
+ <StackPanel Margin="10" Orientation="Vertical">
+ <TextBlock
+ Margin="0,0,0,10"
+ HorizontalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsButtons}" />
+ <Grid HorizontalAlignment="Stretch">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition />
+ <ColumnDefinition />
+ </Grid.ColumnDefinitions>
+ <Grid.RowDefinitions>
+ <RowDefinition />
+ <RowDefinition />
+ </Grid.RowDefinitions>
+ <!-- Right Buttons X -->
+ <StackPanel
+ Margin="0,0,0,4"
+ Grid.Column="0"
+ Grid.Row="0"
+ Background="{DynamicResource ThemeDarkColor}"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsButtonX}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.ButtonX, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <!-- Right Buttons Y -->
+ <StackPanel
+ Grid.Column="0"
+ Grid.Row="1"
+ Background="{DynamicResource ThemeDarkColor}"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsButtonY}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.ButtonY, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <!-- Right Buttons A -->
+ <StackPanel
+ Margin="0,0,0,4"
+ Grid.Column="1"
+ Grid.Row="0"
+ Background="{DynamicResource ThemeDarkColor}"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsButtonA}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.ButtonA, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <!-- Right Buttons B -->
+ <StackPanel
+ Grid.Column="1"
+ Grid.Row="1"
+ Background="{DynamicResource ThemeDarkColor}"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsButtonB}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.ButtonB, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ </Grid>
+ </StackPanel>
+ </Border>
+ <Border
+ Grid.Row="2"
+ Padding="10"
+ BorderBrush="{DynamicResource ThemeControlBorderColor}"
+ BorderThickness="1"
+ IsVisible="{Binding IsRight}">
+ <StackPanel Orientation="Vertical">
+ <TextBlock
+ Margin="0,0,0,10"
+ HorizontalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsRStick}" />
+
+ <!-- Right Joystick Keyboard -->
+ <StackPanel IsVisible="{Binding !IsController}" Orientation="Vertical">
+
+ <!-- Right Joystick Button -->
+ <StackPanel Margin="0,0,0,4" Background="{DynamicResource ThemeDarkColor}" Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsRStickButton}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.RightKeyboardStickButton, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+
+ <!-- Right Joystick Up -->
+ <StackPanel Margin="0,0,0,4" Background="{DynamicResource ThemeDarkColor}" Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsRStickUp}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.RightStickUp, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+
+ <!-- Right Joystick Down -->
+ <StackPanel Margin="0,0,0,4" Background="{DynamicResource ThemeDarkColor}" Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsRStickDown}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.RightStickDown, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+
+ <!-- Right Joystick Left -->
+ <StackPanel Margin="0,0,0,4" Background="{DynamicResource ThemeDarkColor}" Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsRStickLeft}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.RightStickLeft, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+
+ <!-- Right Joystick Right -->
+ <StackPanel Margin="0,0,0,4" Background="{DynamicResource ThemeDarkColor}" Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsRStickRight}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.RightStickRight, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ </StackPanel>
+
+ <!-- Right Joystick Controller -->
+ <StackPanel IsVisible="{Binding IsController}" Orientation="Vertical">
+
+ <!-- Right Joystick Button -->
+ <StackPanel Background="{DynamicResource ThemeDarkColor}" Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsRStickButton}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch">
+ <TextBlock
+ Text="{Binding Configuration.RightControllerStickButton, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+
+
+ <!-- Right Joystick Stick -->
+ <StackPanel Margin="0,4,0,4" Background="{DynamicResource ThemeDarkColor}" Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsRStickStick}"
+ TextAlignment="Center" />
+ <ToggleButton
+ Width="90"
+ Height="27"
+ HorizontalAlignment="Stretch"
+ Tag="stick">
+ <TextBlock
+ Text="{Binding Configuration.RightJoystick, Mode=TwoWay, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <CheckBox IsChecked="{Binding Configuration.RightInvertStickX}">
+ <TextBlock Text="{locale:Locale ControllerSettingsRStickInvertXAxis}" />
+ </CheckBox>
+ <CheckBox IsChecked="{Binding Configuration.RightInvertStickY}">
+ <TextBlock Text="{locale:Locale ControllerSettingsRStickInvertYAxis}" />
+ </CheckBox>
+ <CheckBox IsChecked="{Binding Configuration.RightRotate90}">
+ <TextBlock Text="{locale:Locale ControllerSettingsRotate90}" />
+ </CheckBox>
+ <Separator Margin="0,4,0,4" Height="1" />
+ <StackPanel Orientation="Vertical">
+ <TextBlock Text="{locale:Locale ControllerSettingsRStickDeadzone}" />
+ <StackPanel
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Orientation="Horizontal">
+ <Slider
+ Width="130"
+ Maximum="1"
+ TickFrequency="0.01"
+ IsSnapToTickEnabled="True"
+ Padding="0"
+ VerticalAlignment="Center"
+ Minimum="0"
+ Value="{Binding Configuration.DeadzoneRight, Mode=TwoWay}" />
+ <TextBlock
+ VerticalAlignment="Center"
+ Text="{Binding Configuration.DeadzoneRight, StringFormat=\{0:0.00\}}" />
+ </StackPanel>
+ <TextBlock Text="{locale:Locale ControllerSettingsStickRange}" />
+ <StackPanel
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Orientation="Horizontal">
+ <Slider
+ Width="130"
+ Maximum="2"
+ TickFrequency="0.01"
+ IsSnapToTickEnabled="True"
+ Minimum="0"
+ Value="{Binding Configuration.RangeRight, Mode=TwoWay}" />
+ <TextBlock
+ VerticalAlignment="Center"
+ Text="{Binding Configuration.RangeRight, StringFormat=\{0:0.00\}}" />
+ </StackPanel>
+ </StackPanel>
+ </StackPanel>
+ </StackPanel>
+ </Border>
+ </Grid>
+
+ </Grid>
+
+ </StackPanel>
+
+</UserControl> \ No newline at end of file
diff --git a/src/Ryujinx.Ava/UI/Windows/ControllerSettingsWindow.axaml.cs b/src/Ryujinx.Ava/UI/Windows/ControllerSettingsWindow.axaml.cs
new file mode 100644
index 00000000..2864b6da
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Windows/ControllerSettingsWindow.axaml.cs
@@ -0,0 +1,181 @@
+using Avalonia.Controls;
+using Avalonia.Controls.Primitives;
+using Avalonia.Input;
+using Avalonia.Interactivity;
+using Avalonia.LogicalTree;
+using Ryujinx.Ava.Common.Locale;
+using Ryujinx.Ava.UI.Controls;
+using Ryujinx.Ava.UI.Helpers;
+using Ryujinx.Ava.UI.Models;
+using Ryujinx.Ava.UI.ViewModels;
+using Ryujinx.Common.Configuration.Hid.Controller;
+using Ryujinx.Input;
+using Ryujinx.Input.Assigner;
+using System;
+
+namespace Ryujinx.Ava.UI.Windows
+{
+ public partial class ControllerSettingsWindow : UserControl
+ {
+ private bool _dialogOpen;
+
+ private ButtonKeyAssigner _currentAssigner;
+ internal ControllerSettingsViewModel ViewModel { get; set; }
+
+ public ControllerSettingsWindow()
+ {
+ DataContext = ViewModel = new ControllerSettingsViewModel(this);
+
+ InitializeComponent();
+
+ foreach (ILogical visual in SettingButtons.GetLogicalDescendants())
+ {
+ if (visual is ToggleButton button && !(visual is CheckBox))
+ {
+ button.Checked += Button_Checked;
+ button.Unchecked += Button_Unchecked;
+ }
+ }
+ }
+
+ protected override void OnPointerReleased(PointerReleasedEventArgs e)
+ {
+ base.OnPointerReleased(e);
+
+ if (_currentAssigner != null && _currentAssigner.ToggledButton != null && !_currentAssigner.ToggledButton.IsPointerOver)
+ {
+ _currentAssigner.Cancel();
+ }
+ }
+
+ private void Button_Checked(object sender, RoutedEventArgs e)
+ {
+ if (sender is ToggleButton button)
+ {
+ if (_currentAssigner != null && button == _currentAssigner.ToggledButton)
+ {
+ return;
+ }
+
+ bool isStick = button.Tag != null && button.Tag.ToString() == "stick";
+
+ if (_currentAssigner == null && (bool)button.IsChecked)
+ {
+ _currentAssigner = new ButtonKeyAssigner(button);
+
+ FocusManager.Instance.Focus(this, NavigationMethod.Pointer);
+
+ PointerPressed += MouseClick;
+
+ IKeyboard keyboard = (IKeyboard)ViewModel.AvaloniaKeyboardDriver.GetGamepad("0"); // Open Avalonia keyboard for cancel operations.
+ IButtonAssigner assigner = CreateButtonAssigner(isStick);
+
+ _currentAssigner.ButtonAssigned += (sender, e) =>
+ {
+ if (e.IsAssigned)
+ {
+ ViewModel.IsModified = true;
+ }
+ };
+
+ _currentAssigner.GetInputAndAssign(assigner, keyboard);
+ }
+ else
+ {
+ if (_currentAssigner != null)
+ {
+ ToggleButton oldButton = _currentAssigner.ToggledButton;
+
+ _currentAssigner.Cancel();
+ _currentAssigner = null;
+ button.IsChecked = false;
+ }
+ }
+ }
+ }
+
+ public void SaveCurrentProfile()
+ {
+ ViewModel.Save();
+ }
+
+ private IButtonAssigner CreateButtonAssigner(bool forStick)
+ {
+ IButtonAssigner assigner;
+
+ var device = ViewModel.Devices[ViewModel.Device];
+
+ if (device.Type == DeviceType.Keyboard)
+ {
+ assigner = new KeyboardKeyAssigner((IKeyboard)ViewModel.SelectedGamepad);
+ }
+ else if (device.Type == DeviceType.Controller)
+ {
+ assigner = new GamepadButtonAssigner(ViewModel.SelectedGamepad, (ViewModel.Config as StandardControllerInputConfig).TriggerThreshold, forStick);
+ }
+ else
+ {
+ throw new Exception("Controller not supported");
+ }
+
+ return assigner;
+ }
+
+ private void Button_Unchecked(object sender, RoutedEventArgs e)
+ {
+ _currentAssigner?.Cancel();
+ _currentAssigner = null;
+ }
+
+ private void MouseClick(object sender, PointerPressedEventArgs e)
+ {
+ bool shouldUnbind = false;
+
+ if (e.GetCurrentPoint(this).Properties.IsMiddleButtonPressed)
+ {
+ shouldUnbind = true;
+ }
+
+ _currentAssigner?.Cancel(shouldUnbind);
+
+ PointerPressed -= MouseClick;
+ }
+
+ private async void PlayerIndexBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ if (ViewModel.IsModified && !_dialogOpen)
+ {
+ _dialogOpen = true;
+
+ var result = await ContentDialogHelper.CreateConfirmationDialog(
+ LocaleManager.Instance[LocaleKeys.DialogControllerSettingsModifiedConfirmMessage],
+ LocaleManager.Instance[LocaleKeys.DialogControllerSettingsModifiedConfirmSubMessage],
+ LocaleManager.Instance[LocaleKeys.InputDialogYes],
+ LocaleManager.Instance[LocaleKeys.InputDialogNo],
+ LocaleManager.Instance[LocaleKeys.RyujinxConfirm]);
+
+ if (result == UserResult.Yes)
+ {
+ ViewModel.Save();
+ }
+
+ _dialogOpen = false;
+
+ ViewModel.IsModified = false;
+
+ if (e.AddedItems.Count > 0)
+ {
+ var player = (PlayerModel)e.AddedItems[0];
+ ViewModel.PlayerId = player.Id;
+ }
+ }
+ }
+
+ public void Dispose()
+ {
+ _currentAssigner?.Cancel();
+ _currentAssigner = null;
+ ViewModel.Dispose();
+ }
+ }
+} \ No newline at end of file
diff --git a/src/Ryujinx.Ava/UI/Windows/DownloadableContentManagerWindow.axaml b/src/Ryujinx.Ava/UI/Windows/DownloadableContentManagerWindow.axaml
new file mode 100644
index 00000000..fe446fb3
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Windows/DownloadableContentManagerWindow.axaml
@@ -0,0 +1,194 @@
+<UserControl
+ x:Class="Ryujinx.Ava.UI.Windows.DownloadableContentManagerWindow"
+ xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
+ xmlns:models="clr-namespace:Ryujinx.Ava.UI.Models"
+ xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
+ Width="500"
+ Height="380"
+ mc:Ignorable="d"
+ x:CompileBindings="True"
+ x:DataType="viewModels:DownloadableContentManagerViewModel"
+ Focusable="True">
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <Panel
+ Margin="0 0 0 10"
+ Grid.Row="0">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <TextBlock
+ Grid.Column="0"
+ Text="{Binding UpdateCount}" />
+ <StackPanel
+ Margin="10 0"
+ Grid.Column="1"
+ Orientation="Horizontal">
+ <Button
+ Name="EnableAllButton"
+ MinWidth="90"
+ Margin="5"
+ Command="{ReflectionBinding EnableAll}">
+ <TextBlock Text="{locale:Locale DlcManagerEnableAllButton}" />
+ </Button>
+ <Button
+ Name="DisableAllButton"
+ MinWidth="90"
+ Margin="5"
+ Command="{ReflectionBinding DisableAll}">
+ <TextBlock Text="{locale:Locale DlcManagerDisableAllButton}" />
+ </Button>
+ </StackPanel>
+ <TextBox
+ Grid.Column="2"
+ MinHeight="27"
+ MaxHeight="27"
+ HorizontalAlignment="Stretch"
+ Watermark="{locale:Locale Search}"
+ Text="{Binding Search}" />
+ </Grid>
+ </Panel>
+ <Border
+ Grid.Row="1"
+ Margin="0 0 0 24"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch"
+ BorderBrush="{DynamicResource AppListHoverBackgroundColor}"
+ BorderThickness="1"
+ CornerRadius="5"
+ Padding="2.5">
+ <ListBox
+ AutoScrollToSelectedItem="False"
+ VirtualizationMode="None"
+ SelectionMode="Multiple, Toggle"
+ Background="Transparent"
+ SelectionChanged="OnSelectionChanged"
+ SelectedItems="{Binding SelectedDownloadableContents, Mode=TwoWay}"
+ Items="{Binding Views}">
+ <ListBox.DataTemplates>
+ <DataTemplate
+ DataType="models:DownloadableContentModel">
+ <Panel Margin="10">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+ <Grid
+ Grid.Column="0">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*"></ColumnDefinition>
+ <ColumnDefinition Width="Auto"></ColumnDefinition>
+ </Grid.ColumnDefinitions>
+ <TextBlock
+ Grid.Column="0"
+ HorizontalAlignment="Left"
+ VerticalAlignment="Center"
+ MaxLines="2"
+ TextWrapping="Wrap"
+ TextTrimming="CharacterEllipsis"
+ Text="{Binding FileName}" />
+ <TextBlock
+ Grid.Column="1"
+ Margin="10 0"
+ HorizontalAlignment="Left"
+ VerticalAlignment="Center"
+ Text="{Binding TitleId}" />
+ </Grid>
+ <StackPanel
+ Grid.Column="1"
+ Spacing="10"
+ Orientation="Horizontal"
+ HorizontalAlignment="Right">
+ <Button
+ VerticalAlignment="Center"
+ HorizontalAlignment="Right"
+ Padding="10"
+ MinWidth="0"
+ MinHeight="0"
+ Click="OpenLocation">
+ <ui:SymbolIcon
+ Symbol="OpenFolder"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center" />
+ </Button>
+ <Button
+ VerticalAlignment="Center"
+ HorizontalAlignment="Right"
+ Padding="10"
+ MinWidth="0"
+ MinHeight="0"
+ Click="RemoveDLC">
+ <ui:SymbolIcon
+ Symbol="Cancel"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center" />
+ </Button>
+ </StackPanel>
+ </Grid>
+ </Panel>
+ </DataTemplate>
+ </ListBox.DataTemplates>
+ <ListBox.Styles>
+ <Style Selector="ListBoxItem">
+ <Setter Property="Background" Value="Transparent" />
+ </Style>
+ </ListBox.Styles>
+ </ListBox>
+ </Border>
+ <Panel
+ Grid.Row="2"
+ HorizontalAlignment="Stretch">
+ <StackPanel
+ Orientation="Horizontal"
+ Spacing="10"
+ HorizontalAlignment="Left">
+ <Button
+ Name="AddButton"
+ MinWidth="90"
+ Margin="5"
+ Command="{ReflectionBinding Add}">
+ <TextBlock Text="{locale:Locale SettingsTabGeneralAdd}" />
+ </Button>
+ <Button
+ Name="RemoveAllButton"
+ MinWidth="90"
+ Margin="5"
+ Command="{ReflectionBinding RemoveAll}">
+ <TextBlock Text="{locale:Locale DlcManagerRemoveAllButton}" />
+ </Button>
+ </StackPanel>
+ <StackPanel
+ Orientation="Horizontal"
+ Spacing="10"
+ HorizontalAlignment="Right">
+ <Button
+ Name="SaveButton"
+ MinWidth="90"
+ Margin="5"
+ Click="SaveAndClose">
+ <TextBlock Text="{locale:Locale SettingsButtonSave}" />
+ </Button>
+ <Button
+ Name="CancelButton"
+ MinWidth="90"
+ Margin="5"
+ Click="Close">
+ <TextBlock Text="{locale:Locale InputDialogCancel}" />
+ </Button>
+ </StackPanel>
+ </Panel>
+ </Grid>
+</UserControl> \ No newline at end of file
diff --git a/src/Ryujinx.Ava/UI/Windows/DownloadableContentManagerWindow.axaml.cs b/src/Ryujinx.Ava/UI/Windows/DownloadableContentManagerWindow.axaml.cs
new file mode 100644
index 00000000..6dc99fb5
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Windows/DownloadableContentManagerWindow.axaml.cs
@@ -0,0 +1,115 @@
+using Avalonia.Controls;
+using Avalonia.Interactivity;
+using Avalonia.Styling;
+using FluentAvalonia.UI.Controls;
+using Ryujinx.Ava.Common.Locale;
+using Ryujinx.Ava.UI.Helpers;
+using Ryujinx.Ava.UI.Models;
+using Ryujinx.Ava.UI.ViewModels;
+using Ryujinx.HLE.FileSystem;
+using Ryujinx.Ui.Common.Helper;
+using System.Threading.Tasks;
+using Button = Avalonia.Controls.Button;
+
+namespace Ryujinx.Ava.UI.Windows
+{
+ public partial class DownloadableContentManagerWindow : UserControl
+ {
+ public DownloadableContentManagerViewModel ViewModel;
+
+ public DownloadableContentManagerWindow()
+ {
+ DataContext = this;
+
+ InitializeComponent();
+ }
+
+ public DownloadableContentManagerWindow(VirtualFileSystem virtualFileSystem, ulong titleId, string titleName)
+ {
+ DataContext = ViewModel = new DownloadableContentManagerViewModel(virtualFileSystem, titleId, titleName);
+
+ InitializeComponent();
+ }
+
+ public static async Task Show(VirtualFileSystem virtualFileSystem, ulong titleId, string titleName)
+ {
+ ContentDialog contentDialog = new()
+ {
+ PrimaryButtonText = "",
+ SecondaryButtonText = "",
+ CloseButtonText = "",
+ Content = new DownloadableContentManagerWindow(virtualFileSystem, titleId, titleName),
+ Title = string.Format(LocaleManager.Instance[LocaleKeys.DlcWindowTitle], titleName, titleId.ToString("X16"))
+ };
+
+ Style bottomBorder = new(x => x.OfType<Grid>().Name("DialogSpace").Child().OfType<Border>());
+ bottomBorder.Setters.Add(new Setter(IsVisibleProperty, false));
+
+ contentDialog.Styles.Add(bottomBorder);
+
+ await ContentDialogHelper.ShowAsync(contentDialog);
+ }
+
+ private void SaveAndClose(object sender, RoutedEventArgs routedEventArgs)
+ {
+ ViewModel.Save();
+ ((ContentDialog)Parent).Hide();
+ }
+
+ private void Close(object sender, RoutedEventArgs e)
+ {
+ ((ContentDialog)Parent).Hide();
+ }
+
+ private void RemoveDLC(object sender, RoutedEventArgs e)
+ {
+ if (sender is Button button)
+ {
+ if (button.DataContext is DownloadableContentModel model)
+ {
+ ViewModel.Remove(model);
+ }
+ }
+ }
+
+ private void OpenLocation(object sender, RoutedEventArgs e)
+ {
+ if (sender is Button button)
+ {
+ if (button.DataContext is DownloadableContentModel model)
+ {
+ OpenHelper.LocateFile(model.ContainerPath);
+ }
+ }
+ }
+
+ private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ foreach (var content in e.AddedItems)
+ {
+ if (content is DownloadableContentModel model)
+ {
+ var index = ViewModel.DownloadableContents.IndexOf(model);
+
+ if (index != -1)
+ {
+ ViewModel.DownloadableContents[index].Enabled = true;
+ }
+ }
+ }
+
+ foreach (var content in e.RemovedItems)
+ {
+ if (content is DownloadableContentModel model)
+ {
+ var index = ViewModel.DownloadableContents.IndexOf(model);
+
+ if (index != -1)
+ {
+ ViewModel.DownloadableContents[index].Enabled = false;
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/Ryujinx.Ava/UI/Windows/IconColorPicker.cs b/src/Ryujinx.Ava/UI/Windows/IconColorPicker.cs
new file mode 100644
index 00000000..a4c6287f
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Windows/IconColorPicker.cs
@@ -0,0 +1,192 @@
+using SixLabors.ImageSharp;
+using SixLabors.ImageSharp.PixelFormats;
+using System;
+using System.Collections.Generic;
+
+namespace Ryujinx.Ava.UI.Windows
+{
+ static class IconColorPicker
+ {
+ private const int ColorsPerLine = 64;
+ private const int TotalColors = ColorsPerLine * ColorsPerLine;
+
+ private const int UvQuantBits = 3;
+ private const int UvQuantShift = BitsPerComponent - UvQuantBits;
+
+ private const int SatQuantBits = 5;
+ private const int SatQuantShift = BitsPerComponent - SatQuantBits;
+
+ private const int BitsPerComponent = 8;
+
+ private const int CutOffLuminosity = 64;
+
+ private readonly struct PaletteColor
+ {
+ public int Qck { get; }
+ public byte R { get; }
+ public byte G { get; }
+ public byte B { get; }
+
+ public PaletteColor(int qck, byte r, byte g, byte b)
+ {
+ Qck = qck;
+ R = r;
+ G = g;
+ B = b;
+ }
+ }
+
+ public static Color GetFilteredColor(Image<Bgra32> image)
+ {
+ var color = GetColor(image).ToPixel<Bgra32>();
+
+ // We don't want colors that are too dark.
+ // If the color is too dark, make it brighter by reducing the range
+ // and adding a constant color.
+ int luminosity = GetColorApproximateLuminosity(color.R, color.G, color.B);
+ if (luminosity < CutOffLuminosity)
+ {
+ color = Color.FromRgb(
+ (byte)Math.Min(CutOffLuminosity + color.R, byte.MaxValue),
+ (byte)Math.Min(CutOffLuminosity + color.G, byte.MaxValue),
+ (byte)Math.Min(CutOffLuminosity + color.B, byte.MaxValue));
+ }
+
+ return color;
+ }
+
+ public static Color GetColor(Image<Bgra32> image)
+ {
+ var colors = new PaletteColor[TotalColors];
+
+ var dominantColorBin = new Dictionary<int, int>();
+
+ var buffer = GetBuffer(image);
+
+ int w = image.Width;
+
+ int w8 = w << 8;
+ int h8 = image.Height << 8;
+
+ int xStep = w8 / ColorsPerLine;
+ int yStep = h8 / ColorsPerLine;
+
+ int i = 0;
+ int maxHitCount = 0;
+
+ for (int y = 0; y < image.Height; y++)
+ {
+ int yOffset = y * image.Width;
+
+ for (int x = 0; x < image.Width && i < TotalColors; x++)
+ {
+ int offset = x + yOffset;
+
+ byte cb = buffer[offset].B;
+ byte cg = buffer[offset].G;
+ byte cr = buffer[offset].R;
+
+ var qck = GetQuantizedColorKey(cr, cg, cb);
+
+ if (dominantColorBin.TryGetValue(qck, out int hitCount))
+ {
+ dominantColorBin[qck] = hitCount + 1;
+
+ if (maxHitCount < hitCount)
+ {
+ maxHitCount = hitCount;
+ }
+ }
+ else
+ {
+ dominantColorBin.Add(qck, 1);
+ }
+
+ colors[i++] = new PaletteColor(qck, cr, cg, cb);
+ }
+ }
+
+ int highScore = -1;
+ PaletteColor bestCandidate = default;
+
+ for (i = 0; i < TotalColors; i++)
+ {
+ var score = GetColorScore(dominantColorBin, maxHitCount, colors[i]);
+
+ if (highScore < score)
+ {
+ highScore = score;
+ bestCandidate = colors[i];
+ }
+ }
+
+ return Color.FromRgb(bestCandidate.R, bestCandidate.G, bestCandidate.B);
+ }
+
+ public static Bgra32[] GetBuffer(Image<Bgra32> image)
+ {
+ return image.TryGetSinglePixelSpan(out var data) ? data.ToArray() : Array.Empty<Bgra32>();
+ }
+
+ private static int GetColorScore(Dictionary<int, int> dominantColorBin, int maxHitCount, PaletteColor color)
+ {
+ var hitCount = dominantColorBin[color.Qck];
+ var balancedHitCount = BalanceHitCount(hitCount, maxHitCount);
+ var quantSat = (GetColorSaturation(color) >> SatQuantShift) << SatQuantShift;
+ var value = GetColorValue(color);
+
+ // If the color is rarely used on the image,
+ // then chances are that theres a better candidate, even if the saturation value
+ // is high. By multiplying the saturation value with a weight, we can lower
+ // it if the color is almost never used (hit count is low).
+ var satWeighted = quantSat;
+ var satWeight = balancedHitCount << 5;
+ if (satWeight < 0x100)
+ {
+ satWeighted = (satWeighted * satWeight) >> 8;
+ }
+
+ // Compute score from saturation and dominance of the color.
+ // We prefer more vivid colors over dominant ones, so give more weight to the saturation.
+ var score = ((satWeighted << 1) + balancedHitCount) * value;
+
+ return score;
+ }
+
+ private static int BalanceHitCount(int hitCount, int maxHitCount)
+ {
+ return (hitCount << 8) / maxHitCount;
+ }
+
+ private static int GetColorApproximateLuminosity(byte r, byte g, byte b)
+ {
+ return (r + g + b) / 3;
+ }
+
+ private static int GetColorSaturation(PaletteColor color)
+ {
+ int cMax = Math.Max(Math.Max(color.R, color.G), color.B);
+
+ if (cMax == 0)
+ {
+ return 0;
+ }
+
+ int cMin = Math.Min(Math.Min(color.R, color.G), color.B);
+ int delta = cMax - cMin;
+ return (delta << 8) / cMax;
+ }
+
+ private static int GetColorValue(PaletteColor color)
+ {
+ return Math.Max(Math.Max(color.R, color.G), color.B);
+ }
+
+ private static int GetQuantizedColorKey(byte r, byte g, byte b)
+ {
+ int u = ((-38 * r - 74 * g + 112 * b + 128) >> 8) + 128;
+ int v = ((112 * r - 94 * g - 18 * b + 128) >> 8) + 128;
+ return (v >> UvQuantShift) | ((u >> UvQuantShift) << UvQuantBits);
+ }
+ }
+}
diff --git a/src/Ryujinx.Ava/UI/Windows/MainWindow.axaml b/src/Ryujinx.Ava/UI/Windows/MainWindow.axaml
new file mode 100644
index 00000000..08b99cf5
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Windows/MainWindow.axaml
@@ -0,0 +1,206 @@
+<window:StyleableWindow
+ x:Class="Ryujinx.Ava.UI.Windows.MainWindow"
+ xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:window="clr-namespace:Ryujinx.Ava.UI.Windows"
+ xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
+ xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
+ xmlns:controls="clr-namespace:Ryujinx.Ava.UI.Controls"
+ xmlns:main="clr-namespace:Ryujinx.Ava.UI.Views.Main"
+ Cursor="{Binding Cursor}"
+ Title="{Binding Title}"
+ WindowState="{Binding WindowState}"
+ Width="1280"
+ Height="777"
+ MinWidth="1092"
+ MinHeight="672"
+ d:DesignHeight="720"
+ d:DesignWidth="1280"
+ x:CompileBindings="True"
+ x:DataType="viewModels:MainWindowViewModel"
+ WindowStartupLocation="CenterScreen"
+ mc:Ignorable="d"
+ Focusable="True">
+ <Window.Styles>
+ <Style Selector="TitleBar:fullscreen">
+ <Setter Property="Background" Value="#000000" />
+ </Style>
+ </Window.Styles>
+ <Design.DataContext>
+ <viewModels:MainWindowViewModel />
+ </Design.DataContext>
+ <Window.Resources>
+ <helpers:BitmapArrayValueConverter x:Key="ByteImage" />
+ </Window.Resources>
+ <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+ <helpers:OffscreenTextBox Name="HiddenTextBox" Grid.Row="0" />
+ <StackPanel Grid.Row="0" IsVisible="False">
+ <helpers:HotKeyControl Name="FullscreenHotKey" Command="{ReflectionBinding ToggleFullscreen}" />
+ <helpers:HotKeyControl Name="FullscreenHotKey2" Command="{ReflectionBinding ToggleFullscreen}" />
+ <helpers:HotKeyControl Name="FullscreenHotKeyMacOS" Command="{ReflectionBinding ToggleFullscreen}" />
+ <helpers:HotKeyControl Name="DockToggleHotKey" Command="{ReflectionBinding ToggleDockMode}" />
+ <helpers:HotKeyControl Name="ExitHotKey" Command="{ReflectionBinding ExitCurrentState}" />
+ </StackPanel>
+ <Grid
+ Grid.Row="1"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <StackPanel
+ Name="MenuBar"
+ MinHeight="35"
+ Grid.Row="0"
+ Margin="0"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch"
+ IsVisible="{Binding ShowMenuAndStatusBar}"
+ Orientation="Vertical">
+ <main:MainMenuBarView
+ Name="MenuBarView" />
+ </StackPanel>
+ <ContentControl
+ Name="MainContent"
+ Grid.Row="1"
+ Padding="0"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch"
+ BorderBrush="{DynamicResource ThemeControlBorderColor}"
+ BorderThickness="0,0,0,0"
+ DockPanel.Dock="Top"
+ IsVisible="{Binding ShowContent}">
+ <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Name="GameLibrary">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+ <main:MainViewControls
+ Name="ViewControls"
+ Grid.Row="0"/>
+ <controls:GameListView
+ x:Name="GameList"
+ Grid.Row="1"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch"
+ HorizontalContentAlignment="Stretch"
+ VerticalContentAlignment="Stretch"
+ IsVisible="{Binding IsList}" />
+ <controls:GameGridView
+ x:Name="GameGrid"
+ Grid.Row="1"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch"
+ HorizontalContentAlignment="Stretch"
+ VerticalContentAlignment="Stretch"
+ IsVisible="{Binding IsGrid}" />
+ </Grid>
+ </ContentControl>
+ <Grid
+ Grid.Row="1"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch"
+ Background="{DynamicResource ThemeContentBackgroundColor}"
+ IsVisible="{Binding ShowLoadProgress}"
+ Name="LoadingView"
+ ZIndex="1000">
+ <Grid
+ Margin="40"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ IsVisible="{Binding ShowLoadProgress}">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <Border
+ Grid.RowSpan="2"
+ Grid.Column="0"
+ Width="256"
+ Height="256"
+ Margin="10"
+ Padding="4"
+ BorderBrush="Black"
+ BorderThickness="2"
+ BoxShadow="4 4 32 8 #40000000"
+ CornerRadius="3"
+ IsVisible="{Binding ShowLoadProgress}">
+ <Image
+ Width="256"
+ Height="256"
+ IsVisible="{Binding ShowLoadProgress}"
+ Source="{Binding SelectedIcon, Converter={StaticResource ByteImage}}" />
+ </Border>
+ <Grid
+ Grid.Column="1"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Center"
+ IsVisible="{Binding ShowLoadProgress}">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <TextBlock
+ Grid.Row="0"
+ Margin="10"
+ FontSize="30"
+ FontWeight="Bold"
+ IsVisible="{Binding ShowLoadProgress}"
+ Text="{Binding LoadHeading}"
+ TextAlignment="Left"
+ TextWrapping="Wrap"
+ MaxWidth="500" />
+ <Border
+ Grid.Row="1"
+ Margin="10"
+ Padding="0"
+ HorizontalAlignment="Stretch"
+ BorderBrush="{Binding ProgressBarBackgroundColor}"
+ BorderThickness="1"
+ ClipToBounds="True"
+ CornerRadius="5"
+ IsVisible="{Binding ShowLoadProgress}">
+ <ProgressBar
+ Height="10"
+ MinWidth="500"
+ Margin="0"
+ Padding="0"
+ HorizontalAlignment="Stretch"
+ ClipToBounds="True"
+ CornerRadius="5"
+ Foreground="{Binding ProgressBarForegroundColor}"
+ IsIndeterminate="{Binding IsLoadingIndeterminate}"
+ IsVisible="{Binding ShowLoadProgress}"
+ Maximum="{Binding ProgressMaximum}"
+ Minimum="0"
+ Value="{Binding ProgressValue}" />
+ </Border>
+ <TextBlock
+ Grid.Row="2"
+ Margin="10"
+ FontSize="18"
+ IsVisible="{Binding ShowLoadProgress}"
+ Text="{Binding CacheLoadStatus}"
+ TextAlignment="Left"
+ MaxWidth="500" />
+ </Grid>
+ </Grid>
+ </Grid>
+ <main:MainStatusBarView
+ Name="StatusBarView"
+ Grid.Row="2" />
+ </Grid>
+ </Grid>
+</window:StyleableWindow> \ No newline at end of file
diff --git a/src/Ryujinx.Ava/UI/Windows/MainWindow.axaml.cs b/src/Ryujinx.Ava/UI/Windows/MainWindow.axaml.cs
new file mode 100644
index 00000000..81e05506
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Windows/MainWindow.axaml.cs
@@ -0,0 +1,441 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Input;
+using Avalonia.Threading;
+using FluentAvalonia.UI.Controls;
+using Ryujinx.Ava.Common;
+using Ryujinx.Ava.Common.Locale;
+using Ryujinx.Ava.Input;
+using Ryujinx.Ava.UI.Applet;
+using Ryujinx.Ava.UI.Helpers;
+using Ryujinx.Ava.UI.ViewModels;
+using Ryujinx.Common.Logging;
+using Ryujinx.Graphics.Gpu;
+using Ryujinx.HLE.FileSystem;
+using Ryujinx.HLE.HOS;
+using Ryujinx.HLE.HOS.Services.Account.Acc;
+using Ryujinx.Input.SDL2;
+using Ryujinx.Modules;
+using Ryujinx.Ui.App.Common;
+using Ryujinx.Ui.Common;
+using Ryujinx.Ui.Common.Configuration;
+using Ryujinx.Ui.Common.Helper;
+using System;
+using System.ComponentModel;
+using System.IO;
+using System.Threading.Tasks;
+using InputManager = Ryujinx.Input.HLE.InputManager;
+
+namespace Ryujinx.Ava.UI.Windows
+{
+ public partial class MainWindow : StyleableWindow
+ {
+ internal static MainWindowViewModel MainWindowViewModel { get; private set; }
+
+ private bool _isLoading;
+
+ private UserChannelPersistence _userChannelPersistence;
+ private static bool _deferLoad;
+ private static string _launchPath;
+ private static bool _startFullscreen;
+ internal readonly AvaHostUiHandler UiHandler;
+
+ public VirtualFileSystem VirtualFileSystem { get; private set; }
+ public ContentManager ContentManager { get; private set; }
+ public AccountManager AccountManager { get; private set; }
+
+ public LibHacHorizonManager LibHacHorizonManager { get; private set; }
+
+ public InputManager InputManager { get; private set; }
+
+ internal MainWindowViewModel ViewModel { get; private set; }
+ public SettingsWindow SettingsWindow { get; set; }
+
+ public static bool ShowKeyErrorOnLoad { get; set; }
+ public ApplicationLibrary ApplicationLibrary { get; set; }
+
+ public MainWindow()
+ {
+ ViewModel = new MainWindowViewModel();
+
+ MainWindowViewModel = ViewModel;
+
+ DataContext = ViewModel;
+
+ InitializeComponent();
+ Load();
+
+ UiHandler = new AvaHostUiHandler(this);
+
+ ViewModel.Title = $"Ryujinx {Program.Version}";
+
+ // NOTE: Height of MenuBar and StatusBar is not usable here, since it would still be 0 at this point.
+ double barHeight = MenuBar.MinHeight + StatusBarView.StatusBar.MinHeight;
+ Height = ((Height - barHeight) / Program.WindowScaleFactor) + barHeight;
+ Width /= Program.WindowScaleFactor;
+
+ if (Program.PreviewerDetached)
+ {
+ Initialize();
+
+ InputManager = new InputManager(new AvaloniaKeyboardDriver(this), new SDL2GamepadDriver());
+
+ ViewModel.Initialize(
+ ContentManager,
+ ApplicationLibrary,
+ VirtualFileSystem,
+ AccountManager,
+ InputManager,
+ _userChannelPersistence,
+ LibHacHorizonManager,
+ UiHandler,
+ ShowLoading,
+ SwitchToGameControl,
+ SetMainContent,
+ this);
+
+ ViewModel.RefreshFirmwareStatus();
+
+ LoadGameList();
+
+ this.GetObservable(IsActiveProperty).Subscribe(IsActiveChanged);
+ }
+
+ ApplicationLibrary.ApplicationCountUpdated += ApplicationLibrary_ApplicationCountUpdated;
+ ApplicationLibrary.ApplicationAdded += ApplicationLibrary_ApplicationAdded;
+ ViewModel.ReloadGameList += ReloadGameList;
+
+ NotificationHelper.SetNotificationManager(this);
+ }
+
+ private void IsActiveChanged(bool obj)
+ {
+ ViewModel.IsActive = obj;
+ }
+
+ public void LoadGameList()
+ {
+ if (_isLoading)
+ {
+ return;
+ }
+
+ _isLoading = true;
+
+ LoadApplications();
+
+ _isLoading = false;
+ }
+
+ protected override void HandleScalingChanged(double scale)
+ {
+ Program.DesktopScaleFactor = scale;
+ base.HandleScalingChanged(scale);
+ }
+
+ public void AddApplication(ApplicationData applicationData)
+ {
+ Dispatcher.UIThread.InvokeAsync(() =>
+ {
+ ViewModel.Applications.Add(applicationData);
+ });
+ }
+
+ private void ApplicationLibrary_ApplicationAdded(object sender, ApplicationAddedEventArgs e)
+ {
+ AddApplication(e.AppData);
+ }
+
+ private void ApplicationLibrary_ApplicationCountUpdated(object sender, ApplicationCountUpdatedEventArgs e)
+ {
+ LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.StatusBarGamesLoaded, e.NumAppsLoaded, e.NumAppsFound);
+
+ Dispatcher.UIThread.Post(() =>
+ {
+ ViewModel.StatusBarProgressValue = e.NumAppsLoaded;
+ ViewModel.StatusBarProgressMaximum = e.NumAppsFound;
+
+ if (e.NumAppsFound == 0)
+ {
+ StatusBarView.LoadProgressBar.IsVisible = false;
+ }
+
+ if (e.NumAppsLoaded == e.NumAppsFound)
+ {
+ StatusBarView.LoadProgressBar.IsVisible = false;
+ }
+ });
+ }
+
+ public void Application_Opened(object sender, ApplicationOpenedEventArgs args)
+ {
+ if (args.Application != null)
+ {
+ ViewModel.SelectedIcon = args.Application.Icon;
+
+ string path = new FileInfo(args.Application.Path).FullName;
+
+ ViewModel.LoadApplication(path);
+ }
+
+ args.Handled = true;
+ }
+
+ internal static void DeferLoadApplication(string launchPathArg, bool startFullscreenArg)
+ {
+ _deferLoad = true;
+ _launchPath = launchPathArg;
+ _startFullscreen = startFullscreenArg;
+ }
+
+ public void SwitchToGameControl(bool startFullscreen = false)
+ {
+ ViewModel.ShowLoadProgress = false;
+ ViewModel.ShowContent = true;
+ ViewModel.IsLoadingIndeterminate = false;
+
+ Dispatcher.UIThread.InvokeAsync(() =>
+ {
+ if (startFullscreen && ViewModel.WindowState != WindowState.FullScreen)
+ {
+ ViewModel.ToggleFullscreen();
+ }
+ });
+ }
+
+ public void ShowLoading(bool startFullscreen = false)
+ {
+ ViewModel.ShowContent = false;
+ ViewModel.ShowLoadProgress = true;
+ ViewModel.IsLoadingIndeterminate = true;
+
+ Dispatcher.UIThread.InvokeAsync(() =>
+ {
+ if (startFullscreen && ViewModel.WindowState != WindowState.FullScreen)
+ {
+ ViewModel.ToggleFullscreen();
+ }
+ });
+ }
+
+ protected override void HandleWindowStateChanged(WindowState state)
+ {
+ ViewModel.WindowState = state;
+
+ if (state != WindowState.Minimized)
+ {
+ Renderer.Start();
+ }
+ }
+
+ private void Initialize()
+ {
+ _userChannelPersistence = new UserChannelPersistence();
+ VirtualFileSystem = VirtualFileSystem.CreateInstance();
+ LibHacHorizonManager = new LibHacHorizonManager();
+ ContentManager = new ContentManager(VirtualFileSystem);
+
+ LibHacHorizonManager.InitializeFsServer(VirtualFileSystem);
+ LibHacHorizonManager.InitializeArpServer();
+ LibHacHorizonManager.InitializeBcatServer();
+ LibHacHorizonManager.InitializeSystemClients();
+
+ ApplicationLibrary = new ApplicationLibrary(VirtualFileSystem);
+
+ // Save data created before we supported extra data in directory save data will not work properly if
+ // given empty extra data. Luckily some of that extra data can be created using the data from the
+ // save data indexer, which should be enough to check access permissions for user saves.
+ // Every single save data's extra data will be checked and fixed if needed each time the emulator is opened.
+ // Consider removing this at some point in the future when we don't need to worry about old saves.
+ VirtualFileSystem.FixExtraData(LibHacHorizonManager.RyujinxClient);
+
+ AccountManager = new AccountManager(LibHacHorizonManager.RyujinxClient, CommandLineState.Profile);
+
+ VirtualFileSystem.ReloadKeySet();
+
+ ApplicationHelper.Initialize(VirtualFileSystem, AccountManager, LibHacHorizonManager.RyujinxClient, this);
+ }
+
+ protected void CheckLaunchState()
+ {
+ if (ShowKeyErrorOnLoad)
+ {
+ ShowKeyErrorOnLoad = false;
+
+ Dispatcher.UIThread.Post(async () => await
+ UserErrorDialog.ShowUserErrorDialog(UserError.NoKeys, this));
+ }
+
+ if (_deferLoad)
+ {
+ _deferLoad = false;
+
+ ViewModel.LoadApplication(_launchPath, _startFullscreen);
+ }
+
+ if (ConfigurationState.Instance.CheckUpdatesOnStart.Value && Updater.CanUpdate(false))
+ {
+ Updater.BeginParse(this, false).ContinueWith(task =>
+ {
+ Logger.Error?.Print(LogClass.Application, $"Updater Error: {task.Exception}");
+ }, TaskContinuationOptions.OnlyOnFaulted);
+ }
+ }
+
+ private void Load()
+ {
+ StatusBarView.VolumeStatus.Click += VolumeStatus_CheckedChanged;
+
+ GameGrid.ApplicationOpened += Application_Opened;
+
+ GameGrid.DataContext = ViewModel;
+
+ GameList.ApplicationOpened += Application_Opened;
+
+ GameList.DataContext = ViewModel;
+
+ LoadHotKeys();
+ }
+
+ protected override void OnOpened(EventArgs e)
+ {
+ base.OnOpened(e);
+
+ CheckLaunchState();
+ }
+
+ private void SetMainContent(Control content = null)
+ {
+ if (content == null)
+ {
+ content = GameLibrary;
+ }
+
+ if (MainContent.Content != content)
+ {
+ MainContent.Content = content;
+ }
+ }
+
+ public static void UpdateGraphicsConfig()
+ {
+ GraphicsConfig.ResScale = ConfigurationState.Instance.Graphics.ResScale == -1 ? ConfigurationState.Instance.Graphics.ResScaleCustom : ConfigurationState.Instance.Graphics.ResScale;
+ GraphicsConfig.MaxAnisotropy = ConfigurationState.Instance.Graphics.MaxAnisotropy;
+ GraphicsConfig.ShadersDumpPath = ConfigurationState.Instance.Graphics.ShadersDumpPath;
+ GraphicsConfig.EnableShaderCache = ConfigurationState.Instance.Graphics.EnableShaderCache;
+ GraphicsConfig.EnableTextureRecompression = ConfigurationState.Instance.Graphics.EnableTextureRecompression;
+ GraphicsConfig.EnableMacroHLE = ConfigurationState.Instance.Graphics.EnableMacroHLE;
+ }
+
+ public void LoadHotKeys()
+ {
+ HotKeyManager.SetHotKey(FullscreenHotKey, new KeyGesture(Key.Enter, KeyModifiers.Alt));
+ HotKeyManager.SetHotKey(FullscreenHotKey2, new KeyGesture(Key.F11));
+ HotKeyManager.SetHotKey(FullscreenHotKeyMacOS, new KeyGesture(Key.F, KeyModifiers.Control | KeyModifiers.Meta));
+ HotKeyManager.SetHotKey(DockToggleHotKey, new KeyGesture(Key.F9));
+ HotKeyManager.SetHotKey(ExitHotKey, new KeyGesture(Key.Escape));
+ }
+
+ private void VolumeStatus_CheckedChanged(object sender, SplitButtonClickEventArgs e)
+ {
+ var volumeSplitButton = sender as ToggleSplitButton;
+ if (ViewModel.IsGameRunning)
+ {
+ if (!volumeSplitButton.IsChecked)
+ {
+ ViewModel.AppHost.Device.SetVolume(ConfigurationState.Instance.System.AudioVolume);
+ }
+ else
+ {
+ ViewModel.AppHost.Device.SetVolume(0);
+ }
+
+ ViewModel.Volume = ViewModel.AppHost.Device.GetVolume();
+ }
+ }
+
+ protected override void OnClosing(CancelEventArgs e)
+ {
+ if (!ViewModel.IsClosing && ViewModel.AppHost != null && ConfigurationState.Instance.ShowConfirmExit)
+ {
+ e.Cancel = true;
+
+ ConfirmExit();
+
+ return;
+ }
+
+ ViewModel.IsClosing = true;
+
+ if (ViewModel.AppHost != null)
+ {
+ ViewModel.AppHost.AppExit -= ViewModel.AppHost_AppExit;
+ ViewModel.AppHost.AppExit += (sender, e) =>
+ {
+ ViewModel.AppHost = null;
+
+ Dispatcher.UIThread.Post(() =>
+ {
+ MainContent = null;
+
+ Close();
+ });
+ };
+ ViewModel.AppHost?.Stop();
+
+ e.Cancel = true;
+
+ return;
+ }
+
+ ApplicationLibrary.CancelLoading();
+ InputManager.Dispose();
+ Program.Exit();
+
+ base.OnClosing(e);
+ }
+
+ private void ConfirmExit()
+ {
+ Dispatcher.UIThread.InvokeAsync(async () =>
+ {
+ ViewModel.IsClosing = await ContentDialogHelper.CreateExitDialog();
+
+ if (ViewModel.IsClosing)
+ {
+ Close();
+ }
+ });
+ }
+
+ public async void LoadApplications()
+ {
+ await Dispatcher.UIThread.InvokeAsync(() =>
+ {
+ ViewModel.Applications.Clear();
+
+ StatusBarView.LoadProgressBar.IsVisible = true;
+ ViewModel.StatusBarProgressMaximum = 0;
+ ViewModel.StatusBarProgressValue = 0;
+
+ LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.StatusBarGamesLoaded, 0, 0);
+ });
+
+ ReloadGameList();
+ }
+
+ private void ReloadGameList()
+ {
+ if (_isLoading)
+ {
+ return;
+ }
+
+ _isLoading = true;
+
+ ApplicationLibrary.LoadApplications(ConfigurationState.Instance.Ui.GameDirs.Value, ConfigurationState.Instance.System.Language);
+
+ _isLoading = false;
+ }
+ }
+} \ No newline at end of file
diff --git a/src/Ryujinx.Ava/UI/Windows/MotionSettingsWindow.axaml b/src/Ryujinx.Ava/UI/Windows/MotionSettingsWindow.axaml
new file mode 100644
index 00000000..862998ac
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Windows/MotionSettingsWindow.axaml
@@ -0,0 +1,141 @@
+<UserControl
+ xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
+ xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
+ mc:Ignorable="d"
+ x:Class="Ryujinx.Ava.UI.Windows.MotionSettingsWindow"
+ Focusable="True">
+ <Grid Margin="10">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition />
+ </Grid.RowDefinitions>
+ <StackPanel Orientation="Vertical">
+ <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
+ <TextBlock
+ Margin="0"
+ HorizontalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsMotionGyroSensitivity}" />
+ <Slider
+ Margin="0,-5,0,-5"
+ Width="150"
+ MaxWidth="150"
+ TickFrequency="0.01"
+ IsSnapToTickEnabled="True"
+ Maximum="100"
+ Minimum="0"
+ Value="{Binding Sensitivity, Mode=TwoWay}" />
+ <TextBlock HorizontalAlignment="Center"
+ Margin="5, 0"
+ Text="{Binding Sensitivity, StringFormat=\{0:0\}%}" />
+ </StackPanel>
+ <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
+ <TextBlock
+ Margin="0"
+ HorizontalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsMotionGyroDeadzone}" />
+ <Slider
+ Margin="0,-5,0,-5"
+ Width="150"
+ MaxWidth="150"
+ TickFrequency="0.01"
+ IsSnapToTickEnabled="True"
+ Maximum="100"
+ Minimum="0"
+ Value="{Binding GyroDeadzone, Mode=TwoWay}" />
+ <TextBlock
+ VerticalAlignment="Center"
+ Margin="5, 0"
+ Text="{Binding GyroDeadzone, StringFormat=\{0:0.00\}}" />
+ </StackPanel>
+ <Separator Height="1" Margin="0,5" />
+ <CheckBox Margin="5" IsChecked="{Binding EnableCemuHookMotion}">
+ <TextBlock Margin="0,3,0,0" VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsMotionUseCemuhookCompatibleMotion}" />
+ </CheckBox>
+ </StackPanel>
+ <Border Grid.Row="1"
+ Padding="20,5"
+ BorderBrush="{DynamicResource ThemeControlBorderColor}"
+ BorderThickness="1"
+ HorizontalAlignment="Stretch">
+ <Grid VerticalAlignment="Top">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+ <StackPanel
+ Grid.Row="1"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Orientation="Vertical">
+ <StackPanel
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Orientation="Horizontal">
+ <TextBlock
+ Margin="5"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsMotionServerHost}" />
+ <TextBox
+ Height="30"
+ MinWidth="100"
+ MaxWidth="100"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{Binding DsuServerHost, Mode=TwoWay}" />
+ <TextBlock
+ Margin="5"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text=":" />
+ <TextBox
+ Height="30"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{Binding DsuServerPort, Mode=TwoWay}" />
+ </StackPanel>
+ <StackPanel Orientation="Vertical">
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition />
+ <RowDefinition />
+ </Grid.RowDefinitions>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition />
+ <ColumnDefinition />
+ </Grid.ColumnDefinitions>
+ <TextBlock Margin="0,10,0,0" VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsMotionControllerSlot}" />
+ <ui:NumberBox Grid.Row="0" Grid.Column="1"
+ Name="CemuHookSlotUpDown"
+ SmallChange="1"
+ LargeChange="1"
+ Maximum="4"
+ Minimum="0"
+ Value="{Binding Slot}" />
+ <TextBlock Margin="0,10,0,0" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsMotionRightJoyConSlot}" />
+ <ui:NumberBox Grid.Row="1" Grid.Column="1"
+ Name="CemuHookRightJoyConSlotUpDown"
+ SmallChange="1"
+ LargeChange="1"
+ Maximum="4"
+ Minimum="0"
+ Value="{Binding AltSlot}" />
+ </Grid>
+ </StackPanel>
+ <CheckBox HorizontalAlignment="Center"
+ IsChecked="{Binding MirrorInput, Mode=TwoWay}">
+ <TextBlock HorizontalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsMotionMirrorInput}" />
+ </CheckBox>
+ </StackPanel>
+ </Grid>
+ </Border>
+ </Grid>
+</UserControl> \ No newline at end of file
diff --git a/src/Ryujinx.Ava/UI/Windows/MotionSettingsWindow.axaml.cs b/src/Ryujinx.Ava/UI/Windows/MotionSettingsWindow.axaml.cs
new file mode 100644
index 00000000..c686e7c3
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Windows/MotionSettingsWindow.axaml.cs
@@ -0,0 +1,71 @@
+using Avalonia.Controls;
+using FluentAvalonia.UI.Controls;
+using Ryujinx.Ava.Common.Locale;
+using Ryujinx.Ava.UI.Models;
+using Ryujinx.Ava.UI.ViewModels;
+using Ryujinx.Common.Configuration.Hid.Controller;
+using System.Threading.Tasks;
+
+namespace Ryujinx.Ava.UI.Windows
+{
+ public partial class MotionSettingsWindow : UserControl
+ {
+ private readonly InputConfiguration<GamepadInputId, StickInputId> _viewmodel;
+
+ public MotionSettingsWindow()
+ {
+ InitializeComponent();
+ DataContext = _viewmodel;
+ }
+
+ public MotionSettingsWindow(ControllerSettingsViewModel viewmodel)
+ {
+ var config = viewmodel.Configuration as InputConfiguration<GamepadInputId, StickInputId>;
+
+ _viewmodel = new InputConfiguration<GamepadInputId, StickInputId>()
+ {
+ Slot = config.Slot,
+ AltSlot = config.AltSlot,
+ DsuServerHost = config.DsuServerHost,
+ DsuServerPort = config.DsuServerPort,
+ MirrorInput = config.MirrorInput,
+ EnableMotion = config.EnableMotion,
+ Sensitivity = config.Sensitivity,
+ GyroDeadzone = config.GyroDeadzone,
+ EnableCemuHookMotion = config.EnableCemuHookMotion
+ };
+
+ InitializeComponent();
+ DataContext = _viewmodel;
+ }
+
+ public static async Task Show(ControllerSettingsViewModel viewmodel)
+ {
+ MotionSettingsWindow content = new MotionSettingsWindow(viewmodel);
+
+ ContentDialog contentDialog = new ContentDialog
+ {
+ Title = LocaleManager.Instance[LocaleKeys.ControllerMotionTitle],
+ PrimaryButtonText = LocaleManager.Instance[LocaleKeys.ControllerSettingsSave],
+ SecondaryButtonText = "",
+ CloseButtonText = LocaleManager.Instance[LocaleKeys.ControllerSettingsClose],
+ Content = content
+ };
+ contentDialog.PrimaryButtonClick += (sender, args) =>
+ {
+ var config = viewmodel.Configuration as InputConfiguration<GamepadInputId, StickInputId>;
+ config.Slot = content._viewmodel.Slot;
+ config.EnableMotion = content._viewmodel.EnableMotion;
+ config.Sensitivity = content._viewmodel.Sensitivity;
+ config.GyroDeadzone = content._viewmodel.GyroDeadzone;
+ config.AltSlot = content._viewmodel.AltSlot;
+ config.DsuServerHost = content._viewmodel.DsuServerHost;
+ config.DsuServerPort = content._viewmodel.DsuServerPort;
+ config.EnableCemuHookMotion = content._viewmodel.EnableCemuHookMotion;
+ config.MirrorInput = content._viewmodel.MirrorInput;
+ };
+
+ await contentDialog.ShowAsync();
+ }
+ }
+} \ No newline at end of file
diff --git a/src/Ryujinx.Ava/UI/Windows/RumbleSettingsWindow.axaml b/src/Ryujinx.Ava/UI/Windows/RumbleSettingsWindow.axaml
new file mode 100644
index 00000000..e47cc5bd
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Windows/RumbleSettingsWindow.axaml
@@ -0,0 +1,57 @@
+<UserControl
+ xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
+ mc:Ignorable="d"
+ x:Class="Ryujinx.Ava.UI.Windows.RumbleSettingsWindow"
+ Focusable="True">
+ <Grid Margin="10">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition />
+ </Grid.RowDefinitions>
+ <StackPanel Orientation="Vertical">
+ <StackPanel Orientation="Horizontal">
+ <TextBlock
+ Width="100"
+ TextWrapping="WrapWithOverflow"
+ HorizontalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsRumbleStrongMultiplier}" />
+ <Slider
+ Margin="0,-5,0,-5"
+ Width="200"
+ TickFrequency="0.01"
+ IsSnapToTickEnabled="True"
+ Maximum="10"
+ Minimum="0"
+ Value="{Binding StrongRumble, Mode=TwoWay}" />
+ <TextBlock
+ VerticalAlignment="Center"
+ Margin="5,0"
+ Text="{Binding StrongRumble, StringFormat=\{0:0.00\}}" />
+ </StackPanel>
+ <StackPanel Orientation="Horizontal">
+ <TextBlock
+ Width="100"
+ TextWrapping="WrapWithOverflow"
+ HorizontalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsRumbleWeakMultiplier}" />
+ <Slider
+ Margin="0,-5,0,-5"
+ Width="200"
+ MaxWidth="200"
+ Maximum="10"
+ TickFrequency="0.01"
+ IsSnapToTickEnabled="True"
+ Minimum="0"
+ Value="{Binding WeakRumble, Mode=TwoWay}" />
+ <TextBlock
+ VerticalAlignment="Center"
+ Margin="5,0"
+ Text="{Binding WeakRumble, StringFormat=\{0:0.00\}}" />
+ </StackPanel>
+ </StackPanel>
+ </Grid>
+</UserControl> \ No newline at end of file
diff --git a/src/Ryujinx.Ava/UI/Windows/RumbleSettingsWindow.axaml.cs b/src/Ryujinx.Ava/UI/Windows/RumbleSettingsWindow.axaml.cs
new file mode 100644
index 00000000..178109d6
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Windows/RumbleSettingsWindow.axaml.cs
@@ -0,0 +1,57 @@
+using Avalonia.Controls;
+using FluentAvalonia.UI.Controls;
+using Ryujinx.Ava.Common.Locale;
+using Ryujinx.Ava.UI.Models;
+using Ryujinx.Ava.UI.ViewModels;
+using Ryujinx.Common.Configuration.Hid.Controller;
+using System.Threading.Tasks;
+
+namespace Ryujinx.Ava.UI.Windows
+{
+ public partial class RumbleSettingsWindow : UserControl
+ {
+ private readonly InputConfiguration<GamepadInputId, StickInputId> _viewmodel;
+
+ public RumbleSettingsWindow()
+ {
+ InitializeComponent();
+ DataContext = _viewmodel;
+ }
+
+ public RumbleSettingsWindow(ControllerSettingsViewModel viewmodel)
+ {
+ var config = viewmodel.Configuration as InputConfiguration<GamepadInputId, StickInputId>;
+
+ _viewmodel = new InputConfiguration<GamepadInputId, StickInputId>()
+ {
+ StrongRumble = config.StrongRumble, WeakRumble = config.WeakRumble
+ };
+
+ InitializeComponent();
+ DataContext = _viewmodel;
+ }
+
+ public static async Task Show(ControllerSettingsViewModel viewmodel)
+ {
+ RumbleSettingsWindow content = new RumbleSettingsWindow(viewmodel);
+
+ ContentDialog contentDialog = new ContentDialog
+ {
+ Title = LocaleManager.Instance[LocaleKeys.ControllerRumbleTitle],
+ PrimaryButtonText = LocaleManager.Instance[LocaleKeys.ControllerSettingsSave],
+ SecondaryButtonText = "",
+ CloseButtonText = LocaleManager.Instance[LocaleKeys.ControllerSettingsClose],
+ Content = content,
+ };
+
+ contentDialog.PrimaryButtonClick += (sender, args) =>
+ {
+ var config = viewmodel.Configuration as InputConfiguration<GamepadInputId, StickInputId>;
+ config.StrongRumble = content._viewmodel.StrongRumble;
+ config.WeakRumble = content._viewmodel.WeakRumble;
+ };
+
+ await contentDialog.ShowAsync();
+ }
+ }
+} \ No newline at end of file
diff --git a/src/Ryujinx.Ava/UI/Windows/SettingsWindow.axaml b/src/Ryujinx.Ava/UI/Windows/SettingsWindow.axaml
new file mode 100644
index 00000000..a44cbfe7
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Windows/SettingsWindow.axaml
@@ -0,0 +1,128 @@
+<window:StyleableWindow
+ x:Class="Ryujinx.Ava.UI.Windows.SettingsWindow"
+ xmlns="https://github.com/avaloniaui"
+ xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:window="clr-namespace:Ryujinx.Ava.UI.Windows"
+ xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
+ xmlns:settings="clr-namespace:Ryujinx.Ava.UI.Views.Settings"
+ xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
+ Width="1100"
+ Height="768"
+ MinWidth="800"
+ MinHeight="480"
+ WindowStartupLocation="CenterOwner"
+ x:CompileBindings="True"
+ x:DataType="viewModels:SettingsViewModel"
+ mc:Ignorable="d"
+ Focusable="True">
+ <Design.DataContext>
+ <viewModels:SettingsViewModel />
+ </Design.DataContext>
+ <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MinWidth="600">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <ContentPresenter
+ x:Name="ContentPresenter"
+ Grid.Row="1"
+ IsVisible="False"
+ KeyboardNavigation.IsTabStop="False"/>
+ <Grid Name="Pages" IsVisible="False" Grid.Row="2">
+ <settings:SettingsUIView Name="UiPage" />
+ <settings:SettingsInputView Name="InputPage" />
+ <settings:SettingsHotkeysView Name="HotkeysPage" />
+ <settings:SettingsSystemView Name="SystemPage" />
+ <settings:SettingsCPUView Name="CpuPage" />
+ <settings:SettingsGraphicsView Name="GraphicsPage" />
+ <settings:SettingsAudioView Name="AudioPage" />
+ <settings:SettingsNetworkView Name="NetworkPage" />
+ <settings:SettingsLoggingView Name="LoggingPage" />
+ </Grid>
+ <ui:NavigationView
+ Grid.Row="1"
+ IsSettingsVisible="False"
+ Name="NavPanel"
+ IsBackEnabled="False"
+ PaneDisplayMode="Left"
+ Margin="2,10,10,0"
+ VerticalAlignment="Stretch"
+ HorizontalAlignment="Stretch"
+ OpenPaneLength="200">
+ <ui:NavigationView.MenuItems>
+ <ui:NavigationViewItem
+ IsSelected="True"
+ Content="{locale:Locale SettingsTabGeneral}"
+ Tag="UiPage"
+ Icon="New" />
+ <ui:NavigationViewItem
+ Content="{locale:Locale SettingsTabInput}"
+ Tag="InputPage"
+ Icon="Games" />
+ <ui:NavigationViewItem
+ Content="{locale:Locale SettingsTabHotkeys}"
+ Tag="HotkeysPage"
+ Icon="Keyboard" />
+ <ui:NavigationViewItem
+ Content="{locale:Locale SettingsTabSystem}"
+ Tag="SystemPage"
+ Icon="Settings" />
+ <ui:NavigationViewItem
+ Content="{locale:Locale SettingsTabCpu}"
+ Tag="CpuPage">
+ <ui:NavigationViewItem.Icon>
+ <ui:FontIcon
+ FontFamily="avares://Ryujinx.Ava/Assets/Fonts#Segoe Fluent Icons"
+ Glyph="{helpers:GlyphValueConverter Chip}" />
+ </ui:NavigationViewItem.Icon>
+ </ui:NavigationViewItem>
+ <ui:NavigationViewItem
+ Content="{locale:Locale SettingsTabGraphics}"
+ Tag="GraphicsPage"
+ Icon="Image" />
+ <ui:NavigationViewItem
+ Content="{locale:Locale SettingsTabAudio}"
+ Icon="Audio"
+ Tag="AudioPage" />
+ <ui:NavigationViewItem
+ Content="{locale:Locale SettingsTabNetwork}"
+ Tag="NetworkPage"
+ Icon="Globe" />
+ <ui:NavigationViewItem
+ Content="{locale:Locale SettingsTabLogging}"
+ Tag="LoggingPage"
+ Icon="Document" />
+ </ui:NavigationView.MenuItems>
+ <ui:NavigationView.Styles>
+ <Style Selector="Grid#PlaceholderGrid">
+ <Setter Property="Height" Value="40" />
+ </Style>
+ </ui:NavigationView.Styles>
+ </ui:NavigationView>
+ <ReversibleStackPanel
+ Grid.Row="2"
+ Margin="10"
+ Spacing="10"
+ Orientation="Horizontal"
+ HorizontalAlignment="Right"
+ ReverseOrder="{Binding IsMacOS}">
+ <Button
+ HotKey="Enter"
+ Classes="accent"
+ Content="{locale:Locale SettingsButtonOk}"
+ Command="{ReflectionBinding OkButton}" />
+ <Button
+ HotKey="Escape"
+ Content="{locale:Locale SettingsButtonCancel}"
+ Command="{ReflectionBinding CancelButton}" />
+ <Button
+ Content="{locale:Locale SettingsButtonApply}"
+ Command="{ReflectionBinding ApplyButton}" />
+ </ReversibleStackPanel>
+ </Grid>
+</window:StyleableWindow> \ No newline at end of file
diff --git a/src/Ryujinx.Ava/UI/Windows/SettingsWindow.axaml.cs b/src/Ryujinx.Ava/UI/Windows/SettingsWindow.axaml.cs
new file mode 100644
index 00000000..bdf7e94d
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Windows/SettingsWindow.axaml.cs
@@ -0,0 +1,103 @@
+using FluentAvalonia.Core;
+using FluentAvalonia.UI.Controls;
+using Ryujinx.Ava.Common.Locale;
+using Ryujinx.Ava.UI.ViewModels;
+using Ryujinx.HLE.FileSystem;
+using System;
+using System.ComponentModel;
+
+namespace Ryujinx.Ava.UI.Windows
+{
+ public partial class SettingsWindow : StyleableWindow
+ {
+ internal SettingsViewModel ViewModel { get; set; }
+
+ public SettingsWindow(VirtualFileSystem virtualFileSystem, ContentManager contentManager)
+ {
+ Title = $"Ryujinx {Program.Version} - {LocaleManager.Instance[LocaleKeys.Settings]}";
+
+ ViewModel = new SettingsViewModel(virtualFileSystem, contentManager);
+ DataContext = ViewModel;
+
+ ViewModel.CloseWindow += Close;
+ ViewModel.SaveSettingsEvent += SaveSettings;
+
+ InitializeComponent();
+ Load();
+ }
+
+ public SettingsWindow()
+ {
+ ViewModel = new SettingsViewModel();
+ DataContext = ViewModel;
+
+ InitializeComponent();
+ Load();
+ }
+
+ public void SaveSettings()
+ {
+ InputPage.ControllerSettings?.SaveCurrentProfile();
+
+ if (Owner is MainWindow window && ViewModel.DirectoryChanged)
+ {
+ window.ViewModel.LoadApplications();
+ }
+ }
+
+ private void Load()
+ {
+ Pages.Children.Clear();
+ NavPanel.SelectionChanged += NavPanelOnSelectionChanged;
+ NavPanel.SelectedItem = NavPanel.MenuItems.ElementAt(0);
+ }
+
+ private void NavPanelOnSelectionChanged(object sender, NavigationViewSelectionChangedEventArgs e)
+ {
+ if (e.SelectedItem is NavigationViewItem navItem && navItem.Tag is not null)
+ {
+ switch (navItem.Tag.ToString())
+ {
+ case "UiPage":
+ UiPage.ViewModel = ViewModel;
+ NavPanel.Content = UiPage;
+ break;
+ case "InputPage":
+ NavPanel.Content = InputPage;
+ break;
+ case "HotkeysPage":
+ NavPanel.Content = HotkeysPage;
+ break;
+ case "SystemPage":
+ SystemPage.ViewModel = ViewModel;
+ NavPanel.Content = SystemPage;
+ break;
+ case "CpuPage":
+ NavPanel.Content = CpuPage;
+ break;
+ case "GraphicsPage":
+ NavPanel.Content = GraphicsPage;
+ break;
+ case "AudioPage":
+ NavPanel.Content = AudioPage;
+ break;
+ case "NetworkPage":
+ NavPanel.Content = NetworkPage;
+ break;
+ case "LoggingPage":
+ NavPanel.Content = LoggingPage;
+ break;
+ default:
+ throw new NotImplementedException();
+ }
+ }
+ }
+
+ protected override void OnClosing(CancelEventArgs e)
+ {
+ HotkeysPage.Dispose();
+ InputPage.Dispose();
+ base.OnClosing(e);
+ }
+ }
+} \ No newline at end of file
diff --git a/src/Ryujinx.Ava/UI/Windows/StyleableWindow.cs b/src/Ryujinx.Ava/UI/Windows/StyleableWindow.cs
new file mode 100644
index 00000000..a157f154
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Windows/StyleableWindow.cs
@@ -0,0 +1,39 @@
+using Avalonia.Controls;
+using Avalonia.Controls.Primitives;
+using Avalonia.Media.Imaging;
+using Avalonia.Platform;
+using System;
+using System.IO;
+using System.Reflection;
+
+namespace Ryujinx.Ava.UI.Windows
+{
+ public class StyleableWindow : Window
+ {
+ public IBitmap IconImage { get; set; }
+
+ public StyleableWindow()
+ {
+ WindowStartupLocation = WindowStartupLocation.CenterOwner;
+ TransparencyLevelHint = WindowTransparencyLevel.None;
+
+ using Stream stream = Assembly.GetAssembly(typeof(Ryujinx.Ui.Common.Configuration.ConfigurationState)).GetManifestResourceStream("Ryujinx.Ui.Common.Resources.Logo_Ryujinx.png");
+
+ Icon = new WindowIcon(stream);
+ stream.Position = 0;
+ IconImage = new Bitmap(stream);
+ }
+
+ protected override void OnOpened(EventArgs e)
+ {
+ base.OnOpened(e);
+ }
+
+ protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
+ {
+ base.OnApplyTemplate(e);
+
+ ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.SystemChrome | ExtendClientAreaChromeHints.OSXThickTitleBar;
+ }
+ }
+} \ No newline at end of file
diff --git a/src/Ryujinx.Ava/UI/Windows/TitleUpdateWindow.axaml b/src/Ryujinx.Ava/UI/Windows/TitleUpdateWindow.axaml
new file mode 100644
index 00000000..e9858038
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Windows/TitleUpdateWindow.axaml
@@ -0,0 +1,135 @@
+<UserControl
+ x:Class="Ryujinx.Ava.UI.Windows.TitleUpdateWindow"
+ xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
+ xmlns:models="clr-namespace:Ryujinx.Ava.UI.Models"
+ xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
+ Width="500"
+ Height="300"
+ mc:Ignorable="d"
+ x:CompileBindings="True"
+ x:DataType="viewModels:TitleUpdateViewModel"
+ Focusable="True">
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="*" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+ <Border
+ Grid.Row="0"
+ Margin="0 0 0 24"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch"
+ BorderBrush="{DynamicResource AppListHoverBackgroundColor}"
+ BorderThickness="1"
+ CornerRadius="5"
+ Padding="2.5">
+ <ListBox
+ VirtualizationMode="None"
+ Background="Transparent"
+ SelectedItem="{Binding SelectedUpdate, Mode=TwoWay}"
+ Items="{Binding Views}">
+ <ListBox.DataTemplates>
+ <DataTemplate
+ DataType="models:TitleUpdateModel">
+ <Panel Margin="10">
+ <TextBlock
+ HorizontalAlignment="Left"
+ VerticalAlignment="Center"
+ TextWrapping="Wrap"
+ Text="{Binding Label}" />
+ <StackPanel
+ Spacing="10"
+ Orientation="Horizontal"
+ HorizontalAlignment="Right">
+ <Button
+ VerticalAlignment="Center"
+ HorizontalAlignment="Right"
+ Padding="10"
+ MinWidth="0"
+ MinHeight="0"
+ Click="OpenLocation">
+ <ui:SymbolIcon
+ Symbol="OpenFolder"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center" />
+ </Button>
+ <Button
+ VerticalAlignment="Center"
+ HorizontalAlignment="Right"
+ Padding="10"
+ MinWidth="0"
+ MinHeight="0"
+ Click="RemoveUpdate">
+ <ui:SymbolIcon
+ Symbol="Cancel"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center" />
+ </Button>
+ </StackPanel>
+ </Panel>
+ </DataTemplate>
+ <DataTemplate
+ DataType="viewModels:BaseModel">
+ <Panel
+ Height="33"
+ Margin="10">
+ <TextBlock
+ HorizontalAlignment="Left"
+ VerticalAlignment="Center"
+ TextWrapping="Wrap"
+ Text="{locale:Locale NoUpdate}" />
+ </Panel>
+ </DataTemplate>
+ </ListBox.DataTemplates>
+ <ListBox.Styles>
+ <Style Selector="ListBoxItem">
+ <Setter Property="Background" Value="Transparent" />
+ </Style>
+ </ListBox.Styles>
+ </ListBox>
+ </Border>
+ <Panel
+ Grid.Row="1"
+ HorizontalAlignment="Stretch">
+ <StackPanel
+ Orientation="Horizontal"
+ Spacing="10"
+ HorizontalAlignment="Left">
+ <Button
+ Name="AddButton"
+ MinWidth="90"
+ Command="{ReflectionBinding Add}">
+ <TextBlock Text="{locale:Locale SettingsTabGeneralAdd}" />
+ </Button>
+ <Button
+ Name="RemoveAllButton"
+ MinWidth="90"
+ Click="RemoveAll">
+ <TextBlock Text="{locale:Locale DlcManagerRemoveAllButton}" />
+ </Button>
+ </StackPanel>
+ <StackPanel
+ Orientation="Horizontal"
+ Spacing="10"
+ HorizontalAlignment="Right">
+ <Button
+ Name="SaveButton"
+ MinWidth="90"
+ Click="Save">
+ <TextBlock Text="{locale:Locale SettingsButtonSave}" />
+ </Button>
+ <Button
+ Name="CancelButton"
+ MinWidth="90"
+ Click="Close">
+ <TextBlock Text="{locale:Locale InputDialogCancel}" />
+ </Button>
+ </StackPanel>
+ </Panel>
+ </Grid>
+</UserControl> \ No newline at end of file
diff --git a/src/Ryujinx.Ava/UI/Windows/TitleUpdateWindow.axaml.cs b/src/Ryujinx.Ava/UI/Windows/TitleUpdateWindow.axaml.cs
new file mode 100644
index 00000000..153ce95d
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Windows/TitleUpdateWindow.axaml.cs
@@ -0,0 +1,96 @@
+using Avalonia.Controls;
+using Avalonia.Interactivity;
+using Avalonia.Styling;
+using FluentAvalonia.UI.Controls;
+using Ryujinx.Ava.Common.Locale;
+using Ryujinx.Ava.UI.Helpers;
+using Ryujinx.Ava.UI.Models;
+using Ryujinx.Ava.UI.ViewModels;
+using Ryujinx.HLE.FileSystem;
+using Ryujinx.Ui.Common.Helper;
+using System.Threading.Tasks;
+using Button = Avalonia.Controls.Button;
+
+namespace Ryujinx.Ava.UI.Windows
+{
+ public partial class TitleUpdateWindow : UserControl
+ {
+ public TitleUpdateViewModel ViewModel;
+
+ public TitleUpdateWindow()
+ {
+ DataContext = this;
+
+ InitializeComponent();
+ }
+
+ public TitleUpdateWindow(VirtualFileSystem virtualFileSystem, ulong titleId, string titleName)
+ {
+ DataContext = ViewModel = new TitleUpdateViewModel(virtualFileSystem, titleId, titleName);
+
+ InitializeComponent();
+ }
+
+ public static async Task Show(VirtualFileSystem virtualFileSystem, ulong titleId, string titleName)
+ {
+ ContentDialog contentDialog = new()
+ {
+ PrimaryButtonText = "",
+ SecondaryButtonText = "",
+ CloseButtonText = "",
+ Content = new TitleUpdateWindow(virtualFileSystem, titleId, titleName),
+ Title = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.GameUpdateWindowHeading, titleName, titleId.ToString("X16"))
+ };
+
+ Style bottomBorder = new(x => x.OfType<Grid>().Name("DialogSpace").Child().OfType<Border>());
+ bottomBorder.Setters.Add(new Setter(IsVisibleProperty, false));
+
+ contentDialog.Styles.Add(bottomBorder);
+
+ await ContentDialogHelper.ShowAsync(contentDialog);
+ }
+
+ private void Close(object sender, RoutedEventArgs e)
+ {
+ ((ContentDialog)Parent).Hide();
+ }
+
+ public void Save(object sender, RoutedEventArgs e)
+ {
+ ViewModel.Save();
+
+ if (VisualRoot is MainWindow window)
+ {
+ window.ViewModel.LoadApplications();
+ }
+
+ ((ContentDialog)Parent).Hide();
+ }
+
+ private void OpenLocation(object sender, RoutedEventArgs e)
+ {
+ if (sender is Button button)
+ {
+ if (button.DataContext is TitleUpdateModel model)
+ {
+ OpenHelper.LocateFile(model.Path);
+ }
+ }
+ }
+
+ private void RemoveUpdate(object sender, RoutedEventArgs e)
+ {
+ if (sender is Button button)
+ {
+ ViewModel.RemoveUpdate((TitleUpdateModel)button.DataContext);
+ }
+ }
+
+ private void RemoveAll(object sender, RoutedEventArgs e)
+ {
+ ViewModel.TitleUpdates.Clear();
+
+ ViewModel.SortUpdates();
+ }
+ }
+} \ No newline at end of file