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:
MutantAura 2022-07-24 19:44:47 +01:00 committed by GitHub
parent 1a888ae087
commit 62f8ceb60b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 109 additions and 14 deletions

View file

@ -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;
}