Closed that-ben closed 1 year ago
Yes, it should be possible.
If you're thinking of doing this for the Macintosh Repository, it would be nice if you added CORS headers to the disk image serving. That way they can be requested directly by the client, instead of needing to be proxied by the Infinite Mac server (which would add latency and cost).
Hi again! Thanks for replying.
At the moment, what I'm doing is I pass the disk2 filename to chunk.js which I preprocess with PHP to inject the disk image path and filesize to Infinite Mac, like that:
<script src="static/js/main.5be7ee6d.chunk.js.php?disk2=simcity2000.dsk"></script>
Then in main.5be7ee6d.chunk.js.php I check if GET[disk2] is defined and if it is, then I replace the Infinite Mac disk image (and its filesize) by the disk image path supplied by GET[disk2]. Then, I have some HTACCESS rules to go look in the appropriate disk images folder and to remove the ".chunk" suffix that's added by Infinite Mac at the end of the disk image filename.
BUT, I was wondering if there was a simpler way of telling Infinite Mac to start with a given disk image URL instead of hacking the chunk.js file? :P
Re: CORS I already have it set up like this in the HTACCESS:
# [!] Cross-Origin-Embedder-Policy "require-corp" is MANDATORY for SheepShaver.js SharedArrayBuffer
Header set Cross-Origin-Embedder-Policy "require-corp"
# [!] Cross-Origin-Opener-Policy "same-origin" works when viewing from: https://emulate-sheepshaverjs.macintoshrepository.org
Header set Cross-Origin-Opener-Policy "same-origin"
Header set Cross-Origin-Resource-Policy "same-site"
I'll look into this as part of the CD-ROM support (#166), since it's a related concept (CD-ROMs are also fetched directly from other sites).
@that-ben this is now implemented, e.g. something like https://infinitemac.org/1996/System%207.5.3?cdroms=true&cdrom_url=https%3A%2F%2Farchive.org%2Fdownload%2FPuppet_Motel_Laurie_Anderson_Voyager_CDRM1296500_1995%2FPuppet%2520Motel%2520-%2520Laurie%2520Anderson%2520%2528Voyager%2529%2528CDRM1296500%2529%25281995%2529.iso will now work to load an arbitrary .iso hosted by the Internet Archive.
For now only archive.org URLs are supported (so that this doesn't become an arbitrary proxy), but happy to add other servers as needed. Only thing that's required is that the server has to support HTTP range requests (so that Infinite Mac can request one chunk at a time, instead of needing to wait for the entire thing to load). This also means that .iso's can't be compressed (since the whole file would need to be decompressed first).
@mihaip That is incredible news! Oh yeah, so basically, using HTTP range requests, IM can calculate like (512 * chunk_number) so for chunk 123 it would request from byte 62976 to 63488? What an incredible time to be alive, really. If I wasn't sick as a dog today, I'd try it out on MR, but probably tomorrow I'll feel better and will try this out.
Would there be anything to fix/add to the code to support MR as a cdrom_url server? And could I feed it a relative path?
And would dd floppy disk images still be supported even though you named the variable cdrom_url?
And if I send you a third donation, would I now be entitled to appear in the donators list?
As usual, what a true legend you are coding all of this. It's INCREDIBLY GOOD. Keep it up!
Re-opening this because it also came up in the context of #193 (to be able to specify custom/additional disk images).
If it helps testing anything, here's a 20MB Mac IIfx image with System 7.5.3 and a single game demo. https://img.classicmacdemos.com/test-68k.img
Enjoy!
@that-ben @jcgraybill: OK, an early version of this is deployed. Ideally I'd like to have a UI to support creating custom configs, but in the meantime you can create URLs of the form https://infinitemac.org/run?machine=...&disk=...&cdrom=...
. disk
and cdrom
can be omitted entirely, or repeated more than once.
Here's an example to boot a random archive.org image (Slovenian System 7.5):
You can also add infinite_hd=true
to still load that disk:
And you can specify a disk
parameter to use a built-in disk image:
This function lists all of the parameters that are supported. See disks.ts and machines.ts for the possible machine and disk names.
@that-ben also added macintoshrepository.org to the list of supported domains
@jcgraybill didn't see your comment until now -- that image appears to work: https://infinitemac.org/run?machine=Mac%20IIfx&cdrom=https%3A%2F%2Fimg.classicmacdemos.com%2Ftest-68k.img
That's SLICK! With an optimized disk image, the emulator and game launch so fast.
@mihaip:
disk
andcdrom
can be omitted entirely, or repeated more than once.
According to the code in This function it looks like it's mean to be like disk= disk= disk= which is kind of invalid, at least some web programming languages do not support multiple GET parameters of the same name out of the box, unless they're an array, e.g. disk[]= disk[]= disk[]=
also added macintoshrepository.org to the list of supported domains
Thanks! Just tried it and it works :smiley:
Here's a whopping 2GB bootable environment, FILLED to the brim with Kaleidoscope schemes. You can instantly revisit the past, just by double clicking ANY OF THE 4000 SCHEMES! XD
About the third donation, nevermind the message from last month! I just pushed a third a donation to you to support this FABULOUS project, once again! I don't mind remaining invisible, it's OK, as long as you get the dollars and continue this godly work!
Added a UI for building custom configurations more easily:
https://github.com/mihaip/infinite-mac/assets/513813/af98bff0-a49e-44e9-a28d-1987e6dd0487
Declaring this done.
Wow that's pretty nice and seems quite useful! Thanks for doing this.
This is more of a question than an issue but is there a way in Infinite Mac to arbitrarily, via Javascript or other means, to attach a given disk image using an URL before the emulator starts? The goal is to be able to supply a disk image filename from the URL and Infinite Mac launches with that disk image attached already.
...Perhaps via the JS object:
this["webpackJsonpinfinite-mac"][...]
...Or by injecting a line in the HTML page?
Thanks :D