|
|
« Reply #111 on: December 20, 2010, 04:45:09 PM » |
|
hey sveet... why don't you help in understanding the format... revel doesn't seem to want to be to informative about it... what can you get from this: /***************************************************************************** * dat.bt - Structure definitions for Super Smash Brothers Melee - dat file related entities. * ***************************************************************************** * Revision History: * 2009/09/29 - revel8n - Original * 2010/02/22 - revel8n - Changes based on information from breakpoint * 2010/02/22 - revel8n - More structure updates * 2010/02/23 - revel8n - Started adding other structures (FIGHTER and FIGATREE) */
#include "include\common-types.bt"
SetReadOnly(true);
// #pragma displayname("dat structures") // #pragma fileextensions(".dat")
// #pragma byteorder(big_endian) BigEndian();
// mark used bytes with a light green background
local int64 filePos = FTell();
// DAT_FILE File Structure struct DAT_FILE { // #pragma lockAt(0x00000000)
// DAT_HEADER - DAT file header information structure SetBackColor(cLtGreen); struct DAT_HEADER { // 0x00 uint32 fileSize0x00 <format = hex>; uint32 dataBlockSize0x04 <format = hex>; // size of main data block uint32 relocationTableCount0x08; // unknown data size / 4 uint32 rootCount0x0C; // unknown data size / 8 // if combined "data sizes" + 0x20 is less than file size, then offset to string table? // overwritten data addresses (as such, assumed they are unimportant?) // - 0x20 - start + 0x20? // - 0x24 - start + dataBlockSize0x04 + 0x20 - offsets to offsets? // - 0x28 - start + [0x24] + (relocationTableCount0x08 * 4) // - 0x2C - start + [0x28] + (jobjCount0x0C * 8) // - 0x30 - start + [0x2C] + (unknown0x10 * 8) // - 0x3C - or'ed with 0x01 // - 0x40 - start // 0x10 uint32 unknown0x10; // unknown data size / 8 uint32 unknown0x14; // '001B' in main Pl*.dat files uint32 unknown0x18; uint32 unknown0x1C; } fileHeader; if (0 != fileHeader.dataBlockSize0x04 && 0 < fileHeader.relocationTableCount0x08) { FSeek(0x20 + fileHeader.dataBlockSize0x04); SetBackColor(cLtGreen); uint32 relocationTable[fileHeader.relocationTableCount0x08] <format = hex>; local uint32 offsetNum = 0; filePos = FTell(); FSeek(0x20 + fileHeader.dataBlockSize0x04); SetBackColor(cLtRed); struct { for (offsetNum = 0; offsetNum < fileHeader.relocationTableCount0x08; ++offsetNum) { FSeek(0x20 + relocationTable[offsetNum]); uint32 mappedOffsets <format = hex>; } FSeek(filePos); } relocatedOffsets; FSeek(0x20 + fileHeader.dataBlockSize0x04); SetBackColor(cLtBlue); struct { for (offsetNum = 0; offsetNum < fileHeader.relocationTableCount0x08; ++offsetNum) { //FSeek(0x20 + ReadUInt(0x20 + relocationTable[offsetNum])); FSeek(0x20 + relocatedOffsets.mappedOffsets[offsetNum]); uint16 mappedData <format = hex>; } FSeek(filePos); } relocatedData; } if (0 < fileHeader.rootCount0x0C) { FSeek(0x20 + fileHeader.dataBlockSize0x04 + (fileHeader.relocationTableCount0x08 * 4)); SetBackColor(cLtRed); struct { struct { uint32 rootOffset0x00 <format = hex>; uint32 stringTableOffset0x04 <format = hex>; // offset to name string? filePos = FTell(); FSeek(0x20 + rootOffset0x00); SetBackColor(cLtBlue); uint16 mappedData <format = hex>; FSeek(filePos); } rootNodes[fileHeader.rootCount0x0C] <optimize = false>; } rootNodes; } if (0 < fileHeader.unknown0x10) { FSeek(0x20 + fileHeader.dataBlockSize0x04 + (fileHeader.relocationTableCount0x08 * 4) + (fileHeader.rootCount0x0C * 8)); SetBackColor(cLtBlue); struct { uint32 unknown0x00; uint32 unknown0x04; } unknownData0x10[fileHeader.unknown0x10]; } // string table data if (0 < fileHeader.rootCount0x0C) { FSeek(0x20 + fileHeader.dataBlockSize0x04 + (fileHeader.relocationTableCount0x08 * 4) + (fileHeader.rootCount0x0C * 8) + (fileHeader.unknown0x10 * 8)); SetBackColor(cLtYellow); struct { struct { string nodeName0x00; } stringTable[fileHeader.rootCount0x0C] <optimize = false>; } stringTable; } };
struct DAT_FILE fileInfo;
here's the common types: /***************************************************************************** * common-types.bt - Common type definition used in binary formats. * ***************************************************************************** * Revision History: * 2009/03/16 - GWC - Original * 2009/03/18 - GWC - Added type parsing functions */
typedef byte int8; typedef ubyte uint8;
typedef union { int8 v[4]; struct { int8 x, y, z, w; } vec4; } byte4 <read=byte4Read, write=byte4Write>;
typedef union { uint8 v[4]; struct { uint8 x, y, z, w; } vec4; } ubyte4 <read=ubyte4Read, write=ubyte4Write>;
typedef union { int16 v[2]; struct { int16 x, y; } vec2; } short2 <read=short2Read, write=short2Write>;
typedef union { int16 v[3]; struct { int16 x, y, z; } vec3; } short3 <read=short3Read, write=short3Write>;
typedef union { int16 v[4]; struct { int16 x, y, z, w; } vec4; } short4 <read=short4Read, write=short4Write>;
typedef union { float v[2]; struct { float x, y; } vec2; } float2 <read=float2Read, write=float2Write>;
typedef union { float v[3]; struct { float x, y, z; } vec3; } float3 <read=float3Read, write=float3Write>;
typedef union { float v[4]; struct { float x, y, z, w; } vec4; } float4 <read=float4Read, write=float4Write>;
typedef struct { union { float v[4]; float2 rows[2]; } vec2x2; } float2x2;
typedef struct { union { float v[6]; float3 rows[2]; } vec2x3; } float2x3;
typedef struct { union { float v[9]; float3 rows[3]; } vec3x3; } float3x3;
typedef struct { union { float v[12]; float3 rows[4]; } vec4x3; } float4x3;
typedef struct { union { float v[8]; float4 rows[2]; } vec2x4; } float2x4;
typedef struct { union { float v[12]; float4 rows[3]; } vec3x4; } float3x4;
typedef struct { union { float v[16]; float4 rows[4]; } vec4x4; } float4x4;
// byte4 parsing functions string byte4Read( const byte4 &v ) { local int32 t[4] = {v.v[0], v.v[1], v.v[2], v.v[3]}; string s; SPrintf( s, "(%6d, %6d, %6d, %6d)", t[0], t[1], t[2], t[3] ); return s; }
void byte4Write( byte4 &v, string s ) { SScanf( s, "(%d, %d, %d, %d)", v.v[0], v.v[1], v.v[2], v.v[3] ); }
// ubyte4 parsing functions string ubyte4Read( const ubyte4 &v ) { string s; SPrintf( s, "(%4u, %4u, %4u, %4u)", v.v[0], v.v[1], v.v[2], v.v[3] ); return s; }
void ubyte4Write( ubyte4 &v, string s ) { SScanf( s, "(%u, %u, %u, %u)", v.v[0], v.v[1], v.v[2], v.v[3] ); }
// short2 parsing functions string short2Read( const short2 &v ) { local int32 t[2] = {v.v[0], v.v[1]}; string s; SPrintf( s, "(%6d, %6d)", t[0], t[1] ); return s; }
void short2Write( short2 &v, string s ) { SScanf( s, "(%d, %d)", v.v[0], v.v[1] ); }
// short3 parsing functions string short3Read( const short3 &v ) { local int32 t[3] = {v.v[0], v.v[1], v.v[2]}; string s; SPrintf( s, "(%6d, %6d, %6d)", t[0], t[1], t[2] ); return s; }
void short3Write( short3 &v, string s ) { SScanf( s, "(%d, %d, %d)", v.v[0], v.v[1], v.v[2] ); }
// short4 parsing functions string short4Read( const short4 &v ) { local int32 t[4] = {v.v[0], v.v[1], v.v[2], v.v[3]}; string s; SPrintf( s, "(%6d, %6d, %6d, %6d)", t[0], t[1], t[2], t[3] ); return s; }
void short4Write( short4 &v, string s ) { SScanf( s, "(%d, %d, %d, %d)", v.v[0], v.v[1], v.v[2], v.v[3] ); }
// float2 parsing functions string float2Read( const float2 &v ) { string s; SPrintf( s, "(%14f, %14f)", v.v[0], v.v[1] ); return s; }
void float2Write( float2 &v, string s ) { SScanf( s, "(%f, %f)", v.v[0], v.v[1] ); }
// float3 parsing functions string float3Read( const float3 &v ) { string s; SPrintf( s, "(%14f, %14f, %14f)", v.v[0], v.v[1], v.v[2] ); return s; }
void float3Write( float3 &v, string s ) { SScanf( s, "(%f, %f, %f)", v.v[0], v.v[1], v.v[2] ); }
// float4 parsing functions string float4Read( const float4 &v ) { string s; SPrintf( s, "(%14f, %14f, %14f, %14f)", v.v[0], v.v[1], v.v[2], v.v[3] ); return s; }
void float4Write( float4 &v, string s ) { SScanf( s, "(%f, %f, %f, %f)", v.v[0], v.v[1], v.v[2], v.v[3] ); }
|
|
|
Logged
|
|
|
|
|