# adriadam10/mkw-recomp architecture

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

- Interactive diagram: https://gitdiagram.com/adriadam10/mkw-recomp
- Repository: https://github.com/adriadam10/mkw-recomp

## Overview

mkw-recomp turns a player’s own Switch 2 dump into a native Linux or Windows game: the launcher prepares the dump, AArch64 code is statically lifted to C, SM86 shaders are translated ahead of time, and the runtime supplies guest system services while implementing NVN2 over Vulkan. The runtime also covers input, audio, files, menus, and platform support. The README documents the overall workflow and major capabilities; several internal runtime connections are supported by the source index’s import references rather than inspected call sites.

Main entry points: [`runtime/core/boot/main.c`](https://github.com/adriadam10/mkw-recomp/blob/main/runtime/core/boot/main.c) (Runtime entry), [`runtime/core/base/cfg.h`](https://github.com/adriadam10/mkw-recomp/blob/main/runtime/core/base/cfg.h) (Configuration), [`runtime/ui/launcher/launcher_setup.cpp`](https://github.com/adriadam10/mkw-recomp/blob/main/runtime/ui/launcher/launcher_setup.cpp) (Game preparation), [`recomp/gen.py`](https://github.com/adriadam10/mkw-recomp/blob/main/recomp/gen.py) (AArch64 generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Preparation and translation"]
  node_launcher["Launcher<br/>[launcher.cpp]"]
  node_prepare["Game preparation<br/>[launcher_setup.cpp]"]
  node_generator["AArch64 generator<br/>[gen.py]"]
  node_nso["NSO loader<br/>[nso.py]"]
  node_lifter["AArch64 lifter<br/>[lifter.py]"]
  node_simd["SIMD lowering<br/>[simd_c.py]"]
  node_extract["Shader extraction<br/>[extract.py]"]
end

subgraph group_runtime["Game runtime"]
  node_runtime_entry["Runtime entry<br/>[main.c]"]
  node_guest["Guest CPU and kernel<br/>[cpu.h]"]
  node_memory["Guest memory<br/>[memory.c]"]
  node_audio["Audio runtime<br/>[audio_mixer.c]"]
  node_platform["Host platform<br/>[platform.h]"]
end

subgraph group_graphics["Graphics and shaders"]
  node_sass["SM86 decoder<br/>[sass_decode.py]"]
  node_sassspec["SM86 specification<br/>[sass_spec.py]"]
  node_shader["Shader translator<br/>[program.py]"]
  node_nvn["NVN2 implementation<br/>[nvn_api_core.c]"]
  node_vulkan["Vulkan backend<br/>[vk_pipeline.c]"]
end

subgraph group_services["Host services and UI"]
  node_config["Configuration<br/>[cfg.h]"]
  node_filesystem["Filesystem services<br/>[fs_host.c]"]
  node_input["Input services<br/>[input.c]"]
  node_menu["Settings menu<br/>[menu.cpp]"]
end

node_player(("Player"))

node_player -->|"opens"| node_launcher
node_launcher -->|"prepares dump"| node_prepare
node_prepare -->|"generates C"| node_generator
node_prepare -->|"extracts shaders"| node_extract
node_generator -->|"loads modules"| node_nso
node_generator -->|"lifts code"| node_lifter
node_lifter -->|"lowers SIMD"| node_simd
node_extract -->|"reads NSO"| node_nso
node_extract -->|"feeds programs"| node_shader
node_shader -->|"decodes instructions"| node_sass
node_sass -->|"uses specification"| node_sassspec
node_runtime_entry -->|"runs launcher"| node_launcher
node_runtime_entry -.->|"initializes settings"| node_config
node_runtime_entry -->|"uses host layer"| node_platform
node_runtime_entry -.->|"boots guest"| node_guest
node_runtime_entry -->|"reserves memory"| node_memory
node_runtime_entry -.->|"starts game runtime"| node_audio
node_runtime_entry -.->|"runs game graphics"| node_nvn
node_nvn -->|"reimplemented over"| node_vulkan
node_input -->|"feeds controls"| node_menu
node_input -->|"reads settings"| node_config
node_menu -->|"edits settings"| node_config
node_menu -->|"uses files"| node_filesystem
node_filesystem -->|"reads configuration"| node_config

click node_launcher "https://github.com/adriadam10/mkw-recomp/blob/main/runtime/ui/launcher/launcher.cpp"
click node_prepare "https://github.com/adriadam10/mkw-recomp/blob/main/runtime/ui/launcher/launcher_setup.cpp"
click node_generator "https://github.com/adriadam10/mkw-recomp/blob/main/recomp/gen.py"
click node_nso "https://github.com/adriadam10/mkw-recomp/blob/main/recomp/nso.py"
click node_lifter "https://github.com/adriadam10/mkw-recomp/blob/main/recomp/lifter.py"
click node_simd "https://github.com/adriadam10/mkw-recomp/blob/main/recomp/simd_c.py"
click node_extract "https://github.com/adriadam10/mkw-recomp/blob/main/tools/shaders/extract.py"
click node_sass "https://github.com/adriadam10/mkw-recomp/blob/main/sm86/decode/sass_decode.py"
click node_sassspec "https://github.com/adriadam10/mkw-recomp/blob/main/sm86/decode/sass_spec.py"
click node_shader "https://github.com/adriadam10/mkw-recomp/blob/main/sm86/translate/program.py"
click node_runtime_entry "https://github.com/adriadam10/mkw-recomp/blob/main/runtime/core/boot/main.c"
click node_guest "https://github.com/adriadam10/mkw-recomp/blob/main/runtime/cpu/cpu.h"
click node_memory "https://github.com/adriadam10/mkw-recomp/blob/main/runtime/core/memory/memory.c"
click node_config "https://github.com/adriadam10/mkw-recomp/blob/main/runtime/core/base/cfg.h"
click node_filesystem "https://github.com/adriadam10/mkw-recomp/blob/main/runtime/sdk/fs/fs_host.c"
click node_input "https://github.com/adriadam10/mkw-recomp/blob/main/runtime/input/input.c"
click node_menu "https://github.com/adriadam10/mkw-recomp/blob/main/runtime/ui/menu/menu.cpp"
click node_audio "https://github.com/adriadam10/mkw-recomp/blob/main/runtime/audio/audio_mixer.c"
click node_nvn "https://github.com/adriadam10/mkw-recomp/blob/main/runtime/gfx/nvn/api/nvn_api_core.c"
click node_vulkan "https://github.com/adriadam10/mkw-recomp/blob/main/runtime/gfx/vk/pipe/vk_pipeline.c"
click node_platform "https://github.com/adriadam10/mkw-recomp/blob/main/runtime/platform/platform.h"

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_launcher,node_prepare,node_generator,node_nso,node_lifter,node_simd,node_extract toneBlue
class node_runtime_entry,node_guest,node_memory,node_audio,node_platform toneAmber
class node_sass,node_sassspec,node_shader,node_nvn,node_vulkan toneMint
class node_config,node_filesystem,node_input,node_menu toneRose
class node_player toneIndigo
```

## Components

### Preparation and translation

- [Launcher](https://github.com/adriadam10/mkw-recomp/blob/main/runtime/ui/launcher/launcher.cpp): `runtime/ui/launcher/launcher.cpp`
- [Game preparation](https://github.com/adriadam10/mkw-recomp/blob/main/runtime/ui/launcher/launcher_setup.cpp): `runtime/ui/launcher/launcher_setup.cpp`
- [AArch64 generator](https://github.com/adriadam10/mkw-recomp/blob/main/recomp/gen.py): `recomp/gen.py`
- [NSO loader](https://github.com/adriadam10/mkw-recomp/blob/main/recomp/nso.py): `recomp/nso.py`
- [AArch64 lifter](https://github.com/adriadam10/mkw-recomp/blob/main/recomp/lifter.py): `recomp/lifter.py`
- [SIMD lowering](https://github.com/adriadam10/mkw-recomp/blob/main/recomp/simd_c.py): `recomp/simd_c.py`
- [Shader extraction](https://github.com/adriadam10/mkw-recomp/blob/main/tools/shaders/extract.py): `tools/shaders/extract.py`

### Game runtime

- [Runtime entry](https://github.com/adriadam10/mkw-recomp/blob/main/runtime/core/boot/main.c): `runtime/core/boot/main.c`
- [Guest CPU and kernel](https://github.com/adriadam10/mkw-recomp/blob/main/runtime/cpu/cpu.h): `runtime/cpu/cpu.h`
- [Guest memory](https://github.com/adriadam10/mkw-recomp/blob/main/runtime/core/memory/memory.c): `runtime/core/memory/memory.c`
- [Audio runtime](https://github.com/adriadam10/mkw-recomp/blob/main/runtime/audio/audio_mixer.c): `runtime/audio/audio_mixer.c`
- [Host platform](https://github.com/adriadam10/mkw-recomp/blob/main/runtime/platform/platform.h): `runtime/platform/platform.h`

### Graphics and shaders

- [SM86 decoder](https://github.com/adriadam10/mkw-recomp/blob/main/sm86/decode/sass_decode.py): `sm86/decode/sass_decode.py`
- [SM86 specification](https://github.com/adriadam10/mkw-recomp/blob/main/sm86/decode/sass_spec.py): `sm86/decode/sass_spec.py`
- [Shader translator](https://github.com/adriadam10/mkw-recomp/blob/main/sm86/translate/program.py): `sm86/translate/program.py`
- [NVN2 implementation](https://github.com/adriadam10/mkw-recomp/blob/main/runtime/gfx/nvn/api/nvn_api_core.c): `runtime/gfx/nvn/api/nvn_api_core.c`
- [Vulkan backend](https://github.com/adriadam10/mkw-recomp/blob/main/runtime/gfx/vk/pipe/vk_pipeline.c): `runtime/gfx/vk/pipe/vk_pipeline.c`

### Host services and UI

- [Configuration](https://github.com/adriadam10/mkw-recomp/blob/main/runtime/core/base/cfg.h): `runtime/core/base/cfg.h`
- [Filesystem services](https://github.com/adriadam10/mkw-recomp/blob/main/runtime/sdk/fs/fs_host.c): `runtime/sdk/fs/fs_host.c`
- [Input services](https://github.com/adriadam10/mkw-recomp/blob/main/runtime/input/input.c): `runtime/input/input.c`
- [Settings menu](https://github.com/adriadam10/mkw-recomp/blob/main/runtime/ui/menu/menu.cpp): `runtime/ui/menu/menu.cpp`

### Other components

- **Player**

## Connections

- Player → Launcher: opens (evidence: `README.md`)
- Launcher → Game preparation: prepares dump (evidence: `README.md`)
- Game preparation → AArch64 generator: generates C (evidence: `README.md`)
- Game preparation → Shader extraction: extracts shaders (evidence: `README.md`)
- AArch64 generator → NSO loader: loads modules
- AArch64 generator → AArch64 lifter: lifts code
- AArch64 lifter → SIMD lowering: lowers SIMD (evidence: `recomp/lifter.py`)
- Shader extraction → NSO loader: reads NSO (evidence: `tools/shaders/extract.py`)
- Shader extraction → Shader translator: feeds programs (evidence: `README.md`)
- Shader translator → SM86 decoder: decodes instructions (evidence: `sm86/translate/program.py`)
- SM86 decoder → SM86 specification: uses specification (evidence: `sm86/decode/sass_decode.py`)
- Runtime entry → Launcher: runs launcher (evidence: `runtime/core/boot/main.c`)
- Runtime entry → Configuration: initializes settings (evidence: `runtime/core/boot/main.c`)
- Runtime entry → Host platform: uses host layer (evidence: `runtime/core/boot/main.c`)
- Runtime entry → Guest CPU and kernel: boots guest
- Runtime entry → Guest memory: reserves memory (evidence: `runtime/core/boot/main.c`)
- Runtime entry → Audio runtime: starts game runtime
- Runtime entry → NVN2 implementation: runs game graphics
- NVN2 implementation → Vulkan backend: reimplemented over (evidence: `README.md`)
- Input services → Settings menu: feeds controls (evidence: `runtime/input/input.c`)
- Input services → Configuration: reads settings (evidence: `runtime/input/input.c`)
- Settings menu → Configuration: edits settings (evidence: `runtime/ui/menu/menu.cpp`)
- Settings menu → Filesystem services: uses files (evidence: `runtime/ui/menu/menu.cpp`)
- Filesystem services → Configuration: reads configuration (evidence: `runtime/sdk/fs/fs_host.c`)
