# ngnmax/anyps5 architecture

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

- Interactive diagram: https://gitdiagram.com/ngnmax/anyps5
- Repository: https://github.com/ngnmax/anyps5

## Overview

AnyPS5 ports executables for native Linux and Windows use: an input executable enters the relinker, which produces a target-native executable, while the project’s PRX system-library implementations support dynamic linking rather than a separate emulation process. The GPU compatibility branch includes AGC driver execution and graphics-pipeline management; shader recompilation produces SPIR-V. The source index and excerpts establish some internal components, but do not expose enough call sites to safely connect most runtime layers, so those relationships are left out. The README documents the product-level workflow and capabilities.

Main entry points: [`core/relinker/main.cpp`](https://github.com/ngnmax/anyps5/blob/main/core/relinker/main.cpp) (Relinker), [`core/libs/prx`](https://github.com/ngnmax/anyps5/tree/main/core/libs/prx) (PRX Libraries), [`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp`](https://github.com/ngnmax/anyps5/blob/main/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp) (Draw Commit Queue), [`core/shader/recompiler`](https://github.com/ngnmax/anyps5/tree/main/core/shader/recompiler) (Shader Recompiler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_port["Executable Porting"]
  node_relinker["Relinker<br/>[main.cpp]"]
  node_pipeline["Relinker Pipeline"]
  node_analysis["Code Analysis"]
  node_guest["Guest Module Builder"]
  node_patching["Game Patching<br/>[GamePatch.cpp]"]
  node_codegen["Code Generation"]
  node_native["Native Executable"]
end

subgraph group_compat["System Compatibility"]
  node_prx["PRX Libraries"]
  node_agc["AGC Library"]
end

subgraph group_gpu["GPU Driver"]
  node_driver["AGC Driver<br/>[EntryPoints.cpp]"]
  node_drawqueue["Draw Commit Queue<br/>[DrawPipeline.cpp]"]
  node_graphics["Graphics Pipelines<br/>[Pipeline.cpp]"]
  node_journal[("Pipeline Journal")]
  node_vulkan["Vulkan Device<br/>[VulkanDevice.cpp]"]
end

subgraph group_shader["Shader Translation"]
  node_recompiler["Shader Recompiler"]
  node_spirv["SPIR-V Emitter"]
  node_spirvresult["SPIR-V Output"]
end

node_input(("Game Executable"))

node_input -->|"converts"| node_relinker
node_relinker -->|"produces native"| node_native
node_prx -->|"supports dynamic linking"| node_native
node_recompiler -->|"produces"| node_spirvresult
node_drawqueue -->|"reports failures"| node_driver

click node_relinker "https://github.com/ngnmax/anyps5/blob/main/core/relinker/main.cpp"
click node_pipeline "https://github.com/ngnmax/anyps5/blob/main/core/relinker/relinker/src/pipeline/RelinkerPipeline.cpp"
click node_analysis "https://github.com/ngnmax/anyps5/blob/main/core/relinker/relinker/src/analysis/CodeInstructionCollector.cpp"
click node_guest "https://github.com/ngnmax/anyps5/blob/main/core/relinker/relinker/src/guest/GuestModuleBuilder.cpp"
click node_patching "https://github.com/ngnmax/anyps5/blob/main/core/relinker/relinker/src/patching/GamePatch.cpp"
click node_codegen "https://github.com/ngnmax/anyps5/blob/main/core/relinker/codegen/src/Amd64OnlyConverter.cpp"
click node_prx "https://github.com/ngnmax/anyps5/tree/main/core/libs/prx"
click node_agc "https://github.com/ngnmax/anyps5/tree/main/core/libs/prx/libSceAgc"
click node_driver "https://github.com/ngnmax/anyps5/blob/main/core/libs/prx/libSceAgcDriver/Execution/src/Driver/EntryPoints.cpp"
click node_drawqueue "https://github.com/ngnmax/anyps5/blob/main/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp"
click node_graphics "https://github.com/ngnmax/anyps5/blob/main/core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp"
click node_journal "https://github.com/ngnmax/anyps5/blob/main/core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp"
click node_vulkan "https://github.com/ngnmax/anyps5/blob/main/core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp"
click node_recompiler "https://github.com/ngnmax/anyps5/tree/main/core/shader/recompiler"
click node_spirv "https://github.com/ngnmax/anyps5/blob/main/core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.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_relinker,node_pipeline,node_analysis,node_guest,node_patching,node_codegen,node_native toneBlue
class node_prx,node_agc toneAmber
class node_driver,node_drawqueue,node_graphics,node_journal,node_vulkan toneMint
class node_recompiler,node_spirv,node_spirvresult toneRose
class node_input toneIndigo
```

## Components

### Executable Porting

- [Relinker](https://github.com/ngnmax/anyps5/blob/main/core/relinker/main.cpp): `core/relinker/main.cpp`
- [Relinker Pipeline](https://github.com/ngnmax/anyps5/blob/main/core/relinker/relinker/src/pipeline/RelinkerPipeline.cpp): `core/relinker/relinker/src/pipeline/RelinkerPipeline.cpp`
- [Code Analysis](https://github.com/ngnmax/anyps5/blob/main/core/relinker/relinker/src/analysis/CodeInstructionCollector.cpp): `core/relinker/relinker/src/analysis/CodeInstructionCollector.cpp`
- [Guest Module Builder](https://github.com/ngnmax/anyps5/blob/main/core/relinker/relinker/src/guest/GuestModuleBuilder.cpp): `core/relinker/relinker/src/guest/GuestModuleBuilder.cpp`
- [Game Patching](https://github.com/ngnmax/anyps5/blob/main/core/relinker/relinker/src/patching/GamePatch.cpp): `core/relinker/relinker/src/patching/GamePatch.cpp`
- [Code Generation](https://github.com/ngnmax/anyps5/blob/main/core/relinker/codegen/src/Amd64OnlyConverter.cpp): `core/relinker/codegen/src/Amd64OnlyConverter.cpp`
- **Native Executable**

### System Compatibility

- [PRX Libraries](https://github.com/ngnmax/anyps5/tree/main/core/libs/prx): `core/libs/prx`
- [AGC Library](https://github.com/ngnmax/anyps5/tree/main/core/libs/prx/libSceAgc): `core/libs/prx/libSceAgc`

### GPU Driver

- [AGC Driver](https://github.com/ngnmax/anyps5/blob/main/core/libs/prx/libSceAgcDriver/Execution/src/Driver/EntryPoints.cpp): `core/libs/prx/libSceAgcDriver/Execution/src/Driver/EntryPoints.cpp`
- [Draw Commit Queue](https://github.com/ngnmax/anyps5/blob/main/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp): `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp`
- [Graphics Pipelines](https://github.com/ngnmax/anyps5/blob/main/core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp): `core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp`
- [Pipeline Journal](https://github.com/ngnmax/anyps5/blob/main/core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp): `core/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cpp`
- [Vulkan Device](https://github.com/ngnmax/anyps5/blob/main/core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp): `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`

### Shader Translation

- [Shader Recompiler](https://github.com/ngnmax/anyps5/tree/main/core/shader/recompiler): `core/shader/recompiler`
- [SPIR-V Emitter](https://github.com/ngnmax/anyps5/blob/main/core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp): `core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp`
- **SPIR-V Output**

### Other components

- **Game Executable**

## Connections

- Game Executable → Relinker: converts (evidence: `README.md`)
- Relinker → Native Executable: produces native (evidence: `README.md`)
- PRX Libraries → Native Executable: supports dynamic linking (evidence: `README.md`)
- Shader Recompiler → SPIR-V Output: produces (evidence: `README.md`)
- Draw Commit Queue → AGC Driver: reports failures (evidence: `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawPipeline.cpp`)
