jjuran / metamage_1

Metamage open source, general repository, iteration 1
302 stars 27 forks source link

Running apps from disk images #15

Closed webspacecreations closed 1 year ago

webspacecreations commented 3 years ago

This is a very interesting project. Following the instructions here (https://www.v68k.org/advanced-mac-substitute/howto/) I got AMS compiled and installed (Raspberry Pi 4 / Raspbian). Tests work fine. Attempted to try the Lode Runner example, but at the AMS_DISK=Lode_Runner.dsk AMS_APPNAME="Lode Runner" make ams-osx step I get "no rule to make target amx-osx." No surprise there, I built for x11. However, when I try AMS_DISK=Lode_Runner.dsk AMS_APPNAME="Lode Runner" make ams-osx I get "make: *** No rule to make target 'ams-x11'. Stop."

One possibility is that I'm executing this from the wrong directory (since I had to adjust the mv path). To rule this out, would you mind sharing the absolute path you are in when executing the mv and subsequent AMS_DISK= directive?

I assume that the example with Lode Runner is extracting the 68K binary from the disk image? Is it is simply grabbing a single executable file from the disk or something more extensive (like merging the resource fork and/or supplemental files)? IOW, could the same be accomplished by mounting the disk image and copying the file to Linux?

jjuran commented 3 years ago

All of the make commands listed in the HOWTO are meant to be run from the top level of the metamage_1 repository. Furthermore, it's assumed that all involved repositories (including ams-68k-bin) share the same parent directory. metamage_1 should have symlinks to the others in var/links.

Disk images should go in ../ams-68k-bin/mnt along with the applications. That's the only directory (by default) that emulated code has access to. Advanced Mac Substitute's reimplementation of the File Manager reads the entire 400K disk image (via a file server running natively) and interprets the MFS data structures on its own. AMS also supports MacBinary archives (including the non-standard MacBinary+ extension for directory trees) as well as the two-file data/rsrc approach.

If it's still not working for you, please post the exact command-line. You posted a command of make ams-osx but an error of ams-x11.

(Once it's working, add AMS_GNETICKS=0 to eliminate delays due to idle CPU conservation, and AMS_APPFS=- to enable persistent high scores.)

webspacecreations commented 3 years ago

Thanks, I understand better now that I know how the paths are related. HOWTO.md hints at some pretty cool stuff, but is very terse. For example (on Linux) what is the extensive use of project names for substitution into ./build.pl used for? Are they simply used to build AMS or do they have stand-alone use outside AMS? There are an awful lot of options in the catalog.

Awesome project!

jjuran commented 3 years ago

Thanks! So, metamage_1 is a monolithic repository where most of my public source code lives (with freemount being the big outlier) — so there's plenty of code that's entirely unrelated. Everything that the make recipe builds is relevant one way or another.

As you may have noticed by viewing a process monitor, Advanced Mac Substitute is implemented as a collection of cooperating programs, with varying degrees of utility for other purposes. For example, graft is a general tool for launching one or more servers and a client connected to them, freemountd is a file server (speaking the Freemount protocol), xv68k can run non-Mac, 68K-compiled command-line programs (e.g. unit tests), and though ams.vx is obviously AMS-specific, vx itself is an interpreter for the general-purpose Varyx programming language.

In addition, while sndtrack is purpose-built as a classic Mac audio synthesizer, you can drive it without 68K emulation — see v/bin/snd*.vx and v/music/.

As for Linux-specific tools, kdmode runs as a coprocess that switches the console to graphics mode and back after its client terminates (even if it crashes), whereas reader opens a file for reading and passes the file descriptor to its parent over a control socket — minimizing the attack surface when opening privileged files (such as those in /dev/input/, in some older Linux versions).

I hope that helps. :-)