# libretro/pcsx_rearmed architecture

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

- Interactive diagram: https://gitdiagram.com/libretro/pcsx_rearmed
- Repository: https://github.com/libretro/pcsx_rearmed
- Video tour (about a minute): https://gitdiagram.com/libretro/pcsx_rearmed/video

## Overview

PCSX-ReARMed is a PlayStation emulator, exposed through a platform frontend and libretro support. The principal workflow is to launch the emulator with a game image, initialize the emulation core and plugins, execute PlayStation code, and produce video and audio. The README also identifies two dynamic recompilers, BIOS HLE, and platform-specific GPU implementations. Edges reflect excerpts, SOURCE INDEX references, or documented capabilities; unverified integration points are dashed rather than presented as confirmed calls.

Main entry points: [`libpcsxcore/misc.h`](https://github.com/libretro/pcsx_rearmed/blob/master/libpcsxcore/misc.h) (Emulator core), [`libpcsxcore/gpu.h`](https://github.com/libretro/pcsx_rearmed/blob/master/libpcsxcore/gpu.h) (GPU plugin interface), [`frontend/main.c`](https://github.com/libretro/pcsx_rearmed/blob/master/frontend/main.c) (Desktop frontend), [`libpcsxcore/new_dynarec/new_dynarec.c`](https://github.com/libretro/pcsx_rearmed/blob/master/libpcsxcore/new_dynarec/new_dynarec.c) (ARM dynamic recompiler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend and control"]
  node_frontend_entry["Desktop frontend<br/>[main.c]"]
  node_platform_entry["Maemo frontend<br/>[main.c]"]
  node_libretro["Libretro interface<br/>[libretro.h]"]
end

subgraph group_core["PlayStation emulation"]
  node_emu_core["Emulator core<br/>[misc.h]"]
  node_interpreter["MIPS interpreter<br/>[psxinterpreter.h]"]
  node_arm_drc["ARM dynamic recompiler<br/>[new_dynarec.c]"]
  node_arm_codegen["ARM code generation<br/>[assem_arm.c]"]
  node_arm64_codegen["ARM64 code generation<br/>[assem_arm64.c]"]
  node_lightrec["Lightrec recompiler<br/>[plugin.c]"]
  node_lightrec_memory["Lightrec memory manager<br/>[memmanager.c]"]
  node_bios_hle["BIOS HLE<br/>[psxhle.h]"]
end

subgraph group_render["Graphics and sound"]
  node_gpu["GPU plugin interface<br/>[gpu.h]"]
  node_neon_gpu["NEON GPU<br/>[psx_gpu.c]"]
  node_gles_gpu["GLES GPU<br/>[gpuPrim.c]"]
  node_unai_gpu["PCSX4ALL GPU"]
  node_peops_gpu["P.E.Op.S. GPU<br/>[soft.c]"]
  node_spu["SPU audio plugin<br/>[spu.c]"]
end

subgraph group_media["Disc and runtime support"]
  node_disc_core["Disc control<br/>[cdrom.h]"]
  node_chd_reader["CHD reader<br/>[libchdr_chd.c]"]
  node_game_database["Game compatibility data<br/>[database.c]"]
end

node_user(("Player"))

node_user -->|"launches"| node_frontend_entry
node_user -.->|"launches"| node_platform_entry
node_frontend_entry -->|"initializes"| node_emu_core
node_platform_entry -->|"initializes"| node_emu_core
node_frontend_entry -->|"configures"| node_arm_drc
node_frontend_entry -->|"configures"| node_disc_core
node_emu_core -.->|"executes via"| node_interpreter
node_emu_core -.->|"executes via"| node_arm_drc
node_emu_core -->|"executes via"| node_lightrec
node_arm_drc -->|"emits code with"| node_arm_codegen
node_arm_drc -->|"emits code with"| node_arm64_codegen
node_lightrec -.->|"tracks allocations"| node_lightrec_memory
node_emu_core -->|"supports"| node_bios_hle
node_emu_core -.->|"uses plugin interface"| node_gpu
node_gpu -.->|"selects renderer"| node_neon_gpu
node_gpu -.->|"selects renderer"| node_gles_gpu
node_gpu -.->|"selects renderer"| node_unai_gpu
node_gpu -.->|"selects renderer"| node_peops_gpu
node_emu_core -.->|"uses audio plugin"| node_spu
node_emu_core -.->|"reads disc"| node_disc_core
node_disc_core -.->|"reads CHD"| node_chd_reader
node_emu_core -->|"applies game hacks"| node_game_database
node_libretro -.->|"hosts emulator"| node_emu_core

click node_frontend_entry "https://github.com/libretro/pcsx_rearmed/blob/master/frontend/main.c"
click node_platform_entry "https://github.com/libretro/pcsx_rearmed/blob/master/maemo/main.c"
click node_libretro "https://github.com/libretro/pcsx_rearmed/blob/master/deps/libretro-common/include/libretro.h"
click node_emu_core "https://github.com/libretro/pcsx_rearmed/blob/master/libpcsxcore/misc.h"
click node_interpreter "https://github.com/libretro/pcsx_rearmed/blob/master/libpcsxcore/psxinterpreter.h"
click node_arm_drc "https://github.com/libretro/pcsx_rearmed/blob/master/libpcsxcore/new_dynarec/new_dynarec.c"
click node_arm_codegen "https://github.com/libretro/pcsx_rearmed/blob/master/libpcsxcore/new_dynarec/assem_arm.c"
click node_arm64_codegen "https://github.com/libretro/pcsx_rearmed/blob/master/libpcsxcore/new_dynarec/assem_arm64.c"
click node_lightrec "https://github.com/libretro/pcsx_rearmed/blob/master/libpcsxcore/lightrec/plugin.c"
click node_lightrec_memory "https://github.com/libretro/pcsx_rearmed/blob/master/deps/lightrec/memmanager.c"
click node_bios_hle "https://github.com/libretro/pcsx_rearmed/blob/master/libpcsxcore/psxhle.h"
click node_gpu "https://github.com/libretro/pcsx_rearmed/blob/master/libpcsxcore/gpu.h"
click node_neon_gpu "https://github.com/libretro/pcsx_rearmed/blob/master/plugins/gpu_neon/psx_gpu/psx_gpu.c"
click node_gles_gpu "https://github.com/libretro/pcsx_rearmed/blob/master/plugins/gpu-gles/gpuPrim.c"
click node_unai_gpu "https://github.com/libretro/pcsx_rearmed/blob/master/plugins/gpu_unai/gpu_raster_polygon.h"
click node_peops_gpu "https://github.com/libretro/pcsx_rearmed/blob/master/plugins/dfxvideo/soft.c"
click node_spu "https://github.com/libretro/pcsx_rearmed/blob/master/plugins/dfsound/spu.c"
click node_disc_core "https://github.com/libretro/pcsx_rearmed/blob/master/libpcsxcore/cdrom.h"
click node_chd_reader "https://github.com/libretro/pcsx_rearmed/blob/master/deps/libchdr/src/libchdr_chd.c"
click node_game_database "https://github.com/libretro/pcsx_rearmed/blob/master/libpcsxcore/database.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_frontend_entry,node_platform_entry,node_libretro toneBlue
class node_emu_core,node_interpreter,node_arm_drc,node_arm_codegen,node_arm64_codegen,node_lightrec,node_lightrec_memory,node_bios_hle toneAmber
class node_gpu,node_neon_gpu,node_gles_gpu,node_unai_gpu,node_peops_gpu,node_spu toneMint
class node_disc_core,node_chd_reader,node_game_database toneRose
class node_user toneIndigo
```

## Components

### Frontend and control

- [Desktop frontend](https://github.com/libretro/pcsx_rearmed/blob/master/frontend/main.c): `frontend/main.c`
- [Maemo frontend](https://github.com/libretro/pcsx_rearmed/blob/master/maemo/main.c): `maemo/main.c`
- [Libretro interface](https://github.com/libretro/pcsx_rearmed/blob/master/deps/libretro-common/include/libretro.h): `deps/libretro-common/include/libretro.h`

### PlayStation emulation

- [Emulator core](https://github.com/libretro/pcsx_rearmed/blob/master/libpcsxcore/misc.h): `libpcsxcore/misc.h`
- [MIPS interpreter](https://github.com/libretro/pcsx_rearmed/blob/master/libpcsxcore/psxinterpreter.h): `libpcsxcore/psxinterpreter.h`
- [ARM dynamic recompiler](https://github.com/libretro/pcsx_rearmed/blob/master/libpcsxcore/new_dynarec/new_dynarec.c): `libpcsxcore/new_dynarec/new_dynarec.c`
- [ARM code generation](https://github.com/libretro/pcsx_rearmed/blob/master/libpcsxcore/new_dynarec/assem_arm.c): `libpcsxcore/new_dynarec/assem_arm.c`
- [ARM64 code generation](https://github.com/libretro/pcsx_rearmed/blob/master/libpcsxcore/new_dynarec/assem_arm64.c): `libpcsxcore/new_dynarec/assem_arm64.c`
- [Lightrec recompiler](https://github.com/libretro/pcsx_rearmed/blob/master/libpcsxcore/lightrec/plugin.c): `libpcsxcore/lightrec/plugin.c`
- [Lightrec memory manager](https://github.com/libretro/pcsx_rearmed/blob/master/deps/lightrec/memmanager.c): `deps/lightrec/memmanager.c`
- [BIOS HLE](https://github.com/libretro/pcsx_rearmed/blob/master/libpcsxcore/psxhle.h): `libpcsxcore/psxhle.h`

### Graphics and sound

- [GPU plugin interface](https://github.com/libretro/pcsx_rearmed/blob/master/libpcsxcore/gpu.h): `libpcsxcore/gpu.h`
- [NEON GPU](https://github.com/libretro/pcsx_rearmed/blob/master/plugins/gpu_neon/psx_gpu/psx_gpu.c): `plugins/gpu_neon/psx_gpu/psx_gpu.c`
- [GLES GPU](https://github.com/libretro/pcsx_rearmed/blob/master/plugins/gpu-gles/gpuPrim.c): `plugins/gpu-gles/gpuPrim.c`
- [PCSX4ALL GPU](https://github.com/libretro/pcsx_rearmed/blob/master/plugins/gpu_unai/gpu_raster_polygon.h): `plugins/gpu_unai/gpu_raster_polygon.h`
- [P.E.Op.S. GPU](https://github.com/libretro/pcsx_rearmed/blob/master/plugins/dfxvideo/soft.c): `plugins/dfxvideo/soft.c`
- [SPU audio plugin](https://github.com/libretro/pcsx_rearmed/blob/master/plugins/dfsound/spu.c): `plugins/dfsound/spu.c`

### Disc and runtime support

- [Disc control](https://github.com/libretro/pcsx_rearmed/blob/master/libpcsxcore/cdrom.h): `libpcsxcore/cdrom.h`
- [CHD reader](https://github.com/libretro/pcsx_rearmed/blob/master/deps/libchdr/src/libchdr_chd.c): `deps/libchdr/src/libchdr_chd.c`
- [Game compatibility data](https://github.com/libretro/pcsx_rearmed/blob/master/libpcsxcore/database.c): `libpcsxcore/database.c`

### Other components

- **Player**

## Connections

- Player → Desktop frontend: launches (evidence: `frontend/main.c`)
- Player → Maemo frontend: launches
- Desktop frontend → Emulator core: initializes (evidence: `frontend/main.c`)
- Maemo frontend → Emulator core: initializes (evidence: `maemo/main.c`)
- Desktop frontend → ARM dynamic recompiler: configures (evidence: `frontend/main.c`)
- Desktop frontend → Disc control: configures (evidence: `frontend/main.c`)
- Emulator core → MIPS interpreter: executes via
- Emulator core → ARM dynamic recompiler: executes via
- Emulator core → Lightrec recompiler: executes via (evidence: `libpcsxcore/lightrec/plugin.c`)
- ARM dynamic recompiler → ARM code generation: emits code with (evidence: `libpcsxcore/new_dynarec/new_dynarec.c`)
- ARM dynamic recompiler → ARM64 code generation: emits code with (evidence: `libpcsxcore/new_dynarec/new_dynarec.c`)
- Lightrec recompiler → Lightrec memory manager: tracks allocations
- Emulator core → BIOS HLE: supports (evidence: `libpcsxcore/psxhle.h`)
- Emulator core → GPU plugin interface: uses plugin interface
- GPU plugin interface → NEON GPU: selects renderer
- GPU plugin interface → GLES GPU: selects renderer
- GPU plugin interface → PCSX4ALL GPU: selects renderer
- GPU plugin interface → P.E.Op.S. GPU: selects renderer
- Emulator core → SPU audio plugin: uses audio plugin
- Emulator core → Disc control: reads disc
- Disc control → CHD reader: reads CHD
- Emulator core → Game compatibility data: applies game hacks (evidence: `libpcsxcore/database.c`)
- Libretro interface → Emulator core: hosts emulator
