SB file type
General Info[edit | edit source]
Sb files are SPC binary format files that sunshine reads during gameplay in order to control and manage custom events. They are level-specific and loaded on level start, some common examples being talkevent.sb and redcoin.sb (Controls npc dialogue messages and red coin shine spawning respectively)
File Structure * Header * Text (.text) * Data (.data) * Sym (.sym) * Variables
Header Section[edit | edit source]
Intro part of the file, holds info about the future sections of the file
| Section Offset | Byte Length | Description |
|---|---|---|
| 0x00 | 4 | Magic (always SPCE): char[4] |
| 0x04 | 4 | .text Offset: uint32 |
| 0x08 | 4 | .data Offset: uint32 |
| 0x0c | 4 | .data Count: uint32 |
| 0x10 | 4 | .sym Offset: uint32 |
| 0x14 | 4 | .sym Count: uint32 |
| 0x18 | 4 | Var Count: uint32 |
Text Section[edit | edit source]
These are the assembly instructions that the game will read. Each byte corresponds with the chart below specifying the assembly info (For layers: 0x00 = Script, 0x01 = Local Function)
| OP | Layout | Type |
|---|---|---|
| 0x00 | int32 | Integer(int32) |
| 0x01 | flt32 | Float |
| 0x02 | uint32:.data ID | String |
| 0x03 | int32 | Address |
| 0x04 | uint32:Layer/VarID | Variable |
| 0x05 | Instruction | No Operator |
| 0x06 | var | Increment |
| 0x07 | var | Decrement |
| 0x08 | Instruction | Add |
| 0x09 | Instruction | Subtract |
| 0x0A | Instruction | Multiply |
| 0x0B | Instruction | Divide |
| 0x0C | Instruction | Modulo |
| 0x0D | var | Assign |
| 0x0E | Instruction | Equal |
| 0x0F | Instruction | Not Equal |
| 0x10 | Instruction | Greater Than |
| 0x11 | Instruction | Modulo |
| 0x12 | Instruction | Greater or Equal |
| 0x13 | Instruction | Less or Equal |
| 0x14 | Instruction | Negative |
| 0x15 | Instruction | Not |
| 0x16 | Instruction | And |
| 0x17 | Instruction | Or |
| 0x18 | Instruction | bitwise-And |
| 0x19 | Instruction | bitwise-Or |
| 0x1A | Instruction | bit-shift Left |
| 0x1B | Instruction | bit-shift Right |
| 0x1C | uint32:.text Offset/Count | Local Function Call |
| 0x1D | uint32:.sym ID/Var Count | Built-in Function |
| 0x1E | uint32:Count | Make Frame |
| 0x1F | uint32:Count | Make Dataset? (mkds) |
| 0x20 | Instruction | Return |
| 0x21 | Instruction | Return 0 |
| 0x22 | uint32:Offset | Jump if not equal |
| 0x23 | uint32:Offset | Jump |
| 0x24 | Instruction | Pop |
| 0x25 | Instruction | Integer(0/false) |
| 0x26 | Instruction | Integer(1/true) |
| 0x27 | Instruction | End of Script |
Data Section[edit | edit source]
Contains the strings that the file uses, stored in reverse order of their appearance.
Section Structure * Offsets (array of uint32 offsets for each string entry) * Strings (string data, a byte of padding separates each one)
Sym Section[edit | edit source]
Contains an array of entries that contain the information
| Entry Offset | Byte Length | Description |
|---|---|---|
| 0x00 | 4 | Type: uint32 (0x00 Built-in Function, 0x01 Local Function, 0x02 Variable) |
| 0x04 | 4 | Offset to string: uint32 (0x00 .sym ID, 0x01 Offset in .text, 0x02 Variable ID) |
| 0x08 | 4 | Runtime Field (Hash): uint32 |
| 0x0c | 4 | Runtime Field (Function Pointer): uint32 |
Variable Section[edit | edit source]
Contains the names of variables the file uses, a byte of padding separates each one