SCO

From GTAMods Wiki
Revision as of 10:54, 3 February 2009 by Sacky (talk | contribs)
Jump to navigation Jump to search

SCO files contain GTA 4's game scripts. Its new format replaces old scm one.

File Format

A SCO file is layed out into 4 segments. First the Header containing information about the SCO file. Then the Code Segment which contains the opcode's which govern how the script behaves. The next segment is the Local Variable container which contains enough space to hold the local variables. The last is the Global Variable container, which contains enough space to house the global variables, as well as setting them by default.

Header

There are 2 types of SCO files, an encrypted and unencrypted one. Each file however shares the same unencrypted header structure, and you can use this to determine which type of SCO file you are dealing with. The size of this header is 24 bytes.

4b - CHAR[4]/UINT32 - SCO Identifier
4b - UINT32 - Code Size
4b - UINT32 - Local Var Size
4b - UINT32 - Global Var Size
4b - UINT32 - Script Flags
4b - UINT32 - Signature

The SCO Identifier will be "SCR\r" (or 0xD524353) in an unencrypted version, and "scr"+0xE (or 0xE726373) in an encrypted version. The Code Size refers to the amount of bytes the code section takes