mattgodbolt / Miracle

JavaScript Sega Master System Emulator
http://xania.org/miracle/miracle.html
GNU General Public License v3.0
117 stars 30 forks source link

loading rom from url #6

Open ghost opened 7 years ago

ghost commented 7 years ago

how can we load a rom from url? for example, if we have a compiled homebrew rom host somewhere in webhost services like altervista, how can we add its url in the whole emulator url, just like we do from emulators like webmsx? ( like http://webmsx.org/?ROM=http://nitrofurano.altervista.org/retrocoding/msx/roms/cmjn.rom )

mattgodbolt commented 7 years ago

Great idea; and easy but only if the endpoint supports CORS - which many places do. Taking a look at the ROM link you suggested:

Server: Apache
ETag: "c442b9-4000-55c3a8291b900"
Accept-Ranges: bytes
Keep-Alive: timeout=1, max=100
Content-Length: 16384
Content-Type: text/plain
Last-Modified: Mon, 23 Oct 2017 17:54:12 GMT
Connection: keep-alive

There are no CORS headers so there's no way to get Javascript alone to fetch the ROM (JS has security features to prevent you fetching and using data from other servers without their permission). I can only imagine webmsx is bouncing through a server to do this work for it, which is beyond the scope of what Miracle can do.