Closed jumpjack closed 1 year ago
The web app downloads the dsk and then puts it in the browser local storage: https://github.com/pete-gordon/oricutron/blob/www/main.c#L1823 https://github.com/pete-gordon/oricutron/blob/www/main.c#L1784 Then the emulator accesses it (in read and write mode) in the browser local storage which is mounted into the memory of the web app: https://github.com/pete-gordon/oricutron/blob/www/main.c#L1908
The details of what I used is presented in emscripten doc here: https://emscripten.org/docs/api_reference/fetch.html https://emscripten.org/docs/api_reference/Filesystem-API.html
Thanks but I'm stuck one step before: how does the webapp know that the filename to download is myfile.dsk? I just click this link in index.hml:
<a href="oricutron.html">myfile.dsk</a>
... and "magically" webapp receives the filename, but I don't understand how.
Unfortunately I don't know anything about wasm and emscripten.. I did put some dozens of console.log() commands in oricutron.js , but I can't yet find the moment when "myfile.dsk" string is passed to webapp.
In the index.html I copy the filename in the sessionstorage: https://github.com/pete-gordon/oricutron/blob/www/www/index.html#L24
Then in oricutron.html I get the file name from the sessionstorage and copy it to the emulator's environment: https://github.com/pete-gordon/oricutron/blob/www/www/oricutron.html#L191
Lastly, in the emulator code I retrieve the filename from the environment: https://github.com/pete-gordon/oricutron/blob/www/main.c#L1826
Not an issue.
I can't understand How .dsk files are passed to OricutronJS upon clicking a link to oricutron.html; I know how to load a .dsk file from local hard disk or remote server, and I would like to pass it to the emulator.