# crystal1612/th07_vita architecture

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

- Interactive diagram: https://gitdiagram.com/crystal1612/th07_vita
- Repository: https://github.com/crystal1612/th07_vita

## Overview

This repository is a PSVita/SDL2 port of Touhou 7: the player navigates menus, starts a stage, plays through scripted enemy encounters and bullet-hell combat, then reaches results or replay. The graph retains the major runtime stages and supporting rendering, assets, audio, input, and replay capabilities. Relationships are limited to explicit README statements and SOURCE INDEX references in the sampled files; unsampled modules are included where the tree and index establish product scope, without guessed call links.

Main entry points: [`src/GameManager.cpp`](https://github.com/crystal1612/th07_vita/blob/vita_port/src/GameManager.cpp) (Game state), [`src/EnemyManager.cpp`](https://github.com/crystal1612/th07_vita/blob/vita_port/src/EnemyManager.cpp) (Enemy system), [`src/Supervisor.cpp`](https://github.com/crystal1612/th07_vita/blob/vita_port/src/Supervisor.cpp) (Runtime supervisor), [`src/Player.cpp`](https://github.com/crystal1612/th07_vita/blob/vita_port/src/Player.cpp) (Player combat)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game runtime"]
  node_game["Game state<br/>[GameManager.cpp]"]
  node_supervisor["Runtime supervisor<br/>[Supervisor.cpp]"]
end

subgraph group_combat["Stage and combat"]
  node_player["Player combat<br/>[Player.cpp]"]
  node_bullets["Bullet system<br/>[BulletManager.cpp]"]
  node_enemies["Enemy system<br/>[EnemyManager.cpp]"]
  node_items["Items and drops<br/>[ItemManager.cpp]"]
  node_effects["Combat effects<br/>[EffectManager.cpp]"]
  node_scripts["Enemy scripts<br/>[EclManager.cpp]"]
  node_stage["Stage progression<br/>[Stage.cpp]"]
end

subgraph group_presentation["Presentation"]
  node_menu["Main menu<br/>[MainMenu.cpp]"]
  node_gui["Game GUI<br/>[Gui.cpp]"]
  node_ascii["Text and pause UI<br/>[AsciiManager.cpp]"]
  node_results["Results screen<br/>[ResultScreen.cpp]"]
  node_ending["Ending<br/>[Ending.cpp]"]
  node_musicroom["Music room<br/>[MusicRoom.cpp]"]
  node_animation["Animation manager<br/>[AnmManager.cpp]"]
end

subgraph group_platform["Platform services"]
  node_graphics["OpenGL ES renderer<br/>[Gles.cpp]"]
  node_window["Game window<br/>[GameWindow.cpp]"]
  node_controller["Controller input<br/>[Controller.cpp]"]
  node_audio["Audio playback<br/>[SoundPlayer.cpp]"]
  node_midi["MIDI output<br/>[MidiOutput.cpp]"]
end

subgraph group_data["Assets and persistence"]
  node_filesystem["Game file access<br/>[FileSystem.cpp]"]
  node_archive["PBG4 archives<br/>[Pbg4Archive.cpp]"]
  node_lzss["LZSS compression<br/>[Lzss.cpp]"]
  node_replay["Replay management<br/>[ReplayManager.cpp]"]
end

node_actor(("Player"))
node_original["Original game files"]

node_actor -.->|"navigates"| node_menu
node_game -->|"updates combat"| node_player
node_game -->|"uses stages"| node_stage
node_game -->|"uses scripts"| node_scripts
node_game -->|"uses enemies"| node_enemies
node_game -->|"uses UI"| node_ascii
node_game -->|"uses GUI"| node_gui
node_game -->|"uses runtime"| node_supervisor
node_scripts -->|"controls"| node_enemies
node_enemies -->|"uses drops"| node_items
node_enemies -->|"uses scripts"| node_scripts
node_enemies -.->|"uses bullets"| node_bullets
node_enemies -.->|"uses effects"| node_effects
node_player -.->|"reads state"| node_game
node_player -.->|"uses effects"| node_effects
node_bullets -->|"checks collision"| node_player
node_bullets -->|"uses items"| node_items
node_items -->|"reads state"| node_game
node_items -->|"uses effects"| node_effects
node_effects -->|"reads stage"| node_stage
node_menu -.->|"starts game"| node_game
node_game -->|"uses results"| node_results
node_game -->|"reads input"| node_controller
node_game -->|"uses audio"| node_audio
node_game -->|"uses animation"| node_animation
node_ascii -->|"draws with"| node_animation
node_animation -->|"loads assets"| node_filesystem
node_animation -.->|"renders through"| node_graphics
node_graphics -->|"uses window"| node_window
node_supervisor -->|"owns renderer"| node_graphics
node_supervisor -.->|"uses MIDI"| node_midi
node_supervisor -->|"loads audio"| node_audio
node_replay -->|"reads and writes"| node_filesystem
node_replay -->|"uses compression"| node_lzss
node_archive -->|"decompresses with"| node_lzss
node_original -->|"provides game data"| node_filesystem

click node_player "https://github.com/crystal1612/th07_vita/blob/vita_port/src/Player.cpp"
click node_bullets "https://github.com/crystal1612/th07_vita/blob/vita_port/src/BulletManager.cpp"
click node_enemies "https://github.com/crystal1612/th07_vita/blob/vita_port/src/EnemyManager.cpp"
click node_items "https://github.com/crystal1612/th07_vita/blob/vita_port/src/ItemManager.cpp"
click node_effects "https://github.com/crystal1612/th07_vita/blob/vita_port/src/EffectManager.cpp"
click node_scripts "https://github.com/crystal1612/th07_vita/blob/vita_port/src/EclManager.cpp"
click node_stage "https://github.com/crystal1612/th07_vita/blob/vita_port/src/Stage.cpp"
click node_game "https://github.com/crystal1612/th07_vita/blob/vita_port/src/GameManager.cpp"
click node_supervisor "https://github.com/crystal1612/th07_vita/blob/vita_port/src/Supervisor.cpp"
click node_menu "https://github.com/crystal1612/th07_vita/blob/vita_port/src/MainMenu.cpp"
click node_gui "https://github.com/crystal1612/th07_vita/blob/vita_port/src/Gui.cpp"
click node_ascii "https://github.com/crystal1612/th07_vita/blob/vita_port/src/AsciiManager.cpp"
click node_results "https://github.com/crystal1612/th07_vita/blob/vita_port/src/ResultScreen.cpp"
click node_ending "https://github.com/crystal1612/th07_vita/blob/vita_port/src/Ending.cpp"
click node_musicroom "https://github.com/crystal1612/th07_vita/blob/vita_port/src/MusicRoom.cpp"
click node_animation "https://github.com/crystal1612/th07_vita/blob/vita_port/src/AnmManager.cpp"
click node_graphics "https://github.com/crystal1612/th07_vita/blob/vita_port/src/graphics/Gles.cpp"
click node_window "https://github.com/crystal1612/th07_vita/blob/vita_port/src/GameWindow.cpp"
click node_controller "https://github.com/crystal1612/th07_vita/blob/vita_port/src/Controller.cpp"
click node_audio "https://github.com/crystal1612/th07_vita/blob/vita_port/src/SoundPlayer.cpp"
click node_midi "https://github.com/crystal1612/th07_vita/blob/vita_port/src/MidiOutput.cpp"
click node_filesystem "https://github.com/crystal1612/th07_vita/blob/vita_port/src/FileSystem.cpp"
click node_archive "https://github.com/crystal1612/th07_vita/blob/vita_port/src/pbg4/Pbg4Archive.cpp"
click node_lzss "https://github.com/crystal1612/th07_vita/blob/vita_port/src/pbg4/Lzss.cpp"
click node_replay "https://github.com/crystal1612/th07_vita/blob/vita_port/src/ReplayManager.cpp"

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,node_supervisor toneBlue
class node_player,node_bullets,node_enemies,node_items,node_effects,node_scripts,node_stage toneAmber
class node_menu,node_gui,node_ascii,node_results,node_ending,node_musicroom,node_animation toneMint
class node_graphics,node_window,node_controller,node_audio,node_midi toneRose
class node_filesystem,node_archive,node_lzss,node_replay,node_actor,node_original toneIndigo
```

## Components

### Game runtime

- [Game state](https://github.com/crystal1612/th07_vita/blob/vita_port/src/GameManager.cpp): `src/GameManager.cpp`
- [Runtime supervisor](https://github.com/crystal1612/th07_vita/blob/vita_port/src/Supervisor.cpp): `src/Supervisor.cpp`

### Stage and combat

- [Player combat](https://github.com/crystal1612/th07_vita/blob/vita_port/src/Player.cpp): `src/Player.cpp`
- [Bullet system](https://github.com/crystal1612/th07_vita/blob/vita_port/src/BulletManager.cpp): `src/BulletManager.cpp`
- [Enemy system](https://github.com/crystal1612/th07_vita/blob/vita_port/src/EnemyManager.cpp): `src/EnemyManager.cpp`
- [Items and drops](https://github.com/crystal1612/th07_vita/blob/vita_port/src/ItemManager.cpp): `src/ItemManager.cpp`
- [Combat effects](https://github.com/crystal1612/th07_vita/blob/vita_port/src/EffectManager.cpp): `src/EffectManager.cpp`
- [Enemy scripts](https://github.com/crystal1612/th07_vita/blob/vita_port/src/EclManager.cpp): `src/EclManager.cpp`
- [Stage progression](https://github.com/crystal1612/th07_vita/blob/vita_port/src/Stage.cpp): `src/Stage.cpp`

### Presentation

- [Main menu](https://github.com/crystal1612/th07_vita/blob/vita_port/src/MainMenu.cpp): `src/MainMenu.cpp`
- [Game GUI](https://github.com/crystal1612/th07_vita/blob/vita_port/src/Gui.cpp): `src/Gui.cpp`
- [Text and pause UI](https://github.com/crystal1612/th07_vita/blob/vita_port/src/AsciiManager.cpp): `src/AsciiManager.cpp`
- [Results screen](https://github.com/crystal1612/th07_vita/blob/vita_port/src/ResultScreen.cpp): `src/ResultScreen.cpp`
- [Ending](https://github.com/crystal1612/th07_vita/blob/vita_port/src/Ending.cpp): `src/Ending.cpp`
- [Music room](https://github.com/crystal1612/th07_vita/blob/vita_port/src/MusicRoom.cpp): `src/MusicRoom.cpp`
- [Animation manager](https://github.com/crystal1612/th07_vita/blob/vita_port/src/AnmManager.cpp): `src/AnmManager.cpp`

### Platform services

- [OpenGL ES renderer](https://github.com/crystal1612/th07_vita/blob/vita_port/src/graphics/Gles.cpp): `src/graphics/Gles.cpp`
- [Game window](https://github.com/crystal1612/th07_vita/blob/vita_port/src/GameWindow.cpp): `src/GameWindow.cpp`
- [Controller input](https://github.com/crystal1612/th07_vita/blob/vita_port/src/Controller.cpp): `src/Controller.cpp`
- [Audio playback](https://github.com/crystal1612/th07_vita/blob/vita_port/src/SoundPlayer.cpp): `src/SoundPlayer.cpp`
- [MIDI output](https://github.com/crystal1612/th07_vita/blob/vita_port/src/MidiOutput.cpp): `src/MidiOutput.cpp`

### Assets and persistence

- [Game file access](https://github.com/crystal1612/th07_vita/blob/vita_port/src/FileSystem.cpp): `src/FileSystem.cpp`
- [PBG4 archives](https://github.com/crystal1612/th07_vita/blob/vita_port/src/pbg4/Pbg4Archive.cpp): `src/pbg4/Pbg4Archive.cpp`
- [LZSS compression](https://github.com/crystal1612/th07_vita/blob/vita_port/src/pbg4/Lzss.cpp): `src/pbg4/Lzss.cpp`
- [Replay management](https://github.com/crystal1612/th07_vita/blob/vita_port/src/ReplayManager.cpp): `src/ReplayManager.cpp`

### Other components

- **Player**
- **Original game files**

## Connections

- Player → Main menu: navigates
- Game state → Player combat: updates combat (evidence: `src/GameManager.cpp`)
- Game state → Stage progression: uses stages (evidence: `src/GameManager.cpp`)
- Game state → Enemy scripts: uses scripts (evidence: `src/GameManager.cpp`)
- Game state → Enemy system: uses enemies (evidence: `src/GameManager.cpp`)
- Game state → Text and pause UI: uses UI (evidence: `src/GameManager.cpp`)
- Game state → Game GUI: uses GUI (evidence: `src/GameManager.cpp`)
- Game state → Runtime supervisor: uses runtime (evidence: `src/GameManager.cpp`)
- Enemy scripts → Enemy system: controls (evidence: `src/EclManager.cpp`)
- Enemy system → Items and drops: uses drops (evidence: `src/EnemyManager.cpp`)
- Enemy system → Enemy scripts: uses scripts (evidence: `src/EnemyManager.cpp`)
- Enemy system → Bullet system: uses bullets
- Enemy system → Combat effects: uses effects
- Player combat → Game state: reads state
- Player combat → Combat effects: uses effects
- Bullet system → Player combat: checks collision (evidence: `src/BulletManager.cpp`)
- Bullet system → Items and drops: uses items (evidence: `src/BulletManager.cpp`)
- Items and drops → Game state: reads state (evidence: `src/ItemManager.cpp`)
- Items and drops → Combat effects: uses effects (evidence: `src/ItemManager.cpp`)
- Combat effects → Stage progression: reads stage (evidence: `src/EffectManager.cpp`)
- Main menu → Game state: starts game
- Game state → Results screen: uses results (evidence: `src/GameManager.cpp`)
- Game state → Controller input: reads input (evidence: `src/GameManager.cpp`)
- Game state → Audio playback: uses audio (evidence: `src/GameManager.cpp`)
- Game state → Animation manager: uses animation (evidence: `src/GameManager.cpp`)
- Text and pause UI → Animation manager: draws with (evidence: `src/AsciiManager.cpp`)
- Animation manager → Game file access: loads assets (evidence: `src/AnmManager.cpp`)
- Animation manager → OpenGL ES renderer: renders through
- OpenGL ES renderer → Game window: uses window (evidence: `src/graphics/Gles.cpp`)
- Runtime supervisor → OpenGL ES renderer: owns renderer (evidence: `src/graphics/Gles.cpp`)
- Runtime supervisor → MIDI output: uses MIDI
- Runtime supervisor → Audio playback: loads audio
- Replay management → Game file access: reads and writes (evidence: `src/ReplayManager.cpp`)
- Replay management → LZSS compression: uses compression (evidence: `src/ReplayManager.cpp`)
- PBG4 archives → LZSS compression: decompresses with (evidence: `src/pbg4/Pbg4Archive.cpp`)
- Original game files → Game file access: provides game data (evidence: `README.md`)
