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; }; /...") |
|||
Line 67: | Line 67: | ||
| 0xd710 || 0x9305 || Maps | | 0xd710 || 0x9305 || Maps | ||
|- | |- | ||
| 0x4f2d || 0xcee5 || ''TODO'' | | 0x4f2d || 0xcee5 || ''TODO'' (tile sets?) | ||
|- | |- | ||
| 0x6d24 || 0xa705 || ''TODO'' | | 0x6d24 || 0xa705 || ''TODO'' (font?) | ||
|- | |- | ||
| 0x0a4d || 0xcf05 || ''TODO'' | | 0x0a4d || 0xcf05 || ''TODO'' (tile sets?) | ||
|- | |- | ||
| 0x2117 || 0x9b05 || ''TODO'' | | 0x2117 || 0x9b05 || ''TODO'' (tile sets?) | ||
|- | |- | ||
| 0x5f29 || 0xc8e5 || | | 0x5f29 || 0xc8e5 || Sprite tile sets | ||
|- | |- | ||
| 0x4679 || 0xa8d9 || ''TODO'' | | 0x4679 || 0xa8d9 || ''TODO'' |
Revision as of 17:04, 3 August 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_directories[11];
MFT Address
The mft_directories[]
array starts at the following addresses:
Game | Address |
---|---|
Boktai 1 (J) | 0x085a1584 |
Boktai 1 (U) | 0x085b02c4 |
Boktai 2 (J, Rev. 0) | 0x085b0ce4 |
Boktai 2 (J, Rev. 1) | 0x085b0d90 |
Boktai 2 (U) | 0x085abbc0 |
Boktai 2 (J) | 0x08614d6c |
MFT Directories
The following directories exist:
id_low | id_high | Description |
---|---|---|
0x5130 | 0x9225 | TODO |
0xe53e | 0xc305 | TODO |
0xac2c | 0xaf05 | Palettes |
0xd710 | 0x9305 | Maps |
0x4f2d | 0xcee5 | TODO (tile sets?) |
0x6d24 | 0xa705 | TODO (font?) |
0x0a4d | 0xcf05 | TODO (tile sets?) |
0x2117 | 0x9b05 | TODO (tile sets?) |
0x5f29 | 0xc8e5 | Sprite tile sets |
0x4679 | 0xa8d9 | TODO |
0x41f5 | 0xa8d9 | Scripts (Boktai 1) |
0xa41e | 0xa8d9 | Scripts (Boktai 2) |
0x49bc | 0xa8d9 | Scripts (Boktai 3) |
Tools
- Bokasm: Can extract the MFT of Boktai ROMs