# izawartka/gta2-trainer-cpp architecture

> Architecture diagram of the GitHub repository izawartka/gta2-trainer-cpp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/izawartka/gta2-trainer-cpp
- Repository: https://github.com/izawartka/gta2-trainer-cpp

## Overview

This is a Windows/MFC GTA2 trainer DLL: the user manipulates gameplay through trainer dialogs while GTA2 is running, and the trainer reads or changes GTA2 state through fixed-address game bindings and hooks. The principal workflow branches into player/vehicle controls, spawning and AI setup, camera/render changes, and live entity inspection. The README documents additional gameplay controls that the sampled excerpts do not fully expose; those are represented at the MainWindow level. Edges reflect only documented behavior and visible calls; unsampled implementation limits finer wiring.

Main entry points: [`MainWindow.cpp`](https://github.com/izawartka/gta2-trainer-cpp/blob/master/MainWindow.cpp) (Trainer controls), [`gta2-helper.h`](https://github.com/izawartka/gta2-trainer-cpp/blob/master/gta2-helper.h) (GTA2 bindings), [`LiveTable/LiveTableWindow.cpp`](https://github.com/izawartka/gta2-trainer-cpp/blob/master/LiveTable/LiveTableWindow.cpp) (Live entity table), [`CameraHooks.cpp`](https://github.com/izawartka/gta2-trainer-cpp/blob/master/CameraHooks.cpp) (Camera transforms)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Trainer interface"]
  node_main["Trainer controls<br/>[MainWindow.cpp]"]
  node_ped_dialog["Ped spawner"]
  node_camera_dialog["Camera controls<br/>[CameraWindow.cpp]"]
  node_acs_dialog["Advanced settings<br/>[ACSWindow.cpp]"]
end

subgraph group_gameplay["Gameplay controls"]
  node_vehicle_player["Player and vehicle edits<br/>[MainWindow.cpp]"]
  node_ped_spawn["Ped creation and AI"]
  node_game_actions["Gameplay actions<br/>[MainWindow.cpp]"]
end

subgraph group_render["Camera and rendering"]
  node_camera_logic["Camera transforms<br/>[CameraHooks.cpp]"]
  node_render_hooks["Render hooks<br/>[Hooks.cpp]"]
end

subgraph group_inspection["Live inspection"]
  node_live_window["Live entity table"]
  node_column_editor["Column editor"]
  node_live_helper["Entity memory reader"]
  node_live_data["Table field definitions<br/>[LiveTableData.cpp]"]
end

subgraph group_integration["Game integration"]
  node_game_bindings["GTA2 bindings<br/>[gta2-helper.h]"]
  node_game_layout["GTA2 memory layouts<br/>[gta2.h]"]
  node_hook_helper["Hook utilities<br/>[HookHelper.cpp]"]
end

node_user(("Trainer user"))
node_gta2(("GTA2 runtime"))

node_user -->|"uses controls"| node_main
node_main -->|"edits gameplay"| node_vehicle_player
node_main -->|"dispatches actions"| node_game_actions
node_main -->|"opens spawner"| node_ped_dialog
node_ped_dialog -->|"submits settings"| node_ped_spawn
node_main -->|"opens controls"| node_camera_dialog
node_camera_dialog -->|"sets camera options"| node_camera_logic
node_main -->|"opens settings"| node_acs_dialog
node_main -->|"opens table"| node_live_window
node_live_window -->|"opens editor"| node_column_editor
node_column_editor -->|"updates columns"| node_live_window
node_live_window -->|"reads entity data"| node_live_helper
node_live_helper -->|"uses field offsets"| node_live_data
node_live_helper -->|"indexes game structures"| node_game_layout
node_main -->|"calls game functions"| node_game_bindings
node_vehicle_player -->|"uses game bindings"| node_game_bindings
node_ped_spawn -->|"spawns and configures"| node_game_bindings
node_game_actions -->|"invokes game actions"| node_game_bindings
node_game_bindings -->|"reads and writes"| node_gta2
node_camera_logic -->|"installs hooks"| node_hook_helper
node_render_hooks -->|"patches call sites"| node_hook_helper
node_hook_helper -->|"patches runtime"| node_gta2
node_camera_logic -->|"reads camera state"| node_gta2
node_render_hooks -->|"intercepts rendering"| node_gta2

click node_main "https://github.com/izawartka/gta2-trainer-cpp/blob/master/MainWindow.cpp"
click node_ped_dialog "https://github.com/izawartka/gta2-trainer-cpp/blob/master/PedSpawnerWindow.cpp"
click node_camera_dialog "https://github.com/izawartka/gta2-trainer-cpp/blob/master/CameraWindow.cpp"
click node_acs_dialog "https://github.com/izawartka/gta2-trainer-cpp/blob/master/ACSWindow.cpp"
click node_vehicle_player "https://github.com/izawartka/gta2-trainer-cpp/blob/master/MainWindow.cpp"
click node_ped_spawn "https://github.com/izawartka/gta2-trainer-cpp/blob/master/PedSpawnerWindow.cpp"
click node_game_actions "https://github.com/izawartka/gta2-trainer-cpp/blob/master/MainWindow.cpp"
click node_camera_logic "https://github.com/izawartka/gta2-trainer-cpp/blob/master/CameraHooks.cpp"
click node_render_hooks "https://github.com/izawartka/gta2-trainer-cpp/blob/master/Hooks.cpp"
click node_live_window "https://github.com/izawartka/gta2-trainer-cpp/blob/master/LiveTable/LiveTableWindow.cpp"
click node_column_editor "https://github.com/izawartka/gta2-trainer-cpp/blob/master/LiveTable/LiveTableEditWindow.cpp"
click node_live_helper "https://github.com/izawartka/gta2-trainer-cpp/blob/master/LiveTable/LiveTableHelper.cpp"
click node_live_data "https://github.com/izawartka/gta2-trainer-cpp/blob/master/LiveTable/LiveTableData.cpp"
click node_game_bindings "https://github.com/izawartka/gta2-trainer-cpp/blob/master/gta2-helper.h"
click node_game_layout "https://github.com/izawartka/gta2-trainer-cpp/blob/master/gta2.h"
click node_hook_helper "https://github.com/izawartka/gta2-trainer-cpp/blob/master/HookHelper.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_ped_dialog,node_camera_dialog,node_acs_dialog,node_user toneBlue
class node_vehicle_player,node_ped_spawn,node_game_actions toneAmber
class node_camera_logic,node_render_hooks toneMint
class node_live_window,node_column_editor,node_live_helper,node_live_data toneRose
class node_game_bindings,node_game_layout,node_hook_helper,node_gta2 toneIndigo
```

## Components

### Trainer interface

- [Trainer controls](https://github.com/izawartka/gta2-trainer-cpp/blob/master/MainWindow.cpp): `MainWindow.cpp`
- [Ped spawner](https://github.com/izawartka/gta2-trainer-cpp/blob/master/PedSpawnerWindow.cpp): `PedSpawnerWindow.cpp`
- [Camera controls](https://github.com/izawartka/gta2-trainer-cpp/blob/master/CameraWindow.cpp): `CameraWindow.cpp`
- [Advanced settings](https://github.com/izawartka/gta2-trainer-cpp/blob/master/ACSWindow.cpp): `ACSWindow.cpp`

### Gameplay controls

- [Player and vehicle edits](https://github.com/izawartka/gta2-trainer-cpp/blob/master/MainWindow.cpp): `MainWindow.cpp`
- [Ped creation and AI](https://github.com/izawartka/gta2-trainer-cpp/blob/master/PedSpawnerWindow.cpp): `PedSpawnerWindow.cpp`
- [Gameplay actions](https://github.com/izawartka/gta2-trainer-cpp/blob/master/MainWindow.cpp): `MainWindow.cpp`

### Camera and rendering

- [Camera transforms](https://github.com/izawartka/gta2-trainer-cpp/blob/master/CameraHooks.cpp): `CameraHooks.cpp`
- [Render hooks](https://github.com/izawartka/gta2-trainer-cpp/blob/master/Hooks.cpp): `Hooks.cpp`

### Live inspection

- [Live entity table](https://github.com/izawartka/gta2-trainer-cpp/blob/master/LiveTable/LiveTableWindow.cpp): `LiveTable/LiveTableWindow.cpp`
- [Column editor](https://github.com/izawartka/gta2-trainer-cpp/blob/master/LiveTable/LiveTableEditWindow.cpp): `LiveTable/LiveTableEditWindow.cpp`
- [Entity memory reader](https://github.com/izawartka/gta2-trainer-cpp/blob/master/LiveTable/LiveTableHelper.cpp): `LiveTable/LiveTableHelper.cpp`
- [Table field definitions](https://github.com/izawartka/gta2-trainer-cpp/blob/master/LiveTable/LiveTableData.cpp): `LiveTable/LiveTableData.cpp`

### Game integration

- [GTA2 bindings](https://github.com/izawartka/gta2-trainer-cpp/blob/master/gta2-helper.h): `gta2-helper.h`
- [GTA2 memory layouts](https://github.com/izawartka/gta2-trainer-cpp/blob/master/gta2.h): `gta2.h`
- [Hook utilities](https://github.com/izawartka/gta2-trainer-cpp/blob/master/HookHelper.cpp): `HookHelper.cpp`

### Other components

- **Trainer user**
- **GTA2 runtime**

## Connections

- Trainer user → Trainer controls: uses controls
- Trainer controls → Player and vehicle edits: edits gameplay
- Trainer controls → Gameplay actions: dispatches actions
- Trainer controls → Ped spawner: opens spawner
- Ped spawner → Ped creation and AI: submits settings
- Trainer controls → Camera controls: opens controls
- Camera controls → Camera transforms: sets camera options
- Trainer controls → Advanced settings: opens settings
- Trainer controls → Live entity table: opens table
- Live entity table → Column editor: opens editor
- Column editor → Live entity table: updates columns
- Live entity table → Entity memory reader: reads entity data
- Entity memory reader → Table field definitions: uses field offsets
- Entity memory reader → GTA2 memory layouts: indexes game structures
- Trainer controls → GTA2 bindings: calls game functions
- Player and vehicle edits → GTA2 bindings: uses game bindings
- Ped creation and AI → GTA2 bindings: spawns and configures
- Gameplay actions → GTA2 bindings: invokes game actions
- GTA2 bindings → GTA2 runtime: reads and writes
- Camera transforms → Hook utilities: installs hooks
- Render hooks → Hook utilities: patches call sites
- Hook utilities → GTA2 runtime: patches runtime
- Camera transforms → GTA2 runtime: reads camera state
- Render hooks → GTA2 runtime: intercepts rendering
