I've gone down a deep rabbit hole working on a strange new project: a standalone After Dark module player for modern macOS. No OS emulation or ROM required -- just the original classic Mac OS AD module files! I can't believe this is working!

Hi there @csilverman @root42 👋

In brief, the approach is:
1. Load the code and resources from the original module
2. Execute the original 68k module code using https://github.com/kstenerud/Musashi (Thank you kstenerud!)
3. Add handling for unhandled traps to draw to a Metal view, reimplementing the behaviors of QuickDraw one at a time (setting pixels, drawing rects, sprites, etc)

Huge thanks to the M.A.C.E project for demonstrating this approach might be viable.

GitHub - kstenerud/Musashi: Motorola 680x0 emulator written in C

Motorola 680x0 emulator written in C. Contribute to kstenerud/Musashi development by creating an account on GitHub.

GitHub

@halcyon @csilverman @root42 Impressed, grateful, etc!!

The ultimate test case: Star Trek screensavers

@whophd @halcyon @csilverman @root42

I found this in my house last week.

@jcdvore @whophd @halcyon @csilverman @root42 I have bad news for you: After Dark's Star Trek screensavers are terrible. Awful across the board with like one mediocre exception.

@gparker Some (ok many) of the TNG modules had a whiff of shark-jumping to them, but I'm still proud of working on it. Granted, I wasn't responsible for design, I was responsible for getting the art to fit on (IIRC) two floppies. And writing many of the trivia module's incorrect answers.

@jcdvore @whophd @halcyon @csilverman @root42

@eedly @gparker @jcdvore @halcyon @csilverman @root42 yeah I never got to try the TNG ones, but it was the TOS ones that live in my brain because our high school computing studies teacher had the “Mission Control” one running whenever he spoke long enough to forget to prevent it starting

“Scotty … give me that POWER!”

Its ultimate goal (I felt) was to be a low-CPU simulation of a TV episode generator.

@whophd The coolest part of the TNG screensaver is that it used digital assets from the actual show. Many of the LCARS displays on the show were computer monitors stuck behind smoked glass, running Macromind Director animations. When we did the screen saver, Paramount provided us with a ton of Mike Okuda's Director files, and even a few 3D models. Anything in the screen saver that had LCARS displays in it were processed from those original animations.

@gparker @jcdvore @halcyon @csilverman @root42

@eedly @whophd @jcdvore @halcyon @csilverman @root42 Neat. The artwork and animation for After Dark TNG was very good, nice work getting it all to fit on those disks!

@halcyon @root42 That's fascinating. Hadn't occurred to me that you could trace the operation of a classic Mac OS app by watching what illegal instructions it calls, but based on my admittedly slim understanding of how the APIs behind 68K Mac OS worked, it makes a lot of sense. Thank you.

Very much looking forward to seeing this in the world. I've been missing After Dark for nearly 20 years at this point.

@csilverman @root42 @halcyon Every now and then, I reinstall Win3.1 on DosBox, install After Dark, and play a few rounds of Lunatic Fringe.

@csilverman @halcyon @root42 This was the strategy used to get existing apps to work for the public demos of Copland DR0. Bug fixing the OS one broken API call at a time or having Gestalt lie to the app about what was available. “Edition Manager? What’s that?”

I’ve forgotten the full list of apps I got working, but I remember specifically doing Photoshop and Marathon, the latter resulting in one of the worst KON & BAL’s Puzzle Pages ever published.

@halcyon @csilverman @root42 Nice. I have a similar strategy running as an unpublished side project that I have poked at occasionally for many years. (No Metal, it's OpenGL, that's how old it is!)

Be warned that you'll need increasing amounts of classic Mac OS re-implementation as you add more modules.

You may find the open-sourced code of ARDI Executor useful as a reference for what one reverse-engineer determined that Mac OS did: https://github.com/ctm/executor

@gparker @csilverman @root42 Thanks for the reference. I'll check it out. I've definitely bumped into an order of magnitude more complexity as I try to run AD 3.0+ modules, which depend on a shared resource library. Hopefully this is surmountable.

@halcyon @csilverman @root42 iirc AD 3.0 also introduced their full-blown custom dynamic shared library linker/loader. I made a little progress deciphering it before giving up and just running the After Dark INIT inside the simulated system. After Dark 2.0 and More After Dark are definitely the sweet spot, more fun and more results for less effort.

Oh hey, here's a screenshot from 2017. I never polished the interface as well as yours…

@gparker @csilverman @root42 Wow, you went down this road long before me! I’m also at the point of trying to decipher the 3.0 library behavior. Not a lot of progress yet. I agree, the 2.0 and MAD modules have had the best effort/reward ratio.

Still, hoping I can somehow get over the 3.0 module blocker. So many great modules would be unlocked.

@gparker @halcyon @root42 you probably already know this, but speaking of source code, System 7.1 leaked a while back: https://github.com/elliotnunn/supermario/tree/9dd3c4bef84df2ea30f5ec2c5e97b043e8267b3f

Might be useful as far as seeing how the underlying Toolbox stuff actually worked. They did a thorough job of commenting it.

GitHub - elliotnunn/supermario at 9dd3c4bef84df2ea30f5ec2c5e97b043e8267b3f

Contribute to elliotnunn/supermario development by creating an account on GitHub.

GitHub

@halcyon This is amazing. I'm curious, how hard was it to reverse-engineer these? I dimly remember that the After Dark manual included technical docs on writing screensavers—an unusually thorough inclusion that I didn't appreciate until years later—but generally, nuts-and-bolts info about the internals of After Dark seems pretty hard to find these days.

Any plans to release it at some point?

@csilverman @halcyon tangent: This reminds me of the time I accidentally wandered into the wrong conference room in WWDC 2002 and it was a circle of younger-than-usual developers listening to the secrets of crafting new iTunes Visualizers
@csilverman @halcyon FWIW: I have a cross-platform Konfabulator widget from 2005 that I need to resurrect
@Videoalex @csilverman @halcyon Well it was potentially life-saving, which is how it got world famous 🤷‍♂️
@halcyon Okay this is amazing. Think this could be ported to ie. Linux? I need some After Dark in my life I feel.
@zerodogg The Musashi processor emulation engine is portable, so I think the same approach could work, but it's unlikely my project would be easily adapted to Linux. If you're up for running a full classic Mac OS VM, check out Basilisk II, Mini vMac, or SheepShaver in meantime! They will all run happily on Linux.
@halcyon any details? Sounds very interesting.
@halcyon OMG I need Satori
@oscillik I, too, need Satori.

@halcyon

Oh my. Does it have an embedded M68k emulator or did After Dark have some sort of VM (there was a Windows screensaver package that ran screensavers on SCI, Sierra’s adventure game VM).

@halcyon @Gte omg this is taking me right back in time
@halcyon Thought those were so cool in the 90s, even though I couldn't afford a mac

@halcyon

Oh, wow. I'm pretty sure I still have the After Dark CD, and the second After Dark CD, from all those decades ago.

I could have flying toasters again...

@halcyon Dare I dream of playing Lunatic Fringe again?
@FormerlyStC That's an endgame goal, for sure! That was a favorite of mine.
@halcyon Back around ’93, I replaced all of Lunatic Fringe’s sound resources with ResEdit on my IIsi. I think I still have a copy. That would be a trip.
i was just thinking of how funny it was to replace the sounds and sprites w/ ResEdit
@halcyon @Gte As the former Screen Saver beat editor at MacUser magazine, I approve this entire project. Gold stars all around!!
@jsnell Wow, hey Jason! I didn't know there was such a thing as a Screen Saver beat editor. I'd love to see a contemporaneous take on After Dark software as it was released -- will need to dig up some MacUser PDFs from archive.org!
@halcyon Wow, awesome! Think it’s possible to actually run them as macOS screensavers? Next level would be to integrate with the animated lock screen and desktop to use a static image from AD as your background.
@deviantintegral I was curious about that, but my cursory investigation into the current state of macOS screensavers is that it's a world of pain and breaking changes with every macOS release. Also raises questions about how one would distribute modules without running afoul of the copyright holder -- maybe a just a packaging tool? Too much to take on for now, but I might revisit after I get more modules working.
@halcyon
Annnnnddd…. take my money!
@halcyon extra credit assignment, can you implement the settings as a tear-off palette?
@metaning Is your thought to function similar to demo mode in the original software? I currently have a full screen toggle and was considering having a floating palette there (maybe with toggle-able visibility?). Sometimes I want to fiddle with sliders, sometime enjoy the full screen scene without UI.
@halcyon Apologies, it's something I ask when I see people post interesting apps, that exist as single windows; effectively iPad screens. Very few modern macOS developers seem to know how to, or care to consider, implementing settings / inspectors as a tear-off palette (the way all apps, including iWork used to be). For example, if you wanted to move the settings to a different screen, to maximise the main window space on a primary monitor, while not in full-screen mode.
@halcyon Aaaand now I DESPERATELY want to go hunt through the junk room in case I still have the CD for AFTER DARK: TOTALLY TWISTED so I can have the Lawnmower Kittens screensaver again!
@cstross @halcyon on the other hand… no love for Bad Dog?
@halcyon If you’re working on a downloadable app, could you add me to your release announcement list? If not, do you have a public repo?
Hey @Eric_Neue I plan to make the GitHub repo public with release builds when I’m a bit further along. I’ll be sure to post here when that happens!
@halcyon @kieran Ok, there is a level of need right now...
@halcyon Now I’m trying to remember why, circa 1998, i wrote a super basic screensaver for my Mac Classic II. Did macOS not have password protection at that point? I was in a dorm and may have wanted to keep my roommates from messing with my computer.
@MacBalance I think that was the case without third party software, yeah.