Breaking Eggs And Making Omelettes

Topics On Multimedia Technology and Reverse Engineering


Archives:

Quake 3 Source Code Available (and RoQ engine too!)

September 12th, 2005 by Multimedia Mike

Little by little, proprietary multimedia codecs become open source, one way or another. Sometimes, the originating companies release the code. Eric Lasota tipped me off that id recently saw fit to release the source code for Quake III under the GNU GPL, just as they have previously done for their Doom 1 & 2 and Quake 1 & 2 engines. You can download the source code file (quake3-1.32b-source.zip) from this FTP directory. What makes this development particularly pertinent to multimedia hacking is that the file quake3-1.32b/code/client/cl_cin.c contains the formal decode engine for the RoQ file format, which is the FMV format used in Quake III and games derived from the Q3 engine (such as Jedi Knight II, Return To Castle Wolfenstein, and American McGee’s Alice).

So anything that may have been confusing should be clear upon looking at the official source code. Dr. Tim Ferguson originally reverse engineered the format. From the official source it appears that there were some other features perhaps planned and not implemented, or omitted from the final version. These features apparently include a JPEG encoding mode. In fact, there are 4 extra chunk types that go largely unused (ROQ_QUAD = 0x1000, ROQ_QUAD_JPEG = 0x1012, ROQ_QUAD_HANG = 0x1013, and ROQ_PACKET = 0x1030). The context in which the JPEG mode is defined implies that a frame could be encoded using a JPEG or JPEG-like method. I am not entirely sure what HANG means but it could indicate that the current frame is unchanged from the previous frame.

Eric also points out that the code does, in fact, immediately decode the codebooks from YUV -> RGB16 and everything is processed in that colorspace. I have long suspected that this is a holdover from The 11th Hour which is where the RoQ format got its start. The FMV needed to be played back on 1995-vintage PCs which were not very capable of playing YUV data directly, and converting full frames of YUV data -> RGB would not have been plausible.

Posted in Open Source Multimedia | Comments Off on Quake 3 Source Code Available (and RoQ engine too!)

Comments are closed.