Tag Archives: Hacking

Textures and compression

Your car when you load a texture but forgot to set half the UVs

Your car when you load a texture but forgot to set half the UVs

Well on the path to getting car texture support done, but there have been a few trials along the way.
Firstly the game uses a format I haven’t run into before:
The indices are stored in interleaved order (all even rows, then all odd rows) and the odd rows are word swapped (xxxxxxxx yyyyyyyy is stored as yyyyyyyy xxxxxxxx), very strange.

Second problem I have yet to resolve, I haven’t found how the game keeps track of the texture sizes. This may be hard-coded for car data, as they seem to use 80×38 textures for everything except the wheels, and the wheels have a separate block of texture pointers to the rest of the car parts. Hopefully looking at the track data which has a variety of texture sizes will shed more light on this.

Finally, and perhaps most frustrating, the game appears to use a slightly modified version of zlib 1.0.4 (there’s a string referring to this version in the ROM) to inflate the compressed data. You can use vanilla zlib to decompress and compress data and more often than not you’ll get the same output as the game, buuut not 100% of the time. Hoping that it was perhaps just some breaking change in zlib (which is currently v2.x) I grabbed the source for 1.0.4 and tried that, but it gives the exact same output. So now I have to reverse the game’s inflate routine to be able to extract correct data. Reversing an ASM routine is kinda fun, but can be painful as well.

Such is life.

The most detailed of the three LoD models

The most detailed of the three LoD models

World Driver Championship Car & Track mod – Take 2

Yonks ago (2013 to be precise), I was working on a project which I hoped eventually would enable me to import new car and track models into the N64 game World Driver Championship, I really want to make a Speed Racer mod for the game, it’s slidy handling feels like a good fit to me.
I got as far as partially decoding the track and car data formats, and had a basic C# track viewer up and running (barely, my understanding of OpenGL was… tenuous). Then it fell by the wayside as projects tend to do from time to time and gathered dust…WorldDriverChampionshipuntil now!

Starting from scratch (with the help of my old notes, thank-you past me!) in D, and modern OpenGL the project lives once again.
I’ve started from the other side this time, doing the car model viewer first. So far I have models displaying, and I think I’ve worked out the details for textures. There are some small sections of data in the car blobs that I haven’t figured out yet, but I wonder if they might be to do with in-game things like handling, which I haven’t tested yet.wdc_23_2_16