Previous Post

Project: mojozork-libretro

Next Post
Project: mojozork-libretro
1 / 2
DESCRIPTION

I know, what the heck, he's still talking about Zork?!

I started setting up a computer just to be my, uh, emulation station. Just a small Shuttle PC that was laying around that's got beefier hardware than you could expect from a Raspberry Pi, where all the usual RetroPie setups live, so I could continue my unspoken goal of just having one machine that plays every game I ever loved. As one does, you know.

Since I was moving to a desktop computer plugged into a TV, instead of a Pi3 wired into playing card packaging, I went with stock RetroArch instead of an Intel RetroPie install. And while sometimes you still need to launch some things outside of that umbrella, it's extremely desirable to be able to run everything you can as a "libretro core" so everything is unified, and you know it'll work with the controller you've already got in your hand.

A libretro core is simply a shared library that RetroArch (as a frontend) loads and then calls standard functions in repeatedly. The core provides something worth interacting with--usually an emulator, so you have NES cores and PlayStation cores and so forth, but it can be other things as well. There are game engines ported so you can have a Doom core or perhaps you have a media player that does some sweet visualization that lives in its own core. More or less, we're just talking about a portable structure for making everything run with a consistent interface across (many, many) platforms.

And there are a lot of cores! All sorts of emulators and engines...everything you might want to play from the birth of the video games to the Nintendo 3DS, but there is a big hole in the collection where years of my childhood should be: interactive fiction.

So I took MojoZork and turned it into a libretro core! Now you can play Infocom games from the comfort of your couch.

Your couch?! Yep, it'll accept keyboard input if you want to type (in what RetroArch calls "focus mode" to turn off your hotkeys), but if the core sees input from a game controller, it'll pop up a little virtual keyboard, and assigns some shortcuts to various controller buttons (space, backspace, enter).

I've also added scrollback support so you can look back at text that rolled off the screen and, of course, libretro serialization, so you can rewind your game if you find yourself suddenly eaten by a grue.

This isn't a perfect Z-Machine emulator, to be clear: MojoZork only handles up to version 3 games...this is the vast majority of Infocom's catalog, but it doesn't cover their final games: notably, the graphical ones like Shogun. More notably, it doesn't handle modern Interactive Fiction produced by tools like Inform. But it's a start! We could take the lessons learned here and apply them to something like Frotz, or improve MojoZork itself.

But mostly I did this to learn something new--how to build a libretro core--and now I might use that knowledge to build other interesting things.

Want to try it? Install RetroArch (which is what already powers RetroPie, Pi users!), grab the source code, cmake and make, and then launch it with:

retroarch -L ./mojozork-libretro.so zork1.dat

Oh, and...one more thing.

The first half of the Epic Megagrant showed up in my bank account while I was typing this post! So expect there to be a lot of GPU talk ahead! TTYS!!

Ryan C. Gordon PATREON 3 favs
VIEWS1
FILES2 files
POSTEDApr 8, 2022
ARCHIVEDApr 8, 2022