Kitty Corp Meow Mix Forums

Super Smash Bros. Brawl Hacking => Programming => Topic started by: DarkPikachu on August 09, 2011, 05:03:46 PM



Title: NOTES: DAT Resource Thread
Post by: DarkPikachu on August 09, 2011, 05:03:46 PM
please don't post in this thread while it's unlocked...

I'm posting completely new notes as my old notes are kinda out-of-date... heh

thank you :)


Title: Re: NOTES: DAT Resource Thread
Post by: DarkPikachu on August 11, 2011, 03:03:28 PM
first off, I must give full credit to Revel8n who discovered nearly

all of the format :)

The DAT standards are defined throughout the data

the header:
0x00(4): filesize
0x04(4): data size
0x08(4): relocation entry count
0x0C(4): base count
0x10(4): reference count
0x14(4): unknown ('001B')
0x18(4): unknown (0)
0x1C(4): unknown (0)


all offsets are relative to the data section,
so be sure to add 32 beforereading the data

the relocation table is located just after the data section
follow to the offset (data size + 32) to get to the relocation table.
NOTE: this is currently ignored as there's nothing but random data offsets w/in

it

if you want to get anywhere, you'll have to follow the tree of data starting at

the bases.

the bases are found just after the relocation table (data size + (relocation

entry count * 4) + 32)
bases/references:
0x00(4): data offset
0x04(4): string table offset

the only well known base name is 'joint' which can be retrieved by splitting the

full base name at each '_' and then looking at the 3rd value.
eg: 'PlyPichu5K_Share_joint'

the other most common name is 'matanim' which I currently am not looking at
(not saying I won't look at it) ;)

after the bases are the references, which I havn't actually seen... >_>
(another thing to look into)

following those is the string table, which is like any nintendo string table,

with each string having an end character of '00'
the table has no definitions or string lengths though >_>

now that we have the basis of the DAT, we can start decoding the data structures.


for the base name 'joint' the joint structure is the first one you'll

use:
joint:
0x00 (4): unknown (0)
0x04 (4): flags
0x08 (4): child joint offset
0x0C (4): sibling joint offset
0x10 (4): data offset
0x14(12): rotXYZ (float*3)
0x20(12): scaXYZ (float*3)
0x2C(12): locXYZ (float*3)
0x38 (4): inv matrix offset
0x3C (4): unknown (0)


following the joint structure is the data structure:
data:
0x00 (4): unknown (0)
0x04 (4): next data offset
0x08 (4): material offset
0x0C (4): object offset


following the data structure is the material and object

structures
material:
0x00 (4): unknown (0)
0x04 (4): flags
0x08 (4): texture offset
0x0C (4): colors offset
0x10 (4): unknown
0x14 (4): unknown


the colors for the materials are shared between other materials and objects
(more explaination on that when we get to the objects)
colors:
0x00 (4): diffuse
0x04 (4): ambient
0x08 (4): specular
0x0C (4): unknown (float)
0x10 (4): unknown (float)


and last for the materials is the textures:
(almost completely unknown)
texture:
0x00 (4): unknown (0)
0x04 (4): unknown (0)
0x08 (4): unknown (0)
0x0C (4): unknown (4)
0x10 (4): unknown (0)
0x14 (4): unknown (0)
0x18 (4): unknown (0)
0x1C (4): unknown (float) \
0x20 (4): unknown (float)  scale??
0x24 (4): unknown (float) /
0x28 (4): unknown (0)
0x2C (4): unknown (0)
0x30 (4): unknown (0)
0x34 (4): wrap_s
0x38 (4): wrap_t
0x3C (1): widthScale
0x3D (1): heightScale
0x3E (2): unknown (0)
0x40 (4): unknown
0x44 (4): unknown
0x48 (4): unknown
0x4C (4): image_header Offset
0x50 (4): pallet_header Offset
0x54 (4): unknown
0x58 (4): unknown data offset (prbly flags)


following that comes the image and pallet headers
img_header:
0x00 (4): data offset
0x04 (2): height
0x06 (2): width
0x08 (4): format


and the pallet header
plt_header:
0x00 (4): data offset
0x04 (4): format
0x08 (4): unknown
0x0C (2): color count
0x0E (2): unknown



more to come
(next is objects)





Title: Re: NOTES: DAT Resource Thread
Post by: DarkPikachu on January 23, 2012, 04:24:12 AM
since I've created the reformatted thread, I'm opening this thread for discussion. :)
(I'll finish what's left in the new thread...)

almost everything needs to be redone anyways... heh