# sonicdcer/sf64 architecture

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

- Interactive diagram: https://gitdiagram.com/sonicdcer/sf64
- Repository: https://github.com/sonicdcer/sf64

## Overview

This repository is a matching decompilation of Star Fox 64, not a PC port. The player-facing product is the game: menus and mission overlays provide distinct game stages, supported by shared engine state, audio, and Nintendo 64 runtime services. The tree also contains gameplay mods. The sampled files show controller-query DMA behavior and audio/context data, but do not establish most cross-subsystem call paths; those links are therefore omitted rather than inferred from filenames.

Main entry points: [`src/libultra/io/contquery.c`](https://github.com/sonicdcer/sf64/blob/master/src/libultra/io/contquery.c) (Controller Query), [`src/libultra/io/controller.c`](https://github.com/sonicdcer/sf64/blob/master/src/libultra/io/controller.c) (Controller Runtime), [`include/PR/controller.h`](https://github.com/sonicdcer/sf64/blob/master/include/PR/controller.h) (N64 Interfaces), [`src/mods/object_ram.c`](https://github.com/sonicdcer/sf64/blob/master/src/mods/object_ram.c) (Object RAM Mod)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Game and Missions"]
  node_menus["Menus"]
  node_missions["Mission Overlays"]
  node_engine["Game Engine"]
end

subgraph group_runtime["Shared Runtime"]
  node_game_state["Game State<br/>[fox_context.c]"]
  node_audio["Audio System"]
  node_audio_context["Audio Context<br/>[audio_context.c]"]
  node_dma["DMA and Overlays<br/>[sf64dma.h]"]
end

subgraph group_platform["N64 Platform"]
  node_controller["Controller Runtime<br/>[controller.c]"]
  node_controller_query["Controller Query<br/>[contquery.c]"]
  node_n64_headers["N64 Interfaces<br/>[controller.h]"]
end

subgraph group_extras["Gameplay Mods"]
  node_object_ram["Object RAM Mod<br/>[object_ram.c]"]
  node_object_ram_info["Object RAM Metadata<br/>[object_ram_info.c]"]
end

node_player(("Player"))

node_controller_query -->|"requests status data"| node_controller
node_controller -->|"uses controller types"| node_n64_headers
node_controller_query -->|"uses controller types"| node_n64_headers
node_object_ram -->|"reads metadata"| node_object_ram_info

click node_menus "https://github.com/sonicdcer/sf64/tree/master/src/overlays/ovl_menu"
click node_missions "https://github.com/sonicdcer/sf64/tree/master/src/overlays"
click node_engine "https://github.com/sonicdcer/sf64/tree/master/src/engine"
click node_game_state "https://github.com/sonicdcer/sf64/blob/master/src/engine/fox_context.c"
click node_audio "https://github.com/sonicdcer/sf64/tree/master/src/audio"
click node_audio_context "https://github.com/sonicdcer/sf64/blob/master/src/audio/audio_context.c"
click node_dma "https://github.com/sonicdcer/sf64/blob/master/include/sf64dma.h"
click node_controller "https://github.com/sonicdcer/sf64/blob/master/src/libultra/io/controller.c"
click node_controller_query "https://github.com/sonicdcer/sf64/blob/master/src/libultra/io/contquery.c"
click node_n64_headers "https://github.com/sonicdcer/sf64/blob/master/include/PR/controller.h"
click node_object_ram "https://github.com/sonicdcer/sf64/blob/master/src/mods/object_ram.c"
click node_object_ram_info "https://github.com/sonicdcer/sf64/blob/master/src/mods/object_ram_info.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_menus,node_missions,node_engine toneBlue
class node_game_state,node_audio,node_audio_context,node_dma toneAmber
class node_controller,node_controller_query,node_n64_headers toneMint
class node_object_ram,node_object_ram_info toneRose
class node_player toneIndigo
```

## Components

### Game and Missions

- [Menus](https://github.com/sonicdcer/sf64/tree/master/src/overlays/ovl_menu): `src/overlays/ovl_menu`
- [Mission Overlays](https://github.com/sonicdcer/sf64/tree/master/src/overlays): `src/overlays`
- [Game Engine](https://github.com/sonicdcer/sf64/tree/master/src/engine): `src/engine`

### Shared Runtime

- [Game State](https://github.com/sonicdcer/sf64/blob/master/src/engine/fox_context.c): `src/engine/fox_context.c`
- [Audio System](https://github.com/sonicdcer/sf64/tree/master/src/audio): `src/audio`
- [Audio Context](https://github.com/sonicdcer/sf64/blob/master/src/audio/audio_context.c): `src/audio/audio_context.c`
- [DMA and Overlays](https://github.com/sonicdcer/sf64/blob/master/include/sf64dma.h): `include/sf64dma.h`

### N64 Platform

- [Controller Runtime](https://github.com/sonicdcer/sf64/blob/master/src/libultra/io/controller.c): `src/libultra/io/controller.c`
- [Controller Query](https://github.com/sonicdcer/sf64/blob/master/src/libultra/io/contquery.c): `src/libultra/io/contquery.c`
- [N64 Interfaces](https://github.com/sonicdcer/sf64/blob/master/include/PR/controller.h): `include/PR/controller.h`

### Gameplay Mods

- [Object RAM Mod](https://github.com/sonicdcer/sf64/blob/master/src/mods/object_ram.c): `src/mods/object_ram.c`
- [Object RAM Metadata](https://github.com/sonicdcer/sf64/blob/master/src/mods/object_ram_info.c): `src/mods/object_ram_info.c`

### Other components

- **Player**

## Connections

- Controller Query → Controller Runtime: requests status data (evidence: `src/libultra/io/contquery.c`)
- Controller Runtime → N64 Interfaces: uses controller types (evidence: `src/libultra/io/controller.c`)
- Controller Query → N64 Interfaces: uses controller types (evidence: `src/libultra/io/contquery.c`)
- Object RAM Mod → Object RAM Metadata: reads metadata (evidence: `src/mods/object_ram.c`)
