# bryanthaboi/gen1recomp architecture

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

- Interactive diagram: https://gitdiagram.com/bryanthaboi/gen1recomp
- Repository: https://github.com/bryanthaboi/gen1recomp
- Video tour (about a minute): https://gitdiagram.com/bryanthaboi/gen1recomp/video

## Overview

Gen1Recomp is a native LÖVE2D recreation of Pokémon generations 1 and 2. The principal workflow is: the player supplies a canonical ROM, the importer verifies and decodes it into a private cache, then the launcher starts the Lua-driven game. During play, SDL delivers controls, gameplay systems update world and battles, and the renderer/audio layers produce the result. The tree is dominated by bundled platform libraries; game Lua sources were not sampled, so those nodes and links rely on README capabilities and enclosing paths.

Main entry points: [`mobile/android/love`](https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love) (Game Engine), [`mobile/android/love/src/jni/LuaJIT-2.1/src/lj_dispatch.c`](https://github.com/bryanthaboi/gen1recomp/blob/dev/mobile/android/love/src/jni/LuaJIT-2.1/src/lj_dispatch.c) (LuaJIT Runtime), [`mobile/android/love/src/jni/SDL2`](https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love/src/jni/SDL2) (Controls Binding), [`mobile/android/love/src/jni/oboe`](https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love/src/jni/oboe) (Android Audio)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["ROM Ingestion"]
  node_rom["ROM File"]
  node_importer["ROM Importer"]
  node_validator["SHA-1 Validator"]
  node_decoder["Game Data Decoder"]
end

subgraph group_gameplay["Game Runtime"]
  node_launcher["Game Launcher"]
  node_lua["LuaJIT Runtime<br/>[lj_dispatch.c]"]
  node_engine["Game Engine"]
  node_world["World Behavior"]
  node_battle["Battle Rulesets"]
  node_mods["Mods Manager"]
end

subgraph group_presentation["Presentation"]
  node_renderer["Game Renderer"]
  node_shaderfx["Shader Effects"]
  node_audio["Audio Synthesis"]
end

subgraph group_platform["Platform Services"]
  node_controls["Controls Binding"]
  node_sdl["SDL Platform"]
  node_android_audio["Android Audio"]
end

subgraph group_persistence["Persistent State"]
  node_cache[("Generated Cache")]
end

node_player(("Player"))
node_game_result["Playable Game"]

node_player -->|"supplies"| node_rom
node_rom -->|"imports"| node_importer
node_importer -->|"verifies"| node_validator
node_importer -->|"decodes"| node_decoder
node_decoder -->|"writes data"| node_cache
node_launcher -->|"reads data"| node_cache
node_importer -->|"starts game"| node_launcher
node_launcher -->|"starts runtime"| node_lua
node_lua -->|"executes scripts"| node_engine
node_sdl -->|"delivers input"| node_controls
node_controls -->|"dispatches actions"| node_engine
node_engine -->|"updates world"| node_world
node_engine -->|"runs battles"| node_battle
node_engine -.->|"dispatches mods"| node_mods
node_engine -->|"renders frame"| node_renderer
node_renderer -.->|"applies effects"| node_shaderfx
node_engine -->|"synthesizes sound"| node_audio
node_audio -.->|"outputs audio"| node_android_audio
node_renderer -->|"produces visuals"| node_game_result
node_android_audio -.->|"produces sound"| node_game_result

click node_importer "https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love"
click node_validator "https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love"
click node_decoder "https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love"
click node_cache "https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love"
click node_launcher "https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love"
click node_lua "https://github.com/bryanthaboi/gen1recomp/blob/dev/mobile/android/love/src/jni/LuaJIT-2.1/src/lj_dispatch.c"
click node_engine "https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love"
click node_world "https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love"
click node_battle "https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love"
click node_mods "https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love"
click node_controls "https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love/src/jni/SDL2"
click node_renderer "https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love"
click node_shaderfx "https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love"
click node_audio "https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love"
click node_sdl "https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love/src/jni/SDL2"
click node_android_audio "https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love/src/jni/oboe"

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_rom,node_importer,node_validator,node_decoder toneBlue
class node_launcher,node_lua,node_engine,node_world,node_battle,node_mods toneAmber
class node_renderer,node_shaderfx,node_audio toneMint
class node_controls,node_sdl,node_android_audio toneRose
class node_cache,node_player,node_game_result toneIndigo
```

## Components

### ROM Ingestion

- **ROM File**
- [ROM Importer](https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love): `mobile/android/love`
- [SHA-1 Validator](https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love): `mobile/android/love`
- [Game Data Decoder](https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love): `mobile/android/love`

### Game Runtime

- [Game Launcher](https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love): `mobile/android/love`
- [LuaJIT Runtime](https://github.com/bryanthaboi/gen1recomp/blob/dev/mobile/android/love/src/jni/LuaJIT-2.1/src/lj_dispatch.c): `mobile/android/love/src/jni/LuaJIT-2.1/src/lj_dispatch.c`
- [Game Engine](https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love): `mobile/android/love`
- [World Behavior](https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love): `mobile/android/love`
- [Battle Rulesets](https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love): `mobile/android/love`
- [Mods Manager](https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love): `mobile/android/love`

### Presentation

- [Game Renderer](https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love): `mobile/android/love`
- [Shader Effects](https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love): `mobile/android/love`
- [Audio Synthesis](https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love): `mobile/android/love`

### Platform Services

- [Controls Binding](https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love/src/jni/SDL2): `mobile/android/love/src/jni/SDL2`
- [SDL Platform](https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love/src/jni/SDL2): `mobile/android/love/src/jni/SDL2`
- [Android Audio](https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love/src/jni/oboe): `mobile/android/love/src/jni/oboe`

### Persistent State

- [Generated Cache](https://github.com/bryanthaboi/gen1recomp/tree/dev/mobile/android/love): `mobile/android/love`

### Other components

- **Player**
- **Playable Game**

## Connections

- Player → ROM File: supplies
- ROM File → ROM Importer: imports
- ROM Importer → SHA-1 Validator: verifies
- ROM Importer → Game Data Decoder: decodes
- Game Data Decoder → Generated Cache: writes data
- Game Launcher → Generated Cache: reads data
- ROM Importer → Game Launcher: starts game
- Game Launcher → LuaJIT Runtime: starts runtime
- LuaJIT Runtime → Game Engine: executes scripts
- SDL Platform → Controls Binding: delivers input
- Controls Binding → Game Engine: dispatches actions
- Game Engine → World Behavior: updates world
- Game Engine → Battle Rulesets: runs battles
- Game Engine → Mods Manager: dispatches mods
- Game Engine → Game Renderer: renders frame
- Game Renderer → Shader Effects: applies effects
- Game Engine → Audio Synthesis: synthesizes sound
- Audio Synthesis → Android Audio: outputs audio
- Game Renderer → Playable Game: produces visuals
- Android Audio → Playable Game: produces sound
