spritely icon indicating copy to clipboard operation
spritely copied to clipboard

wasm: issue with using keybinding in browser

Open dfirebaugh opened this issue 6 years ago • 2 comments

When I compile to web assembly, the application runs fine (in the browser) until I use one of the keyboard shortcuts (e.g. ctrl+c to copy).

exception thrown: RuntimeError: index out of bounds,@http://localhost:8000/index.wasm:wasm-function[292]:0x7047

dfirebaugh avatar Oct 05 '20 23:10 dfirebaugh

I looked around at this for a bit. I wasn't able to find anything that would allow us to use the keybindings in the browser. I added this line that seems to disable keybindings in wasm. https://github.com/dfirebaugh/spritely/blob/e2132ac5b49bce9483f18a2cc2d4f2a52a396ec7/src/init.c#L19

Maybe once our gui toolbar is built out this won't be as big of a deal, but currently the browser version is missing features.

Hopefully there's a better solution out there.

https://dfirebaugh.github.io/spritely/

dfirebaugh avatar Oct 09 '20 05:10 dfirebaugh

this seems to be related to certain system calls that wasm doesn't know how to handle. For now, I added a check in the open_file and the save_file to see if we are in emscripten. If we are in emscripten build, they would just return.

I thought these were working, but it seems like only the save_file function is disabled. The open_file function still throws an error.

https://github.com/dfirebaugh/spritely/blob/05699c4bd409f05a09c82d4f689ab7392c1c8160/src/file.c#L219-L220

dfirebaugh avatar Oct 12 '20 04:10 dfirebaugh