Browsers heavily throttle non-active flags. This is especially bad with the gametank emulator's web build as this often leads to deeply cursed audio as the audio processor is not given enough time to run.
This pr adds some simple, idempotent functions to gte.cpp to pause and resume emulation. These functions are exported for use through emscripten. The browser uses a visibilitychange event on the page to call PauseEmulation or ResumeEmulation respectively.
Lmk what your thoughts on this pr are. I didn't see any other functions specifically for controlling the emulator's paused state, so I'm not sure I'm pausing everything I need to.
Note on <iframe>s: According to mdn, iframes inherit the visibility status of their containing page. This means that if you tab away from an itch page with an emulator running the embedded emulator iframe also receives the visibilitychange event. I haven't updated the embedded shell in this pr to also feature pausing functionality, but I could if you want.
Update: pause/ resume functionality has been added to the embedded shell
Browsers heavily throttle non-active flags. This is especially bad with the gametank emulator's web build as this often leads to deeply cursed audio as the audio processor is not given enough time to run.
This pr adds some simple, idempotent functions to
gte.cpp
to pause and resume emulation. These functions are exported for use through emscripten. The browser uses a visibilitychange event on the page to callPauseEmulation
orResumeEmulation
respectively.Lmk what your thoughts on this pr are. I didn't see any other functions specifically for controlling the emulator's paused state, so I'm not sure I'm pausing everything I need to.
Note on
<iframe>
s: According to mdn, iframes inherit the visibility status of their containing page. This means that if you tab away from an itch page with an emulator running the embedded emulator iframe also receives the visibilitychange event. I haven't updated the embedded shell in this pr to also feature pausing functionality, but I could if you want.Update: pause/ resume functionality has been added to the embedded shell