Add custom refresh rate mode to VSync option (#238)

Rebased @jcm93's refreshinterval branch:
https://github.com/jcm93/Ryujinx/tree/refreshinterval

The option is placed under System/Hacks. Disabled, it's the default
Ryujinx behavior. Enabled, the behavior is shown in the attached
screenshots. If a framerate is too high or low, you can adjust the value
where you normally toggle VSync on and off. It will also cycle through
the default on/off toggles.

Also, in order to reduce clutter, I made an adjustment to remove the
target FPS and only show the percentage.

---------

Co-authored-by: jcm <6864788+jcm93@users.noreply.github.com>
This commit is contained in:
Keaton 2024-11-25 13:39:09 -06:00 committed by GitHub
parent 7e16fccfc1
commit 2e6794e69b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 678 additions and 110 deletions

View file

@ -5,13 +5,13 @@ namespace Ryujinx.Ava.UI.Models.Input
{
public class HotkeyConfig : BaseModel
{
private Key _toggleVsync;
public Key ToggleVsync
private Key _toggleVSyncMode;
public Key ToggleVSyncMode
{
get => _toggleVsync;
get => _toggleVSyncMode;
set
{
_toggleVsync = value;
_toggleVSyncMode = value;
OnPropertyChanged();
}
}
@ -104,11 +104,33 @@ namespace Ryujinx.Ava.UI.Models.Input
}
}
private Key _customVSyncIntervalIncrement;
public Key CustomVSyncIntervalIncrement
{
get => _customVSyncIntervalIncrement;
set
{
_customVSyncIntervalIncrement = value;
OnPropertyChanged();
}
}
private Key _customVSyncIntervalDecrement;
public Key CustomVSyncIntervalDecrement
{
get => _customVSyncIntervalDecrement;
set
{
_customVSyncIntervalDecrement = value;
OnPropertyChanged();
}
}
public HotkeyConfig(KeyboardHotkeys config)
{
if (config != null)
{
ToggleVsync = config.ToggleVsync;
ToggleVSyncMode = config.ToggleVSyncMode;
Screenshot = config.Screenshot;
ShowUI = config.ShowUI;
Pause = config.Pause;
@ -117,6 +139,8 @@ namespace Ryujinx.Ava.UI.Models.Input
ResScaleDown = config.ResScaleDown;
VolumeUp = config.VolumeUp;
VolumeDown = config.VolumeDown;
CustomVSyncIntervalIncrement = config.CustomVSyncIntervalIncrement;
CustomVSyncIntervalDecrement = config.CustomVSyncIntervalDecrement;
}
}
@ -124,7 +148,7 @@ namespace Ryujinx.Ava.UI.Models.Input
{
var config = new KeyboardHotkeys
{
ToggleVsync = ToggleVsync,
ToggleVSyncMode = ToggleVSyncMode,
Screenshot = Screenshot,
ShowUI = ShowUI,
Pause = Pause,
@ -133,6 +157,8 @@ namespace Ryujinx.Ava.UI.Models.Input
ResScaleDown = ResScaleDown,
VolumeUp = VolumeUp,
VolumeDown = VolumeDown,
CustomVSyncIntervalIncrement = CustomVSyncIntervalIncrement,
CustomVSyncIntervalDecrement = CustomVSyncIntervalDecrement,
};
return config;