Decompilation of Portal 2 using IDA Pro 9.4 + Hex-Rays Decompiler.
| Metric | Value |
|---|---|
| Modules | 52 |
.cpp files |
27,639 |
.h files |
27,691 |
| Functions | ~78,000 |
| Coverage | ~99.99% |
| Size (decompiled files) | 0.64 GB |
Open Portal2.sln in Visual Studio 2022. All 52 modules load as separate projects.
Use Ctrl+Shift+F for cross-project search.
Alternatively, open any folder in src/ with your editor of choice.
├── src/ # Decompiled .cpp and .h
├── src_clean/ # Restoration of decompiled sources
├── projects/ # .vcxproj per module
├── projects_clean/
├── logs/ # Hung function lists
├── valve/ # Index of Valve source folders (not actual sources)
├── tools/ # Automation scripts used to build this repo
├── Portal2.sln # Visual Studio 2022 solution
├── Portal2_clean.sln
├── LEGAL.md
| Script | Purpose |
|---|---|
export_all.py |
IDA-side decompiler (Hex-Rays -> per-class .cpp/.h) |
split_merged_funcs.py |
Splits merged_funcs.cpp into per-class files |
regenerate_vcxproj.py |
Rebuilds .vcxproj with full file list from src/ |
fix_vcxproj.py |
Fixes duplicates in generated .vcxproj |
Use Portal2_clean.sln to restore files corrupted by Hex-Rays Decompiler.
After implementing the class, it is recommended to delete the *_PanelMessageFunc_* and $00* files.
For reverse engineering training materials and guides, visit the Hex-Rays Documentation.
- Get Portal 2
.dll+ matching.pdbfiles - Create IDA
.i64databases - Run
export_all.pyinside IDA for each module - Run
split_merged_funcs.pyto organize output - Run
regenerate_vcxproj.pyto update project files
- Statically linked libraries (tier0, tier1, mathlib) are duplicated across modules
- Project structure follows DLL boundaries, not Valve's original source tree
binkw32has 28.5% named functions (PDB mismatch)- 5 functions skipped due to Hex-Rays hangs (see
logs/*_hung_functions.txt)
See LEGAL.md.