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

@ -115,8 +115,11 @@ namespace Ryujinx.Headless.SDL2
[Option("fs-global-access-log-mode", Required = false, Default = 0, HelpText = "Enables FS access log output to the console.")]
public int FsGlobalAccessLogMode { get; set; }
[Option("disable-vsync", Required = false, HelpText = "Disables Vertical Sync.")]
public bool DisableVSync { get; set; }
[Option("vsync-mode", Required = false, Default = VSyncMode.Switch, HelpText = "Sets the emulated VSync mode (Switch, Unbounded, or Custom).")]
public VSyncMode VSyncMode { get; set; }
[Option("custom-refresh-rate", Required = false, Default = 90, HelpText = "Sets the custom refresh rate target value (integer).")]
public int CustomVSyncInterval { get; set; }
[Option("disable-shader-cache", Required = false, HelpText = "Disables Shader cache.")]
public bool DisableShaderCache { get; set; }

View file

@ -563,7 +563,7 @@ namespace Ryujinx.Headless.SDL2
window,
options.SystemLanguage,
options.SystemRegion,
!options.DisableVSync,
options.VSyncMode,
!options.DisableDockedMode,
!options.DisablePTC,
options.EnableInternetAccess,
@ -580,7 +580,8 @@ namespace Ryujinx.Headless.SDL2
Common.Configuration.Multiplayer.MultiplayerMode.Disabled,
false,
"",
"");
"",
options.CustomVSyncInterval);
return new Switch(configuration);
}

View file

@ -3,7 +3,7 @@ using System;
namespace Ryujinx.Headless.SDL2
{
class StatusUpdatedEventArgs(
bool vSyncEnabled,
string vSyncMode,
string dockedMode,
string aspectRatio,
string gameStatus,
@ -11,7 +11,7 @@ namespace Ryujinx.Headless.SDL2
string gpuName)
: EventArgs
{
public bool VSyncEnabled = vSyncEnabled;
public string VSyncMode = vSyncMode;
public string DockedMode = dockedMode;
public string AspectRatio = aspectRatio;
public string GameStatus = gameStatus;

View file

@ -314,7 +314,7 @@ namespace Ryujinx.Headless.SDL2
}
StatusUpdatedEvent?.Invoke(this, new StatusUpdatedEventArgs(
Device.EnableDeviceVsync,
Device.VSyncMode.ToString(),
dockedMode,
Device.Configuration.AspectRatio.ToText(),
$"Game: {Device.Statistics.GetGameFrameRate():00.00} FPS ({Device.Statistics.GetGameFrameTime():00.00} ms)",