# amix307/zelda-tmc-3ds architecture

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

- Interactive diagram: https://gitdiagram.com/amix307/zelda-tmc-3ds
- Repository: https://github.com/amix307/zelda-tmc-3ds

## Overview

This repository is a Nintendo 3DS port of The Minish Cap. Its principal workflow is to launch the application, locate and identify a user-provided USA or European ROM, initialize the game, and run gameplay with 3DS display, input, and audio. The port also adds dual-screen interfaces, Russian localization, randomizer support, persistent settings and saves, and diagnostics. The README documents these capabilities; sampled source and the source index support the main runtime links, but not every feature’s internal wiring.

Main entry points: [`src/main.c`](https://github.com/amix307/zelda-tmc-3ds/blob/main/src/main.c) (Game Main Loop), [`src/game.c`](https://github.com/amix307/zelda-tmc-3ds/blob/main/src/game.c) (Game Tasks), [`platform/3ds/source/main_3ds.c`](https://github.com/amix307/zelda-tmc-3ds/blob/main/platform/3ds/source/main_3ds.c) (3DS Launch), [`platform/3ds/source/platform_3ds.c`](https://github.com/amix307/zelda-tmc-3ds/blob/main/platform/3ds/source/platform_3ds.c) (Platform Services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game Runtime"]
  node_main["Game Main Loop<br/>[main.c]"]
  node_game["Game Tasks<br/>[game.c]"]
  node_world["World Simulation<br/>[entity.c]"]
  node_room["Room State<br/>[room.h]"]
  node_screen["Screen Rendering<br/>[screen.h]"]
end

subgraph group_platform["3DS Platform"]
  node_launcher["3DS Launch<br/>[main_3ds.c]"]
  node_platformapi["Platform Services<br/>[platform_3ds.c]"]
  node_audio["Audio<br/>[sound.h]"]
  node_display["Display Modes<br/>[port_config.h]"]
end

subgraph group_features["Port Features"]
  node_second["Dual-Screen UI"]
  node_mapui["Map and Quest Views"]
  node_touch["Touch Controls"]
  node_localization["Russian Localization<br/>[port_russian_3ds.c]"]
  node_randomizer["Randomizer<br/>[rando.cpp]"]
  node_diagnostics["Diagnostic Dumps<br/>[port_bugreport.cpp]"]
end

subgraph group_data["Game Data"]
  node_rom["ROM Discovery<br/>[port_rom_picker.c]"]
  node_romruntime["ROM Runtime<br/>[port_rom.c]"]
  node_saves["Save Handling<br/>[port_save.c]"]
  node_settings["Runtime Settings"]
end

node_player(("Player"))

node_player -->|"launches"| node_launcher
node_launcher -.->|"initializes"| node_platformapi
node_launcher -.->|"starts"| node_main
node_main -.->|"selects ROM"| node_rom
node_rom -.->|"provides ROM"| node_romruntime
node_main -->|"runs tasks"| node_game
node_main -->|"uses screen"| node_screen
node_main -->|"uses audio"| node_audio
node_main -->|"uses room state"| node_room
node_game -.->|"updates world"| node_world
node_main -.->|"updates interface"| node_second
node_second -.->|"shows views"| node_mapui
node_player -.->|"touch input"| node_touch
node_player -->|"chooses mode"| node_display
node_main -.->|"loads localization"| node_localization
node_game -->|"supports randomized play"| node_randomizer
node_game -->|"persists progress"| node_saves
node_player -->|"configures"| node_settings
node_player -->|"requests dump"| node_diagnostics
node_platformapi -->|"provides stereo audio"| node_audio

click node_launcher "https://github.com/amix307/zelda-tmc-3ds/blob/main/platform/3ds/source/main_3ds.c"
click node_platformapi "https://github.com/amix307/zelda-tmc-3ds/blob/main/platform/3ds/source/platform_3ds.c"
click node_rom "https://github.com/amix307/zelda-tmc-3ds/blob/main/port/port_rom_picker.c"
click node_romruntime "https://github.com/amix307/zelda-tmc-3ds/blob/main/port/port_rom.c"
click node_main "https://github.com/amix307/zelda-tmc-3ds/blob/main/src/main.c"
click node_game "https://github.com/amix307/zelda-tmc-3ds/blob/main/src/game.c"
click node_world "https://github.com/amix307/zelda-tmc-3ds/blob/main/src/entity.c"
click node_room "https://github.com/amix307/zelda-tmc-3ds/blob/main/include/room.h"
click node_screen "https://github.com/amix307/zelda-tmc-3ds/blob/main/include/screen.h"
click node_audio "https://github.com/amix307/zelda-tmc-3ds/blob/main/include/sound.h"
click node_second "https://github.com/amix307/zelda-tmc-3ds/blob/main/port/port_second_screen.c"
click node_mapui "https://github.com/amix307/zelda-tmc-3ds/blob/main/port/port_second_screen_worldmap.c"
click node_touch "https://github.com/amix307/zelda-tmc-3ds/blob/main/port/port_touch_controls.cpp"
click node_localization "https://github.com/amix307/zelda-tmc-3ds/blob/main/platform/3ds/source/port_russian_3ds.c"
click node_randomizer "https://github.com/amix307/zelda-tmc-3ds/blob/main/port/rando/rando.cpp"
click node_saves "https://github.com/amix307/zelda-tmc-3ds/blob/main/port/port_save.c"
click node_settings "https://github.com/amix307/zelda-tmc-3ds/blob/main/port/port_runtime_config.cpp"
click node_diagnostics "https://github.com/amix307/zelda-tmc-3ds/blob/main/port/port_bugreport.cpp"
click node_display "https://github.com/amix307/zelda-tmc-3ds/blob/main/port/port_config.h"

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_world,node_room,node_screen toneBlue
class node_launcher,node_platformapi,node_audio,node_display toneAmber
class node_second,node_mapui,node_touch,node_localization,node_randomizer,node_diagnostics toneMint
class node_rom,node_romruntime,node_saves,node_settings toneRose
class node_player toneIndigo
```

## Components

### Game Runtime

- [Game Main Loop](https://github.com/amix307/zelda-tmc-3ds/blob/main/src/main.c): `src/main.c`
- [Game Tasks](https://github.com/amix307/zelda-tmc-3ds/blob/main/src/game.c): `src/game.c`
- [World Simulation](https://github.com/amix307/zelda-tmc-3ds/blob/main/src/entity.c): `src/entity.c`
- [Room State](https://github.com/amix307/zelda-tmc-3ds/blob/main/include/room.h): `include/room.h`
- [Screen Rendering](https://github.com/amix307/zelda-tmc-3ds/blob/main/include/screen.h): `include/screen.h`

### 3DS Platform

- [3DS Launch](https://github.com/amix307/zelda-tmc-3ds/blob/main/platform/3ds/source/main_3ds.c): `platform/3ds/source/main_3ds.c`
- [Platform Services](https://github.com/amix307/zelda-tmc-3ds/blob/main/platform/3ds/source/platform_3ds.c): `platform/3ds/source/platform_3ds.c`
- [Audio](https://github.com/amix307/zelda-tmc-3ds/blob/main/include/sound.h): `include/sound.h`
- [Display Modes](https://github.com/amix307/zelda-tmc-3ds/blob/main/port/port_config.h): `port/port_config.h`

### Port Features

- [Dual-Screen UI](https://github.com/amix307/zelda-tmc-3ds/blob/main/port/port_second_screen.c): `port/port_second_screen.c`
- [Map and Quest Views](https://github.com/amix307/zelda-tmc-3ds/blob/main/port/port_second_screen_worldmap.c): `port/port_second_screen_worldmap.c`
- [Touch Controls](https://github.com/amix307/zelda-tmc-3ds/blob/main/port/port_touch_controls.cpp): `port/port_touch_controls.cpp`
- [Russian Localization](https://github.com/amix307/zelda-tmc-3ds/blob/main/platform/3ds/source/port_russian_3ds.c): `platform/3ds/source/port_russian_3ds.c`
- [Randomizer](https://github.com/amix307/zelda-tmc-3ds/blob/main/port/rando/rando.cpp): `port/rando/rando.cpp`
- [Diagnostic Dumps](https://github.com/amix307/zelda-tmc-3ds/blob/main/port/port_bugreport.cpp): `port/port_bugreport.cpp`

### Game Data

- [ROM Discovery](https://github.com/amix307/zelda-tmc-3ds/blob/main/port/port_rom_picker.c): `port/port_rom_picker.c`
- [ROM Runtime](https://github.com/amix307/zelda-tmc-3ds/blob/main/port/port_rom.c): `port/port_rom.c`
- [Save Handling](https://github.com/amix307/zelda-tmc-3ds/blob/main/port/port_save.c): `port/port_save.c`
- [Runtime Settings](https://github.com/amix307/zelda-tmc-3ds/blob/main/port/port_runtime_config.cpp): `port/port_runtime_config.cpp`

### Other components

- **Player**

## Connections

- Player → 3DS Launch: launches
- 3DS Launch → Platform Services: initializes
- 3DS Launch → Game Main Loop: starts
- Game Main Loop → ROM Discovery: selects ROM
- ROM Discovery → ROM Runtime: provides ROM
- Game Main Loop → Game Tasks: runs tasks (evidence: `src/main.c`)
- Game Main Loop → Screen Rendering: uses screen (evidence: `src/main.c`)
- Game Main Loop → Audio: uses audio (evidence: `src/main.c`)
- Game Main Loop → Room State: uses room state (evidence: `src/main.c`)
- Game Tasks → World Simulation: updates world
- Game Main Loop → Dual-Screen UI: updates interface
- Dual-Screen UI → Map and Quest Views: shows views
- Player → Touch Controls: touch input
- Player → Display Modes: chooses mode
- Game Main Loop → Russian Localization: loads localization
- Game Tasks → Randomizer: supports randomized play
- Game Tasks → Save Handling: persists progress
- Player → Runtime Settings: configures
- Player → Diagnostic Dumps: requests dump
- Platform Services → Audio: provides stereo audio
