MSBF (File Format): Difference between revisions

From Luma's Workshop
Jump to navigation Jump to search
m (→‎Condition Types: Add notes)
 
Line 113: Line 113:
! ID !! Name !! Description
! ID !! Name !! Description
|-
|-
| 0x00 || YesNo Result || Shows the YesNo Layout and displays one of the [[#YesNo_Results|YesNo Options]]
| 0x00 || YesNo Result || Shows the YesNo Layout and displays one of the [[#YesNo_Results|YesNo Options]]<br/>'''Requires a Message Node to come before it, or else the game will crash'''.
|-
|-
| 0x01 || BranchFunc || Object dependent. See [[#Branch_Functions|Branch Functions]]
| 0x01 || BranchFunc || Object dependent. See [[#Branch_Functions|Branch Functions]]
Line 135: Line 135:
| 0x0A || Cutscene || Checks to see if a cutscene is currently active or not
| 0x0A || Cutscene || Checks to see if a cutscene is currently active or not
|-
|-
| 0x0B || Message Read Flag || Checks to see if the Player has already read this message
| 0x0B || Message Read Flag || Checks to see if the Player has already read this message (needs verification)
|-
|-
| 0x0C || 120 Star Ending || Checks to see if the 120 star ending has been Achieved
| 0x0C || 120 Star Ending || Checks to see if the 120 star ending has been Achieved
|-
|-
| 0x0D || '''Unknown''' || '''Unknown'''
| 0x0D || '''Unknown''' || '''Unknown'''<br/>Only known to be used by King Whomp.
|-
|-
| 0x0E || Player Mode: Yoshi || Checks to see if the Player is riding Yoshi
| 0x0E || Player Mode: Yoshi || Checks to see if the Player is riding Yoshi

Latest revision as of 14:24, 24 February 2024

MSBF stands for Message Binary Flow, it contains control for the order of textboxes in Super Mario Galaxy 2.

Header

Offset Type Description
0x00 String MsgFlwBn in ASCII.
0x08 UInt16 Endianess. 0xFEFF for Big Endian, 0xFFFE for Little Endian.
0x0A UInt32 Version.
0x0E UInt16 Number of sections.
0x10 UInt16 Padding.
0x12 UInt32 File length.
0x16 Byte[0xA] Padding.

Sections

After the header follows the sections. It is worth noting that these sections are padded to the nearest 0x10th byte with the value 0xAB.

FLW2

Header

Offset Type Description
0x00 String FLW2 in ASCII.
0x04 UInt32 Section size. Does not account for this header or padding.
0x08 Byte[0x8] Padding.

Flow Node Entries

After the header come the flow node entries.

Offset Type Description
0x00 UInt16 Node Entry Count.
0x02 Uint16 Label Count.
0x04 byte[0x4] Padding.

A Node is defined by the following structure:

Offset Type Description
0x00 UInt16 Node Type. See Node Types
0x0A UInt16[0x5] A collection of shorts. The shorts have varying uses depending on the Node Type.

After the nodes, comes a list of UInt16's regarding Message Labels

Offset Type Description
0x00 UInt16[Label Count] Label Value

Node Types

Value Name Description
0x01 MESSAGE This node will display a MSBT entry. Message Labels are ignored, and are indexed by ID
0x02 CONDITION This node will branch to another node based on if a condition is met or not
0x03 EVENT This node will trigger an event, such as activating a switch, or spawning a star
0x04 ENTRY This node should come first. It acts as the starting point, and simply has one value to point to the actual first Node.

MESSAGE Node Format

Offset Type Description
0x00 UInt16 Unused
0x02 UInt16 Unused
0x04 UInt16 Message ID
0x06 UInt16 Next Flow Node ID
0x08 UInt16 Unused

CONDITION Node Format

Offset Type Description
0x00 UInt16 Unused
0x02 UInt16 Unknown, always 0x0002
0x04 UInt16 Condition Type
0x06 UInt16 Condition Parameter. What this does depends on the Condition Type defined above
0x08 UInt16 Index into the condition list. Indexes are always 1 apart (0x00, 0x02, 0x04, etc.).
Condition Types
ID Name Description
0x00 YesNo Result Shows the YesNo Layout and displays one of the YesNo Options
Requires a Message Node to come before it, or else the game will crash.
0x01 BranchFunc Object dependent. See Branch Functions
0x02 Player Distance Checks to see if the player is close enough to the NPC
0x03 SW_A Checks to see if the NPC's SW_A has been activated
0x04 SW_B Checks to see if the NPC's SW_B has been activated
0x05 Player Mode: Normal Checks to see if the Player has no powerup
0x06 Player Mode: Bee Checks to see if the Player has the Bee Mushroom
0x07 Player Mode: Boo Checks to see if the Player has the Boo Mushroom
0x08 Power Star Appeared Checks to see if the Power Star has spawned
0x09 Player Checks to see if the Player is Luigi
0x0A Cutscene Checks to see if a cutscene is currently active or not
0x0B Message Read Flag Checks to see if the Player has already read this message (needs verification)
0x0C 120 Star Ending Checks to see if the 120 star ending has been Achieved
0x0D Unknown Unknown
Only known to be used by King Whomp.
0x0E Player Mode: Yoshi Checks to see if the Player is riding Yoshi
0x0F Player Mode: Cloud Checks to see if the Player has the Cloud Flower
0x10 Player Mode: Rock Checks to see if the Player has the Rock Mushroom
YesNo Results

Below is a complete list of YesNo Results, and their button text.

ID Name Left Button Text (False) Right Button Text (True)
0x00 PichanRace Quit Race
0x01 TicoShopExchange No thanks Buy
0x02 TicoShopWhich 1-Up Life
0x03 Dreamer No Yes
0x04 SuperDreamer No Yes
0x05 MuimuiPlay No thanks OK
0x06 ScoreAttackPlay No Yes
0x07 ScoreAttackContinue Start over Continue
0x08 GliBirdRide No thanks Let's glide
0x09 TicoFatCoinGive No Yes
0x0A FireWoodBoxPlay No thanks Sure
0x0B GliBirdTutorial No thanks Tell me
0x0C LuigiTalkNPC No thanks OK
0x0D KinopioBank No thanks OK
0x0E LuckeyRoom Quit OK
0x0F MeisterTrade That's right Yes
0x10 TamakoroTutorial That's OK Tell me
0x11 MeisterConfirm That's right Yes
Branch Functions

Each branch function will take a single number as a parameter. if the table below lists the Parameter Name as "(none)" then you must pass in 0

Object Name Function Name Parameter Name Description
Caretaker (Gearmo) Caretaker::branchFuncComet Check ID Uses the parameter to determine which of 7 checks is performed on your current Purple Coin count. Valid values are 0, 1, 2, 3, 4, 5, and 6.
Caretaker (Gearmo) Caretaker::branchFuncStar (none) Checks to see if the Geamo's SW_A has been activated
CaretakerHunter (Gearmo Hunter) CaretakerHunter::branchFunc (none) Unknown
Kinopio (Toad) Kinopio::branchFunc Progress Check ID See MR::branchFuncGameProgress at the bottom of the table
KinopioBank (Banktoad) KinopioBank::branchFunc Check ID Unknown, valid values are 0, 1, 2, 3....and something over 10000
KinopioPostman (Mailtoad) KinopioPostman::branchFunc Check ID Unknown, valid values are 0, and 1.
KinopioPostman (Mailtoad) KinopioPostman::branchFuncLuigi (none) Unknown, only activates if the player is Luigi
LuigiIntrusively (The Luigi you can play as) LuigiIntrusively::branchFunc (none) Unknown, checks to see if Luigi is in a specific state
LuigiTalkNPC (Luigi NPC) LuigiTalkNPC::branchFunc Progress Check ID See MR::branchFuncGameProgress at the bottom of the table
MameMuimuiAttackMan
(The Chimp [Ice Skating])
MameMuimuiAttackMan::branchFunc Check ID 0 = Check the scorer object for Unknown1.
1 = Check the scorer object for Unknown2.
2 = Check the scorer object for a new high score.
Meister (Lubba) Meister::branchFunc Unknown Unknown, for some reason, this function is registered twice.
Moc (Whittle) Moc::branchFunc Check ID 0 = Unknown
1 = Unknown, Something related to how many purple coins you have
Pichan (Jibberjay) Pichan::branchFunc Check ID 0 = Unknown
1 = Checks to see if you have completed the Glider Tutorial.
2 = Unknown
PichanRacer (Jibberjay Racer) PichanRacer::branchFunc Check ID 0 = Unknown
1 = Checks to see if you have completed the Glider Tutorial.
2 = Unknown
ScoreAttackMan
(The Chimp [Score Attack])
ScoreAttackMan::branchFunc Check ID 0 = Checks to see if time is up.
1 = Checks to see if you have beaten the target score.
2 = Checks to see if you beat the high score.
3 = Checks to see if the stage is MokumokuValleyGalaxy (Fluffy Bluff).
4 = Checks to see if the stage is HoneyBeeVillageGalaxy (Honeyhop Galaxy).
Tico (Luma) Tico::branchFunc Progress Check ID See MR::branchFuncGameProgress at the bottom of the table
TicoFatCoin (Hungry Luma [Coins]) TicoFatCoin::branchFunc (none) Checks to see if you have the required amount of coins
TicoShop (Luma Shop) TicoShop::branchFunc (none) Checks to see if you have the required amount of starbits
TicoShopDice (Luma Shop [Chance Cubes]) TicoShopDice::branchFunc (none) Checks to see if you have the required amount of Currency (based on the object's arguments)
TogepinAttackMan
(The Chimp [Bowling])
TogepinAttackMan::branchFunc Check ID 0 = Check the scorer object for Unknown1.
1 = Check the scorer object for Unknown2.
2 = Check the scorer object for a new high score.
(none) MR::branchFuncGameProgress Progress Check ID Valid Values are 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.

EVENT Node Format

Offset Type Description
0x00 UInt16 Unused
0x02 UInt16 Event Type
0x04 UInt16 Next Flow Node ID
0x06 UInt16 Unused
0x08 UInt16 Event Parameter. What this is used for depends on the Event Type
Event Types
ID Name Description
0x00 EventFunc
(With Advance)
Object Dependent.
Will automatically advance to the next flow when the event completes.
0x01 EventFunc
(No Advance)
Object Dependent.
Will end the current talk session when the event completes.
0x02 (none) There is no action mapped to 0x02, so it just goes to the next flow node
0x03 Forward Flow Advances to the next node
0x04 AnimeFunc Object Dependent
0x05 SW_A Activate the NPC's SW_A
0x06 SW_B Activate the NPC's SW_B
0x07 KillFunc Object Dependent
0x08 SW_A Deactivate the NPC's SW_A
0x09 SW_B Deactivate the NPC's SW_B
0x0A Hide Talk Bubble Pointer Hides the little triangle that indicates the position of the speaker
0x0B Show Talk Bubble Pointer Shows the little triangle that indicates the position of the speaker

ENTRY Node Format

Offset Type Description
0x00 UInt16 Unused
0x02 UInt16 Next Flow Node ID
0x04 UInt16 Unused
0x06 UInt16 Unused
0x08 UInt16 Unused


FEN1

Header

Offset Type Description
0x00 String FEN1 in ASCII.
0x04 UInt32 Section size. Does not account for this header or padding.
0x08 Byte[0x8] Padding.

Data

Offset Type Description
0x00 UInt32 Entry Count
0x04 Byte[0x8] Padding
0x08 UInt32[Entry Count] Data Offsets.

After the data is written, there is a collection of Message Label Strings. After each string is padding to the nearest 0x04.

Offset Type Description
0x00 byte String Length
0x01 String[String Length] Text