OpenCoD2-Plus
Call of Duty 2 client & server, rebuilt
Loading...
Searching...
No Matches
check_var_sizes Namespace Reference

Functions

 declared (readelf, path)
 main ()

Variables

 ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

Detailed Description

Lists the engine's globals that are used as larger than they are defined.

    python3 scripts/check_var_sizes.py <build_dir> [--binary NAME] [--readelf READELF] [-v]

Much of the engine's data is defined in src/blobs and src/stubs as byte
arrays the size of the original binary's, and declared where it is used with
its type. When the type is larger, the code reads and writes past the array,
over whatever the linker put next: the 1.0 client's cls was 162 KB short of a
clientStatic_t, and its debug lists lay over the renderer's entity lighting.
This reads the DWARF of the build's objects (built with -g) for every
declaration of a global with its type's size, and the binary's symbol table
(nm) for the size each global has, and lists the globals some object declares
larger. Exits with 0 when there are none.

Function Documentation

◆ declared()

check_var_sizes.declared ( readelf,
path )
[(name, size)] of the globals the object declares with a sized type.

◆ main()

check_var_sizes.main ( )

Variable Documentation

◆ ROOT

check_var_sizes.ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))