# stenzek/duckstation architecture

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

- Interactive diagram: https://gitdiagram.com/stenzek/duckstation
- Repository: https://github.com/stenzek/duckstation

## Overview

DuckStation is a PlayStation emulator whose main user journey is selecting a game in a frontend, configuring or supplying BIOS and input, running the emulated system, and presenting video and audio. The graph preserves major README capabilities as product subsystems, including disc loading, rendering, controller input, save states, achievements, and alternate UI. Source excerpts cover only a few controllers, audio effects, and graphics pipelines, so most subsystem connections are shown as unverified rather than asserted as inspected call paths.

Main entry points: [`src/core/system.h`](https://github.com/stenzek/duckstation/blob/master/src/core/system.h) (Emulated system), [`src/duckstation-qt/qthost.h`](https://github.com/stenzek/duckstation/blob/master/src/duckstation-qt/qthost.h) (Qt frontend), [`dep/imgui/include/imgui.h`](https://github.com/stenzek/duckstation/blob/master/dep/imgui/include/imgui.h) (Fullscreen UI), [`src/core/analog_controller.cpp`](https://github.com/stenzek/duckstation/blob/master/src/core/analog_controller.cpp) (Controller input)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontends["User interfaces"]
  node_qt["Qt frontend<br/>[qthost.h]"]
  node_bigpicture["Fullscreen UI<br/>[imgui.h]"]
end

subgraph group_emulation["Emulation runtime"]
  node_system["Emulated system<br/>[system.h]"]
  node_cpu["CPU execution"]
  node_disc["Disc and game loading"]
  node_controllers["Controller input"]
  node_settings["Configuration<br/>[settings.h]"]
end

subgraph group_media["Media and output"]
  node_gpu["Hardware rendering"]
  node_d3d11["Direct3D 11<br/>[d3d11_pipeline.cpp]"]
  node_d3d12["Direct3D 12<br/>[d3d12_pipeline.cpp]"]
  node_audio["Audio effects"]
end

subgraph group_features["Player features"]
  node_states["Save states<br/>[state_wrapper.h]"]
  node_achievements["RetroAchievements<br/>[rc_client.c]"]
  node_patches["Patches and cheats"]
  node_debug["Debug and memory tools"]
end

subgraph group_platform["External services"]
  node_host(("Host operating system"))
  node_achievement_service(("Achievements service"))
  node_game_media["Game media"]
end

node_player(("Player"))

node_player -.->|"selects game"| node_qt
node_player -.->|"uses interface"| node_bigpicture
node_qt -.->|"starts emulation"| node_system
node_bigpicture -.->|"starts emulation"| node_system
node_system -.->|"loads game"| node_disc
node_game_media -.->|"provides content"| node_disc
node_system -.->|"executes instructions"| node_cpu
node_system -.->|"reads input"| node_controllers
node_controllers -->|"sets vibration"| node_host
node_system -.->|"renders graphics"| node_gpu
node_system -.->|"renders graphics"| node_d3d11
node_system -.->|"renders graphics"| node_d3d12
node_system -.->|"produces audio"| node_audio
node_qt -.->|"configures"| node_settings
node_system -.->|"serializes state"| node_states
node_system -.->|"applies enhancements"| node_patches
node_system -.->|"exposes tools"| node_debug
node_system -.->|"updates achievements"| node_achievements
node_achievements -.->|"uses service"| node_achievement_service

click node_qt "https://github.com/stenzek/duckstation/blob/master/src/duckstation-qt/qthost.h"
click node_bigpicture "https://github.com/stenzek/duckstation/blob/master/dep/imgui/include/imgui.h"
click node_system "https://github.com/stenzek/duckstation/blob/master/src/core/system.h"
click node_cpu "https://github.com/stenzek/duckstation/tree/master/src/core"
click node_disc "https://github.com/stenzek/duckstation/tree/master/src/core"
click node_controllers "https://github.com/stenzek/duckstation/blob/master/src/core/analog_controller.cpp"
click node_settings "https://github.com/stenzek/duckstation/blob/master/src/core/settings.h"
click node_gpu "https://github.com/stenzek/duckstation/blob/master/src/util/opengl_pipeline.cpp"
click node_d3d11 "https://github.com/stenzek/duckstation/blob/master/src/util/d3d11_pipeline.cpp"
click node_d3d12 "https://github.com/stenzek/duckstation/blob/master/src/util/d3d12_pipeline.cpp"
click node_audio "https://github.com/stenzek/duckstation/blob/master/src/core/sound_effect_manager.cpp"
click node_states "https://github.com/stenzek/duckstation/blob/master/src/util/state_wrapper.h"
click node_achievements "https://github.com/stenzek/duckstation/blob/master/dep/rcheevos/src/rc_client.c"
click node_patches "https://github.com/stenzek/duckstation/tree/master/src/core"
click node_debug "https://github.com/stenzek/duckstation/tree/master/src/core"

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_qt,node_bigpicture toneBlue
class node_system,node_cpu,node_disc,node_controllers,node_settings toneAmber
class node_gpu,node_d3d11,node_d3d12,node_audio toneMint
class node_states,node_achievements,node_patches,node_debug toneRose
class node_host,node_achievement_service,node_game_media,node_player toneIndigo
```

## Components

### User interfaces

- [Qt frontend](https://github.com/stenzek/duckstation/blob/master/src/duckstation-qt/qthost.h): `src/duckstation-qt/qthost.h`
- [Fullscreen UI](https://github.com/stenzek/duckstation/blob/master/dep/imgui/include/imgui.h): `dep/imgui/include/imgui.h`

### Emulation runtime

- [Emulated system](https://github.com/stenzek/duckstation/blob/master/src/core/system.h): `src/core/system.h`
- [CPU execution](https://github.com/stenzek/duckstation/tree/master/src/core): `src/core`
- [Disc and game loading](https://github.com/stenzek/duckstation/tree/master/src/core): `src/core`
- [Controller input](https://github.com/stenzek/duckstation/blob/master/src/core/analog_controller.cpp): `src/core/analog_controller.cpp`
- [Configuration](https://github.com/stenzek/duckstation/blob/master/src/core/settings.h): `src/core/settings.h`

### Media and output

- [Hardware rendering](https://github.com/stenzek/duckstation/blob/master/src/util/opengl_pipeline.cpp): `src/util/opengl_pipeline.cpp`
- [Direct3D 11](https://github.com/stenzek/duckstation/blob/master/src/util/d3d11_pipeline.cpp): `src/util/d3d11_pipeline.cpp`
- [Direct3D 12](https://github.com/stenzek/duckstation/blob/master/src/util/d3d12_pipeline.cpp): `src/util/d3d12_pipeline.cpp`
- [Audio effects](https://github.com/stenzek/duckstation/blob/master/src/core/sound_effect_manager.cpp): `src/core/sound_effect_manager.cpp`

### Player features

- [Save states](https://github.com/stenzek/duckstation/blob/master/src/util/state_wrapper.h): `src/util/state_wrapper.h`
- [RetroAchievements](https://github.com/stenzek/duckstation/blob/master/dep/rcheevos/src/rc_client.c): `dep/rcheevos/src/rc_client.c`
- [Patches and cheats](https://github.com/stenzek/duckstation/tree/master/src/core): `src/core`
- [Debug and memory tools](https://github.com/stenzek/duckstation/tree/master/src/core): `src/core`

### External services

- **Host operating system**
- **Achievements service**
- **Game media**

### Other components

- **Player**

## Connections

- Player → Qt frontend: selects game (evidence: `README.md`)
- Player → Fullscreen UI: uses interface (evidence: `README.md`)
- Qt frontend → Emulated system: starts emulation
- Fullscreen UI → Emulated system: starts emulation
- Emulated system → Disc and game loading: loads game (evidence: `README.md`)
- Game media → Disc and game loading: provides content (evidence: `README.md`)
- Emulated system → CPU execution: executes instructions (evidence: `README.md`)
- Emulated system → Controller input: reads input (evidence: `src/core/analog_controller.cpp`)
- Controller input → Host operating system: sets vibration (evidence: `src/core/analog_controller.cpp`)
- Emulated system → Hardware rendering: renders graphics (evidence: `README.md`)
- Emulated system → Direct3D 11: renders graphics (evidence: `README.md`)
- Emulated system → Direct3D 12: renders graphics (evidence: `README.md`)
- Emulated system → Audio effects: produces audio (evidence: `README.md`)
- Qt frontend → Configuration: configures
- Emulated system → Save states: serializes state (evidence: `README.md`)
- Emulated system → Patches and cheats: applies enhancements (evidence: `README.md`)
- Emulated system → Debug and memory tools: exposes tools (evidence: `README.md`)
- Emulated system → RetroAchievements: updates achievements (evidence: `README.md`)
- RetroAchievements → Achievements service: uses service (evidence: `README.md`)
