# gameboy829/ps5-lz4-game-compressor architecture

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

- Interactive diagram: https://gitdiagram.com/gameboy829/ps5-lz4-game-compressor
- Repository: https://github.com/gameboy829/ps5-lz4-game-compressor
- Video tour (about a minute): https://gitdiagram.com/gameboy829/ps5-lz4-game-compressor/video

## Overview

LZ4 Game Compressor is a PS5-hosted browser app that turns supported game images or folder dumps into AMPR LZ4 packs. The user selects a source and destination, configures verification and original-game handling, then monitors a cancellable conversion; the service coordinates mounting, packing, runtime installation, verification, and post-conversion storage actions. The graph combines README-documented behavior with sampled service/backend code and the source index. Several conversion and web-service internals were not sampled, so those links are documented rather than asserted as source-level calls.

Main entry points: [`ampr-ps5/standalone/main.cpp`](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-ps5/standalone/main.cpp) (App service), [`ampr-ps5/src/ampr_backend.cpp`](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-ps5/src/ampr_backend.cpp) (PS5 pack backend), [`ampr-native/src/main.cpp`](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/src/main.cpp) (Native pack engine), [`ampr-native/reference/external/ampr_emu/src/ampr_emu_pack.cpp`](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/reference/external/ampr_emu/src/ampr_emu_pack.cpp) (AMPR pack runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Console app"]
  node_browser["Browser interface<br/>[main.cpp]"]
  node_service["App service<br/>[main.cpp]"]
  node_http["HTTP server<br/>[http.h]"]
  node_game_library["Game library<br/>[main.cpp]"]
  node_original_ops["Original game handling<br/>[original.h]"]
end

subgraph group_convert["Conversion engine"]
  node_backend["PS5 pack backend<br/>[ampr_backend.cpp]"]
  node_native_engine["Native pack engine<br/>[main.cpp]"]
  node_index["Source index<br/>[index_builder.h]"]
  node_profile_packer["Profile packer<br/>[profile_packer.h]"]
  node_universal_profile["Universal profile"]
  node_pipeline_io["Pipeline I/O<br/>[pipeline_io.h]"]
  node_pipeline_diagnostics["Pipeline diagnostics"]
end

subgraph group_format["AMPR format and runtime"]
  node_ampr_runtime["AMPR pack runtime<br/>[ampr_emu_pack.cpp]"]
  node_apr_services["APR services"]
  node_aio["Async I/O broker"]
  node_command_dump["Command buffer dump"]
  node_command_packing["Command packing"]
  node_runtime_config["Runtime config and errors<br/>[ampr_emu_config.h]"]
  node_runtime_log["Runtime logging<br/>[ampr_emu_log.h]"]
  node_runtime_sync["Runtime synchronization<br/>[ampr_emu_sync.h]"]
end

subgraph group_tools["Pack tooling"]
  node_pack_cli["AMPR pack tools<br/>[ampr_pack.py]"]
  node_pack_format["AMPR format utilities"]
  node_command_log_parser["Command log parser"]
end

node_user(("Browser user"))
node_shadow["ShadowMountPlus"]

node_user -->|"selects and configures"| node_browser
node_browser -.->|"uses web interface"| node_http
node_http -.->|"routes requests"| node_service
node_service -->|"loads library"| node_game_library
node_game_library -->|"queries mounted games"| node_shadow
node_service -->|"mounts and refreshes"| node_shadow
node_service -->|"starts conversion"| node_backend
node_backend -->|"invokes pack engine"| node_native_engine
node_backend -->|"builds fresh index"| node_index
node_backend -->|"generates profile"| node_universal_profile
node_native_engine -->|"uses packer"| node_profile_packer
node_native_engine -->|"reads and writes data"| node_pipeline_io
node_native_engine -.->|"reports pipeline metrics"| node_pipeline_diagnostics
node_service -->|"moves or removes original"| node_original_ops
node_backend -->|"installs pinned runtime"| node_ampr_runtime
node_ampr_runtime -.->|"uses asynchronous I/O"| node_aio
node_apr_services -->|"uses command buffer support"| node_command_dump
node_command_dump -->|"uses packing helpers"| node_command_packing
node_ampr_runtime -->|"uses runtime definitions"| node_runtime_config
node_ampr_runtime -.->|"uses synchronization"| node_runtime_sync
node_apr_services -->|"logs service activity"| node_runtime_log
node_pack_cli -->|"uses format utilities"| node_pack_format
node_pack_cli -.->|"reads command logs"| node_command_log_parser

click node_browser "https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-ps5/standalone/main.cpp"
click node_service "https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-ps5/standalone/main.cpp"
click node_http "https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-ps5/standalone/http.h"
click node_game_library "https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-ps5/standalone/main.cpp"
click node_original_ops "https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-ps5/standalone/original.h"
click node_backend "https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-ps5/src/ampr_backend.cpp"
click node_native_engine "https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/src/main.cpp"
click node_index "https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/src/index_builder.h"
click node_profile_packer "https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/src/profile_packer.h"
click node_universal_profile "https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/src/universal_profile.h"
click node_pipeline_io "https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/src/pipeline_io.h"
click node_pipeline_diagnostics "https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/src/pipeline_diagnostics.h"
click node_ampr_runtime "https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/reference/external/ampr_emu/src/ampr_emu_pack.cpp"
click node_apr_services "https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/reference/external/ampr_emu/src/ampr_emu_apr_services.cpp"
click node_aio "https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/reference/external/ampr_emu/include/ampr_emu_aio_broker.h"
click node_command_dump "https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/reference/external/ampr_emu/include/ampr_emu_command_buffer_dump.h"
click node_command_packing "https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/reference/external/ampr_emu/include/ampr_emu_command_packing.h"
click node_runtime_config "https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/reference/external/ampr_emu/include/ampr_emu_config.h"
click node_runtime_log "https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/reference/external/ampr_emu/include/ampr_emu_log.h"
click node_runtime_sync "https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/reference/external/ampr_emu/include/ampr_emu_sync.h"
click node_pack_cli "https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/reference/external/ampr_emu/tools/ampr_pack.py"
click node_pack_format "https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/reference/external/ampr_emu/tools/ampr_pack_format.py"
click node_command_log_parser "https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/reference/external/ampr_emu/tools/parse_ampr_command_log.py"

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_browser,node_service,node_http,node_game_library,node_original_ops,node_user toneBlue
class node_backend,node_native_engine,node_index,node_profile_packer,node_universal_profile,node_pipeline_io,node_pipeline_diagnostics toneAmber
class node_ampr_runtime,node_apr_services,node_aio,node_command_dump,node_command_packing,node_runtime_config,node_runtime_log,node_runtime_sync toneMint
class node_pack_cli,node_pack_format,node_command_log_parser toneRose
class node_shadow toneIndigo
```

## Components

### Console app

- [Browser interface](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-ps5/standalone/main.cpp): `ampr-ps5/standalone/main.cpp`
- [App service](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-ps5/standalone/main.cpp): `ampr-ps5/standalone/main.cpp`
- [HTTP server](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-ps5/standalone/http.h): `ampr-ps5/standalone/http.h`
- [Game library](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-ps5/standalone/main.cpp): `ampr-ps5/standalone/main.cpp`
- [Original game handling](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-ps5/standalone/original.h): `ampr-ps5/standalone/original.h`

### Conversion engine

- [PS5 pack backend](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-ps5/src/ampr_backend.cpp): `ampr-ps5/src/ampr_backend.cpp`
- [Native pack engine](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/src/main.cpp): `ampr-native/src/main.cpp`
- [Source index](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/src/index_builder.h): `ampr-native/src/index_builder.h`
- [Profile packer](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/src/profile_packer.h): `ampr-native/src/profile_packer.h`
- [Universal profile](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/src/universal_profile.h): `ampr-native/src/universal_profile.h`
- [Pipeline I/O](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/src/pipeline_io.h): `ampr-native/src/pipeline_io.h`
- [Pipeline diagnostics](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/src/pipeline_diagnostics.h): `ampr-native/src/pipeline_diagnostics.h`

### AMPR format and runtime

- [AMPR pack runtime](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/reference/external/ampr_emu/src/ampr_emu_pack.cpp): `ampr-native/reference/external/ampr_emu/src/ampr_emu_pack.cpp`
- [APR services](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/reference/external/ampr_emu/src/ampr_emu_apr_services.cpp): `ampr-native/reference/external/ampr_emu/src/ampr_emu_apr_services.cpp`
- [Async I/O broker](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/reference/external/ampr_emu/include/ampr_emu_aio_broker.h): `ampr-native/reference/external/ampr_emu/include/ampr_emu_aio_broker.h`
- [Command buffer dump](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/reference/external/ampr_emu/include/ampr_emu_command_buffer_dump.h): `ampr-native/reference/external/ampr_emu/include/ampr_emu_command_buffer_dump.h`
- [Command packing](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/reference/external/ampr_emu/include/ampr_emu_command_packing.h): `ampr-native/reference/external/ampr_emu/include/ampr_emu_command_packing.h`
- [Runtime config and errors](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/reference/external/ampr_emu/include/ampr_emu_config.h): `ampr-native/reference/external/ampr_emu/include/ampr_emu_config.h`
- [Runtime logging](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/reference/external/ampr_emu/include/ampr_emu_log.h): `ampr-native/reference/external/ampr_emu/include/ampr_emu_log.h`
- [Runtime synchronization](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/reference/external/ampr_emu/include/ampr_emu_sync.h): `ampr-native/reference/external/ampr_emu/include/ampr_emu_sync.h`

### Pack tooling

- [AMPR pack tools](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/reference/external/ampr_emu/tools/ampr_pack.py): `ampr-native/reference/external/ampr_emu/tools/ampr_pack.py`
- [AMPR format utilities](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/reference/external/ampr_emu/tools/ampr_pack_format.py): `ampr-native/reference/external/ampr_emu/tools/ampr_pack_format.py`
- [Command log parser](https://github.com/gameboy829/ps5-lz4-game-compressor/blob/main/ampr-native/reference/external/ampr_emu/tools/parse_ampr_command_log.py): `ampr-native/reference/external/ampr_emu/tools/parse_ampr_command_log.py`

### Other components

- **Browser user**
- **ShadowMountPlus**

## Connections

- Browser user → Browser interface: selects and configures
- Browser interface → HTTP server: uses web interface (evidence: `ampr-ps5/standalone/main.cpp`)
- HTTP server → App service: routes requests (evidence: `ampr-ps5/standalone/main.cpp`)
- App service → Game library: loads library (evidence: `ampr-ps5/standalone/main.cpp`)
- Game library → ShadowMountPlus: queries mounted games (evidence: `ampr-ps5/standalone/main.cpp`)
- App service → ShadowMountPlus: mounts and refreshes
- App service → PS5 pack backend: starts conversion
- PS5 pack backend → Native pack engine: invokes pack engine (evidence: `ampr-ps5/src/ampr_backend.cpp`)
- PS5 pack backend → Source index: builds fresh index (evidence: `ampr-ps5/src/ampr_backend.cpp`)
- PS5 pack backend → Universal profile: generates profile (evidence: `ampr-ps5/src/ampr_backend.cpp`)
- Native pack engine → Profile packer: uses packer (evidence: `ampr-native/src/main.cpp`)
- Native pack engine → Pipeline I/O: reads and writes data (evidence: `ampr-native/src/main.cpp`)
- Native pack engine → Pipeline diagnostics: reports pipeline metrics
- App service → Original game handling: moves or removes original (evidence: `ampr-ps5/standalone/main.cpp`)
- PS5 pack backend → AMPR pack runtime: installs pinned runtime
- AMPR pack runtime → Async I/O broker: uses asynchronous I/O (evidence: `ampr-native/reference/external/ampr_emu/src/ampr_emu_pack.cpp`)
- APR services → Command buffer dump: uses command buffer support (evidence: `ampr-native/reference/external/ampr_emu/src/ampr_emu_apr_services.cpp`)
- Command buffer dump → Command packing: uses packing helpers (evidence: `ampr-native/reference/external/ampr_emu/include/ampr_emu_command_buffer_dump.h`)
- AMPR pack runtime → Runtime config and errors: uses runtime definitions (evidence: `ampr-native/reference/external/ampr_emu/src/ampr_emu_pack.cpp`)
- AMPR pack runtime → Runtime synchronization: uses synchronization (evidence: `ampr-native/reference/external/ampr_emu/src/ampr_emu_pack.cpp`)
- APR services → Runtime logging: logs service activity (evidence: `ampr-native/reference/external/ampr_emu/src/ampr_emu_apr_services.cpp`)
- AMPR pack tools → AMPR format utilities: uses format utilities (evidence: `ampr-native/reference/external/ampr_emu/tools/ampr_pack.py`)
- AMPR pack tools → Command log parser: reads command logs
