nepx / halfix

x86 PC emulator that runs both natively and in the browser, via WebAssembly
https://nepx.github.io/halfix-demo/
GNU General Public License v3.0
669 stars 86 forks source link

lib/drive-filereader.js is missing #14

Closed ikreymer closed 3 years ago

ikreymer commented 3 years ago

Wanted to try the emscripten build of halfix.

Looks like there's a file that's missing from git:

<script src="lib/drive-filereader.js"></script>

The file is not in the repo, I assume its also where dynCall_vii would be implemented, as it ends up being undefined.

nepx commented 3 years ago

Hi,

Sorry, I shouldn't have included that line. It was for another side project that I can hopefully pick back up when I'm not so busy.

As for dynCall_vii, that's an internal Emscripten routine to call function pointers. It connects the disk image loader (in JavaScript) back into the IDE emulator (in C). I used a lower-level binding mainly for speed and simplicity. The build script always invokes emcc with -s "EXTRA_EXPORTED_RUNTIME_METHODS=['dynCall_vii']" so that this routine is always exported. If you're using the build script and Emscripten is still complaining, then it will probably require more code changes, by perhaps writing a custom implementation of dynCall_vii.

In the past, Emscripten would automatically expose dynCall_vii, but somewhere along the line, it changed so that it no longer does. It works with the latest Emscripten (2.0.9), though.

Hope that helps.

rossimo commented 3 years ago

2.0.9 didn't work for me, personally. Had the same dynCall_vii issue. Rolled back to the 1.x release of Emscripten, and things began to work.

nepx commented 3 years ago

I believe the dynCall issue should be resolved now -- I wrote my own version of it in src/emscripten/emscripten.c, and it works fine on 2.0.9.