Difference between revisions of "BFRES (File Format)"
KillzXGaming (talk | contribs) |
KillzXGaming (talk | contribs) (→FVTX) |
||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
BFRES, known as '''B'''inary Ca'''F'''e '''RES'''ource, stores information relating to any 3D model data. | BFRES, known as '''B'''inary Ca'''F'''e '''RES'''ource, stores information relating to any 3D model data. | ||
+ | |||
+ | == Changes From Wii U == | ||
+ | BFRES has substantial changes from Wii U. Here are a few examples: | ||
+ | |||
+ | * Offsets are uint64 | ||
+ | * Render state in FMAT is removed | ||
+ | * Relocation table is now used | ||
+ | * Mostly everything rearranged in some way | ||
+ | * Enums are different (ie vertex attribute format) | ||
+ | * FSHP bounding boxes are used for each LOD mesh | ||
+ | * Dictionary left/right and index data are handled differently | ||
+ | * Dictionaries no longer point to sections. Only used to lookup indexes for lists. | ||
+ | |||
+ | ==Version List== | ||
+ | * 0.5.0.3 (Mario Kart 8 Deluxe, BOTW, ARMS) | ||
+ | * 0.8.0.0 (Splatoon 2, Mario Odyssey) | ||
+ | * 0.8.1.1 (Kirby Star Allies, Super Mario Party) | ||
+ | * 0.9.0.0 (Kirby Super Clash, Super Mario Maker 2) | ||
== Header == | == Header == | ||
Line 26: | Line 44: | ||
| 0x16 || UInt16 || Block offset. | | 0x16 || UInt16 || Block offset. | ||
|- | |- | ||
− | | 0x18 || UInt32 || Relocation table offset. | + | | 0x18 || UInt32 || [[#Relocation Table|Relocation table]] offset. |
|- | |- | ||
| 0x1C || UInt32 || BFRES Size. | | 0x1C || UInt32 || BFRES Size. | ||
Line 36: | Line 54: | ||
| 0x30 || UInt64 || [[#FMDL|FMDL]] dictionary offset. | | 0x30 || UInt64 || [[#FMDL|FMDL]] dictionary offset. | ||
|- | |- | ||
+ | |- bgcolor="#AAFFAA" | ||
+ | | colspan="3" align="center" | '''if BFRES version >= 0.0.9.0''' | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x38 || UInt64 || Unknown offset. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x40 || UInt64 || Unknown dictionary offset. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x48 || UInt64 || Unknown 2 offset. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x50 || UInt64 || Unknown 2 dictionary offset. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x58 || UInt64 || Skeletal animations offset. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x60 || UInt64 || Skeletal animations dictionary. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x68 || UInt64 || Material animations offset. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x70 || UInt64 || Material animations dictionary. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x78 || UInt64 || Bone visibility animation array offset. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x80 || UInt64 || Bone visibility animation array dictionary. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x88 || UInt64 || Shape animation array offset. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x90 || UInt64 || Shape animation dictionary offset. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x98 || UInt64 || Scene animation array offset. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0xA0 || UInt64 || Scene animation dictionary offset. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0xA8|| UInt64 || Memory Pool. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0xB0 || UInt64 || [[#Buffer Section|Buffer Section]]. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0xB8 || UInt64 || [[#Embedded Files|Embedded files]] offset. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0xC0|| UInt64 || Embedded file dictionary offset. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0xC8|| Byte[8] || Padding. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0xD0|| UInt64 || String table offset. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0xD8|| UInt32 || String table size. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0xDC|| UInt16 || Model count. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0xDE || UInt16 || Unknown count. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0xE0 || UInt16 || Unknown 2 count. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0xE2 || UInt16 || Skeletal animation count. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0xE4 || UInt16 || Material animation count. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0xE6 || UInt16 || Bone visual animation count. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0xE8 || UInt16 || Shape animation count. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0xEA || UInt16 || Scene animation count. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0xEC || UInt16 || External file count. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0xEE || Byte[2] || Padding. | ||
+ | |- bgcolor="#FFDDDD" | ||
+ | | 0xF0 || || End of header. | ||
+ | |- | ||
+ | |- bgcolor="#FFAAAA" | ||
+ | | colspan="3" align="center" | '''else''' | ||
+ | |- bgcolor="#FFAAAA" | ||
| 0x38 || UInt64 || Skeletal animations offset. | | 0x38 || UInt64 || Skeletal animations offset. | ||
− | |- | + | |- bgcolor="#FFAAAA" |
| 0x40 || UInt64 || Skeletal animations dictionary. | | 0x40 || UInt64 || Skeletal animations dictionary. | ||
− | |- | + | |- bgcolor="#FFAAAA" |
| 0x48 || UInt64 || Material animations offset. | | 0x48 || UInt64 || Material animations offset. | ||
− | |- | + | |- bgcolor="#FFAAAA" |
| 0x50 || UInt64 || Material animations dictionary. | | 0x50 || UInt64 || Material animations dictionary. | ||
− | |- | + | |- bgcolor="#FFAAAA" |
| 0x58 || UInt64 || Bone visibility animation array offset. | | 0x58 || UInt64 || Bone visibility animation array offset. | ||
− | |- | + | |- bgcolor="#FFAAAA" |
| 0x60 || UInt64 || Bone visibility animation array dictionary. | | 0x60 || UInt64 || Bone visibility animation array dictionary. | ||
− | |- | + | |- bgcolor="#FFAAAA" |
| 0x68 || UInt64 || Shape animation array offset. | | 0x68 || UInt64 || Shape animation array offset. | ||
− | |- | + | |- bgcolor="#FFAAAA" |
| 0x70 || UInt64 || Shape animation dictionary offset. | | 0x70 || UInt64 || Shape animation dictionary offset. | ||
− | |- | + | |- bgcolor="#FFAAAA" |
| 0x78 || UInt64 || Scene animation array offset. | | 0x78 || UInt64 || Scene animation array offset. | ||
− | |- | + | |- bgcolor="#FFAAAA" |
| 0x80 || UInt64 || Scene animation dictionary offset. | | 0x80 || UInt64 || Scene animation dictionary offset. | ||
− | |- | + | |- bgcolor="#FFAAAA" |
| 0x88 || UInt64 || Memory Pool. | | 0x88 || UInt64 || Memory Pool. | ||
− | |- | + | |- bgcolor="#FFAAAA" |
− | | 0x90 || UInt64 || Buffer Section. | + | | 0x90 || UInt64 || [[#Buffer Section|Buffer Section]]. |
− | |- | + | |- bgcolor="#FFAAAA" |
− | | 0x98 || UInt64 || | + | | 0x98 || UInt64 || [[#Embedded Files|Embedded files]] offset. |
− | |- | + | |- bgcolor="#FFAAAA" |
| 0xA0 || UInt64 || Embedded file dictionary offset. | | 0xA0 || UInt64 || Embedded file dictionary offset. | ||
− | |- | + | |- bgcolor="#FFAAAA" |
| 0xA8 || Byte[8] || Padding. | | 0xA8 || Byte[8] || Padding. | ||
− | |- | + | |- bgcolor="#FFAAAA" |
| 0xB0 || UInt64 || String table offset. | | 0xB0 || UInt64 || String table offset. | ||
− | |- | + | |- bgcolor="#FFAAAA" |
| 0xB8 || UInt32 || String table size. | | 0xB8 || UInt32 || String table size. | ||
− | |- | + | |- bgcolor="#FFAAAA" |
| 0xBC || UInt16 || Model count. | | 0xBC || UInt16 || Model count. | ||
− | |- | + | |- bgcolor="#FFAAAA" |
| 0xBE || UInt16 || Skeletal animation count. | | 0xBE || UInt16 || Skeletal animation count. | ||
− | |- | + | |- bgcolor="#FFAAAA" |
| 0xC0 || UInt16 || Material animation count. | | 0xC0 || UInt16 || Material animation count. | ||
− | |- | + | |- bgcolor="#FFAAAA" |
| 0xC2 || UInt16 || Bone visual animation count. | | 0xC2 || UInt16 || Bone visual animation count. | ||
− | |- | + | |- bgcolor="#FFAAAA" |
| 0xC4 || UInt16 || Shape animation count. | | 0xC4 || UInt16 || Shape animation count. | ||
− | |- | + | |- bgcolor="#FFAAAA" |
| 0xC6 || UInt16 || Scene animation count. | | 0xC6 || UInt16 || Scene animation count. | ||
− | |- | + | |- bgcolor="#FFAAAA" |
| 0xC8 || UInt16 || External file count. | | 0xC8 || UInt16 || External file count. | ||
− | |- | + | |- bgcolor="#FFAAAA" |
| 0xCA || Byte[6] || Padding. | | 0xCA || Byte[6] || Padding. | ||
− | |- | + | |- bgcolor="#FFDDDD" |
− | | 0xD0 || || End of | + | | 0xD0 || || End of header. |
|} | |} | ||
Line 97: | Line 185: | ||
|- | |- | ||
| 0x00 || String || '''Section magic'''. Always "FMDL" in ASCII. | | 0x00 || String || '''Section magic'''. Always "FMDL" in ASCII. | ||
− | |- | + | |- bgcolor="#AAFFAA" |
+ | | colspan="3" align="center" | '''if BFRES version >= 0.0.9.0''' | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x04 || UInt32 || Padding. (reserved for flags) | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x08 || UInt64 || Model name offset. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x10 || UInt64 || Path name offset. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x18 || UInt64 || FSKL offset. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x20 || UInt64 || FVTX offset. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x28 || Uint64 || FSHP offset. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x30 || UInt64 || FSHP dictionary offset. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x38 || UInt64 || FMAT offset. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x40 || UInt64 || Padding | ||
+ | |- | ||
+ | |- bgcolor="#FFAAAA" | ||
+ | | colspan="4" align="center" | '''else''' | ||
+ | |- bgcolor="#FFDDDD" | ||
| 0x04 || UInt32 || Block size. | | 0x04 || UInt32 || Block size. | ||
− | |- | + | |- bgcolor="#FFDDDD" |
| 0x08 || UInt64 || Block offset. | | 0x08 || UInt64 || Block offset. | ||
− | |- | + | |- bgcolor="#FFDDDD" |
| 0x10 || UInt64 || Model name offset. | | 0x10 || UInt64 || Model name offset. | ||
− | |- | + | |- bgcolor="#FFDDDD" |
− | | 0x18 || UInt64 || | + | | 0x18 || UInt64 || Pathname offset. |
− | |- | + | |- bgcolor="#FFDDDD" |
| 0x20 || UInt64 || FSKL offset. | | 0x20 || UInt64 || FSKL offset. | ||
− | |- | + | |- bgcolor="#FFDDDD" |
| 0x28 || UInt64 || FVTX offset. | | 0x28 || UInt64 || FVTX offset. | ||
− | |- | + | |- bgcolor="#FFDDDD" |
| 0x30 || Uint64 || FSHP offset. | | 0x30 || Uint64 || FSHP offset. | ||
− | |- | + | |- bgcolor="#FFDDDD" |
| 0x38 || UInt64 || FSHP dictionary offset. | | 0x38 || UInt64 || FSHP dictionary offset. | ||
− | |- | + | |- bgcolor="#FFDDDD" |
| 0x40 || UInt64 || FMAT offset. | | 0x40 || UInt64 || FMAT offset. | ||
|- | |- | ||
Line 140: | Line 251: | ||
Then after this structure, a model [[#Dictionary|dictionary]] is present. | Then after this structure, a model [[#Dictionary|dictionary]] is present. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== FVTX == | == FVTX == | ||
Line 166: | Line 260: | ||
|- | |- | ||
| 0x00 || String || '''Section magic'''. Always "FVTX" in ASCII. | | 0x00 || String || '''Section magic'''. Always "FVTX" in ASCII. | ||
+ | |- bgcolor="#AAFFAA" | ||
+ | | colspan="3" align="center" | '''if BFRES version >= 0.0.9.0''' | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x04 || Byte[4] || Flags. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x08 || UInt64 || Vertex attribute array offset. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x10 || UInt64 || Vertex attribute array dictionary. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x18 || UInt64 || Memory pool. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x20 || UInt64 || Offset to unknown area. Data may be set at runtime. covers 0x10 spaces for each buffer. | ||
|- | |- | ||
+ | |- bgcolor="#FFAAAA" | ||
+ | | colspan="4" align="center" | '''else''' | ||
+ | |- bgcolor="#FFDDDD" | ||
| 0x04 || Byte[12] || Padding. | | 0x04 || Byte[12] || Padding. | ||
− | |- | + | |- bgcolor="#FFDDDD" |
| 0x10 || UInt64 || Vertex attribute array offset. | | 0x10 || UInt64 || Vertex attribute array offset. | ||
− | |- | + | |- bgcolor="#FFDDDD" |
| 0x18 || UInt64 || Vertex attribute array dictionary. | | 0x18 || UInt64 || Vertex attribute array dictionary. | ||
− | |- | + | |- bgcolor="#FFDDDD" |
| 0x20 || UInt64 || Memory pool. | | 0x20 || UInt64 || Memory pool. | ||
− | |- | + | |- bgcolor="#FFDDDD" |
| 0x28 || UInt64 || Offset to unknown area. Data may be set at runtime. covers 0x10 spaces for each buffer. | | 0x28 || UInt64 || Offset to unknown area. Data may be set at runtime. covers 0x10 spaces for each buffer. | ||
− | |- | + | |- bgcolor="#FFDDDD" |
| 0x30 || UInt64 || Offset to unknown area. Data may be set at runtime. covers 0x08 spaces for each buffer. | | 0x30 || UInt64 || Offset to unknown area. Data may be set at runtime. covers 0x08 spaces for each buffer. | ||
|- | |- | ||
Line 197: | Line 306: | ||
| 0x5C || UInt32 || Skin weight influence. | | 0x5C || UInt32 || Skin weight influence. | ||
|- | |- | ||
− | | 0x60 || || End of | + | | 0x60 || colspan="3" End of vertex header |
+ | |} | ||
+ | |||
+ | == Embedded Files == | ||
+ | This area stores additional files such as shaders (BFSHA) and textures (BNTX). | ||
+ | |||
+ | {|class="wikitable" | ||
+ | |- | ||
+ | ! Offset !! Type !! Description | ||
+ | |- | ||
+ | | 0x00 || UInt64 || Data offset. | ||
+ | |- | ||
+ | | 0x08 || UInt64 || Data size. | ||
+ | |- | ||
+ | | 0x10 || || End of buffer structure. | ||
+ | |} | ||
+ | |||
+ | |||
+ | == Buffer Section == | ||
+ | This area goes below all the sub section headers. This still gets written even if unused/not pointed in the file header | ||
+ | |||
+ | {|class="wikitable" | ||
+ | |- | ||
+ | ! Offset !! Type !! Description | ||
+ | |- | ||
+ | | 0x00 || UInt32 || Unknown. | ||
+ | |- | ||
+ | | 0x04 || UInt32 || Size. | ||
+ | |- | ||
+ | | 0x08 || UInt64 || Buffer offset. | ||
+ | |- | ||
+ | | 0x10 || Byte[16] || Padding. | ||
+ | |- | ||
+ | | 0x20 || || End of buffer structure. | ||
|} | |} | ||
Line 232: | Line 374: | ||
|- | |- | ||
| 0x10 || || End of dictionary node. | | 0x10 || || End of dictionary node. | ||
+ | |} | ||
+ | |||
+ | == Relocation Table == | ||
+ | The relocation table is a table that contains pointers to all the offsets in the file. | ||
+ | |||
+ | === Header === | ||
+ | |||
+ | {|class="wikitable" | ||
+ | |- | ||
+ | ! Offset !! Type !! Description | ||
+ | |- | ||
+ | | 0x00 || String || Section magic. Always "_RLT" in ASCII. | ||
+ | |- | ||
+ | | 0x04 || UInt32 || Current location. | ||
+ | |- | ||
+ | | 0x08 || UInt32 || Number of sections. | ||
+ | |- | ||
+ | | 0x0C || UInt32 || Padding. | ||
+ | |- | ||
+ | | ~ || || End of relocation table header. | ||
+ | |} | ||
+ | After the header are the sections and entries. | ||
+ | A BFRES always has 5 sections, even if unused. | ||
+ | # Pointers up to the end of the string pool. | ||
+ | # Pointers for index buffer. | ||
+ | # Pointers for vertex buffer. | ||
+ | # Pointers for memory pool. | ||
+ | # Pointers for external files. | ||
+ | |||
+ | === Relocation Section === | ||
+ | {|class="wikitable" | ||
+ | |- | ||
+ | ! Offset !! Type !! Description | ||
+ | |- | ||
+ | | 0x00 || UInt64 || Base pointer. | ||
+ | |- | ||
+ | | 0x08 || UInt32 || Current position. | ||
+ | |- | ||
+ | | 0x0C || UInt32 || Size. | ||
+ | |- | ||
+ | | 0x10 || Int32 || Entry index. | ||
+ | |- | ||
+ | | 0x14 || Int32 || Entry count. | ||
+ | |- | ||
+ | | 0x18 || || End of relocation section. | ||
+ | |} | ||
+ | |||
+ | === Relocation Entry === | ||
+ | {|class="wikitable" | ||
+ | |- | ||
+ | ! Offset !! Type !! Description | ||
+ | |- | ||
+ | | 0x00 || UInt32 || Current position. | ||
+ | |- | ||
+ | | 0x04 || UInt16 || Structure count. | ||
+ | |- | ||
+ | | 0x06 || Byte || Offset count. | ||
+ | |- | ||
+ | | 0x07 || Byte || Padding count. | ||
+ | |- | ||
+ | | 0x08 || || End of relocation section. | ||
|} | |} | ||
[[Category:File formats]] | [[Category:File formats]] |
Latest revision as of 20:58, 11 September 2019
BFRES, known as Binary CaFe RESource, stores information relating to any 3D model data.
Contents
Changes From Wii U
BFRES has substantial changes from Wii U. Here are a few examples:
- Offsets are uint64
- Render state in FMAT is removed
- Relocation table is now used
- Mostly everything rearranged in some way
- Enums are different (ie vertex attribute format)
- FSHP bounding boxes are used for each LOD mesh
- Dictionary left/right and index data are handled differently
- Dictionaries no longer point to sections. Only used to lookup indexes for lists.
Version List
- 0.5.0.3 (Mario Kart 8 Deluxe, BOTW, ARMS)
- 0.8.0.0 (Splatoon 2, Mario Odyssey)
- 0.8.1.1 (Kirby Star Allies, Super Mario Party)
- 0.9.0.0 (Kirby Super Clash, Super Mario Maker 2)
Header
The header contains all of the information needed to parse the entire file, include counts and offsets to data.
Offset | Type | Description |
---|---|---|
0x00 | String | File magic. Always "FRES" in ASCII. |
0x04 | UInt32 | Signature. |
0x08 | UInt32 | Version. |
0x0C | UInt16 | Byte Order Mark (BOM): 0xFEFF for big endian and 0xFFFE for little endian. |
0x0E | Byte | Byte alignment. |
0x0F | Byte | Target address size. Usually 0. |
0x10 | UInt32 | File name offset. |
0x14 | Uint16 | Flags. |
0x16 | UInt16 | Block offset. |
0x18 | UInt32 | Relocation table offset. |
0x1C | UInt32 | BFRES Size. |
0x20 | UInt64 | Offset to the file name length. |
0x28 | UInt64 | FMDL offset. |
0x30 | UInt64 | FMDL dictionary offset. |
if BFRES version >= 0.0.9.0 | ||
0x38 | UInt64 | Unknown offset. |
0x40 | UInt64 | Unknown dictionary offset. |
0x48 | UInt64 | Unknown 2 offset. |
0x50 | UInt64 | Unknown 2 dictionary offset. |
0x58 | UInt64 | Skeletal animations offset. |
0x60 | UInt64 | Skeletal animations dictionary. |
0x68 | UInt64 | Material animations offset. |
0x70 | UInt64 | Material animations dictionary. |
0x78 | UInt64 | Bone visibility animation array offset. |
0x80 | UInt64 | Bone visibility animation array dictionary. |
0x88 | UInt64 | Shape animation array offset. |
0x90 | UInt64 | Shape animation dictionary offset. |
0x98 | UInt64 | Scene animation array offset. |
0xA0 | UInt64 | Scene animation dictionary offset. |
0xA8 | UInt64 | Memory Pool. |
0xB0 | UInt64 | Buffer Section. |
0xB8 | UInt64 | Embedded files offset. |
0xC0 | UInt64 | Embedded file dictionary offset. |
0xC8 | Byte[8] | Padding. |
0xD0 | UInt64 | String table offset. |
0xD8 | UInt32 | String table size. |
0xDC | UInt16 | Model count. |
0xDE | UInt16 | Unknown count. |
0xE0 | UInt16 | Unknown 2 count. |
0xE2 | UInt16 | Skeletal animation count. |
0xE4 | UInt16 | Material animation count. |
0xE6 | UInt16 | Bone visual animation count. |
0xE8 | UInt16 | Shape animation count. |
0xEA | UInt16 | Scene animation count. |
0xEC | UInt16 | External file count. |
0xEE | Byte[2] | Padding. |
0xF0 | End of header. | |
else | ||
0x38 | UInt64 | Skeletal animations offset. |
0x40 | UInt64 | Skeletal animations dictionary. |
0x48 | UInt64 | Material animations offset. |
0x50 | UInt64 | Material animations dictionary. |
0x58 | UInt64 | Bone visibility animation array offset. |
0x60 | UInt64 | Bone visibility animation array dictionary. |
0x68 | UInt64 | Shape animation array offset. |
0x70 | UInt64 | Shape animation dictionary offset. |
0x78 | UInt64 | Scene animation array offset. |
0x80 | UInt64 | Scene animation dictionary offset. |
0x88 | UInt64 | Memory Pool. |
0x90 | UInt64 | Buffer Section. |
0x98 | UInt64 | Embedded files offset. |
0xA0 | UInt64 | Embedded file dictionary offset. |
0xA8 | Byte[8] | Padding. |
0xB0 | UInt64 | String table offset. |
0xB8 | UInt32 | String table size. |
0xBC | UInt16 | Model count. |
0xBE | UInt16 | Skeletal animation count. |
0xC0 | UInt16 | Material animation count. |
0xC2 | UInt16 | Bone visual animation count. |
0xC4 | UInt16 | Shape animation count. |
0xC6 | UInt16 | Scene animation count. |
0xC8 | UInt16 | External file count. |
0xCA | Byte[6] | Padding. |
0xD0 | End of header. |
FMDL
The FMDL section handles the actual model information, where it stores skeleton structures, shapes, and more.
Offset | Type | Description | |
---|---|---|---|
0x00 | String | Section magic. Always "FMDL" in ASCII. | |
if BFRES version >= 0.0.9.0 | |||
0x04 | UInt32 | Padding. (reserved for flags) | |
0x08 | UInt64 | Model name offset. | |
0x10 | UInt64 | Path name offset. | |
0x18 | UInt64 | FSKL offset. | |
0x20 | UInt64 | FVTX offset. | |
0x28 | Uint64 | FSHP offset. | |
0x30 | UInt64 | FSHP dictionary offset. | |
0x38 | UInt64 | FMAT offset. | |
0x40 | UInt64 | Padding | |
else | |||
0x04 | UInt32 | Block size. | |
0x08 | UInt64 | Block offset. | |
0x10 | UInt64 | Model name offset. | |
0x18 | UInt64 | Pathname offset. | |
0x20 | UInt64 | FSKL offset. | |
0x28 | UInt64 | FVTX offset. | |
0x30 | Uint64 | FSHP offset. | |
0x38 | UInt64 | FSHP dictionary offset. | |
0x40 | UInt64 | FMAT offset. | |
0x48 | UInt64 | FMAT dictionary offset. | |
0x50 | UInt64 | User data offset. | |
0x58 | Byte[16] | Padding. | |
0x68 | UInt16 | Vertex array count. | |
0x6A | UInt16 | Shape count. | |
0x6C | UInt16 | Material count. | |
0x6E | UInt16 | User data count. | |
0x70 | UInt32 | Total vertex count. | |
0x74 | Byte[4] | Padding. | |
0x78 | End of FMDL header. |
Directly after the FMDL header, there is a structure that defines a buffer for resources.
Then after this structure, a model dictionary is present.
FVTX
The FVTX section stores data related to vertices.
Offset | Type | Description | |
---|---|---|---|
0x00 | String | Section magic. Always "FVTX" in ASCII. | |
if BFRES version >= 0.0.9.0 | |||
0x04 | Byte[4] | Flags. | |
0x08 | UInt64 | Vertex attribute array offset. | |
0x10 | UInt64 | Vertex attribute array dictionary. | |
0x18 | UInt64 | Memory pool. | |
0x20 | UInt64 | Offset to unknown area. Data may be set at runtime. covers 0x10 spaces for each buffer. | |
else | |||
0x04 | Byte[12] | Padding. | |
0x10 | UInt64 | Vertex attribute array offset. | |
0x18 | UInt64 | Vertex attribute array dictionary. | |
0x20 | UInt64 | Memory pool. | |
0x28 | UInt64 | Offset to unknown area. Data may be set at runtime. covers 0x10 spaces for each buffer. | |
0x30 | UInt64 | Offset to unknown area. Data may be set at runtime. covers 0x08 spaces for each buffer. | |
0x38 | UInt64 | Vertex buffer size. | |
0x40 | UInt64 | Vertex stride size. | |
0x48 | UInt64 | Vertex buffer array offset. | |
0x50 | UInt32 | Buffer offset. | |
0x54 | Byte | Vertex attribute count. | |
0x55 | Byte | Vertex buffer count. | |
0x56 | UInt16 | Vertex index. | |
0x58 | UInt32 | Vertex count. | |
0x5C | UInt32 | Skin weight influence. | |
0x60 | colspan="3" End of vertex header |
Embedded Files
This area stores additional files such as shaders (BFSHA) and textures (BNTX).
Offset | Type | Description |
---|---|---|
0x00 | UInt64 | Data offset. |
0x08 | UInt64 | Data size. |
0x10 | End of buffer structure. |
Buffer Section
This area goes below all the sub section headers. This still gets written even if unused/not pointed in the file header
Offset | Type | Description |
---|---|---|
0x00 | UInt32 | Unknown. |
0x04 | UInt32 | Size. |
0x08 | UInt64 | Buffer offset. |
0x10 | Byte[16] | Padding. |
0x20 | End of buffer structure. |
Dictionary
A dictionary is a structure that can store nodes that reference each other, to create a tree for storing data.
Header
The header defines the structure of the dictionary.
Offset | Type | Description |
---|---|---|
0x00 | UInt32 | Magic. Always blank for BFRES. |
0x04 | UInt32 | Number of nodes in this dictionary. This does NOT include the root node. |
0x08 | Dictionary Nodes | Node definitions. |
0x08 + (numNodes * 0x10) | End of dictionary. |
Dictionary Node
Offset | Type | Description |
---|---|---|
0x00 | UInt32 | Reference node. -1 for root node. |
0x04 | UInt16 | ID of the node to the left of this node. |
0x06 | UInt16 | ID of the node to the right of this node. |
0x08 | UInt64 | Offset to the string in the string table that is associated with this node. |
0x10 | End of dictionary node. |
Relocation Table
The relocation table is a table that contains pointers to all the offsets in the file.
Header
Offset | Type | Description |
---|---|---|
0x00 | String | Section magic. Always "_RLT" in ASCII. |
0x04 | UInt32 | Current location. |
0x08 | UInt32 | Number of sections. |
0x0C | UInt32 | Padding. |
~ | End of relocation table header. |
After the header are the sections and entries. A BFRES always has 5 sections, even if unused.
- Pointers up to the end of the string pool.
- Pointers for index buffer.
- Pointers for vertex buffer.
- Pointers for memory pool.
- Pointers for external files.
Relocation Section
Offset | Type | Description |
---|---|---|
0x00 | UInt64 | Base pointer. |
0x08 | UInt32 | Current position. |
0x0C | UInt32 | Size. |
0x10 | Int32 | Entry index. |
0x14 | Int32 | Entry count. |
0x18 | End of relocation section. |
Relocation Entry
Offset | Type | Description |
---|---|---|
0x00 | UInt32 | Current position. |
0x04 | UInt16 | Structure count. |
0x06 | Byte | Offset count. |
0x07 | Byte | Padding count. |
0x08 | End of relocation section. |