# mattias800/prosper architecture

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

- Interactive diagram: https://gitdiagram.com/mattias800/prosper
- Repository: https://github.com/mattias800/prosper

## Overview

prosper is a user-space PS5 compatibility layer: guest x86-64 code runs natively, while the project loads and links game modules, reimplements system interfaces, and translates AGC/PM4 graphics and RDNA2 shaders to Vulkan. The main user-to-result route is supplying a game dump, booting it in the SDL frontend, executing guest work, and presenting rendered frames. The README documents loader and HLE responsibilities, but their implementation files are largely absent from the supplied tree; GPU and frontend links are limited to relationships shown by the README or source index.

Main entry points: [`prosper/frontends/prosper-app/main.cpp`](https://github.com/mattias800/prosper/blob/main/prosper/frontends/prosper-app/main.cpp) (App startup and loop), [`prosper/src/loader`](https://github.com/mattias800/prosper/tree/main/prosper/src/loader) (SELF/ELF loader and linker), [`prosper/src/hle`](https://github.com/mattias800/prosper/tree/main/prosper/src/hle) (System library reimplementation), [`prosper/src/gpu/execute/gpu_execute.hpp`](https://github.com/mattias800/prosper/blob/main/prosper/src/gpu/execute/gpu_execute.hpp) (GPU command execution)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_boot["Boot and compatibility"]
  node_loader["SELF/ELF loader and linker"]
  node_hle["System library reimplementation"]
  node_hle_service["HLE service dispatch<br/>[hle_service.cpp]"]
  node_host["Host compatibility"]
end

subgraph group_gpu["GPU translation"]
  node_pm4["AGC/PM4 processing"]
  node_gpu_execute["GPU command execution<br/>[gpu_execute.hpp]"]
  node_shader_resources["Shader resource contract"]
  node_recompiler["RDNA2 to SPIR-V"]
  node_image_routes["Storage image lowering"]
end

subgraph group_runtime["Rendering and runtime"]
  node_live_renderer["Live Vulkan renderer<br/>[live_renderer.cpp]"]
  node_present["Frame presentation<br/>[present_blit.cpp]"]
  node_audio["Audio output"]
  node_video["Video decoding"]
  node_perf["Performance capture<br/>[perf_ledger.hpp]"]
end

subgraph group_app["Desktop frontend"]
  node_app_main["App startup and loop<br/>[main.cpp]"]
  node_game_library["Game library paths<br/>[game_path.hpp]"]
  node_pad["Controller input<br/>[pad.hpp]"]
end

node_user(("Game dump user"))

node_user -->|"supplies dump"| node_loader
node_loader -->|"resolves imports"| node_hle
node_hle -.->|"dispatches services"| node_hle_service
node_hle -->|"uses host facilities"| node_host
node_user -.->|"starts frontend"| node_app_main
node_app_main -->|"uses game paths"| node_game_library
node_app_main -.->|"boots guest"| node_loader
node_app_main -.->|"accepts input"| node_pad
node_loader -->|"submits GPU work"| node_pm4
node_pm4 -->|"decodes commands"| node_gpu_execute
node_gpu_execute -->|"recompiles shaders"| node_recompiler
node_recompiler -->|"uses resource contract"| node_shader_resources
node_image_routes -->|"checks bindings"| node_shader_resources
node_gpu_execute -.->|"renders guest work"| node_live_renderer
node_live_renderer -->|"hands off frames"| node_present
node_app_main -->|"presents frames"| node_present
node_app_main -.->|"configures audio"| node_audio
node_app_main -.->|"integrates video"| node_video
node_app_main -->|"records performance"| node_perf

click node_loader "https://github.com/mattias800/prosper/tree/main/prosper/src/loader"
click node_hle "https://github.com/mattias800/prosper/tree/main/prosper/src/hle"
click node_hle_service "https://github.com/mattias800/prosper/blob/main/prosper/src/hle/service/hle_service.cpp"
click node_host "https://github.com/mattias800/prosper/tree/main/prosper/src/host"
click node_app_main "https://github.com/mattias800/prosper/blob/main/prosper/frontends/prosper-app/main.cpp"
click node_game_library "https://github.com/mattias800/prosper/blob/main/prosper/frontends/prosper-app/game_path.hpp"
click node_pad "https://github.com/mattias800/prosper/blob/main/prosper/src/input/pad.hpp"
click node_pm4 "https://github.com/mattias800/prosper/tree/main/prosper/src/gpu/pm4"
click node_gpu_execute "https://github.com/mattias800/prosper/blob/main/prosper/src/gpu/execute/gpu_execute.hpp"
click node_shader_resources "https://github.com/mattias800/prosper/blob/main/prosper/src/gpu/resources/shader_resources.hpp"
click node_recompiler "https://github.com/mattias800/prosper/tree/main/prosper/src/gpu/recompiler"
click node_image_routes "https://github.com/mattias800/prosper/blob/main/prosper/src/gpu/recompiler/ir/lower/image_storage_routes.cpp"
click node_live_renderer "https://github.com/mattias800/prosper/blob/main/prosper/frontends/shared/live/live_renderer.cpp"
click node_present "https://github.com/mattias800/prosper/blob/main/prosper/frontends/shared/present/present_blit.cpp"
click node_audio "https://github.com/mattias800/prosper/blob/main/prosper/frontends/audio_sdl3/audio_sink_sdl3.cpp"
click node_video "https://github.com/mattias800/prosper/blob/main/prosper/frontends/video_mf/media_foundation_backend.cpp"
click node_perf "https://github.com/mattias800/prosper/blob/main/prosper/src/diagnostics/perf/perf_ledger.hpp"

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_loader,node_hle,node_hle_service,node_host,node_user toneBlue
class node_pm4,node_gpu_execute,node_shader_resources,node_recompiler,node_image_routes toneAmber
class node_live_renderer,node_present,node_audio,node_video,node_perf toneMint
class node_app_main,node_game_library,node_pad toneRose
```

## Components

### Boot and compatibility

- [SELF/ELF loader and linker](https://github.com/mattias800/prosper/tree/main/prosper/src/loader): `prosper/src/loader`
- [System library reimplementation](https://github.com/mattias800/prosper/tree/main/prosper/src/hle): `prosper/src/hle`
- [HLE service dispatch](https://github.com/mattias800/prosper/blob/main/prosper/src/hle/service/hle_service.cpp): `prosper/src/hle/service/hle_service.cpp`
- [Host compatibility](https://github.com/mattias800/prosper/tree/main/prosper/src/host): `prosper/src/host`

### GPU translation

- [AGC/PM4 processing](https://github.com/mattias800/prosper/tree/main/prosper/src/gpu/pm4): `prosper/src/gpu/pm4`
- [GPU command execution](https://github.com/mattias800/prosper/blob/main/prosper/src/gpu/execute/gpu_execute.hpp): `prosper/src/gpu/execute/gpu_execute.hpp`
- [Shader resource contract](https://github.com/mattias800/prosper/blob/main/prosper/src/gpu/resources/shader_resources.hpp): `prosper/src/gpu/resources/shader_resources.hpp`
- [RDNA2 to SPIR-V](https://github.com/mattias800/prosper/tree/main/prosper/src/gpu/recompiler): `prosper/src/gpu/recompiler`
- [Storage image lowering](https://github.com/mattias800/prosper/blob/main/prosper/src/gpu/recompiler/ir/lower/image_storage_routes.cpp): `prosper/src/gpu/recompiler/ir/lower/image_storage_routes.cpp`

### Rendering and runtime

- [Live Vulkan renderer](https://github.com/mattias800/prosper/blob/main/prosper/frontends/shared/live/live_renderer.cpp): `prosper/frontends/shared/live/live_renderer.cpp`
- [Frame presentation](https://github.com/mattias800/prosper/blob/main/prosper/frontends/shared/present/present_blit.cpp): `prosper/frontends/shared/present/present_blit.cpp`
- [Audio output](https://github.com/mattias800/prosper/blob/main/prosper/frontends/audio_sdl3/audio_sink_sdl3.cpp): `prosper/frontends/audio_sdl3/audio_sink_sdl3.cpp`
- [Video decoding](https://github.com/mattias800/prosper/blob/main/prosper/frontends/video_mf/media_foundation_backend.cpp): `prosper/frontends/video_mf/media_foundation_backend.cpp`
- [Performance capture](https://github.com/mattias800/prosper/blob/main/prosper/src/diagnostics/perf/perf_ledger.hpp): `prosper/src/diagnostics/perf/perf_ledger.hpp`

### Desktop frontend

- [App startup and loop](https://github.com/mattias800/prosper/blob/main/prosper/frontends/prosper-app/main.cpp): `prosper/frontends/prosper-app/main.cpp`
- [Game library paths](https://github.com/mattias800/prosper/blob/main/prosper/frontends/prosper-app/game_path.hpp): `prosper/frontends/prosper-app/game_path.hpp`
- [Controller input](https://github.com/mattias800/prosper/blob/main/prosper/src/input/pad.hpp): `prosper/src/input/pad.hpp`

### Other components

- **Game dump user**

## Connections

- Game dump user → SELF/ELF loader and linker: supplies dump
- SELF/ELF loader and linker → System library reimplementation: resolves imports
- System library reimplementation → HLE service dispatch: dispatches services
- System library reimplementation → Host compatibility: uses host facilities
- Game dump user → App startup and loop: starts frontend
- App startup and loop → Game library paths: uses game paths (evidence: `prosper/frontends/prosper-app/main.cpp`)
- App startup and loop → SELF/ELF loader and linker: boots guest (evidence: `prosper/frontends/prosper-app/main.cpp`)
- App startup and loop → Controller input: accepts input (evidence: `prosper/frontends/prosper-app/main.cpp`)
- SELF/ELF loader and linker → AGC/PM4 processing: submits GPU work
- AGC/PM4 processing → GPU command execution: decodes commands
- GPU command execution → RDNA2 to SPIR-V: recompiles shaders
- RDNA2 to SPIR-V → Shader resource contract: uses resource contract (evidence: `prosper/src/gpu/recompiler/ir/lower/image_storage_routes.cpp`)
- Storage image lowering → Shader resource contract: checks bindings (evidence: `prosper/src/gpu/recompiler/ir/lower/image_storage_routes.cpp`)
- GPU command execution → Live Vulkan renderer: renders guest work
- Live Vulkan renderer → Frame presentation: hands off frames
- App startup and loop → Frame presentation: presents frames (evidence: `prosper/frontends/prosper-app/main.cpp`)
- App startup and loop → Audio output: configures audio
- App startup and loop → Video decoding: integrates video
- App startup and loop → Performance capture: records performance (evidence: `prosper/frontends/prosper-app/main.cpp`)
