feat: pace frames to the interval set with SetFrameIntervalX #3

Manually merged
github merged 1 commit from gh-pr/3/head into gh-pr/3/base 2026-11-26 19:55:05 +00:00
Owner

@⁠AutoComput on GitHub · 2026-11-21 10:05 UTC · original
AutoComput:feat/frame-interval-pacing → main · +128 −5 · 7 files · 1 commits · merged 2026-11-22 10:38 UTC

TL;DR

  • Problem: Games run as fast as the PC can go instead of at the frame rate they ask for.
  • Fix: The emulator now waits between frames to hold the requested rate. --uncapped turns that off.

WaitFrameEventX returns straight away, so the title runs uncapped. It now waits for the next frame origin, one SetFrameIntervalX interval after the last. I treated the period argument as latency rather than a rate divisor, so the observed (16667, 2) means 60 fps. Worth a second look if you know otherwise.

It uses a high resolution waitable timer, not vsync. --uncapped turns it off for benchmarking. ScheduleFrameEventX is unchanged.

New test test_d3d12_frame_pacing calls the two slots on the device proxy: 12 frames take 200 ms. I don't have the title, so this is untested in a real game. It assumes the title calls WaitFrameEventX once per frame. The milestone notes in generate_status.py still say uncapped, I left those for you.

**@⁠AutoComput** on GitHub · 2026-11-21 10:05 UTC · [original](https://github.com/Freminet/ScarlettX/pull/3) `AutoComput:feat/frame-interval-pacing` → `main` · +128 −5 · 7 files · 1 commits · merged 2026-11-22 10:38 UTC **TL;DR** - **Problem:** Games run as fast as the PC can go instead of at the frame rate they ask for. - **Fix:** The emulator now waits between frames to hold the requested rate. `--uncapped` turns that off. `WaitFrameEventX` returns straight away, so the title runs uncapped. It now waits for the next frame origin, one `SetFrameIntervalX` interval after the last. I treated the period argument as latency rather than a rate divisor, so the observed `(16667, 2)` means 60 fps. Worth a second look if you know otherwise. It uses a high resolution waitable timer, not vsync. `--uncapped` turns it off for benchmarking. `ScheduleFrameEventX` is unchanged. New test `test_d3d12_frame_pacing` calls the two slots on the device proxy: 12 frames take 200 ms. I don't have the title, so this is untested in a real game. It assumes the title calls `WaitFrameEventX` once per frame. The milestone notes in `generate_status.py` still say uncapped, I left those for you.
WaitFrameEventX on the device proxy now blocks until the next frame origin
instead of returning at once, so a title that waits on it runs at the rate
it asked for. --uncapped restores the old behaviour.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 19:55:03 +00:00
github manually merged commit 41bbb89dcb into gh-pr/3/base 2026-11-26 19:55:05 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.