Difference between revisions of "BRRES (File Format)"
(→Others) |
m (Reverted edits by 87.252.5.128 (talk) to last revision by Wiimm) |
||
Line 63: | Line 63: | ||
This header is then followed by a [[BRRES Index Group (File Format)|BRRES Index Group]]. The entries in this group are the folders of this brres file, and point to more [[BRRES Index Group (File Format)|BRRES Index Group]]s within the root section. These then point to the actual sections of the BRRES file. | This header is then followed by a [[BRRES Index Group (File Format)|BRRES Index Group]]. The entries in this group are the folders of this brres file, and point to more [[BRRES Index Group (File Format)|BRRES Index Group]]s within the root section. These then point to the actual sections of the BRRES file. | ||
− | + | === Others === | |
+ | |||
+ | Other [[BRRES Sub Files (File Format)|BRRES sections]] tend to be within specific folders, as set out by the root section. The identifiers of these sections, as well as the normal folder and a description are listed below. | ||
+ | BRRES Files contain only a few file formats, they are: | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | ! Identifier | ||
+ | ! Folder | ||
+ | ! Description | ||
+ | |- | ||
+ | | [[MDL0 (File Format)|MDL0]] | ||
+ | | 3DModels(NW4R) | ||
+ | | Model files. | ||
+ | |- | ||
+ | | [[TEX0 (File Format)|TEX0]] | ||
+ | | Textures(NW4R) | ||
+ | | Texture files. | ||
+ | |- | ||
+ | | [[SRT0 (File Format)|SRT0]] | ||
+ | | AnmTexSrt(NW4R) | ||
+ | | Texture movement animations. | ||
+ | |- | ||
+ | | [[CHR0 (File Format)|CHR0]] | ||
+ | | AnmChr(NW4R) | ||
+ | | Model movement animations. | ||
+ | |- | ||
+ | | [[PAT0 (File Format)|PAT0]] | ||
+ | | AnmTexPat(NW4R) | ||
+ | | Texture swapping animations. | ||
+ | |- | ||
+ | | [[CLR0 (File Format)|CLR0]] | ||
+ | | AnmClr(NW4R) | ||
+ | | Colour changing animations. | ||
+ | |- | ||
+ | | [[SHP0 (File Format)|SHP0]] | ||
+ | | AnmShp(NW4R) | ||
+ | | ? | ||
+ | |- | ||
+ | | [[SCN0 (File Format)|SCN0]] | ||
+ | | AnmScn(NW4R) | ||
+ | | ? | ||
+ | |- | ||
+ | | '''Not seen''' | ||
+ | | Palettes(NW4R) | ||
+ | | '''Known to exist from main.dol''' | ||
+ | |- | ||
+ | | '''Not seen''' | ||
+ | | AnmVis(NW4R) | ||
+ | | '''Known to exist from main.dol''' | ||
+ | |- | ||
+ | | '''Not seen''' | ||
+ | | LightSet(NW4R) | ||
+ | | '''Known to exist from main.dol''' | ||
+ | |- | ||
+ | | '''Not seen''' | ||
+ | | AmbLights(NW4R) | ||
+ | | '''Known to exist from main.dol''' | ||
+ | |- | ||
+ | | '''Not seen''' | ||
+ | | Lights(NW4R) | ||
+ | | '''Known to exist from main.dol''' | ||
+ | |- | ||
+ | | '''Not seen''' | ||
+ | | Fogs(NW4R) | ||
+ | | '''Known to exist from main.dol''' | ||
+ | |- | ||
+ | | '''Not seen''' | ||
+ | | Cameras(NW4R) | ||
+ | | '''Known to exist from main.dol''' | ||
+ | |} | ||
== String Table == | == String Table == |
Revision as of 18:57, 18 June 2011
BRRES Files are used to make objects. They contain models, textures and animations
Format
BRRES files are similar to SZS files: They contain multiple sections, sometimes refereed to as files. The format has been used in many games by Nintendo. This article describes Mario Kart Wii BRRES files.
Header
The file begins with the header. It is a 0x10 structure. It is as follows:
Offset | Type | Description |
---|---|---|
0x00 | char[4] | 'bres' in ASCII; File identifier. |
0x04 | u16 | Byte order mark. 0xFEFF is the big endian byte order, 0xFFFE is little endian. |
0x06 | u16 | Padding. |
0x08 | u32 | Length of the file in bytes. |
0x0C | u16 | Offset to root section relative to start. (0x0010) |
0x0E | u16 | Number of sections (including root). |
Sections
Root
The root section of the brres file contains all pointers to files and filenames The header of the root is 0x8 in length.
Offset | Type | Description |
---|---|---|
0x00 | char[4] | 'root' in ASCII |
0x04 | u32 | Length of section in bytes. |
This header is then followed by a BRRES Index Group. The entries in this group are the folders of this brres file, and point to more BRRES Index Groups within the root section. These then point to the actual sections of the BRRES file.
Others
Other BRRES sections tend to be within specific folders, as set out by the root section. The identifiers of these sections, as well as the normal folder and a description are listed below. BRRES Files contain only a few file formats, they are:
Identifier | Folder | Description |
---|---|---|
MDL0 | 3DModels(NW4R) | Model files. |
TEX0 | Textures(NW4R) | Texture files. |
SRT0 | AnmTexSrt(NW4R) | Texture movement animations. |
CHR0 | AnmChr(NW4R) | Model movement animations. |
PAT0 | AnmTexPat(NW4R) | Texture swapping animations. |
CLR0 | AnmClr(NW4R) | Colour changing animations. |
SHP0 | AnmShp(NW4R) | ? |
SCN0 | AnmScn(NW4R) | ? |
Not seen | Palettes(NW4R) | Known to exist from main.dol |
Not seen | AnmVis(NW4R) | Known to exist from main.dol |
Not seen | LightSet(NW4R) | Known to exist from main.dol |
Not seen | AmbLights(NW4R) | Known to exist from main.dol |
Not seen | Lights(NW4R) | Known to exist from main.dol |
Not seen | Fogs(NW4R) | Known to exist from main.dol |
Not seen | Cameras(NW4R) | Known to exist from main.dol |
String Table
At the end of the BRRES file is a string table. This is a series of 4-byte length prefixed strings, padded to start at four byte offsets. Various sections point to this table, which is how all text in BRRES files is stored.
GNU C header example
typedef struct brres_header_t { char magic[4]; // = string "bres" u16 bom; // byte order mark // the data is 'bom' dependent big or little endian u16 bom_padding; // usally 0 u32 size; // file size u16 root_off; // offset of root section u16 n_sections; // number of sections } __attribute__ ((packed)) brres_header_t; typedef struct brres_entry_t { u16 id; // entry id u16 unknown; // always 0? u16 left_idx; // index to left element in virtual tree u16 right_idx; // index to right element in virtual tree u32 name_off; // offset into string table u32 data_off; // offset to data } __attribute__ ((packed)) brres_entry_t; typedef struct brres_group_t { u32 size; // size of complete group u32 n_entries; // number of entires brres_entry_t entry[0]; // list of entries, N := 1 + n_entries // entry with index #0 is a special // root node not counting in 'n_entries' } __attribute__ ((packed)) brres_group_t; typedef struct brres_root_t { char magic[4]; // = string "root" u32 size; // size of complete header brres_group_t group[0]; // first group } __attribute__ ((packed)) brres_root_t;
Tools
The following tools can handle BRRES files:
- SZS Modifier, by MrBean35000vr and Chadderz
- CTools Pack, by MrBean35000vr and Chadderz
- Wiimms SZS Tools, by Wiimm
Wiimms SZS Tools are able to extract all files of a BRRES file. They are also able to create a complete new BRRES file from scratch by copying the content of a local directory structure.