BMG

From CloudModding TWW Wiki
Jump to: navigation, search

The Wind Waker stores its text in a variation of the BMG format, which Nintendo has used off and on since it was introduced. Most of the essential fields are documented, but there are still some unknown fields that need to be investigate further if possible.

File Header

//0x20/32dec bytes long

/*0x00*/ const string Magic = "MESGbmg1";

/*0x08*/ int FileSize; //Doesn't seem to be right. Normally size up to, but not including, the FLW1 and FLI1 sectors

/*0x0C*/ int SecNum; //Number of sections

/*0x10*/ byte Encoding; //1: CP1252, 2: UTF-16, 3: Shift-JIS, 4: UTF-8. Only CP1252 and Shift-JIS used in WW

INF1

The INF1 section holds the data about each message within the file, such as the text box options and the offset to the text itself.

Header

//0x10/16dec bytes long

/*0x00*/ const string Magic = "INF1";

/*0x04*/ int SectionSize; //Size of the INF1 section

/*0x08*/ short EntryCount;

/*0x0A*/ short EntrySize; //Size in bytes of one entry

/*0x0C*/ short UnknownField1; //0

/*0x0E*/ short UnknownField2; //0

INF1 Entry

//In TWW, all entries are 0x18/24dec bytes long

/*0x00*/ int StringOffset;

/*0x04*/ short StringID;

/*0x06*/ short ItemPrice; // If this message presents a choice for buying an item, this value determines how many Rupees Link must have to buy the item.

/*0x08*/ short NextMessageID; // This is the ID of the message that comes next if this is a chain of dialog. HOWEVER, there is a variable somewhere outside the message that tells the engine to continue on to this message. Having this set to a non-zero value does not make the text continue.

/*0x0A*/ short UnknownFiled3;

/*0x0C*/ byte TextBoxType;

/*0x0D*/ byte DrawType; // Either the text will draw by character, like L-I-N-K, or it will all appear at once, like LINK.

/*0x0E*/ byte BoxPosition; // Top/middle/bottom of the screen

/*0x0F*/ byte ItemID; // Only used for "You got the thing!" text

/*0x10*/ byte Unknown1; // Usually set when itemID is set, too

/*0x11*/ byte InitialSoundId; // Sound to play when text begins to draw

/*0x12*/ byte InitialCameraBehavior; // Where the camera should look when the text begins to draw

/*0x13*/ byte InitialSpeakerAnim; // What the speaking character should do when the text begins to draw

/*0x14*/ byte Unknown5;

/*0x15*/ short NumLines; // Maximum number of lines per box

/*0x17*/ byte Padding;

DAT1

The DAT1 section contains the strings that are drawn to the screen.

Header

//8 bytes long

/*0x00*/ const string Magic = "DAT1";

/*0x04*/ int SectionSize;

See Also

  • BMC, the color bank used by certain control codes to recolor the font