# blacklabelhq/symphonyrecomp architecture

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

- Interactive diagram: https://gitdiagram.com/blacklabelhq/symphonyrecomp
- Repository: https://github.com/blacklabelhq/symphonyrecomp

## Overview

#### Purpose and execution model
SymphonyRecomp is a .NET 10 recompilation-based modern PC port of the North American PSX version of *Castlevania: Symphony of the Night*. It statically recompiles legally supplied disc assets, then builds a patched native/game-facing runtime. Primary entry points are `Program.cs` and the project file `RecompOne.SoTN.csproj`; launch/build scripts include `windows_run.bat` and `run.sh`.

#### Recompilation input boundary
The build consumes user-provided BIN/CUE game media under `disc/`, whose expected contract is documented in `disc/README.md`. RecompOne uses the title definition in `config/sotn.json` to drive static recompilation. This is the critical boundary between copyrighted game data and repository-owned C# patches/configuration.

#### Generated-game integration layer
`wrapers/` is the main abstraction boundary over recompiled game state, entities, memory/API calls, and game concepts. Higher-level patches should use these wrappers rather than direct generated-code assumptions. Core representations include `wrapers/GameApi.cs`, `wrapers/Game.cs`, and `wrapers/Stage.cs`; player, inventory, map, progress, items, and relics are similarly exposed here.

#### Runtime event orchestration
Event modules attach mod behavior to game lifecycle, level transitions, rendering, and display changes. `events/GameLifecycleEvents.cs`, `events/LevelEvents.cs`, and `events/RenderEvents.cs` form the control-flow hooks through which patches initialize, update, and draw. `events/DisplayModeEvents.cs` handles display-specific coordination.

#### Game patches and feature modules
Feature code is grouped by intervention domain:
- Randomizer generation, UI, and persistence: `patches/rando/Randomizer.cs`, `patches/rando/RandoPatch.cs`, `patches/rando/SaveLoadManager.cs`.
- Tracker/map overlays and collected-item state: `patches/tracker/Tracker.cs`, `patches/tracker/MapChecks.cs`, `patches/tracker/TrackerOverlayPanel.cs`.
- Cheats and interactive panels: `patches/cheats/Cheats.cs`, `patches/cheats/CheatMenu.cs`.
- General fixes and quality-of-life changes: `patches/qol/QualityOfLife.cs`, `patches/qol/FunctionFixes.cs`.
- Extension room-fill behavior: `patches/extension/RoomFill.cs`.

#### Widescreen rendering adaptation
Widescreen support is a cross-cutting rendering/gameplay patch set, not merely a display option. `patches/widescreen/WidescreenPatch.cs` coordinates camera, HUD, effects, spawning, transitions, hit detection, and scene-specific corrections. Key bounds and compatibility controls are `patches/widescreen/ScreenBounds.cs` and `patches/widescreen/VanillaGuard.cs`; camera/transition work resides in `patches/widescreen/CameraWidescreenPatch.cs` and `patches/widescreen/RoomTransitionPatch.cs`.

#### Static configuration and assets
Function maps map recompiled functions across game executable/stage domains, with common definitions in `config/funcmaps/main.json` and per-stage files such as `config/funcmaps/dra.json` and `config/funcmaps/stcat.json`. Runtime feature assets include room-fill metadata at `assets/extension/room_fills.json`, language metadata at `assets/languages.json`, plus map/tracker assets under `assets/map/` and `assets/tracker/`.

#### Runtime dependencies and delivery
The runtime requires .NET 10, OpenGL 2.1-capable graphics, and OpenAL audio. Menu/about/update and disc validation concerns are isolated in `misc/GameMenu.cs`, `misc/AutoUpdater.cs`, and `misc/DiscCheck.cs`. GitHub Actions build and publish releases via `.github/workflows/build.yml` and `.github/workflows/release.yml`.

Main entry points: [`events/GameLifecycleEvents.cs`](https://github.com/blacklabelhq/symphonyrecomp/blob/master/events/GameLifecycleEvents.cs) (Lifecycle event hooks), [`wrapers/GameApi.cs`](https://github.com/blacklabelhq/symphonyrecomp/blob/master/wrapers/GameApi.cs) (Game wrapper layer), [`Program.cs`](https://github.com/blacklabelhq/symphonyrecomp/blob/master/Program.cs) (Recomp build entry), [`patches/tracker/Tracker.cs`](https://github.com/blacklabelhq/symphonyrecomp/blob/master/patches/tracker/Tracker.cs) (Tracker and map overlay)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Recompilation Inputs"]
  node_disc["Supplied PSX media<br/>game media"]
  node_disc_contract["Disc contract<br/>documentation<br/>[README.md]"]
  node_title_definition["Title definition<br/>recomp config<br/>[sotn.json]"]
  node_function_maps["Function maps<br/>recomp mappings<br/>[main.json]"]
end

subgraph group_runtime["Runtime Core"]
  node_build_entry["Recomp build entry<br/>.NET application<br/>[Program.cs]"]
  node_project["Project definition<br/>.NET project"]
  node_generated_game["Recompiled game runtime<br/>generated native integration"]
  node_wrappers["Game wrapper layer<br/>C&#35; abstraction<br/>[GameApi.cs]"]
  node_events["Lifecycle event hooks<br/>event orchestration"]
  node_menu_services["Menu and runtime services<br/>[GameMenu.cs]"]
end

subgraph group_features["Patch Modules"]
  node_randomizer["Randomizer<br/>feature module<br/>[Randomizer.cs]"]
  node_tracker["Tracker and map overlay<br/>feature module<br/>[Tracker.cs]"]
  node_cheats["Cheats UI<br/>feature module<br/>[Cheats.cs]"]
  node_qol["QoL and fixes<br/>patch module<br/>[QualityOfLife.cs]"]
  node_room_fill["Room fill extension<br/>patch module<br/>[RoomFill.cs]"]
  node_widescreen["Widescreen adaptation<br/>cross-cutting patch<br/>[WidescreenPatch.cs]"]
  node_feature_assets["Feature assets<br/>runtime data<br/>[room_fills.json]"]
end

subgraph group_delivery["Delivery"]
  node_ci_build["Build workflow<br/>GitHub Actions<br/>[build.yml]"]
  node_ci_release["Release workflow<br/>GitHub Actions<br/>[release.yml]"]
end

node_disc_contract -.->|"specifies"| node_disc
node_disc -->|"recompilation input"| node_build_entry
node_title_definition -->|"defines title"| node_build_entry
node_function_maps -->|"maps functions"| node_build_entry
node_project -->|"builds"| node_build_entry
node_build_entry -->|"produces/integrates"| node_generated_game
node_generated_game -->|"game state and APIs"| node_wrappers
node_wrappers -->|"supports hooks"| node_events
node_events -->|"drives"| node_randomizer
node_events -->|"drives"| node_tracker
node_events -->|"drives"| node_cheats
node_events -->|"drives"| node_qol
node_events -->|"drives"| node_room_fill
node_events -->|"render and transition hooks"| node_widescreen
node_wrappers -->|"game abstraction"| node_randomizer
node_wrappers -->|"game abstraction"| node_tracker
node_wrappers -->|"camera and state access"| node_widescreen
node_feature_assets -->|"room metadata"| node_room_fill
node_feature_assets -->|"map and tracker data"| node_tracker
node_disc -.->|"validated at runtime"| node_menu_services
node_ci_build -->|"builds"| node_project
node_ci_release -->|"publishes build output"| node_ci_build

click node_disc_contract "https://github.com/blacklabelhq/symphonyrecomp/blob/master/disc/README.md"
click node_title_definition "https://github.com/blacklabelhq/symphonyrecomp/blob/master/config/sotn.json"
click node_function_maps "https://github.com/blacklabelhq/symphonyrecomp/blob/master/config/funcmaps/main.json"
click node_build_entry "https://github.com/blacklabelhq/symphonyrecomp/blob/master/Program.cs"
click node_project "https://github.com/blacklabelhq/symphonyrecomp/blob/master/RecompOne.SoTN.csproj"
click node_wrappers "https://github.com/blacklabelhq/symphonyrecomp/blob/master/wrapers/GameApi.cs"
click node_events "https://github.com/blacklabelhq/symphonyrecomp/blob/master/events/GameLifecycleEvents.cs"
click node_randomizer "https://github.com/blacklabelhq/symphonyrecomp/blob/master/patches/rando/Randomizer.cs"
click node_tracker "https://github.com/blacklabelhq/symphonyrecomp/blob/master/patches/tracker/Tracker.cs"
click node_cheats "https://github.com/blacklabelhq/symphonyrecomp/blob/master/patches/cheats/Cheats.cs"
click node_qol "https://github.com/blacklabelhq/symphonyrecomp/blob/master/patches/qol/QualityOfLife.cs"
click node_room_fill "https://github.com/blacklabelhq/symphonyrecomp/blob/master/patches/extension/RoomFill.cs"
click node_widescreen "https://github.com/blacklabelhq/symphonyrecomp/blob/master/patches/widescreen/WidescreenPatch.cs"
click node_feature_assets "https://github.com/blacklabelhq/symphonyrecomp/blob/master/assets/extension/room_fills.json"
click node_menu_services "https://github.com/blacklabelhq/symphonyrecomp/blob/master/misc/GameMenu.cs"
click node_ci_build "https://github.com/blacklabelhq/symphonyrecomp/blob/master/.github/workflows/build.yml"
click node_ci_release "https://github.com/blacklabelhq/symphonyrecomp/blob/master/.github/workflows/release.yml"

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_disc,node_disc_contract,node_title_definition,node_function_maps toneBlue
class node_build_entry,node_project,node_generated_game,node_wrappers,node_events,node_menu_services toneAmber
class node_randomizer,node_tracker,node_cheats,node_qol,node_room_fill,node_widescreen,node_feature_assets toneMint
class node_ci_build,node_ci_release toneRose
```

## Components

### Recompilation Inputs

User media and static function mappings drive recompilation.

- **Supplied PSX media**: game media · Legally supplied BIN/CUE input.
- [Disc contract](https://github.com/blacklabelhq/symphonyrecomp/blob/master/disc/README.md): documentation · `disc/README.md`
- [Title definition](https://github.com/blacklabelhq/symphonyrecomp/blob/master/config/sotn.json): recomp config · `config/sotn.json`
- [Function maps](https://github.com/blacklabelhq/symphonyrecomp/blob/master/config/funcmaps/main.json): recomp mappings · Common and per-stage executable mappings. · `config/funcmaps/main.json`

### Runtime Core

Repository-owned integration and lifecycle control.

- [Recomp build entry](https://github.com/blacklabelhq/symphonyrecomp/blob/master/Program.cs): .NET application · Static recompilation and patched runtime entry point. · `Program.cs`
- [Project definition](https://github.com/blacklabelhq/symphonyrecomp/blob/master/RecompOne.SoTN.csproj): .NET project · `RecompOne.SoTN.csproj`
- **Recompiled game runtime**: generated native integration · Game-facing output produced from media and mappings.
- [Game wrapper layer](https://github.com/blacklabelhq/symphonyrecomp/blob/master/wrapers/GameApi.cs): C# abstraction · Stable access to game state, entities, memory, and APIs. · `wrapers/GameApi.cs`
- [Lifecycle event hooks](https://github.com/blacklabelhq/symphonyrecomp/blob/master/events/GameLifecycleEvents.cs): event orchestration · Initialization, level, render, and display hooks. · `events/GameLifecycleEvents.cs`
- [Menu and runtime services](https://github.com/blacklabelhq/symphonyrecomp/blob/master/misc/GameMenu.cs): runtime services · Menu, update, and disc-validation concerns. · `misc/GameMenu.cs`

### Patch Modules

Gameplay, UI, rendering, and extension features.

- [Randomizer](https://github.com/blacklabelhq/symphonyrecomp/blob/master/patches/rando/Randomizer.cs): feature module · Generation, runtime patching, and save/load behavior. · `patches/rando/Randomizer.cs`
- [Tracker and map overlay](https://github.com/blacklabelhq/symphonyrecomp/blob/master/patches/tracker/Tracker.cs): feature module · Collected-item state, map checks, and overlay UI. · `patches/tracker/Tracker.cs`
- [Cheats UI](https://github.com/blacklabelhq/symphonyrecomp/blob/master/patches/cheats/Cheats.cs): feature module · `patches/cheats/Cheats.cs`
- [QoL and fixes](https://github.com/blacklabelhq/symphonyrecomp/blob/master/patches/qol/QualityOfLife.cs): patch module · `patches/qol/QualityOfLife.cs`
- [Room fill extension](https://github.com/blacklabelhq/symphonyrecomp/blob/master/patches/extension/RoomFill.cs): patch module · `patches/extension/RoomFill.cs`
- [Widescreen adaptation](https://github.com/blacklabelhq/symphonyrecomp/blob/master/patches/widescreen/WidescreenPatch.cs): cross-cutting patch · Coordinates camera, HUD, effects, transitions, and compatibility guards. · `patches/widescreen/WidescreenPatch.cs`
- [Feature assets](https://github.com/blacklabelhq/symphonyrecomp/blob/master/assets/extension/room_fills.json): runtime data · Room-fill, language, map, and tracker metadata. · `assets/extension/room_fills.json`

### Delivery

Build and release automation.

- [Build workflow](https://github.com/blacklabelhq/symphonyrecomp/blob/master/.github/workflows/build.yml): GitHub Actions · `.github/workflows/build.yml`
- [Release workflow](https://github.com/blacklabelhq/symphonyrecomp/blob/master/.github/workflows/release.yml): GitHub Actions · `.github/workflows/release.yml`

## Connections

- Disc contract → Supplied PSX media: specifies
- Supplied PSX media → Recomp build entry: recompilation input
- Title definition → Recomp build entry: defines title
- Function maps → Recomp build entry: maps functions
- Project definition → Recomp build entry: builds
- Recomp build entry → Recompiled game runtime: produces/integrates
- Recompiled game runtime → Game wrapper layer: game state and APIs
- Game wrapper layer → Lifecycle event hooks: supports hooks
- Lifecycle event hooks → Randomizer: drives
- Lifecycle event hooks → Tracker and map overlay: drives
- Lifecycle event hooks → Cheats UI: drives
- Lifecycle event hooks → QoL and fixes: drives
- Lifecycle event hooks → Room fill extension: drives
- Lifecycle event hooks → Widescreen adaptation: render and transition hooks
- Game wrapper layer → Randomizer: game abstraction
- Game wrapper layer → Tracker and map overlay: game abstraction
- Game wrapper layer → Widescreen adaptation: camera and state access
- Feature assets → Room fill extension: room metadata
- Feature assets → Tracker and map overlay: map and tracker data
- Supplied PSX media → Menu and runtime services: validated at runtime
- Build workflow → Project definition: builds
- Release workflow → Build workflow: publishes build output
