# craze1pirate/craziiemu architecture

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

- Interactive diagram: https://gitdiagram.com/craze1pirate/craziiemu
- Repository: https://github.com/craze1pirate/craziiemu

## Overview

craziiEmu is an experimental Windows x64 PlayStation 5 emulator and compatibility layer. The principal workflow begins with a user launching a game through the CLI or UI; the runtime loads the guest image, executes guest code, resolves system-library calls, and submits graphics work for Vulkan presentation. Other documented capabilities include audio and video decoding, controller input, save data, and debugging/diagnostics. Several subsystem connections are documented in the README but their implementation was not sampled, so those links are marked unverified.

Main entry points: [`src/CraziiEmu.Core/Runtime/CraziiEmuRuntime.cs`](https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Core/Runtime/CraziiEmuRuntime.cs) (Emulator runtime), [`src/CraziiEmu.Core/Cpu/Native/DirectExecutionBackend.cs`](https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Core/Cpu/Native/DirectExecutionBackend.cs) (Native CPU execution), [`src/CraziiEmu.Libs/Gpu/GpuCommands/GpuCommandInterpreter.cs`](https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Libs/Gpu/GpuCommands/GpuCommandInterpreter.cs) (GPU command processing), [`src/CraziiEmu.CLI/Program.cs`](https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.CLI/Program.cs) (CLI launcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_launch["Launch and runtime"]
  node_cli["CLI launcher<br/>[Program.cs]"]
  node_ui["Emulator UI<br/>[Program.cs]"]
  node_runtime["Emulator runtime"]
end

subgraph group_compat["Guest compatibility"]
  node_loader["Guest image loader<br/>[SelfLoader.cs]"]
  node_cpu["Native CPU execution"]
  node_context["Guest CPU context<br/>[CpuContext.cs]"]
  node_modules["Guest exports<br/>[ModuleManager.cs]"]
  node_kernel["Kernel compatibility"]
end

subgraph group_graphics["Graphics pipeline"]
  node_commands["GPU command processing"]
  node_shader["Shader compilation"]
  node_pipelines["Shader pipelines"]
  node_scheduler["GPU submission"]
  node_presenter["Vulkan presentation"]
end

subgraph group_media["Media and input"]
  node_audio["Audio and media<br/>[AudioOutExports.cs]"]
  node_input["Controller input<br/>[GamepadHandler.cs]"]
  node_saves[("Save data<br/>[SaveDataStorage.cs]")]
end

subgraph group_support["Debug and support"]
  node_debugger["Debugger server<br/>[DebuggerServer.cs]"]
  node_diagnostics["Runtime diagnostics"]
  node_debugclient["Debug client<br/>[Program.cs]"]
end

node_user(("User"))
node_guest["Game package"]
node_vulkan["Vulkan device"]

node_user -->|"launches"| node_cli
node_user -.->|"opens"| node_ui
node_cli -->|"creates"| node_runtime
node_ui -.->|"starts"| node_runtime
node_runtime -.->|"loads guest"| node_loader
node_guest -.->|"provides image"| node_loader
node_runtime -.->|"executes guest"| node_cpu
node_cpu -->|"uses context"| node_context
node_cpu -.->|"dispatches imports"| node_modules
node_modules -.->|"resolves exports"| node_kernel
node_commands -.->|"requests pipelines"| node_pipelines
node_pipelines -->|"compiles stages"| node_shader
node_commands -.->|"submits work"| node_scheduler
node_scheduler -.->|"schedules presentation"| node_presenter
node_presenter -.->|"renders through"| node_vulkan
node_runtime -.->|"supports audio"| node_audio
node_runtime -.->|"accepts controls"| node_input
node_runtime -.->|"supports saves"| node_saves
node_user -.->|"connects debugger"| node_debugclient
node_debugclient -->|"sends commands"| node_debugger
node_debugger -.->|"controls execution"| node_runtime
node_cpu -.->|"reports faults"| node_diagnostics

click node_cli "https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.CLI/Program.cs"
click node_ui "https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.UI/Program.cs"
click node_runtime "https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Core/Runtime/CraziiEmuRuntime.cs"
click node_loader "https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Core/Loader/SelfLoader.cs"
click node_cpu "https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Core/Cpu/Native/DirectExecutionBackend.cs"
click node_context "https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.HLE/CpuContext.cs"
click node_modules "https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.HLE/ModuleManager.cs"
click node_kernel "https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Libs/Kernel/KernelRuntimeCompatExports.cs"
click node_commands "https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Libs/Gpu/GpuCommands/GpuCommandInterpreter.cs"
click node_shader "https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.ShaderCompiler/Gen5ShaderTranslator.cs"
click node_pipelines "https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Libs/Gpu/Pipelines/ShaderPipelineCache.cs"
click node_scheduler "https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Libs/Gpu/Scheduling/SubmissionScheduler.cs"
click node_presenter "https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Libs/VideoOut/VulkanVideoPresenter.cs"
click node_audio "https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Libs/Audio/AudioOutExports.cs"
click node_input "https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.HLE/Input/GamepadHandler.cs"
click node_saves "https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Libs/SaveData/SaveDataStorage.cs"
click node_debugger "https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Debugger/Server/DebuggerServer.cs"
click node_diagnostics "https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Core/Diagnostics/WindowsCrashCapture.cs"
click node_debugclient "https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.DebugClient/Program.cs"

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_cli,node_ui,node_runtime,node_user toneBlue
class node_loader,node_cpu,node_context,node_modules,node_kernel toneAmber
class node_commands,node_shader,node_pipelines,node_scheduler,node_presenter toneMint
class node_audio,node_input,node_saves toneRose
class node_debugger,node_diagnostics,node_debugclient,node_guest,node_vulkan toneIndigo
```

## Components

### Launch and runtime

- [CLI launcher](https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.CLI/Program.cs): `src/CraziiEmu.CLI/Program.cs`
- [Emulator UI](https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.UI/Program.cs): `src/CraziiEmu.UI/Program.cs`
- [Emulator runtime](https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Core/Runtime/CraziiEmuRuntime.cs): `src/CraziiEmu.Core/Runtime/CraziiEmuRuntime.cs`

### Guest compatibility

- [Guest image loader](https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Core/Loader/SelfLoader.cs): `src/CraziiEmu.Core/Loader/SelfLoader.cs`
- [Native CPU execution](https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Core/Cpu/Native/DirectExecutionBackend.cs): `src/CraziiEmu.Core/Cpu/Native/DirectExecutionBackend.cs`
- [Guest CPU context](https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.HLE/CpuContext.cs): `src/CraziiEmu.HLE/CpuContext.cs`
- [Guest exports](https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.HLE/ModuleManager.cs): `src/CraziiEmu.HLE/ModuleManager.cs`
- [Kernel compatibility](https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Libs/Kernel/KernelRuntimeCompatExports.cs): `src/CraziiEmu.Libs/Kernel/KernelRuntimeCompatExports.cs`

### Graphics pipeline

- [GPU command processing](https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Libs/Gpu/GpuCommands/GpuCommandInterpreter.cs): `src/CraziiEmu.Libs/Gpu/GpuCommands/GpuCommandInterpreter.cs`
- [Shader compilation](https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.ShaderCompiler/Gen5ShaderTranslator.cs): `src/CraziiEmu.ShaderCompiler/Gen5ShaderTranslator.cs`
- [Shader pipelines](https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Libs/Gpu/Pipelines/ShaderPipelineCache.cs): `src/CraziiEmu.Libs/Gpu/Pipelines/ShaderPipelineCache.cs`
- [GPU submission](https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Libs/Gpu/Scheduling/SubmissionScheduler.cs): `src/CraziiEmu.Libs/Gpu/Scheduling/SubmissionScheduler.cs`
- [Vulkan presentation](https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Libs/VideoOut/VulkanVideoPresenter.cs): `src/CraziiEmu.Libs/VideoOut/VulkanVideoPresenter.cs`

### Media and input

- [Audio and media](https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Libs/Audio/AudioOutExports.cs): `src/CraziiEmu.Libs/Audio/AudioOutExports.cs`
- [Controller input](https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.HLE/Input/GamepadHandler.cs): `src/CraziiEmu.HLE/Input/GamepadHandler.cs`
- [Save data](https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Libs/SaveData/SaveDataStorage.cs): `src/CraziiEmu.Libs/SaveData/SaveDataStorage.cs`

### Debug and support

- [Debugger server](https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Debugger/Server/DebuggerServer.cs): `src/CraziiEmu.Debugger/Server/DebuggerServer.cs`
- [Runtime diagnostics](https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.Core/Diagnostics/WindowsCrashCapture.cs): `src/CraziiEmu.Core/Diagnostics/WindowsCrashCapture.cs`
- [Debug client](https://github.com/craze1pirate/craziiemu/blob/main/src/CraziiEmu.DebugClient/Program.cs): `src/CraziiEmu.DebugClient/Program.cs`

### Other components

- **User**
- **Game package**
- **Vulkan device**

## Connections

- User → CLI launcher: launches (evidence: `src/CraziiEmu.CLI/Program.cs`)
- User → Emulator UI: opens (evidence: `README.md`)
- CLI launcher → Emulator runtime: creates (evidence: `src/CraziiEmu.CLI/Program.cs`)
- Emulator UI → Emulator runtime: starts (evidence: `src/CraziiEmu.UI/Program.cs`)
- Emulator runtime → Guest image loader: loads guest (evidence: `README.md`)
- Game package → Guest image loader: provides image (evidence: `README.md`)
- Emulator runtime → Native CPU execution: executes guest (evidence: `README.md`)
- Native CPU execution → Guest CPU context: uses context (evidence: `src/CraziiEmu.Core/Cpu/Native/DirectExecutionBackend.NativeWorker.cs`)
- Native CPU execution → Guest exports: dispatches imports (evidence: `README.md`)
- Guest exports → Kernel compatibility: resolves exports (evidence: `src/CraziiEmu.HLE/ModuleManager.cs`)
- GPU command processing → Shader pipelines: requests pipelines (evidence: `README.md`)
- Shader pipelines → Shader compilation: compiles stages (evidence: `src/CraziiEmu.Libs/Gpu/Pipelines/ShaderPipelineCache.cs`)
- GPU command processing → GPU submission: submits work (evidence: `README.md`)
- GPU submission → Vulkan presentation: schedules presentation (evidence: `src/CraziiEmu.Libs/VideoOut/VulkanVideoPresenter.Pipelines.cs`)
- Vulkan presentation → Vulkan device: renders through (evidence: `README.md`)
- Emulator runtime → Audio and media: supports audio (evidence: `README.md`)
- Emulator runtime → Controller input: accepts controls (evidence: `README.md`)
- Emulator runtime → Save data: supports saves (evidence: `README.md`)
- User → Debug client: connects debugger (evidence: `README.md`)
- Debug client → Debugger server: sends commands (evidence: `src/CraziiEmu.DebugClient/Program.cs`)
- Debugger server → Emulator runtime: controls execution (evidence: `README.md`)
- Native CPU execution → Runtime diagnostics: reports faults (evidence: `README.md`)
