-
-
Notifications
You must be signed in to change notification settings - Fork 13
File structure ‐ ACTS GSC Debug File
The acts GSC debug file format is a format to describe the GSC scripts compiled using the acts gsc compiler using the -d --debug option.
These information can be used by a custom gsc linker to provide more features. (detours, dev blocks, better log messages, unhashed strings, etc.) The decompiler can also read these information.
The header is first composed of these field:
- file magic
0x0d0a42444124(64 bits integer) - file version (8 bits integer)
- padding (24 bits)
- flags (32 bits integer)
- acts version (64 bits integer)
Depending on the file version, the header can then have these fields:
- strings offset (32 bits integer)
- strings count (32 bits integer)
- detours offset (32 bits integer)
- detours count (32 bits integer)
- dev blocks offset (32 bits integer)
- dev blocks count (32 bits integer)
- lazy links offset (32 bits integer)
- lazy links count (32 bits integer)
- checksum offset (32 bits integer)
- dev strings offset (32 bits integer)
- dev strings count (32 bits integer)
- source lines offset (32 bits integer)
- source lines count (32 bits integer)
- source files offset (32 bits integer)
- source files count (32 bits integer)
- checksum (32 bits integer)
The flags are defining the compilation information
| Value | Name | Description |
|---|---|---|
| 0x0001 | Obfuscated | obfuscated option was used |
| 0x0002 | Debug | debug option was used |
| 0x0004 | Client | This is a client script |
The 7th bits to 9th (included) are used to describe the compilation platform. See gsc_opcodes_load.hpp for a platform list.
The strings table can be obtained at the index described by strings offset and contains strings count strings.
A string is a 32 bits integer representing the string location in the debug file.
It can be used to unhash the different hashes of the script.
The detours table can be obtained at the index described by detours offset and contains detours count detours.
A detour is defined by this structure
- hashed function namespace (64 bits integer)
- hashed function name (64 bits integer)
- hashed function script (64 bits integer)
- detour stub location in the gsc file (32 bits integer)
- detour stub size (32 bits integer)
It can be used to implement function detours within a custom linker.
The dev blocks table can be obtained at the index described by dev blocks offset and dev blocks count dev blocks.
A dev block is a 32 bits integer representing the opcode location in the gsc file.
It can be used to replace the begin dev block opcodes with custom ones or to nop them.
The lazy links table can be obtained at the index described by lazy links offset and lazy links count dev blocks.
A lazy link is defined by this structure
- lazy link function namespace (64 bits integer)
- lazy link function name (64 bits integer)
- lazy link function script (64 bits integer)
- number of addresses (32 bits integer)
then number of addresses times 32 bits integer representing the opcode location in the gsc file.
It can be used to replace the lazy links operation with prelinked links, reducing the overhead of constantly searching the same functions.
Not to be confused with the checksum. The checksum offset is the address of the checksum data in the gsc script.
Depending on the game, it has a different meaning
- MWIII and after: Address of the string to set the checksum value, the string max size is at least 20 characters.
- CW: Address of the checksum emit opcode.
If no checksum was provided during the compilation and the injector replace a particular script, its checksum should be replaced.
The dev strings table isn't used anymore.
The source lines table can be obtained at the index described by source lines offset and contains source lines count lines.
A line is defined by this structure
- start offset in the gsc file (32 bits integer)
- end offset in the gsc file (32 bits integer)
- line number in the source file (64 bits integer)
It can be used to know the location in the source script of an opcode.
The source files table can be obtained at the index described by source files offset and contains source files count files.
A file is defined by this structure
- file name offset in the debug file (32 bits integer)
- line start (64 bits integer)
- line end (64 bits integer)
It can be used to know the name of a file for a particular line.
Not to be confused with the checksum offset. The checksum is the checksum of the gsc script.
It can be used to validate that a debug file is corresponding to a gsc script.
- AtianTools
- Atian Tools UI
- Game Script Code (GSC)
- Fast Files (FF)
- File Structure
- Other Utilities
- Developer