# swordpdf/ps5sx2 architecture

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

- Interactive diagram: https://gitdiagram.com/swordpdf/ps5sx2
- Repository: https://github.com/swordpdf/ps5sx2

## Overview

PS5SX2 is a native PS2 emulator for jailbroken PS5 consoles. The main user journey is browsing the game shelf, choosing a title, booting it in the emulated PS2, and playing through the PS5 display and controller. The README also describes phone-based settings, patches, achievements, online play, texture packs, memory cards, and USB support. Those documented capabilities are represented alongside the runtime stages; several platform-specific implementations are not present in the supplied tree, so their links are documented at README level.

Main entry points: [`pcsx2/VMManager.cpp`](https://github.com/swordpdf/ps5sx2/blob/main/pcsx2/VMManager.cpp) (VM lifecycle), [`ps5/frontend`](https://github.com/swordpdf/ps5sx2/tree/main/ps5/frontend) (Phone settings), [`pcsx2/Input/InputManager.cpp`](https://github.com/swordpdf/ps5sx2/blob/main/pcsx2/Input/InputManager.cpp) (Input bindings), [`ps5/frontend/fe_app.cpp`](https://github.com/swordpdf/ps5sx2/blob/main/ps5/frontend/fe_app.cpp) (Game shelf)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend and settings"]
  node_shelf["Game shelf<br/>[fe_app.cpp]"]
  node_phone_settings["Phone settings"]
  node_game_list["Game library<br/>[VMManager.cpp]"]
  node_controllers["Controller settings"]
  node_installer["Installer<br/>[app.c]"]
end

subgraph group_emulation["Emulation runtime"]
  node_vm["VM lifecycle<br/>[VMManager.cpp]"]
  node_disc["Disc loading<br/>[CDVD.cpp]"]
  node_cpu["PS2 CPU<br/>[VMManager.cpp]"]
  node_recompiler["CPU recompilers<br/>[iMMI.cpp]"]
end

subgraph group_platform["PS5 integration"]
  node_renderer["Graphics renderer<br/>[GLContextPS5.h]"]
  node_input["Input bindings<br/>[InputManager.cpp]"]
  node_usb["USB devices<br/>[InputManager.cpp]"]
end

subgraph group_capabilities["Game capabilities"]
  node_achievements["RetroAchievements<br/>[rc_client.c]"]
  node_network["Emulated network"]
  node_patches["Game patches<br/>[GameDatabase.cpp]"]
  node_textures["HD textures"]
  node_memory_cards["Memory cards<br/>[Sio.h]"]
end

node_player(("Player"))
node_phone_browser(("Phone browser"))

node_player -->|"browses"| node_shelf
node_shelf -->|"shows library"| node_game_list
node_shelf -->|"starts game"| node_vm
node_game_list -.->|"selects image"| node_disc
node_vm -->|"initializes disc"| node_disc
node_vm -->|"runs VM"| node_cpu
node_cpu -.->|"executes native code"| node_recompiler
node_vm -.->|"renders gameplay"| node_renderer
node_player -->|"provides controls"| node_input
node_input -.->|"controls emulation"| node_vm
node_controllers -->|"configures bindings"| node_input
node_player -->|"opens settings"| node_phone_settings
node_phone_browser -->|"loads page"| node_phone_settings
node_phone_settings -.->|"changes settings"| node_vm
node_vm -->|"updates progress"| node_achievements
node_vm -->|"routes game traffic"| node_network
node_phone_settings -.->|"configures patches"| node_patches
node_vm -.->|"uses replacement textures"| node_textures
node_vm -.->|"accesses cards"| node_memory_cards
node_usb -.->|"provides input"| node_input
node_player -->|"installs app"| node_installer

click node_shelf "https://github.com/swordpdf/ps5sx2/blob/main/ps5/frontend/fe_app.cpp"
click node_phone_settings "https://github.com/swordpdf/ps5sx2/tree/main/ps5/frontend"
click node_game_list "https://github.com/swordpdf/ps5sx2/blob/main/pcsx2/VMManager.cpp"
click node_vm "https://github.com/swordpdf/ps5sx2/blob/main/pcsx2/VMManager.cpp"
click node_disc "https://github.com/swordpdf/ps5sx2/blob/main/pcsx2/CDVD/CDVD.cpp"
click node_cpu "https://github.com/swordpdf/ps5sx2/blob/main/pcsx2/VMManager.cpp"
click node_recompiler "https://github.com/swordpdf/ps5sx2/blob/main/pcsx2/x86/iMMI.cpp"
click node_renderer "https://github.com/swordpdf/ps5sx2/blob/main/ps5/coreorbis/include-orbis/GLContextPS5.h"
click node_input "https://github.com/swordpdf/ps5sx2/blob/main/pcsx2/Input/InputManager.cpp"
click node_controllers "https://github.com/swordpdf/ps5sx2/blob/main/pcsx2-qt/Settings/ControllerBindingWidget.cpp"
click node_achievements "https://github.com/swordpdf/ps5sx2/blob/main/3rdparty/rcheevos/src/rc_client.c"
click node_network "https://github.com/swordpdf/ps5sx2/blob/main/pcsx2/DEV9/Sessions/TCP_Session/TCP_Session_Out.cpp"
click node_patches "https://github.com/swordpdf/ps5sx2/blob/main/pcsx2/GameDatabase.cpp"
click node_textures "https://github.com/swordpdf/ps5sx2/blob/main/pcsx2/GS/Renderers/DX12/D3D12DescriptorHeapManager.cpp"
click node_memory_cards "https://github.com/swordpdf/ps5sx2/blob/main/pcsx2/SIO/Sio.h"
click node_usb "https://github.com/swordpdf/ps5sx2/blob/main/pcsx2/Input/InputManager.cpp"
click node_installer "https://github.com/swordpdf/ps5sx2/blob/main/ps5/installer/src/app.c"

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_shelf,node_phone_settings,node_game_list,node_controllers,node_installer,node_phone_browser toneBlue
class node_vm,node_disc,node_cpu,node_recompiler toneAmber
class node_renderer,node_input,node_usb toneMint
class node_achievements,node_network,node_patches,node_textures,node_memory_cards toneRose
class node_player toneIndigo
```

## Components

### Frontend and settings

- [Game shelf](https://github.com/swordpdf/ps5sx2/blob/main/ps5/frontend/fe_app.cpp): `ps5/frontend/fe_app.cpp`
- [Phone settings](https://github.com/swordpdf/ps5sx2/tree/main/ps5/frontend): `ps5/frontend`
- [Game library](https://github.com/swordpdf/ps5sx2/blob/main/pcsx2/VMManager.cpp): `pcsx2/VMManager.cpp`
- [Controller settings](https://github.com/swordpdf/ps5sx2/blob/main/pcsx2-qt/Settings/ControllerBindingWidget.cpp): `pcsx2-qt/Settings/ControllerBindingWidget.cpp`
- [Installer](https://github.com/swordpdf/ps5sx2/blob/main/ps5/installer/src/app.c): `ps5/installer/src/app.c`

### Emulation runtime

- [VM lifecycle](https://github.com/swordpdf/ps5sx2/blob/main/pcsx2/VMManager.cpp): `pcsx2/VMManager.cpp`
- [Disc loading](https://github.com/swordpdf/ps5sx2/blob/main/pcsx2/CDVD/CDVD.cpp): `pcsx2/CDVD/CDVD.cpp`
- [PS2 CPU](https://github.com/swordpdf/ps5sx2/blob/main/pcsx2/VMManager.cpp): `pcsx2/VMManager.cpp`
- [CPU recompilers](https://github.com/swordpdf/ps5sx2/blob/main/pcsx2/x86/iMMI.cpp): `pcsx2/x86/iMMI.cpp`

### PS5 integration

- [Graphics renderer](https://github.com/swordpdf/ps5sx2/blob/main/ps5/coreorbis/include-orbis/GLContextPS5.h): `ps5/coreorbis/include-orbis/GLContextPS5.h`
- [Input bindings](https://github.com/swordpdf/ps5sx2/blob/main/pcsx2/Input/InputManager.cpp): `pcsx2/Input/InputManager.cpp`
- [USB devices](https://github.com/swordpdf/ps5sx2/blob/main/pcsx2/Input/InputManager.cpp): `pcsx2/Input/InputManager.cpp`

### Game capabilities

- [RetroAchievements](https://github.com/swordpdf/ps5sx2/blob/main/3rdparty/rcheevos/src/rc_client.c): `3rdparty/rcheevos/src/rc_client.c`
- [Emulated network](https://github.com/swordpdf/ps5sx2/blob/main/pcsx2/DEV9/Sessions/TCP_Session/TCP_Session_Out.cpp): `pcsx2/DEV9/Sessions/TCP_Session/TCP_Session_Out.cpp`
- [Game patches](https://github.com/swordpdf/ps5sx2/blob/main/pcsx2/GameDatabase.cpp): `pcsx2/GameDatabase.cpp`
- [HD textures](https://github.com/swordpdf/ps5sx2/blob/main/pcsx2/GS/Renderers/DX12/D3D12DescriptorHeapManager.cpp): `pcsx2/GS/Renderers/DX12/D3D12DescriptorHeapManager.cpp`
- [Memory cards](https://github.com/swordpdf/ps5sx2/blob/main/pcsx2/SIO/Sio.h): `pcsx2/SIO/Sio.h`

### Other components

- **Player**
- **Phone browser**

## Connections

- Player → Game shelf: browses
- Game shelf → Game library: shows library
- Game shelf → VM lifecycle: starts game
- Game library → Disc loading: selects image
- VM lifecycle → Disc loading: initializes disc (evidence: `pcsx2/VMManager.cpp`)
- VM lifecycle → PS2 CPU: runs VM (evidence: `pcsx2/VMManager.cpp`)
- PS2 CPU → CPU recompilers: executes native code
- VM lifecycle → Graphics renderer: renders gameplay
- Player → Input bindings: provides controls
- Input bindings → VM lifecycle: controls emulation
- Controller settings → Input bindings: configures bindings (evidence: `pcsx2-qt/Settings/ControllerBindingWidget.cpp`)
- Player → Phone settings: opens settings
- Phone browser → Phone settings: loads page
- Phone settings → VM lifecycle: changes settings
- VM lifecycle → RetroAchievements: updates progress (evidence: `pcsx2/VMManager.cpp`)
- VM lifecycle → Emulated network: routes game traffic
- Phone settings → Game patches: configures patches
- VM lifecycle → HD textures: uses replacement textures
- VM lifecycle → Memory cards: accesses cards (evidence: `pcsx2/VMManager.cpp`)
- USB devices → Input bindings: provides input (evidence: `pcsx2/Input/InputManager.cpp`)
- Player → Installer: installs app
