# weihuoya/citra architecture

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

- Interactive diagram: https://gitdiagram.com/weihuoya/citra
- Repository: https://github.com/weihuoya/citra

## Overview

Citra is a Nintendo 3DS emulator and debugger, with desktop Qt and Android frontends. The principal workflow is selecting a game, starting emulation, and presenting rendered output; users can also configure input and settings, debug, and use multiplayer features. The graph preserves these major product areas, plus core emulation layers. Source excerpts support a few internal calls; other frontend-to-core and subsystem links are shown as dashed, unverified relationships rather than inferred pipelines.

Main entry points: [`src/core/core.h`](https://github.com/weihuoya/citra/blob/master/src/core/core.h) (Emulation system), [`src/citra_qt/main.cpp`](https://github.com/weihuoya/citra/blob/master/src/citra_qt/main.cpp) (Desktop UI), [`src/citra_qt/bootmanager.cpp`](https://github.com/weihuoya/citra/blob/master/src/citra_qt/bootmanager.cpp) (Emulation window), [`src/input_common/main.cpp`](https://github.com/weihuoya/citra/blob/master/src/input_common/main.cpp) (Input backends)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontends["User frontends"]
  node_desktop["Desktop UI<br/>[main.cpp]"]
  node_boot["Emulation window<br/>[bootmanager.cpp]"]
  node_android["Android app"]
  node_settings["Settings<br/>[settings.h]"]
  node_input["Input backends<br/>[main.cpp]"]
end

subgraph group_emulation["Emulation core"]
  node_core["Emulation system<br/>[core.h]"]
  node_cpu["ARM CPU<br/>[arm_interface.h]"]
  node_memory["Virtual memory<br/>[vm_manager.cpp]"]
  node_kernel["Kernel and services<br/>[service.cpp]"]
  node_files["Game and files"]
end

subgraph group_systems["Hardware services"]
  node_video["Graphics pipeline"]
  node_audio["Audio"]
  node_applets["System applets<br/>[applet_manager.cpp]"]
  node_common["Shared utilities"]
end

subgraph group_capabilities["Product features"]
  node_debugger["Debugger"]
  node_multiplayer["Multiplayer<br/>[state.h]"]
  node_cheats["Cheats"]
  node_dumping["Capture and dumping"]
end

node_user(("User"))

node_user -.->|"uses"| node_desktop
node_user -.->|"uses"| node_android
node_desktop -.->|"starts emulation"| node_boot
node_android -.->|"controls emulation"| node_core
node_boot -->|"runs loop"| node_core
node_boot -->|"initializes input"| node_input
node_boot -->|"presents frames"| node_video
node_core -.->|"executes instructions"| node_cpu
node_core -.->|"manages address space"| node_memory
node_memory -->|"maps regions"| node_common
node_core -.->|"runs services"| node_kernel
node_core -.->|"loads game data"| node_files
node_core -.->|"renders graphics"| node_video
node_core -.->|"produces audio"| node_audio
node_kernel -.->|"dispatches applets"| node_applets
node_applets -->|"creates events"| node_kernel
node_input -->|"uses packages"| node_common
node_settings -.->|"configures bindings"| node_input
node_desktop -.->|"offers tools"| node_debugger
node_desktop -.->|"offers netplay"| node_multiplayer
node_core -.->|"applies cheats"| node_cheats
node_desktop -.->|"configures capture"| node_dumping

click node_desktop "https://github.com/weihuoya/citra/blob/master/src/citra_qt/main.cpp"
click node_boot "https://github.com/weihuoya/citra/blob/master/src/citra_qt/bootmanager.cpp"
click node_android "https://github.com/weihuoya/citra/blob/master/src/android/app/src/main/java/org/citra/emu/ui/EmulationActivity.java"
click node_settings "https://github.com/weihuoya/citra/blob/master/src/core/settings.h"
click node_input "https://github.com/weihuoya/citra/blob/master/src/input_common/main.cpp"
click node_core "https://github.com/weihuoya/citra/blob/master/src/core/core.h"
click node_cpu "https://github.com/weihuoya/citra/blob/master/src/core/arm/arm_interface.h"
click node_memory "https://github.com/weihuoya/citra/blob/master/src/core/hle/kernel/vm_manager.cpp"
click node_kernel "https://github.com/weihuoya/citra/blob/master/src/core/hle/service/service.cpp"
click node_files "https://github.com/weihuoya/citra/tree/master/src/core/file_sys"
click node_video "https://github.com/weihuoya/citra/blob/master/src/video_core/geometry_pipeline.cpp"
click node_audio "https://github.com/weihuoya/citra/tree/master/src/audio_core"
click node_applets "https://github.com/weihuoya/citra/blob/master/src/core/hle/service/apt/applet_manager.cpp"
click node_debugger "https://github.com/weihuoya/citra/tree/master/src/citra_qt/debugger"
click node_multiplayer "https://github.com/weihuoya/citra/blob/master/src/citra_qt/multiplayer/state.h"
click node_cheats "https://github.com/weihuoya/citra/tree/master/src/core/cheats"
click node_dumping "https://github.com/weihuoya/citra/tree/master/src/core/dumping"
click node_common "https://github.com/weihuoya/citra/tree/master/src/common"

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_desktop,node_boot,node_android,node_settings,node_input,node_user toneBlue
class node_core,node_cpu,node_memory,node_kernel,node_files toneAmber
class node_video,node_audio,node_applets,node_common toneMint
class node_debugger,node_multiplayer,node_cheats,node_dumping toneRose
```

## Components

### User frontends

- [Desktop UI](https://github.com/weihuoya/citra/blob/master/src/citra_qt/main.cpp): `src/citra_qt/main.cpp`
- [Emulation window](https://github.com/weihuoya/citra/blob/master/src/citra_qt/bootmanager.cpp): `src/citra_qt/bootmanager.cpp`
- [Android app](https://github.com/weihuoya/citra/blob/master/src/android/app/src/main/java/org/citra/emu/ui/EmulationActivity.java): `src/android/app/src/main/java/org/citra/emu/ui/EmulationActivity.java`
- [Settings](https://github.com/weihuoya/citra/blob/master/src/core/settings.h): `src/core/settings.h`
- [Input backends](https://github.com/weihuoya/citra/blob/master/src/input_common/main.cpp): `src/input_common/main.cpp`

### Emulation core

- [Emulation system](https://github.com/weihuoya/citra/blob/master/src/core/core.h): `src/core/core.h`
- [ARM CPU](https://github.com/weihuoya/citra/blob/master/src/core/arm/arm_interface.h): `src/core/arm/arm_interface.h`
- [Virtual memory](https://github.com/weihuoya/citra/blob/master/src/core/hle/kernel/vm_manager.cpp): `src/core/hle/kernel/vm_manager.cpp`
- [Kernel and services](https://github.com/weihuoya/citra/blob/master/src/core/hle/service/service.cpp): `src/core/hle/service/service.cpp`
- [Game and files](https://github.com/weihuoya/citra/tree/master/src/core/file_sys): `src/core/file_sys`

### Hardware services

- [Graphics pipeline](https://github.com/weihuoya/citra/blob/master/src/video_core/geometry_pipeline.cpp): `src/video_core/geometry_pipeline.cpp`
- [Audio](https://github.com/weihuoya/citra/tree/master/src/audio_core): `src/audio_core`
- [System applets](https://github.com/weihuoya/citra/blob/master/src/core/hle/service/apt/applet_manager.cpp): `src/core/hle/service/apt/applet_manager.cpp`
- [Shared utilities](https://github.com/weihuoya/citra/tree/master/src/common): `src/common`

### Product features

- [Debugger](https://github.com/weihuoya/citra/tree/master/src/citra_qt/debugger): `src/citra_qt/debugger`
- [Multiplayer](https://github.com/weihuoya/citra/blob/master/src/citra_qt/multiplayer/state.h): `src/citra_qt/multiplayer/state.h`
- [Cheats](https://github.com/weihuoya/citra/tree/master/src/core/cheats): `src/core/cheats`
- [Capture and dumping](https://github.com/weihuoya/citra/tree/master/src/core/dumping): `src/core/dumping`

### Other components

- **User**

## Connections

- User → Desktop UI: uses
- User → Android app: uses
- Desktop UI → Emulation window: starts emulation
- Android app → Emulation system: controls emulation
- Emulation window → Emulation system: runs loop (evidence: `src/citra_qt/bootmanager.cpp`)
- Emulation window → Input backends: initializes input (evidence: `src/citra_qt/bootmanager.cpp`)
- Emulation window → Graphics pipeline: presents frames (evidence: `src/citra_qt/bootmanager.cpp`)
- Emulation system → ARM CPU: executes instructions
- Emulation system → Virtual memory: manages address space
- Virtual memory → Shared utilities: maps regions (evidence: `src/core/hle/kernel/vm_manager.cpp`)
- Emulation system → Kernel and services: runs services
- Emulation system → Game and files: loads game data
- Emulation system → Graphics pipeline: renders graphics
- Emulation system → Audio: produces audio
- Kernel and services → System applets: dispatches applets
- System applets → Kernel and services: creates events (evidence: `src/core/hle/service/apt/applet_manager.cpp`)
- Input backends → Shared utilities: uses packages (evidence: `src/input_common/main.cpp`)
- Settings → Input backends: configures bindings
- Desktop UI → Debugger: offers tools (evidence: `src/citra_qt/main.cpp`)
- Desktop UI → Multiplayer: offers netplay (evidence: `src/citra_qt/main.cpp`)
- Emulation system → Cheats: applies cheats
- Desktop UI → Capture and dumping: configures capture
