# harbourmasters/shipwright architecture

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

- Interactive diagram: https://gitdiagram.com/harbourmasters/shipwright
- Repository: https://github.com/harbourmasters/shipwright

## Overview

Ship of Harkinian is a desktop Ocarina of Time game client built on libultraship and decompilation-derived game code. The principal workflow is to provide a supported ROM, extract its assets into an archive, launch the client, and play with configurable controls and graphics. The repository also includes save management, randomizer behavior, gameplay enhancements, custom messages, and Anchor networking. The README documents the product capabilities; source excerpts and the source index support only selected internal relationships, so unverified wiring is omitted.

Main entry points: [`soh/include/z64.h`](https://github.com/harbourmasters/shipwright/blob/develop/soh/include/z64.h) (Game engine), [`soh/soh/Enhancements/game-interactor/GameInteractor.h`](https://github.com/harbourmasters/shipwright/blob/develop/soh/soh/Enhancements/game-interactor/GameInteractor.h) (Gameplay hooks), [`soh/soh/Enhancements/randomizer/hook_handlers.cpp`](https://github.com/harbourmasters/shipwright/blob/develop/soh/soh/Enhancements/randomizer/hook_handlers.cpp) (Randomizer), [`soh/src/code/main.c`](https://github.com/harbourmasters/shipwright/blob/develop/soh/src/code/main.c) (Game startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Startup and assets"]
  node_bootstrap["Game startup<br/>[main.c]"]
  node_asset_extract["Asset extraction<br/>[OTRGlobals.h]"]
  node_resource_manager["Asset resources"]
  node_custom_assets["Custom asset archives"]
end

subgraph group_engine["Game runtime"]
  node_game_engine["Game engine<br/>[z64.h]"]
  node_engine_api["Engine functions<br/>[functions.h]"]
  node_engine_state["Engine state<br/>[variables.h]"]
  node_game_loop["Game loop<br/>[main.c]"]
  node_controller["Controller input<br/>[controller.c]"]
  node_graphics["Graphics backends"]
end

subgraph group_play["Gameplay systems"]
  node_save_manager[("Save management<br/>[SaveManager.cpp]")]
  node_randomizer["Randomizer<br/>[hook_handlers.cpp]"]
  node_seed_context["Randomizer context<br/>[SeedContext.h]"]
  node_game_interactor["Gameplay hooks<br/>[GameInteractor.h]"]
  node_enhancements["Gameplay enhancements<br/>[enhancementTypes.h]"]
end

subgraph group_client["Client features"]
  node_messages["Custom messages"]
  node_settings["Controls and settings<br/>[Mapper.cpp]"]
  node_anchor["Anchor networking<br/>[HookHandlers.cpp]"]
end

node_player(("Player"))
node_rom["Supported ROM"]

node_player -->|"launches"| node_bootstrap
node_rom -->|"provides assets"| node_asset_extract
node_asset_extract -.->|"makes archives"| node_resource_manager
node_custom_assets -->|"loads archives"| node_resource_manager
node_bootstrap -.->|"starts"| node_game_loop
node_game_loop -.->|"runs"| node_game_engine
node_controller -.->|"supplies input"| node_game_engine
node_game_engine -->|"uses APIs"| node_engine_api
node_game_engine -->|"uses state"| node_engine_state
node_game_engine -->|"renders through"| node_graphics
node_player -->|"configures"| node_settings
node_player -->|"installs"| node_custom_assets
node_save_manager -->|"persists settings"| node_seed_context
node_randomizer -->|"reads context"| node_seed_context
node_randomizer -->|"uses hooks"| node_game_interactor
node_enhancements -.->|"registers behavior"| node_game_interactor
node_player -.->|"reads messages"| node_messages
node_anchor -->|"uses hooks"| node_game_interactor

click node_bootstrap "https://github.com/harbourmasters/shipwright/blob/develop/soh/src/code/main.c"
click node_asset_extract "https://github.com/harbourmasters/shipwright/blob/develop/soh/soh/OTRGlobals.h"
click node_resource_manager "https://github.com/harbourmasters/shipwright/blob/develop/soh/soh/ResourceManagerHelpers.cpp"
click node_game_engine "https://github.com/harbourmasters/shipwright/blob/develop/soh/include/z64.h"
click node_engine_api "https://github.com/harbourmasters/shipwright/blob/develop/soh/include/functions.h"
click node_engine_state "https://github.com/harbourmasters/shipwright/blob/develop/soh/include/variables.h"
click node_game_loop "https://github.com/harbourmasters/shipwright/blob/develop/soh/src/code/main.c"
click node_controller "https://github.com/harbourmasters/shipwright/blob/develop/soh/src/libultra/io/controller.c"
click node_save_manager "https://github.com/harbourmasters/shipwright/blob/develop/soh/soh/SaveManager.cpp"
click node_randomizer "https://github.com/harbourmasters/shipwright/blob/develop/soh/soh/Enhancements/randomizer/hook_handlers.cpp"
click node_seed_context "https://github.com/harbourmasters/shipwright/blob/develop/soh/soh/Enhancements/randomizer/SeedContext.h"
click node_game_interactor "https://github.com/harbourmasters/shipwright/blob/develop/soh/soh/Enhancements/game-interactor/GameInteractor.h"
click node_enhancements "https://github.com/harbourmasters/shipwright/blob/develop/soh/soh/Enhancements/enhancementTypes.h"
click node_messages "https://github.com/harbourmasters/shipwright/blob/develop/soh/soh/Enhancements/custom-message/CustomMessageManager.cpp"
click node_settings "https://github.com/harbourmasters/shipwright/blob/develop/soh/soh/Enhancements/controls/Mapper.cpp"
click node_anchor "https://github.com/harbourmasters/shipwright/blob/develop/soh/soh/Network/Anchor/HookHandlers.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_bootstrap,node_asset_extract,node_resource_manager,node_custom_assets toneBlue
class node_game_engine,node_engine_api,node_engine_state,node_game_loop,node_controller,node_graphics toneAmber
class node_save_manager,node_randomizer,node_seed_context,node_game_interactor,node_enhancements toneMint
class node_messages,node_settings,node_anchor toneRose
class node_player,node_rom toneIndigo
```

## Components

### Startup and assets

- [Game startup](https://github.com/harbourmasters/shipwright/blob/develop/soh/src/code/main.c): `soh/src/code/main.c`
- [Asset extraction](https://github.com/harbourmasters/shipwright/blob/develop/soh/soh/OTRGlobals.h): `soh/soh/OTRGlobals.h`
- [Asset resources](https://github.com/harbourmasters/shipwright/blob/develop/soh/soh/ResourceManagerHelpers.cpp): `soh/soh/ResourceManagerHelpers.cpp`
- **Custom asset archives**

### Game runtime

- [Game engine](https://github.com/harbourmasters/shipwright/blob/develop/soh/include/z64.h): `soh/include/z64.h`
- [Engine functions](https://github.com/harbourmasters/shipwright/blob/develop/soh/include/functions.h): `soh/include/functions.h`
- [Engine state](https://github.com/harbourmasters/shipwright/blob/develop/soh/include/variables.h): `soh/include/variables.h`
- [Game loop](https://github.com/harbourmasters/shipwright/blob/develop/soh/src/code/main.c): `soh/src/code/main.c`
- [Controller input](https://github.com/harbourmasters/shipwright/blob/develop/soh/src/libultra/io/controller.c): `soh/src/libultra/io/controller.c`
- **Graphics backends**

### Gameplay systems

- [Save management](https://github.com/harbourmasters/shipwright/blob/develop/soh/soh/SaveManager.cpp): `soh/soh/SaveManager.cpp`
- [Randomizer](https://github.com/harbourmasters/shipwright/blob/develop/soh/soh/Enhancements/randomizer/hook_handlers.cpp): `soh/soh/Enhancements/randomizer/hook_handlers.cpp`
- [Randomizer context](https://github.com/harbourmasters/shipwright/blob/develop/soh/soh/Enhancements/randomizer/SeedContext.h): `soh/soh/Enhancements/randomizer/SeedContext.h`
- [Gameplay hooks](https://github.com/harbourmasters/shipwright/blob/develop/soh/soh/Enhancements/game-interactor/GameInteractor.h): `soh/soh/Enhancements/game-interactor/GameInteractor.h`
- [Gameplay enhancements](https://github.com/harbourmasters/shipwright/blob/develop/soh/soh/Enhancements/enhancementTypes.h): `soh/soh/Enhancements/enhancementTypes.h`

### Client features

- [Custom messages](https://github.com/harbourmasters/shipwright/blob/develop/soh/soh/Enhancements/custom-message/CustomMessageManager.cpp): `soh/soh/Enhancements/custom-message/CustomMessageManager.cpp`
- [Controls and settings](https://github.com/harbourmasters/shipwright/blob/develop/soh/soh/Enhancements/controls/Mapper.cpp): `soh/soh/Enhancements/controls/Mapper.cpp`
- [Anchor networking](https://github.com/harbourmasters/shipwright/blob/develop/soh/soh/Network/Anchor/HookHandlers.cpp): `soh/soh/Network/Anchor/HookHandlers.cpp`

### Other components

- **Player**
- **Supported ROM**

## Connections

- Player → Game startup: launches (evidence: `README.md`)
- Supported ROM → Asset extraction: provides assets (evidence: `README.md`)
- Asset extraction → Asset resources: makes archives (evidence: `soh/soh/ResourceManagerHelpers.cpp`)
- Custom asset archives → Asset resources: loads archives (evidence: `README.md`)
- Game startup → Game loop: starts (evidence: `soh/src/code/main.c`)
- Game loop → Game engine: runs
- Controller input → Game engine: supplies input
- Game engine → Engine functions: uses APIs (evidence: `soh/include/functions.h`)
- Game engine → Engine state: uses state (evidence: `soh/include/variables.h`)
- Game engine → Graphics backends: renders through (evidence: `README.md`)
- Player → Controls and settings: configures (evidence: `README.md`)
- Player → Custom asset archives: installs (evidence: `README.md`)
- Save management → Randomizer context: persists settings (evidence: `soh/soh/SaveManager.cpp`)
- Randomizer → Randomizer context: reads context (evidence: `soh/soh/Enhancements/randomizer/hook_handlers.cpp`)
- Randomizer → Gameplay hooks: uses hooks (evidence: `soh/soh/Enhancements/randomizer/hook_handlers.cpp`)
- Gameplay enhancements → Gameplay hooks: registers behavior
- Player → Custom messages: reads messages
- Anchor networking → Gameplay hooks: uses hooks (evidence: `soh/soh/Network/Anchor/HookHandlers.cpp`)
