Boxer

Developer diary: plans and progress reports.

Rumors of my death etc. Saturday 26th October 2013

Hello boys and girls! Let’s start with the pressing stuff:

Go ahead and upgrade to Mavericks already

Boxer works just fine in the newly-released OS X 10.9 Mavericks, with the sole exception that you'll need to give Boxer permission to capture hotkeys again so that Ctrl+arrowkeys won't switch spaces while you're playing.

Boxer’s issue tracker has an illustrated walkthrough of how to do this but the short version is that you'll need to go into “Security & Privacy” in System Preferences, tick a box in the Privacy tab to give Boxer permission to do naughty accessibility things, and then restart Boxer. After that, everything will work the same as it always has.

This also applies to any GOG.com game apps you have: those will be listed separately in the Security & Privacy pane, and must be given permission individually.

Unfortunately Boxer 1.3.2's UI and helpfile will still point you to the old System Preferences location to enable hotkey capturing, which no longer has the relevant option. Those instructions will be corrected in the next release of Boxer, which brings us to…

When the hell is the next version coming out?

The answer remains “when it’s done” followed by a frustrated and sympathetic smiley face. (“<:/”, possibly, though that looks more like an apprehensive gnome.)

Owing to mission creep Boxer 2.0 (née 1.4) turned into a balls-out rewrite of large sections of Boxer’s underlying architecture: a labour comparable to cleansing the Augean stables of 3 year’s worth of thickly encrusted cattle poo written in Objective-C. Boxer is a cleaner and less smelly codebase for it, with some powerful new systems for future growth, but there are still a number of new and existing features to be finished (which is to say “unbroken”) before it’s ready for release. More on these later.

Be that as it may, where the hell have you been?

The observant of you have noticed that I hadn’t posted since last December and there was a period of several months where Boxer’s repo lay suspiciously fallow. The truth is, I’ve been holed up in a Moroccan flophouse shaking off an opium addiction.

Alas nothing so romantic. I burned myself out on programming in general and Boxer in particular and spent my summer recuperating, catching up on Breaking Bad, and building Doom levels in some kind of subconscious effort to out-retro myself.

I’m back in action now though, and looking forward to getting the new release out the door. In my next post I’ll go over the major visible features that are coming in Boxer 2.0. With screenshots, that aren’t even of Gene Hackman.

Righting Write-Only Sunday 16th December 2012

One curious support issue that’s landed in my lap a few times is installation failure when importing old 3D Realms shareware titles: like Duke Nukem, Cosmo’s Cosmic Adventure, Secret Agent and the like.

The problem is that the zips available from the 3D Realms download page (which have found their way onto other download sites too) have corrupt file permissions. After extracting the zip using OS X’s built-in zip support, one or more of the game files may be marked as write-only. This prevents Boxer from accessing the contents of those files, making the game’s installer spit out spurious errors and fail abysmally.

The permissions on the affected files can be corrected from Finder’s Get Info panel:

  1. Select a file in Finder and press Cmd ⌘I to bring up the Get Info panel,
  2. Scroll down to Sharing & Permissions,
  3. Change “Write only (Drop Box)” to “Read & Write”.

Once you’ve ensured that all the files are readable, Boxer should import the game successfully.


The Unarchiver download

An easier fix though is to use The Unarchiver to extract the zips instead. <plug>This is a terrific (and free) drop-in replacement for OS X’s built-in zip support, seamlessly extending it to support RAR, 7zip, and other archive formats popular on abandonware sites. It works exactly like the built-in support, extracting in the background instead of making you plod through a worthless fucking UI.</plug> More to the point, The Unarchiver ignores file permissions when extracting, avoiding the write-only problem in the first place.

I’m not getting any kickbacks or sexual favours for this endorsement; The Unarchiver is just a great piece of software which I’ve been using for 5 years, and can recommend unreservedly to any Mac user.

PC LOAD LETTER Monday 12th November 2012

After several months of big noisy feature work I needed to blow off a little steam: so over the past few weekends I’ve been pottering away on a feature I knew would be of use to approximately 6 people. Can you guess what feature that could be? That’s right!

Boxer 1.4 emulates a 24-pin dot matrix parallel printer, compatible with the IBM PPDS and Epson ESC/P2 printer languages popular in the DOS heyday. This means any DOS app can print text; any DOS app with drivers for IBM ProPrinter or Epson LX/LQ-series printers (including Word, Works, WordPerfect and others) can print graphics too. Authentically shitty graphics, as you can see — just like the old days.

This emulation is built on the third-party printer emulation patch that’s been floating around for DOSBox: rewritten in Objective-C with Cocoa's native PDF support, and sprinkled with some UI magic to help the medicine go down. Boxer uses the standard OS X print panel, so you can print to a PDF file or straight to a real printer. Because Boxer generates actual PDF data, the PDFs you save are fully vectorised and have selectable text.

Impedance mismatch

One of the challenges of printer emulation is that the print workflow in DOS programs is quite different to how we roll these days. Printing in OS X is done in discrete print jobs representing a set of pages or an entire document. But DOS programs squirt text and graphics to the printer line-by-line: they have no notion of a print job, and there’s no formal indication of when they’re actually done printing. This means a human (you) has to decide when the printing is done — and that means you need to be able to see what the printer is doing.

So once the DOS program starts printing, Boxer brings up a live animated print preview showing you what’s coming out of the emulated printer. After the emulated printer has been idle for more than a couple of seconds, Boxer lets you print or discard the pages so far – or you can keep printing more pages to add to the print job. Once you’re ready, hit Print and Boxer will wrap it up as a print job and hand you over to the OS X print panel.

I’ll be honest: the print preview was the reason I implemented this whole feature, because it was a fun design challenge and a way to make printer emulation about me instead. I call this Design By Narcissism.

Positively agog Sunday 21st October 2012

So when I said back in July that I was taking a break because of real-life commitments, that was a teeny tiny fib. In fact I was beavering away undercover with the fine people at GOG.com to help them launch their DOS games catalogue on Mac.

On October 18th the fruits of our labours were finally revealed, and I can finally gush about what I’ve been working on all this time: Boxer standalone. This is a streamlined and state-of-the-art Boxer built for one purpose: releasing DOS games as individual apps. It's also a peek into Boxer’s future.

Why a separate version?

When we were figuring out how to deploy GOG.com's DOS games on the Mac, it became abundantly clear that Boxer in its current form wasn't gonna cut it. It sticks you with a folder full of sample games to help you figure out the emulator. Its gameboxes are document files that can’t be played without downloading a separate application. Its emulation is studded with peripheral features to help you install new games and configure them and add new drives to them and all that jazz. The entire app is designed around turning your box of old CDs into a games collection.

But GOG.com are selling games, not raw materials for someone else’s curated emulation experience. Their games already come ready to play, so they don't need any of the features to help you get there. Each game needs nothing but to look and feel like a native Mac game.

So I began macheteing off all the bits of Boxer that weren’t part of that experience. Sample games and game importing were the first to go; the preferences window, inspector panel and drag-drop drive addition all hit the cutting-room floor. The UI was tailored to clean away everything that smelled like emulator infrastructure instead of a native game.

Putting together a game app isn’t as easy as making a gamebox – there’s resources to bundle, app IDs to choose, help links to define, behaviour to tweak, branding to slap on – so I also developed a bundler utility that takes a gamebox and wraps it into an app according to your specifications. It’s not as slick as Boxer’s game importer and it’s not intended for end-users: you’ll need to build it and Boxer standalone from source yourself.


With Boxer’s dead weight liposuctioned away and gamebox-to-app conversion a reality, new challenges came to light. Ones that required exciting and shiny new features.

The launcher, rethought

Boxer’s program panel was designed for one task: choosing the right executable once and never touching it again.

But many of GOG.com’s games don’t have just one true executable: there may be a main game and expansion packs, there may be separate singleplayer and multiplayer options, there may be setup utilities and campaign editors. Boxer’s program panel was woefully inadequate for switching back and forth between different launch options.

Even worse, the program panel insisted on appearing alongside the wretched old DOS prompt, and it wouldn’t even appear at all in fullscreen mode. In a standalone game app, that makes for a terrible user experience.

So I threw it away and started again.

The first time you launch one of these games, you’ll be greeted with a tidy list of predefined launch options. Click an option to launch that program; quit back to DOS, and the app will return to the launch options. (You can also get back to the launch options at any time from the File menu.)

If you quit the app while a program is still running, the app will remember which launch option you’d chosen and start up with that next time. This way, it’s easy to switch back and forth between launch options, without needing to choose one every time you start up.

The launch options panel only appears in GOG games that actually have multiple options. For games with only a single launch option, the game will start up straight away and exiting to DOS will quit the app instead of returning to the launch options.

Shadow boxing

As you’d expect, inside each game app are all the files for that game. And as you also know, DOS games like to dump their savegames in the same place as all their other program files.

These two facts are on a head-on collision course. OS X apps aren’t expected to be self-modifying: and if you’re not running as an administrator, then apps in the Applications folder are not even allowed to write to themselves. This would prevent you from saving your game and in many cases would prevent the game from running at all.

The solution is one I’ve discussed in the past: write shadowing. Attempts to write to game files are instead written to a ‘shadow’ location inside the current user’s Application Support folder. The app reads changes from there first, before reading the original game files from inside the app. This way noone’s trying to modify the app itself and everyone’s happy.

This has several knock-on benefits:

Shaders a-go-go

Dropping OSX 10.5 support let me pull the trigger on a feature I’ve had in my sights for a long time: pixel shaders for rendering styles. Shaders are programmable effects that run on the GPU, and they allow for faster and considerably fancier scaling effects.


The game apps ship with three shader-powered rendering styles: the original untouched output, a 5xBR smoothing shader by Hyllian and crazy46guy, and a simply awesome curved CRT shader by cgwg, Themaister and DOLLS. I cherry-picked these from the thriving BSNES shader community; the coders deserve much love for creating such great-looking shaders.

For older Macs that can’t run pixel shaders at an acceptable speed, Boxer standalone falls back on the old software rendering styles you get in Boxer 1.3.

Naturally, the game apps also natively support those newfangled retina displays.

There’s always a but

The game apps are slick as hell, but that comes in exchange for flexibility and features. Hence some caveats:

Each game app has a gamebox inside, so if you prefer you can just run the gamebox in Boxer 1.3.2 instead. However, Boxer 1.3.2 does not utilise the new launch option structure, nor does it support write shadowing: your game state will not be consistent between Boxer and the game app, and any changes you make in Boxer will be saved permanently into the app.

So when do I get to see all this neat stuff in Boxer itself?

Soon! But there’s still a bunch of work to do before these features are ready to appear in Boxer 1.4:

For now, buy the hell out of GOG.com’s DOS game collection and get the goodies right away. If you don’t mind wet paint and you’re familiar with XCode, you could build Boxer 1.4pre from source and take advantage of all the new features; or even build Boxer standalone and its bundler utility and start churning out your own game apps (some assembly required!)

Closing remarks

It's been a huge pleasure to collaborate with the cool guys at GOG.com and big ups to them for choosing Boxer. By doing so, they’ve ensured that their Mac gamers get the best DOS gaming experience across any platform.

Out to lunch Monday 16th July 2012

My July has gotten a lot more crowded than I expected, and it’s become clear that Boxer 1.4 will not be ready in time for the impending release of OS X 10.8 Mountain Lion. So, I released Boxer 1.3.2 as a stopgap: this has a few minor bugfixes and is Developer-ID signed to be trusted by Mountain Lion's new Gatekeeper system.

I'll be very busy over the next couple of months with Real Life commitments, so Boxer’s development will be quiet for a wee while and Boxer 1.4 may not arrive until later this year. Fear not though, exciting things are on the way!

Design by 40watt.