Running classic Mac OS in a browser with minivmac-em
I’ve been working on getting some games for classic Mac OS ready for release. These games require an older Mac or, more likely, an emulator like Mini vMac or PCE/macplus to run. The games will be available for download, but I’d also like to make them available to play directly in a web browser.
A while back I learned that the Internet Archive uses Emularity for their in-browser emulation, thanks to Sonneveld using it for Donkey Island. Emularity includes option to run both Mini vMac and PCE/macplus in-browser. That gave me two great options to explore.
Emularity with PCE/macplus did not work well enough in my testing. Audio support was unreliable, and it would often make an unpleasant pop sound before playback. The speed was also inconsistent—my games ran at a reasonable speed in Safari, but they were much too fast in Chrome. PCE has a lot of options I couldn’t find any documentation for, so it’s possible there’s some way to resolve these problems. (I couldn’t get it to load any of my
.dsk images either, but at least that’s a problem I can work around.)
Emularity with Mini vMac works great without any adjustments. Mini vMac is the same emulator I normally use for classic Mac OS, so this wasn’t a surprise, but it’s impressive that it runs just as well in a browser.
The one issue I have with Mini vMac is that the default 8× speed is too fast. Most animation plays faster than intended, and buttons that are held down will fire more quickly than they should. Unfortunately most of Mini vMac’s configuration options are baked in at compile time, so the only way to adjust the speed is to compile yksoft1’s minivmac-em myself.
I spent the better part of a week trying to do this. I was not successful.
Initially I tried to compile it directly on my Mac running macOS 14. I quickly ran into issues because it uses emscripten which does not have arm64 builds for older versions. I tried using the latest version of emscripten, but the project makes some calls to
emscripten_sleep_with_yield() that are no longer supported, and my attempts to update the code were ultimately unsuccessful. (I got it to build, but the builds did not run correctly.)
My next attempt was to install Ubuntu in UTM (a nice Mac GUI for QEMU). I tried a few versions before settling on Ubuntu 18.04.06, 64-bit, using the minimal installation option. Here are the steps I followed:
sudo apt update sudo apt upgrade sudo apt install build-essential sudo apt install git mkdir emu cd emu git clone https://github.com/emscripten-core/emsdk.git cd emsdk git checkout tags/1.38.48 ./emsdk install 1.38.48 ./emsdk activate 1.38.48 source ./emsdk_env.sh cd ../ git clone https://github.com/yksoft1/minivmac-em.git cd minivmac-em/ make -f Makefile-em html
This uses emscripten 1.38.48. The minivmac-em project includes some references to 1.38.12, so I assume that’s the version it was originally compiled with, but presumably 1.38.48 shouldn’t have any changes that would break things.
I still got errors using the process above. However if I switched to leonier’s fork of minivmac-em I was able to build it without errors using the same process. It would not run successfully though—it gave me an error that the disk could not be found. The error was displayed using the Mini vMac UI, which was promising, but I couldn’t find a solution.
So unfortunately, for now at least, I’ve given up. I’ve added a message below the emulator that says “Before opening the game, hold the control key on your keyboard, press S, then 1. You should see ‘Speed: 2x’ at the top of the screen.” I’m not happy with this solution, but it seems to be the best I can do right now.
I love when I declare that I’ve given up on something, and hours later it’s working perfectly. The incredibly generous mausimus took a look at the problem and discovered that the main issue was just an incorrect path to the ROM file. This can be worked around by editing
cfg/CNFGRAPI.h and setting the
RomFileName to something like
I’m now working on a Mac with an Intel processor and macOS 12. (This is much faster than running Ubuntu in an emulator, I’m not sure why I didn’t try this earlier.) I was finally able to successfully build a working version by following these steps:
mkdir emu cd emu git clone https://github.com/emscripten-core/emsdk.git cd emsdk git checkout tags/1.38.48 ./emsdk install 1.38.48 ./emsdk activate 1.38.48 source ./emsdk_env.sh cd ../ git clone https://github.com/yksoft1/minivmac-em.git cd minivmac-em/ # Update Makefile-em, change line 30: # TheDefaultOutput : $(TARGET) # Update cfg/CNFGRAPI.h: # #define RomFileName “/emulator/roms/vMac.ROM” # #define WantInitSpeedValue 1 make -f Makefile-em html
This is essentially the same process as above, with the added step of modifying
P.S. Please make sure to check out mausimus’s games and other projects! Enclosure 3-D is an excellent update to a great adventure game, and I’m very excited for the upcoming Escape From Castle Matsumoto.
Link to this entry: https://mikepiontek.com/go/9287