torch2424 / wasmboy

Game Boy / Game Boy Color Emulator Library, 🎮written for WebAssembly using AssemblyScript. 🚀Demos built with Preact and Svelte. ⚛️
https://wasmboy.app/
GNU General Public License v3.0
1.39k stars 65 forks source link

setJoypadState is inconsistent #375

Open bonkrat opened 9 months ago

bonkrat commented 9 months ago

setJoypadState is not consistently updating the WasmBoy instance. For example, something like:

setInterval(async () => {
  WasmBoy.setJoypadState({
    ...getInitialJoypadState(),
    UP: true
  })
}, 500)

Screencast from 2024-01-08 21-57-22.webm

will process correctly sometimes. I haven't been able to figure out why it's dropping some of the input here. Maybe I'm not using it correctly though. Is there a suggested way to use setJoypadState with the Lib API? Or should it only be used with executeFrame to guarantee that it is set between each frame?