# seveerj/ghoulies_pc_recomp architecture

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

- Interactive diagram: https://gitdiagram.com/seveerj/ghoulies_pc_recomp
- Repository: https://github.com/seveerj/ghoulies_pc_recomp

## Overview

Ghoulies PC Recomp is a Windows port of Grabbed by the Ghoulies: a player supplies their own North American game files, which are translated and built into a native executable that runs against an Xbox compatibility runtime. The graph includes setup, the documented recompiler stages, game startup and settings, and the runtime’s kernel, graphics, audio, input, and video capabilities. The README and selected source excerpts support the broad workflow; most runtime implementation files were not sampled, so detailed internal dispatch links are omitted.

Main entry points: [`ghoulies/src/main.c`](https://github.com/seveerj/ghoulies_pc_recomp/blob/main/ghoulies/src/main.c) (Game executable), [`installer/setup_main.py`](https://github.com/seveerj/ghoulies_pc_recomp/blob/main/installer/setup_main.py) (Setup orchestration), [`installer/setup.c`](https://github.com/seveerj/ghoulies_pc_recomp/blob/main/installer/setup.c) (Setup program), [`xboxrecomp-main/tools/disasm/engine.py`](https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/tools/disasm/engine.py) (Disassembly)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_install["Setup and build"]
  node_setup["Setup program<br/>[setup.c]"]
  node_setupflow["Setup orchestration<br/>[setup_main.py]"]
  node_discparse["Disc parsing<br/>[xdvdfs.py]"]
end

subgraph group_recomp["Recompilation tools"]
  node_xbeparse["XBE parsing<br/>[xbe_parser.py]"]
  node_disasm["Disassembly<br/>[engine.py]"]
  node_recompdisasm["Recomp disassembly<br/>[disasm.py]"]
  node_lifter["Code lifting<br/>[lifter.py]"]
  node_translator["Code translation<br/>[translator.py]"]
end

subgraph group_game["Game application"]
  node_gameexe["Game executable<br/>[main.c]"]
  node_launcher["Launch settings<br/>[launcher.c]"]
  node_overlay["In-game menu<br/>[overlay.cpp]"]
  node_manual["Manual replacements<br/>[recomp_manual.c]"]
end

subgraph group_kernel["Xbox kernel runtime"]
  node_memory[("Guest memory")]
  node_bridge["Kernel bridge<br/>[kernel_bridge.c]"]
  node_kernelapis["Kernel services<br/>[kernel_file.c]"]
end

subgraph group_devices["Console devices"]
  node_graphics["D3D graphics<br/>[d3d8_resources.c]"]
  node_gpu["NV2A GPU"]
  node_audio["Audio and APU<br/>[apu_core.c]"]
  node_input["Gamepad input<br/>[xinput_device.c]"]
  node_video["Video playback<br/>[video_player.c]"]
end

node_player(("Player"))
node_gamefiles["Game files"]

node_player -->|"starts setup"| node_setup
node_player -->|"provides copy"| node_gamefiles
node_setup -->|"validates disc"| node_discparse
node_setup -->|"launches build"| node_setupflow
node_gamefiles -->|"supplies source"| node_setupflow
node_setupflow -.->|"parses XBE"| node_xbeparse
node_setupflow -->|"disassembles"| node_disasm
node_setupflow -->|"translates game"| node_translator
node_disasm -.->|"supports analysis"| node_recompdisasm
node_lifter -->|"uses disassembly"| node_recompdisasm
node_setupflow -->|"builds executable"| node_gameexe
node_player -->|"chooses settings"| node_launcher
node_launcher -.->|"configures startup"| node_gameexe
node_player -->|"opens menu"| node_overlay
node_overlay -->|"updates settings"| node_gameexe
node_gameexe -->|"initializes guest space"| node_memory
node_gameexe -->|"initializes imports"| node_bridge
node_bridge -->|"dispatches kernel calls"| node_kernelapis
node_gameexe -.->|"resolves replacements"| node_manual
node_gameexe -->|"uses graphics"| node_graphics
node_graphics -.->|"renders via GPU"| node_gpu
node_gameexe -->|"uses audio"| node_audio
node_gameexe -->|"reads controller"| node_input
node_gameexe -->|"plays cutscenes"| node_video

click node_setup "https://github.com/seveerj/ghoulies_pc_recomp/blob/main/installer/setup.c"
click node_setupflow "https://github.com/seveerj/ghoulies_pc_recomp/blob/main/installer/setup_main.py"
click node_discparse "https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/tools/xiso/xdvdfs.py"
click node_xbeparse "https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/tools/xbe_parser/xbe_parser.py"
click node_disasm "https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/tools/disasm/engine.py"
click node_recompdisasm "https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/tools/recomp/disasm.py"
click node_lifter "https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/tools/recomp/lifter.py"
click node_translator "https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/tools/recomp/translator.py"
click node_gameexe "https://github.com/seveerj/ghoulies_pc_recomp/blob/main/ghoulies/src/main.c"
click node_launcher "https://github.com/seveerj/ghoulies_pc_recomp/blob/main/ghoulies/src/launcher.c"
click node_overlay "https://github.com/seveerj/ghoulies_pc_recomp/blob/main/ghoulies/src/overlay.cpp"
click node_manual "https://github.com/seveerj/ghoulies_pc_recomp/blob/main/ghoulies/src/recomp_manual.c"
click node_memory "https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/src/kernel/xbox_memory_layout.c"
click node_bridge "https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/src/kernel/kernel_bridge.c"
click node_kernelapis "https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/src/kernel/kernel_file.c"
click node_graphics "https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/src/d3d/d3d8_resources.c"
click node_gpu "https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/src/nv2a/nv2a_pgraph_d3d11.c"
click node_audio "https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/src/apu/apu_core.c"
click node_input "https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/src/input/xinput_device.c"
click node_video "https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/src/video/video_player.c"

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_setup,node_setupflow,node_discparse toneBlue
class node_xbeparse,node_disasm,node_recompdisasm,node_lifter,node_translator toneAmber
class node_gameexe,node_launcher,node_overlay,node_manual toneMint
class node_memory,node_bridge,node_kernelapis toneRose
class node_graphics,node_gpu,node_audio,node_input,node_video,node_player,node_gamefiles toneIndigo
```

## Components

### Setup and build

- [Setup program](https://github.com/seveerj/ghoulies_pc_recomp/blob/main/installer/setup.c): `installer/setup.c`
- [Setup orchestration](https://github.com/seveerj/ghoulies_pc_recomp/blob/main/installer/setup_main.py): `installer/setup_main.py`
- [Disc parsing](https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/tools/xiso/xdvdfs.py): `xboxrecomp-main/tools/xiso/xdvdfs.py`

### Recompilation tools

- [XBE parsing](https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/tools/xbe_parser/xbe_parser.py): `xboxrecomp-main/tools/xbe_parser/xbe_parser.py`
- [Disassembly](https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/tools/disasm/engine.py): `xboxrecomp-main/tools/disasm/engine.py`
- [Recomp disassembly](https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/tools/recomp/disasm.py): `xboxrecomp-main/tools/recomp/disasm.py`
- [Code lifting](https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/tools/recomp/lifter.py): `xboxrecomp-main/tools/recomp/lifter.py`
- [Code translation](https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/tools/recomp/translator.py): `xboxrecomp-main/tools/recomp/translator.py`

### Game application

- [Game executable](https://github.com/seveerj/ghoulies_pc_recomp/blob/main/ghoulies/src/main.c): `ghoulies/src/main.c`
- [Launch settings](https://github.com/seveerj/ghoulies_pc_recomp/blob/main/ghoulies/src/launcher.c): `ghoulies/src/launcher.c`
- [In-game menu](https://github.com/seveerj/ghoulies_pc_recomp/blob/main/ghoulies/src/overlay.cpp): `ghoulies/src/overlay.cpp`
- [Manual replacements](https://github.com/seveerj/ghoulies_pc_recomp/blob/main/ghoulies/src/recomp_manual.c): `ghoulies/src/recomp_manual.c`

### Xbox kernel runtime

- [Guest memory](https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/src/kernel/xbox_memory_layout.c): `xboxrecomp-main/src/kernel/xbox_memory_layout.c`
- [Kernel bridge](https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/src/kernel/kernel_bridge.c): `xboxrecomp-main/src/kernel/kernel_bridge.c`
- [Kernel services](https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/src/kernel/kernel_file.c): `xboxrecomp-main/src/kernel/kernel_file.c`

### Console devices

- [D3D graphics](https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/src/d3d/d3d8_resources.c): `xboxrecomp-main/src/d3d/d3d8_resources.c`
- [NV2A GPU](https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/src/nv2a/nv2a_pgraph_d3d11.c): `xboxrecomp-main/src/nv2a/nv2a_pgraph_d3d11.c`
- [Audio and APU](https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/src/apu/apu_core.c): `xboxrecomp-main/src/apu/apu_core.c`
- [Gamepad input](https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/src/input/xinput_device.c): `xboxrecomp-main/src/input/xinput_device.c`
- [Video playback](https://github.com/seveerj/ghoulies_pc_recomp/blob/main/xboxrecomp-main/src/video/video_player.c): `xboxrecomp-main/src/video/video_player.c`

### Other components

- **Player**
- **Game files**

## Connections

- Player → Setup program: starts setup
- Player → Game files: provides copy
- Setup program → Disc parsing: validates disc (evidence: `installer/setup.c`)
- Setup program → Setup orchestration: launches build (evidence: `installer/setup.c`)
- Game files → Setup orchestration: supplies source
- Setup orchestration → XBE parsing: parses XBE
- Setup orchestration → Disassembly: disassembles
- Setup orchestration → Code translation: translates game
- Disassembly → Recomp disassembly: supports analysis
- Code lifting → Recomp disassembly: uses disassembly (evidence: `xboxrecomp-main/tools/recomp/lifter.py`)
- Setup orchestration → Game executable: builds executable
- Player → Launch settings: chooses settings
- Launch settings → Game executable: configures startup
- Player → In-game menu: opens menu
- In-game menu → Game executable: updates settings (evidence: `ghoulies/src/overlay.cpp`)
- Game executable → Guest memory: initializes guest space
- Game executable → Kernel bridge: initializes imports
- Kernel bridge → Kernel services: dispatches kernel calls (evidence: `xboxrecomp-main/src/kernel/kernel_bridge.c`)
- Game executable → Manual replacements: resolves replacements
- Game executable → D3D graphics: uses graphics
- D3D graphics → NV2A GPU: renders via GPU
- Game executable → Audio and APU: uses audio
- Game executable → Gamepad input: reads controller
- Game executable → Video playback: plays cutscenes
