# unchiga/yu-gi-oh-forbidden-memories-recompiled architecture

> Architecture diagram of the GitHub repository unchiga/yu-gi-oh-forbidden-memories-recompiled, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/unchiga/yu-gi-oh-forbidden-memories-recompiled
- Repository: https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled

## Overview

This repository is a native PC port of Yu-Gi-Oh! Forbidden Memories, preserving the original game while adding PC features and mod support. The main player workflow is launch, select a game mode, play a duel or other mode, and save progress. Separate branches cover enhanced presentation, language support, and creating and enabling mods with the FM Editor. The graph uses README-documented relationships where available; many runtime details are unsampled, so it does not infer calls between game modules.

Main entry points: [`src/game/main_modes.c`](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/main_modes.c) (Game modes), [`src/game/main_loop.c`](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/main_loop.c) (Game loop), [`src/pc/mods/manager.c`](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/pc/mods/manager.c) (Mod manager), [`src/pc/guest/main.c`](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/pc/guest/main.c) (PC game entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Game runtime"]
  node_game_loop["Game loop<br/>[main_loop.c]"]
  node_game_modes["Game modes<br/>[main_modes.c]"]
  node_duel["Duel runtime"]
  node_deck_build["Deck building"]
  node_campaign["Campaign"]
  node_free_duel["Free Duel<br/>[screen_runtime.c]"]
end

subgraph group_platform["PC port"]
  node_launcher["PC game entry<br/>[main.c]"]
  node_save_data[("Save data")]
  node_card_storage[("Card storage<br/>[card_storage.c]")]
end

subgraph group_presentation["Presentation"]
  node_graphics["Graphics frame<br/>[graphics_frame.c]"]
  node_movie["Movie playback"]
  node_hd_text["HD text<br/>[hd_text.c]"]
  node_language["Game language<br/>[language.h]"]
end

subgraph group_modding["Modding"]
  node_mods["Mod manager<br/>[manager.c]"]
  node_mod_framework["Mod framework<br/>[modapi.h]"]
  node_fm_editor["FM Editor<br/>[app.py]"]
  node_monster_mod["3D Monsters<br/>[field_art.c]"]
end

subgraph group_foundation["Game foundations"]
  node_card_constants["Card and duel data<br/>[card_constants.h]"]
  node_duel_effects["Duel effects<br/>[duel_effect.h]"]
  node_file_transfer["File transfer<br/>[file_transfer.h]"]
  node_model["Model system<br/>[model.h]"]
  node_sound["Sound system<br/>[sound.h]"]
  node_port_types["Port data types<br/>[port_ptr.h]"]
end

node_player(("Player"))

node_player -->|"launches"| node_launcher
node_launcher -.->|"starts"| node_game_loop
node_player -->|"selects mode"| node_game_modes
node_game_loop -.->|"runs"| node_game_modes
node_game_modes -.->|"starts duel"| node_duel
node_game_modes -.->|"runs campaign"| node_campaign
node_game_modes -.->|"runs Free Duel"| node_free_duel
node_player -->|"builds deck"| node_deck_build
node_player -->|"plays duel"| node_duel
node_player -->|"saves progress"| node_save_data
node_player -.->|"manages cards"| node_card_storage
node_game_loop -.->|"presents game"| node_graphics
node_player -->|"enables HD text"| node_hd_text
node_player -->|"chooses language"| node_language
node_player -->|"creates mods"| node_fm_editor
node_fm_editor -->|"exports mods"| node_mods
node_mods -.->|"uses framework"| node_mod_framework
node_mods -.->|"loads optional mod"| node_monster_mod
node_player -.->|"views movies"| node_movie

click node_launcher "https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/pc/guest/main.c"
click node_game_loop "https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/main_loop.c"
click node_game_modes "https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/main_modes.c"
click node_duel "https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/duel_scene_update.c"
click node_deck_build "https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/build_deck_pane_input.c"
click node_campaign "https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/main_run_campaign.c"
click node_free_duel "https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/overlays/free_duel/screen_runtime.c"
click node_save_data "https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/pc/game/free_duel_storage.c"
click node_card_storage "https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/pc/game/card_storage.c"
click node_graphics "https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/graphics_frame.c"
click node_movie "https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/movie_frame_pipeline.c"
click node_hd_text "https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/pc/text/hd_text.c"
click node_language "https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/pc/text/language.h"
click node_mods "https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/pc/mods/manager.c"
click node_mod_framework "https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/pc/mods/modapi.h"
click node_fm_editor "https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/tools/pc/fm_editor/app.py"
click node_monster_mod "https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/mods/3d-monsters/field_art.c"
click node_card_constants "https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/card_constants.h"
click node_duel_effects "https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/duel_effect.h"
click node_file_transfer "https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/file_transfer.h"
click node_model "https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/model.h"
click node_sound "https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/sound.h"
click node_port_types "https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/port_ptr.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_game_loop,node_game_modes,node_duel,node_deck_build,node_campaign,node_free_duel toneBlue
class node_launcher,node_save_data,node_card_storage toneAmber
class node_graphics,node_movie,node_hd_text,node_language toneMint
class node_mods,node_mod_framework,node_fm_editor,node_monster_mod toneRose
class node_card_constants,node_duel_effects,node_file_transfer,node_model,node_sound,node_port_types,node_player toneIndigo
```

## Components

### Game runtime

- [Game loop](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/main_loop.c): `src/game/main_loop.c`
- [Game modes](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/main_modes.c): `src/game/main_modes.c`
- [Duel runtime](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/duel_scene_update.c): `src/game/duel_scene_update.c`
- [Deck building](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/build_deck_pane_input.c): `src/game/build_deck_pane_input.c`
- [Campaign](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/main_run_campaign.c): `src/game/main_run_campaign.c`
- [Free Duel](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/overlays/free_duel/screen_runtime.c): `src/overlays/free_duel/screen_runtime.c`

### PC port

- [PC game entry](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/pc/guest/main.c): `src/pc/guest/main.c`
- [Save data](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/pc/game/free_duel_storage.c): `src/pc/game/free_duel_storage.c`
- [Card storage](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/pc/game/card_storage.c): `src/pc/game/card_storage.c`

### Presentation

- [Graphics frame](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/graphics_frame.c): `src/game/graphics_frame.c`
- [Movie playback](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/movie_frame_pipeline.c): `src/game/movie_frame_pipeline.c`
- [HD text](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/pc/text/hd_text.c): `src/pc/text/hd_text.c`
- [Game language](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/pc/text/language.h): `src/pc/text/language.h`

### Modding

- [Mod manager](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/pc/mods/manager.c): `src/pc/mods/manager.c`
- [Mod framework](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/pc/mods/modapi.h): `src/pc/mods/modapi.h`
- [FM Editor](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/tools/pc/fm_editor/app.py): `tools/pc/fm_editor/app.py`
- [3D Monsters](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/mods/3d-monsters/field_art.c): `mods/3d-monsters/field_art.c`

### Game foundations

- [Card and duel data](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/card_constants.h): `src/game/card_constants.h`
- [Duel effects](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/duel_effect.h): `src/game/duel_effect.h`
- [File transfer](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/file_transfer.h): `src/game/file_transfer.h`
- [Model system](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/model.h): `src/game/model.h`
- [Sound system](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/game/sound.h): `src/game/sound.h`
- [Port data types](https://github.com/unchiga/yu-gi-oh-forbidden-memories-recompiled/blob/master/src/port_ptr.h): `src/port_ptr.h`

### Other components

- **Player**

## Connections

- Player → PC game entry: launches (evidence: `README.md`)
- PC game entry → Game loop: starts
- Player → Game modes: selects mode (evidence: `README.md`)
- Game loop → Game modes: runs
- Game modes → Duel runtime: starts duel
- Game modes → Campaign: runs campaign
- Game modes → Free Duel: runs Free Duel
- Player → Deck building: builds deck (evidence: `README.md`)
- Player → Duel runtime: plays duel (evidence: `README.md`)
- Player → Save data: saves progress (evidence: `README.md`)
- Player → Card storage: manages cards
- Game loop → Graphics frame: presents game
- Player → HD text: enables HD text (evidence: `README.md`)
- Player → Game language: chooses language (evidence: `README.md`)
- Player → FM Editor: creates mods (evidence: `README.md`)
- FM Editor → Mod manager: exports mods (evidence: `README.md`)
- Mod manager → Mod framework: uses framework
- Mod manager → 3D Monsters: loads optional mod
- Player → Movie playback: views movies
