Xcode icon

Code

About

Various bits of code I’ve written and which are available free to use under liberal terms. Unless otherwise specified, the code can be found at GitHub or Google Code – a gradual transition to GitHub is under way.

I mostly code for Mac OS X, but some of the code is intended to be cross-platform.

If you feel a pressing urge to shout at me, you can use this e-mail address, which changes from time to time.

Mac OS X – High Level

 Oolite icon

Oolite

An Elite-like space shooter. I’m the current project lead, having taken over from Giles Williams some time ago. GPL 2.0 with numerous MIT/X11 license components.
(Hosted at BerliOS)

Redline Plug-in Splitter icon

Redline Tools

A set of tools for working with plug-ins for Ambrosia Software’s Redline. MIT/X11 license.
  • Plug-in Splitter for Redline: a drag-and-drop tool to unpack Redline plug-in archives.
  • Plug-in Mounter for Redline: a tool to mount Redline plug-ins like disk images (using MacFUSE).
  • redlinesplit: command-line equivalent of Plug-in Splitter.
  • Map Viewer for Redline: a tool for examining Redline maps in 3D.
  • RedlineHackKit: a set of reusable classes used in the above.
(Hosted at SourceForge)

Mac OS X – Libraries and Snippets

Objective-C source file icon

JAValueFromString

A tool to automatically describe (almost) any Objective-C variable, including primitives and variables, without the need to write a correct format string and extract fields. For example, NSRect foo = {{1, 2}, {3, 4}}; JA_DUMP(foo); will log foo = { { 1, 2 }, { 3, 4 } }.

MIT/X11 license. Hosted on GitHub. See also: this blog entry.


JAMultiTypeSavePanelController

A class to manage an NSSavePanel with a pop-up menu for choosing types. Uses modern, spiffy UTIs. MIT/X11 license. Hosted on GitHub. See also: this blog entry.

KeyNaming icon

KeyNaming

A library for generating descriptive strings from virtual key codes. Also has experimental support for USB HID usage codes for keyboards. MIT/X11 license.

C source file icon

KeyFromQWERTY

A simple library to convert character values to corresponding key codes using a predefined keyboard layout (that is, it does not use the current keyboard layout; by default is uses the U.S. layout, but tools to generate different versions are included). This can be used to hard-code default key bindings when you want to bind to physical key location rather than character value. Use KeyNaming to get an appropriate display string for a key code.

MIT/X11 license. Hosted on GitHub. See also: this blog entry.


Cross-Platform – Libraries and Snippets

C source file icon

S3TCDecompression

When I added texture conversion to redplugsplit, I needed a library for decompressing S3TC DXT3 textures. I couldn’t find one, so I wrote my own based on the S3TC code in DevIL. Public domain (with the permission of the DevIL crew).
Note: while it nominally supports other S3TC codecs (DXT1, DXT2, DXT4 and DXT5), it has currently only been tested on DXT3 textures.
Note 2: this code may be patent-encumbered. In particular, United States Patent 6,940,511 defines the decompression algorithm for the S3TC formats, but may only apply to specific uses. I am not your patent lawyer; if you wish to deploy this code in the United States or other countries which allow software patents, you should get legal advice.

MIT/X11 license. Zip file.

GLSL Bindings Sample screen shot

GLSL Bindings Sample

An example of using Objective-C’s dynamism and introspection to bind object properties to GLSL shader uniforms. Why is this listed as cross-platform? Well, it’s based on code from a cross-platform game, Oolite, so clearly Objective-C and the Foundation framework qualify as cross-platform. See this blog entry for a description.

Objective-C source file icon

JAPriorityQueue

I needed a priority queue for Oolite, and Foundation doesn’t provide one. Mike Ash provides an implementation which wraps the STL, and (as I pointed out there) CoreFoundation provides CFBinaryHeap. However, I needed this to work under GNUstep, which doesn’t play nice with Objective-C++, and I didn’t want to introduce a dependency on CFLite. So here’s an Objective-C implementation. MIT/X11 license. See also: this blog entry.