From ec6cb0abb4b7669895b6e96fd7581c93b5abd691 Mon Sep 17 00:00:00 2001 From: Mary Guillemard Date: Sat, 2 Mar 2024 12:51:05 +0100 Subject: infra: Make Avalonia the default UI (#6375) * misc: Move Ryujinx project to Ryujinx.Gtk3 This breaks release CI for now but that's fine. Signed-off-by: Mary Guillemard * misc: Move Ryujinx.Ava project to Ryujinx This breaks CI for now, but it's fine. Signed-off-by: Mary Guillemard * infra: Make Avalonia the default UI Should fix CI after the previous changes. GTK3 isn't build by the release job anymore, only by PR CI. This also ensure that the test-ava update package is still generated to allow update from the old testing channel. Signed-off-by: Mary Guillemard * Fix missing copy in create_app_bundle.sh Signed-off-by: Mary Guillemard * Fix syntax error Signed-off-by: Mary Guillemard --------- Signed-off-by: Mary Guillemard --- .../UI/Views/Input/ControllerInputView.axaml | 1130 -------------------- .../UI/Views/Input/ControllerInputView.axaml.cs | 181 ---- .../UI/Views/Input/MotionInputView.axaml | 171 --- .../UI/Views/Input/MotionInputView.axaml.cs | 68 -- .../UI/Views/Input/RumbleInputView.axaml | 62 -- .../UI/Views/Input/RumbleInputView.axaml.cs | 58 - .../UI/Views/Main/MainMenuBarView.axaml | 203 ---- .../UI/Views/Main/MainMenuBarView.axaml.cs | 232 ---- .../UI/Views/Main/MainStatusBarView.axaml | 289 ----- .../UI/Views/Main/MainStatusBarView.axaml.cs | 72 -- .../UI/Views/Main/MainViewControls.axaml | 177 --- .../UI/Views/Main/MainViewControls.axaml.cs | 54 - .../UI/Views/Settings/SettingsAudioView.axaml | 81 -- .../UI/Views/Settings/SettingsAudioView.axaml.cs | 12 - .../UI/Views/Settings/SettingsCPUView.axaml | 77 -- .../UI/Views/Settings/SettingsCPUView.axaml.cs | 12 - .../UI/Views/Settings/SettingsGraphicsView.axaml | 301 ------ .../Views/Settings/SettingsGraphicsView.axaml.cs | 12 - .../UI/Views/Settings/SettingsHotkeysView.axaml | 103 -- .../UI/Views/Settings/SettingsHotkeysView.axaml.cs | 81 -- .../UI/Views/Settings/SettingsInputView.axaml | 67 -- .../UI/Views/Settings/SettingsInputView.axaml.cs | 17 - .../UI/Views/Settings/SettingsLoggingView.axaml | 120 --- .../UI/Views/Settings/SettingsLoggingView.axaml.cs | 12 - .../UI/Views/Settings/SettingsNetworkView.axaml | 58 - .../UI/Views/Settings/SettingsNetworkView.axaml.cs | 12 - .../UI/Views/Settings/SettingsSystemView.axaml | 224 ---- .../UI/Views/Settings/SettingsSystemView.axaml.cs | 37 - .../UI/Views/Settings/SettingsUIView.axaml | 128 --- .../UI/Views/Settings/SettingsUIView.axaml.cs | 65 -- src/Ryujinx.Ava/UI/Views/User/UserEditorView.axaml | 122 --- .../UI/Views/User/UserEditorView.axaml.cs | 165 --- .../User/UserFirmwareAvatarSelectorView.axaml | 113 -- .../User/UserFirmwareAvatarSelectorView.axaml.cs | 89 -- .../Views/User/UserProfileImageSelectorView.axaml | 62 -- .../User/UserProfileImageSelectorView.axaml.cs | 116 -- .../UI/Views/User/UserRecovererView.axaml | 82 -- .../UI/Views/User/UserRecovererView.axaml.cs | 51 - .../UI/Views/User/UserSaveManagerView.axaml | 213 ---- .../UI/Views/User/UserSaveManagerView.axaml.cs | 148 --- .../UI/Views/User/UserSelectorView.axaml | 162 --- .../UI/Views/User/UserSelectorView.axaml.cs | 129 --- 42 files changed, 5568 deletions(-) delete mode 100644 src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml delete mode 100644 src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml.cs delete mode 100644 src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml delete mode 100644 src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml.cs delete mode 100644 src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml delete mode 100644 src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml.cs delete mode 100644 src/Ryujinx.Ava/UI/Views/Main/MainMenuBarView.axaml delete mode 100644 src/Ryujinx.Ava/UI/Views/Main/MainMenuBarView.axaml.cs delete mode 100644 src/Ryujinx.Ava/UI/Views/Main/MainStatusBarView.axaml delete mode 100644 src/Ryujinx.Ava/UI/Views/Main/MainStatusBarView.axaml.cs delete mode 100644 src/Ryujinx.Ava/UI/Views/Main/MainViewControls.axaml delete mode 100644 src/Ryujinx.Ava/UI/Views/Main/MainViewControls.axaml.cs delete mode 100644 src/Ryujinx.Ava/UI/Views/Settings/SettingsAudioView.axaml delete mode 100644 src/Ryujinx.Ava/UI/Views/Settings/SettingsAudioView.axaml.cs delete mode 100644 src/Ryujinx.Ava/UI/Views/Settings/SettingsCPUView.axaml delete mode 100644 src/Ryujinx.Ava/UI/Views/Settings/SettingsCPUView.axaml.cs delete mode 100644 src/Ryujinx.Ava/UI/Views/Settings/SettingsGraphicsView.axaml delete mode 100644 src/Ryujinx.Ava/UI/Views/Settings/SettingsGraphicsView.axaml.cs delete mode 100644 src/Ryujinx.Ava/UI/Views/Settings/SettingsHotkeysView.axaml delete mode 100644 src/Ryujinx.Ava/UI/Views/Settings/SettingsHotkeysView.axaml.cs delete mode 100644 src/Ryujinx.Ava/UI/Views/Settings/SettingsInputView.axaml delete mode 100644 src/Ryujinx.Ava/UI/Views/Settings/SettingsInputView.axaml.cs delete mode 100644 src/Ryujinx.Ava/UI/Views/Settings/SettingsLoggingView.axaml delete mode 100644 src/Ryujinx.Ava/UI/Views/Settings/SettingsLoggingView.axaml.cs delete mode 100644 src/Ryujinx.Ava/UI/Views/Settings/SettingsNetworkView.axaml delete mode 100644 src/Ryujinx.Ava/UI/Views/Settings/SettingsNetworkView.axaml.cs delete mode 100644 src/Ryujinx.Ava/UI/Views/Settings/SettingsSystemView.axaml delete mode 100644 src/Ryujinx.Ava/UI/Views/Settings/SettingsSystemView.axaml.cs delete mode 100644 src/Ryujinx.Ava/UI/Views/Settings/SettingsUIView.axaml delete mode 100644 src/Ryujinx.Ava/UI/Views/Settings/SettingsUIView.axaml.cs delete mode 100644 src/Ryujinx.Ava/UI/Views/User/UserEditorView.axaml delete mode 100644 src/Ryujinx.Ava/UI/Views/User/UserEditorView.axaml.cs delete mode 100644 src/Ryujinx.Ava/UI/Views/User/UserFirmwareAvatarSelectorView.axaml delete mode 100644 src/Ryujinx.Ava/UI/Views/User/UserFirmwareAvatarSelectorView.axaml.cs delete mode 100644 src/Ryujinx.Ava/UI/Views/User/UserProfileImageSelectorView.axaml delete mode 100644 src/Ryujinx.Ava/UI/Views/User/UserProfileImageSelectorView.axaml.cs delete mode 100644 src/Ryujinx.Ava/UI/Views/User/UserRecovererView.axaml delete mode 100644 src/Ryujinx.Ava/UI/Views/User/UserRecovererView.axaml.cs delete mode 100644 src/Ryujinx.Ava/UI/Views/User/UserSaveManagerView.axaml delete mode 100644 src/Ryujinx.Ava/UI/Views/User/UserSaveManagerView.axaml.cs delete mode 100644 src/Ryujinx.Ava/UI/Views/User/UserSelectorView.axaml delete mode 100644 src/Ryujinx.Ava/UI/Views/User/UserSelectorView.axaml.cs (limited to 'src/Ryujinx.Ava/UI/Views') diff --git a/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml b/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml deleted file mode 100644 index 99f2b6b6..00000000 --- a/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml +++ /dev/null @@ -1,1130 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml.cs deleted file mode 100644 index 35129706..00000000 --- a/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml.cs +++ /dev/null @@ -1,181 +0,0 @@ -using Avalonia.Controls; -using Avalonia.Controls.Primitives; -using Avalonia.Input; -using Avalonia.Interactivity; -using Avalonia.LogicalTree; -using Ryujinx.Ava.Common.Locale; -using Ryujinx.Ava.UI.Helpers; -using Ryujinx.Ava.UI.Models; -using Ryujinx.Ava.UI.ViewModels; -using Ryujinx.Common.Configuration.Hid.Controller; -using Ryujinx.Input; -using Ryujinx.Input.Assigner; -using System; - -namespace Ryujinx.Ava.UI.Views.Input -{ - public partial class ControllerInputView : UserControl - { - private bool _dialogOpen; - - private ButtonKeyAssigner _currentAssigner; - internal ControllerInputViewModel ViewModel { get; set; } - - public ControllerInputView() - { - DataContext = ViewModel = new ControllerInputViewModel(this); - - InitializeComponent(); - - foreach (ILogical visual in SettingButtons.GetLogicalDescendants()) - { - if (visual is ToggleButton button && visual is not CheckBox) - { - button.IsCheckedChanged += Button_IsCheckedChanged; - } - } - } - - protected override void OnPointerReleased(PointerReleasedEventArgs e) - { - base.OnPointerReleased(e); - - if (_currentAssigner != null && _currentAssigner.ToggledButton != null && !_currentAssigner.ToggledButton.IsPointerOver) - { - _currentAssigner.Cancel(); - } - } - - private void Button_IsCheckedChanged(object sender, RoutedEventArgs e) - { - if (sender is ToggleButton button) - { - if ((bool)button.IsChecked) - { - if (_currentAssigner != null && button == _currentAssigner.ToggledButton) - { - return; - } - - bool isStick = button.Tag != null && button.Tag.ToString() == "stick"; - - if (_currentAssigner == null) - { - _currentAssigner = new ButtonKeyAssigner(button); - - this.Focus(NavigationMethod.Pointer); - - PointerPressed += MouseClick; - - IKeyboard keyboard = (IKeyboard)ViewModel.AvaloniaKeyboardDriver.GetGamepad("0"); // Open Avalonia keyboard for cancel operations. - IButtonAssigner assigner = CreateButtonAssigner(isStick); - - _currentAssigner.ButtonAssigned += (sender, e) => - { - if (e.IsAssigned) - { - ViewModel.IsModified = true; - } - }; - - _currentAssigner.GetInputAndAssign(assigner, keyboard); - } - else - { - if (_currentAssigner != null) - { - ToggleButton oldButton = _currentAssigner.ToggledButton; - - _currentAssigner.Cancel(); - _currentAssigner = null; - button.IsChecked = false; - } - } - } - else - { - _currentAssigner?.Cancel(); - _currentAssigner = null; - } - } - } - - public void SaveCurrentProfile() - { - ViewModel.Save(); - } - - private IButtonAssigner CreateButtonAssigner(bool forStick) - { - IButtonAssigner assigner; - - var device = ViewModel.Devices[ViewModel.Device]; - - if (device.Type == DeviceType.Keyboard) - { - assigner = new KeyboardKeyAssigner((IKeyboard)ViewModel.SelectedGamepad); - } - else if (device.Type == DeviceType.Controller) - { - assigner = new GamepadButtonAssigner(ViewModel.SelectedGamepad, (ViewModel.Config as StandardControllerInputConfig).TriggerThreshold, forStick); - } - else - { - throw new Exception("Controller not supported"); - } - - return assigner; - } - - private void MouseClick(object sender, PointerPressedEventArgs e) - { - bool shouldUnbind = false; - - if (e.GetCurrentPoint(this).Properties.IsMiddleButtonPressed) - { - shouldUnbind = true; - } - - _currentAssigner?.Cancel(shouldUnbind); - - PointerPressed -= MouseClick; - } - - private async void PlayerIndexBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) - { - if (ViewModel.IsModified && !_dialogOpen) - { - _dialogOpen = true; - - var result = await ContentDialogHelper.CreateConfirmationDialog( - LocaleManager.Instance[LocaleKeys.DialogControllerSettingsModifiedConfirmMessage], - LocaleManager.Instance[LocaleKeys.DialogControllerSettingsModifiedConfirmSubMessage], - LocaleManager.Instance[LocaleKeys.InputDialogYes], - LocaleManager.Instance[LocaleKeys.InputDialogNo], - LocaleManager.Instance[LocaleKeys.RyujinxConfirm]); - - if (result == UserResult.Yes) - { - ViewModel.Save(); - } - - _dialogOpen = false; - - ViewModel.IsModified = false; - - if (e.AddedItems.Count > 0) - { - var player = (PlayerModel)e.AddedItems[0]; - ViewModel.PlayerId = player.Id; - } - } - } - - public void Dispose() - { - _currentAssigner?.Cancel(); - _currentAssigner = null; - ViewModel.Dispose(); - } - } -} diff --git a/src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml b/src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml deleted file mode 100644 index a6b587f6..00000000 --- a/src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml +++ /dev/null @@ -1,171 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml.cs deleted file mode 100644 index 1b340752..00000000 --- a/src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml.cs +++ /dev/null @@ -1,68 +0,0 @@ -using Avalonia.Controls; -using FluentAvalonia.UI.Controls; -using Ryujinx.Ava.Common.Locale; -using Ryujinx.Ava.UI.Models; -using Ryujinx.Ava.UI.ViewModels; -using Ryujinx.Common.Configuration.Hid.Controller; -using System.Threading.Tasks; - -namespace Ryujinx.Ava.UI.Views.Input -{ - public partial class MotionInputView : UserControl - { - private readonly MotionInputViewModel _viewModel; - - public MotionInputView() - { - InitializeComponent(); - } - - public MotionInputView(ControllerInputViewModel viewModel) - { - var config = viewModel.Configuration as InputConfiguration; - - _viewModel = new MotionInputViewModel - { - Slot = config.Slot, - AltSlot = config.AltSlot, - DsuServerHost = config.DsuServerHost, - DsuServerPort = config.DsuServerPort, - MirrorInput = config.MirrorInput, - Sensitivity = config.Sensitivity, - GyroDeadzone = config.GyroDeadzone, - EnableCemuHookMotion = config.EnableCemuHookMotion, - }; - - InitializeComponent(); - DataContext = _viewModel; - } - - public static async Task Show(ControllerInputViewModel viewModel) - { - MotionInputView content = new(viewModel); - - ContentDialog contentDialog = new() - { - Title = LocaleManager.Instance[LocaleKeys.ControllerMotionTitle], - PrimaryButtonText = LocaleManager.Instance[LocaleKeys.ControllerSettingsSave], - SecondaryButtonText = "", - CloseButtonText = LocaleManager.Instance[LocaleKeys.ControllerSettingsClose], - Content = content, - }; - contentDialog.PrimaryButtonClick += (sender, args) => - { - var config = viewModel.Configuration as InputConfiguration; - config.Slot = content._viewModel.Slot; - config.Sensitivity = content._viewModel.Sensitivity; - config.GyroDeadzone = content._viewModel.GyroDeadzone; - config.AltSlot = content._viewModel.AltSlot; - config.DsuServerHost = content._viewModel.DsuServerHost; - config.DsuServerPort = content._viewModel.DsuServerPort; - config.EnableCemuHookMotion = content._viewModel.EnableCemuHookMotion; - config.MirrorInput = content._viewModel.MirrorInput; - }; - - await contentDialog.ShowAsync(); - } - } -} diff --git a/src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml b/src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml deleted file mode 100644 index 5b7087a4..00000000 --- a/src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml.cs deleted file mode 100644 index 9307f872..00000000 --- a/src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Avalonia.Controls; -using FluentAvalonia.UI.Controls; -using Ryujinx.Ava.Common.Locale; -using Ryujinx.Ava.UI.Models; -using Ryujinx.Ava.UI.ViewModels; -using Ryujinx.Common.Configuration.Hid.Controller; -using System.Threading.Tasks; - -namespace Ryujinx.Ava.UI.Views.Input -{ - public partial class RumbleInputView : UserControl - { - private readonly RumbleInputViewModel _viewModel; - - public RumbleInputView() - { - InitializeComponent(); - } - - public RumbleInputView(ControllerInputViewModel viewModel) - { - var config = viewModel.Configuration as InputConfiguration; - - _viewModel = new RumbleInputViewModel - { - StrongRumble = config.StrongRumble, - WeakRumble = config.WeakRumble, - }; - - InitializeComponent(); - - DataContext = _viewModel; - } - - public static async Task Show(ControllerInputViewModel viewModel) - { - RumbleInputView content = new(viewModel); - - ContentDialog contentDialog = new() - { - Title = LocaleManager.Instance[LocaleKeys.ControllerRumbleTitle], - PrimaryButtonText = LocaleManager.Instance[LocaleKeys.ControllerSettingsSave], - SecondaryButtonText = "", - CloseButtonText = LocaleManager.Instance[LocaleKeys.ControllerSettingsClose], - Content = content, - }; - - contentDialog.PrimaryButtonClick += (sender, args) => - { - var config = viewModel.Configuration as InputConfiguration; - config.StrongRumble = content._viewModel.StrongRumble; - config.WeakRumble = content._viewModel.WeakRumble; - }; - - await contentDialog.ShowAsync(); - } - } -} diff --git a/src/Ryujinx.Ava/UI/Views/Main/MainMenuBarView.axaml b/src/Ryujinx.Ava/UI/Views/Main/MainMenuBarView.axaml deleted file mode 100644 index 30358ada..00000000 --- a/src/Ryujinx.Ava/UI/Views/Main/MainMenuBarView.axaml +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Ryujinx.Ava/UI/Views/Main/MainMenuBarView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Main/MainMenuBarView.axaml.cs deleted file mode 100644 index 8dff5086..00000000 --- a/src/Ryujinx.Ava/UI/Views/Main/MainMenuBarView.axaml.cs +++ /dev/null @@ -1,232 +0,0 @@ -using Avalonia; -using Avalonia.Controls; -using Avalonia.Interactivity; -using LibHac.Ncm; -using LibHac.Tools.FsSystem.NcaUtils; -using Ryujinx.Ava.Common.Locale; -using Ryujinx.Ava.UI.Helpers; -using Ryujinx.Ava.UI.ViewModels; -using Ryujinx.Ava.UI.Windows; -using Ryujinx.Common; -using Ryujinx.Common.Utilities; -using Ryujinx.Modules; -using Ryujinx.UI.Common; -using Ryujinx.UI.Common.Configuration; -using Ryujinx.UI.Common.Helper; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; - -namespace Ryujinx.Ava.UI.Views.Main -{ - public partial class MainMenuBarView : UserControl - { - public MainWindow Window { get; private set; } - public MainWindowViewModel ViewModel { get; private set; } - - public MainMenuBarView() - { - InitializeComponent(); - - ToggleFileTypesMenuItem.ItemsSource = GenerateToggleFileTypeItems(); - ChangeLanguageMenuItem.ItemsSource = GenerateLanguageMenuItems(); - } - - private CheckBox[] GenerateToggleFileTypeItems() - { - List checkBoxes = new(); - - foreach (var item in Enum.GetValues(typeof(FileTypes))) - { - string fileName = Enum.GetName(typeof(FileTypes), item); - checkBoxes.Add(new CheckBox - { - Content = $".{fileName}", - IsChecked = ((FileTypes)item).GetConfigValue(ConfigurationState.Instance.UI.ShownFileTypes), - Command = MiniCommand.Create(() => Window.ToggleFileType(fileName)), - }); - } - - return checkBoxes.ToArray(); - } - - private static MenuItem[] GenerateLanguageMenuItems() - { - List menuItems = new(); - - string localePath = "Ryujinx.Ava/Assets/Locales"; - string localeExt = ".json"; - - string[] localesPath = EmbeddedResources.GetAllAvailableResources(localePath, localeExt); - - Array.Sort(localesPath); - - foreach (string locale in localesPath) - { - string languageCode = Path.GetFileNameWithoutExtension(locale).Split('.').Last(); - string languageJson = EmbeddedResources.ReadAllText($"{localePath}/{languageCode}{localeExt}"); - var strings = JsonHelper.Deserialize(languageJson, CommonJsonContext.Default.StringDictionary); - - if (!strings.TryGetValue("Language", out string languageName)) - { - languageName = languageCode; - } - - MenuItem menuItem = new() - { - Header = languageName, - Command = MiniCommand.Create(() => - { - MainWindowViewModel.ChangeLanguage(languageCode); - }), - }; - - menuItems.Add(menuItem); - } - - return menuItems.ToArray(); - } - - protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) - { - base.OnAttachedToVisualTree(e); - - if (VisualRoot is MainWindow window) - { - Window = window; - } - - ViewModel = Window.ViewModel; - DataContext = ViewModel; - } - - private async void StopEmulation_Click(object sender, RoutedEventArgs e) - { - await Window.ViewModel.AppHost?.ShowExitPrompt(); - } - - private void PauseEmulation_Click(object sender, RoutedEventArgs e) - { - Window.ViewModel.AppHost?.Pause(); - } - - private void ResumeEmulation_Click(object sender, RoutedEventArgs e) - { - Window.ViewModel.AppHost?.Resume(); - } - - public async void OpenSettings(object sender, RoutedEventArgs e) - { - Window.SettingsWindow = new(Window.VirtualFileSystem, Window.ContentManager); - - await Window.SettingsWindow.ShowDialog(Window); - - Window.SettingsWindow = null; - - ViewModel.LoadConfigurableHotKeys(); - } - - public async void OpenMiiApplet(object sender, RoutedEventArgs e) - { - string contentPath = ViewModel.ContentManager.GetInstalledContentPath(0x0100000000001009, StorageId.BuiltInSystem, NcaContentType.Program); - - if (!string.IsNullOrEmpty(contentPath)) - { - await ViewModel.LoadApplication(contentPath, false, "Mii Applet"); - } - } - - public async void OpenAmiiboWindow(object sender, RoutedEventArgs e) - { - if (!ViewModel.IsAmiiboRequested) - { - return; - } - - if (ViewModel.AppHost.Device.System.SearchingForAmiibo(out int deviceId)) - { - string titleId = ViewModel.AppHost.Device.Processes.ActiveApplication.ProgramIdText.ToUpper(); - AmiiboWindow window = new(ViewModel.ShowAll, ViewModel.LastScannedAmiiboId, titleId); - - await window.ShowDialog(Window); - - if (window.IsScanned) - { - ViewModel.ShowAll = window.ViewModel.ShowAllAmiibo; - ViewModel.LastScannedAmiiboId = window.ScannedAmiibo.GetId(); - - ViewModel.AppHost.Device.System.ScanAmiibo(deviceId, ViewModel.LastScannedAmiiboId, window.ViewModel.UseRandomUuid); - } - } - } - - public async void OpenCheatManagerForCurrentApp(object sender, RoutedEventArgs e) - { - if (!ViewModel.IsGameRunning) - { - return; - } - - string name = ViewModel.AppHost.Device.Processes.ActiveApplication.ApplicationControlProperties.Title[(int)ViewModel.AppHost.Device.System.State.DesiredTitleLanguage].NameString.ToString(); - - await new CheatWindow( - Window.VirtualFileSystem, - ViewModel.AppHost.Device.Processes.ActiveApplication.ProgramIdText, - name, - Window.ViewModel.SelectedApplication.Path).ShowDialog(Window); - - ViewModel.AppHost.Device.EnableCheats(); - } - - private void ScanAmiiboMenuItem_AttachedToVisualTree(object sender, VisualTreeAttachmentEventArgs e) - { - if (sender is MenuItem) - { - ViewModel.IsAmiiboRequested = Window.ViewModel.AppHost.Device.System.SearchingForAmiibo(out _); - } - } - - private async void InstallFileTypes_Click(object sender, RoutedEventArgs e) - { - if (FileAssociationHelper.Install()) - { - await ContentDialogHelper.CreateInfoDialog(LocaleManager.Instance[LocaleKeys.DialogInstallFileTypesSuccessMessage], string.Empty, LocaleManager.Instance[LocaleKeys.InputDialogOk], string.Empty, string.Empty); - } - else - { - await ContentDialogHelper.CreateErrorDialog(LocaleManager.Instance[LocaleKeys.DialogInstallFileTypesErrorMessage]); - } - } - - private async void UninstallFileTypes_Click(object sender, RoutedEventArgs e) - { - if (FileAssociationHelper.Uninstall()) - { - await ContentDialogHelper.CreateInfoDialog(LocaleManager.Instance[LocaleKeys.DialogUninstallFileTypesSuccessMessage], string.Empty, LocaleManager.Instance[LocaleKeys.InputDialogOk], string.Empty, string.Empty); - } - else - { - await ContentDialogHelper.CreateErrorDialog(LocaleManager.Instance[LocaleKeys.DialogUninstallFileTypesErrorMessage]); - } - } - - public async void CheckForUpdates(object sender, RoutedEventArgs e) - { - if (Updater.CanUpdate(true)) - { - await Updater.BeginParse(Window, true); - } - } - - public async void OpenAboutWindow(object sender, RoutedEventArgs e) - { - await AboutWindow.Show(); - } - - public void CloseWindow(object sender, RoutedEventArgs e) - { - Window.Close(); - } - } -} diff --git a/src/Ryujinx.Ava/UI/Views/Main/MainStatusBarView.axaml b/src/Ryujinx.Ava/UI/Views/Main/MainStatusBarView.axaml deleted file mode 100644 index f9e192e6..00000000 --- a/src/Ryujinx.Ava/UI/Views/Main/MainStatusBarView.axaml +++ /dev/null @@ -1,289 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Ryujinx.Ava/UI/Views/Main/MainStatusBarView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Main/MainStatusBarView.axaml.cs deleted file mode 100644 index 239a7cbf..00000000 --- a/src/Ryujinx.Ava/UI/Views/Main/MainStatusBarView.axaml.cs +++ /dev/null @@ -1,72 +0,0 @@ -using Avalonia; -using Avalonia.Controls; -using Avalonia.Input; -using Avalonia.Interactivity; -using Ryujinx.Ava.UI.Windows; -using Ryujinx.Common.Configuration; -using Ryujinx.Common.Logging; -using Ryujinx.UI.Common.Configuration; -using System; - -namespace Ryujinx.Ava.UI.Views.Main -{ - public partial class MainStatusBarView : UserControl - { - public MainWindow Window; - - public MainStatusBarView() - { - InitializeComponent(); - } - - protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) - { - base.OnAttachedToVisualTree(e); - - if (VisualRoot is MainWindow window) - { - Window = window; - } - - DataContext = Window.ViewModel; - } - - private void VsyncStatus_PointerReleased(object sender, PointerReleasedEventArgs e) - { - Window.ViewModel.AppHost.Device.EnableDeviceVsync = !Window.ViewModel.AppHost.Device.EnableDeviceVsync; - - Logger.Info?.Print(LogClass.Application, $"VSync toggled to: {Window.ViewModel.AppHost.Device.EnableDeviceVsync}"); - } - - private void DockedStatus_PointerReleased(object sender, PointerReleasedEventArgs e) - { - ConfigurationState.Instance.System.EnableDockedMode.Value = !ConfigurationState.Instance.System.EnableDockedMode.Value; - } - - private void AspectRatioStatus_OnClick(object sender, RoutedEventArgs e) - { - AspectRatio aspectRatio = ConfigurationState.Instance.Graphics.AspectRatio.Value; - ConfigurationState.Instance.Graphics.AspectRatio.Value = (int)aspectRatio + 1 > Enum.GetNames(typeof(AspectRatio)).Length - 1 ? AspectRatio.Fixed4x3 : aspectRatio + 1; - } - - private void Refresh_OnClick(object sender, RoutedEventArgs e) - { - Window.LoadApplications(); - } - - private void VolumeStatus_OnPointerWheelChanged(object sender, PointerWheelEventArgs e) - { - // Change the volume by 5% at a time - float newValue = Window.ViewModel.Volume + (float)e.Delta.Y * 0.05f; - - Window.ViewModel.Volume = newValue switch - { - < 0 => 0, - > 1 => 1, - _ => newValue, - }; - - e.Handled = true; - } - } -} diff --git a/src/Ryujinx.Ava/UI/Views/Main/MainViewControls.axaml b/src/Ryujinx.Ava/UI/Views/Main/MainViewControls.axaml deleted file mode 100644 index cc21b5c6..00000000 --- a/src/Ryujinx.Ava/UI/Views/Main/MainViewControls.axaml +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Ryujinx.Ava/UI/Views/Main/MainViewControls.axaml.cs b/src/Ryujinx.Ava/UI/Views/Main/MainViewControls.axaml.cs deleted file mode 100644 index 02fd1bf5..00000000 --- a/src/Ryujinx.Ava/UI/Views/Main/MainViewControls.axaml.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Avalonia; -using Avalonia.Controls; -using Avalonia.Input; -using Avalonia.Interactivity; -using Ryujinx.Ava.Common; -using Ryujinx.Ava.UI.ViewModels; -using Ryujinx.Ava.UI.Windows; -using System; - -namespace Ryujinx.Ava.UI.Views.Main -{ - public partial class MainViewControls : UserControl - { - public MainWindowViewModel ViewModel; - - public MainViewControls() - { - InitializeComponent(); - } - - protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) - { - base.OnAttachedToVisualTree(e); - - if (VisualRoot is MainWindow window) - { - ViewModel = window.ViewModel; - } - - DataContext = ViewModel; - } - - public void Sort_Checked(object sender, RoutedEventArgs args) - { - if (sender is RadioButton button) - { - ViewModel.Sort(Enum.Parse(button.Tag.ToString())); - } - } - - public void Order_Checked(object sender, RoutedEventArgs args) - { - if (sender is RadioButton button) - { - ViewModel.Sort(button.Tag.ToString() != "Descending"); - } - } - - private void SearchBox_OnKeyUp(object sender, KeyEventArgs e) - { - ViewModel.SearchText = SearchBox.Text; - } - } -} diff --git a/src/Ryujinx.Ava/UI/Views/Settings/SettingsAudioView.axaml b/src/Ryujinx.Ava/UI/Views/Settings/SettingsAudioView.axaml deleted file mode 100644 index 657e07ee..00000000 --- a/src/Ryujinx.Ava/UI/Views/Settings/SettingsAudioView.axaml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Ryujinx.Ava/UI/Views/Settings/SettingsAudioView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Settings/SettingsAudioView.axaml.cs deleted file mode 100644 index b672a0f2..00000000 --- a/src/Ryujinx.Ava/UI/Views/Settings/SettingsAudioView.axaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Avalonia.Controls; - -namespace Ryujinx.Ava.UI.Views.Settings -{ - public partial class SettingsAudioView : UserControl - { - public SettingsAudioView() - { - InitializeComponent(); - } - } -} diff --git a/src/Ryujinx.Ava/UI/Views/Settings/SettingsCPUView.axaml b/src/Ryujinx.Ava/UI/Views/Settings/SettingsCPUView.axaml deleted file mode 100644 index c74d3dd5..00000000 --- a/src/Ryujinx.Ava/UI/Views/Settings/SettingsCPUView.axaml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Ryujinx.Ava/UI/Views/Settings/SettingsCPUView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Settings/SettingsCPUView.axaml.cs deleted file mode 100644 index a475971a..00000000 --- a/src/Ryujinx.Ava/UI/Views/Settings/SettingsCPUView.axaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Avalonia.Controls; - -namespace Ryujinx.Ava.UI.Views.Settings -{ - public partial class SettingsCPUView : UserControl - { - public SettingsCPUView() - { - InitializeComponent(); - } - } -} diff --git a/src/Ryujinx.Ava/UI/Views/Settings/SettingsGraphicsView.axaml b/src/Ryujinx.Ava/UI/Views/Settings/SettingsGraphicsView.axaml deleted file mode 100644 index 22449478..00000000 --- a/src/Ryujinx.Ava/UI/Views/Settings/SettingsGraphicsView.axaml +++ /dev/null @@ -1,301 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Ryujinx.Ava/UI/Views/Settings/SettingsGraphicsView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Settings/SettingsGraphicsView.axaml.cs deleted file mode 100644 index 67341330..00000000 --- a/src/Ryujinx.Ava/UI/Views/Settings/SettingsGraphicsView.axaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Avalonia.Controls; - -namespace Ryujinx.Ava.UI.Views.Settings -{ - public partial class SettingsGraphicsView : UserControl - { - public SettingsGraphicsView() - { - InitializeComponent(); - } - } -} diff --git a/src/Ryujinx.Ava/UI/Views/Settings/SettingsHotkeysView.axaml b/src/Ryujinx.Ava/UI/Views/Settings/SettingsHotkeysView.axaml deleted file mode 100644 index b4eae01e..00000000 --- a/src/Ryujinx.Ava/UI/Views/Settings/SettingsHotkeysView.axaml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Ryujinx.Ava/UI/Views/Settings/SettingsHotkeysView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Settings/SettingsHotkeysView.axaml.cs deleted file mode 100644 index b006d703..00000000 --- a/src/Ryujinx.Ava/UI/Views/Settings/SettingsHotkeysView.axaml.cs +++ /dev/null @@ -1,81 +0,0 @@ -using Avalonia.Controls; -using Avalonia.Controls.Primitives; -using Avalonia.Input; -using Avalonia.Interactivity; -using Ryujinx.Ava.Input; -using Ryujinx.Ava.UI.Helpers; -using Ryujinx.Input; -using Ryujinx.Input.Assigner; - -namespace Ryujinx.Ava.UI.Views.Settings -{ - public partial class SettingsHotkeysView : UserControl - { - private ButtonKeyAssigner _currentAssigner; - private readonly IGamepadDriver _avaloniaKeyboardDriver; - - public SettingsHotkeysView() - { - InitializeComponent(); - _avaloniaKeyboardDriver = new AvaloniaKeyboardDriver(this); - } - - private void MouseClick(object sender, PointerPressedEventArgs e) - { - bool shouldUnbind = e.GetCurrentPoint(this).Properties.IsMiddleButtonPressed; - - _currentAssigner?.Cancel(shouldUnbind); - - PointerPressed -= MouseClick; - } - - private void Button_Checked(object sender, RoutedEventArgs e) - { - if (sender is ToggleButton button) - { - if (_currentAssigner != null && button == _currentAssigner.ToggledButton) - { - return; - } - - if (_currentAssigner == null && button.IsChecked != null && (bool)button.IsChecked) - { - _currentAssigner = new ButtonKeyAssigner(button); - - this.Focus(NavigationMethod.Pointer); - - PointerPressed += MouseClick; - - var keyboard = (IKeyboard)_avaloniaKeyboardDriver.GetGamepad(_avaloniaKeyboardDriver.GamepadsIds[0]); - IButtonAssigner assigner = new KeyboardKeyAssigner(keyboard); - - _currentAssigner.GetInputAndAssign(assigner); - } - else - { - if (_currentAssigner != null) - { - ToggleButton oldButton = _currentAssigner.ToggledButton; - - _currentAssigner.Cancel(); - _currentAssigner = null; - - button.IsChecked = false; - } - } - } - } - - private void Button_Unchecked(object sender, RoutedEventArgs e) - { - _currentAssigner?.Cancel(); - _currentAssigner = null; - } - - public void Dispose() - { - _currentAssigner?.Cancel(); - _currentAssigner = null; - } - } -} diff --git a/src/Ryujinx.Ava/UI/Views/Settings/SettingsInputView.axaml b/src/Ryujinx.Ava/UI/Views/Settings/SettingsInputView.axaml deleted file mode 100644 index 81f4b68b..00000000 --- a/src/Ryujinx.Ava/UI/Views/Settings/SettingsInputView.axaml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Ryujinx.Ava/UI/Views/Settings/SettingsInputView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Settings/SettingsInputView.axaml.cs deleted file mode 100644 index e75c9f0c..00000000 --- a/src/Ryujinx.Ava/UI/Views/Settings/SettingsInputView.axaml.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Avalonia.Controls; - -namespace Ryujinx.Ava.UI.Views.Settings -{ - public partial class SettingsInputView : UserControl - { - public SettingsInputView() - { - InitializeComponent(); - } - - public void Dispose() - { - ControllerSettings.Dispose(); - } - } -} diff --git a/src/Ryujinx.Ava/UI/Views/Settings/SettingsLoggingView.axaml b/src/Ryujinx.Ava/UI/Views/Settings/SettingsLoggingView.axaml deleted file mode 100644 index 0fc9ea1b..00000000 --- a/src/Ryujinx.Ava/UI/Views/Settings/SettingsLoggingView.axaml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Ryujinx.Ava/UI/Views/Settings/SettingsLoggingView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Settings/SettingsLoggingView.axaml.cs deleted file mode 100644 index c8df46b3..00000000 --- a/src/Ryujinx.Ava/UI/Views/Settings/SettingsLoggingView.axaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Avalonia.Controls; - -namespace Ryujinx.Ava.UI.Views.Settings -{ - public partial class SettingsLoggingView : UserControl - { - public SettingsLoggingView() - { - InitializeComponent(); - } - } -} diff --git a/src/Ryujinx.Ava/UI/Views/Settings/SettingsNetworkView.axaml b/src/Ryujinx.Ava/UI/Views/Settings/SettingsNetworkView.axaml deleted file mode 100644 index 9bb81463..00000000 --- a/src/Ryujinx.Ava/UI/Views/Settings/SettingsNetworkView.axaml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Ryujinx.Ava/UI/Views/Settings/SettingsNetworkView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Settings/SettingsNetworkView.axaml.cs deleted file mode 100644 index b771933e..00000000 --- a/src/Ryujinx.Ava/UI/Views/Settings/SettingsNetworkView.axaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Avalonia.Controls; - -namespace Ryujinx.Ava.UI.Views.Settings -{ - public partial class SettingsNetworkView : UserControl - { - public SettingsNetworkView() - { - InitializeComponent(); - } - } -} diff --git a/src/Ryujinx.Ava/UI/Views/Settings/SettingsSystemView.axaml b/src/Ryujinx.Ava/UI/Views/Settings/SettingsSystemView.axaml deleted file mode 100644 index e6f7c6e4..00000000 --- a/src/Ryujinx.Ava/UI/Views/Settings/SettingsSystemView.axaml +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Ryujinx.Ava/UI/Views/Settings/SettingsSystemView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Settings/SettingsSystemView.axaml.cs deleted file mode 100644 index 2c9eac28..00000000 --- a/src/Ryujinx.Ava/UI/Views/Settings/SettingsSystemView.axaml.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Avalonia.Controls; -using Ryujinx.Ava.UI.ViewModels; -using TimeZone = Ryujinx.Ava.UI.Models.TimeZone; - -namespace Ryujinx.Ava.UI.Views.Settings -{ - public partial class SettingsSystemView : UserControl - { - public SettingsViewModel ViewModel; - - public SettingsSystemView() - { - InitializeComponent(); - } - - private void TimeZoneBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) - { - if (e.AddedItems != null && e.AddedItems.Count > 0) - { - if (e.AddedItems[0] is TimeZone timeZone) - { - e.Handled = true; - - ViewModel.ValidateAndSetTimeZone(timeZone.Location); - } - } - } - - private void TimeZoneBox_OnTextChanged(object sender, TextChangedEventArgs e) - { - if (sender is AutoCompleteBox box && box.SelectedItem is TimeZone timeZone) - { - ViewModel.ValidateAndSetTimeZone(timeZone.Location); - } - } - } -} diff --git a/src/Ryujinx.Ava/UI/Views/Settings/SettingsUIView.axaml b/src/Ryujinx.Ava/UI/Views/Settings/SettingsUIView.axaml deleted file mode 100644 index 6504637e..00000000 --- a/src/Ryujinx.Ava/UI/Views/Settings/SettingsUIView.axaml +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Ryujinx.Ava/UI/Views/Settings/SettingsUIView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Settings/SettingsUIView.axaml.cs deleted file mode 100644 index 996d15cd..00000000 --- a/src/Ryujinx.Ava/UI/Views/Settings/SettingsUIView.axaml.cs +++ /dev/null @@ -1,65 +0,0 @@ -using Avalonia.Controls; -using Avalonia.Interactivity; -using Avalonia.Platform.Storage; -using Avalonia.VisualTree; -using Ryujinx.Ava.Common.Locale; -using Ryujinx.Ava.UI.ViewModels; -using System.Collections.Generic; -using System.IO; -using System.Linq; - -namespace Ryujinx.Ava.UI.Views.Settings -{ - public partial class SettingsUiView : UserControl - { - public SettingsViewModel ViewModel; - - public SettingsUiView() - { - InitializeComponent(); - } - - private async void AddButton_OnClick(object sender, RoutedEventArgs e) - { - string path = PathBox.Text; - - if (!string.IsNullOrWhiteSpace(path) && Directory.Exists(path) && !ViewModel.GameDirectories.Contains(path)) - { - ViewModel.GameDirectories.Add(path); - ViewModel.DirectoryChanged = true; - } - else - { - if (this.GetVisualRoot() is Window window) - { - var result = await window.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions - { - AllowMultiple = false, - }); - - if (result.Count > 0) - { - ViewModel.GameDirectories.Add(result[0].Path.LocalPath); - ViewModel.DirectoryChanged = true; - } - } - } - } - - private void RemoveButton_OnClick(object sender, RoutedEventArgs e) - { - int oldIndex = GameList.SelectedIndex; - - foreach (string path in new List(GameList.SelectedItems.Cast())) - { - ViewModel.GameDirectories.Remove(path); - ViewModel.DirectoryChanged = true; - } - - if (GameList.ItemCount > 0) - { - GameList.SelectedIndex = oldIndex < GameList.ItemCount ? oldIndex : 0; - } - } - } -} diff --git a/src/Ryujinx.Ava/UI/Views/User/UserEditorView.axaml b/src/Ryujinx.Ava/UI/Views/User/UserEditorView.axaml deleted file mode 100644 index ab83c2cd..00000000 --- a/src/Ryujinx.Ava/UI/Views/User/UserEditorView.axaml +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Ryujinx.Ava/UI/Views/User/UserProfileImageSelectorView.axaml.cs b/src/Ryujinx.Ava/UI/Views/User/UserProfileImageSelectorView.axaml.cs deleted file mode 100644 index fabfaa4e..00000000 --- a/src/Ryujinx.Ava/UI/Views/User/UserProfileImageSelectorView.axaml.cs +++ /dev/null @@ -1,116 +0,0 @@ -using Avalonia.Controls; -using Avalonia.Interactivity; -using Avalonia.Platform.Storage; -using Avalonia.VisualTree; -using FluentAvalonia.UI.Controls; -using FluentAvalonia.UI.Navigation; -using Ryujinx.Ava.Common.Locale; -using Ryujinx.Ava.UI.Controls; -using Ryujinx.Ava.UI.Models; -using Ryujinx.Ava.UI.ViewModels; -using Ryujinx.HLE.FileSystem; -using SixLabors.ImageSharp; -using SixLabors.ImageSharp.Processing; -using System.Collections.Generic; -using System.IO; -using Image = SixLabors.ImageSharp.Image; - -namespace Ryujinx.Ava.UI.Views.User -{ - public partial class UserProfileImageSelectorView : UserControl - { - private ContentManager _contentManager; - private NavigationDialogHost _parent; - private TempProfile _profile; - - internal UserProfileImageSelectorViewModel ViewModel { get; private set; } - - public UserProfileImageSelectorView() - { - 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; - - ((ContentDialog)_parent.Parent).Title = $"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - {LocaleManager.Instance[LocaleKeys.ProfileImageSelectionHeader]}"; - - if (Program.PreviewerDetached) - { - DataContext = ViewModel = new UserProfileImageSelectorViewModel(); - ViewModel.FirmwareFound = _contentManager.GetCurrentFirmwareVersion() != null; - } - - break; - case NavigationMode.Back: - if (_profile.Image != null) - { - _parent.GoBack(); - } - break; - } - } - } - - private async void Import_OnClick(object sender, RoutedEventArgs e) - { - var window = this.GetVisualRoot() as Window; - var result = await window.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions - { - AllowMultiple = false, - FileTypeFilter = new List - { - new(LocaleManager.Instance[LocaleKeys.AllSupportedFormats]) - { - Patterns = new[] { "*.jpg", "*.jpeg", "*.png", "*.bmp" }, - AppleUniformTypeIdentifiers = new[] { "public.jpeg", "public.png", "com.microsoft.bmp" }, - MimeTypes = new[] { "image/jpeg", "image/png", "image/bmp" }, - }, - }, - }); - - if (result.Count > 0) - { - _profile.Image = ProcessProfileImage(File.ReadAllBytes(result[0].Path.LocalPath)); - _parent.GoBack(); - } - } - - private void GoBack(object sender, RoutedEventArgs e) - { - _parent.GoBack(); - } - - private void SelectFirmwareImage_OnClick(object sender, RoutedEventArgs e) - { - if (ViewModel.FirmwareFound) - { - _parent.Navigate(typeof(UserFirmwareAvatarSelectorView), (_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(); - } - } -} diff --git a/src/Ryujinx.Ava/UI/Views/User/UserRecovererView.axaml b/src/Ryujinx.Ava/UI/Views/User/UserRecovererView.axaml deleted file mode 100644 index 3fdb4ab9..00000000 --- a/src/Ryujinx.Ava/UI/Views/User/UserRecovererView.axaml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Ryujinx.Ava/UI/Views/User/UserRecovererView.axaml.cs b/src/Ryujinx.Ava/UI/Views/User/UserRecovererView.axaml.cs deleted file mode 100644 index 31934349..00000000 --- a/src/Ryujinx.Ava/UI/Views/User/UserRecovererView.axaml.cs +++ /dev/null @@ -1,51 +0,0 @@ -using Avalonia.Controls; -using Avalonia.Interactivity; -using FluentAvalonia.UI.Controls; -using FluentAvalonia.UI.Navigation; -using Ryujinx.Ava.Common.Locale; -using Ryujinx.Ava.UI.Controls; - -namespace Ryujinx.Ava.UI.Views.User -{ - public partial class UserRecovererView : UserControl - { - private NavigationDialogHost _parent; - - public UserRecovererView() - { - 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 parent = (NavigationDialogHost)arg.Parameter; - - _parent = parent; - - ((ContentDialog)_parent.Parent).Title = $"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - {LocaleManager.Instance[LocaleKeys.UserProfilesRecoverHeading]}"; - - break; - } - } - } - - private void GoBack(object sender, RoutedEventArgs e) - { - _parent?.GoBack(); - } - - private void Recover(object sender, RoutedEventArgs e) - { - _parent?.RecoverLostAccounts(); - } - } -} diff --git a/src/Ryujinx.Ava/UI/Views/User/UserSaveManagerView.axaml b/src/Ryujinx.Ava/UI/Views/User/UserSaveManagerView.axaml deleted file mode 100644 index 8bc5125a..00000000 --- a/src/Ryujinx.Ava/UI/Views/User/UserSaveManagerView.axaml +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Ryujinx.Ava/UI/Views/User/UserSaveManagerView.axaml.cs b/src/Ryujinx.Ava/UI/Views/User/UserSaveManagerView.axaml.cs deleted file mode 100644 index 00a229fa..00000000 --- a/src/Ryujinx.Ava/UI/Views/User/UserSaveManagerView.axaml.cs +++ /dev/null @@ -1,148 +0,0 @@ -using Avalonia.Controls; -using Avalonia.Interactivity; -using Avalonia.Threading; -using FluentAvalonia.UI.Controls; -using FluentAvalonia.UI.Navigation; -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.Controls; -using Ryujinx.Ava.UI.Helpers; -using Ryujinx.Ava.UI.Models; -using Ryujinx.Ava.UI.ViewModels; -using Ryujinx.HLE.FileSystem; -using Ryujinx.HLE.HOS.Services.Account.Acc; -using System; -using System.Collections.ObjectModel; -using System.Threading.Tasks; -using Button = Avalonia.Controls.Button; -using UserId = LibHac.Fs.UserId; - -namespace Ryujinx.Ava.UI.Views.User -{ - public partial class UserSaveManagerView : UserControl - { - internal UserSaveManagerViewModel ViewModel { get; private set; } - - private AccountManager _accountManager; - private HorizonClient _horizonClient; - private VirtualFileSystem _virtualFileSystem; - private NavigationDialogHost _parent; - - public UserSaveManagerView() - { - 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 (parent, accountManager, client, virtualFileSystem) = ((NavigationDialogHost parent, AccountManager accountManager, HorizonClient client, VirtualFileSystem virtualFileSystem))arg.Parameter; - _accountManager = accountManager; - _horizonClient = client; - _virtualFileSystem = virtualFileSystem; - - _parent = parent; - break; - } - - DataContext = ViewModel = new UserSaveManagerViewModel(_accountManager); - ((ContentDialog)_parent.Parent).Title = $"{LocaleManager.Instance[LocaleKeys.UserProfileWindowTitle]} - {ViewModel.SaveManagerHeading}"; - - Task.Run(LoadSaves); - } - } - - public void LoadSaves() - { - ViewModel.Saves.Clear(); - var saves = new ObservableCollection(); - var saveDataFilter = SaveDataFilter.Make( - programId: default, - saveType: SaveDataType.Account, - new UserId((ulong)_accountManager.LastOpenedUser.UserId.High, (ulong)_accountManager.LastOpenedUser.UserId.Low), - saveDataId: default, - index: default); - - using var saveDataIterator = new UniqueRef(); - - _horizonClient.Fs.OpenSaveDataIterator(ref saveDataIterator.Ref, SaveDataSpaceId.User, in saveDataFilter).ThrowIfFailure(); - - Span 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); - saves.Add(saveModel); - } - } - } - - Dispatcher.UIThread.Post(() => - { - ViewModel.Saves = saves; - ViewModel.Sort(); - }); - } - - private void GoBack(object sender, RoutedEventArgs e) - { - _parent?.GoBack(); - } - - private void OpenLocation(object sender, RoutedEventArgs e) - { - if (sender is Button button) - { - if (button.DataContext is SaveModel saveModel) - { - ApplicationHelper.OpenSaveDir(saveModel.SaveId); - } - } - } - - private async void Delete(object sender, RoutedEventArgs e) - { - if (sender is Button button) - { - if (button.DataContext is SaveModel saveModel) - { - var result = await ContentDialogHelper.CreateConfirmationDialog(LocaleManager.Instance[LocaleKeys.DeleteUserSave], - LocaleManager.Instance[LocaleKeys.IrreversibleActionNote], - LocaleManager.Instance[LocaleKeys.InputDialogYes], - LocaleManager.Instance[LocaleKeys.InputDialogNo], ""); - - if (result == UserResult.Yes) - { - _horizonClient.Fs.DeleteSaveData(SaveDataSpaceId.User, saveModel.SaveId); - ViewModel.Saves.Remove(saveModel); - ViewModel.Sort(); - } - } - } - } - } -} diff --git a/src/Ryujinx.Ava/UI/Views/User/UserSelectorView.axaml b/src/Ryujinx.Ava/UI/Views/User/UserSelectorView.axaml deleted file mode 100644 index 3a9de303..00000000 --- a/src/Ryujinx.Ava/UI/Views/User/UserSelectorView.axaml +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -