Master file table: Difference between revisions
(Created page with " The master file table stores all data files used by the game (graphics, sounds, text, scripts, maps, and more). It is located near the end of the ROM. The MFT contains ''directories'', and each directory contains ''files''. Directories are identified by a 4-byte ID, files are identified by a 2-byte ID. Neither file names, nor subdirectories are supported. <syntaxhighlight lang="c"> struct mft_header { u16 id_low; u16 id_high; mft_directory* directory; }; /...") |
No edit summary |
||
(25 intermediate revisions by the same user not shown) | |||
Line 29: | Line 29: | ||
// See table below for address | // See table below for address | ||
mft_header | mft_header mft_headers[11]; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
= MFT Address = | = MFT Address = | ||
The <code> | The <code>mft_headers[]</code> array starts at the following addresses: | ||
{| class="wikitable" | {| class="wikitable exportable" | ||
|- | |- | ||
! Game || Address | ! Game || Address | ||
Line 42: | Line 42: | ||
|- | |- | ||
| Boktai 1 (U) || 0x085b02c4 | | Boktai 1 (U) || 0x085b02c4 | ||
|- | |||
| Boktai 1 (EU) || 0x0856e97c | |||
|- | |||
| Boktai 1 (E3 Demo) || 0x08459fbc | |||
|- | |- | ||
| Boktai 2 (J, Rev. 0) || 0x085b0ce4 | | Boktai 2 (J, Rev. 0) || 0x085b0ce4 | ||
Line 49: | Line 53: | ||
| Boktai 2 (U) || 0x085abbc0 | | Boktai 2 (U) || 0x085abbc0 | ||
|- | |- | ||
| Boktai 2 (J) || 0x08614d6c | | Boktai 2 (EU) || 0x085b1874 | ||
|- | |||
| Boktai 3 (J) || 0x08614d6c | |||
|} | |} | ||
Line 55: | Line 61: | ||
The following directories exist: | The following directories exist: | ||
{| class="wikitable" | {| class="wikitable exportable" | ||
|- | |- | ||
! id_low || id_high || Description | ! id_low || id_high || Description | ||
|- | |- | ||
| 0x5130 || 0x9225 || | | 0x5130 || 0x9225 || [[Animation file|Animations]] | ||
|- | |- | ||
| 0xe53e || 0xc305 || | | 0xe53e || 0xc305 || [[Tile map file|Tile maps]] | ||
|- | |- | ||
| 0xac2c || 0xaf05 || | | 0xac2c || 0xaf05 || [[Collision map file|Collision maps]] | ||
|- | |- | ||
| 0xd710 || 0x9305 || | | 0xd710 || 0x9305 || Palettes - 20 byte header (ignorable?) followed by 0x200 bytes of raw [https://problemkaputt.de/gbatek-lcd-color-palettes.htm GBA palette data] | ||
|- | |- | ||
| 0x4f2d || 0xcee5 || | | 0x4f2d || 0xcee5 || [[Tile set file|Tile sets]] | ||
|- | |- | ||
| 0x6d24 || 0xa705 || | | 0x6d24 || 0xa705 || [[Font]] | ||
|- | |- | ||
| 0x0a4d || 0xcf05 || | | 0x0a4d || 0xcf05 || [[Particle file|Particles]] | ||
|- | |- | ||
| 0x2117 || 0x9b05 || | | 0x2117 || 0x9b05 || [[Actor sprites file|Actor sprites]] | ||
|- | |- | ||
| 0x5f29 || 0xc8e5 || | | 0x5f29 || 0xc8e5 || [[Sprite set file|Sprite sets]] | ||
|- | |- | ||
| 0x4679 || | | 0x4679 || 0x9a65 || [[Sprite set file#Palettes|Sprite set palettes]] | ||
|- | |- | ||
| 0x41f5 || 0xa8d9 || | | 0x41f5 || 0xa8d9 || [[Script directory]] (Boktai 1) | ||
|- | |- | ||
| 0xa41e || 0xa8d9 || | | 0xa41e || 0xa8d9 || Script directory (Boktai 2) | ||
|- | |- | ||
| 0x49bc || 0xa8d9 || | | 0x49bc || 0xa8d9 || Script directory (Boktai 3) | ||
|} | |} | ||
Line 89: | Line 95: | ||
* [[Bokasm]]: Can extract the MFT of Boktai ROMs | * [[Bokasm]]: Can extract the MFT of Boktai ROMs | ||
[[Category:Documentation]] | [[Category:Documentation]] [[Category:File formats]] | ||
[[Category:Boktai 1]] [[Category:Boktai 2]] [[Category:Boktai 3]] | [[Category:Boktai 1]] [[Category:Boktai 2]] [[Category:Boktai 3]] |
Latest revision as of 10:51, 9 November 2024
The master file table stores all data files used by the game (graphics, sounds, text, scripts, maps, and more). It is located near the end of the ROM. The MFT contains directories, and each directory contains files. Directories are identified by a 4-byte ID, files are identified by a 2-byte ID. Neither file names, nor subdirectories are supported.
struct mft_header {
u16 id_low;
u16 id_high;
mft_directory* directory;
};
// NOTE: This applies to all directories, EXCEPT for the script directory. That has its own format.
struct mft_directory {
u32 num_entries;
u32 offset_to_id_array; // Relative to the start of this struct
u32 offset_to_file_array; // Relative to the start of this struct
u16 id_array[num_entries];
u32 file_array[num_entries]; // Entries are relative to the start of this struct
// File contents follow
};
// Return pointer to start of file with the specified id.
void* mft_get_file(mft_directory* dir, u16 id) {
u16* id_array = (char*)dir + dir->offset_to_id_array;
u32* file_array = (char*)dir + dir->offset_to_file_array;
u32 index = index_of(id_array, id);
u32 file_offset = file_array[index];
return (char*)dir + file_offset;
}
// See table below for address
mft_header mft_headers[11];
MFT Address
The mft_headers[]
array starts at the following addresses:
Game | Address |
---|---|
Boktai 1 (J) | 0x085a1584 |
Boktai 1 (U) | 0x085b02c4 |
Boktai 1 (EU) | 0x0856e97c |
Boktai 1 (E3 Demo) | 0x08459fbc |
Boktai 2 (J, Rev. 0) | 0x085b0ce4 |
Boktai 2 (J, Rev. 1) | 0x085b0d90 |
Boktai 2 (U) | 0x085abbc0 |
Boktai 2 (EU) | 0x085b1874 |
Boktai 3 (J) | 0x08614d6c |
MFT Directories
The following directories exist:
id_low | id_high | Description |
---|---|---|
0x5130 | 0x9225 | Animations |
0xe53e | 0xc305 | Tile maps |
0xac2c | 0xaf05 | Collision maps |
0xd710 | 0x9305 | Palettes - 20 byte header (ignorable?) followed by 0x200 bytes of raw GBA palette data |
0x4f2d | 0xcee5 | Tile sets |
0x6d24 | 0xa705 | Font |
0x0a4d | 0xcf05 | Particles |
0x2117 | 0x9b05 | Actor sprites |
0x5f29 | 0xc8e5 | Sprite sets |
0x4679 | 0x9a65 | Sprite set palettes |
0x41f5 | 0xa8d9 | Script directory (Boktai 1) |
0xa41e | 0xa8d9 | Script directory (Boktai 2) |
0x49bc | 0xa8d9 | Script directory (Boktai 3) |
Tools
- Bokasm: Can extract the MFT of Boktai ROMs