# zeldaret/oot architecture

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

- Interactive diagram: https://gitdiagram.com/zeldaret/oot
- Repository: https://github.com/zeldaret/oot

## Overview

This repository is a work-in-progress decompilation of The Legend of Zelda: Ocarina of Time, not a PC port. Its runtime recreates the game’s boot and frame loop, gameplay and actor behavior, menus, graphics, audio, and platform services. The sampled sources show selected calls among audio scheduling, overlay loading, and the Wallmaster actor; other major game subsystems are represented from the repository tree and README, so their internal links are omitted where evidence was unavailable.

Main entry points: [`src/code/main.c`](https://github.com/zeldaret/oot/blob/main/src/code/main.c) (Game Entry), [`src/code/audio_thread_manager.c`](https://github.com/zeldaret/oot/blob/main/src/code/audio_thread_manager.c) (Audio Scheduling), [`src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c`](https://github.com/zeldaret/oot/blob/main/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c) (Wallmaster Actor), [`src/code/z_kaleido_manager.c`](https://github.com/zeldaret/oot/blob/main/src/code/z_kaleido_manager.c) (Menus and HUD)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_main["Game Entry<br/>[main.c]"]
  node_game["Game States<br/>[game.c]"]
  node_play["Play State<br/>[play_state.h]"]
end

subgraph group_gameplay["Gameplay"]
  node_scene["Scenes and Rooms<br/>[z_scene.c]"]
  node_actors["Actor System<br/>[z_actor.c]"]
  node_wallmas["Wallmaster Actor<br/>[z_en_wallmas.c]"]
  node_collision["Collision"]
  node_messages["Messages<br/>[z_message.c]"]
end

subgraph group_presentation["Presentation"]
  node_menus["Menus and HUD"]
  node_overlays["Overlay Loading"]
  node_graphics["Graphics<br/>[graph.c]"]
  node_audio["Audio Driver<br/>[session_init.c]"]
end

subgraph group_platform["Platform Services"]
  node_audio_thread["Audio Scheduling"]
  node_scheduler["Task Scheduler<br/>[sched.c]"]
  node_input["Controller Input<br/>[padmgr.c]"]
  node_dma["DMA and ROM<br/>[z_std_dma.c]"]
  node_save[("Save Data<br/>[z_sram.c]")]
end

node_player(("Player"))

node_player -.->|"starts game"| node_main
node_wallmas -->|"uses state"| node_play
node_wallmas -->|"targets player"| node_player
node_wallmas -->|"starts cutscene"| node_menus
node_menus -->|"loads overlay"| node_overlays
node_audio_thread -->|"submits tasks"| node_scheduler
node_audio_thread -->|"updates driver"| node_audio
node_main -->|"starts manager"| node_audio_thread
node_main -->|"uses graphics"| node_graphics
node_main -->|"uses input"| node_input
node_audio_thread -->|"sets DMA handler"| node_dma

click node_main "https://github.com/zeldaret/oot/blob/main/src/code/main.c"
click node_game "https://github.com/zeldaret/oot/blob/main/src/code/game.c"
click node_play "https://github.com/zeldaret/oot/blob/main/include/play_state.h"
click node_scene "https://github.com/zeldaret/oot/blob/main/src/code/z_scene.c"
click node_actors "https://github.com/zeldaret/oot/blob/main/src/code/z_actor.c"
click node_wallmas "https://github.com/zeldaret/oot/blob/main/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c"
click node_collision "https://github.com/zeldaret/oot/blob/main/src/code/z_collision_check.c"
click node_messages "https://github.com/zeldaret/oot/blob/main/src/code/z_message.c"
click node_menus "https://github.com/zeldaret/oot/blob/main/src/code/z_kaleido_manager.c"
click node_overlays "https://github.com/zeldaret/oot/blob/main/src/code/z_kaleido_manager.c"
click node_graphics "https://github.com/zeldaret/oot/blob/main/src/code/graph.c"
click node_audio "https://github.com/zeldaret/oot/blob/main/src/audio/game/session_init.c"
click node_audio_thread "https://github.com/zeldaret/oot/blob/main/src/code/audio_thread_manager.c"
click node_scheduler "https://github.com/zeldaret/oot/blob/main/src/code/sched.c"
click node_input "https://github.com/zeldaret/oot/blob/main/src/code/padmgr.c"
click node_dma "https://github.com/zeldaret/oot/blob/main/src/boot/z_std_dma.c"
click node_save "https://github.com/zeldaret/oot/blob/main/src/code/z_sram.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_main,node_game,node_play toneBlue
class node_scene,node_actors,node_wallmas,node_collision,node_messages toneAmber
class node_menus,node_overlays,node_graphics,node_audio toneMint
class node_audio_thread,node_scheduler,node_input,node_dma,node_save toneRose
class node_player toneIndigo
```

## Components

### Runtime

- [Game Entry](https://github.com/zeldaret/oot/blob/main/src/code/main.c): `src/code/main.c`
- [Game States](https://github.com/zeldaret/oot/blob/main/src/code/game.c): `src/code/game.c`
- [Play State](https://github.com/zeldaret/oot/blob/main/include/play_state.h): `include/play_state.h`

### Gameplay

- [Scenes and Rooms](https://github.com/zeldaret/oot/blob/main/src/code/z_scene.c): `src/code/z_scene.c`
- [Actor System](https://github.com/zeldaret/oot/blob/main/src/code/z_actor.c): `src/code/z_actor.c`
- [Wallmaster Actor](https://github.com/zeldaret/oot/blob/main/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c): `src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c`
- [Collision](https://github.com/zeldaret/oot/blob/main/src/code/z_collision_check.c): `src/code/z_collision_check.c`
- [Messages](https://github.com/zeldaret/oot/blob/main/src/code/z_message.c): `src/code/z_message.c`

### Presentation

- [Menus and HUD](https://github.com/zeldaret/oot/blob/main/src/code/z_kaleido_manager.c): `src/code/z_kaleido_manager.c`
- [Overlay Loading](https://github.com/zeldaret/oot/blob/main/src/code/z_kaleido_manager.c): `src/code/z_kaleido_manager.c`
- [Graphics](https://github.com/zeldaret/oot/blob/main/src/code/graph.c): `src/code/graph.c`
- [Audio Driver](https://github.com/zeldaret/oot/blob/main/src/audio/game/session_init.c): `src/audio/game/session_init.c`

### Platform Services

- [Audio Scheduling](https://github.com/zeldaret/oot/blob/main/src/code/audio_thread_manager.c): `src/code/audio_thread_manager.c`
- [Task Scheduler](https://github.com/zeldaret/oot/blob/main/src/code/sched.c): `src/code/sched.c`
- [Controller Input](https://github.com/zeldaret/oot/blob/main/src/code/padmgr.c): `src/code/padmgr.c`
- [DMA and ROM](https://github.com/zeldaret/oot/blob/main/src/boot/z_std_dma.c): `src/boot/z_std_dma.c`
- [Save Data](https://github.com/zeldaret/oot/blob/main/src/code/z_sram.c): `src/code/z_sram.c`

### Other components

- **Player**

## Connections

- Player → Game Entry: starts game
- Wallmaster Actor → Play State: uses state (evidence: `src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c`)
- Wallmaster Actor → Player: targets player (evidence: `src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c`)
- Wallmaster Actor → Menus and HUD: starts cutscene (evidence: `src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c`)
- Menus and HUD → Overlay Loading: loads overlay (evidence: `src/code/z_kaleido_manager.c`)
- Audio Scheduling → Task Scheduler: submits tasks (evidence: `src/code/audio_thread_manager.c`)
- Audio Scheduling → Audio Driver: updates driver (evidence: `src/code/audio_thread_manager.c`)
- Game Entry → Audio Scheduling: starts manager (evidence: `src/code/main.c`)
- Game Entry → Graphics: uses graphics (evidence: `src/code/main.c`)
- Game Entry → Controller Input: uses input (evidence: `src/code/main.c`)
- Audio Scheduling → DMA and ROM: sets DMA handler (evidence: `src/code/audio_thread_manager.c`)
