mihaip / infinite-mac

A classic Mac loaded with everything you'd want
https://infinitemac.org
Apache License 2.0
1.12k stars 67 forks source link

Switch builtin CD-ROM library to macintoshgarden to avoid bug w/ slow image downloads #264

Closed spudpiggy closed 6 months ago

spudpiggy commented 7 months ago

TL;DR The emulator can error and cause issues if disc images download too slowly. Since archive.org has bad servers, images from that site are more likely to cause this. Switch to macintoshgarden instead for the CD-ROMs section's built in library, as it has pretty good servers.

While I agree that archive.org is a really useful site, I think that disc images should be sourced from other places in this instance.

It seems common for the emulator to crash when disc images are too slow to download. It's literally random whether or not it'll work for me, but trying multiple times usually makes it work. I make this assumption mostly because archive.org's download servers are, for the most part, awful.

It's also seemingly random whether or not you'll get good download speeds or if you're about to play Dial-Up Simulator 2023. Before anyone says my net just sucks: i mean, probably, (i'm in the UK, and Virgin Media is my ISP) but I don't have this specific issue with most other sites. I've heard at least one other person mention it too, archive.org's servers just really suck.

Just checked, and macintoshgarden's .se mirror is really fast for me (like, 10MB/s), so I'd like if the CD-ROMs section starts to get moved over to images from that site, so I won't have to refresh like 3 or 4 times every time I wanna play a game from that section. (I mess with this at school sometimes to play with Kai's Power Goo, plus it's just more convenient to have a bunch of software set up for me to play with.)

mihaip commented 7 months ago

Most of Macintosh Garden's disk images are compressed (as .sit or .zip), which doesn't work with Infinite Mac (it needs raw .isos). That being said, if you find an uncompressed disk image you can try it today - use the "Load from URL" option. If you can find equivalents to ones that I've already loaded, leave a comment here and I can switch them over.

spudpiggy commented 7 months ago

Most of Macintosh Garden's disk images are compressed (as .sit or .zip), which doesn't work with Infinite Mac (it needs raw .isos). That being said, if you find an uncompressed disk image you can try it today - use the "Load from URL" option. If you can find equivalents to ones that I've already loaded, leave a comment here and I can switch them over.

I did notice that when i was looking for Kai's Power Goo on there: none of the downloads are the raw, English image. The closest it has is an iso of the German version. Here's a hybrid CD of the English version, but it's from archive.org. Have confirmed, it works on infinitemac under both os 8 and 9, since it has a 68k and a ppc version. I'm not an old mac enthusiast, so idk where you'd find raw images that isn't archive.org, maybe you/someone else knows?

You could try these, though:

that-ben commented 7 months ago

Here's a much faster way to use disk images: Download the disk images to your device and when you want to use one, then drag it onto the emulator canvas which will instantly mount it. This will load MUCH faster than any internet mirror you could ever find :)

spudpiggy commented 6 months ago

Here's a much faster way to use disk images: Download the disk images to your device and when you want to use one, then drag it onto the emulator canvas which will instantly mount it. This will load MUCH faster than any internet mirror you could ever find :)

A quick download without having to dissect the jsons would be helpful for people on slow enough connections that they can't consistently stream files this way, or also people who want to install stuff in other emulators. i still think a buffer should be implemented, because it's a good compromise between streaming and downloading

that-ben commented 6 months ago

I didn't understand the buffer explanation yesterday and today, after reading it again, I still don't understand what you mean by "Add a buffer so that the image isn't mounted until X amount of it has downloaded - lowers the chances of running out of image"

mihaip commented 6 months ago

I think the assumption is that this is a video streaming-like setup, where the CD-ROM image is streamed from beginning to end, and as long there's a big enough buffer, the emulator reading will never need to wait for additional data to be downloaded.

However, CDs are not read sequentially like that, the emulator will jump around depending on which files are requested and how they're laid out on disk. Infinite Mac loads disks in 256K chunks, thus small files next to each other should end up in the same chunk. It also has some basic prefetching, where it will also load the adjacent chunk when one is requested: https://github.com/mihaip/infinite-mac/blob/021d8c46c83d027d78096f676472c0b95ddad570/src/emulator/emulator-service-worker.ts#L110-L120

There's probably more improvements that could be done here, but it's not as easy as increasing the buffer size.

that-ben commented 6 months ago

Nowhere in the whole thread was FMV games mentioned, but I now understand what spudpiggy meant. The truth is there will never be a faster disk image source than just downloading it to your device and dragging it to the emulator to mount it locally. This way, you'll never run out of buffer. Anything else is asynchronous and susceptible to running out of buffer randomly for all sorts of reasons that are almost all out of your or the emulator's control.

Plus, streaming the same disk images multiple times is contributing to making ARCHIVE.ORG and other sites slow, because you're downloading over and over again the same DATA. Storing it on your device is really the way to go to solve the out of buffer issue (e.g. video stuttering), the random error 500 crashes due to ARCHIVE.ORG being on its knees constantly nowadays due to hundreds of thousands of users streaming ISO and other files from its site AND it will load instantly too! So you'll have a much more enjoyable experience.

ghost commented 6 months ago

Maybe there should be a toggle under "advanced" or something that would allow you to specify if you want to load the entire disk into RAM or stream it.

that-ben commented 6 months ago

I wonder how such a feature would mitigate the type 500 errors though.

mihaip commented 6 months ago

Given that I implemented support for using a local file as a disk in a custom instance (#265), I don't think it's worth adding that "advanced" option - you can download the disk image (taking as many attempts as needed) and then give it to the emulator as a local file.

I would prefer Infinite Mac to remain relatively easy to use, without too many advanced features that would confuse users that don't need them.