Page 1 of 2

Manhattan Chase

Posted: Mon Jul 11, 2005 5:38 am
by Marvey
Hey ppl
Its possible to make a pluggin to this game Manhattan Chase
I have uploaded one file from textures directory they use this format for almost all files they have in the game if you can plz take a look on it.
Thx

Posted: Mon Jul 11, 2005 7:25 am
by Mr.Mouse
Thanks! I'm on it. Let you know what I find. :)

Posted: Mon Jul 11, 2005 8:45 am
by Mr.Mouse
This is a file that contains increasingly smaller textures for the same item (like MIP maps in DDS). I haven't quite figured out the format of the images yet. They do not look compressed really, as the image data matches the height*width variables in there. So it should be an 8-bit image format.

Do you have more examples? There are still some variables in the 0x24 header that I don't understand.

Posted: Mon Jul 11, 2005 12:57 pm
by Marvey
Sure mate i have included other file from the folder textures/ and other file from the folder Menu/ i hope this help you.
Thx

Posted: Mon Jul 11, 2005 12:58 pm
by Marvey
this one if from the Menu/ folder

Posted: Tue Jul 12, 2005 1:02 am
by Marvey
mr. mouse if you can resolve this i wanna ask if is possible to make a convertor for the images inside the paks in case they are not standart.
Thx

Posted: Tue Jul 12, 2005 8:55 am
by Mr.Mouse
I will take a look at them at get back asap. :)

Posted: Wed Jul 13, 2005 2:59 pm
by KorNet

Posted: Wed Jul 13, 2005 3:16 pm
by Mr.Mouse
Thanks. I will see what I can do, when I have time. ;)

Posted: Sat Jul 16, 2005 8:38 pm
by SparedLife
The DCT texture file format is indeed a DDS file with mips. The DCT header is 48 bytes and contains all the information including the width and height. All that I looked at were DXT3 format which may mean that modders can utilize the alpha channel.


Marvey:
Since I'm on the road and using this old laptop I don't think I have enough resources available to write and test a Perl conversion script but if you want to convert by hand I can tell you how with Photoshop and a HEX editor.

Posted: Tue Jul 19, 2005 12:21 am
by KorNet
Strange but I sat understood with formats of all files this game and have come to conclusion what not what there DXT3 even does not smell as a format... At all files with expansions DCT, DCW, DCM, DCA, CAM , MCS, DCV, DCL, dcShadow, dcScript heading DC2 and further on all file almost one zero... :o What think in this occasion? :oops:

This example CAM file format
DC2...........?....i...k.
.?...=...:...B...?....2?


This example DCT file format
DC2.......................................
.................................................
.................................................
..................................................
...................................................
..................................................
..................................................
....................................................
.....................................................
........................................................
..................................

Posted: Tue Jul 19, 2005 1:16 am
by SparedLife
If I read your translation correctly, you do not understand how I concluded the DCT files are DXT3.

The DC2 header is 48 bytes long. If you remove this header the remaining data is a raw DXT3 with mips. It is not readable as a DXT3 because there is no DDS header. I looked at some other textures and there are both DXT1 and DXT3

To make it a DDS you will need to add a DDS header. This can be done by creating a DDS DXT3 file in the size needed with mips. Then remove the 128 byte header from your newly created DDS and attach it to the top of the raw DDS. The same for DXT1

To get the correct file size look at the original DC2 header. The 2 byte word at byte 19 is the width and the 2 byte word at byte 23 is the height. I also noticed the file size height and width at byte 36 and 38

For instance this Perl script would work for the DXT3

Code: Select all

while ($name = <*.dct>){
      	print "found a DCT file named $name\n";
        open(INPUT, "< $name") or die "can't open $input file: $!\n";
	binmode(INPUT);
	$FileLength = (-s INPUT);
	print "filelength = $FileLength\n";
	read(INPUT,$c,$FileLength,0) or die "can't read $FileLength bytes.\n";
       	($Width,$Height)= unpack "Sx[S]S", substr $c, 36, 128;
        print "width = $Width\n";
	print "height = $Height\n";
	$Size = ($Width * $Height);
	print "size = $Size\n";
	$DDSL1 = pack "SSSSSSSS", 17476, 8275, 124, 0, 4103, 10, $Height, 0;
	$DDSL2 = pack "SSSSSSSS",$Width,0,0,4,0,0,0,0;
	$DDSL345 = pack "LLLLLLLLLLLL", 0,0,0,0,0,0,0,0,0,0,0,0;
	$DDSL6 = pack "LCCCCLL", 0,68,88,84,51,0,0;
	$DDSL78 = pack "LLLLLLLL", 0,0,0,0,0,0,0,0;
	
	
   	
	seek INPUT, 48, SEEK_SET or die "can't seek Header length. \n";
	read (INPUT,$b,$Size,0) or die "can't read File Size.\n";
	$name =~ s/DCT/dds/;
	print "name = $name\n"; 
    	open(DDSFILE, "> $name") or die "can't open DDSFILE: $!\n";
   	binmode(DDSFILE);
   	print(DDSFILE $DDSL1);
	print(DDSFILE $DDSL2);
	print(DDSFILE $DDSL345);
	print(DDSFILE $DDSL6);
	print(DDSFILE $DDSL78);
	print(DDSFILE $b);
  }
Basically the script reads the 48 byte header , gets the size of the graphic, removes the 48 byte header , puts the DDS header on the file using the size from the original header. Just a time saver since it will read every DCT file in the folder and convert to DXT3. I tried it on a few and the actual DXT3 files came out ok.

Posted: Tue Jul 19, 2005 9:37 am
by KorNet
I wish to know you what version use? Full or the Demo? In the full version files differ from a demo !

Posted: Tue Jul 19, 2005 6:26 pm
by Marvey
the files i posted here are from the full game not the demo.
Mate is possible to compile this code ?
thx

Posted: Wed Jul 20, 2005 4:24 am
by SparedLife
Mate is possible to compile this code ?

I have heard of Perl compilers but the code is smaller and easier to manipulate in script form. For instance to get this to work on DXT1 only requires text editing a couple values.

Perl is a free download, I used ActiveState Perl to test the script. It runs at the command prompt and requires no Perl knowledge to run the script.