FANDOM


ScriptAsset Edit

ScriptAsset is the name used to refer to the compiled Black Ops III GSC files. These files are used by the engine on the server side to run the game. Source files are written in GSC scripting language, which are then compiled into files and packed into Fast Files by the Linker. These files are then loaded into memory upon loading the game and are read by the engine in real time.

File Structure Edit

Compiled GSC files have several distinct sections within the file:

  • Header
  • String Table
  • Include Pointers
  • Code Section
  • Export Section
  • Import Section
  • Animations Section
  • String Reference Section

These happen to be the same as in Black Ops II GSC, but have several changes included within each section.

HeaderEdit

The header consists of 0x48 bytes

  1. Magic (64 bits)
  2. Checksum (32 bits)
  3. Pointer to Includes Section (32 bits)
  4. Pointer to Animations Section (32 bits)
  5. Pointer to Code Section (32 bits)
  6. Pointer to String References Section (32 bits)
  7. Unknown 1 (32 bits)
  8. Pointer to Exports Section (32 bits)
  9. Pointer to Imports Section (32 bits)
  10. File Size 1 (32 bits)
  11. File Size 2 (32 bits)
  12. Unknown 2 (32 bits)
  13. Name Pointer (32 bits)
  14. Number of String Refs (16 bits)
  15. Number of Exports (16 bits)
  16. Number of Imports (16 bits)
  17. Unknown 3 (16 bits) - Potentially number of AnimRefs
  18. Unknown 4 (16 bits)
  19. Unknown 5 (16 bits)
  20. Number of Includes (16 bits)
  21. Unknown 6 (16 bits)

Magic Edit

  • The magic is the file identifier for the parser, which in Black Ops III is always the byte sequence:

0x80 0x47 0x53 0x43 0x0D 0x0A 0x00 0x1C

  • This is the easiest way to identify a GSC file in memory and only appears in ScriptAsset files

Checksum Edit

  • The checksum is not needed for reversing the file, but is present in every GSC file.
  • The method for computing the checksum is unknown at this point in time.

Pointer to Includes Section Edit

  • 32 bit value pointing to the start of the Includes Section

Pointer to Animations Section Edit

  • 32 bit value pointing to the start of the Animations Section.
  • Can be equal to the String Refs pointer if no anims are referenced.

Pointer to Code Section Edit

  • 32 bit value pointing to the start of the Code Section.

Pointer to String Reference Section Edit

  • 32 bit value pointing to the start of the String References Section

Unknown 1 Edit

  • 32 bit value that is always greater than or equal to the size of the file
  • It is currently unknown what this value represents

Pointer to Exports Section Edit

  • 32 bit value pointing to the start of the Exports Section
  • Value can be equal to the Exports Section Pointer if no exports exist

Pointer to Imports Section Edit

  • 32 bit value pointing to the start of the Imports Section
  • Value can be equal to the String Refs Pointer if no imports exist

File Size 1 and 2 Edit

  • 32 bit values that both represent the file size

Unknown 2 Edit

  • 32 bit value
  • It is currently unknown what this value represents, however it does not appear to represent a pointer nor a counter.

Name Pointer Edit

  • 32 bit value pointing to the null terminated string that represents the name of the GSC file being examined as it would appear in script parse tree

String Table Edit

  • List of null terminated strings
  • Each string is either a literal string from the script or an include path
  • Note: All variable references are no longer included in the local string table

Includes Section Edit

  • List of 32 bit integer pointers to each of the include strings' positions within the local string table

Code Section Edit

  • This is the most complex part of the Script Asset
  • This structure consists of the callstack of each function compiled in the GSC

Exports Section Edit

  • List of functions defined within the GSC in the following format

public class GSCExport

   public uint CRC32
   public uint FunctionStart
   public uint Function_Hash
   public uint Namespace_Hash
   public byte NumOfParams
   public byte ScriptFlags
   public ushort Padding

Imports Section Edit

  • List of locations and items that have been referenced external to the script that should be imported

public class GSCImport

   public uint Namespace_Hash
   public uint Function_Hash
   public ushort RefCount
   public byte NumOfParams
   public byte ScriptFlag
   public uint[] RefPosition

String Refs Section Edit

  • List of String Refereces in the script

public class StringRef

   public uint NamePtr
   public uint AmountOfRefs
   public uint[] RefLocations
   public string Name

Code Section Breakdown Edit

  • Code section has a list of function code which is seperated into OP codes and their respective parameters
  • Each function starts with a list of declarations of local variables and parameters