Sly 2:SEQ
| Data Structure | |
|---|---|
| Game | Sly 2: Band of Thieves |
SEQ structs contain sequences of instructions to execute in a row. The "macro" entity contains most of them, however other entities such as "rig" also contain them. Each instruction takes up 0x50 bytes and have varying data fields acting as variables. The resulting structs take the form of scripts which are either executed by Circle Button Interacts, automatically via Splice code, or by other scripts. SEQ scripts, DAG nodes, and Splice code are the foundation of jobs. A list of instructions, which contains a good amount of the official names from the March 17 Internal Build, can be found here:
https://docs.google.com/spreadsheets/d/1vdh0hjwyXZJuyFye2jZrzyotmysCFAu7bdfHFcta-18/edit?usp=sharing
A full script dump by Slynders can be found here, which is WIP as pointers and names are slowly being added:
https://docs.google.com/spreadsheets/d/1Gj-oBYNsSXcI1lrf25i0JnSFEFRXSXKRa7pcuYTqBg0/edit?usp=sharing
Fields
The SEQ struct has the following fields:
| Offset | Size | Type | Name | Notes |
|---|---|---|---|---|
| 0x0 | 4 | int
|
Splice Pointer
|
Pointer to relevant Splice code if applicable |
| 0xC | 4 | int
|
Function Pointer
|
Pointer to programming which dictates functionality of the struct |
| 0x14 | 4 | int
|
Temp Storage
|
Pointer to a group of 5 ints used as temporary data storage |
| 0x18 | 4 | int
|
OID
|
Object ID |
| 0x20 | 4 | int
|
Next Same Entity
|
Pointer to next entity of the same type |
| 0x24 | 4 | int
|
Next Entity
|
Pointer to next entity |
| 0x28 | 4 | int
|
Previous Entity
|
Pointer to previous entity |
| 0x2C | 4 | int
|
Spawn Flags
|
Flags related to the entity's current state |
| 0x30 | 4 | int
|
Unknown
|
Always 0x7F7FFFFF |
| 0x38 | 4 | float
|
View distance
|
Distance at which the object stops rendering (always 10000000000 for scripts) |
| 0x3C | 4 | int
|
Entity List
|
Pointer to the entity list (FK$X) |
| 0x40 | 4 | int
|
Unknown
|
Usually 0x21, but fills with a pointer when in use |
| 0x50 | 4 | int
|
Number of Instructions to Run
|
The number of instructions that the script should run before ending |
| 0x54 | 4 | int
|
First Instruction
|
Pointer to the address of the first instruction |
| 0x58 | 4 | int
|
Total Number of Instructions
|
This should be the same amount as offset 0x50 |
| 0x64 | 4 | int
|
Unknown
|
https://imgur.com/a/KXxfX6F |
| 0x70 | 4 | float
|
Runtime
|
Continues to count up as long as the script is running, 0 before and after running |
| 0x74 | 4 | int
|
Script Finished
|
0x1 if the finished running, 0x0 if still running |
| 0x78 | 4 | int
|
Script Running
|
0x1 ifs currently running, 0x0 if not running or has finished |
| 0x7C | 4 | int
|
Script Ready
|
0x1 if not started yet, 0x0 if started |
Unlike every other type of data struct, new SEQ scripts can be created in codecaves and ran via methods that use a pointer to dictate which script to run, albeit with offsets 0x18, 0x20, 0x24, and 0x0x28 non-functional, meaning it cannot be called using its OID. However, as long as it's set up correctly, it will run if called, and does not require a map reload to be treated as a functional script.
Note that the pointer at offset 0x14 can point to any location, even a codecave. The value at this pointer must then contain a pointer to the start of the script. An example of a custom SEQ script can be seen below: