diff --git a/src/Ryujinx/Assets/locales.json b/src/Ryujinx/Assets/locales.json index c3044f639..d591d395f 100644 --- a/src/Ryujinx/Assets/locales.json +++ b/src/Ryujinx/Assets/locales.json @@ -6122,6 +6122,56 @@ "zh_TW": "關閉" } }, + { + "ID": "SettingsButtonReset", + "Translations": { + "ar_SA": "", + "de_DE": "", + "el_GR": "", + "en_US": "Reset Settings", + "es_ES": "", + "fr_FR": "", + "he_IL": "", + "it_IT": "", + "ja_JP": "", + "ko_KR": "", + "no_NO": "", + "pl_PL": "", + "pt_BR": "", + "ru_RU": "", + "sv_SE": "", + "th_TH": "", + "tr_TR": "", + "uk_UA": "", + "zh_CN": "", + "zh_TW": "" + } + }, + { + "ID": "SettingsButtonResetConfirm", + "Translations": { + "ar_SA": "", + "de_DE": "", + "el_GR": "", + "en_US": "I want to reset my settings.", + "es_ES": "", + "fr_FR": "", + "he_IL": "", + "it_IT": "", + "ja_JP": "", + "ko_KR": "", + "no_NO": "", + "pl_PL": "", + "pt_BR": "", + "ru_RU": "", + "sv_SE": "", + "th_TH": "", + "tr_TR": "", + "uk_UA": "", + "zh_CN": "", + "zh_TW": "" + } + }, { "ID": "SettingsButtonOk", "Translations": { diff --git a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs index d54313e76..bd649602c 100644 --- a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs @@ -2,7 +2,7 @@ using Avalonia.Collections; using Avalonia.Controls; using Avalonia.Threading; using CommunityToolkit.Mvvm.ComponentModel; -using Gommon; +using CommunityToolkit.Mvvm.Input; using LibHac.Tools.FsSystem; using Ryujinx.Audio.Backends.OpenAL; using Ryujinx.Audio.Backends.SDL2; @@ -28,8 +28,6 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Net.NetworkInformation; -using System.Runtime.InteropServices; -using System.Text.RegularExpressions; using System.Threading.Tasks; using TimeZone = Ryujinx.Ava.UI.Models.TimeZone; @@ -722,6 +720,25 @@ namespace Ryujinx.Ava.UI.ViewModels CloseWindow?.Invoke(); } + [ObservableProperty] private bool _wantsToReset; + + public AsyncRelayCommand ResetButton => Commands.Create(async () => + { + if (!WantsToReset) return; + + CloseWindow?.Invoke(); + ConfigurationState.Instance.LoadDefault(); + ConfigurationState.Instance.ToFileFormat().SaveConfig(Program.ConfigurationPath); + RyujinxApp.MainWindow.LoadApplications(); + + await ContentDialogHelper.CreateInfoDialog( + $"Your {RyujinxApp.FullAppName} configuration has been reset.", + "", + string.Empty, + LocaleManager.Instance[LocaleKeys.SettingsButtonClose], + "Configuration Reset"); + }); + public void CancelButton() { RevertIfNotSaved(); diff --git a/src/Ryujinx/UI/Windows/SettingsWindow.axaml b/src/Ryujinx/UI/Windows/SettingsWindow.axaml index 7abf044ee..1c7e9cf58 100644 --- a/src/Ryujinx/UI/Windows/SettingsWindow.axaml +++ b/src/Ryujinx/UI/Windows/SettingsWindow.axaml @@ -108,24 +108,36 @@ - -