[ Midtown Madness 2 Central ] [ Midtown Madness 2 Central ]

Midtown Madness 2 Central > General Discussion > CDDS - Compressed DDS textures
View previous topic | View next topic
Author
Message Post new topicReply to topic
Yallis
Professional Sucker
Moderator

Joined: 20 Jul 2002
Posts: 693
Location: city.psdl

Status: Offline


Post subject: CDDS - Compressed DDS textures Reply with quote

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:



_________________
Post 10 Dec 2014 10:16 pm
View user's profile Send private message Visit poster's website
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: Reply with quote

Whoa, impressive! Thanks for this Smile
Post 12 Dec 2014 12:27 am
View user's profile Send private message Yahoo Messenger MSN Messenger
_Tim_
Kiwilicious
Administrator

Joined: 22 Mar 2005
Posts: 1259
Location: Where the wild things are.

Status: Offline


Xbox Live Gamertag:
TimNZ
Post subject: Reply with quote

Super impressive. I loved that motorised shopping cart!

Are you playing with anything else in MM3 currently, Yallis?
_________________
<- My experimental pages.
Post 12 Dec 2014 12:51 am
View user's profile Send private message
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: Reply with quote

_Tim_ wrote:
Super impressive. I loved that motorised shopping cart!

Are you playing with anything else in MM3 currently, Yallis?


Looks like it Wink
Post 12 Dec 2014 01:21 am
View user's profile Send private message Yahoo Messenger MSN Messenger
Yallis
Professional Sucker
Moderator

Joined: 20 Jul 2002
Posts: 693
Location: city.psdl

Status: Offline


Post subject: Reply with quote

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.


_________________
Post 12 Dec 2014 01:31 am
View user's profile Send private message Visit poster's website
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: Reply with quote

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? Smile
Post 12 Dec 2014 03:19 am
View user's profile Send private message Yahoo Messenger MSN Messenger
_Tim_
Kiwilicious
Administrator

Joined: 22 Mar 2005
Posts: 1259
Location: Where the wild things are.

Status: Offline


Xbox Live Gamertag:
TimNZ
Post subject: Reply with quote

Shocked Surprised Bravo! Consider my mind boggled Thumbs Up Thumbs Up Aww
_________________
<- My experimental pages.
Post 12 Dec 2014 04:18 am
View user's profile Send private message
carking1996
MM2C Too Much

Joined: 12 Aug 2009
Posts: 608
Location: United States

Status: Offline


Post subject: Reply with quote

Feel free to share some of that model extract so we can get an importer for max and Zm working.
_________________
Post 12 Dec 2014 10:19 am
View user's profile Send private message Send e-mail MSN Messenger
carking1996
MM2C Too Much

Joined: 12 Aug 2009
Posts: 608
Location: United States

Status: Offline


Post subject: Reply with quote

We put it on MMA for ya.

http://mmarchive.com/file_details.php?file_id=2385
_________________
Post 15 Dec 2014 01:55 am
View user's profile Send private message Send e-mail MSN Messenger
Yallis
Professional Sucker
Moderator

Joined: 20 Jul 2002
Posts: 693
Location: city.psdl

Status: Offline


Post subject: Reply with quote

It's heartwarming to see that people still care about Midtown Madness. Laughing

aaro4130 wrote:
Maybe you could send me the format spec (pesudocode) after and I could get a Zmodeler filter started? Smile

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.



carking1996 wrote:
We put it on MMA for ya.

http://mmarchive.com/file_details.php?file_id=2385

Cool. It's misspelled, though. Wink
_________________
Post 15 Dec 2014 05:30 am
View user's profile Send private message Visit poster's website
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: Reply with quote

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 Wink. Haha
Post 15 Dec 2014 11:20 am
View user's profile Send private message Yahoo Messenger MSN Messenger
HummersRock
...is still seeing colours.

Joined: 20 Feb 2006
Posts: 2669
Location: Magic Mushroom Land

Status: Offline


Post subject: Reply with quote

Cool stuff. Great work, Yallis.
_________________
My MM2 Creations | My DeviantArt
Post 19 Dec 2014 07:38 pm
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous: Post new topicReply to topic

Page 1 of 1 All times are GMT


Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Home - MM2C.com - Contact - Staff & Seniors - FAQ - Community Rules - Syndication


Powered by phpBB © 2001, 2005 phpBB Group