# snuri00/psp-web-recomp architecture

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

- Interactive diagram: https://gitdiagram.com/snuri00/psp-web-recomp
- Repository: https://github.com/snuri00/psp-web-recomp

## Overview

PSP Web Recomp runs a user-supplied PSP game by translating its MIPS executable ahead of time, then executing the generated code against a high-level PSP kernel and guest-memory model. At runtime, the host entry advances guest frames and routes system calls into kernel services; display lists are dispatched to the GE and WebGL backend, while audio is mixed for browser playback. Disc files can be fetched on demand. The README documents these product capabilities; source excerpts show selected runtime links, so unsampled service connections are omitted.

Main entry points: [`profile/host/kernel.cpp`](https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/kernel.cpp) (Kernel and scheduler), [`profile/host/main.cpp`](https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/main.cpp) (Host entry), [`profile`](https://github.com/snuri00/psp-web-recomp/tree/main/profile) (Translated game), [`profile/host/io.cpp`](https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/io.cpp) (File I/O)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_game["Translated game"]
  node_host["Host entry<br/>[main.cpp]"]
end

subgraph group_kernel["PSP kernel"]
  node_kernel["Kernel and scheduler<br/>[kernel.cpp]"]
  node_devices["Device services<br/>[devices.cpp]"]
  node_io["File I/O<br/>[io.cpp]"]
  node_pgd["PGD decryption<br/>[pgd.cpp]"]
end

subgraph group_graphics["Graphics"]
  node_ge["Display-list engine<br/>[ge.cpp]"]
  node_worker["GE worker<br/>[ge_worker.cpp]"]
  node_gl["WebGL renderer<br/>[ge_gl.cpp]"]
end

subgraph group_media["Media and files"]
  node_audio["Audio output<br/>[sas.cpp]"]
  node_atrac["ATRAC decoding<br/>[atrac.cpp]"]
  node_mpeg["Movie bookkeeping<br/>[mpeg.cpp]"]
  node_webfs[("Streamed disc files<br/>[webfs.cpp]")]
end

node_owner(("Game owner"))
node_browser(("Browser page"))

node_owner -->|"provides disc"| node_game
node_game -->|"runs in"| node_host
node_host -->|"starts session"| node_kernel
node_kernel -->|"installs services"| node_devices
node_kernel -->|"installs services"| node_audio
node_kernel -->|"installs services"| node_atrac
node_kernel -->|"installs services"| node_mpeg
node_kernel -.->|"handles file calls"| node_io
node_io -->|"decrypts PGD"| node_pgd
node_kernel -->|"queues lists"| node_worker
node_worker -->|"runs lists"| node_ge
node_ge -->|"submits draws"| node_gl
node_kernel -.->|"reads disc files"| node_webfs
node_webfs -->|"fetches ranges"| node_browser
node_host -->|"plays mixed audio"| node_browser
node_browser -->|"sends controls"| node_host

click node_game "https://github.com/snuri00/psp-web-recomp/tree/main/profile"
click node_host "https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/main.cpp"
click node_kernel "https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/kernel.cpp"
click node_devices "https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/devices.cpp"
click node_io "https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/io.cpp"
click node_pgd "https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/pgd.cpp"
click node_ge "https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/ge.cpp"
click node_worker "https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/ge_worker.cpp"
click node_gl "https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/ge_gl.cpp"
click node_audio "https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/sas.cpp"
click node_atrac "https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/atrac.cpp"
click node_mpeg "https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/mpeg.cpp"
click node_webfs "https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/webfs.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_host,node_browser toneBlue
class node_kernel,node_devices,node_io,node_pgd toneAmber
class node_ge,node_worker,node_gl toneMint
class node_audio,node_atrac,node_mpeg,node_webfs toneRose
class node_owner toneIndigo
```

## Components

### Runtime

- [Translated game](https://github.com/snuri00/psp-web-recomp/tree/main/profile): `profile`
- [Host entry](https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/main.cpp): `profile/host/main.cpp`

### PSP kernel

- [Kernel and scheduler](https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/kernel.cpp): `profile/host/kernel.cpp`
- [Device services](https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/devices.cpp): `profile/host/devices.cpp`
- [File I/O](https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/io.cpp): `profile/host/io.cpp`
- [PGD decryption](https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/pgd.cpp): `profile/host/pgd.cpp`

### Graphics

- [Display-list engine](https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/ge.cpp): `profile/host/ge.cpp`
- [GE worker](https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/ge_worker.cpp): `profile/host/ge_worker.cpp`
- [WebGL renderer](https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/ge_gl.cpp): `profile/host/ge_gl.cpp`

### Media and files

- [Audio output](https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/sas.cpp): `profile/host/sas.cpp`
- [ATRAC decoding](https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/atrac.cpp): `profile/host/atrac.cpp`
- [Movie bookkeeping](https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/mpeg.cpp): `profile/host/mpeg.cpp`
- [Streamed disc files](https://github.com/snuri00/psp-web-recomp/blob/main/profile/host/webfs.cpp): `profile/host/webfs.cpp`

### Other components

- **Game owner**
- **Browser page**

## Connections

- Game owner → Translated game: provides disc (evidence: `README.md`)
- Translated game → Host entry: runs in (evidence: `README.md`)
- Host entry → Kernel and scheduler: starts session (evidence: `profile/host/main.cpp`)
- Kernel and scheduler → Device services: installs services (evidence: `profile/host/kernel.cpp`)
- Kernel and scheduler → Audio output: installs services (evidence: `profile/host/kernel.cpp`)
- Kernel and scheduler → ATRAC decoding: installs services (evidence: `profile/host/kernel.cpp`)
- Kernel and scheduler → Movie bookkeeping: installs services (evidence: `profile/host/kernel.cpp`)
- Kernel and scheduler → File I/O: handles file calls
- File I/O → PGD decryption: decrypts PGD (evidence: `profile/host/io.cpp`)
- Kernel and scheduler → GE worker: queues lists (evidence: `README.md`)
- GE worker → Display-list engine: runs lists (evidence: `profile/host/ge_worker.cpp`)
- Display-list engine → WebGL renderer: submits draws (evidence: `profile/host/ge.cpp`)
- Kernel and scheduler → Streamed disc files: reads disc files
- Streamed disc files → Browser page: fetches ranges (evidence: `README.md`)
- Host entry → Browser page: plays mixed audio (evidence: `profile/host/main.cpp`)
- Browser page → Host entry: sends controls (evidence: `profile/host/main.cpp`)
