mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-19 05:42:01 +00:00
Resolution scaling hotkeys (#3185)
* hotkeys * comments * update implementation to include custom scales * copypasta * review changes * hotkeys * comments * update implementation to include custom scales * copypasta * review changes * Remove outdated configuration and force hotkeys unbound * Add avalonia support * Fix configuration file * Update GTK implementation and fix config... again. * Remove legacy implementation + nits * Avalonia locales (DeepL) * review * Remove colon from chinese locale * Update ConfigFile * locale fix
This commit is contained in:
parent
1a888ae087
commit
62f8ceb60b
14 changed files with 109 additions and 14 deletions
|
@ -53,6 +53,7 @@ namespace Ryujinx.Ava
|
||||||
internal class AppHost
|
internal class AppHost
|
||||||
{
|
{
|
||||||
private const int CursorHideIdleTime = 8; // Hide Cursor seconds
|
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);
|
private static readonly Cursor InvisibleCursor = new Cursor(StandardCursorType.None);
|
||||||
|
|
||||||
|
@ -976,6 +977,13 @@ namespace Ryujinx.Ava
|
||||||
|
|
||||||
_parent.ViewModel.Volume = Device.GetVolume();
|
_parent.ViewModel.Volume = Device.GetVolume();
|
||||||
break;
|
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:
|
case KeyboardHotkeyState.None:
|
||||||
(_keyboardInterface as AvaloniaKeyboard).Clear();
|
(_keyboardInterface as AvaloniaKeyboard).Clear();
|
||||||
break;
|
break;
|
||||||
|
@ -1033,6 +1041,14 @@ namespace Ryujinx.Ava
|
||||||
{
|
{
|
||||||
state = KeyboardHotkeyState.ToggleMute;
|
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;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
|
@ -556,5 +556,7 @@
|
||||||
"SettingsSelectThemeFileDialogTitle" : "Wähle ein benutzerdefiniertes Thema",
|
"SettingsSelectThemeFileDialogTitle" : "Wähle ein benutzerdefiniertes Thema",
|
||||||
"SettingsXamlThemeFile" : "Xaml Thema-Datei",
|
"SettingsXamlThemeFile" : "Xaml Thema-Datei",
|
||||||
"SettingsTabGraphicsBackend" : "Grafik-Backend",
|
"SettingsTabGraphicsBackend" : "Grafik-Backend",
|
||||||
"GraphicsBackendTooltip" : "Ändert das Grafik-Backend"
|
"GraphicsBackendTooltip" : "Ändert das Grafik-Backend",
|
||||||
|
"SettingsTabHotkeysResScaleUpHotkey": "Auflösung erhöhen:",
|
||||||
|
"SettingsTabHotkeysResScaleDownHotkey": "Auflösung vermindern:"
|
||||||
}
|
}
|
||||||
|
|
|
@ -575,5 +575,7 @@
|
||||||
"UserProfilesSetProfileImage": "Set Profile Image",
|
"UserProfilesSetProfileImage": "Set Profile Image",
|
||||||
"UserProfileEmptyNameError": "Name is required",
|
"UserProfileEmptyNameError": "Name is required",
|
||||||
"UserProfileNoImageError": "Profile image must be set",
|
"UserProfileNoImageError": "Profile image must be set",
|
||||||
"GameUpdateWindowHeading": "Updates Available for {0} [{1}]"
|
"GameUpdateWindowHeading": "Updates Available for {0} [{1}]",
|
||||||
|
"SettingsTabHotkeysResScaleUpHotkey": "Increase resolution:",
|
||||||
|
"SettingsTabHotkeysResScaleDownHotkey": "Decrease resolution:"
|
||||||
}
|
}
|
||||||
|
|
|
@ -568,5 +568,7 @@
|
||||||
"UpdateWindowTitle": "Administrar actualizaciones",
|
"UpdateWindowTitle": "Administrar actualizaciones",
|
||||||
"CheatWindowHeading": "Cheats disponibles para {0} [{1}]",
|
"CheatWindowHeading": "Cheats disponibles para {0} [{1}]",
|
||||||
"DlcWindowHeading": "Contenido descargable disponible 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:"
|
||||||
}
|
}
|
||||||
|
|
|
@ -554,5 +554,7 @@
|
||||||
"ControllerMotionTitle": "Impostazioni dei sensori di movimento",
|
"ControllerMotionTitle": "Impostazioni dei sensori di movimento",
|
||||||
"ControllerRumbleTitle": "Impostazioni di vibrazione",
|
"ControllerRumbleTitle": "Impostazioni di vibrazione",
|
||||||
"SettingsSelectThemeFileDialogTitle" : "Seleziona file del tema",
|
"SettingsSelectThemeFileDialogTitle" : "Seleziona file del tema",
|
||||||
"SettingsXamlThemeFile" : "File del tema xaml"
|
"SettingsXamlThemeFile" : "File del tema xaml",
|
||||||
|
"SettingsTabHotkeysResScaleUpHotkey": "Aumentare la risoluzione:",
|
||||||
|
"SettingsTabHotkeysResScaleDownHotkey": "Diminuire la risoluzione:"
|
||||||
}
|
}
|
||||||
|
|
|
@ -554,5 +554,7 @@
|
||||||
"ControllerMotionTitle": "Configurações do controle de movimento",
|
"ControllerMotionTitle": "Configurações do controle de movimento",
|
||||||
"ControllerRumbleTitle": "Configurações de vibração",
|
"ControllerRumbleTitle": "Configurações de vibração",
|
||||||
"SettingsSelectThemeFileDialogTitle" : "Selecionar arquivo do tema",
|
"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:"
|
||||||
}
|
}
|
||||||
|
|
|
@ -554,5 +554,7 @@
|
||||||
"ControllerMotionTitle": "Hareket Kontrol Seçenekleri",
|
"ControllerMotionTitle": "Hareket Kontrol Seçenekleri",
|
||||||
"ControllerRumbleTitle": "Titreşim Seçenekleri",
|
"ControllerRumbleTitle": "Titreşim Seçenekleri",
|
||||||
"SettingsSelectThemeFileDialogTitle" : "Tema Dosyası Seçin",
|
"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:"
|
||||||
}
|
}
|
||||||
|
|
|
@ -568,5 +568,7 @@
|
||||||
"UpdateWindowTitle": "管理游戏更新",
|
"UpdateWindowTitle": "管理游戏更新",
|
||||||
"CheatWindowHeading": "适用于 {0} [{1}] 的金手指",
|
"CheatWindowHeading": "适用于 {0} [{1}] 的金手指",
|
||||||
"DlcWindowHeading": "适用于 {0} [{1}] 的 DLC",
|
"DlcWindowHeading": "适用于 {0} [{1}] 的 DLC",
|
||||||
"GameUpdateWindowHeading": "适用于 {0} [{1}] 的更新"
|
"GameUpdateWindowHeading": "适用于 {0} [{1}] 的更新",
|
||||||
|
"SettingsTabHotkeysResScaleUpHotkey": "分辨率提高",
|
||||||
|
"SettingsTabHotkeysResScaleDownHotkey": "降低分辨率"
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
Screenshot,
|
Screenshot,
|
||||||
ShowUi,
|
ShowUi,
|
||||||
Pause,
|
Pause,
|
||||||
ToggleMute
|
ToggleMute,
|
||||||
|
ResScaleUp,
|
||||||
|
ResScaleDown
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -241,6 +241,22 @@
|
||||||
TextAlignment="Center" />
|
TextAlignment="Center" />
|
||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
<StackPanel Margin="10,0,0,0" Orientation="Horizontal">
|
||||||
|
<TextBlock VerticalAlignment="Center" Text="{locale:Locale SettingsTabHotkeysResScaleUpHotkey}" Width="230" />
|
||||||
|
<ToggleButton Width="90" Height="27" Checked="Button_Checked" Unchecked="Button_Unchecked">
|
||||||
|
<TextBlock
|
||||||
|
Text="{Binding KeyboardHotkeys.ResScaleUp, Mode=TwoWay, Converter={StaticResource Key}}"
|
||||||
|
TextAlignment="Center" />
|
||||||
|
</ToggleButton>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Margin="10,0,0,0" Orientation="Horizontal">
|
||||||
|
<TextBlock VerticalAlignment="Center" Text="{locale:Locale SettingsTabHotkeysResScaleDownHotkey}" Width="230" />
|
||||||
|
<ToggleButton Width="90" Height="27" Checked="Button_Checked" Unchecked="Button_Unchecked">
|
||||||
|
<TextBlock
|
||||||
|
Text="{Binding KeyboardHotkeys.ResScaleDown, Mode=TwoWay, Converter={StaticResource Key}}"
|
||||||
|
TextAlignment="Center" />
|
||||||
|
</ToggleButton>
|
||||||
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|
|
@ -7,5 +7,7 @@
|
||||||
public Key ShowUi { get; set; }
|
public Key ShowUi { get; set; }
|
||||||
public Key Pause { get; set; }
|
public Key Pause { get; set; }
|
||||||
public Key ToggleMute { get; set; }
|
public Key ToggleMute { get; set; }
|
||||||
|
public Key ResScaleUp { get; set; }
|
||||||
|
public Key ResScaleDown { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace Ryujinx.Ui.Common.Configuration
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current version of the file format
|
/// The current version of the file format
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const int CurrentVersion = 38;
|
public const int CurrentVersion = 39;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Version of the configuration file format
|
/// Version of the configuration file format
|
||||||
|
@ -80,7 +80,7 @@ namespace Ryujinx.Ui.Common.Configuration
|
||||||
/// Enables printing error log messages
|
/// Enables printing error log messages
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool LoggingEnableError { get; set; }
|
public bool LoggingEnableError { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enables printing trace log messages
|
/// Enables printing trace log messages
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -310,7 +310,7 @@ namespace Ryujinx.Ui.Common.Configuration
|
||||||
EnableDockedMode = new ReactiveObject<bool>();
|
EnableDockedMode = new ReactiveObject<bool>();
|
||||||
EnableDockedMode.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableDockedMode));
|
EnableDockedMode.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableDockedMode));
|
||||||
EnablePtc = new ReactiveObject<bool>();
|
EnablePtc = new ReactiveObject<bool>();
|
||||||
EnablePtc.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnablePtc));
|
EnablePtc.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnablePtc));
|
||||||
EnableInternetAccess = new ReactiveObject<bool>();
|
EnableInternetAccess = new ReactiveObject<bool>();
|
||||||
EnableInternetAccess.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableInternetAccess));
|
EnableInternetAccess.Event += static (sender, e) => LogValueChange(sender, e, nameof(EnableInternetAccess));
|
||||||
EnableFsIntegrityChecks = new ReactiveObject<bool>();
|
EnableFsIntegrityChecks = new ReactiveObject<bool>();
|
||||||
|
@ -648,7 +648,9 @@ namespace Ryujinx.Ui.Common.Configuration
|
||||||
ToggleMute = Key.F2,
|
ToggleMute = Key.F2,
|
||||||
Screenshot = Key.F8,
|
Screenshot = Key.F8,
|
||||||
ShowUi = Key.F4,
|
ShowUi = Key.F4,
|
||||||
Pause = Key.F5
|
Pause = Key.F5,
|
||||||
|
ResScaleUp = Key.Unbound,
|
||||||
|
ResScaleDown = Key.Unbound
|
||||||
};
|
};
|
||||||
Hid.InputConfig.Value = new List<InputConfig>
|
Hid.InputConfig.Value = new List<InputConfig>
|
||||||
{
|
{
|
||||||
|
@ -967,7 +969,7 @@ namespace Ryujinx.Ui.Common.Configuration
|
||||||
if (configurationFileFormat.Version < 29)
|
if (configurationFileFormat.Version < 29)
|
||||||
{
|
{
|
||||||
Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 29.");
|
Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 29.");
|
||||||
|
|
||||||
configurationFileFormat.Hotkeys = new KeyboardHotkeys
|
configurationFileFormat.Hotkeys = new KeyboardHotkeys
|
||||||
{
|
{
|
||||||
ToggleVsync = Key.Tab,
|
ToggleVsync = Key.Tab,
|
||||||
|
@ -1096,6 +1098,22 @@ namespace Ryujinx.Ui.Common.Configuration
|
||||||
configurationFileUpdated = true;
|
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;
|
Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog;
|
||||||
Graphics.ResScale.Value = configurationFileFormat.ResScale;
|
Graphics.ResScale.Value = configurationFileFormat.ResScale;
|
||||||
Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom;
|
Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom;
|
||||||
|
|
|
@ -6,6 +6,7 @@ using Ryujinx.Common;
|
||||||
using Ryujinx.Common.Configuration;
|
using Ryujinx.Common.Configuration;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Ui.Common.Configuration;
|
using Ryujinx.Ui.Common.Configuration;
|
||||||
|
using Ryujinx.Graphics.Gpu;
|
||||||
using Ryujinx.Graphics.GAL;
|
using Ryujinx.Graphics.GAL;
|
||||||
using Ryujinx.Graphics.GAL.Multithreading;
|
using Ryujinx.Graphics.GAL.Multithreading;
|
||||||
using Ryujinx.Input;
|
using Ryujinx.Input;
|
||||||
|
@ -33,6 +34,7 @@ namespace Ryujinx.Ui
|
||||||
private const int SwitchPanelWidth = 1280;
|
private const int SwitchPanelWidth = 1280;
|
||||||
private const int SwitchPanelHeight = 720;
|
private const int SwitchPanelHeight = 720;
|
||||||
private const int TargetFps = 60;
|
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 ManualResetEvent WaitEvent { get; set; }
|
||||||
public NpadManager NpadManager { get; }
|
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;
|
_prevHotkeyState = currentHotkeyState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -648,7 +663,9 @@ namespace Ryujinx.Ui
|
||||||
Screenshot = 1 << 1,
|
Screenshot = 1 << 1,
|
||||||
ShowUi = 1 << 2,
|
ShowUi = 1 << 2,
|
||||||
Pause = 1 << 3,
|
Pause = 1 << 3,
|
||||||
ToggleMute = 1 << 4
|
ToggleMute = 1 << 4,
|
||||||
|
ResScaleUp = 1 << 5,
|
||||||
|
ResScaleDown = 1 << 6
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyboardHotkeyState GetHotkeyState()
|
private KeyboardHotkeyState GetHotkeyState()
|
||||||
|
@ -680,6 +697,16 @@ namespace Ryujinx.Ui
|
||||||
state |= KeyboardHotkeyState.ToggleMute;
|
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;
|
return state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue