Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TickSource-based turbo mode #747

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Conversation

GreemDev
Copy link
Member

@GreemDev GreemDev commented Mar 4, 2025

This PR adds a hotkey that, while held, toggles on a "turbo mode" flag that multiplies elapsed CPU TickSource ticks, which should speed up any games that use delta time between frames for physics calculations.

This is functionally distinct from the existing custom refresh rate, despite sounding similar.
Custom Refresh Rate (#238) simply allows you to increase the emulated Switch's present rate.
This PR actively changes CPU tick speeds by an arbitrary scalar to speed up gameplay deliberately.
The point of CRR (#238) is for more broad FPS cap selection, for games that aren't FPS sensitive.
Alternatively, the point of this PR is to speed up gameplay by an arbitrary factor.

Original PR archive (originally by @nico-abram)
https://web.archive.org/web/20240713135029/https://github.com/Ryujinx/Ryujinx/pull/6456

This todo is written from their perspective; not mine.

TODO:

  • TickSource currently stores the multiplier as a public static. Is this alright, or should it be turned into a private static and a method added? Changed to an instance field.
  • Should the multiplier setting go in System settings? (It's where it's currently at) Moved to CPU
  • Keyboard hotkeys cannot be assigned to a controller. Should the hotkey instead be in the input config?
  • It's implemented as a "Hold" button. Did not see any such buttons in the avalonia UI (Only "toggle on press" buttons) so the way this was implemented might be a bit hacky, It checks IsPressed whenever (currentHotkeyState != _prevHotkeyState) and if it differs from turboMode it updates the multiplier.
  • Need to define a default hotkey. I set it to F3 but didn't think much about it. Unbounded.
  • I set the interval for the setting to [50, 500]%, might need some discussion around what this should be ("What are reasonable values")
  • riperi mentioned on discord that "if this is added, it should also increase the vsync rate". I tried adjusting _ticksPerFrame in SurfaceFlinger.cs, but the game I've been testing on (Xenoblade DE, 30fps game, unmodded) was getting FPS over 30 with VSync on even without modifying that.

@github-actions github-actions bot added cpu An issue with ARMeilleure, the JIT, or Hypervisor gpu Affects GPU emulation gui Affects the Avalonia UI or translations. horizon Affects the Horizon OS HLE components. labels Mar 4, 2025
@amayra
Copy link

amayra commented Mar 4, 2025

Would it be possible to add a toggle option for 'turbo mode' so that pressing the assigned hotkey once enables it, and pressing it again disables it? Holding the button is fine for short bursts, but a toggle would make it easier to use for extended periods.

ps: this will be useful in turn-based games

@GreemDev
Copy link
Member Author

GreemDev commented Mar 4, 2025

Would it be possible to add a toggle option for 'turbo mode' so that pressing the assigned hotkey once enables it, and pressing it again disables it? Holding the button is fine for short bursts, but a toggle would make it easier to use for extended periods.

ps: this will be useful in turn-based games

Please try these PRs before you suggest new things be added.
This is literally already a part of this PR. In fact its the only entry in Keyboard Hotkeys settings that has a "only while pressed" option, allowing you to choose turbo activation type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cpu An issue with ARMeilleure, the JIT, or Hypervisor gpu Affects GPU emulation gui Affects the Avalonia UI or translations. horizon Affects the Horizon OS HLE components.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants