Skip to content
ipfsd-accPublic

About

Portal 2 Reverse Engineering project

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

p2-decomp

Decompilation of Portal 2 using IDA Pro 9.4 + Hex-Rays Decompiler.

Stats

Metric Value
Modules 52
.cpp files 27,639
.h files 27,691
Functions ~78,000
Coverage ~99.99%
Size (decompiled files) 0.64 GB

How to Browse

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.

Directory Structure

├── 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

Scripts

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

How to contribute

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.

How to rebuild from scratch

  1. Get Portal 2 .dll + matching .pdb files
  2. Create IDA .i64 databases
  3. Run export_all.py inside IDA for each module
  4. Run split_merged_funcs.py to organize output
  5. Run regenerate_vcxproj.py to update project files

Limitations

  • Statically linked libraries (tier0, tier1, mathlib) are duplicated across modules
  • Project structure follows DLL boundaries, not Valve's original source tree
  • binkw32 has 28.5% named functions (PDB mismatch)
  • 5 functions skipped due to Hex-Rays hangs (see logs/*_hung_functions.txt)

License

See LEGAL.md.

About

Portal 2 Reverse Engineering project

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages