aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Ava/Ui/Controls
diff options
context:
space:
mode:
authorIsaac Marovitz <42140194+IsaacMarovitz@users.noreply.github.com>2022-12-29 14:24:05 +0000
committerGitHub <noreply@github.com>2022-12-29 15:24:05 +0100
commit76671d63d4f3ea18f8ad99e9ce9f0b2ec9a2599d (patch)
tree05013214e4696a9254369d0706173f58877f6a83 /Ryujinx.Ava/Ui/Controls
parent3d1a0bf3749afa14da5b5ba1e0666fdb78c99beb (diff)
Ava GUI: Restructure `Ryujinx.Ava` (#4165)
* Restructure `Ryujinx.Ava` * Stylistic consistency * Update Ryujinx.Ava/UI/Controls/UserEditor.axaml.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Controls/UserEditor.axaml.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Controls/UserSelector.axaml.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Controls/SaveManager.axaml.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Controls/SaveManager.axaml.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Windows/SettingsWindow.axaml.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Helpers/EmbeddedWindow.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Helpers/EmbeddedWindow.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Helpers/EmbeddedWindow.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Helpers/EmbeddedWindow.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Windows/SettingsWindow.axaml.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/ViewModels/UserProfileViewModel.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/ViewModels/UserProfileViewModel.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Update Ryujinx.Ava/UI/Helpers/EmbeddedWindow.cs Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com> * Fix redundancies * Remove redunancies * Add back elses Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com>
Diffstat (limited to 'Ryujinx.Ava/Ui/Controls')
-rw-r--r--Ryujinx.Ava/Ui/Controls/ApplicationOpenedEventArgs.cs16
-rw-r--r--Ryujinx.Ava/Ui/Controls/AvaloniaGlxContext.cs16
-rw-r--r--Ryujinx.Ava/Ui/Controls/AvaloniaWglContext.cs16
-rw-r--r--Ryujinx.Ava/Ui/Controls/BitmapArrayValueConverter.cs35
-rw-r--r--Ryujinx.Ava/Ui/Controls/ButtonKeyAssigner.cs118
-rw-r--r--Ryujinx.Ava/Ui/Controls/ContentDialogHelper.cs401
-rw-r--r--Ryujinx.Ava/Ui/Controls/EmbeddedWindow.cs233
-rw-r--r--Ryujinx.Ava/Ui/Controls/GameGridView.axaml195
-rw-r--r--Ryujinx.Ava/Ui/Controls/GameGridView.axaml.cs82
-rw-r--r--Ryujinx.Ava/Ui/Controls/GameListView.axaml235
-rw-r--r--Ryujinx.Ava/Ui/Controls/GameListView.axaml.cs82
-rw-r--r--Ryujinx.Ava/Ui/Controls/Glyph.cs9
-rw-r--r--Ryujinx.Ava/Ui/Controls/GlyphValueConverter.cs49
-rw-r--r--Ryujinx.Ava/Ui/Controls/HotKeyControl.cs52
-rw-r--r--Ryujinx.Ava/Ui/Controls/IGlContextExtension.cs25
-rw-r--r--Ryujinx.Ava/Ui/Controls/InputDialog.axaml32
-rw-r--r--Ryujinx.Ava/Ui/Controls/InputDialog.axaml.cs56
-rw-r--r--Ryujinx.Ava/Ui/Controls/KeyValueConverter.cs46
-rw-r--r--Ryujinx.Ava/Ui/Controls/MiniCommand.cs71
-rw-r--r--Ryujinx.Ava/Ui/Controls/NavigationDialogHost.axaml11
-rw-r--r--Ryujinx.Ava/Ui/Controls/NavigationDialogHost.axaml.cs91
-rw-r--r--Ryujinx.Ava/Ui/Controls/OffscreenTextBox.cs40
-rw-r--r--Ryujinx.Ava/Ui/Controls/OpenGLEmbeddedWindow.cs85
-rw-r--r--Ryujinx.Ava/Ui/Controls/OpenToolkitBindingsContext.cs20
-rw-r--r--Ryujinx.Ava/Ui/Controls/ProfileImageSelectionDialog.axaml32
-rw-r--r--Ryujinx.Ava/Ui/Controls/ProfileImageSelectionDialog.axaml.cs105
-rw-r--r--Ryujinx.Ava/Ui/Controls/RendererHost.axaml8
-rw-r--r--Ryujinx.Ava/Ui/Controls/RendererHost.axaml.cs126
-rw-r--r--Ryujinx.Ava/Ui/Controls/SPBOpenGLContext.cs47
-rw-r--r--Ryujinx.Ava/Ui/Controls/SaveManager.axaml103
-rw-r--r--Ryujinx.Ava/Ui/Controls/SaveManager.axaml.cs160
-rw-r--r--Ryujinx.Ava/Ui/Controls/UpdateWaitWindow.axaml43
-rw-r--r--Ryujinx.Ava/Ui/Controls/UpdateWaitWindow.axaml.cs20
-rw-r--r--Ryujinx.Ava/Ui/Controls/UserEditor.axaml89
-rw-r--r--Ryujinx.Ava/Ui/Controls/UserEditor.axaml.cs117
-rw-r--r--Ryujinx.Ava/Ui/Controls/UserErrorDialog.cs91
-rw-r--r--Ryujinx.Ava/Ui/Controls/UserRecoverer.axaml71
-rw-r--r--Ryujinx.Ava/Ui/Controls/UserRecoverer.axaml.cs44
-rw-r--r--Ryujinx.Ava/Ui/Controls/UserResult.cs12
-rw-r--r--Ryujinx.Ava/Ui/Controls/UserSelector.axaml146
-rw-r--r--Ryujinx.Ava/Ui/Controls/UserSelector.axaml.cs77
-rw-r--r--Ryujinx.Ava/Ui/Controls/VulkanEmbeddedWindow.cs53
-rw-r--r--Ryujinx.Ava/Ui/Controls/Win32NativeInterop.cs107
43 files changed, 0 insertions, 3467 deletions
diff --git a/Ryujinx.Ava/Ui/Controls/ApplicationOpenedEventArgs.cs b/Ryujinx.Ava/Ui/Controls/ApplicationOpenedEventArgs.cs
deleted file mode 100644
index 9909bd6a..00000000
--- a/Ryujinx.Ava/Ui/Controls/ApplicationOpenedEventArgs.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using Avalonia.Interactivity;
-using Ryujinx.Ui.App.Common;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- public class ApplicationOpenedEventArgs : RoutedEventArgs
- {
- public ApplicationData Application { get; }
-
- public ApplicationOpenedEventArgs(ApplicationData application, RoutedEvent routedEvent)
- {
- Application = application;
- RoutedEvent = routedEvent;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/AvaloniaGlxContext.cs b/Ryujinx.Ava/Ui/Controls/AvaloniaGlxContext.cs
deleted file mode 100644
index d48de41d..00000000
--- a/Ryujinx.Ava/Ui/Controls/AvaloniaGlxContext.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using SPB.Graphics;
-using System;
-using System.Runtime.Versioning;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- [SupportedOSPlatform("linux")]
- internal class AvaloniaGlxContext : SPB.Platform.GLX.GLXOpenGLContext
- {
- public AvaloniaGlxContext(IntPtr handle)
- : base(FramebufferFormat.Default, 0, 0, 0, false, null)
- {
- ContextHandle = handle;
- }
- }
-}
diff --git a/Ryujinx.Ava/Ui/Controls/AvaloniaWglContext.cs b/Ryujinx.Ava/Ui/Controls/AvaloniaWglContext.cs
deleted file mode 100644
index 01e9b920..00000000
--- a/Ryujinx.Ava/Ui/Controls/AvaloniaWglContext.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using SPB.Graphics;
-using System;
-using System.Runtime.Versioning;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- [SupportedOSPlatform("windows")]
- internal class AvaloniaWglContext : SPB.Platform.WGL.WGLOpenGLContext
- {
- public AvaloniaWglContext(IntPtr handle)
- : base(FramebufferFormat.Default, 0, 0, 0, false, null)
- {
- ContextHandle = handle;
- }
- }
-}
diff --git a/Ryujinx.Ava/Ui/Controls/BitmapArrayValueConverter.cs b/Ryujinx.Ava/Ui/Controls/BitmapArrayValueConverter.cs
deleted file mode 100644
index d037e5f1..00000000
--- a/Ryujinx.Ava/Ui/Controls/BitmapArrayValueConverter.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using Avalonia.Data.Converters;
-using Avalonia.Media;
-using Avalonia.Media.Imaging;
-using System;
-using System.Globalization;
-using System.IO;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- internal class BitmapArrayValueConverter : IValueConverter
- {
- public static BitmapArrayValueConverter Instance = new();
-
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value == null)
- {
- return null;
- }
-
- if (value is byte[] buffer && targetType == typeof(IImage))
- {
- MemoryStream mem = new(buffer);
- return new Bitmap(mem);
- }
-
- throw new NotSupportedException();
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotSupportedException();
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/ButtonKeyAssigner.cs b/Ryujinx.Ava/Ui/Controls/ButtonKeyAssigner.cs
deleted file mode 100644
index a83ef961..00000000
--- a/Ryujinx.Ava/Ui/Controls/ButtonKeyAssigner.cs
+++ /dev/null
@@ -1,118 +0,0 @@
-using Avalonia.Controls;
-using Avalonia.Controls.Primitives;
-using Avalonia.LogicalTree;
-using Avalonia.Threading;
-using Ryujinx.Input;
-using Ryujinx.Input.Assigner;
-using System;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- internal class ButtonKeyAssigner
- {
- internal class ButtonAssignedEventArgs : EventArgs
- {
- public ToggleButton Button { get; }
- public bool IsAssigned { get; }
-
- public ButtonAssignedEventArgs(ToggleButton button, bool isAssigned)
- {
- Button = button;
- IsAssigned = isAssigned;
- }
- }
-
- public ToggleButton ToggledButton { get; set; }
-
- private bool _isWaitingForInput;
- private bool _shouldUnbind;
- public event EventHandler<ButtonAssignedEventArgs> ButtonAssigned;
-
- public ButtonKeyAssigner(ToggleButton toggleButton)
- {
- ToggledButton = toggleButton;
- }
-
- public async void GetInputAndAssign(IButtonAssigner assigner, IKeyboard keyboard = null)
- {
- Dispatcher.UIThread.Post(() =>
- {
- ToggledButton.IsChecked = true;
- });
-
- if (_isWaitingForInput)
- {
- Dispatcher.UIThread.Post(() =>
- {
- Cancel();
- });
-
- return;
- }
-
- _isWaitingForInput = true;
-
- assigner.Initialize();
-
- await Task.Run(async () =>
- {
- while (true)
- {
- if (!_isWaitingForInput)
- {
- return;
- }
-
- await Task.Delay(10);
-
- assigner.ReadInput();
-
- if (assigner.HasAnyButtonPressed() || assigner.ShouldCancel() || (keyboard != null && keyboard.IsPressed(Key.Escape)))
- {
- break;
- }
- }
- });
-
- await Dispatcher.UIThread.InvokeAsync(() =>
- {
- string pressedButton = assigner.GetPressedButton();
-
- if (_shouldUnbind)
- {
- SetButtonText(ToggledButton, "Unbound");
- }
- else if (pressedButton != "")
- {
- SetButtonText(ToggledButton, pressedButton);
- }
-
- _shouldUnbind = false;
- _isWaitingForInput = false;
-
- ToggledButton.IsChecked = false;
-
- ButtonAssigned?.Invoke(this, new ButtonAssignedEventArgs(ToggledButton, pressedButton != null));
-
- static void SetButtonText(ToggleButton button, string text)
- {
- ILogical textBlock = button.GetLogicalDescendants().First(x => x is TextBlock);
-
- if (textBlock != null && textBlock is TextBlock block)
- {
- block.Text = text;
- }
- }
- });
- }
-
- public void Cancel(bool shouldUnbind = false)
- {
- _isWaitingForInput = false;
- ToggledButton.IsChecked = false;
- _shouldUnbind = shouldUnbind;
- }
- }
-}
diff --git a/Ryujinx.Ava/Ui/Controls/ContentDialogHelper.cs b/Ryujinx.Ava/Ui/Controls/ContentDialogHelper.cs
deleted file mode 100644
index eca47644..00000000
--- a/Ryujinx.Ava/Ui/Controls/ContentDialogHelper.cs
+++ /dev/null
@@ -1,401 +0,0 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Controls.ApplicationLifetimes;
-using Avalonia.Controls.Primitives;
-using Avalonia.Media;
-using Avalonia.Threading;
-using FluentAvalonia.Core;
-using FluentAvalonia.UI.Controls;
-using Ryujinx.Ava.Common.Locale;
-using Ryujinx.Ava.Ui.Models;
-using Ryujinx.Ava.Ui.Windows;
-using Ryujinx.Common.Logging;
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- public static class ContentDialogHelper
- {
- private static bool _isChoiceDialogOpen;
-
- private async static Task<UserResult> ShowContentDialog(
- string title,
- string primaryText,
- string secondaryText,
- string primaryButton,
- string secondaryButton,
- string closeButton,
- int iconSymbol,
- UserResult primaryButtonResult = UserResult.Ok,
- ManualResetEvent deferResetEvent = null,
- Func<Window, Task> doWhileDeferred = null,
- TypedEventHandler<ContentDialog, ContentDialogButtonClickEventArgs> deferCloseAction = null)
- {
- UserResult result = UserResult.None;
-
- bool useOverlay = false;
- Window mainWindow = null;
-
- if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime al)
- {
- foreach (var item in al.Windows)
- {
- if (item.IsActive && item is MainWindow window && window.ViewModel.IsGameRunning)
- {
- mainWindow = window;
- useOverlay = true;
- break;
- }
- }
- }
-
- ContentDialog contentDialog = null;
- ContentDialogOverlayWindow overlay = null;
-
- if (useOverlay)
- {
- overlay = new ContentDialogOverlayWindow()
- {
- Height = mainWindow.Bounds.Height,
- Width = mainWindow.Bounds.Width,
- Position = mainWindow.PointToScreen(new Point())
- };
-
- mainWindow.PositionChanged += OverlayOnPositionChanged;
-
- void OverlayOnPositionChanged(object sender, PixelPointEventArgs e)
- {
- overlay.Position = mainWindow.PointToScreen(new Point());
- }
-
- contentDialog = overlay.ContentDialog;
-
- bool opened = false;
-
- overlay.Opened += OverlayOnActivated;
-
- async void OverlayOnActivated(object sender, EventArgs e)
- {
- if (opened)
- {
- return;
- }
-
- opened = true;
-
- overlay.Position = mainWindow.PointToScreen(new Point());
-
- await ShowDialog();
- }
-
- await overlay.ShowDialog(mainWindow);
- }
- else
- {
- contentDialog = new ContentDialog();
-
- await ShowDialog();
- }
-
- async Task ShowDialog()
- {
- contentDialog.Title = title;
- contentDialog.PrimaryButtonText = primaryButton;
- contentDialog.SecondaryButtonText = secondaryButton;
- contentDialog.CloseButtonText = closeButton;
- contentDialog.Content = CreateDialogTextContent(primaryText, secondaryText, iconSymbol);
-
- contentDialog.PrimaryButtonCommand = MiniCommand.Create(() =>
- {
- result = primaryButtonResult;
- });
- contentDialog.SecondaryButtonCommand = MiniCommand.Create(() =>
- {
- result = UserResult.No;
- contentDialog.PrimaryButtonClick -= deferCloseAction;
- });
- contentDialog.CloseButtonCommand = MiniCommand.Create(() =>
- {
- result = UserResult.Cancel;
- contentDialog.PrimaryButtonClick -= deferCloseAction;
- });
-
- if (deferResetEvent != null)
- {
- contentDialog.PrimaryButtonClick += deferCloseAction;
- }
-
- if (useOverlay)
- {
- await contentDialog.ShowAsync(overlay, ContentDialogPlacement.Popup);
-
- overlay!.Close();
- }
- else
- {
- await contentDialog.ShowAsync(ContentDialogPlacement.Popup);
- }
- }
-
- if (useOverlay)
- {
- overlay.Content = null;
- overlay.Close();
- }
-
- return result;
- }
-
- public async static Task<UserResult> ShowDeferredContentDialog(
- StyleableWindow window,
- string title,
- string primaryText,
- string secondaryText,
- string primaryButton,
- string secondaryButton,
- string closeButton,
- int iconSymbol,
- ManualResetEvent deferResetEvent,
- Func<Window, Task> doWhileDeferred = null)
- {
- bool startedDeferring = false;
- UserResult result = UserResult.None;
-
- return await ShowContentDialog(
- title,
- primaryText,
- secondaryText,
- primaryButton,
- secondaryButton,
- closeButton,
- iconSymbol,
- primaryButton == LocaleManager.Instance["InputDialogYes"] ? UserResult.Yes : UserResult.Ok,
- deferResetEvent,
- doWhileDeferred,
- DeferClose);
-
- async void DeferClose(ContentDialog sender, ContentDialogButtonClickEventArgs args)
- {
- if (startedDeferring)
- {
- return;
- }
-
- sender.PrimaryButtonClick -= DeferClose;
-
- startedDeferring = true;
-
- var deferral = args.GetDeferral();
-
- result = primaryButton == LocaleManager.Instance["InputDialogYes"] ? UserResult.Yes : UserResult.Ok;
-
- sender.PrimaryButtonClick -= DeferClose;
-
-#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
- Task.Run(() =>
- {
- deferResetEvent.WaitOne();
-
- Dispatcher.UIThread.Post(() =>
- {
- deferral.Complete();
- });
- });
-#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
-
- if (doWhileDeferred != null)
- {
- await doWhileDeferred(window);
-
- deferResetEvent.Set();
- }
- }
- }
-
- private static Grid CreateDialogTextContent(string primaryText, string secondaryText, int symbol)
- {
- Grid content = new Grid();
- content.RowDefinitions = new RowDefinitions() { new RowDefinition(), new RowDefinition() };
- content.ColumnDefinitions = new ColumnDefinitions() { new ColumnDefinition(GridLength.Auto), new ColumnDefinition() };
-
- content.MinHeight = 80;
-
- SymbolIcon icon = new SymbolIcon { Symbol = (Symbol)symbol, Margin = new Thickness(10) };
- icon.FontSize = 40;
- icon.VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center;
- Grid.SetColumn(icon, 0);
- Grid.SetRowSpan(icon, 2);
- Grid.SetRow(icon, 0);
-
- TextBlock primaryLabel = new TextBlock()
- {
- Text = primaryText,
- Margin = new Thickness(5),
- TextWrapping = TextWrapping.Wrap,
- MaxWidth = 450
- };
- TextBlock secondaryLabel = new TextBlock()
- {
- Text = secondaryText,
- Margin = new Thickness(5),
- TextWrapping = TextWrapping.Wrap,
- MaxWidth = 450
- };
-
- Grid.SetColumn(primaryLabel, 1);
- Grid.SetColumn(secondaryLabel, 1);
- Grid.SetRow(primaryLabel, 0);
- Grid.SetRow(secondaryLabel, 1);
-
- content.Children.Add(icon);
- content.Children.Add(primaryLabel);
- content.Children.Add(secondaryLabel);
-
- return content;
- }
-
- public static async Task<UserResult> CreateInfoDialog(
- string primary,
- string secondaryText,
- string acceptButton,
- string closeButton,
- string title)
- {
- return await ShowContentDialog(
- title,
- primary,
- secondaryText,
- acceptButton,
- "",
- closeButton,
- (int)Symbol.Important);
- }
-
- internal static async Task<UserResult> CreateConfirmationDialog(
- string primaryText,
- string secondaryText,
- string acceptButtonText,
- string cancelButtonText,
- string title,
- UserResult primaryButtonResult = UserResult.Yes)
- {
- return await ShowContentDialog(
- string.IsNullOrWhiteSpace(title) ? LocaleManager.Instance["DialogConfirmationTitle"] : title,
- primaryText,
- secondaryText,
- acceptButtonText,
- "",
- cancelButtonText,
- (int)Symbol.Help,
- primaryButtonResult);
- }
-
- internal static UpdateWaitWindow CreateWaitingDialog(string mainText, string secondaryText)
- {
- return new(mainText, secondaryText);
- }
-
- internal static async Task CreateUpdaterInfoDialog(string primary, string secondaryText)
- {
- await ShowContentDialog(
- LocaleManager.Instance["DialogUpdaterTitle"],
- primary,
- secondaryText,
- "",
- "",
- LocaleManager.Instance["InputDialogOk"],
- (int)Symbol.Important);
- }
-
- internal static async Task CreateWarningDialog(string primary, string secondaryText)
- {
- await ShowContentDialog(
- LocaleManager.Instance["DialogWarningTitle"],
- primary,
- secondaryText,
- "",
- "",
- LocaleManager.Instance["InputDialogOk"],
- (int)Symbol.Important);
- }
-
- internal static async Task CreateErrorDialog(string errorMessage, string secondaryErrorMessage = "")
- {
- Logger.Error?.Print(LogClass.Application, errorMessage);
-
- await ShowContentDialog(
- LocaleManager.Instance["DialogErrorTitle"],
- LocaleManager.Instance["DialogErrorMessage"],
- errorMessage,
- secondaryErrorMessage,
- "",
- LocaleManager.Instance["InputDialogOk"],
- (int)Symbol.Dismiss);
- }
-
- internal static async Task<bool> CreateChoiceDialog(string title, string primary, string secondaryText)
- {
- if (_isChoiceDialogOpen)
- {
- return false;
- }
-
- _isChoiceDialogOpen = true;
-
- UserResult response =
- await ShowContentDialog(
- title,
- primary,
- secondaryText,
- LocaleManager.Instance["InputDialogYes"],
- "",
- LocaleManager.Instance["InputDialogNo"],
- (int)Symbol.Help,
- UserResult.Yes);
-
- _isChoiceDialogOpen = false;
-
- return response == UserResult.Yes;
- }
-
- internal static async Task<bool> CreateExitDialog()
- {
- return await CreateChoiceDialog(
- LocaleManager.Instance["DialogExitTitle"],
- LocaleManager.Instance["DialogExitMessage"],
- LocaleManager.Instance["DialogExitSubMessage"]);
- }
-
- internal static async Task<bool> CreateStopEmulationDialog()
- {
- return await CreateChoiceDialog(
- LocaleManager.Instance["DialogStopEmulationTitle"],
- LocaleManager.Instance["DialogStopEmulationMessage"],
- LocaleManager.Instance["DialogExitSubMessage"]);
- }
-
- internal static async Task<string> CreateInputDialog(
- string title,
- string mainText,
- string subText,
- uint maxLength = int.MaxValue,
- string input = "")
- {
- var result = await InputDialog.ShowInputDialog(
- title,
- mainText,
- input,
- subText,
- maxLength);
-
- if (result.Result == UserResult.Ok)
- {
- return result.Input;
- }
-
- return string.Empty;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/EmbeddedWindow.cs b/Ryujinx.Ava/Ui/Controls/EmbeddedWindow.cs
deleted file mode 100644
index 05b2cc5b..00000000
--- a/Ryujinx.Ava/Ui/Controls/EmbeddedWindow.cs
+++ /dev/null
@@ -1,233 +0,0 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Input;
-using Avalonia.Platform;
-using Ryujinx.Ava.Ui.Helper;
-using SPB.Graphics;
-using SPB.Platform;
-using SPB.Platform.GLX;
-using System;
-using System.Runtime.InteropServices;
-using System.Runtime.Versioning;
-using System.Threading.Tasks;
-using static Ryujinx.Ava.Ui.Controls.Win32NativeInterop;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- public class EmbeddedWindow : NativeControlHost
- {
- private WindowProc _wndProcDelegate;
- private string _className;
-
- protected GLXWindow X11Window { get; set; }
- protected IntPtr WindowHandle { get; set; }
- protected IntPtr X11Display { get; set; }
- protected IntPtr NsView { get; set; }
- protected IntPtr MetalLayer { get; set; }
-
- private UpdateBoundsCallbackDelegate _updateBoundsCallback;
-
- public event EventHandler<IntPtr> WindowCreated;
- public event EventHandler<Size> SizeChanged;
-
- protected virtual void OnWindowDestroyed() { }
- protected virtual void OnWindowDestroying()
- {
- WindowHandle = IntPtr.Zero;
- X11Display = IntPtr.Zero;
- }
-
- public EmbeddedWindow()
- {
- var stateObserverable = this.GetObservable(BoundsProperty);
-
- stateObserverable.Subscribe(StateChanged);
-
- this.Initialized += NativeEmbeddedWindow_Initialized;
- }
-
- public virtual void OnWindowCreated() { }
-
- private void NativeEmbeddedWindow_Initialized(object sender, EventArgs e)
- {
- OnWindowCreated();
-
- Task.Run(() =>
- {
- WindowCreated?.Invoke(this, WindowHandle);
- });
- }
-
- private void StateChanged(Rect rect)
- {
- SizeChanged?.Invoke(this, rect.Size);
- _updateBoundsCallback?.Invoke(rect);
- }
-
- protected override IPlatformHandle CreateNativeControlCore(IPlatformHandle parent)
- {
- if (OperatingSystem.IsLinux())
- {
- return CreateLinux(parent);
- }
- else if (OperatingSystem.IsWindows())
- {
- return CreateWin32(parent);
- }
- else if (OperatingSystem.IsMacOS())
- {
- return CreateMacOs(parent);
- }
-
- return base.CreateNativeControlCore(parent);
- }
-
- protected override void DestroyNativeControlCore(IPlatformHandle control)
- {
- OnWindowDestroying();
-
- if (OperatingSystem.IsLinux())
- {
- DestroyLinux();
- }
- else if (OperatingSystem.IsWindows())
- {
- DestroyWin32(control);
- }
- else if (OperatingSystem.IsMacOS())
- {
- DestroyMacOS();
- }
- else
- {
- base.DestroyNativeControlCore(control);
- }
-
- OnWindowDestroyed();
- }
-
- [SupportedOSPlatform("linux")]
- protected virtual IPlatformHandle CreateLinux(IPlatformHandle parent)
- {
- X11Window = PlatformHelper.CreateOpenGLWindow(FramebufferFormat.Default, 0, 0, 100, 100) as GLXWindow;
- WindowHandle = X11Window.WindowHandle.RawHandle;
- X11Display = X11Window.DisplayHandle.RawHandle;
-
- return new PlatformHandle(WindowHandle, "X11");
- }
-
- [SupportedOSPlatform("windows")]
- IPlatformHandle CreateWin32(IPlatformHandle parent)
- {
- _className = "NativeWindow-" + Guid.NewGuid();
- _wndProcDelegate = WndProc;
- var wndClassEx = new WNDCLASSEX
- {
- cbSize = Marshal.SizeOf<WNDCLASSEX>(),
- hInstance = GetModuleHandle(null),
- lpfnWndProc = Marshal.GetFunctionPointerForDelegate(_wndProcDelegate),
- style = ClassStyles.CS_OWNDC,
- lpszClassName = Marshal.StringToHGlobalUni(_className),
- hCursor = LoadCursor(IntPtr.Zero, (IntPtr)Cursors.IDC_ARROW)
- };
-
- var atom = RegisterClassEx(ref wndClassEx);
-
- var handle = CreateWindowEx(
- 0,
- _className,
- "NativeWindow",
- WindowStyles.WS_CHILD,
- 0,
- 0,
- 640,
- 480,
- parent.Handle,
- IntPtr.Zero,
- IntPtr.Zero,
- IntPtr.Zero);
-
- WindowHandle = handle;
-
- Marshal.FreeHGlobal(wndClassEx.lpszClassName);
-
- return new PlatformHandle(WindowHandle, "HWND");
- }
-
- [SupportedOSPlatform("windows")]
- IntPtr WndProc(IntPtr hWnd, WindowsMessages msg, IntPtr wParam, IntPtr lParam)
- {
- var point = new Point((long)lParam & 0xFFFF, ((long)lParam >> 16) & 0xFFFF);
- var root = VisualRoot as Window;
- bool isLeft = false;
- switch (msg)
- {
- case WindowsMessages.LBUTTONDOWN:
- case WindowsMessages.RBUTTONDOWN:
- isLeft = msg == WindowsMessages.LBUTTONDOWN;
- this.RaiseEvent(new PointerPressedEventArgs(
- this,
- new Pointer(0, PointerType.Mouse, true),
- root,
- this.TranslatePoint(point, root).Value,
- (ulong)Environment.TickCount64,
- new PointerPointProperties(isLeft ? RawInputModifiers.LeftMouseButton : RawInputModifiers.RightMouseButton, isLeft ? PointerUpdateKind.LeftButtonPressed : PointerUpdateKind.RightButtonPressed),
- KeyModifiers.None));
- break;
- case WindowsMessages.LBUTTONUP:
- case WindowsMessages.RBUTTONUP:
- isLeft = msg == WindowsMessages.LBUTTONUP;
- this.RaiseEvent(new PointerReleasedEventArgs(
- this,
- new Pointer(0, PointerType.Mouse, true),
- root,
- this.TranslatePoint(point, root).Value,
- (ulong)Environment.TickCount64,
- new PointerPointProperties(isLeft ? RawInputModifiers.LeftMouseButton : RawInputModifiers.RightMouseButton, isLeft ? PointerUpdateKind.LeftButtonReleased : PointerUpdateKind.RightButtonReleased),
- KeyModifiers.None,
- isLeft ? MouseButton.Left : MouseButton.Right));
- break;
- case WindowsMessages.MOUSEMOVE:
- this.RaiseEvent(new PointerEventArgs(
- PointerMovedEvent,
- this,
- new Pointer(0, PointerType.Mouse, true),
- root,
- this.TranslatePoint(point, root).Value,
- (ulong)Environment.TickCount64,
- new PointerPointProperties(RawInputModifiers.None, PointerUpdateKind.Other),
- KeyModifiers.None));
- break;
- }
- return DefWindowProc(hWnd, msg, (IntPtr)wParam, (IntPtr)lParam);
- }
-
- [SupportedOSPlatform("macos")]
- IPlatformHandle CreateMacOs(IPlatformHandle parent)
- {
- MetalLayer = MetalHelper.GetMetalLayer(out IntPtr nsView, out _updateBoundsCallback);
-
- NsView = nsView;
-
- return new PlatformHandle(nsView, "NSView");
- }
-
- void DestroyLinux()
- {
- X11Window?.Dispose();
- }
-
- [SupportedOSPlatform("windows")]
- void DestroyWin32(IPlatformHandle handle)
- {
- DestroyWindow(handle.Handle);
- UnregisterClass(_className, GetModuleHandle(null));
- }
-
- [SupportedOSPlatform("macos")]
- void DestroyMacOS()
- {
- MetalHelper.DestroyMetalLayer(NsView, MetalLayer);
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/GameGridView.axaml b/Ryujinx.Ava/Ui/Controls/GameGridView.axaml
deleted file mode 100644
index b0669463..00000000
--- a/Ryujinx.Ava/Ui/Controls/GameGridView.axaml
+++ /dev/null
@@ -1,195 +0,0 @@
-<UserControl
- x:Class="Ryujinx.Ava.Ui.Controls.GameGridView"
- xmlns="https://github.com/avaloniaui"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:controls="clr-namespace:Ryujinx.Ava.Ui.Controls"
- 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"
- d:DesignHeight="450"
- d:DesignWidth="800"
- mc:Ignorable="d"
- Focusable="True">
- <UserControl.Resources>
- <controls:BitmapArrayValueConverter x:Key="ByteImage" />
- <MenuFlyout x:Key="GameContextMenu" Opened="MenuBase_OnMenuOpened">
- <MenuItem
- Command="{Binding ToggleFavorite}"
- Header="{locale:Locale GameListContextMenuToggleFavorite}"
- ToolTip.Tip="{locale:Locale GameListContextMenuToggleFavoriteToolTip}" />
- <Separator />
- <MenuItem
- Command="{Binding OpenUserSaveDirectory}"
- Header="{locale:Locale GameListContextMenuOpenUserSaveDirectory}"
- ToolTip.Tip="{locale:Locale GameListContextMenuOpenUserSaveDirectoryToolTip}" />
- <MenuItem
- Command="{Binding OpenDeviceSaveDirectory}"
- Header="{locale:Locale GameListContextMenuOpenUserDeviceDirectory}"
- ToolTip.Tip="{locale:Locale GameListContextMenuOpenUserDeviceDirectoryToolTip}" />
- <MenuItem
- Command="{Binding OpenBcatSaveDirectory}"
- Header="{locale:Locale GameListContextMenuOpenUserBcatDirectory}"
- ToolTip.Tip="{locale:Locale GameListContextMenuOpenUserBcatDirectoryToolTip}" />
- <Separator />
- <MenuItem
- Command="{Binding OpenTitleUpdateManager}"
- Header="{locale:Locale GameListContextMenuManageTitleUpdates}"
- ToolTip.Tip="{locale:Locale GameListContextMenuManageTitleUpdatesToolTip}" />
- <MenuItem
- Command="{Binding OpenDownloadableContentManager}"
- Header="{locale:Locale GameListContextMenuManageDlc}"
- ToolTip.Tip="{locale:Locale GameListContextMenuManageDlcToolTip}" />
- <MenuItem
- Command="{Binding OpenCheatManager}"
- Header="{locale:Locale GameListContextMenuManageCheat}"
- ToolTip.Tip="{locale:Locale GameListContextMenuManageCheatToolTip}" />
- <MenuItem
- Command="{Binding OpenModsDirectory}"
- Header="{locale:Locale GameListContextMenuOpenModsDirectory}"
- ToolTip.Tip="{locale:Locale GameListContextMenuOpenModsDirectoryToolTip}" />
- <MenuItem
- Command="{Binding OpenSdModsDirectory}"
- Header="{locale:Locale GameListContextMenuOpenSdModsDirectory}"
- ToolTip.Tip="{locale:Locale GameListContextMenuOpenSdModsDirectoryToolTip}" />
- <Separator />
- <MenuItem Header="{locale:Locale GameListContextMenuCacheManagement}">
- <MenuItem
- Command="{Binding PurgePtcCache}"
- Header="{locale:Locale GameListContextMenuCacheManagementPurgePptc}"
- ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementPurgePptcToolTip}" />
- <MenuItem
- Command="{Binding PurgeShaderCache}"
- Header="{locale:Locale GameListContextMenuCacheManagementPurgeShaderCache}"
- ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementPurgeShaderCacheToolTip}" />
- <MenuItem
- Command="{Binding OpenPtcDirectory}"
- Header="{locale:Locale GameListContextMenuCacheManagementOpenPptcDirectory}"
- ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementOpenPptcDirectoryToolTip}" />
- <MenuItem
- Command="{Binding OpenShaderCacheDirectory}"
- Header="{locale:Locale GameListContextMenuCacheManagementOpenShaderCacheDirectory}"
- ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementOpenShaderCacheDirectoryToolTip}" />
- </MenuItem>
- <MenuItem Header="{locale:Locale GameListContextMenuExtractData}">
- <MenuItem
- Command="{Binding ExtractExeFs}"
- Header="{locale:Locale GameListContextMenuExtractDataExeFS}"
- ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataExeFSToolTip}" />
- <MenuItem
- Command="{Binding ExtractRomFs}"
- Header="{locale:Locale GameListContextMenuExtractDataRomFS}"
- ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataRomFSToolTip}" />
- <MenuItem
- Command="{Binding ExtractLogo}"
- Header="{locale:Locale GameListContextMenuExtractDataLogo}"
- ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataLogoToolTip}" />
- </MenuItem>
- </MenuFlyout>
- </UserControl.Resources>
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
- <ListBox
- Grid.Row="0"
- Padding="8"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- ContextFlyout="{StaticResource GameContextMenu}"
- DoubleTapped="GameList_DoubleTapped"
- Items="{Binding AppsObservableList}"
- SelectionChanged="GameList_SelectionChanged">
- <ListBox.ItemsPanel>
- <ItemsPanelTemplate>
- <flex:FlexPanel
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- AlignContent="FlexStart"
- JustifyContent="Center" />
- </ItemsPanelTemplate>
- </ListBox.ItemsPanel>
- <ListBox.Styles>
- <Style Selector="ListBoxItem">
- <Setter Property="Padding" Value="0" />
- <Setter Property="Margin" Value="5" />
- <Setter Property="CornerRadius" Value="4" />
- <Setter Property="Background" Value="{DynamicResource AppListBackgroundColor}" />
- <Style.Animations>
- <Animation Duration="0:0:0.7">
- <KeyFrame Cue="0%">
- <Setter Property="MaxWidth" Value="0" />
- <Setter Property="Opacity" Value="0.0" />
- </KeyFrame>
- <KeyFrame Cue="50%">
- <Setter Property="MaxWidth" Value="1000" />
- <Setter Property="Opacity" Value="0.3" />
- </KeyFrame>
- <KeyFrame Cue="100%">
- <Setter Property="MaxWidth" Value="1000" />
- <Setter Property="Opacity" Value="1.0" />
- </KeyFrame>
- </Animation>
- </Style.Animations>
- </Style>
- <Style Selector="ListBoxItem:selected /template/ ContentPresenter">
- <Setter Property="Background" Value="{DynamicResource AppListBackgroundColor}" />
- </Style>
- <Style Selector="ListBoxItem:pointerover /template/ ContentPresenter">
- <Setter Property="Background" Value="{DynamicResource AppListHoverBackgroundColor}" />
- </Style>
- </ListBox.Styles>
- <ListBox.ItemTemplate>
- <DataTemplate>
- <Grid>
- <Border
- Margin="10"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- Classes.huge="{Binding $parent[UserControl].DataContext.IsGridHuge}"
- Classes.large="{Binding $parent[UserControl].DataContext.IsGridLarge}"
- Classes.normal="{Binding $parent[UserControl].DataContext.IsGridMedium}"
- Classes.small="{Binding $parent[UserControl].DataContext.IsGridSmall}"
- ClipToBounds="True"
- CornerRadius="4">
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <Image
- Grid.Row="0"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Top"
- Source="{Binding Icon, Converter={StaticResource ByteImage}}" />
- <Panel
- Grid.Row="1"
- Height="50"
- Margin="0 10 0 0"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- IsVisible="{Binding $parent[UserControl].DataContext.ShowNames}">
- <TextBlock
- HorizontalAlignment="Stretch"
- VerticalAlignment="Center"
- Text="{Binding TitleName}"
- TextAlignment="Center"
- TextWrapping="Wrap" />
- </Panel>
- </Grid>
- </Border>
- <ui:SymbolIcon
- Margin="5,5,0,0"
- HorizontalAlignment="Left"
- VerticalAlignment="Top"
- FontSize="16"
- Foreground="{DynamicResource SystemAccentColor}"
- IsVisible="{Binding Favorite}"
- Symbol="StarFilled" />
- </Grid>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- </Grid>
-</UserControl> \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/GameGridView.axaml.cs b/Ryujinx.Ava/Ui/Controls/GameGridView.axaml.cs
deleted file mode 100644
index 4dfe4f0e..00000000
--- a/Ryujinx.Ava/Ui/Controls/GameGridView.axaml.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-using Avalonia.Collections;
-using Avalonia.Controls;
-using Avalonia.Input;
-using Avalonia.Interactivity;
-using Avalonia.Markup.Xaml;
-using LibHac.Common;
-using Ryujinx.Ava.Ui.ViewModels;
-using Ryujinx.Ui.App.Common;
-using System;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- public partial class GameGridView : UserControl
- {
- private ApplicationData _selectedApplication;
- public static readonly RoutedEvent<ApplicationOpenedEventArgs> ApplicationOpenedEvent =
- RoutedEvent.Register<GameGridView, ApplicationOpenedEventArgs>(nameof(ApplicationOpened), RoutingStrategies.Bubble);
-
- public event EventHandler<ApplicationOpenedEventArgs> ApplicationOpened
- {
- add { AddHandler(ApplicationOpenedEvent, value); }
- remove { RemoveHandler(ApplicationOpenedEvent, value); }
- }
-
- public void GameList_DoubleTapped(object sender, RoutedEventArgs args)
- {
- if (sender is ListBox listBox)
- {
- if (listBox.SelectedItem is ApplicationData selected)
- {
- RaiseEvent(new ApplicationOpenedEventArgs(selected, ApplicationOpenedEvent));
- }
- }
- }
-
- public void GameList_SelectionChanged(object sender, SelectionChangedEventArgs args)
- {
- if (sender is ListBox listBox)
- {
- var selected = listBox.SelectedItem as ApplicationData;
-
- _selectedApplication = selected;
- }
- }
-
- public ApplicationData SelectedApplication => _selectedApplication;
-
- public GameGridView()
- {
- InitializeComponent();
- }
-
- private void InitializeComponent()
- {
- AvaloniaXamlLoader.Load(this);
- }
-
- private void SearchBox_OnKeyUp(object sender, KeyEventArgs e)
- {
- (DataContext as MainWindowViewModel).SearchText = (sender as TextBox).Text;
- }
-
- private void MenuBase_OnMenuOpened(object sender, EventArgs e)
- {
- var selection = SelectedApplication;
-
- if (selection != null)
- {
- if (sender is ContextMenu menu)
- {
- bool canHaveUserSave = !Utilities.IsZeros(selection.ControlHolder.ByteSpan) && selection.ControlHolder.Value.UserAccountSaveDataSize > 0;
- bool canHaveDeviceSave = !Utilities.IsZeros(selection.ControlHolder.ByteSpan) && selection.ControlHolder.Value.DeviceSaveDataSize > 0;
- bool canHaveBcatSave = !Utilities.IsZeros(selection.ControlHolder.ByteSpan) && selection.ControlHolder.Value.BcatDeliveryCacheStorageSize > 0;
-
- ((menu.Items as AvaloniaList<object>)[2] as MenuItem).IsEnabled = canHaveUserSave;
- ((menu.Items as AvaloniaList<object>)[3] as MenuItem).IsEnabled = canHaveDeviceSave;
- ((menu.Items as AvaloniaList<object>)[4] as MenuItem).IsEnabled = canHaveBcatSave;
- }
- }
- }
- }
-}
diff --git a/Ryujinx.Ava/Ui/Controls/GameListView.axaml b/Ryujinx.Ava/Ui/Controls/GameListView.axaml
deleted file mode 100644
index 2c41cef8..00000000
--- a/Ryujinx.Ava/Ui/Controls/GameListView.axaml
+++ /dev/null
@@ -1,235 +0,0 @@
-<UserControl
- x:Class="Ryujinx.Ava.Ui.Controls.GameListView"
- xmlns="https://github.com/avaloniaui"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:controls="clr-namespace:Ryujinx.Ava.Ui.Controls"
- 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"
- d:DesignHeight="450"
- d:DesignWidth="800"
- mc:Ignorable="d"
- Focusable="True">
- <UserControl.Resources>
- <controls:BitmapArrayValueConverter x:Key="ByteImage" />
- <MenuFlyout x:Key="GameContextMenu" Opened="MenuBase_OnMenuOpened">
- <MenuItem
- Command="{Binding ToggleFavorite}"
- Header="{locale:Locale GameListContextMenuToggleFavorite}"
- ToolTip.Tip="{locale:Locale GameListContextMenuToggleFavoriteToolTip}" />
- <Separator />
- <MenuItem
- Command="{Binding OpenUserSaveDirectory}"
- Header="{locale:Locale GameListContextMenuOpenUserSaveDirectory}"
- ToolTip.Tip="{locale:Locale GameListContextMenuOpenUserSaveDirectoryToolTip}" />
- <MenuItem
- Command="{Binding OpenDeviceSaveDirectory}"
- Header="{locale:Locale GameListContextMenuOpenUserDeviceDirectory}"
- ToolTip.Tip="{locale:Locale GameListContextMenuOpenUserDeviceDirectoryToolTip}" />
- <MenuItem
- Command="{Binding OpenBcatSaveDirectory}"
- Header="{locale:Locale GameListContextMenuOpenUserBcatDirectory}"
- ToolTip.Tip="{locale:Locale GameListContextMenuOpenUserBcatDirectoryToolTip}" />
- <Separator />
- <MenuItem
- Command="{Binding OpenTitleUpdateManager}"
- Header="{locale:Locale GameListContextMenuManageTitleUpdates}"
- ToolTip.Tip="{locale:Locale GameListContextMenuManageTitleUpdatesToolTip}" />
- <MenuItem
- Command="{Binding OpenDownloadableContentManager}"
- Header="{locale:Locale GameListContextMenuManageDlc}"
- ToolTip.Tip="{locale:Locale GameListContextMenuManageDlcToolTip}" />
- <MenuItem
- Command="{Binding OpenCheatManager}"
- Header="{locale:Locale GameListContextMenuManageCheat}"
- ToolTip.Tip="{locale:Locale GameListContextMenuManageCheatToolTip}" />
- <MenuItem
- Command="{Binding OpenModsDirectory}"
- Header="{locale:Locale GameListContextMenuOpenModsDirectory}"
- ToolTip.Tip="{locale:Locale GameListContextMenuOpenModsDirectoryToolTip}" />
- <MenuItem
- Command="{Binding OpenSdModsDirectory}"
- Header="{locale:Locale GameListContextMenuOpenSdModsDirectory}"
- ToolTip.Tip="{locale:Locale GameListContextMenuOpenSdModsDirectoryToolTip}" />
- <Separator />
- <MenuItem Header="{locale:Locale GameListContextMenuCacheManagement}">
- <MenuItem
- Command="{Binding PurgePtcCache}"
- Header="{locale:Locale GameListContextMenuCacheManagementPurgePptc}"
- ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementPurgePptcToolTip}" />
- <MenuItem
- Command="{Binding PurgeShaderCache}"
- Header="{locale:Locale GameListContextMenuCacheManagementPurgeShaderCache}"
- ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementPurgeShaderCacheToolTip}" />
- <MenuItem
- Command="{Binding OpenPtcDirectory}"
- Header="{locale:Locale GameListContextMenuCacheManagementOpenPptcDirectory}"
- ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementOpenPptcDirectoryToolTip}" />
- <MenuItem
- Command="{Binding OpenShaderCacheDirectory}"
- Header="{locale:Locale GameListContextMenuCacheManagementOpenShaderCacheDirectory}"
- ToolTip.Tip="{locale:Locale GameListContextMenuCacheManagementOpenShaderCacheDirectoryToolTip}" />
- </MenuItem>
- <MenuItem Header="{locale:Locale GameListContextMenuExtractData}">
- <MenuItem
- Command="{Binding ExtractExeFs}"
- Header="{locale:Locale GameListContextMenuExtractDataExeFS}"
- ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataExeFSToolTip}" />
- <MenuItem
- Command="{Binding ExtractRomFs}"
- Header="{locale:Locale GameListContextMenuExtractDataRomFS}"
- ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataRomFSToolTip}" />
- <MenuItem
- Command="{Binding ExtractLogo}"
- Header="{locale:Locale GameListContextMenuExtractDataLogo}"
- ToolTip.Tip="{locale:Locale GameListContextMenuExtractDataLogoToolTip}" />
- </MenuItem>
- </MenuFlyout>
- </UserControl.Resources>
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
- <ListBox
- Name="GameListBox"
- Grid.Row="0"
- Padding="8"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- ContextFlyout="{StaticResource GameContextMenu}"
- DoubleTapped="GameList_DoubleTapped"
- Items="{Binding AppsObservableList}"
- SelectionChanged="GameList_SelectionChanged">
- <ListBox.ItemsPanel>
- <ItemsPanelTemplate>
- <StackPanel
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- Orientation="Vertical"
- Spacing="2" />
- </ItemsPanelTemplate>
- </ListBox.ItemsPanel>
- <ListBox.Styles>
- <Style Selector="ListBoxItem">
- <Setter Property="Padding" Value="0" />
- <Setter Property="Margin" Value="0" />
- <Setter Property="CornerRadius" Value="5" />
- <Setter Property="Background" Value="{DynamicResource AppListBackgroundColor}" />
- <Setter Property="BorderThickness" Value="2"/>
- <Style.Animations>
- <Animation Duration="0:0:0.7">
- <KeyFrame Cue="0%">
- <Setter Property="MaxHeight" Value="0" />
- <Setter Property="Opacity" Value="0.0" />
- </KeyFrame>
- <KeyFrame Cue="50%">
- <Setter Property="MaxHeight" Value="1000" />
- <Setter Property="Opacity" Value="0.3" />
- </KeyFrame>
- <KeyFrame Cue="100%">
- <Setter Property="MaxHeight" Value="1000" />
- <Setter Property="Opacity" Value="1.0" />
- </KeyFrame>
- </Animation>
- </Style.Animations>
- </Style>
- <Style Selector="ListBoxItem:selected /template/ ContentPresenter">
- <Setter Property="Background" Value="{DynamicResource AppListBackgroundColor}" />
- </Style>
- <Style Selector="ListBoxItem:selected /template/ Border#SelectionIndicator">
- <Setter Property="MinHeight" Value="100" />
- </Style>
- <Style Selector="ListBoxItem:pointerover /template/ ContentPresenter">
- <Setter Property="Background" Value="{DynamicResource AppListHoverBackgroundColor}" />
- </Style>
- </ListBox.Styles>
- <ListBox.ItemTemplate>
- <DataTemplate>
- <Grid>
- <Border
- Margin="0"
- Padding="10"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- ClipToBounds="True"
- CornerRadius="5">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="10" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="Auto" />
- </Grid.ColumnDefinitions>
- <Image
- Grid.RowSpan="3"
- Grid.Column="0"
- Margin="0"
- Classes.huge="{Binding $parent[UserControl].DataContext.IsGridHuge}"
- Classes.large="{Binding $parent[UserControl].DataContext.IsGridLarge}"
- Classes.normal="{Binding $parent[UserControl].DataContext.IsGridMedium}"
- Classes.small="{Binding $parent[UserControl].DataContext.IsGridSmall}"
- Source="{Binding Icon, Converter={StaticResource ByteImage}}" />
- <StackPanel
- Grid.Column="2"
- HorizontalAlignment="Left"
- VerticalAlignment="Top"
- Orientation="Vertical"
- Spacing="5" >
- <TextBlock
- HorizontalAlignment="Stretch"
- Text="{Binding TitleName}"
- TextAlignment="Left"
- TextWrapping="Wrap" />
- <TextBlock
- HorizontalAlignment="Stretch"
- Text="{Binding Developer}"
- TextAlignment="Left"
- TextWrapping="Wrap" />
- <TextBlock
- HorizontalAlignment="Stretch"
- Text="{Binding Version}"
- TextAlignment="Left"
- TextWrapping="Wrap" />
- </StackPanel>
- <StackPanel
- Grid.Column="3"
- HorizontalAlignment="Right"
- VerticalAlignment="Top"
- Orientation="Vertical"
- Spacing="5">
- <TextBlock
- HorizontalAlignment="Stretch"
- Text="{Binding TimePlayed}"
- TextAlignment="Right"
- TextWrapping="Wrap" />
- <TextBlock
- HorizontalAlignment="Stretch"
- Text="{Binding LastPlayed}"
- TextAlignment="Right"
- TextWrapping="Wrap" />
- <TextBlock
- HorizontalAlignment="Stretch"
- Text="{Binding FileSize}"
- TextAlignment="Right"
- TextWrapping="Wrap" />
- </StackPanel>
- <ui:SymbolIcon
- Grid.Row="0"
- Grid.Column="0"
- Margin="-5,-5,0,0"
- HorizontalAlignment="Left"
- VerticalAlignment="Top"
- FontSize="16"
- Foreground="{DynamicResource SystemAccentColor}"
- IsVisible="{Binding Favorite}"
- Symbol="StarFilled" />
- </Grid>
- </Border>
- </Grid>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- </Grid>
-</UserControl> \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/GameListView.axaml.cs b/Ryujinx.Ava/Ui/Controls/GameListView.axaml.cs
deleted file mode 100644
index 1cca3bea..00000000
--- a/Ryujinx.Ava/Ui/Controls/GameListView.axaml.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-using Avalonia.Collections;
-using Avalonia.Controls;
-using Avalonia.Input;
-using Avalonia.Interactivity;
-using Avalonia.Markup.Xaml;
-using LibHac.Common;
-using Ryujinx.Ava.Ui.ViewModels;
-using Ryujinx.Ui.App.Common;
-using System;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- public partial class GameListView : UserControl
- {
- private ApplicationData _selectedApplication;
- public static readonly RoutedEvent<ApplicationOpenedEventArgs> ApplicationOpenedEvent =
- RoutedEvent.Register<GameGridView, ApplicationOpenedEventArgs>(nameof(ApplicationOpened), RoutingStrategies.Bubble);
-
- public event EventHandler<ApplicationOpenedEventArgs> ApplicationOpened
- {
- add { AddHandler(ApplicationOpenedEvent, value); }
- remove { RemoveHandler(ApplicationOpenedEvent, value); }
- }
-
- public void GameList_DoubleTapped(object sender, RoutedEventArgs args)
- {
- if (sender is ListBox listBox)
- {
- if (listBox.SelectedItem is ApplicationData selected)
- {
- RaiseEvent(new ApplicationOpenedEventArgs(selected, ApplicationOpenedEvent));
- }
- }
- }
-
- public void GameList_SelectionChanged(object sender, SelectionChangedEventArgs args)
- {
- if (sender is ListBox listBox)
- {
- var selected = listBox.SelectedItem as ApplicationData;
-
- _selectedApplication = selected;
- }
- }
-
- public ApplicationData SelectedApplication => _selectedApplication;
-
- public GameListView()
- {
- InitializeComponent();
- }
-
- private void InitializeComponent()
- {
- AvaloniaXamlLoader.Load(this);
- }
-
- private void SearchBox_OnKeyUp(object sender, KeyEventArgs e)
- {
- (DataContext as MainWindowViewModel).SearchText = (sender as TextBox).Text;
- }
-
- private void MenuBase_OnMenuOpened(object sender, EventArgs e)
- {
- var selection = SelectedApplication;
-
- if (selection != null)
- {
- if (sender is ContextMenu menu)
- {
- bool canHaveUserSave = !Utilities.IsZeros(selection.ControlHolder.ByteSpan) && selection.ControlHolder.Value.UserAccountSaveDataSize > 0;
- bool canHaveDeviceSave = !Utilities.IsZeros(selection.ControlHolder.ByteSpan) && selection.ControlHolder.Value.DeviceSaveDataSize > 0;
- bool canHaveBcatSave = !Utilities.IsZeros(selection.ControlHolder.ByteSpan) && selection.ControlHolder.Value.BcatDeliveryCacheStorageSize > 0;
-
- ((menu.Items as AvaloniaList<object>)[2] as MenuItem).IsEnabled = canHaveUserSave;
- ((menu.Items as AvaloniaList<object>)[3] as MenuItem).IsEnabled = canHaveDeviceSave;
- ((menu.Items as AvaloniaList<object>)[4] as MenuItem).IsEnabled = canHaveBcatSave;
- }
- }
- }
- }
-}
diff --git a/Ryujinx.Ava/Ui/Controls/Glyph.cs b/Ryujinx.Ava/Ui/Controls/Glyph.cs
deleted file mode 100644
index 74a3c94a..00000000
--- a/Ryujinx.Ava/Ui/Controls/Glyph.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace Ryujinx.Ava.Ui.Controls
-{
- public enum Glyph : int
- {
- List,
- Grid,
- Chip
- }
-}
diff --git a/Ryujinx.Ava/Ui/Controls/GlyphValueConverter.cs b/Ryujinx.Ava/Ui/Controls/GlyphValueConverter.cs
deleted file mode 100644
index 63c6a17d..00000000
--- a/Ryujinx.Ava/Ui/Controls/GlyphValueConverter.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-using Avalonia.Data;
-using Avalonia.Markup.Xaml;
-using FluentAvalonia.UI.Controls;
-using System;
-using System.Collections.Generic;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- public class GlyphValueConverter : MarkupExtension
- {
- private string _key;
-
- private static Dictionary<Glyph, string> _glyphs = new Dictionary<Glyph, string>
- {
- { Glyph.List, char.ConvertFromUtf32((int)Symbol.List).ToString() },
- { Glyph.Grid, char.ConvertFromUtf32((int)Symbol.ViewAll).ToString() },
- { Glyph.Chip, char.ConvertFromUtf32(59748).ToString() }
- };
-
- public GlyphValueConverter(string key)
- {
- _key = key;
- }
-
- public string this[string key]
- {
- get
- {
- if (_glyphs.TryGetValue(Enum.Parse<Glyph>(key), out var val))
- {
- return val;
- }
-
- return string.Empty;
- }
- }
-
- public override object ProvideValue(IServiceProvider serviceProvider)
- {
- Avalonia.Markup.Xaml.MarkupExtensions.ReflectionBindingExtension binding = new($"[{_key}]")
- {
- Mode = BindingMode.OneWay,
- Source = this
- };
-
- return binding.ProvideValue(serviceProvider);
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/HotKeyControl.cs b/Ryujinx.Ava/Ui/Controls/HotKeyControl.cs
deleted file mode 100644
index d3ab1e8f..00000000
--- a/Ryujinx.Ava/Ui/Controls/HotKeyControl.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Input;
-using System;
-using System.Windows.Input;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- public class HotKeyControl : ContentControl, ICommandSource
- {
- public static readonly StyledProperty<object> CommandParameterProperty =
- AvaloniaProperty.Register<HotKeyControl, object>(nameof(CommandParameter));
-
- public static readonly DirectProperty<HotKeyControl, ICommand> CommandProperty =
- AvaloniaProperty.RegisterDirect<HotKeyControl, ICommand>(nameof(Command),
- control => control.Command, (control, command) => control.Command = command, enableDataValidation: true);
-
- public static readonly StyledProperty<KeyGesture> HotKeyProperty = HotKeyManager.HotKeyProperty.AddOwner<Button>();
-
- private ICommand _command;
- private bool _commandCanExecute;
-
- public ICommand Command
- {
- get { return _command; }
- set { SetAndRaise(CommandProperty, ref _command, value); }
- }
-
- public KeyGesture HotKey
- {
- get { return GetValue(HotKeyProperty); }
- set { SetValue(HotKeyProperty, value); }
- }
-
- public object CommandParameter
- {
- get { return GetValue(CommandParameterProperty); }
- set { SetValue(CommandParameterProperty, value); }
- }
-
- public void CanExecuteChanged(object sender, EventArgs e)
- {
- var canExecute = Command == null || Command.CanExecute(CommandParameter);
-
- if (canExecute != _commandCanExecute)
- {
- _commandCanExecute = canExecute;
- UpdateIsEffectivelyEnabled();
- }
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/IGlContextExtension.cs b/Ryujinx.Ava/Ui/Controls/IGlContextExtension.cs
deleted file mode 100644
index 79d6658d..00000000
--- a/Ryujinx.Ava/Ui/Controls/IGlContextExtension.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using Avalonia.OpenGL;
-using SPB.Graphics.OpenGL;
-using System;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- internal static class IGlContextExtension
- {
- public static OpenGLContextBase AsOpenGLContextBase(this IGlContext context)
- {
- var handle = (IntPtr)context.GetType().GetProperty("Handle").GetValue(context);
-
- if (OperatingSystem.IsWindows())
- {
- return new AvaloniaWglContext(handle);
- }
- else if (OperatingSystem.IsLinux())
- {
- return new AvaloniaGlxContext(handle);
- }
-
- return null;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/InputDialog.axaml b/Ryujinx.Ava/Ui/Controls/InputDialog.axaml
deleted file mode 100644
index 56f96f82..00000000
--- a/Ryujinx.Ava/Ui/Controls/InputDialog.axaml
+++ /dev/null
@@ -1,32 +0,0 @@
-<UserControl
- x:Class="Ryujinx.Ava.Ui.Controls.InputDialog"
- 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"
- mc:Ignorable="d"
- Focusable="True">
- <Grid
- Margin="5,10,5,5"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Center">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <TextBlock HorizontalAlignment="Center" Text="{Binding Message}" />
- <TextBox
- Grid.Row="1"
- Width="300"
- Margin="10"
- HorizontalAlignment="Center"
- MaxLength="{Binding MaxLength}"
- Text="{Binding Input, Mode=TwoWay}" />
- <TextBlock
- Grid.Row="2"
- Margin="5,5,5,10"
- HorizontalAlignment="Center"
- Text="{Binding SubMessage}" />
- </Grid>
-</UserControl> \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/InputDialog.axaml.cs b/Ryujinx.Ava/Ui/Controls/InputDialog.axaml.cs
deleted file mode 100644
index 3e78119d..00000000
--- a/Ryujinx.Ava/Ui/Controls/InputDialog.axaml.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using Avalonia.Controls;
-using FluentAvalonia.UI.Controls;
-using Ryujinx.Ava.Common.Locale;
-using Ryujinx.Ava.Ui.Models;
-using System.Threading.Tasks;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- public partial class InputDialog : UserControl
- {
- public string Message { get; set; }
- public string Input { get; set; }
- public string SubMessage { get; set; }
-
- public uint MaxLength { get; }
-
- public InputDialog(string message, string input = "", string subMessage = "", uint maxLength = int.MaxValue)
- {
- Message = message;
- Input = input;
- SubMessage = subMessage;
- MaxLength = maxLength;
-
- DataContext = this;
- }
-
- public InputDialog()
- {
- InitializeComponent();
- }
-
- public static async Task<(UserResult Result, string Input)> ShowInputDialog(string title, string message,
- string input = "", string subMessage = "", uint maxLength = int.MaxValue)
- {
- UserResult result = UserResult.Cancel;
-
- InputDialog content = new InputDialog(message, input, subMessage, maxLength);
- ContentDialog contentDialog = new ContentDialog
- {
- Title = title,
- PrimaryButtonText = LocaleManager.Instance["InputDialogOk"],
- SecondaryButtonText = "",
- CloseButtonText = LocaleManager.Instance["InputDialogCancel"],
- Content = content,
- PrimaryButtonCommand = MiniCommand.Create(() =>
- {
- result = UserResult.Ok;
- input = content.Input;
- })
- };
- await contentDialog.ShowAsync();
-
- return (result, input);
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/KeyValueConverter.cs b/Ryujinx.Ava/Ui/Controls/KeyValueConverter.cs
deleted file mode 100644
index ac0b622b..00000000
--- a/Ryujinx.Ava/Ui/Controls/KeyValueConverter.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using Avalonia.Data.Converters;
-using Ryujinx.Common.Configuration.Hid;
-using Ryujinx.Common.Configuration.Hid.Controller;
-using System;
-using System.Globalization;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- internal class KeyValueConverter : IValueConverter
- {
- public static KeyValueConverter Instance = new();
-
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value == null)
- {
- return null;
- }
-
- return value.ToString();
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- object key = null;
-
- if (value != null)
- {
- if (targetType == typeof(Key))
- {
- key = Enum.Parse<Key>(value.ToString());
- }
- else if (targetType == typeof(GamepadInputId))
- {
- key = Enum.Parse<GamepadInputId>(value.ToString());
- }
- else if (targetType == typeof(StickInputId))
- {
- key = Enum.Parse<StickInputId>(value.ToString());
- }
- }
-
- return key;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/MiniCommand.cs b/Ryujinx.Ava/Ui/Controls/MiniCommand.cs
deleted file mode 100644
index e14cfa6f..00000000
--- a/Ryujinx.Ava/Ui/Controls/MiniCommand.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-using System;
-using System.Threading.Tasks;
-using System.Windows.Input;
-
-namespace Ryujinx.Ava.Ui.Models
-{
- public sealed class MiniCommand<T> : MiniCommand, ICommand
- {
- private readonly Action<T> _callback;
- private bool _busy;
- private Func<T, Task> _asyncCallback;
-
- public MiniCommand(Action<T> callback)
- {
- _callback = callback;
- }
-
- public MiniCommand(Func<T, Task> callback)
- {
- _asyncCallback = callback;
- }
-
- private bool Busy
- {
- get => _busy;
- set
- {
- _busy = value;
- CanExecuteChanged?.Invoke(this, EventArgs.Empty);
- }
- }
-
- public override event EventHandler CanExecuteChanged;
- public override bool CanExecute(object parameter) => !_busy;
-
- public override async void Execute(object parameter)
- {
- if (Busy)
- {
- return;
- }
- try
- {
- Busy = true;
- if (_callback != null)
- {
- _callback((T)parameter);
- }
- else
- {
- await _asyncCallback((T)parameter);
- }
- }
- finally
- {
- Busy = false;
- }
- }
- }
-
- public abstract class MiniCommand : ICommand
- {
- public static MiniCommand Create(Action callback) => new MiniCommand<object>(_ => callback());
- public static MiniCommand Create<TArg>(Action<TArg> callback) => new MiniCommand<TArg>(callback);
- public static MiniCommand CreateFromTask(Func<Task> callback) => new MiniCommand<object>(_ => callback());
-
- public abstract bool CanExecute(object parameter);
- public abstract void Execute(object parameter);
- public abstract event EventHandler CanExecuteChanged;
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/NavigationDialogHost.axaml b/Ryujinx.Ava/Ui/Controls/NavigationDialogHost.axaml
deleted file mode 100644
index fb1f6b6d..00000000
--- a/Ryujinx.Ava/Ui/Controls/NavigationDialogHost.axaml
+++ /dev/null
@@ -1,11 +0,0 @@
-<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"
- mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
- x:Class="Ryujinx.Ava.Ui.Controls.NavigationDialogHost"
- Focusable="True">
- <ui:Frame HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
- x:Name="ContentFrame" />
-</UserControl> \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/NavigationDialogHost.axaml.cs b/Ryujinx.Ava/Ui/Controls/NavigationDialogHost.axaml.cs
deleted file mode 100644
index ced88328..00000000
--- a/Ryujinx.Ava/Ui/Controls/NavigationDialogHost.axaml.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-using Avalonia;
-using Avalonia.Controls;
-using FluentAvalonia.UI.Controls;
-using LibHac;
-using Ryujinx.Ava.Common.Locale;
-using Ryujinx.Ava.Ui.ViewModels;
-using Ryujinx.HLE.FileSystem;
-using Ryujinx.HLE.HOS.Services.Account.Acc;
-using System;
-using System.Threading.Tasks;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- public partial class NavigationDialogHost : UserControl
- {
- public AccountManager AccountManager { get; }
- public ContentManager ContentManager { get; }
- public VirtualFileSystem VirtualFileSystem { get; }
- public HorizonClient HorizonClient { get; }
- public UserProfileViewModel ViewModel { get; set; }
-
- public NavigationDialogHost()
- {
- InitializeComponent();
- }
-
- public NavigationDialogHost(AccountManager accountManager, ContentManager contentManager,
- VirtualFileSystem virtualFileSystem, HorizonClient horizonClient)
- {
- AccountManager = accountManager;
- ContentManager = contentManager;
- VirtualFileSystem = virtualFileSystem;
- HorizonClient = horizonClient;
- ViewModel = new UserProfileViewModel(this);
-
-
- if (contentManager.GetCurrentFirmwareVersion() != null)
- {
- Task.Run(() =>
- {
- AvatarProfileViewModel.PreloadAvatars(contentManager, virtualFileSystem);
- });
- }
- InitializeComponent();
- }
-
- public void GoBack(object parameter = null)
- {
- if (ContentFrame.BackStack.Count > 0)
- {
- ContentFrame.GoBack();
- }
-
- ViewModel.LoadProfiles();
- }
-
- public void Navigate(Type sourcePageType, object parameter)
- {
- ContentFrame.Navigate(sourcePageType, parameter);
- }
-
- public static async Task Show(AccountManager ownerAccountManager, ContentManager ownerContentManager,
- VirtualFileSystem ownerVirtualFileSystem, HorizonClient ownerHorizonClient)
- {
- var content = new NavigationDialogHost(ownerAccountManager, ownerContentManager, ownerVirtualFileSystem, ownerHorizonClient);
- ContentDialog contentDialog = new ContentDialog
- {
- Title = LocaleManager.Instance["UserProfileWindowTitle"],
- PrimaryButtonText = "",
- SecondaryButtonText = "",
- CloseButtonText = LocaleManager.Instance["UserProfilesClose"],
- Content = content,
- Padding = new Thickness(0)
- };
-
- contentDialog.Closed += (sender, args) =>
- {
- content.ViewModel.Dispose();
- };
-
- await contentDialog.ShowAsync();
- }
-
- protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
- {
- base.OnAttachedToVisualTree(e);
-
- Navigate(typeof(UserSelector), this);
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/OffscreenTextBox.cs b/Ryujinx.Ava/Ui/Controls/OffscreenTextBox.cs
deleted file mode 100644
index ffe5bdde..00000000
--- a/Ryujinx.Ava/Ui/Controls/OffscreenTextBox.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using Avalonia.Controls;
-using Avalonia.Input;
-using Avalonia.Interactivity;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- public class OffscreenTextBox : TextBox
- {
- public RoutedEvent<KeyEventArgs> GetKeyDownRoutedEvent()
- {
- return KeyDownEvent;
- }
-
- public RoutedEvent<KeyEventArgs> GetKeyUpRoutedEvent()
- {
- return KeyUpEvent;
- }
-
- public void SendKeyDownEvent(KeyEventArgs keyEvent)
- {
- OnKeyDown(keyEvent);
- }
-
- public void SendKeyUpEvent(KeyEventArgs keyEvent)
- {
- OnKeyUp(keyEvent);
- }
-
- public void SendText(string text)
- {
- OnTextInput(new TextInputEventArgs()
- {
- Text = text,
- Device = KeyboardDevice.Instance,
- Source = this,
- RoutedEvent = TextInputEvent
- });
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/OpenGLEmbeddedWindow.cs b/Ryujinx.Ava/Ui/Controls/OpenGLEmbeddedWindow.cs
deleted file mode 100644
index f32bf041..00000000
--- a/Ryujinx.Ava/Ui/Controls/OpenGLEmbeddedWindow.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-using Avalonia;
-using Avalonia.OpenGL;
-using OpenTK.Graphics.OpenGL;
-using Ryujinx.Common.Configuration;
-using SPB.Graphics;
-using SPB.Graphics.OpenGL;
-using SPB.Platform;
-using SPB.Platform.GLX;
-using SPB.Platform.WGL;
-using SPB.Windowing;
-using System;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- public class OpenGLEmbeddedWindow : EmbeddedWindow
- {
- private readonly int _major;
- private readonly int _minor;
- private readonly GraphicsDebugLevel _graphicsDebugLevel;
- private SwappableNativeWindowBase _window;
- public OpenGLContextBase Context { get; set; }
-
- public OpenGLEmbeddedWindow(int major, int minor, GraphicsDebugLevel graphicsDebugLevel)
- {
- _major = major;
- _minor = minor;
- _graphicsDebugLevel = graphicsDebugLevel;
- }
-
- protected override void OnWindowDestroying()
- {
- Context.Dispose();
- base.OnWindowDestroying();
- }
-
- public override void OnWindowCreated()
- {
- base.OnWindowCreated();
-
- if (OperatingSystem.IsWindows())
- {
- _window = new WGLWindow(new NativeHandle(WindowHandle));
- }
- else if (OperatingSystem.IsLinux())
- {
- _window = X11Window;
- }
- else
- {
- throw new PlatformNotSupportedException();
- }
-
- var flags = OpenGLContextFlags.Compat;
- if (_graphicsDebugLevel != GraphicsDebugLevel.None)
- {
- flags |= OpenGLContextFlags.Debug;
- }
-
- Context = PlatformHelper.CreateOpenGLContext(FramebufferFormat.Default, _major, _minor, flags);
-
- Context.Initialize(_window);
- Context.MakeCurrent(_window);
-
- var bindingsContext = new OpenToolkitBindingsContext(Context.GetProcAddress);
-
- GL.LoadBindings(bindingsContext);
- Context.MakeCurrent(null);
- }
-
- public void MakeCurrent()
- {
- Context?.MakeCurrent(_window);
- }
-
- public void MakeCurrent(NativeWindowBase window)
- {
- Context?.MakeCurrent(window);
- }
-
- public void SwapBuffers()
- {
- _window.SwapBuffers();
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/OpenToolkitBindingsContext.cs b/Ryujinx.Ava/Ui/Controls/OpenToolkitBindingsContext.cs
deleted file mode 100644
index 3a767ce9..00000000
--- a/Ryujinx.Ava/Ui/Controls/OpenToolkitBindingsContext.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using OpenTK;
-using System;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- internal class OpenToolkitBindingsContext : IBindingsContext
- {
- private readonly Func<string, IntPtr> _getProcAddress;
-
- public OpenToolkitBindingsContext(Func<string, IntPtr> getProcAddress)
- {
- _getProcAddress = getProcAddress;
- }
-
- public IntPtr GetProcAddress(string procName)
- {
- return _getProcAddress(procName);
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/ProfileImageSelectionDialog.axaml b/Ryujinx.Ava/Ui/Controls/ProfileImageSelectionDialog.axaml
deleted file mode 100644
index 7bbd03ca..00000000
--- a/Ryujinx.Ava/Ui/Controls/ProfileImageSelectionDialog.axaml
+++ /dev/null
@@ -1,32 +0,0 @@
-<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"
- mc:Ignorable="d"
- xmlns:Locale="clr-namespace:Ryujinx.Ava.Common.Locale"
- x:Class="Ryujinx.Ava.Ui.Controls.ProfileImageSelectionDialog"
- Focusable="True">
- <Grid HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="5,10,5, 5">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="70" />
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <TextBlock FontWeight="Bold" FontSize="18" HorizontalAlignment="Center" Grid.Row="1"
- Text="{Locale:Locale ProfileImageSelectionHeader}" />
- <TextBlock FontWeight="Bold" Grid.Row="2" Margin="10" MaxWidth="400" TextWrapping="Wrap"
- HorizontalAlignment="Center" TextAlignment="Center" Text="{Locale:Locale ProfileImageSelectionNote}" />
- <StackPanel Margin="5,0" Spacing="10" Grid.Row="4" HorizontalAlignment="Center"
- Orientation="Horizontal">
- <Button Name="Import" Click="Import_OnClick" Width="200">
- <TextBlock Text="{Locale:Locale ProfileImageSelectionImportImage}" />
- </Button>
- <Button Name="SelectFirmwareImage" IsEnabled="{Binding FirmwareFound}" Click="SelectFirmwareImage_OnClick"
- Width="200">
- <TextBlock Text="{Locale:Locale ProfileImageSelectionSelectAvatar}" />
- </Button>
- </StackPanel>
- </Grid>
-</UserControl> \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/ProfileImageSelectionDialog.axaml.cs b/Ryujinx.Ava/Ui/Controls/ProfileImageSelectionDialog.axaml.cs
deleted file mode 100644
index 5d361af9..00000000
--- a/Ryujinx.Ava/Ui/Controls/ProfileImageSelectionDialog.axaml.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-using Avalonia.Controls;
-using Avalonia.Interactivity;
-using Avalonia.VisualTree;
-using FluentAvalonia.UI.Controls;
-using FluentAvalonia.UI.Navigation;
-using Ryujinx.Ava.Common.Locale;
-using Ryujinx.Ava.Ui.Models;
-using Ryujinx.Ava.Ui.Windows;
-using Ryujinx.HLE.FileSystem;
-using SixLabors.ImageSharp;
-using SixLabors.ImageSharp.Processing;
-using System.IO;
-using Image = SixLabors.ImageSharp.Image;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- public partial class ProfileImageSelectionDialog : UserControl
- {
- private ContentManager _contentManager;
- private NavigationDialogHost _parent;
- private TempProfile _profile;
-
- public bool FirmwareFound => _contentManager.GetCurrentFirmwareVersion() != null;
-
- public ProfileImageSelectionDialog()
- {
- InitializeComponent();
- AddHandler(Frame.NavigatedToEvent, (s, e) =>
- {
- NavigatedTo(e);
- }, RoutingStrategies.Direct);
- }
-
- private void NavigatedTo(NavigationEventArgs arg)
- {
- if (Program.PreviewerDetached)
- {
- switch (arg.NavigationMode)
- {
- case NavigationMode.New:
- (_parent, _profile) = ((NavigationDialogHost, TempProfile))arg.Parameter;
- _contentManager = _parent.ContentManager;
- break;
- case NavigationMode.Back:
- _parent.GoBack();
- break;
- }
-
- DataContext = this;
- }
- }
-
- private async void Import_OnClick(object sender, RoutedEventArgs e)
- {
- OpenFileDialog dialog = new();
- dialog.Filters.Add(new FileDialogFilter
- {
- Name = LocaleManager.Instance["AllSupportedFormats"],
- Extensions = { "jpg", "jpeg", "png", "bmp" }
- });
- dialog.Filters.Add(new FileDialogFilter { Name = "JPEG", Extensions = { "jpg", "jpeg" } });
- dialog.Filters.Add(new FileDialogFilter { Name = "PNG", Extensions = { "png" } });
- dialog.Filters.Add(new FileDialogFilter { Name = "BMP", Extensions = { "bmp" } });
-
- dialog.AllowMultiple = false;
-
- string[] image = await dialog.ShowAsync(((TopLevel)_parent.GetVisualRoot()) as Window);
-
- if (image != null)
- {
- if (image.Length > 0)
- {
- string imageFile = image[0];
-
- _profile.Image = ProcessProfileImage(File.ReadAllBytes(imageFile));
- }
-
- _parent.GoBack();
- }
- }
-
- private void SelectFirmwareImage_OnClick(object sender, RoutedEventArgs e)
- {
- if (FirmwareFound)
- {
- _parent.Navigate(typeof(AvatarWindow), (_parent, _profile));
- }
- }
-
- private static byte[] ProcessProfileImage(byte[] buffer)
- {
- using (Image image = Image.Load(buffer))
- {
- image.Mutate(x => x.Resize(256, 256));
-
- using (MemoryStream streamJpg = new())
- {
- image.SaveAsJpeg(streamJpg);
-
- return streamJpg.ToArray();
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/RendererHost.axaml b/Ryujinx.Ava/Ui/Controls/RendererHost.axaml
deleted file mode 100644
index 45bc1b2b..00000000
--- a/Ryujinx.Ava/Ui/Controls/RendererHost.axaml
+++ /dev/null
@@ -1,8 +0,0 @@
-<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"
- mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
- x:Class="Ryujinx.Ava.Ui.Controls.RendererHost"
- Focusable="True">
-</UserControl>
diff --git a/Ryujinx.Ava/Ui/Controls/RendererHost.axaml.cs b/Ryujinx.Ava/Ui/Controls/RendererHost.axaml.cs
deleted file mode 100644
index b6986b7c..00000000
--- a/Ryujinx.Ava/Ui/Controls/RendererHost.axaml.cs
+++ /dev/null
@@ -1,126 +0,0 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
-using Ryujinx.Common.Configuration;
-using Silk.NET.Vulkan;
-using SPB.Graphics.OpenGL;
-using SPB.Windowing;
-using System;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- public partial class RendererHost : UserControl, IDisposable
- {
- private readonly GraphicsDebugLevel _graphicsDebugLevel;
- private EmbeddedWindow _currentWindow;
-
- public bool IsVulkan { get; private set; }
-
- public RendererHost(GraphicsDebugLevel graphicsDebugLevel)
- {
- _graphicsDebugLevel = graphicsDebugLevel;
- InitializeComponent();
- }
-
- public RendererHost()
- {
- InitializeComponent();
- }
-
- public void CreateOpenGL()
- {
- Dispose();
-
- _currentWindow = new OpenGLEmbeddedWindow(3, 3, _graphicsDebugLevel);
- Initialize();
-
- IsVulkan = false;
- }
-
- private void Initialize()
- {
- _currentWindow.WindowCreated += CurrentWindow_WindowCreated;
- _currentWindow.SizeChanged += CurrentWindow_SizeChanged;
- Content = _currentWindow;
- }
-
- public void CreateVulkan()
- {
- Dispose();
-
- _currentWindow = new VulkanEmbeddedWindow();
- Initialize();
-
- IsVulkan = true;
- }
-
- public OpenGLContextBase GetContext()
- {
- if (_currentWindow is OpenGLEmbeddedWindow openGlEmbeddedWindow)
- {
- return openGlEmbeddedWindow.Context;
- }
-
- return null;
- }
-
- protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
- {
- base.OnDetachedFromVisualTree(e);
-
- Dispose();
- }
-
- private void CurrentWindow_SizeChanged(object sender, Size e)
- {
- SizeChanged?.Invoke(sender, e);
- }
-
- private void CurrentWindow_WindowCreated(object sender, IntPtr e)
- {
- RendererInitialized?.Invoke(this, EventArgs.Empty);
- }
-
- public void MakeCurrent()
- {
- if (_currentWindow is OpenGLEmbeddedWindow openGlEmbeddedWindow)
- {
- openGlEmbeddedWindow.MakeCurrent();
- }
- }
-
- public void MakeCurrent(SwappableNativeWindowBase window)
- {
- if (_currentWindow is OpenGLEmbeddedWindow openGlEmbeddedWindow)
- {
- openGlEmbeddedWindow.MakeCurrent(window);
- }
- }
-
- public void SwapBuffers()
- {
- if (_currentWindow is OpenGLEmbeddedWindow openGlEmbeddedWindow)
- {
- openGlEmbeddedWindow.SwapBuffers();
- }
- }
-
- public event EventHandler<EventArgs> RendererInitialized;
- public event Action<object, Size> SizeChanged;
- public void Dispose()
- {
- if (_currentWindow != null)
- {
- _currentWindow.WindowCreated -= CurrentWindow_WindowCreated;
- _currentWindow.SizeChanged -= CurrentWindow_SizeChanged;
- }
- }
-
- public SurfaceKHR CreateVulkanSurface(Instance instance, Vk api)
- {
- return (_currentWindow is VulkanEmbeddedWindow vulkanEmbeddedWindow)
- ? vulkanEmbeddedWindow.CreateSurface(instance)
- : default;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/SPBOpenGLContext.cs b/Ryujinx.Ava/Ui/Controls/SPBOpenGLContext.cs
deleted file mode 100644
index 45c6187e..00000000
--- a/Ryujinx.Ava/Ui/Controls/SPBOpenGLContext.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using OpenTK.Graphics.OpenGL;
-using Ryujinx.Graphics.OpenGL;
-using SPB.Graphics;
-using SPB.Graphics.OpenGL;
-using SPB.Platform;
-using SPB.Windowing;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- class SPBOpenGLContext : IOpenGLContext
- {
- private OpenGLContextBase _context;
- private NativeWindowBase _window;
-
- private SPBOpenGLContext(OpenGLContextBase context, NativeWindowBase window)
- {
- _context = context;
- _window = window;
- }
-
- public void Dispose()
- {
- _context.Dispose();
- _window.Dispose();
- }
-
- public void MakeCurrent()
- {
- _context.MakeCurrent(_window);
- }
-
- public static SPBOpenGLContext CreateBackgroundContext(OpenGLContextBase sharedContext)
- {
- OpenGLContextBase context = PlatformHelper.CreateOpenGLContext(FramebufferFormat.Default, 3, 3, OpenGLContextFlags.Compat, true, sharedContext);
- NativeWindowBase window = PlatformHelper.CreateOpenGLWindow(FramebufferFormat.Default, 0, 0, 100, 100);
-
- context.Initialize(window);
- context.MakeCurrent(window);
-
- GL.LoadBindings(new OpenToolkitBindingsContext(context.GetProcAddress));
-
- context.MakeCurrent(null);
-
- return new SPBOpenGLContext(context, window);
- }
- }
-}
diff --git a/Ryujinx.Ava/Ui/Controls/SaveManager.axaml b/Ryujinx.Ava/Ui/Controls/SaveManager.axaml
deleted file mode 100644
index 8721d2a7..00000000
--- a/Ryujinx.Ava/Ui/Controls/SaveManager.axaml
+++ /dev/null
@@ -1,103 +0,0 @@
-<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:controls="clr-namespace:Ryujinx.Ava.Ui.Controls"
- xmlns:models="clr-namespace:Ryujinx.Ava.Ui.Models"
- xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
- xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
- mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
- Height="400"
- Width="550"
- x:Class="Ryujinx.Ava.Ui.Controls.SaveManager"
- Focusable="True">
- <UserControl.Resources>
- <controls:BitmapArrayValueConverter x:Key="ByteImage" />
- </UserControl.Resources>
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition />
- </Grid.RowDefinitions>
- <Grid Grid.Row="0" HorizontalAlignment="Stretch">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition />
- </Grid.ColumnDefinitions>
- <StackPanel Spacing="10" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
- <Label Content="{locale:Locale CommonSort}" VerticalAlignment="Center" />
- <ComboBox SelectedIndex="{Binding SortIndex}" Width="100">
- <ComboBoxItem>
- <Label VerticalAlignment="Center" HorizontalContentAlignment="Left"
- Content="{locale:Locale Name}" />
- </ComboBoxItem>
- <ComboBoxItem>
- <Label VerticalAlignment="Center" HorizontalContentAlignment="Left"
- Content="{locale:Locale Size}" />
- </ComboBoxItem>
- </ComboBox>
- <ComboBox SelectedIndex="{Binding OrderIndex}" Width="150">
- <ComboBoxItem>
- <Label VerticalAlignment="Center" HorizontalContentAlignment="Left"
- Content="{locale:Locale OrderAscending}" />
- </ComboBoxItem>
- <ComboBoxItem>
- <Label VerticalAlignment="Center" HorizontalContentAlignment="Left"
- Content="{locale:Locale Descending}" />
- </ComboBoxItem>
- </ComboBox>
- </StackPanel>
- <Grid Grid.Column="1" HorizontalAlignment="Stretch" Margin="10,0, 0, 0">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto"/>
- <ColumnDefinition/>
- </Grid.ColumnDefinitions>
- <Label Content="{locale:Locale Search}" VerticalAlignment="Center"/>
- <TextBox Margin="5,0,0,0" Grid.Column="1" HorizontalAlignment="Stretch" Text="{Binding Search}"/>
- </Grid>
- </Grid>
- <Border Grid.Row="1" Margin="0,5" BorderThickness="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
- <ListBox Name="SaveList" Items="{Binding View}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
- <ListBox.ItemTemplate>
- <DataTemplate x:DataType="models:SaveModel">
- <Grid HorizontalAlignment="Stretch" Margin="0,5">
- <Grid.ColumnDefinitions>
- <ColumnDefinition />
- <ColumnDefinition Width="Auto" />
- </Grid.ColumnDefinitions>
- <StackPanel Grid.Column="0" Orientation="Horizontal">
- <Border Height="42" Margin="2" Width="42" Padding="10"
- IsVisible="{Binding !InGameList}">
- <ui:SymbolIcon Symbol="Help" FontSize="30" HorizontalAlignment="Center"
- VerticalAlignment="Center" />
- </Border>
- <Image IsVisible="{Binding InGameList}"
- Margin="2"
- Width="42"
- Height="42"
- Source="{Binding Icon, Converter={StaticResource ByteImage}}" />
- <TextBlock MaxLines="3" Width="320" Margin="5" TextWrapping="Wrap"
- Text="{Binding Title}" VerticalAlignment="Center" />
- </StackPanel>
- <StackPanel Grid.Column="1" Spacing="10" HorizontalAlignment="Right"
- Orientation="Horizontal">
- <Label Content="{Binding SizeString}" IsVisible="{Binding SizeAvailable}"
- VerticalAlignment="Center" HorizontalAlignment="Right" />
- <Button VerticalAlignment="Center" HorizontalAlignment="Right" Padding="10"
- MinWidth="0" MinHeight="0" Name="OpenLocation" Command="{Binding OpenLocation}">
- <ui:SymbolIcon Symbol="OpenFolder" HorizontalAlignment="Center"
- VerticalAlignment="Center" />
- </Button>
- <Button VerticalAlignment="Center" HorizontalAlignment="Right" Padding="10"
- MinWidth="0" MinHeight="0" Name="Delete" Command="{Binding Delete}">
- <ui:SymbolIcon Symbol="Delete" HorizontalAlignment="Center"
- VerticalAlignment="Center" />
- </Button>
- </StackPanel>
- </Grid>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- </Border>
- </Grid>
-</UserControl> \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/SaveManager.axaml.cs b/Ryujinx.Ava/Ui/Controls/SaveManager.axaml.cs
deleted file mode 100644
index 499cd918..00000000
--- a/Ryujinx.Ava/Ui/Controls/SaveManager.axaml.cs
+++ /dev/null
@@ -1,160 +0,0 @@
-using Avalonia.Controls;
-using DynamicData;
-using DynamicData.Binding;
-using LibHac;
-using LibHac.Common;
-using LibHac.Fs;
-using LibHac.Fs.Shim;
-using Ryujinx.Ava.Common;
-using Ryujinx.Ava.Common.Locale;
-using Ryujinx.Ava.Ui.Models;
-using Ryujinx.HLE.FileSystem;
-using Ryujinx.Ui.App.Common;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Threading.Tasks;
-using UserProfile = Ryujinx.Ava.Ui.Models.UserProfile;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- public partial class SaveManager : UserControl
- {
- private readonly UserProfile _userProfile;
- private readonly HorizonClient _horizonClient;
- private readonly VirtualFileSystem _virtualFileSystem;
- private int _sortIndex;
- private int _orderIndex;
- private ObservableCollection<SaveModel> _view = new ObservableCollection<SaveModel>();
- private string _search;
-
- public ObservableCollection<SaveModel> Saves { get; set; } = new ObservableCollection<SaveModel>();
-
- public ObservableCollection<SaveModel> View
- {
- get => _view;
- set => _view = value;
- }
-
- public int SortIndex
- {
- get => _sortIndex;
- set
- {
- _sortIndex = value;
- Sort();
- }
- }
-
- public int OrderIndex
- {
- get => _orderIndex;
- set
- {
- _orderIndex = value;
- Sort();
- }
- }
-
- public string Search
- {
- get => _search;
- set
- {
- _search = value;
- Sort();
- }
- }
-
- public SaveManager()
- {
- InitializeComponent();
- }
-
- public SaveManager(UserProfile userProfile, HorizonClient horizonClient, VirtualFileSystem virtualFileSystem)
- {
- _userProfile = userProfile;
- _horizonClient = horizonClient;
- _virtualFileSystem = virtualFileSystem;
- InitializeComponent();
-
- DataContext = this;
-
- Task.Run(LoadSaves);
- }
-
- public void LoadSaves()
- {
- Saves.Clear();
- var saveDataFilter = SaveDataFilter.Make(programId: default, saveType: SaveDataType.Account,
- new UserId((ulong)_userProfile.UserId.High, (ulong)_userProfile.UserId.Low), saveDataId: default, index: default);
-
- using var saveDataIterator = new UniqueRef<SaveDataIterator>();
-
- _horizonClient.Fs.OpenSaveDataIterator(ref saveDataIterator.Ref(), SaveDataSpaceId.User, in saveDataFilter).ThrowIfFailure();
-
- Span<SaveDataInfo> saveDataInfo = stackalloc SaveDataInfo[10];
-
- while (true)
- {
- saveDataIterator.Get.ReadSaveDataInfo(out long readCount, saveDataInfo).ThrowIfFailure();
-
- if (readCount == 0)
- {
- break;
- }
-
- for (int i = 0; i < readCount; i++)
- {
- var save = saveDataInfo[i];
- if (save.ProgramId.Value != 0)
- {
- var saveModel = new SaveModel(save, _horizonClient, _virtualFileSystem);
- Saves.Add(saveModel);
- saveModel.DeleteAction = () => { Saves.Remove(saveModel); };
- }
-
- Sort();
- }
- }
- }
-
- private void Sort()
- {
- Saves.AsObservableChangeSet()
- .Filter(Filter)
- .Sort(GetComparer())
- .Bind(out var view).AsObservableList();
-
- _view.Clear();
- _view.AddRange(view);
- }
-
- private IComparer<SaveModel> GetComparer()
- {
- switch (SortIndex)
- {
- case 0:
- return OrderIndex == 0
- ? SortExpressionComparer<SaveModel>.Ascending(save => save.Title)
- : SortExpressionComparer<SaveModel>.Descending(save => save.Title);
- case 1:
- return OrderIndex == 0
- ? SortExpressionComparer<SaveModel>.Ascending(save => save.Size)
- : SortExpressionComparer<SaveModel>.Descending(save => save.Size);
- default:
- return null;
- }
- }
-
- private bool Filter(object arg)
- {
- if (arg is SaveModel save)
- {
- return string.IsNullOrWhiteSpace(_search) || save.Title.ToLower().Contains(_search.ToLower());
- }
-
- return false;
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/UpdateWaitWindow.axaml b/Ryujinx.Ava/Ui/Controls/UpdateWaitWindow.axaml
deleted file mode 100644
index 8309e369..00000000
--- a/Ryujinx.Ava/Ui/Controls/UpdateWaitWindow.axaml
+++ /dev/null
@@ -1,43 +0,0 @@
-<Window
- x:Class="Ryujinx.Ava.Ui.Controls.UpdateWaitWindow"
- 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"
- Title="Ryujinx - Waiting"
- SizeToContent="WidthAndHeight"
- WindowStartupLocation="CenterOwner"
- mc:Ignorable="d"
- Focusable="True">
- <Grid
- Margin="20"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition />
- </Grid.ColumnDefinitions>
- <Image
- Grid.Row="1"
- Height="70"
- MinWidth="50"
- Margin="5,10,20,10"
- Source="resm:Ryujinx.Ui.Common.Resources.Logo_Ryujinx.png?assembly=Ryujinx.Ui.Common" />
- <StackPanel
- Grid.Row="1"
- Grid.Column="1"
- VerticalAlignment="Center"
- Orientation="Vertical">
- <TextBlock Name="PrimaryText" Margin="5" />
- <TextBlock
- Name="SecondaryText"
- Margin="5"
- VerticalAlignment="Center" />
- </StackPanel>
- </Grid>
-</Window> \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/UpdateWaitWindow.axaml.cs b/Ryujinx.Ava/Ui/Controls/UpdateWaitWindow.axaml.cs
deleted file mode 100644
index efea4339..00000000
--- a/Ryujinx.Ava/Ui/Controls/UpdateWaitWindow.axaml.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using Avalonia.Controls;
-using Ryujinx.Ava.Ui.Windows;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- public partial class UpdateWaitWindow : StyleableWindow
- {
- public UpdateWaitWindow(string primaryText, string secondaryText) : this()
- {
- PrimaryText.Text = primaryText;
- SecondaryText.Text = secondaryText;
- WindowStartupLocation = WindowStartupLocation.CenterOwner;
- }
-
- public UpdateWaitWindow()
- {
- InitializeComponent();
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/UserEditor.axaml b/Ryujinx.Ava/Ui/Controls/UserEditor.axaml
deleted file mode 100644
index a00e4210..00000000
--- a/Ryujinx.Ava/Ui/Controls/UserEditor.axaml
+++ /dev/null
@@ -1,89 +0,0 @@
-<UserControl
- x:Class="Ryujinx.Ava.Ui.Controls.UserEditor"
- xmlns="https://github.com/avaloniaui"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:Locale="clr-namespace:Ryujinx.Ava.Common.Locale"
- xmlns:controls="clr-namespace:Ryujinx.Ava.Ui.Controls"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:models="clr-namespace:Ryujinx.Ava.Ui.Models"
- xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
- xmlns:viewModels="clr-namespace:Ryujinx.Ava.Ui.ViewModels"
- Margin="0"
- MinWidth="500"
- Padding="0"
- mc:Ignorable="d"
- Focusable="True">
- <UserControl.Resources>
- <controls:BitmapArrayValueConverter x:Key="ByteImage" />
- </UserControl.Resources>
- <Grid Margin="0">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition />
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="*" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <StackPanel
- HorizontalAlignment="Left"
- VerticalAlignment="Stretch"
- Orientation="Vertical">
- <Image
- Name="ProfileImage"
- Width="96"
- Height="96"
- Margin="0"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Top"
- Source="{Binding Image, Converter={StaticResource ByteImage}}" />
- <Button
- Name="ChangePictureButton"
- Margin="5"
- HorizontalAlignment="Stretch"
- Click="ChangePictureButton_Click"
- Content="{Locale:Locale UserProfilesChangeProfileImage}" />
- <Button
- Name="AddPictureButton"
- Margin="5"
- HorizontalAlignment="Stretch"
- Click="ChangePictureButton_Click"
- Content="{Locale:Locale UserProfilesSetProfileImage}" />
- </StackPanel>
- <StackPanel
- Grid.Row="0"
- Grid.Column="1"
- Margin="5,10"
- HorizontalAlignment="Stretch"
- Orientation="Vertical"
- Spacing="10">
- <TextBlock Text="{Locale:Locale UserProfilesName}" />
- <TextBox
- Name="NameBox"
- Width="300"
- HorizontalAlignment="Stretch"
- MaxLength="{Binding MaxProfileNameLength}"
- Text="{Binding Name}" />
- <TextBlock Name="IdText" Text="{Locale:Locale UserProfilesUserId}" />
- <TextBlock Name="IdLabel" Text="{Binding UserId}" />
- </StackPanel>
- <StackPanel
- Grid.Row="1"
- Grid.Column="0"
- Grid.ColumnSpan="2"
- HorizontalAlignment="Right"
- Orientation="Horizontal"
- Spacing="10">
- <Button
- Name="SaveButton"
- Click="SaveButton_Click"
- Content="{Locale:Locale Save}" />
- <Button
- Name="CloseButton"
- HorizontalAlignment="Right"
- Click="CloseButton_Click"
- Content="{Locale:Locale Discard}" />
- </StackPanel>
- </Grid>
-</UserControl>
diff --git a/Ryujinx.Ava/Ui/Controls/UserEditor.axaml.cs b/Ryujinx.Ava/Ui/Controls/UserEditor.axaml.cs
deleted file mode 100644
index f5b51e4e..00000000
--- a/Ryujinx.Ava/Ui/Controls/UserEditor.axaml.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-using Avalonia.Controls;
-using Avalonia.Data;
-using Avalonia.Interactivity;
-using FluentAvalonia.UI.Controls;
-using FluentAvalonia.UI.Navigation;
-using Ryujinx.Ava.Common.Locale;
-using Ryujinx.Ava.Ui.Models;
-using UserProfile = Ryujinx.Ava.Ui.Models.UserProfile;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- public partial class UserEditor : UserControl
- {
- private NavigationDialogHost _parent;
- private UserProfile _profile;
- private bool _isNewUser;
-
- public TempProfile TempProfile { get; set; }
- public uint MaxProfileNameLength => 0x20;
-
- public UserEditor()
- {
- InitializeComponent();
- AddHandler(Frame.NavigatedToEvent, (s, e) =>
- {
- NavigatedTo(e);
- }, RoutingStrategies.Direct);
- }
-
- private void NavigatedTo(NavigationEventArgs arg)
- {
- if (Program.PreviewerDetached)
- {
- switch (arg.NavigationMode)
- {
- case NavigationMode.New:
- var args = ((NavigationDialogHost parent, UserProfile profile, bool isNewUser))arg.Parameter;
- _isNewUser = args.isNewUser;
- _profile = args.profile;
- TempProfile = new TempProfile(_profile);
-
- _parent = args.parent;
- break;
- }
-
- DataContext = TempProfile;
-
- AddPictureButton.IsVisible = _isNewUser;
- IdLabel.IsVisible = _profile != null;
- IdText.IsVisible = _profile != null;
- ChangePictureButton.IsVisible = !_isNewUser;
- }
- }
-
- private void CloseButton_Click(object sender, RoutedEventArgs e)
- {
- _parent?.GoBack();
- }
-
- private async void SaveButton_Click(object sender, RoutedEventArgs e)
- {
- DataValidationErrors.ClearErrors(NameBox);
- bool isInvalid = false;
-
- if (string.IsNullOrWhiteSpace(TempProfile.Name))
- {
- DataValidationErrors.SetError(NameBox, new DataValidationException(LocaleManager.Instance["UserProfileEmptyNameError"]));
-
- isInvalid = true;
- }
-
- if (TempProfile.Image == null)
- {
- await ContentDialogHelper.CreateWarningDialog(LocaleManager.Instance["UserProfileNoImageError"], "");
-
- isInvalid = true;
- }
-
- if(isInvalid)
- {
- return;
- }
-
- if (_profile != null && !_isNewUser)
- {
- _profile.Name = TempProfile.Name;
- _profile.Image = TempProfile.Image;
- _profile.UpdateState();
- _parent.AccountManager.SetUserName(_profile.UserId, _profile.Name);
- _parent.AccountManager.SetUserImage(_profile.UserId, _profile.Image);
- }
- else if (_isNewUser)
- {
- _parent.AccountManager.AddUser(TempProfile.Name, TempProfile.Image, TempProfile.UserId);
- }
- else
- {
- return;
- }
-
- _parent?.GoBack();
- }
-
- public void SelectProfileImage()
- {
- _parent.Navigate(typeof(ProfileImageSelectionDialog), (_parent, TempProfile));
- }
-
- private void ChangePictureButton_Click(object sender, RoutedEventArgs e)
- {
- if (_profile != null || _isNewUser)
- {
- SelectProfileImage();
- }
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/UserErrorDialog.cs b/Ryujinx.Ava/Ui/Controls/UserErrorDialog.cs
deleted file mode 100644
index 0b2d2c11..00000000
--- a/Ryujinx.Ava/Ui/Controls/UserErrorDialog.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-using Ryujinx.Ava.Common.Locale;
-using Ryujinx.Ava.Ui.Windows;
-using Ryujinx.Ui.Common;
-using Ryujinx.Ui.Common.Helper;
-using System.Threading.Tasks;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- internal class UserErrorDialog
- {
- private const string SetupGuideUrl = "https://github.com/Ryujinx/Ryujinx/wiki/Ryujinx-Setup-&-Configuration-Guide";
-
- private static string GetErrorCode(UserError error)
- {
- return $"RYU-{(uint)error:X4}";
- }
-
- private static string GetErrorTitle(UserError error)
- {
- return error switch
- {
- UserError.NoKeys => LocaleManager.Instance["UserErrorNoKeys"],
- UserError.NoFirmware => LocaleManager.Instance["UserErrorNoFirmware"],
- UserError.FirmwareParsingFailed => LocaleManager.Instance["UserErrorFirmwareParsingFailed"],
- UserError.ApplicationNotFound => LocaleManager.Instance["UserErrorApplicationNotFound"],
- UserError.Unknown => LocaleManager.Instance["UserErrorUnknown"],
- _ => LocaleManager.Instance["UserErrorUndefined"]
- };
- }
-
- private static string GetErrorDescription(UserError error)
- {
- return error switch
- {
- UserError.NoKeys => LocaleManager.Instance["UserErrorNoKeysDescription"],
- UserError.NoFirmware => LocaleManager.Instance["UserErrorNoFirmwareDescription"],
- UserError.FirmwareParsingFailed => LocaleManager.Instance["UserErrorFirmwareParsingFailedDescription"],
- UserError.ApplicationNotFound => LocaleManager.Instance["UserErrorApplicationNotFoundDescription"],
- UserError.Unknown => LocaleManager.Instance["UserErrorUnknownDescription"],
- _ => LocaleManager.Instance["UserErrorUndefinedDescription"]
- };
- }
-
- private static bool IsCoveredBySetupGuide(UserError error)
- {
- return error switch
- {
- UserError.NoKeys or
- UserError.NoFirmware or
- UserError.FirmwareParsingFailed => true,
- _ => false
- };
- }
-
- private static string GetSetupGuideUrl(UserError error)
- {
- if (!IsCoveredBySetupGuide(error))
- {
- return null;
- }
-
- return error switch
- {
- UserError.NoKeys => SetupGuideUrl + "#initial-setup---placement-of-prodkeys",
- UserError.NoFirmware => SetupGuideUrl + "#initial-setup-continued---installation-of-firmware",
- _ => SetupGuideUrl
- };
- }
-
- public static async Task ShowUserErrorDialog(UserError error, StyleableWindow owner)
- {
- string errorCode = GetErrorCode(error);
-
- bool isInSetupGuide = IsCoveredBySetupGuide(error);
-
- string setupButtonLabel = isInSetupGuide ? LocaleManager.Instance["OpenSetupGuideMessage"] : "";
-
- var result = await ContentDialogHelper.CreateInfoDialog(
- string.Format(LocaleManager.Instance["DialogUserErrorDialogMessage"], errorCode, GetErrorTitle(error)),
- GetErrorDescription(error) + (isInSetupGuide
- ? LocaleManager.Instance["DialogUserErrorDialogInfoMessage"]
- : ""), setupButtonLabel, LocaleManager.Instance["InputDialogOk"],
- string.Format(LocaleManager.Instance["DialogUserErrorDialogTitle"], errorCode));
-
- if (result == UserResult.Ok)
- {
- OpenHelper.OpenUrl(GetSetupGuideUrl(error));
- }
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/UserRecoverer.axaml b/Ryujinx.Ava/Ui/Controls/UserRecoverer.axaml
deleted file mode 100644
index 0efb5019..00000000
--- a/Ryujinx.Ava/Ui/Controls/UserRecoverer.axaml
+++ /dev/null
@@ -1,71 +0,0 @@
-<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"
- mc:Ignorable="d"
- d:DesignWidth="800"
- d:DesignHeight="450"
- MinWidth="500"
- MinHeight="400"
- xmlns:Locale="clr-namespace:Ryujinx.Ava.Common.Locale"
- xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
- xmlns:viewModels="clr-namespace:Ryujinx.Ava.Ui.ViewModels"
- x:Class="Ryujinx.Ava.Ui.Controls.UserRecoverer"
- Focusable="True">
- <Design.DataContext>
- <viewModels:UserProfileViewModel />
- </Design.DataContext>
- <Grid HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition/>
- </Grid.RowDefinitions>
- <Button Grid.Row="0"
- Margin="5"
- Height="30"
- Width="50"
- MinWidth="50"
- HorizontalAlignment="Left"
- Command="{Binding GoBack}">
- <ui:SymbolIcon Symbol="Back"/>
- </Button>
- <TextBlock Grid.Row="1"
- Text="{Locale:Locale UserProfilesRecoverHeading}"/>
- <ListBox
- Margin="5"
- Grid.Row="2"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- Items="{Binding LostProfiles}">
- <ListBox.ItemTemplate>
- <DataTemplate>
- <Border
- Margin="2"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- ClipToBounds="True"
- CornerRadius="5">
- <Grid Margin="0">
- <Grid.ColumnDefinitions>
- <ColumnDefinition/>
- <ColumnDefinition Width="Auto"/>
- </Grid.ColumnDefinitions>
- <TextBlock
- HorizontalAlignment="Stretch"
- Text="{Binding UserId}"
- TextAlignment="Left"
- TextWrapping="Wrap" />
- <Button Grid.Column="1"
- HorizontalAlignment="Right"
- Command="{Binding Recover}"
- CommandParameter="{Binding}"
- Content="{Locale:Locale Recover}"/>
- </Grid>
- </Border>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- </Grid>
-</UserControl>
diff --git a/Ryujinx.Ava/Ui/Controls/UserRecoverer.axaml.cs b/Ryujinx.Ava/Ui/Controls/UserRecoverer.axaml.cs
deleted file mode 100644
index f093686d..00000000
--- a/Ryujinx.Ava/Ui/Controls/UserRecoverer.axaml.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Interactivity;
-using Avalonia.Markup.Xaml;
-using FluentAvalonia.UI.Controls;
-using FluentAvalonia.UI.Navigation;
-using Ryujinx.Ava.Ui.Models;
-using Ryujinx.Ava.Ui.ViewModels;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- public partial class UserRecoverer : UserControl
- {
- private UserProfileViewModel _viewModel;
- private NavigationDialogHost _parent;
-
- public UserRecoverer()
- {
- InitializeComponent();
- AddHandler(Frame.NavigatedToEvent, (s, e) =>
- {
- NavigatedTo(e);
- }, RoutingStrategies.Direct);
- }
-
- private void NavigatedTo(NavigationEventArgs arg)
- {
- if (Program.PreviewerDetached)
- {
- switch (arg.NavigationMode)
- {
- case NavigationMode.New:
- var args = ((NavigationDialogHost parent, UserProfileViewModel viewModel))arg.Parameter;
-
- _viewModel = args.viewModel;
- _parent = args.parent;
- break;
- }
-
- DataContext = _viewModel;
- }
- }
- }
-}
diff --git a/Ryujinx.Ava/Ui/Controls/UserResult.cs b/Ryujinx.Ava/Ui/Controls/UserResult.cs
deleted file mode 100644
index 6eb89a90..00000000
--- a/Ryujinx.Ava/Ui/Controls/UserResult.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace Ryujinx.Ava.Ui.Controls
-{
- public enum UserResult
- {
- Ok,
- Yes,
- No,
- Abort,
- Cancel,
- None,
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/UserSelector.axaml b/Ryujinx.Ava/Ui/Controls/UserSelector.axaml
deleted file mode 100644
index 7cfdc481..00000000
--- a/Ryujinx.Ava/Ui/Controls/UserSelector.axaml
+++ /dev/null
@@ -1,146 +0,0 @@
-<UserControl
- x:Class="Ryujinx.Ava.Ui.Controls.UserSelector"
- xmlns="https://github.com/avaloniaui"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:Locale="clr-namespace:Ryujinx.Ava.Common.Locale"
- xmlns:controls="clr-namespace:Ryujinx.Ava.Ui.Controls"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:flex="clr-namespace:Avalonia.Flexbox;assembly=Avalonia.Flexbox"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
- xmlns:viewModels="clr-namespace:Ryujinx.Ava.Ui.ViewModels"
- d:DesignHeight="450"
- MinWidth="500"
- d:DesignWidth="800"
- mc:Ignorable="d"
- Focusable="True">
- <UserControl.Resources>
- <controls:BitmapArrayValueConverter x:Key="ByteImage" />
- </UserControl.Resources>
- <Design.DataContext>
- <viewModels:UserProfileViewModel />
- </Design.DataContext>
- <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
- <Grid.RowDefinitions>
- <RowDefinition />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <ListBox
- Margin="5"
- MaxHeight="300"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Center"
- DoubleTapped="ProfilesList_DoubleTapped"
- Items="{Binding Profiles}"
- SelectionChanged="SelectingItemsControl_SelectionChanged">
- <ListBox.ItemsPanel>
- <ItemsPanelTemplate>
- <flex:FlexPanel
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- AlignContent="FlexStart"
- JustifyContent="Center" />
- </ItemsPanelTemplate>
- </ListBox.ItemsPanel>
- <ListBox.ItemTemplate>
- <DataTemplate>
- <Grid>
- <Border
- Margin="2"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- ClipToBounds="True"
- CornerRadius="5">
- <Grid Margin="0">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition Height="Auto" />
- </Grid.RowDefinitions>
- <Image
- Grid.Row="0"
- Width="96"
- Height="96"
- Margin="0"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Top"
- Source="{Binding Image, Converter={StaticResource ByteImage}}" />
- <StackPanel
- Grid.Row="1"
- Height="30"
- Margin="5"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch">
- <TextBlock
- HorizontalAlignment="Stretch"
- Text="{Binding Name}"
- TextAlignment="Center"
- TextWrapping="Wrap" />
- </StackPanel>
- </Grid>
- </Border>
- <Border
- Width="10"
- Height="10"
- Margin="5"
- HorizontalAlignment="Left"
- VerticalAlignment="Top"
- Background="LimeGreen"
- CornerRadius="5"
- IsVisible="{Binding IsOpened}" />
- </Grid>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- <Grid
- Grid.Row="1"
- HorizontalAlignment="Center">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="Auto"/>
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto"/>
- <ColumnDefinition Width="Auto"/>
- </Grid.ColumnDefinitions>
- <Button
- HorizontalAlignment="Stretch"
- Grid.Row="0"
- Grid.Column="0"
- Margin="2"
- Command="{Binding AddUser}"
- Content="{Locale:Locale UserProfilesAddNewProfile}" />
- <Button
- HorizontalAlignment="Stretch"
- Grid.Row="0"
- Margin="2"
- Grid.Column="1"
- Command="{Binding EditUser}"
- Content="{Locale:Locale UserProfilesEditProfile}"
- IsEnabled="{Binding IsSelectedProfiledEditable}" />
- <Button
- HorizontalAlignment="Stretch"
- Grid.Row="1"
- Grid.Column="0"
- Margin="2"
- Content="{Locale:Locale UserProfilesManageSaves}"
- Command="{Binding ManageSaves}" />
- <Button
- HorizontalAlignment="Stretch"
- Grid.Row="1"
- Grid.Column="1"
- Margin="2"
- Command="{Binding DeleteUser}"
- Content="{Locale:Locale UserProfilesDeleteSelectedProfile}"
- IsEnabled="{Binding IsSelectedProfileDeletable}" />
- <Button
- HorizontalAlignment="Stretch"
- Grid.Row="2"
- Grid.ColumnSpan="2"
- Grid.Column="0"
- Margin="2"
- Command="{Binding RecoverLostAccounts}"
- Content="{Locale:Locale UserProfilesRecoverLostAccounts}" />
- </Grid>
- </Grid>
-</UserControl> \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/UserSelector.axaml.cs b/Ryujinx.Ava/Ui/Controls/UserSelector.axaml.cs
deleted file mode 100644
index 8d93088c..00000000
--- a/Ryujinx.Ava/Ui/Controls/UserSelector.axaml.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-using Avalonia.Controls;
-using Avalonia.Interactivity;
-using FluentAvalonia.UI.Controls;
-using FluentAvalonia.UI.Navigation;
-using Ryujinx.Ava.Ui.ViewModels;
-using UserProfile = Ryujinx.Ava.Ui.Models.UserProfile;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- public partial class UserSelector : UserControl
- {
- private NavigationDialogHost _parent;
- public UserProfileViewModel ViewModel { get; set; }
-
- public UserSelector()
- {
- InitializeComponent();
-
- if (Program.PreviewerDetached)
- {
- AddHandler(Frame.NavigatedToEvent, (s, e) =>
- {
- NavigatedTo(e);
- }, RoutingStrategies.Direct);
- }
- }
-
- private void NavigatedTo(NavigationEventArgs arg)
- {
- if (Program.PreviewerDetached)
- {
- if (arg.NavigationMode == NavigationMode.New)
- {
- _parent = (NavigationDialogHost)arg.Parameter;
- ViewModel = _parent.ViewModel;
- }
-
- DataContext = ViewModel;
- }
- }
-
- private void ProfilesList_DoubleTapped(object sender, RoutedEventArgs e)
- {
- if (sender is ListBox listBox)
- {
- int selectedIndex = listBox.SelectedIndex;
-
- if (selectedIndex >= 0 && selectedIndex < ViewModel.Profiles.Count)
- {
- ViewModel.SelectedProfile = ViewModel.Profiles[selectedIndex];
-
- _parent?.AccountManager?.OpenUser(ViewModel.SelectedProfile.UserId);
-
- ViewModel.LoadProfiles();
-
- foreach (UserProfile profile in ViewModel.Profiles)
- {
- profile.UpdateState();
- }
- }
- }
- }
-
- private void SelectingItemsControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- if (sender is ListBox listBox)
- {
- int selectedIndex = listBox.SelectedIndex;
-
- if (selectedIndex >= 0 && selectedIndex < ViewModel.Profiles.Count)
- {
- ViewModel.HighlightedProfile = ViewModel.Profiles[selectedIndex];
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/VulkanEmbeddedWindow.cs b/Ryujinx.Ava/Ui/Controls/VulkanEmbeddedWindow.cs
deleted file mode 100644
index b9c5f75f..00000000
--- a/Ryujinx.Ava/Ui/Controls/VulkanEmbeddedWindow.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using Avalonia.Platform;
-using Ryujinx.Ava.Ui.Controls;
-using Silk.NET.Vulkan;
-using SPB.Graphics.Vulkan;
-using SPB.Platform.GLX;
-using SPB.Platform.Metal;
-using SPB.Platform.Win32;
-using SPB.Platform.X11;
-using SPB.Windowing;
-using System;
-using System.Runtime.Versioning;
-
-namespace Ryujinx.Ava.Ui
-{
- public class VulkanEmbeddedWindow : EmbeddedWindow
- {
- private NativeWindowBase _window;
-
- [SupportedOSPlatform("linux")]
- protected override IPlatformHandle CreateLinux(IPlatformHandle parent)
- {
- X11Window = new GLXWindow(new NativeHandle(X11.DefaultDisplay), new NativeHandle(parent.Handle));
- WindowHandle = X11Window.WindowHandle.RawHandle;
- X11Display = X11Window.DisplayHandle.RawHandle;
-
- X11Window.Hide();
-
- return new PlatformHandle(WindowHandle, "X11");
- }
-
- public SurfaceKHR CreateSurface(Instance instance)
- {
- if (OperatingSystem.IsWindows())
- {
- _window = new SimpleWin32Window(new NativeHandle(WindowHandle));
- }
- else if (OperatingSystem.IsLinux())
- {
- _window = new SimpleX11Window(new NativeHandle(X11Display), new NativeHandle(WindowHandle));
- }
- else if (OperatingSystem.IsMacOS())
- {
- _window = new SimpleMetalWindow(new NativeHandle(NsView), new NativeHandle(MetalLayer));
- }
- else
- {
- throw new PlatformNotSupportedException();
- }
-
- return new SurfaceKHR((ulong?)VulkanHelper.CreateWindowSurface(instance.Handle, _window));
- }
- }
-} \ No newline at end of file
diff --git a/Ryujinx.Ava/Ui/Controls/Win32NativeInterop.cs b/Ryujinx.Ava/Ui/Controls/Win32NativeInterop.cs
deleted file mode 100644
index 81e2fee9..00000000
--- a/Ryujinx.Ava/Ui/Controls/Win32NativeInterop.cs
+++ /dev/null
@@ -1,107 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-using System.Runtime.Versioning;
-
-namespace Ryujinx.Ava.Ui.Controls
-{
- [SupportedOSPlatform("windows")]
- internal partial class Win32NativeInterop
- {
- [Flags]
- public enum ClassStyles : uint
- {
- CS_CLASSDC = 0x40,
- CS_OWNDC = 0x20,
- }
-
- [Flags]
- public enum WindowStyles : uint
- {
- WS_CHILD = 0x40000000
- }
-
- public enum Cursors : uint
- {
- IDC_ARROW = 32512
- }
-
- public enum WindowsMessages : uint
- {
- MOUSEMOVE = 0x0200,
- LBUTTONDOWN = 0x0201,
- LBUTTONUP = 0x0202,
- LBUTTONDBLCLK = 0x0203,
- RBUTTONDOWN = 0x0204,
- RBUTTONUP = 0x0205,
- RBUTTONDBLCLK = 0x0206,
- MBUTTONDOWN = 0x0207,
- MBUTTONUP = 0x0208,
- MBUTTONDBLCLK = 0x0209,
- MOUSEWHEEL = 0x020A,
- XBUTTONDOWN = 0x020B,
- XBUTTONUP = 0x020C,
- XBUTTONDBLCLK = 0x020D,
- MOUSEHWHEEL = 0x020E,
- MOUSELAST = 0x020E
- }
-
- [UnmanagedFunctionPointer(CallingConvention.Winapi)]
- internal delegate IntPtr WindowProc(IntPtr hWnd, WindowsMessages msg, IntPtr wParam, IntPtr lParam);
-
- [StructLayout(LayoutKind.Sequential)]
- public struct WNDCLASSEX
- {
- public int cbSize;
- public ClassStyles style;
- public IntPtr lpfnWndProc; // not WndProc
- public int cbClsExtra;
- public int cbWndExtra;
- public IntPtr hInstance;
- public IntPtr hIcon;
- public IntPtr hCursor;
- public IntPtr hbrBackground;
- public IntPtr lpszMenuName;
- public IntPtr lpszClassName;
- public IntPtr hIconSm;
-
- public WNDCLASSEX()
- {
- cbSize = Marshal.SizeOf<WNDCLASSEX>();
- }
- }
-
- [LibraryImport("user32.dll", SetLastError = true, EntryPoint = "RegisterClassExW")]
- public static partial ushort RegisterClassEx(ref WNDCLASSEX param);
-
- [LibraryImport("user32.dll", SetLastError = true, EntryPoint = "UnregisterClassW")]
- public static partial short UnregisterClass([MarshalAs(UnmanagedType.LPWStr)] string lpClassName, IntPtr instance);
-
- [LibraryImport("user32.dll", EntryPoint = "DefWindowProcW")]
- public static partial IntPtr DefWindowProc(IntPtr hWnd, WindowsMessages msg, IntPtr wParam, IntPtr lParam);
-
- [LibraryImport("kernel32.dll", EntryPoint = "GetModuleHandleA")]
- public static partial IntPtr GetModuleHandle([MarshalAs(UnmanagedType.LPStr)] string lpModuleName);
-
- [LibraryImport("user32.dll", SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static partial bool DestroyWindow(IntPtr hwnd);
-
- [LibraryImport("user32.dll", SetLastError = true, EntryPoint = "LoadCursorA")]
- public static partial IntPtr LoadCursor(IntPtr hInstance, IntPtr lpCursorName);
-
- [LibraryImport("user32.dll", SetLastError = true, EntryPoint = "CreateWindowExW")]
- public static partial IntPtr CreateWindowEx(
- uint dwExStyle,
- [MarshalAs(UnmanagedType.LPWStr)] string lpClassName,
- [MarshalAs(UnmanagedType.LPWStr)] string lpWindowName,
- WindowStyles dwStyle,
- int x,
- int y,
- int nWidth,
- int nHeight,
- IntPtr hWndParent,
- IntPtr hMenu,
- IntPtr hInstance,
- IntPtr lpParam);
- }
-}