PlaidCTF 2020: Making the Watness 2
For PlaidCTF this year, I created a demake of The Witness in Hypercard. Since most of the technology I used is over 20 years old, and a lot of the documentation seems lost to time, I created a short video that discusses how I made it, and what resources I used in order to make it happen.
All of my code can be found on Github.
Nearly all of the development of The Watness was done inside of OS 9. Here are the tools I used for that
- SheepShaver: SheepShaver is a PowerPC emulator designed specifically for running classic versions of Macintosh OS.
Macintosh OS 9: Although Myst was likely developed on System 6/7, I went ahead and used OS 9 because it was easier. Nearly everything that I’ve used here will work on System 7 if you choose, but you may need older versions of them.
- Hypercard 2.4: Hypercard is the tool that The Watness is built in. You will need a copy of Hypercard to both play and edit any files associated with the game.
- QuickTime 4: Hypercard comes with QuickTime 3, but I was unable to get it to display JPEGs without crashing. Upgrading to QuickTime 4 solved this problem.
- Macintosh Programmer’s Workstation: MPW is an IDE (ish) for writing native code in OS 9. I used the Gold Master edition, but any “recent” version should work. If you install GM, however, you will also need to separately install Apple Pascal.
- ResEdit: ResEdit allows you to view the resource forks of files. This isn’t needed to make the challenge, but is helpful in understanding how it all works.
- Stuffit Deluxe: Stuffit is a suite of compression/archival utilities for Macintosh systems that properly handles binary data and resource forks.
In addition to the OS 9 utilities, I also used typescript for all of my offline scripts.
The vast majority of my time was spent trying to piece together an understsanding of how everything works from the limited documentation I could find. Here is a list of what I used, annotated with what I took away from it.
- XCMD Cookboox: This is an interesting introduction to how XCMDs work. It has a lot of useful information, but do not use any of the code. I got sucked down a rabbit hole of trying to make this code work, only to find out many hours later that the framework referenced therein had been since superceded by a built-in library called
- All MPW Pascal Interfaces: I stumbled across this while trying to make the previous code work. It contains the only documentation I could find of the
HyperXCMDlibrary. There are a few things to note,
- If you’re using the
HyperXCMDlibrary, you will almost certainly also want the
Typeslibrary. A lot of the code I saw used
MemTypesinstead, but I did not have this installed.
Typeshowever contained all of the structures that I actually needed.
EvalExpris not eval in the modern sense of the term. Instead, it parses the input as though it were a
Hypertalkstatement, but does not run it. To execute the resulting
- There are 3 types of strings referenced.
Zero, and (sometimes)
handleis a Hypertalk string, and a
Pasis a pascal style string.
Zerotook me some time to figure out, but it’s a C-style string (null or “zero” terminated).
- If you’re using the
- Hypertalk Script Language Guide: An excerpt from an early book on programming for Hypertalk.
- The Apple Pascal Docs: A somewhat helpful guide to writing Apple Pascal. It was missing a lot of useful information, but it gave me enough so that I could piece the rest together.
- The HCSC Color Tools Guide: A hypercard stack that goes into minimal detail about how to use Color Tools.
This project was a lot of fun, and taught me more than I ever expected to know about developing for classic Macs. If you have any questions about the project, or need help with your own, please feel free to reach me by Twitter (@zwad3) or by email ([email protected]).