Author |
Message |
  |
|
Yallis
Professional Sucker

Joined: 20 Jul 2002
Posts: 693
Location: city.psdl
Status: Offline
|
Post subject: CDDS - Compressed DDS textures |
|
|
I have planned to write about my Midtown Madness 3 reversing for half a decade, so with the revival of MM2C.com I am taking the opportunity to release what I have got before it vanishes again.
All Midtown Madness 3 textures, except city tiles, are stored as CDDS files. These files was a mystery for quite some time because there was not much to go by. They are in fact raw, header-less compression streams. The dictionaries are embedded in the executable and a dictionary is chosen based on the image type. The extracted data is a regular DDS file.
A CDDS file starts with the compression stream of a DDS header, using a dedicated dictionary. When the 128 byte header have been decompressed, the header is parsed. A new dictionary is set based on the pixel format. DXT1, DXT2/DXT3, DXT4/DXT5, or a general one for other types, such as RGB. The target length is determined by the image dimensions, pixel format and number of surfaces (mipmaps, cube maps). The compression use a 64 byte sliding window to reduce byte-runs.
decdds is a command line tool to decompress CDDS files to DDS files. The output file name will be the same as the input file, but with the .dds extension instead of .cdds. It is also possible to set a custom output file name.
Code: |
Usage: decdds [-v] [-q] infile.cdds [outfile.dds]
Options:
-v increase verbosity
-q quiet
-? this helpful output
|
Win32 binary download: decdds-2013-09-17-win32bin.7z (23KB)
And for people with better taste in operating systems, here's the source: decdds-2013-09-17-src.tar.xz (13KB)
Build with make. The code is also on GitHub: https://github.com/dstien/gameformats/tree/master/mm3/decdds
All CDDS files can be converted if the MM3 assets are unzipped. In a Unix-like shell it can be achieved with a one-liner like this:
Code: |
$ find MM3Directory -type f -iname '*.cdds' -exec decdds {} \;
|
Example output:

 _________________
 |
|
10 Dec 2014 10:16 pm |
|
|
aaro4130
MM2C Maniac
Joined: 22 Feb 2009
Posts: 233
Location: At my laptop (hooked up to a monitor, keyboard, mouse, and speakers)
Status: Offline
|
Post subject: |
|
|
Whoa, impressive! Thanks for this  |
|
12 Dec 2014 12:27 am |
|
|
_Tim_
Kiwilicious

Joined: 22 Mar 2005
Posts: 1259
Location: Where the wild things are.
Status: Offline
Xbox Live Gamertag: TimNZ
|
Post subject: |
|
|
Super impressive. I loved that motorised shopping cart!
Are you playing with anything else in MM3 currently, Yallis? _________________
<- My experimental pages. |
|
12 Dec 2014 12:51 am |
|
|
aaro4130
MM2C Maniac
Joined: 22 Feb 2009
Posts: 233
Location: At my laptop (hooked up to a monitor, keyboard, mouse, and speakers)
Status: Offline
|
Post subject: |
|
|
_Tim_ wrote: |
Super impressive. I loved that motorised shopping cart!
Are you playing with anything else in MM3 currently, Yallis? |
Looks like it
 |
|
12 Dec 2014 01:21 am |
|
|
Yallis
Professional Sucker

Joined: 20 Jul 2002
Posts: 693
Location: city.psdl
Status: Offline
|
Post subject: |
|
|
Hehe, busted. Trying to implement some of the stuff from my old notes. Made some progress on car meshes lately. Will post threads about car models and cities when I have something screenshotable.
 _________________
 |
|
12 Dec 2014 01:31 am |
|
|
aaro4130
MM2C Maniac
Joined: 22 Feb 2009
Posts: 233
Location: At my laptop (hooked up to a monitor, keyboard, mouse, and speakers)
Status: Offline
|
Post subject: |
|
|
Yallis wrote: |
Hehe, busted. Trying to implement some of the stuff from my old notes. Made some progress on car meshes lately. Will post threads about car models and cities when I have something screenshotable. |
Maybe you could send me the format spec (pesudocode) after and I could get a Zmodeler filter started?  |
|
12 Dec 2014 03:19 am |
|
|
_Tim_
Kiwilicious

Joined: 22 Mar 2005
Posts: 1259
Location: Where the wild things are.
Status: Offline
Xbox Live Gamertag: TimNZ
|
Post subject: |
|
|
Bravo! Consider my mind boggled  _________________
<- My experimental pages. |
|
12 Dec 2014 04:18 am |
|
|
carking1996
MM2C Too Much
Joined: 12 Aug 2009
Posts: 608
Location: United States
Status: Offline
|
Post subject: |
|
|
Feel free to share some of that model extract so we can get an importer for max and Zm working. _________________
 |
|
12 Dec 2014 10:19 am |
|
|
carking1996
MM2C Too Much
Joined: 12 Aug 2009
Posts: 608
Location: United States
Status: Offline
|
|
15 Dec 2014 01:55 am |
|
|
Yallis
Professional Sucker

Joined: 20 Jul 2002
Posts: 693
Location: city.psdl
Status: Offline
|
Post subject: |
|
|
It's heartwarming to see that people still care about Midtown Madness.
aaro4130 wrote: |
Maybe you could send me the format spec (pesudocode) after and I could get a Zmodeler filter started?  |
carking1996 wrote: |
Feel free to share some of that model extract so we can get an importer for max and Zm working. |
Making import/export plugins is a little premature, there's still a lot left to figure out. I'll create a CMP thread to elaborate on what we know and what remains. As for specs, my research is already available in the form of binary templates for 010 Editor in my gameformats repo on GitHub. The files are C-like structs, as close to pseudo code as it gets. The files are however littered with assumptions, wild guesses and incomplete interpretations. The CMP viewer I'm using to verify the interpretations is also available. cmp.h is probably a more readable description of the format. The parser is standard, portable C++ which takes a filestream and returns a hierarchy of CMP nodes. Feel free to use it and/or contribute.
Cool. It's misspelled, though.  _________________
 |
|
15 Dec 2014 05:30 am |
|
|
aaro4130
MM2C Maniac
Joined: 22 Feb 2009
Posts: 233
Location: At my laptop (hooked up to a monitor, keyboard, mouse, and speakers)
Status: Offline
|
Post subject: |
|
|
Carking why'd you change the name from "CDDS to DDS Converter" or whatever I had it as lol.
But hey, first MM3 file on it. I'll take a look at your 010 binary templates.
I guess all the best use 010 . Haha
 |
|
15 Dec 2014 11:20 am |
|
|
HummersRock
...is still seeing colours.
Joined: 20 Feb 2006
Posts: 2669
Location: Magic Mushroom Land
Status: Offline
|
|
19 Dec 2014 07:38 pm |
|
|
|