mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-25 23:37:11 +02:00
feature: Turbo Mode
Adds an elapsed tick multiplier feature which speeds up games which are built upon delta time. More information: https://web.archive.org/web/20240713135029/https://github.com/Ryujinx/Ryujinx/pull/6456
This commit is contained in:
parent
d7754aeee1
commit
8ad5c73f4c
23 changed files with 475 additions and 41 deletions
|
@ -4,6 +4,7 @@ using Avalonia.Controls.ApplicationLifetimes;
|
|||
using Avalonia.Input;
|
||||
using Avalonia.Threading;
|
||||
using DiscordRPC;
|
||||
using Gommon;
|
||||
using LibHac.Common;
|
||||
using LibHac.Ns;
|
||||
using Ryujinx.Audio.Backends.Dummy;
|
||||
|
@ -1115,11 +1116,23 @@ namespace Ryujinx.Ava.Systems
|
|||
LocaleManager.Instance[LocaleKeys.VolumeShort] + $": {(int)(Device.GetVolume() * 100)}%",
|
||||
dockedMode,
|
||||
ConfigurationState.Instance.Graphics.AspectRatio.Value.ToText(),
|
||||
Device.Statistics.FormatGameFrameRate(),
|
||||
FormatGameFrameRate(),
|
||||
Device.Statistics.FormatFifoPercent(),
|
||||
_displayCount));
|
||||
}
|
||||
|
||||
private string FormatGameFrameRate()
|
||||
{
|
||||
string frameRate = Device.Statistics.GetGameFrameRate().ToString("00.00");
|
||||
string frameTime = Device.Statistics.GetGameFrameTime().ToString("00.00");
|
||||
|
||||
return Device.TurboMode
|
||||
? LocaleManager.GetUnformatted(LocaleKeys.FpsTurboStatusBarText)
|
||||
.Format(frameRate, frameTime, Device.TickScalar)
|
||||
: LocaleManager.GetUnformatted(LocaleKeys.FpsStatusBarText)
|
||||
.Format(frameRate, frameTime);
|
||||
}
|
||||
|
||||
public async Task ShowExitPrompt()
|
||||
{
|
||||
bool shouldExit = !ConfigurationState.Instance.ShowConfirmExit;
|
||||
|
@ -1215,6 +1228,12 @@ namespace Ryujinx.Ava.Systems
|
|||
|
||||
if (currentHotkeyState != _prevHotkeyState)
|
||||
{
|
||||
if (ConfigurationState.Instance.Hid.Hotkeys.Value.TurboModeWhileHeld &&
|
||||
_keyboardInterface.IsPressed((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.TurboMode) != Device.TurboMode)
|
||||
{
|
||||
Device.ToggleTurbo();
|
||||
}
|
||||
|
||||
switch (currentHotkeyState)
|
||||
{
|
||||
case KeyboardHotkeyState.ToggleVSyncMode:
|
||||
|
@ -1226,6 +1245,12 @@ namespace Ryujinx.Ava.Systems
|
|||
case KeyboardHotkeyState.CustomVSyncIntervalIncrement:
|
||||
_viewModel.CustomVSyncInterval = Device.IncrementCustomVSyncInterval();
|
||||
break;
|
||||
case KeyboardHotkeyState.TurboMode:
|
||||
if (!ConfigurationState.Instance.Hid.Hotkeys.Value.TurboModeWhileHeld)
|
||||
{
|
||||
Device.ToggleTurbo();
|
||||
}
|
||||
break;
|
||||
case KeyboardHotkeyState.Screenshot:
|
||||
ScreenshotRequested = true;
|
||||
break;
|
||||
|
@ -1355,6 +1380,10 @@ namespace Ryujinx.Ava.Systems
|
|||
{
|
||||
state = KeyboardHotkeyState.CustomVSyncIntervalDecrement;
|
||||
}
|
||||
else if (_keyboardInterface.IsPressed((Key)ConfigurationState.Instance.Hid.Hotkeys.Value.TurboMode))
|
||||
{
|
||||
state = KeyboardHotkeyState.TurboMode;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -258,6 +258,11 @@ namespace Ryujinx.Ava.Systems.Configuration
|
|||
/// Enables or disables low-power profiled translation cache persistency loading
|
||||
/// </summary>
|
||||
public bool EnableLowPowerPtc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Clock tick scalar, in percent points (100 = 1.0).
|
||||
/// </summary>
|
||||
public long TickScalar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables guest Internet access
|
||||
|
|
|
@ -93,6 +93,7 @@ namespace Ryujinx.Ava.Systems.Configuration
|
|||
System.EnableDockedMode.Value = cff.DockedMode;
|
||||
System.EnablePtc.Value = cff.EnablePtc;
|
||||
System.EnableLowPowerPtc.Value = cff.EnableLowPowerPtc;
|
||||
System.TickScalar.Value = cff.TickScalar;
|
||||
System.EnableInternetAccess.Value = cff.EnableInternetAccess;
|
||||
System.EnableFsIntegrityChecks.Value = cff.EnableFsIntegrityChecks;
|
||||
System.FsGlobalAccessLogMode.Value = cff.FsGlobalAccessLogMode;
|
||||
|
@ -438,9 +439,27 @@ namespace Ryujinx.Ava.Systems.Configuration
|
|||
(64, static cff => cff.LoggingEnableAvalonia = false),
|
||||
(65, static cff => cff.UpdateCheckerType = cff.CheckUpdatesOnStart ? UpdaterType.PromptAtStartup : UpdaterType.Off),
|
||||
(66, static cff => cff.DisableInputWhenOutOfFocus = false),
|
||||
(67, static cff => cff.FocusLostActionType = cff.DisableInputWhenOutOfFocus ? FocusLostType.BlockInput : FocusLostType.DoNothing)
|
||||
// 68 was the version that added per-game configs; the file structure did not change
|
||||
// the version was increased so external tools could know that your Ryujinx version has per-game config capabilities.
|
||||
(67, static cff => cff.FocusLostActionType = cff.DisableInputWhenOutOfFocus ? FocusLostType.BlockInput : FocusLostType.DoNothing),
|
||||
(68, static cff =>
|
||||
{
|
||||
cff.TickScalar = 200;
|
||||
cff.Hotkeys = new KeyboardHotkeys
|
||||
{
|
||||
ToggleVSyncMode = cff.Hotkeys.ToggleVSyncMode,
|
||||
Screenshot = cff.Hotkeys.Screenshot,
|
||||
ShowUI = cff.Hotkeys.ShowUI,
|
||||
Pause = cff.Hotkeys.Pause,
|
||||
ToggleMute = cff.Hotkeys.ToggleMute,
|
||||
ResScaleUp = cff.Hotkeys.ResScaleUp,
|
||||
ResScaleDown = cff.Hotkeys.ResScaleDown,
|
||||
VolumeUp = cff.Hotkeys.VolumeUp,
|
||||
VolumeDown = cff.Hotkeys.VolumeDown,
|
||||
CustomVSyncIntervalIncrement = cff.Hotkeys.CustomVSyncIntervalIncrement,
|
||||
CustomVSyncIntervalDecrement = cff.Hotkeys.CustomVSyncIntervalDecrement,
|
||||
TurboMode = Key.Unbound,
|
||||
TurboModeWhileHeld = false
|
||||
};
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -335,6 +335,11 @@ namespace Ryujinx.Ava.Systems.Configuration
|
|||
/// Enables or disables persistent profiled translation cache
|
||||
/// </summary>
|
||||
public ReactiveObject<bool> EnablePtc { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Clock tick scalar, in percent points (100 = 1.0).
|
||||
/// </summary>
|
||||
public ReactiveObject<long> TickScalar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables low-power persistent profiled translation cache loading
|
||||
|
@ -415,6 +420,15 @@ namespace Ryujinx.Ava.Systems.Configuration
|
|||
EnableLowPowerPtc.LogChangesToValue(nameof(EnableLowPowerPtc));
|
||||
EnableLowPowerPtc.Event += (_, evnt)
|
||||
=> Optimizations.LowPower = evnt.NewValue;
|
||||
TickScalar = new ReactiveObject<long>();
|
||||
TickScalar.LogChangesToValue(nameof(TickScalar));
|
||||
TickScalar.Event += (_, evnt) =>
|
||||
{
|
||||
if (Switch.Shared is null)
|
||||
return;
|
||||
|
||||
Switch.Shared.Configuration.TickScalar = evnt.NewValue;
|
||||
};
|
||||
EnableInternetAccess = new ReactiveObject<bool>();
|
||||
EnableInternetAccess.LogChangesToValue(nameof(EnableInternetAccess));
|
||||
EnableFsIntegrityChecks = new ReactiveObject<bool>();
|
||||
|
@ -842,6 +856,7 @@ namespace Ryujinx.Ava.Systems.Configuration
|
|||
Graphics.VSyncMode,
|
||||
System.EnableDockedMode,
|
||||
System.EnablePtc,
|
||||
System.TickScalar,
|
||||
System.EnableInternetAccess,
|
||||
System.EnableFsIntegrityChecks
|
||||
? IntegrityCheckLevel.ErrorOnInvalid
|
||||
|
@ -860,8 +875,8 @@ namespace Ryujinx.Ava.Systems.Configuration
|
|||
Multiplayer.Mode,
|
||||
Multiplayer.DisableP2p,
|
||||
Multiplayer.LdnPassphrase,
|
||||
Instance.Multiplayer.GetLdnServer(),
|
||||
Instance.Graphics.CustomVSyncInterval,
|
||||
Instance.Hacks.ShowDirtyHacks ? Instance.Hacks.EnabledHacks : null);
|
||||
Multiplayer.GetLdnServer(),
|
||||
Graphics.CustomVSyncInterval,
|
||||
Hacks.ShowDirtyHacks ? Hacks.EnabledHacks : null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,6 +72,7 @@ namespace Ryujinx.Ava.Systems.Configuration
|
|||
EnableColorSpacePassthrough = Graphics.EnableColorSpacePassthrough,
|
||||
EnablePtc = System.EnablePtc,
|
||||
EnableLowPowerPtc = System.EnableLowPowerPtc,
|
||||
TickScalar = System.TickScalar,
|
||||
EnableInternetAccess = System.EnableInternetAccess,
|
||||
EnableFsIntegrityChecks = System.EnableFsIntegrityChecks,
|
||||
FsGlobalAccessLogMode = System.FsGlobalAccessLogMode,
|
||||
|
@ -260,6 +261,10 @@ namespace Ryujinx.Ava.Systems.Configuration
|
|||
ResScaleDown = Key.Unbound,
|
||||
VolumeUp = Key.Unbound,
|
||||
VolumeDown = Key.Unbound,
|
||||
CustomVSyncIntervalIncrement = Key.Unbound,
|
||||
CustomVSyncIntervalDecrement = Key.Unbound,
|
||||
TurboMode = Key.Unbound,
|
||||
TurboModeWhileHeld = false
|
||||
};
|
||||
Hid.RainbowSpeed.Value = 1f;
|
||||
Hid.InputConfig.Value =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue