Difference between revisions of "Binary Spiral Template"

From Spiral Framework
Jump to navigation Jump to search
(4 intermediate revisions by the same user not shown)
Line 69: Line 69:
  
 
===01 - Add Magic Number===
 
===01 - Add Magic Number===
Syntax: <code>00 [Magic Number]</code>
+
Syntax: <code>01 [Magic Number]</code>
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 78: Line 78:
 
!Name
 
!Name
 
|-
 
|-
|00
+
|00 || <code>4B 41 50 2E</code> || [[Pak]]
|<code>2E 50 41 4B</code>
+
|-
|Pak
+
|01 || <code>4E 49 4C 2E</code> || [[Lin]]
 +
|-
 +
|02 || <code>44 52 57 2E</code> || [[Word Script]]
 +
|-
 +
|03 || <code>44 52 53 2E</code> || [[Srd]]
 +
|-
 +
|04 || <code>49 44 52 53</code> || [[Srdi]]
 +
|-
 +
|05 || <code>56 44 52 53</code> || [[Srdv]]
 +
|-
 +
|style="text-align:center;" colspan="3" | ...
 +
|-
 +
|10 || <code>31 50 4C 2E</code> || Dr1 Loop
 +
|-
 +
|11 || <code>31 45 43 2E</code> || Dr1 Climax Episode
 +
|-
 +
|12 || <code>31 47 48 2E</code> || Dr1 Hangman's Gambit
 +
|-
 +
|13 || <code>31 44 4E 2E</code> || Dr1 Nonstop Debate
 +
|-
 +
|14 || <code>31 4F 52 2E</code> || Dr1 Room Object
 +
|-
 +
|style="text-align:center;" colspan="3" | ...
 +
|-
 +
|30 || <code>33 54 44 2E</code> || [[Data Table (V3)|V3 Data Table]]
 
|-
 
|-
 
|style="text-align:center;" colspan="3" | ...
 
|style="text-align:center;" colspan="3" | ...
Line 103: Line 127:
  
 
===02 - Iterate Subfiles===
 
===02 - Iterate Subfiles===
 +
Syntax: <code>02</code>
 +
 +
Indicates to the BstProcessor that we should begin iterating through the subfiles of this data.
 +
 +
Only works with [[Pak]] and [[Spc]] data files.
 +
 +
Use [[#04 - Break|Break]] to break out of the iteration.
  
 
===03 - Done===
 
===03 - Done===
 +
Syntax: <code>03</code>
 +
 +
Indicates to the BstProcessor that we are finished with our data, and to flush the output and move on.
  
 
===04 - Break===
 
===04 - Break===
 +
Syntax: <code>04</code>
 +
 +
Indicates to the BstProcessor to break out of the closest iteration '''without''' flushing output for the current entry.

Revision as of 15:31, 7 November 2019

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

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
...
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.