# waifwu/meltyreact architecture

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

- Interactive diagram: https://gitdiagram.com/waifwu/meltyreact
- Repository: https://github.com/waifwu/meltyreact

## Overview

This repository is a static-browser WebAssembly port of MELTY BLOOD Re·ACT Final Tuned. The main workflow is to open the game page, load game files through the virtual filesystem, run the WebAssembly game, and present video, audio, and browser controls. Separate capabilities cover save persistence and settings import/export, controller configuration, mobile touch input, a soundtrack player, and character guides. The graph follows README claims and the supplied source index; some implementation details are unsampled, so those links are omitted rather than inferred.

Main entry points: [`play.js`](https://github.com/waifwu/meltyreact/blob/main/play.js) (Game page), [`lib/vfs.js`](https://github.com/waifwu/meltyreact/blob/main/lib/vfs.js) (Virtual filesystem), [`settings.js`](https://github.com/waifwu/meltyreact/blob/main/settings.js) (Settings page), [`lib/settings-store.js`](https://github.com/waifwu/meltyreact/blob/main/lib/settings-store.js) (Host settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_game["Game runtime"]
  node_game_page["Game page<br/>[play.js]"]
  node_wasm["WebAssembly game<br/>[mbr-jspi.wasm]"]
  node_audio["Audio mixer<br/>[audio.js]"]
  node_audio_worklet["Audio worklet<br/>[audio-worklet.js]"]
  node_pause["Pause handling<br/>[pause.js]"]
  node_loading["Loading screen<br/>[loading-screen.js]"]
  node_jspi["Runtime selection<br/>[jspi.js]"]
end

subgraph group_storage["Files and saves"]
  node_vfs["Virtual filesystem<br/>[vfs.js]"]
  node_game_assets[("Game archives")]
  node_archive_manifest["Archive manifest<br/>[manifest.js]"]
  node_archive_cache["Block cache<br/>[blockcache.js]"]
  node_archive_tables["Archive tables<br/>[pfile.js]"]
  node_trim_map["Trim offset map<br/>[ptrim.js]"]
  node_opfs[("OPFS storage<br/>[opfs.js]")]
  node_zip["ZIP import/export<br/>[zip.js]"]
  node_prefetch["Archive prefetch<br/>[prefetch.js]"]
end

subgraph group_controls["Input and settings"]
  node_settings_page["Settings page<br/>[settings.js]"]
  node_settings_store["Host settings<br/>[settings-store.js]"]
  node_game_config["Game config<br/>[gamecfg.js]"]
  node_config_codec["Config codec<br/>[cfgcfg.js]"]
  node_controls_page["Controls page<br/>[controls-page.js]"]
  node_controls_model["Control mappings<br/>[controls-model.js]"]
  node_controls_host["Input host<br/>[controls-host.js]"]
  node_touch["Touch controls<br/>[touch-controls.js]"]
  node_fullscreen["Fullscreen<br/>[fullscreen.js]"]
end

subgraph group_extras["Companion features"]
  node_guide["Move guide<br/>[guide.js]"]
  node_music["Soundtrack player<br/>[music.js]"]
end

node_player(("Player"))

node_player -->|"opens"| node_game_page
node_game_page -->|"mounts files"| node_vfs
node_vfs -->|"reads and writes"| node_opfs
node_vfs -->|"uses manifest"| node_archive_manifest
node_vfs -->|"caches blocks"| node_archive_cache
node_vfs -->|"decodes tables"| node_archive_tables
node_vfs -->|"maps trimmed data"| node_trim_map
node_game_page -->|"runs game"| node_wasm
node_game_page -->|"selects runtime"| node_jspi
node_game_page -->|"prefetches files"| node_prefetch
node_game_page -->|"shows loading"| node_loading
node_game_page -->|"starts audio"| node_audio
node_audio -.->|"uses worklet"| node_audio_worklet
node_game_page -->|"configures input"| node_controls_host
node_game_page -->|"handles pause"| node_pause
node_game_page -->|"enables fullscreen"| node_fullscreen
node_game_page -->|"adds touch input"| node_touch
node_touch -->|"loads mappings"| node_controls_model
node_controls_host -->|"loads mappings"| node_controls_model
node_controls_page -->|"edits mappings"| node_controls_model
node_controls_page -->|"accesses saves"| node_opfs
node_player -->|"remaps controls"| node_controls_page
node_player -->|"configures game"| node_settings_page
node_settings_page -->|"mounts user files"| node_vfs
node_settings_page -->|"loads settings"| node_settings_store
node_settings_page -->|"imports and exports"| node_zip
node_settings_page -->|"reads game config"| node_game_config
node_settings_store -->|"parses archives"| node_zip
node_settings_store -->|"validates config"| node_game_config
node_game_config -->|"encodes config"| node_config_codec
node_player -->|"plays soundtrack"| node_music
node_music -->|"reads archive tables"| node_archive_tables
node_music -->|"reads trimmed archives"| node_trim_map
node_player -->|"views moves"| node_guide

click node_game_page "https://github.com/waifwu/meltyreact/blob/main/play.js"
click node_wasm "https://github.com/waifwu/meltyreact/blob/main/build/mbr-jspi.wasm"
click node_vfs "https://github.com/waifwu/meltyreact/blob/main/lib/vfs.js"
click node_game_assets "https://github.com/waifwu/meltyreact/tree/main/data/MeltyBlood"
click node_archive_manifest "https://github.com/waifwu/meltyreact/blob/main/lib/manifest.js"
click node_archive_cache "https://github.com/waifwu/meltyreact/blob/main/lib/blockcache.js"
click node_archive_tables "https://github.com/waifwu/meltyreact/blob/main/lib/pfile.js"
click node_trim_map "https://github.com/waifwu/meltyreact/blob/main/lib/ptrim.js"
click node_opfs "https://github.com/waifwu/meltyreact/blob/main/lib/opfs.js"
click node_settings_page "https://github.com/waifwu/meltyreact/blob/main/settings.js"
click node_settings_store "https://github.com/waifwu/meltyreact/blob/main/lib/settings-store.js"
click node_zip "https://github.com/waifwu/meltyreact/blob/main/lib/zip.js"
click node_game_config "https://github.com/waifwu/meltyreact/blob/main/lib/gamecfg.js"
click node_config_codec "https://github.com/waifwu/meltyreact/blob/main/lib/cfgcfg.js"
click node_controls_page "https://github.com/waifwu/meltyreact/blob/main/lib/controls-page.js"
click node_controls_model "https://github.com/waifwu/meltyreact/blob/main/lib/controls-model.js"
click node_controls_host "https://github.com/waifwu/meltyreact/blob/main/lib/controls-host.js"
click node_touch "https://github.com/waifwu/meltyreact/blob/main/lib/touch-controls.js"
click node_fullscreen "https://github.com/waifwu/meltyreact/blob/main/lib/fullscreen.js"
click node_audio "https://github.com/waifwu/meltyreact/blob/main/lib/audio.js"
click node_audio_worklet "https://github.com/waifwu/meltyreact/blob/main/lib/audio-worklet.js"
click node_guide "https://github.com/waifwu/meltyreact/blob/main/guide.js"
click node_music "https://github.com/waifwu/meltyreact/blob/main/music.js"
click node_pause "https://github.com/waifwu/meltyreact/blob/main/lib/pause.js"
click node_prefetch "https://github.com/waifwu/meltyreact/blob/main/lib/prefetch.js"
click node_loading "https://github.com/waifwu/meltyreact/blob/main/lib/loading-screen.js"
click node_jspi "https://github.com/waifwu/meltyreact/blob/main/lib/jspi.js"

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_page,node_wasm,node_audio,node_audio_worklet,node_pause,node_loading,node_jspi toneBlue
class node_vfs,node_game_assets,node_archive_manifest,node_archive_cache,node_archive_tables,node_trim_map,node_opfs,node_zip,node_prefetch toneAmber
class node_settings_page,node_settings_store,node_game_config,node_config_codec,node_controls_page,node_controls_model,node_controls_host,node_touch,node_fullscreen toneMint
class node_guide,node_music toneRose
class node_player toneIndigo
```

## Components

### Game runtime

- [Game page](https://github.com/waifwu/meltyreact/blob/main/play.js): `play.js`
- [WebAssembly game](https://github.com/waifwu/meltyreact/blob/main/build/mbr-jspi.wasm): `build/mbr-jspi.wasm`
- [Audio mixer](https://github.com/waifwu/meltyreact/blob/main/lib/audio.js): `lib/audio.js`
- [Audio worklet](https://github.com/waifwu/meltyreact/blob/main/lib/audio-worklet.js): `lib/audio-worklet.js`
- [Pause handling](https://github.com/waifwu/meltyreact/blob/main/lib/pause.js): `lib/pause.js`
- [Loading screen](https://github.com/waifwu/meltyreact/blob/main/lib/loading-screen.js): `lib/loading-screen.js`
- [Runtime selection](https://github.com/waifwu/meltyreact/blob/main/lib/jspi.js): `lib/jspi.js`

### Files and saves

- [Virtual filesystem](https://github.com/waifwu/meltyreact/blob/main/lib/vfs.js): `lib/vfs.js`
- [Game archives](https://github.com/waifwu/meltyreact/tree/main/data/MeltyBlood): `data/MeltyBlood`
- [Archive manifest](https://github.com/waifwu/meltyreact/blob/main/lib/manifest.js): `lib/manifest.js`
- [Block cache](https://github.com/waifwu/meltyreact/blob/main/lib/blockcache.js): `lib/blockcache.js`
- [Archive tables](https://github.com/waifwu/meltyreact/blob/main/lib/pfile.js): `lib/pfile.js`
- [Trim offset map](https://github.com/waifwu/meltyreact/blob/main/lib/ptrim.js): `lib/ptrim.js`
- [OPFS storage](https://github.com/waifwu/meltyreact/blob/main/lib/opfs.js): `lib/opfs.js`
- [ZIP import/export](https://github.com/waifwu/meltyreact/blob/main/lib/zip.js): `lib/zip.js`
- [Archive prefetch](https://github.com/waifwu/meltyreact/blob/main/lib/prefetch.js): `lib/prefetch.js`

### Input and settings

- [Settings page](https://github.com/waifwu/meltyreact/blob/main/settings.js): `settings.js`
- [Host settings](https://github.com/waifwu/meltyreact/blob/main/lib/settings-store.js): `lib/settings-store.js`
- [Game config](https://github.com/waifwu/meltyreact/blob/main/lib/gamecfg.js): `lib/gamecfg.js`
- [Config codec](https://github.com/waifwu/meltyreact/blob/main/lib/cfgcfg.js): `lib/cfgcfg.js`
- [Controls page](https://github.com/waifwu/meltyreact/blob/main/lib/controls-page.js): `lib/controls-page.js`
- [Control mappings](https://github.com/waifwu/meltyreact/blob/main/lib/controls-model.js): `lib/controls-model.js`
- [Input host](https://github.com/waifwu/meltyreact/blob/main/lib/controls-host.js): `lib/controls-host.js`
- [Touch controls](https://github.com/waifwu/meltyreact/blob/main/lib/touch-controls.js): `lib/touch-controls.js`
- [Fullscreen](https://github.com/waifwu/meltyreact/blob/main/lib/fullscreen.js): `lib/fullscreen.js`

### Companion features

- [Move guide](https://github.com/waifwu/meltyreact/blob/main/guide.js): `guide.js`
- [Soundtrack player](https://github.com/waifwu/meltyreact/blob/main/music.js): `music.js`

### Other components

- **Player**

## Connections

- Player → Game page: opens (evidence: `README.md`)
- Game page → Virtual filesystem: mounts files (evidence: `play.js`)
- Virtual filesystem → OPFS storage: reads and writes (evidence: `lib/vfs.js`)
- Virtual filesystem → Archive manifest: uses manifest (evidence: `lib/vfs.js`)
- Virtual filesystem → Block cache: caches blocks (evidence: `lib/vfs.js`)
- Virtual filesystem → Archive tables: decodes tables (evidence: `lib/vfs.js`)
- Virtual filesystem → Trim offset map: maps trimmed data (evidence: `lib/vfs.js`)
- Game page → WebAssembly game: runs game (evidence: `README.md`)
- Game page → Runtime selection: selects runtime (evidence: `play.js`)
- Game page → Archive prefetch: prefetches files (evidence: `play.js`)
- Game page → Loading screen: shows loading (evidence: `play.js`)
- Game page → Audio mixer: starts audio (evidence: `play.js`)
- Audio mixer → Audio worklet: uses worklet
- Game page → Input host: configures input (evidence: `play.js`)
- Game page → Pause handling: handles pause (evidence: `play.js`)
- Game page → Fullscreen: enables fullscreen (evidence: `play.js`)
- Game page → Touch controls: adds touch input (evidence: `play.js`)
- Touch controls → Control mappings: loads mappings (evidence: `lib/touch-controls.js`)
- Input host → Control mappings: loads mappings (evidence: `lib/controls-host.js`)
- Controls page → Control mappings: edits mappings (evidence: `lib/controls-page.js`)
- Controls page → OPFS storage: accesses saves (evidence: `lib/controls-page.js`)
- Player → Controls page: remaps controls (evidence: `README.md`)
- Player → Settings page: configures game (evidence: `README.md`)
- Settings page → Virtual filesystem: mounts user files (evidence: `settings.js`)
- Settings page → Host settings: loads settings (evidence: `settings.js`)
- Settings page → ZIP import/export: imports and exports (evidence: `settings.js`)
- Settings page → Game config: reads game config (evidence: `settings.js`)
- Host settings → ZIP import/export: parses archives (evidence: `lib/settings-store.js`)
- Host settings → Game config: validates config (evidence: `lib/settings-store.js`)
- Game config → Config codec: encodes config (evidence: `lib/gamecfg.js`)
- Player → Soundtrack player: plays soundtrack (evidence: `README.md`)
- Soundtrack player → Archive tables: reads archive tables (evidence: `music.js`)
- Soundtrack player → Trim offset map: reads trimmed archives (evidence: `music.js`)
- Player → Move guide: views moves (evidence: `README.md`)
