Skip to content

Repository files navigation

TF2 Steam Overlay Hook

A professional Steam overlay renderer for Team Fortress 2 with ImGui integration and OBS streaming support.

Security Notice

This is a defensive security research tool for understanding overlay hooking techniques. Use responsibly and only for legitimate purposes.

Features

  • 64-bit Steam Overlay Hooking: Direct integration with Steam's overlay system
  • Pattern-Based Detection: Robust pattern scanning instead of hardcoded offsets
  • OBS Stream-Proof: Invisible to OBS - streams see clean gameplay while player sees overlay
  • Professional Architecture: Clean, maintainable codebase with proper documentation
  • ImGui Integration: Modern immediate-mode GUI for overlay rendering
  • Comprehensive Logging: Detailed logging system for debugging and monitoring

Architecture

TF2SteamOverlay/
├── src/
│   ├── core/           # Core application logic
│   ├── hooks/          # DirectX function hooking
│   ├── ui/             # User interface rendering
│   └── utils/          # Utility functions
├── include/            # Header files (mirrors src structure)
├── external/           # Third-party dependencies (ImGui)
├── docs/              # Documentation
└── build/             # Build artifacts

Building

Requirements

  • Visual Studio 2022 (v143 toolset)
  • Windows SDK 10.0 or later
  • C++17 support

Build Steps

  1. Clone the repository
  2. Open TF2SteamOverlay.sln in Visual Studio
  3. Select x64 platform (32-bit not supported)
  4. Build in Release or Debug configuration

Output

  • Debug: bin/x64/Debug/TF2SteamOverlay_d.dll
  • Release: bin/x64/Release/TF2SteamOverlay.dll

Configuration

The overlay system uses pattern scanning to locate Steam overlay functions. Patterns are defined in include/core/Config.h and updated for Steam's new hooking architecture (2025):

namespace Patterns {
    // Updated patterns for Steam's FUN_1800899e0 hooking system
    constexpr const char* PRESENT_STORAGE = "48 8B ? 88 00 00 00 E8";
    constexpr const char* RESET_STORAGE = "48 8B ? 80 00 00 00 E8";
}

Pattern Evolution

  • Legacy patterns (pre-2025): Direct function pointer access
  • Current patterns (2025+): Hook registration function calls with offset parameters
  • Detection method: Pattern scanning + LEA instruction extraction for actual function addresses

Usage

  1. Inject the DLL into Team Fortress 2 process
  2. The overlay will automatically initialize when Steam overlay is ready
  3. Press F1 to toggle overlay visibility
  4. Press Insert to toggle the main menu

OBS Integration

The overlay includes stream-proof functionality:

  • Automatically detects OBS graphics hooks
  • Sends clean frames to OBS before rendering overlay
  • Completely invisible to streaming software
  • No impact on stream quality or performance

Logging

Debug logs are written to:

  • Console: Real-time output during development
  • File: C:\temp\tf2_steam_overlay.log
  • Debug Output: Visual Studio output window

Development

Pattern Discovery

Use Ghidra or similar tools to analyze gameoverlayrenderer64.dll:

  1. Load the DLL in Ghidra
  2. Search for offset values 80 00 00 00 and 88 00 00 00 in memory
  3. Locate MOV + CALL instruction sequences that load these offsets
  4. Extract LEA instructions that load the actual Steam function addresses
  5. Update patterns in Config.h following the format: 48 8B ? [offset] 00 00 00 E8

Adding Features

  1. Follow the established namespace structure
  2. Add header declarations in include/
  3. Implement functionality in corresponding src/ directory
  4. Update project file with new source files
  5. Document all public interfaces

Safety & Security

  • Read-Only Memory Scanning: Only scans for patterns, no arbitrary memory modification
  • Validation: All memory accesses are validated before use
  • Exception Handling: Graceful error handling prevents crashes
  • Steam Compliance: Works within Steam's overlay architecture

License

MIT License - see LICENSE file for details.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Follow existing code style and documentation standards
  4. Test thoroughly with TF2
  5. Submit a pull request

Troubleshooting

Common Issues

Overlay not appearing:

  • Ensure Steam overlay is enabled in TF2
  • Check debug logs for initialization errors
  • Verify TF2 is running in 64-bit mode

Pattern not found:

  • Steam overlay updated - patterns need updating
  • Use Ghidra to find new function locations
  • Update patterns in Config.h

OBS not detecting clean frames:

  • Ensure OBS is using game capture
  • Check that graphics-hook64.dll is loaded
  • Verify pattern matching in logs

Version History

  • v2.1.0 (2025-08-01): Updated for Steam's new hooking architecture
    • Fixed compatibility with current Steam builds
    • Simplified pattern detection using working patterns only
    • Improved ImGui initialization and crash prevention
    • MinHook integration for robust function hooking
  • v2.0.0: Complete rewrite with professional architecture
  • v1.x: Legacy versions (deprecated)

About

Steam overlay renderer for Team Fortress 2 with ImGui integration and OBS streaming support — defensive research into overlay hooking

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages