PMD2 Pack File Format
Pack files are container containing a large amount of sub-files. They're fairly similar to the .sbin files found in Blue Rescue Team, except there are no filenames stored in the table of content(ToC). They usually share the ".bin" file extension with many other formats.
The kind of files it contains can be pretty much anything.
List of Known Pack Files
Since all pack files end up the very common ".bin" file extension, it becomes hard to find which files are pack files, and which aren't. To help with this, here is a list of all the known files ending with a ".bin" file extension that happen to be pack files !
"/DUNGEON/dungeon.bin" "/EFFECT/effect.bin" "/MONSTER/m_attack.bin" "/MONSTER/m_ground.bin" "/MONSTER/monster.bin" "/BALANCE/m_level.bin"
Those 6 files have been proven to be pack files.
File Structure
Overview
A global overview of all the parts that make up a pack file.
Offset | Length | Endianness | Type | Name | Description |
---|---|---|---|---|---|
0x00 | 4 | Null | 4 bytes of zeros. | ||
0x04 | 4 | little | uint32 | NbFiles | The number of sub-files / valid ToC entries. |
0x08 | ( NbFiles * 8 ) + 1 | Table of Content | This contains the offset of each sub-files, along with its length. | ||
After ToC | Varies | ToC Padding | 0xFF bytes used as padding to align the sub-files data on 16 bytes. It should be noted that for some files there will be more padding bytes to align the beginning offset of the first sub-file to a precise address. More details in the Special Cases section! | ||
After ToC Padding | Varies | Sub-Files Data | This block contains all the sub-files' data. |
Table of Content
The Table of Content is fairly simple. It consists of a bunch of 8 bytes entries one after the other.
Offset | Length | Endianness | Type | Name | Description |
---|---|---|---|---|---|
0x00 | 8 | ToC Entry 0 | A single ToC entry. | ||
.. Rest of the ToC entries here .. | |||||
Last ToC Slot | 8 | Last ToC Entry | The last entry in the table of content is null, and filled with 8 bytes of zeros. |
ToC Entry
A single entry in the table of content. Its made up of 2, 4 bytes integers. The first is a pointer to the offset of the sub-file data, the second is the length of the sub-file's data.
Offset | Length | Endianness | Type | Name | Description |
---|---|---|---|---|---|
0x00 | 4 | little | uint32 | Pointer to Sub-File | This value contains the offset of the sub-file within the Sub-Files Data block. |
0x04 | 4 | little | uint32 | Length of Sub-File | This value contains the length in bytes of the sub-file pointed to by the "Pointer to Sub-File". |
Sub-Files Data
This is where all the sub-files' data is piled one after the other, separated with padding when needed.
Offset | Length | Endianness | Type | Name | Description |
---|---|---|---|---|---|
0x00 | Sub-File Length | Sub-File Data | The data for the sub-file. | ||
After Sub-File Data | varies | Sub-File Padding | Some 0xFF bytes to align the next sub-file on 16 bytes. |
Special Cases
The 3 pack files in the "/MONSTER/" folder are special. unlike the other pack files, the 3 of them must have their first sub-file stored at the very same address, 0x1300. A lot of padding is added after the ToC in all 3 files just to meet that requirement. If a single one of them isn't at the same address, the game will either black screen, or no sprites will be loaded, and the game will eventually freeze or crash.