SourceMod gamedata checker.

nosoop edab5930bf Add usage and configuration 10 meses atrás
src 4b2aa978bc Split out overload disamb and unique pass 10 meses atrás
tests 836279d2eb Finish migrating vtable helpers to disambiguator 10 meses atrás
.gitignore 2ca53b9168 Add TF2 server binary vtable test 10 meses atrás
.justfile f6e4a2cd4b Add mypy checking to test dir and prioritize over pytest 10 meses atrás
README.md edab5930bf Add usage and configuration 3 meses atrás
pyproject.toml 2ca53b9168 Add TF2 server binary vtable test 10 meses atrás

README.md

smgdc

SourceMod gamedata checker.

Rewrite of a previous internal project. Faster. Stronger. More maintainable.

Usage

smgdc <specfile> --add-binary <binary> --add-binary <binary> ...

  • specfile is a specification file or directory (tree) containing specification files.
  • --add-binary specifies one or more binaries to add for checking.
    • This may be a os.pathsep-separated pair of values that map a physical file to one present in the specification file.

Specification file

A specification file is an INI configuration file used to check aspects of one or more binary (code) files.

Example:

; reports presence of a byte sequence in the Windows server binary, yielding signature
[CWeaponMedigun::SecondaryAttack()]
target = bin/tf/server.dll
type = bytesig
contents = 55 8B EC 56 8B 75 08 85 F6 0F 84 ?? ?? ?? ?? 53

; reports that a given immediate value in code is at a given location, yielding offsets, etc.
[CTFProjectile_Flare::Explode_Air()::SelfDamageRadius LINUX]
target = bin/tf/server_srv.so
type = value
symbol = _ZN19CTFProjectile_Flare11Explode_AirEP10CGameTraceib
offset = 0x468
struct = <f
assert = value == 100.0

; reports the presence of a symbol in a given vtable, yielding offset for Windows / Linux
[CBaseEntity::GetEnemy()]
target = bin/tf/server_srv.so
type = vfn
vtable = 11CBaseEntity
symbol = _ZN11CBaseEntity8GetEnemyEv

The entries specify a section name (must be unique within the file), a target binary's subpath to match against, a type of specification to check for, and additional information for a particular specification type.

This allows the validation process to be more flexible than a gameconf file is on its own, as that tells you nothing about the context (is the offset for a virtual file? a property?).

Types of specifications include:

  • value: reads out a value from a binary
  • bytesig: confirms the presence of a byte sequence
  • vfn: takes a virtual method symbol and gets the vtable index for it on Linux and Windows (guesstimate on the latter)