Skip to content

feat(port): add option to pause game when F8 menu is opened - #234

Open
jacobjordan94 wants to merge 1 commit into
999sian:masterfrom
jacobjordan94:feat/pause-game-on-menu-open
Open

jacobjordan94 wants to merge 1 commit into
999sian:masterfrom
jacobjordan94:feat/pause-game-on-menu-open

Conversation

@jacobjordan94

Copy link
Copy Markdown

Summary

Adds an opt-in setting, off by default, that freezes the game world while the F8 menu is open instead of letting it keep running behind the menu. It shows up as a checkbox in both the ribbon-mode footer and
classic mode's settings panel, right next to the existing Skip Launcher toggle.

It reuses Practice Mode's existing pause loop in VBlankIntrWait() (present and pump events only, no Port_UpdateInput, so game state can't advance) instead of building a second freeze mechanism. The new setting just adds a second condition that can hold the same loop open.

This also fixes an existing audio desync along the way. The SDL audio callback runs on its own thread and keeps consuming the stream no matter what the engine is doing, so music and SFX kept elapsing behind a frozen game and could drift out of sync with a cutscene once resumed.
That applied to Practice Mode's own frame-step pause too, since it shares the same loop, so both pause sources now pause and resume the audio device in lockstep with the freeze.

Requested in #225.

Testing

Linux, Bazzite host, built inside a Debian distrobox container.

  • xmake build -y tmc_pc: clean build.
  • Headless smoke run (TMC_AUTOPLAY=1, dummy video/audio) reaches "Port layer initialized. Entering AgbMain...".
  • Manual testing on the host with a controller and keyboard:
    • Toggling the setting on or off while F8 is already open freezes or resumes within the loop's own ~4ms tick, no need to close and reopen the menu.
    • Quitting while frozen, from either pause source, shuts down cleanly.
    • Practice Mode's overlays (timer, inputs, history) still render correctly when the freeze comes from this setting instead of Practice Mode's own pause.
    • Confirmed and accepted as intended: frame-stepping does nothing while Practice Mode's pause and this setting are both holding the freeze open at once. The menu-open condition wins over a single step-through in that combination.
    • Confirmed and accepted as intended: audio now also pauses during Practice Mode's plain frame-step pause, not just when triggered by this new setting.

…d in 999sian#225)

Also fixes an existing audio desync: Practice Mode's frame-step pause lets music/SFX keep elapsing behind the frozen game, drifting out of
sync with cutscenes once resumed. Fixed for both pause sources since
they share the same freeze loop.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant