-
Notifications
You must be signed in to change notification settings - Fork 0
Extra Info Format
Sanny Builder stores scripts metadata when Add extra info option is enabled. This metadata gets added at the very end of the compiled file directly following the last opcode. It exploits the fact that the last opcode must be the goto instruction or the script terminator command otherwise the game would crash here trying to read the next opcode.
A script with the Extra Info section is structured in the following way
OFFSET TYPE DESCRIPTION
0000 byte[n] script section (compiled opcodes)
n byte[m] extra info section
n+m DWORD extra info section start offset (n)
n+m+4 CHAR[8] __SBFTR
__SBFTR
is the null-terminated string literal (8 bytes) that signals the disassembler that the preceding chunk of data is the Sanny's extra info section. If the literal is not __SBFTR
the disassembler treats the whole file as compiled code.
This section starts at the Xth byte from the beginning of the file where X is a DWORD number stored at offset 12 from the end of the file. It may contain zero to many subsections each with the following format:
OFFSET TYPE DESCRIPTION
0000 CHAR[n] a null-terminated subsection signature
n byte[nn] extra info subsection
The order of subsections is undetermined. Currently known and supported subsection signatures are:
- HEX
- VAR
- FLAG
- SRC
- AAA*
- E*
* deprecated
Keeps information about HEX..END structs used in the script. Each record contains the starting offset of the struct in the code and its size.
OFFSET TYPE DESCRIPTION
0000 DWORD number of records (n)
0004 Hex[n] a list of records, see below the individual record format
Hex:
OFFSET TYPE DESCRIPTION
0000 DWORD offset
0004 DWORD size
This subsection indicates that the AAA
script in the script.img
is user-made (as opposed to the automatically generated AAA script that serves for compatibility with the original GTA SA scripts). Deprecated, see the Flags subsection.
This subsection indicates that this script is headerless, e.g. a CLEO script. Deprecated in favor of the Flags subsection. See also Skip SCM Header.
This subsection keeps custom global variables used in the script along with their names.
OFFSET TYPE DESCRIPTION
0000 DWORD number of variables (n)
0004 Variable[n] a list of records, see below the individual record format
Variable:
OFFSET TYPE DESCRIPTION
0000 CHAR[n] a null-terminated variable name literal
n DWORD variable index
This section contains various DWORD numbers used to toggle different Sanny options.
OFFSET TYPE DESCRIPTION
0000 DWORD the target game for the disassembler
1 = GTA 3
2 = Vice City
4 = San Andreas
8 = LCS
16 = VCS
32 = SA Mobile
0004 DWORD custom AAA script flag (a replacement for the AAA Subsection)
0008 DWORD is headerless script flag (a replacement for the E subsection).
This section stores the unmodified source code used as is by the disassembler.
OFFSET TYPE DESCRIPTION
0000 CHAR[n] a null-terminated string representing the source code of the script