pete-gordon / oricutron

Portable Oric-1/Atmos/Telestrat and Pravetz 8D emulator
http://www.petergordon.org.uk/oricutron/
GNU General Public License v2.0
69 stars 25 forks source link

Remote files download not supported #187

Open jumpjack opened 1 year ago

jumpjack commented 1 year ago

Replacing "fetch->url" in these lines:

https://github.com/pete-gordon/oricutron/blob/075c517a15ff15dfa8424dd7f88b6baf5cd486e7/main.c#L1793

https://github.com/pete-gordon/oricutron/blob/075c517a15ff15dfa8424dd7f88b6baf5cd486e7/main.c#L1804

by just the filename if the string contains a remote url, would allow loading any remote file into the emulator. For example, the download of https://jumpjack.github.io/oricutronJS/space1999-en.dsk succeeds, but of course creation of emulator file

/readwritefs/https://jumpjack.github.io/oricutronJS/space1999-en.dsk 

fails (but error is shown only in browser console, not in emulator console, where only the same messages of a valid download appear: "MFM DISK" and "STATUS 200").

Probably an alternative mode to use remote files in the emulator would be retrieving them from the web page and storing them into /readwritefs/ session storage key.... but I have no idea of how to do it. :-)

As a side note, probably this couple of lines should be moved before the "downloading file" message.

hialmar commented 1 year ago

Good idea. I'll try to do this ASAP. I need to merge changes from the main branch as well.

jumpjack commented 1 year ago

In the meantime I found a method to load local files from user's PC:

https://jumpjack.github.io/oricutronJS/

I see there are two DBs, "/readwritefs" and "emscripten_filesystem", but the second one is apparently never used by the emulator, so I just ignore it.

hialmar commented 1 year ago

It doesn't work on Chrome on a Mac. What browser did you test it on ?

hialmar commented 1 year ago

We can talk about this here: https://forum.defence-force.org/viewtopic.php?p=27823#p27823 In order not to pollute all contributors mail boxes.