Binary Spiral Template

From Spiral Framework
Revision as of 21:09, 17 November 2019 by UnderMybrella (talk | contribs) (→‎01 - Add Magic Number)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Binary Spiral Templates (BST) are template files that use a set of opcodes to modify files to fit a certain binary format. These are used by Spiral to coerce some format files into being more easily and sanely recogniseable (such as Pak archives).


Specification

BST Opcodes
Hex Opcode Name Argument Count Comments
00 Parse Data As 1
01 Add Magic Number 1
02 Iterate Subfiles 0
03 Done 0
04 Break 0 Does not flush output
05 Skip 0
06 Flush 0

Opcodes

00 - Parse Data As

Syntax: 00 [File Type]

Parses the data as a certain type. Primarily used to iterate through sub-entries.

Magic Numbers
Hex Value Name
00 Pak
01 Spc
...
FF (Raw)

01 - Add Magic Number

Syntax: 01 [Magic Number]

Magic Numbers
Hex Opcode Hex Magic Number (LE) Name
00 4B 41 50 2E Pak
01 4E 49 4C 2E Lin
02 44 52 57 2E Word Script
03 44 52 53 2E Srd
04 49 44 52 53 Srdi
05 56 44 52 53 Srdv
06 See Here TGA
...
10 31 50 4C 2E Dr1 Loop
11 31 45 43 2E Dr1 Climax Episode
12 31 47 48 2E Dr1 Hangman's Gambit
13 31 44 4E 2E Dr1 Nonstop Debate
14 31 4F 52 2E Dr1 Room Object
...
30 33 54 44 2E V3 Data Table
...
FC N/a (Raw Int8)
FD N/a (Raw Int16)
FE N/a (Raw Int32)
FF N/a (Raw Int64)

02 - Iterate Subfiles

Syntax: 02

Indicates to the BstProcessor that we should begin iterating through the subfiles of this data.

Only works with Pak and Spc data files.

Use Break to break out of the iteration.

03 - Done

Syntax: 03

Indicates to the BstProcessor that we are finished with our data, and to flush the output and move on.

04 - Break

Syntax: 04

Indicates to the BstProcessor to break out of the closest iteration without flushing output for the current entry.