fengb / fundude

Gameboy emulator: Zig -> wasm
https://fengb.github.io/fundude/
MIT License
181 stars 8 forks source link

Sleep/resume overflow #53

Open fengb opened 4 years ago

fengb commented 4 years ago

When the timer doesn't fire for... days, the counter overflows and does bad stuff. This really only happens when the laptop / browser goes to sleep.

We should add a hook to disable/reenable the runloop upon sleep/wake.

fengb commented 4 years ago

There's also been a regression with background processing. setInterval doesn't seem to be as guaranteed to run as setTimeout (although neither is actually guaranteed). The recommendation is the use a WebWorker for the timer, which feels a little heavy but it can work.