This tool generates offset gamedata files for AMX Mod X from debug information (PDB and DWARF).
-
Prerequisites:
- Get debug symbols for your mod.
- On Windows, compile the mod with Visual Studio in Release mode. Set Debug Information Format = Program Database (/Zi)
- On Linux, compile the mod with
-gcompiler argument - If using CMake, use RelWithDebInfo configuration
- Download amxx-offset-generator from Releases page on GitHub.
- Get debug symbols for your mod.
-
Retrieve the list of all classes that inherit from
CBaseEntityandCGameRules.For Half-Life, you can use the file in this repo:
test-data\class-list.txtFor other mods, you have to generate it youself.
-
Open hl.dll source code folder
-
In bash, run this to generate an intermediate class list.
egrep -hr 'class\s+(\w+)\s+:' | sort -u > class-list.txtIt should look like this:
class CAGrunt : public CSquadMonster class CActAnimating : public CBaseAnimating class CAirtank : public CGrenade class CAmbientGeneric : public CBaseEntity ... -
Use regex replacement in a text editor:
class\s+(\w+)\s+.*->$1 -
Add
CBaseEntityandCGameRulesmanually -
Remove
CRestore,CSave,CMultiplayGameMgrHelpermanually -
Sort the file
-
-
Run this command to generate Windows offsets:
OffsetGenerator.Pdb --class-list path-to/class-list.txt --pdb path-to/hl.pdb --out offsets_windows.json -
Run this command to generate Linux offsets:
OffsetGenerator.Dwarf --class-list path-to/class-list.txt --so path-to/hl.so --out offsets_linux.json -
Run this command to combine JSONs and generate AMXX gamedata. You can omit
--windowsor--linuxif you don't need offsets for one them.python scripts/create_amxx_files.py --windows=path-to/offsets_windows.json --linux=path-to/offsets_linux.json --out=path-to/valve/addons/gamedata/common.games/custom "--banner=Custom offsets for Mod Name, generated with amxx-offset-generator" --file-prefix=my-mod
Content Warning
C++ code in this project is awful. PDB format is unpleasant to work with and DWARF generator is full of memory leaks. Proceed with caution.
- Install vcpkg
- Run CMake with vcpkg's toolchain file
- Build the project