CS2ProtoMap is a lightweight protobuf reverse-engineering toolkit designed for Counter-Strike 2.
The goal of this project is to bridge the gap between:
- raw .proto definitions
- generated protobuf C++ code (.pb.h/.pb.cc)
- and actual runtime-compatible C++ memory layouts
Instead of interacting with protobuf messages using the normal generated API:
mutable_input_history()->Add()CS2ProtoMap focuses on generating low-level raw C++ structures suitable for:
reverse engineering SDK generation memory mapping runtime protobuf manipulation internal tooling CS2 research
The project parses protobuf definitions, compiles them using protoc, analyzes the generated C++ output, and produces simplified raw C++ header structures.
Why this project exists
Working with protobuf normally requires using the generated reflection/API layer.
Example:
msg->mutable_base()->set_tick(123);For reverse engineering and runtime tooling, this approach is often inconvenient because:
- protobuf internals are hidden
- memory layouts are abstracted
- repeated fields use custom containers
- offsets are not obvious
- direct memory manipulation becomes difficult
CS2ProtoMap exists to convert protobuf definitions into raw C++ structures closer to the actual in-memory representation used by CS2.
Example output:
struct CCSGOUserCmdPB : PBMessage
{
RepeatedPtrField_t<CCSGOInputHistoryEntryPB> input_history;
CBaseUserCmdPB* base;
bool left_hand_desired;
};This allows direct runtime access and easier reverse engineering workflows.
- Download .proto files from URLs
- Resolve local .proto files
- Compile protobufs automatically using protoc
- Parse generated .pb.cc/.pb.h
- Generate raw C++ headers
- One-file or per-module output
- Zero Python dependencies (built-in libraries only)
CS2ProtoMap [options] inputs...Example:
python main.py \
https://github.com/SteamTracking/GameTracking-CS2/raw/refs/heads/master/Protobufs/cs_usercmd.proto \
https://raw.githubusercontent.com/SteamTracking/GameTracking-CS2/refs/heads/master/Protobufs/usercmd.proto \
https://raw.githubusercontent.com/SteamTracking/GameTracking-CS2/refs/heads/master/Protobufs/network_connection.proto \
https://raw.githubusercontent.com/SteamTracking/GameTracking-CS2/refs/heads/master/Protobufs/networkbasetypes.proto \
--protoc-path protoc.exe \
--hpp-out output/inputs
List of .proto files or URLs.
Examples:
CS2ProtoMap cs_usercmd.proto
CS2ProtoMap a.proto b.proto
CS2ProtoMap https://example.com/test.proto--workdir
Working directory used for:
- downloaded .proto files
- generated .pb.cc/.pb.h
- temporary artifacts
Example:
--workdir workspace/--log
Sets log verbosity.
Available levels:
debug info warn error
Example:
--log debug--force-proto
Ignore existing .proto files inside the workspace and always re-fetch or re-copy inputs.
Useful when updating protobuf definitions.
Example:
--force-proto--protoc-path
Path to protoc.exe or protobuf compiler executable.
Example:
--protoc-path protoc.exe
--protoc-path C:/protobuf/bin/protoc.exe--force-compile
Force recompilation even if .pb.cc/.pb.h files already exist in the workspace.
Example:
--force-compile--hpp-out
Generated C++ header output destination.
Behavior depends on the path type:
Directory → separate module files
--hpp-out output/Produces:
output/
├── cs_usercmd.hpp
├── netmessages.hpp
└── engine_gcmessages.hpp
File → single combined header
--hpp-out sdk.hppProduces:
sdk.hpp
containing all generated enums and classes.
.proto
↓
protoc
↓
.pb.cc / .pb.h
↓
CS2ProtoMap parser
↓
Raw C++ generator
↓
.hpp output
This is still an early-stage project.
Current generator behavior is intentionally simplified and may not perfectly match protobuf runtime internals yet.
Known limitations:
- no padding comment generation
- partial protobuf feature coverage
- no reflection support
- repeated field layouts are simplified
Customization
- Rename classes, fields, types...
- Change field name letter case (camelCase, snakeCase, ...)
- Add custom template file (Add method to specific class automaticly)
- Ignore classes
Tooling
- JSON and other language export
- smart generate (generate files if there are changes)