diff --git a/Ryujinx.Ava/AppHost.cs b/Ryujinx.Ava/AppHost.cs index c6f2265ccf..22c4ab5eb5 100644 --- a/Ryujinx.Ava/AppHost.cs +++ b/Ryujinx.Ava/AppHost.cs @@ -53,6 +53,7 @@ namespace Ryujinx.Ava internal class AppHost { private const int CursorHideIdleTime = 8; // Hide Cursor seconds + private const float MaxResolutionScale = 4.0f; // Max resolution hotkeys can scale to before wrapping. private static readonly Cursor InvisibleCursor = new Cursor(StandardCursorType.None); @@ -976,6 +977,13 @@ namespace Ryujinx.Ava _parent.ViewModel.Volume = Device.GetVolume(); break; + case KeyboardHotkeyState.ResScaleUp: + GraphicsConfig.ResScale = GraphicsConfig.ResScale % MaxResolutionScale + 1; + break; + case KeyboardHotkeyState.ResScaleDown: + GraphicsConfig.ResScale = + (MaxResolutionScale + GraphicsConfig.ResScale - 2) % MaxResolutionScale + 1; + break; case KeyboardHotkeyState.None: (_keyboardInterface as AvaloniaKeyboard).Clear(); break; @@ -1033,6 +1041,14 @@ namespace Ryujinx.Ava { state = KeyboardHotkeyState.ToggleMute; } + else if (_keyboardInterface.IsPressed((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.ResScaleUp)) + { + state = KeyboardHotkeyState.ResScaleUp; + } + else if (_keyboardInterface.IsPressed((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.ResScaleDown)) + { + state = KeyboardHotkeyState.ResScaleDown; + } return state; } diff --git a/Ryujinx.Ava/Assets/Locales/de_DE.json b/Ryujinx.Ava/Assets/Locales/de_DE.json index 6cdf8cd342..c2812f787b 100644 --- a/Ryujinx.Ava/Assets/Locales/de_DE.json +++ b/Ryujinx.Ava/Assets/Locales/de_DE.json @@ -556,5 +556,7 @@ "SettingsSelectThemeFileDialogTitle" : "Wähle ein benutzerdefiniertes Thema", "SettingsXamlThemeFile" : "Xaml Thema-Datei", "SettingsTabGraphicsBackend" : "Grafik-Backend", - "GraphicsBackendTooltip" : "Ändert das Grafik-Backend" + "GraphicsBackendTooltip" : "Ändert das Grafik-Backend", + "SettingsTabHotkeysResScaleUpHotkey": "Auflösung erhöhen:", + "SettingsTabHotkeysResScaleDownHotkey": "Auflösung vermindern:" } diff --git a/Ryujinx.Ava/Assets/Locales/en_US.json b/Ryujinx.Ava/Assets/Locales/en_US.json index dd18dd9eee..d9cbce9de8 100644 --- a/Ryujinx.Ava/Assets/Locales/en_US.json +++ b/Ryujinx.Ava/Assets/Locales/en_US.json @@ -575,5 +575,7 @@ "UserProfilesSetProfileImage": "Set Profile Image", "UserProfileEmptyNameError": "Name is required", "UserProfileNoImageError": "Profile image must be set", - "GameUpdateWindowHeading": "Updates Available for {0} [{1}]" + "GameUpdateWindowHeading": "Updates Available for {0} [{1}]", + "SettingsTabHotkeysResScaleUpHotkey": "Increase resolution:", + "SettingsTabHotkeysResScaleDownHotkey": "Decrease resolution:" } diff --git a/Ryujinx.Ava/Assets/Locales/es_ES.json b/Ryujinx.Ava/Assets/Locales/es_ES.json index 87e5c0fe89..dd9b960a8a 100644 --- a/Ryujinx.Ava/Assets/Locales/es_ES.json +++ b/Ryujinx.Ava/Assets/Locales/es_ES.json @@ -568,5 +568,7 @@ "UpdateWindowTitle": "Administrar actualizaciones", "CheatWindowHeading": "Cheats disponibles para {0} [{1}]", "DlcWindowHeading": "Contenido descargable disponible para {0} [{1}]", - "GameUpdateWindowHeading": "Actualizaciones disponibles para {0} [{1}]" + "GameUpdateWindowHeading": "Actualizaciones disponibles para {0} [{1}]", + "SettingsTabHotkeysResScaleUpHotkey": "Aumentar la resolución:", + "SettingsTabHotkeysResScaleDownHotkey": "Disminuir la resolución:" } diff --git a/Ryujinx.Ava/Assets/Locales/it_IT.json b/Ryujinx.Ava/Assets/Locales/it_IT.json index 4c5abe8e16..ba72283c52 100644 --- a/Ryujinx.Ava/Assets/Locales/it_IT.json +++ b/Ryujinx.Ava/Assets/Locales/it_IT.json @@ -554,5 +554,7 @@ "ControllerMotionTitle": "Impostazioni dei sensori di movimento", "ControllerRumbleTitle": "Impostazioni di vibrazione", "SettingsSelectThemeFileDialogTitle" : "Seleziona file del tema", - "SettingsXamlThemeFile" : "File del tema xaml" + "SettingsXamlThemeFile" : "File del tema xaml", + "SettingsTabHotkeysResScaleUpHotkey": "Aumentare la risoluzione:", + "SettingsTabHotkeysResScaleDownHotkey": "Diminuire la risoluzione:" } diff --git a/Ryujinx.Ava/Assets/Locales/pt_BR.json b/Ryujinx.Ava/Assets/Locales/pt_BR.json index ff3f099f8f..e2cf38c6de 100644 --- a/Ryujinx.Ava/Assets/Locales/pt_BR.json +++ b/Ryujinx.Ava/Assets/Locales/pt_BR.json @@ -554,5 +554,7 @@ "ControllerMotionTitle": "Configurações do controle de movimento", "ControllerRumbleTitle": "Configurações de vibração", "SettingsSelectThemeFileDialogTitle" : "Selecionar arquivo do tema", - "SettingsXamlThemeFile" : "Arquivo de tema Xaml" + "SettingsXamlThemeFile" : "Arquivo de tema Xaml", + "SettingsTabHotkeysResScaleUpHotkey": "Aumentar a resolução:", + "SettingsTabHotkeysResScaleDownHotkey": "Diminuir a resolução:" } diff --git a/Ryujinx.Ava/Assets/Locales/tr_TR.json b/Ryujinx.Ava/Assets/Locales/tr_TR.json index 60d89fedfb..763f197e81 100644 --- a/Ryujinx.Ava/Assets/Locales/tr_TR.json +++ b/Ryujinx.Ava/Assets/Locales/tr_TR.json @@ -554,5 +554,7 @@ "ControllerMotionTitle": "Hareket Kontrol Seçenekleri", "ControllerRumbleTitle": "Titreşim Seçenekleri", "SettingsSelectThemeFileDialogTitle" : "Tema Dosyası Seçin", - "SettingsXamlThemeFile" : "Xaml Tema Dosyası" + "SettingsXamlThemeFile" : "Xaml Tema Dosyası", + "SettingsTabHotkeysResScaleUpHotkey": "Çözünürlüğü artırın:", + "SettingsTabHotkeysResScaleDownHotkey": "Çözünürlüğü azaltın:" } diff --git a/Ryujinx.Ava/Assets/Locales/zh_CN.json b/Ryujinx.Ava/Assets/Locales/zh_CN.json index cff0a31d89..625c81b65b 100644 --- a/Ryujinx.Ava/Assets/Locales/zh_CN.json +++ b/Ryujinx.Ava/Assets/Locales/zh_CN.json @@ -568,5 +568,7 @@ "UpdateWindowTitle": "管理游戏更新", "CheatWindowHeading": "适用于 {0} [{1}] 的金手指", "DlcWindowHeading": "适用于 {0} [{1}] 的 DLC", - "GameUpdateWindowHeading": "适用于 {0} [{1}] 的更新" + "GameUpdateWindowHeading": "适用于 {0} [{1}] 的更新", + "SettingsTabHotkeysResScaleUpHotkey": "分辨率提高", + "SettingsTabHotkeysResScaleDownHotkey": "降低分辨率" } diff --git a/Ryujinx.Ava/Common/KeyboardHotkeyState.cs b/Ryujinx.Ava/Common/KeyboardHotkeyState.cs index 6f0ff07c94..a4e9c55505 100644 --- a/Ryujinx.Ava/Common/KeyboardHotkeyState.cs +++ b/Ryujinx.Ava/Common/KeyboardHotkeyState.cs @@ -7,6 +7,8 @@ Screenshot, ShowUi, Pause, - ToggleMute + ToggleMute, + ResScaleUp, + ResScaleDown } } \ No newline at end of file diff --git a/Ryujinx.Ava/Ui/Windows/SettingsWindow.axaml b/Ryujinx.Ava/Ui/Windows/SettingsWindow.axaml index 493d679898..9a9a395e04 100644 --- a/Ryujinx.Ava/Ui/Windows/SettingsWindow.axaml +++ b/Ryujinx.Ava/Ui/Windows/SettingsWindow.axaml @@ -241,6 +241,22 @@ TextAlignment="Center" /> + + + + + + + + + + + + diff --git a/Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs b/Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs index c7a59a3334..a6f69e8d15 100644 --- a/Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs +++ b/Ryujinx.Common/Configuration/Hid/KeyboardHotkeys.cs @@ -7,5 +7,7 @@ public Key ShowUi { get; set; } public Key Pause { get; set; } public Key ToggleMute { get; set; } + public Key ResScaleUp { get; set; } + public Key ResScaleDown { get; set; } } } diff --git a/Ryujinx.Ui.Common/Configuration/ConfigurationFileFormat.cs b/Ryujinx.Ui.Common/Configuration/ConfigurationFileFormat.cs index 28a2956a61..126399e7c4 100644 --- a/Ryujinx.Ui.Common/Configuration/ConfigurationFileFormat.cs +++ b/Ryujinx.Ui.Common/Configuration/ConfigurationFileFormat.cs @@ -14,7 +14,7 @@ namespace Ryujinx.Ui.Common.Configuration /// /// The current version of the file format /// - public const int CurrentVersion = 38; + public const int CurrentVersion = 39; /// /// Version of the configuration file format @@ -80,7 +80,7 @@ namespace Ryujinx.Ui.Common.Configuration /// Enables printing error log messages /// public bool LoggingEnableError { get; set; } - + /// /// Enables printing trace log messages /// diff --git a/Ryujinx.Ui.Common/Configuration/ConfigurationState.cs b/Ryujinx.Ui.Common/Configuration/ConfigurationState.cs index c739b2949a..7f76dc3fd4 100644 --- a/Ryujinx.Ui.Common/Configuration/ConfigurationState.cs +++ b/Ryujinx.Ui.Common/Configuration/ConfigurationState.cs @@ -310,7 +310,7 @@ namespace Ryujinx.Ui.Common.Configuration EnableDockedMode = new ReactiveObject(); EnableDockedMode.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableDockedMode)); EnablePtc = new ReactiveObject(); - EnablePtc.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnablePtc)); + EnablePtc.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnablePtc)); EnableInternetAccess = new ReactiveObject(); EnableInternetAccess.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableInternetAccess)); EnableFsIntegrityChecks = new ReactiveObject(); @@ -648,7 +648,9 @@ namespace Ryujinx.Ui.Common.Configuration ToggleMute = Key.F2, Screenshot = Key.F8, ShowUi = Key.F4, - Pause = Key.F5 + Pause = Key.F5, + ResScaleUp = Key.Unbound, + ResScaleDown = Key.Unbound }; Hid.InputConfig.Value = new List { @@ -967,7 +969,7 @@ namespace Ryujinx.Ui.Common.Configuration if (configurationFileFormat.Version < 29) { Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 29."); - + configurationFileFormat.Hotkeys = new KeyboardHotkeys { ToggleVsync = Key.Tab, @@ -1096,6 +1098,22 @@ namespace Ryujinx.Ui.Common.Configuration configurationFileUpdated = true; } + if (configurationFileFormat.Version < 39) + { + Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 39."); + + configurationFileFormat.Hotkeys = new KeyboardHotkeys + { + ToggleVsync = configurationFileFormat.Hotkeys.ToggleVsync, + Screenshot = configurationFileFormat.Hotkeys.Screenshot, + ShowUi = configurationFileFormat.Hotkeys.ShowUi, + Pause = configurationFileFormat.Hotkeys.Pause, + ToggleMute = configurationFileFormat.Hotkeys.ToggleMute, + ResScaleUp = Key.Unbound, + ResScaleDown = Key.Unbound + }; + } + Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog; Graphics.ResScale.Value = configurationFileFormat.ResScale; Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom; diff --git a/Ryujinx/Ui/RendererWidgetBase.cs b/Ryujinx/Ui/RendererWidgetBase.cs index 0d82a5c574..a3ff4708d0 100644 --- a/Ryujinx/Ui/RendererWidgetBase.cs +++ b/Ryujinx/Ui/RendererWidgetBase.cs @@ -6,6 +6,7 @@ using Ryujinx.Common; using Ryujinx.Common.Configuration; using Ryujinx.Common.Logging; using Ryujinx.Ui.Common.Configuration; +using Ryujinx.Graphics.Gpu; using Ryujinx.Graphics.GAL; using Ryujinx.Graphics.GAL.Multithreading; using Ryujinx.Input; @@ -33,6 +34,7 @@ namespace Ryujinx.Ui private const int SwitchPanelWidth = 1280; private const int SwitchPanelHeight = 720; private const int TargetFps = 60; + private const float MaxResolutionScale = 4.0f; // Max resolution hotkeys can scale to before wrapping. public ManualResetEvent WaitEvent { get; set; } public NpadManager NpadManager { get; } @@ -618,6 +620,19 @@ namespace Ryujinx.Ui } } + if (currentHotkeyState.HasFlag(KeyboardHotkeyState.ResScaleUp) && + !_prevHotkeyState.HasFlag(KeyboardHotkeyState.ResScaleUp)) + { + GraphicsConfig.ResScale = GraphicsConfig.ResScale % MaxResolutionScale + 1; + } + + if (currentHotkeyState.HasFlag(KeyboardHotkeyState.ResScaleDown) && + !_prevHotkeyState.HasFlag(KeyboardHotkeyState.ResScaleDown)) + { + GraphicsConfig.ResScale = + (MaxResolutionScale + GraphicsConfig.ResScale - 2) % MaxResolutionScale + 1; + } + _prevHotkeyState = currentHotkeyState; } @@ -648,7 +663,9 @@ namespace Ryujinx.Ui Screenshot = 1 << 1, ShowUi = 1 << 2, Pause = 1 << 3, - ToggleMute = 1 << 4 + ToggleMute = 1 << 4, + ResScaleUp = 1 << 5, + ResScaleDown = 1 << 6 } private KeyboardHotkeyState GetHotkeyState() @@ -680,6 +697,16 @@ namespace Ryujinx.Ui state |= KeyboardHotkeyState.ToggleMute; } + if (_keyboardInterface.IsPressed((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.ResScaleUp)) + { + state |= KeyboardHotkeyState.ResScaleUp; + } + + if (_keyboardInterface.IsPressed((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.ResScaleDown)) + { + state |= KeyboardHotkeyState.ResScaleDown; + } + return state; } }