# ctrdecomp/nintendoware4ctr architecture

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

- Interactive diagram: https://gitdiagram.com/ctrdecomp/nintendoware4ctr
- Repository: https://github.com/ctrdecomp/nintendoware4ctr

## Overview

NintendoWare4Ctr is a decompilation of NintendoWare’s graphics and sound engine, with animation, 2D layout, font, I/O, math, OS, and utility libraries in the supplied tree. A typical client uses engine APIs to load resources, update animation or scene state, then render graphics/UI or play sound. The graph shows these product domains and selected internal stages; exact runtime wiring is limited because only a small sample of implementation was provided. README-listed ctrl, eft, and h3d capabilities are not represented in the supplied tree.

Main entry points: [`sources/libraries/gfx/gfx_GraphicsDevice.cpp`](https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/gfx/gfx_GraphicsDevice.cpp) (Rendering), [`sources/libraries/gfx/gfx_SceneBuilder.cpp`](https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/gfx/gfx_SceneBuilder.cpp) (Scene and models), [`sources/libraries/snd/snd_SoundArchiveLoader.cpp`](https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/snd/snd_SoundArchiveLoader.cpp) (Sound archives), [`sources/libraries/gfx/gfx_ParticleEmitter.cpp`](https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/gfx/gfx_ParticleEmitter.cpp) (Particle effects)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_graphics["Graphics engine"]
  node_gfxres["Graphics resources"]
  node_scene["Scene and models"]
  node_particles["Particle effects"]
  node_lighting["Lighting"]
  node_render["Rendering"]
end

subgraph group_sound["Sound engine"]
  node_archive["Sound archives"]
  node_sounddata["Sound data"]
  node_playback["Sound playback"]
  node_spatial["3D sound"]
  node_hardware["Audio hardware"]
end

subgraph group_ui["Layout and fonts"]
  node_layout["2D layout<br/>[lyt_Layout.cpp]"]
  node_font["Font rendering"]
end

subgraph group_runtime["Animation and I/O"]
  node_anim["Animation"]
  node_io["File streams"]
end

subgraph group_foundation["Core utilities"]
  node_math["Math primitives<br/>[math.h]"]
  node_memory["Memory utilities<br/>[os_Memory.h]"]
  node_containers["Containers and resources<br/>[ut_LinkList.h]"]
end

node_client(("Game client"))
node_gpu(("Graphics hardware"))
node_audio(("CTR sound API"))

node_client -->|"updates frames"| node_anim
node_client -->|"opens streams"| node_io
node_client -->|"builds scenes"| node_scene
node_client -->|"configures effects"| node_particles
node_client -->|"selects sounds"| node_archive
node_client -->|"sets sound space"| node_spatial
node_client -->|"builds UI"| node_layout
node_client -->|"writes text"| node_font
node_archive -->|"resolves file data"| node_sounddata
node_hardware -->|"sets effects and volume"| node_audio
node_gfxres -->|"provides resources"| node_scene
node_scene -->|"submits scene"| node_render
node_lighting -->|"supplies lighting"| node_render
node_particles -->|"supplies particles"| node_render
node_render -->|"renders"| node_gpu
node_layout -->|"uses text"| node_font
node_io -->|"reads archive data"| node_archive
node_playback -->|"controls output"| node_hardware
node_spatial -->|"provides 3D parameters"| node_playback

click node_anim "https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/anim/anim_AnimFrameController.cpp"
click node_io "https://github.com/ctrdecomp/nintendoware4ctr/tree/legacyModule/sources/libraries/io"
click node_gfxres "https://github.com/ctrdecomp/nintendoware4ctr/tree/legacyModule/sources/libraries/gfx/res"
click node_scene "https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/gfx/gfx_SceneBuilder.cpp"
click node_particles "https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/gfx/gfx_ParticleEmitter.cpp"
click node_lighting "https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/gfx/gfx_FragmentLight.cpp"
click node_render "https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/gfx/gfx_GraphicsDevice.cpp"
click node_archive "https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/snd/snd_SoundArchiveLoader.cpp"
click node_sounddata "https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/snd/snd_SoundDataManager.cpp"
click node_playback "https://github.com/ctrdecomp/nintendoware4ctr/tree/legacyModule/sources/libraries/snd"
click node_spatial "https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/snd/snd_Sound3DEngine.cpp"
click node_hardware "https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/snd/snd_HardwareManager.cpp"
click node_layout "https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/lyt/lyt_Layout.cpp"
click node_font "https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/font/font_TextWriterBase.cpp"
click node_math "https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/include/nw/math.h"
click node_memory "https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/include/nw/os/os_Memory.h"
click node_containers "https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/include/nw/ut/ut_LinkList.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_gfxres,node_scene,node_particles,node_lighting,node_render,node_client toneBlue
class node_archive,node_sounddata,node_playback,node_spatial,node_hardware toneAmber
class node_layout,node_font,node_audio toneMint
class node_anim,node_io toneRose
class node_math,node_memory,node_containers,node_gpu toneIndigo
```

## Components

### Graphics engine

- [Graphics resources](https://github.com/ctrdecomp/nintendoware4ctr/tree/legacyModule/sources/libraries/gfx/res): `sources/libraries/gfx/res`
- [Scene and models](https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/gfx/gfx_SceneBuilder.cpp): `sources/libraries/gfx/gfx_SceneBuilder.cpp`
- [Particle effects](https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/gfx/gfx_ParticleEmitter.cpp): `sources/libraries/gfx/gfx_ParticleEmitter.cpp`
- [Lighting](https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/gfx/gfx_FragmentLight.cpp): `sources/libraries/gfx/gfx_FragmentLight.cpp`
- [Rendering](https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/gfx/gfx_GraphicsDevice.cpp): `sources/libraries/gfx/gfx_GraphicsDevice.cpp`

### Sound engine

- [Sound archives](https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/snd/snd_SoundArchiveLoader.cpp): `sources/libraries/snd/snd_SoundArchiveLoader.cpp`
- [Sound data](https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/snd/snd_SoundDataManager.cpp): `sources/libraries/snd/snd_SoundDataManager.cpp`
- [Sound playback](https://github.com/ctrdecomp/nintendoware4ctr/tree/legacyModule/sources/libraries/snd): `sources/libraries/snd`
- [3D sound](https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/snd/snd_Sound3DEngine.cpp): `sources/libraries/snd/snd_Sound3DEngine.cpp`
- [Audio hardware](https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/snd/snd_HardwareManager.cpp): `sources/libraries/snd/snd_HardwareManager.cpp`

### Layout and fonts

- [2D layout](https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/lyt/lyt_Layout.cpp): `sources/libraries/lyt/lyt_Layout.cpp`
- [Font rendering](https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/font/font_TextWriterBase.cpp): `sources/libraries/font/font_TextWriterBase.cpp`

### Animation and I/O

- [Animation](https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/sources/libraries/anim/anim_AnimFrameController.cpp): `sources/libraries/anim/anim_AnimFrameController.cpp`
- [File streams](https://github.com/ctrdecomp/nintendoware4ctr/tree/legacyModule/sources/libraries/io): `sources/libraries/io`

### Core utilities

- [Math primitives](https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/include/nw/math.h): `include/nw/math.h`
- [Memory utilities](https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/include/nw/os/os_Memory.h): `include/nw/os/os_Memory.h`
- [Containers and resources](https://github.com/ctrdecomp/nintendoware4ctr/blob/legacyModule/include/nw/ut/ut_LinkList.h): `include/nw/ut/ut_LinkList.h`

### Other components

- **Game client**
- **Graphics hardware**
- **CTR sound API**

## Connections

- Game client → Animation: updates frames
- Game client → File streams: opens streams
- Game client → Scene and models: builds scenes
- Game client → Particle effects: configures effects
- Game client → Sound archives: selects sounds
- Game client → 3D sound: sets sound space
- Game client → 2D layout: builds UI
- Game client → Font rendering: writes text
- Sound archives → Sound data: resolves file data
- Audio hardware → CTR sound API: sets effects and volume
- Graphics resources → Scene and models: provides resources
- Scene and models → Rendering: submits scene
- Lighting → Rendering: supplies lighting
- Particle effects → Rendering: supplies particles
- Rendering → Graphics hardware: renders
- 2D layout → Font rendering: uses text
- File streams → Sound archives: reads archive data
- Sound playback → Audio hardware: controls output
- 3D sound → Sound playback: provides 3D parameters
