# pret/pokeplatinum architecture

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

- Interactive diagram: https://gitdiagram.com/pret/pokeplatinum
- Repository: https://github.com/pret/pokeplatinum

## Overview

Pokémon Platinum is a Nintendo DS role-playing game reconstructed as a decompilation. Its runtime spans field exploration and activities, battles, menus and collection management, communication features, and story sequences. The graph emphasizes substantial modules named in the SOURCE INDEX and shared runtime foundations. It does not claim a single end-to-end user workflow: the README identifies the game and ROMs, but does not document runtime flows. Edges are limited to relationships visible in indexed references or excerpts; unsampled connections are omitted.

Main entry points: [`src/comm_manager.c`](https://github.com/pret/pokeplatinum/blob/main/src/comm_manager.c) (Communication Manager), [`src/g3d_pipeline.c`](https://github.com/pret/pokeplatinum/blob/main/src/g3d_pipeline.c) (3D Pipeline), [`src/underground/manager.c`](https://github.com/pret/pokeplatinum/blob/main/src/underground/manager.c) (Underground), [`src/overlay104/frontier_script_manager.c`](https://github.com/pret/pokeplatinum/blob/main/src/overlay104/frontier_script_manager.c) (Frontier Scripts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Core Gameplay"]
  node_battle["Battle Control"]
  node_battle_api["Battle Commands"]
  node_field_effects["Field Effects"]
  node_underground["Underground<br/>[manager.c]"]
  node_frontier_scripts["Frontier Scripts"]
end

subgraph group_applications["Player Applications"]
  node_capsules["Capsule Menu<br/>[manager.c]"]
  node_pc_boxes["Pokémon Storage<br/>[box_app_manager.c]"]
  node_storage_session["Storage Session"]
  node_credits["End Credits<br/>[main.c]"]
end

subgraph group_network["Communication"]
  node_gts["Global Trade<br/>[application.c]"]
  node_gts_network["Trade Networking<br/>[network_handler.c]"]
  node_communications["Communication Manager<br/>[comm_manager.c]"]
  node_nintendo_wfc["Nintendo WFC<br/>[main.c]"]
end

subgraph group_runtime["Runtime Foundations"]
  node_save[("Save Data<br/>[savedata.h]")]
  node_pokemon["Pokémon Data<br/>[pokemon.h]"]
  node_archive["NARC Archives<br/>[narc.h]"]
  node_messages["Message Loading<br/>[message.h]"]
  node_graphics["3D Pipeline<br/>[g3d_pipeline.c]"]
  node_tasks["Task Scheduler<br/>[sys_task_manager.h]"]
  node_system["System Runtime<br/>[system.h]"]
  node_heap["Heap Manager<br/>[heap.h]"]
end

node_player(("Player"))

node_battle -->|"uses commands"| node_battle_api
node_battle_api -->|"uses context"| node_battle
node_underground -->|"reads save"| node_save
node_underground -->|"uses field effects"| node_field_effects
node_frontier_scripts -->|"loads messages"| node_messages
node_frontier_scripts -->|"reads archives"| node_archive
node_capsules -->|"uses graphics"| node_graphics
node_pc_boxes -->|"uses session"| node_storage_session
node_pc_boxes -->|"uses Pokémon data"| node_pokemon
node_gts -->|"routes screens"| node_gts_network
node_communications -->|"uses savedata"| node_save
node_communications -->|"uses WFC"| node_nintendo_wfc
node_nintendo_wfc -->|"uses communication"| node_communications
node_credits -->|"uses 3D pipeline"| node_graphics
node_credits -->|"uses messages"| node_messages
node_system -->|"holds task managers"| node_tasks
node_graphics -->|"uses heap IDs"| node_heap

click node_battle "https://github.com/pret/pokeplatinum/blob/main/src/battle/battle_controller_player.c"
click node_battle_api "https://github.com/pret/pokeplatinum/blob/main/include/battle/battle_controller.h"
click node_field_effects "https://github.com/pret/pokeplatinum/blob/main/src/overlay005/field_effect_manager.c"
click node_underground "https://github.com/pret/pokeplatinum/blob/main/src/underground/manager.c"
click node_frontier_scripts "https://github.com/pret/pokeplatinum/blob/main/src/overlay104/frontier_script_manager.c"
click node_capsules "https://github.com/pret/pokeplatinum/blob/main/src/applications/capsule_menu/manager.c"
click node_pc_boxes "https://github.com/pret/pokeplatinum/blob/main/src/applications/pc_boxes/box_app_manager.c"
click node_storage_session "https://github.com/pret/pokeplatinum/blob/main/include/applications/pc_boxes/pokemon_storage_session.h"
click node_credits "https://github.com/pret/pokeplatinum/blob/main/src/cutscenes/end_credits/main.c"
click node_gts "https://github.com/pret/pokeplatinum/blob/main/src/gts_application/application.c"
click node_gts_network "https://github.com/pret/pokeplatinum/blob/main/src/gts_application/screens/network_handler.c"
click node_communications "https://github.com/pret/pokeplatinum/blob/main/src/comm_manager.c"
click node_nintendo_wfc "https://github.com/pret/pokeplatinum/blob/main/src/nintendo_wfc/main.c"
click node_save "https://github.com/pret/pokeplatinum/blob/main/include/savedata.h"
click node_pokemon "https://github.com/pret/pokeplatinum/blob/main/include/pokemon.h"
click node_archive "https://github.com/pret/pokeplatinum/blob/main/include/narc.h"
click node_messages "https://github.com/pret/pokeplatinum/blob/main/include/message.h"
click node_graphics "https://github.com/pret/pokeplatinum/blob/main/src/g3d_pipeline.c"
click node_tasks "https://github.com/pret/pokeplatinum/blob/main/include/sys_task_manager.h"
click node_system "https://github.com/pret/pokeplatinum/blob/main/include/system.h"
click node_heap "https://github.com/pret/pokeplatinum/blob/main/include/heap.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_battle,node_battle_api,node_field_effects,node_underground,node_frontier_scripts toneBlue
class node_capsules,node_pc_boxes,node_storage_session,node_credits toneAmber
class node_gts,node_gts_network,node_communications,node_nintendo_wfc toneMint
class node_save,node_pokemon,node_archive,node_messages,node_graphics,node_tasks,node_system,node_heap toneRose
class node_player toneIndigo
```

## Components

### Core Gameplay

- [Battle Control](https://github.com/pret/pokeplatinum/blob/main/src/battle/battle_controller_player.c): `src/battle/battle_controller_player.c`
- [Battle Commands](https://github.com/pret/pokeplatinum/blob/main/include/battle/battle_controller.h): `include/battle/battle_controller.h`
- [Field Effects](https://github.com/pret/pokeplatinum/blob/main/src/overlay005/field_effect_manager.c): `src/overlay005/field_effect_manager.c`
- [Underground](https://github.com/pret/pokeplatinum/blob/main/src/underground/manager.c): `src/underground/manager.c`
- [Frontier Scripts](https://github.com/pret/pokeplatinum/blob/main/src/overlay104/frontier_script_manager.c): `src/overlay104/frontier_script_manager.c`

### Player Applications

- [Capsule Menu](https://github.com/pret/pokeplatinum/blob/main/src/applications/capsule_menu/manager.c): `src/applications/capsule_menu/manager.c`
- [Pokémon Storage](https://github.com/pret/pokeplatinum/blob/main/src/applications/pc_boxes/box_app_manager.c): `src/applications/pc_boxes/box_app_manager.c`
- [Storage Session](https://github.com/pret/pokeplatinum/blob/main/include/applications/pc_boxes/pokemon_storage_session.h): `include/applications/pc_boxes/pokemon_storage_session.h`
- [End Credits](https://github.com/pret/pokeplatinum/blob/main/src/cutscenes/end_credits/main.c): `src/cutscenes/end_credits/main.c`

### Communication

- [Global Trade](https://github.com/pret/pokeplatinum/blob/main/src/gts_application/application.c): `src/gts_application/application.c`
- [Trade Networking](https://github.com/pret/pokeplatinum/blob/main/src/gts_application/screens/network_handler.c): `src/gts_application/screens/network_handler.c`
- [Communication Manager](https://github.com/pret/pokeplatinum/blob/main/src/comm_manager.c): `src/comm_manager.c`
- [Nintendo WFC](https://github.com/pret/pokeplatinum/blob/main/src/nintendo_wfc/main.c): `src/nintendo_wfc/main.c`

### Runtime Foundations

- [Save Data](https://github.com/pret/pokeplatinum/blob/main/include/savedata.h): `include/savedata.h`
- [Pokémon Data](https://github.com/pret/pokeplatinum/blob/main/include/pokemon.h): `include/pokemon.h`
- [NARC Archives](https://github.com/pret/pokeplatinum/blob/main/include/narc.h): `include/narc.h`
- [Message Loading](https://github.com/pret/pokeplatinum/blob/main/include/message.h): `include/message.h`
- [3D Pipeline](https://github.com/pret/pokeplatinum/blob/main/src/g3d_pipeline.c): `src/g3d_pipeline.c`
- [Task Scheduler](https://github.com/pret/pokeplatinum/blob/main/include/sys_task_manager.h): `include/sys_task_manager.h`
- [System Runtime](https://github.com/pret/pokeplatinum/blob/main/include/system.h): `include/system.h`
- [Heap Manager](https://github.com/pret/pokeplatinum/blob/main/include/heap.h): `include/heap.h`

### Other components

- **Player**

## Connections

- Battle Control → Battle Commands: uses commands (evidence: `src/battle/battle_controller_player.c`)
- Battle Commands → Battle Control: uses context (evidence: `include/battle/battle_controller.h`)
- Underground → Save Data: reads save (evidence: `src/underground/manager.c`)
- Underground → Field Effects: uses field effects (evidence: `src/underground/manager.c`)
- Frontier Scripts → Message Loading: loads messages (evidence: `src/overlay104/frontier_script_manager.c`)
- Frontier Scripts → NARC Archives: reads archives (evidence: `src/overlay104/frontier_script_manager.c`)
- Capsule Menu → 3D Pipeline: uses graphics (evidence: `src/applications/capsule_menu/manager.c`)
- Pokémon Storage → Storage Session: uses session (evidence: `src/applications/pc_boxes/box_app_manager.c`)
- Pokémon Storage → Pokémon Data: uses Pokémon data (evidence: `src/applications/pc_boxes/box_app_manager.c`)
- Global Trade → Trade Networking: routes screens (evidence: `src/gts_application/application.c`)
- Communication Manager → Save Data: uses savedata (evidence: `src/comm_manager.c`)
- Communication Manager → Nintendo WFC: uses WFC (evidence: `src/comm_manager.c`)
- Nintendo WFC → Communication Manager: uses communication (evidence: `src/nintendo_wfc/main.c`)
- End Credits → 3D Pipeline: uses 3D pipeline (evidence: `src/cutscenes/end_credits/main.c`)
- End Credits → Message Loading: uses messages (evidence: `src/cutscenes/end_credits/main.c`)
- System Runtime → Task Scheduler: holds task managers (evidence: `include/system.h`)
- 3D Pipeline → Heap Manager: uses heap IDs (evidence: `src/g3d_pipeline.c`)
