# danielgomesvieira2000/body-harvest-recomp architecture

> Architecture diagram of the GitHub repository danielgomesvieira2000/body-harvest-recomp, 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/danielgomesvieira2000/body-harvest-recomp
- Repository: https://github.com/danielgomesvieira2000/body-harvest-recomp

## Overview

Body Harvest: Recompiled is a native PC port that runs recompiled Body Harvest game code through the N64 runtime. The principal workflow is selecting a matching game dump in the launcher and starting the runtime; SDL-backed callbacks provide platform I/O while RT64 renders the game. The README also documents widescreen HUD handling, mods, saves and rumble, and a live HUD inspector. The tree and excerpts support the main runtime and several rendering/audio links; some subsystem wiring is not shown, so uncertain links are omitted.

Main entry points: [`src/main.cpp`](https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/main.cpp) (Application entry), [`src/callbacks.cpp`](https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/callbacks.cpp) (Platform callbacks), [`src/renderer.cpp`](https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/renderer.cpp) (Renderer), [`src/inspector.cpp`](https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/inspector.cpp) (HUD inspector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_launch["Launch and Runtime"]
  node_launcher["Launcher<br/>[frontend.cpp]"]
  node_rom["ROM handling<br/>[rom.cpp]"]
  node_main["Application entry<br/>[main.cpp]"]
  node_game["Recompiled game"]
  node_runtime["N64 runtime"]
  node_mods["Mod support<br/>[mods.cpp]"]
end

subgraph group_platform["Platform Services"]
  node_callbacks["Platform callbacks<br/>[callbacks.cpp]"]
  node_libultra["libultra glue<br/>[libultra_glue.cpp]"]
end

subgraph group_graphics["Graphics and HUD"]
  node_renderer["Renderer<br/>[renderer.cpp]"]
  node_widescreen["Widescreen<br/>[widescreen.cpp]"]
  node_hud["HUD rewriting<br/>[hudrewrite.cpp]"]
  node_census["Display census<br/>[dlcensus.cpp]"]
  node_inspector["HUD inspector<br/>[inspector.cpp]"]
  node_overlays["Game overlays<br/>[overlays.cpp]"]
end

subgraph group_audio["Audio and Input"]
  node_audio["Audio diagnostics<br/>[audiodiag.cpp]"]
  node_resample["Audio resampling<br/>[resample.cpp]"]
end

subgraph group_diagnostics["Diagnostics"]
  node_crash["Crash handling<br/>[crash_handler.cpp]"]
  node_testdrive["Test drive<br/>[testdrive.cpp]"]
end

node_user(("Player"))
node_dump["Game dump"]
node_rt64["RT64"]
node_sdl["SDL devices"]

node_user -->|"configures"| node_launcher
node_user -->|"supplies"| node_dump
node_launcher -->|"selects dump"| node_rom
node_rom -->|"identifies ROM"| node_main
node_main -->|"starts"| node_runtime
node_main -->|"supplies callbacks"| node_callbacks
node_main -->|"installs handler"| node_crash
node_runtime -->|"runs"| node_game
node_runtime -->|"requests platform I/O"| node_callbacks
node_runtime -->|"uses glue"| node_libultra
node_callbacks -->|"uses devices"| node_sdl
node_callbacks -->|"converts audio"| node_resample
node_callbacks -->|"reports audio"| node_audio
node_runtime -->|"renders through"| node_renderer
node_renderer -->|"uses"| node_rt64
node_game -->|"provides game state"| node_widescreen
node_widescreen -->|"rewrites HUD"| node_hud
node_census -->|"publishes frame data"| node_inspector
node_hud -->|"reads class overrides"| node_inspector
node_inspector -->|"installs panel"| node_renderer
node_main -->|"loads mod support"| node_mods
node_runtime -->|"initializes overlays"| node_overlays
node_main -.->|"runs optional harness"| node_testdrive

click node_launcher "https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/frontend.cpp"
click node_rom "https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/rom.cpp"
click node_main "https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/main.cpp"
click node_mods "https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/mods.cpp"
click node_callbacks "https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/callbacks.cpp"
click node_libultra "https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/libultra_glue.cpp"
click node_renderer "https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/renderer.cpp"
click node_widescreen "https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/widescreen.cpp"
click node_hud "https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/hudrewrite.cpp"
click node_census "https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/dlcensus.cpp"
click node_inspector "https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/inspector.cpp"
click node_overlays "https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/overlays.cpp"
click node_audio "https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/audiodiag.cpp"
click node_resample "https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/resample.cpp"
click node_crash "https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/crash_handler.cpp"
click node_testdrive "https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/testdrive.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_launcher,node_rom,node_main,node_game,node_runtime,node_mods toneBlue
class node_callbacks,node_libultra toneAmber
class node_renderer,node_widescreen,node_hud,node_census,node_inspector,node_overlays toneMint
class node_audio,node_resample toneRose
class node_crash,node_testdrive,node_user,node_dump,node_rt64,node_sdl toneIndigo
```

## Components

### Launch and Runtime

- [Launcher](https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/frontend.cpp): `src/frontend.cpp`
- [ROM handling](https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/rom.cpp): `src/rom.cpp`
- [Application entry](https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/main.cpp): `src/main.cpp`
- **Recompiled game**
- **N64 runtime**
- [Mod support](https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/mods.cpp): `src/mods.cpp`

### Platform Services

- [Platform callbacks](https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/callbacks.cpp): `src/callbacks.cpp`
- [libultra glue](https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/libultra_glue.cpp): `src/libultra_glue.cpp`

### Graphics and HUD

- [Renderer](https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/renderer.cpp): `src/renderer.cpp`
- [Widescreen](https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/widescreen.cpp): `src/widescreen.cpp`
- [HUD rewriting](https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/hudrewrite.cpp): `src/hudrewrite.cpp`
- [Display census](https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/dlcensus.cpp): `src/dlcensus.cpp`
- [HUD inspector](https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/inspector.cpp): `src/inspector.cpp`
- [Game overlays](https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/overlays.cpp): `src/overlays.cpp`

### Audio and Input

- [Audio diagnostics](https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/audiodiag.cpp): `src/audiodiag.cpp`
- [Audio resampling](https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/resample.cpp): `src/resample.cpp`

### Diagnostics

- [Crash handling](https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/crash_handler.cpp): `src/crash_handler.cpp`
- [Test drive](https://github.com/danielgomesvieira2000/body-harvest-recomp/blob/main/src/testdrive.cpp): `src/testdrive.cpp`

### Other components

- **Player**
- **Game dump**
- **RT64**
- **SDL devices**

## Connections

- Player → Launcher: configures
- Player → Game dump: supplies
- Launcher → ROM handling: selects dump
- ROM handling → Application entry: identifies ROM
- Application entry → N64 runtime: starts
- Application entry → Platform callbacks: supplies callbacks
- Application entry → Crash handling: installs handler
- N64 runtime → Recompiled game: runs
- N64 runtime → Platform callbacks: requests platform I/O
- N64 runtime → libultra glue: uses glue
- Platform callbacks → SDL devices: uses devices
- Platform callbacks → Audio resampling: converts audio
- Platform callbacks → Audio diagnostics: reports audio
- N64 runtime → Renderer: renders through
- Renderer → RT64: uses
- Recompiled game → Widescreen: provides game state
- Widescreen → HUD rewriting: rewrites HUD
- Display census → HUD inspector: publishes frame data
- HUD rewriting → HUD inspector: reads class overrides
- HUD inspector → Renderer: installs panel
- Application entry → Mod support: loads mod support
- N64 runtime → Game overlays: initializes overlays
- Application entry → Test drive: runs optional harness
