Difference between pages "FF7/Battle/Battle scenes" and "FF8/FileFormat DAT"
Jump to navigation
Jump to search
my_wiki>NFITC1 m (→Enemy data format) |
my_wiki>Myst6re |
||
Line 1: | Line 1: | ||
− | + | By Mirex, JWP and myst6re. | |
− | + | == Header == | |
− | |||
− | + | DAT file is divided into 11 sections (except for c0m127.dat, which contains only 2 sections : 7th and 8th). | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{| border="1" cellspacing="1" cellpadding="3" align="center" style="border: 1px solid black; border-collapse: collapse;" | {| border="1" cellspacing="1" cellpadding="3" align="center" style="border: 1px solid black; border-collapse: collapse;" | ||
− | ! style="background:rgb(204,204,204) | + | ! style="background:rgb(204,204,204)" | Offset |
− | ! style="background:rgb(204,204,204) | + | ! style="background:rgb(204,204,204)" | Length |
− | ! style="background:rgb(204,204,204) | + | ! style="background:rgb(204,204,204)" | Description |
|- | |- | ||
− | | | + | | 0 |
| 4 bytes | | 4 bytes | ||
− | | | + | | Number of sections (always =11, except for c0m127.dat) |
|- | |- | ||
− | | | + | | 4 |
− | | 4 bytes | + | | nbSections * 4 bytes |
− | | | + | | Section Positions |
|- | |- | ||
− | | | + | | 4 + nbSections * 4 |
− | |||
− | |||
| 4 bytes | | 4 bytes | ||
− | | | + | | File size |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
− | == | + | == Section 1: Skeleton == |
− | {| border="1" cellspacing="1" cellpadding="3" style="border: 1px solid black; border-collapse: collapse;" | + | {| border="1" cellspacing="1" cellpadding="3" align="center" style="border: 1px solid black; border-collapse: collapse;" |
− | ! style="background:rgb(204,204,204) | + | ! style="background:rgb(204,204,204)" | Offset |
− | ! style="background:rgb(204,204,204) | + | ! style="background:rgb(204,204,204)" | Length |
− | ! style="background:rgb(204,204,204) | + | ! style="background:rgb(204,204,204)" | Description |
|- | |- | ||
− | | | + | | 0 |
| 2 bytes | | 2 bytes | ||
− | | | + | | Number of bones |
|- | |- | ||
− | | | + | |style="background:rgb(255,255,204)" | 2 |
− | | | + | |style="background:rgb(255,255,204)" | 14 bytes |
− | | | + | |style="background:rgb(255,255,204)" | Unknown |
|- | |- | ||
− | | | + | | 16 |
− | | | + | | Number of bones * 48 bytes |
− | + | | Bones | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
+ | === Bone struct === | ||
− | |||
− | {| border="1" cellspacing="1" cellpadding="3" style="border: 1px solid black; border-collapse: collapse;" | + | {| border="1" cellspacing="1" cellpadding="3" align="center" style="border: 1px solid black; border-collapse: collapse;" |
− | ! style="background:rgb(204,204,204) | + | ! style="background:rgb(204,204,204)" | Offset |
− | ! style="background:rgb(204,204,204) | + | ! style="background:rgb(204,204,204)" | Length |
− | ! style="background:rgb(204,204,204) | + | ! style="background:rgb(204,204,204)" | Description |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | 0 |
| 2 bytes | | 2 bytes | ||
− | | | + | | Parent id |
|- | |- | ||
− | | | + | | 2 |
| 2 bytes | | 2 bytes | ||
− | | | + | | Bone size |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | |style="background:rgb(255,255,204)" | 4 |
− | | | + | |style="background:rgb(255,255,204)" | 44 bytes |
− | | | + | |style="background:rgb(255,255,204)" | Unknown (often empty) |
− | | | ||
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | | | ||
− | |||
− | |||
− | |||
|} | |} | ||
− | ==== | + | == Section 2: Model geometry == |
+ | |||
+ | === Header (data sub table) === | ||
− | + | {| border="1" cellspacing="1" cellpadding="3" align="center" style="border: 1px solid black; border-collapse: collapse;" | |
− | {| border="1" cellspacing="1" cellpadding="3" style="border: 1px solid black; border-collapse: collapse;" | + | ! style="background:rgb(204,204,204)" | Offset |
− | ! style="background:rgb(204,204,204) | + | ! style="background:rgb(204,204,204)" | Length |
− | ! style="background:rgb(204,204,204) | + | ! style="background:rgb(204,204,204)" | Description |
− | ! style="background:rgb(204,204,204) | ||
|- | |- | ||
− | | | + | | 0 |
− | | | + | | 4 bytes |
− | | | + | | Number of objects |
|- | |- | ||
− | | | + | | 4 |
− | + | | nbObjects * 4 bytes | |
− | + | | Object Positions | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | | | ||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
− | === | + | === Object Data === |
− | + | {| border="1" cellspacing="1" cellpadding="3" align="center" style="border: 1px solid black; border-collapse: collapse;" | |
− | {| border="1" cellspacing="1" cellpadding="3" style="border: 1px solid black; border-collapse: collapse;" | + | ! style="background:rgb(204,204,204)" | Offset |
− | ! style="background:rgb(204,204,204) | + | ! style="background:rgb(204,204,204)" | Length |
− | ! style="background:rgb(204,204,204) | + | ! style="background:rgb(204,204,204)" | Description |
− | ! style="background:rgb(204,204,204) | ||
|- | |- | ||
− | | | + | | 0 |
| 2 bytes | | 2 bytes | ||
− | | | + | | Number of Vertices Data |
+ | |- | ||
+ | | 2 | ||
+ | | Varies * NbVerticesData | ||
+ | | Vertices Data | ||
|- | |- | ||
− | | | + | | Varies |
+ | | absolutePosition % 4 | ||
+ | | Padding (0x00) | ||
+ | |- | ||
+ | | Varies | ||
| 2 bytes | | 2 bytes | ||
− | | | + | | Num triangles |
|- | |- | ||
− | | | + | | Varies |
| 2 bytes | | 2 bytes | ||
− | | | + | | Num quads |
|- | |- | ||
− | | | + | | Varies |
− | | | + | | 8 bytes |
− | | | + | | Padding (0x00) |
|- | |- | ||
− | | | + | | Varies |
− | | | + | | numTriangles * 16 bytes |
− | | | + | | Triangles |
|- | |- | ||
− | | | + | | Varies |
− | | | + | | numQuads * 20 bytes |
− | | | + | | Quads |
|- | |- | ||
− | | | + | | Varies |
| 4 bytes | | 4 bytes | ||
− | | | + | | Total number of vertices (may be not visible) |
|} | |} | ||
− | ==== | + | ==== Vertice Data ==== |
− | {| border="1" cellspacing="1" cellpadding="3" style="border: 1px solid black; border-collapse: collapse;" | + | {| border="1" cellspacing="1" cellpadding="3" align="center" style="border: 1px solid black; border-collapse: collapse;" |
− | ! style="background:rgb(204,204,204) | + | ! style="background:rgb(204,204,204)" | Offset |
− | ! style="background:rgb(204,204,204) | + | ! style="background:rgb(204,204,204)" | Length |
− | ! style="background:rgb(204,204,204) | + | ! style="background:rgb(204,204,204)" | Description |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | 0 |
− | |||
− | |||
− | |||
− | |||
| 2 bytes | | 2 bytes | ||
− | | | + | | Bone id |
|- | |- | ||
− | | | + | | 2 |
| 2 bytes | | 2 bytes | ||
− | | | + | | Number of vertices |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | + | | 4 | |
− | | 4 | + | | nbVertices * 6 bytes |
− | + | | Vertices (nbVertices * 3 shorts) | |
− | |||
− | |||
− | | | ||
− | | | ||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
− | ==== | + | ==== Useful structures ==== |
− | + | typedef struct { | |
+ | sint16 x, y, z; | ||
+ | } vertice; | ||
+ | (sizeof = 6) | ||
− | + | typedef struct { | |
− | + | uint16 vertex_indexes[3]; | |
− | + | uint8 texCoords1[2]; | |
+ | uint8 texCoords2[2]; | ||
+ | uint16 textureID_related; | ||
+ | uint8 texCoords3[2]; | ||
+ | uint16 u; // textureID_related2 | ||
+ | } triangle; | ||
+ | (sizeof = 16) | ||
− | + | typedef struct { | |
+ | uint16 vertex_indexes[4]; | ||
+ | uint8 texCoords1[2]; | ||
+ | uint16 textureID_related; | ||
+ | uint8 texCoords2[2]; | ||
+ | uint16 u; // textureID_related2 | ||
+ | uint8 texCoords3[2]; | ||
+ | uint8 texCoords4[2]; | ||
+ | } triangle; | ||
+ | (sizeof = 20) | ||
− | + | == Section 3: Model animation == | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | === | + | === Header (data sub table) === |
− | |||
{| border="1" cellspacing="1" cellpadding="3" align="center" style="border: 1px solid black; border-collapse: collapse;" | {| border="1" cellspacing="1" cellpadding="3" align="center" style="border: 1px solid black; border-collapse: collapse;" | ||
− | ! style="background:rgb(204,204,204) | + | ! style="background:rgb(204,204,204)" | Offset |
− | ! style="background:rgb(204,204,204)" | + | ! style="background:rgb(204,204,204)" | Length |
+ | ! style="background:rgb(204,204,204)" | Description | ||
|- | |- | ||
− | | | + | | 0 |
− | | | + | | 4 bytes |
− | + | | Number of animations | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | 4 |
− | + | | nbAnimations * 4 bytes | |
− | + | | Animations Positions | |
− | | | ||
− | | | ||
|} | |} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 22:29, 7 December 2010
By Mirex, JWP and myst6re.
Contents
Header
DAT file is divided into 11 sections (except for c0m127.dat, which contains only 2 sections : 7th and 8th).
Offset | Length | Description |
---|---|---|
0 | 4 bytes | Number of sections (always =11, except for c0m127.dat) |
4 | nbSections * 4 bytes | Section Positions |
4 + nbSections * 4 | 4 bytes | File size |
Section 1: Skeleton
Offset | Length | Description |
---|---|---|
0 | 2 bytes | Number of bones |
2 | 14 bytes | Unknown |
16 | Number of bones * 48 bytes | Bones |
Bone struct
Offset | Length | Description |
---|---|---|
0 | 2 bytes | Parent id |
2 | 2 bytes | Bone size |
4 | 44 bytes | Unknown (often empty) |
Section 2: Model geometry
Header (data sub table)
Offset | Length | Description |
---|---|---|
0 | 4 bytes | Number of objects |
4 | nbObjects * 4 bytes | Object Positions |
Object Data
Offset | Length | Description |
---|---|---|
0 | 2 bytes | Number of Vertices Data |
2 | Varies * NbVerticesData | Vertices Data |
Varies | absolutePosition % 4 | Padding (0x00) |
Varies | 2 bytes | Num triangles |
Varies | 2 bytes | Num quads |
Varies | 8 bytes | Padding (0x00) |
Varies | numTriangles * 16 bytes | Triangles |
Varies | numQuads * 20 bytes | Quads |
Varies | 4 bytes | Total number of vertices (may be not visible) |
Vertice Data
Offset | Length | Description |
---|---|---|
0 | 2 bytes | Bone id |
2 | 2 bytes | Number of vertices |
4 | nbVertices * 6 bytes | Vertices (nbVertices * 3 shorts) |
Useful structures
typedef struct { sint16 x, y, z; } vertice;
(sizeof = 6)
typedef struct { uint16 vertex_indexes[3]; uint8 texCoords1[2]; uint8 texCoords2[2]; uint16 textureID_related; uint8 texCoords3[2]; uint16 u; // textureID_related2 } triangle;
(sizeof = 16)
typedef struct { uint16 vertex_indexes[4]; uint8 texCoords1[2]; uint16 textureID_related; uint8 texCoords2[2]; uint16 u; // textureID_related2 uint8 texCoords3[2]; uint8 texCoords4[2]; } triangle;
(sizeof = 20)
Section 3: Model animation
Header (data sub table)
Offset | Length | Description |
---|---|---|
0 | 4 bytes | Number of animations |
4 | nbAnimations * 4 bytes | Animations Positions |