# captainj-sparrow/astral-chain-pc-recomp architecture

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

- Interactive diagram: https://gitdiagram.com/captainj-sparrow/astral-chain-pc-recomp
- Repository: https://github.com/captainj-sparrow/astral-chain-pc-recomp

## Overview

Astral Chain Recomp turns a user-supplied Switch game and update into a native x86-64 application, then runs it with a compatibility runtime. The documented installation flow extracts and merges game data, lifts code to C, and builds the executable. At runtime, the host layer, graphics translation, and settings/input UI support play and the documented visual and control features. The README supplies the installation sequence and product capabilities; sampled source and the SOURCE INDEX support only selected internal links, so unsampled integrations are shown only where documented.

Main entry points: [`runtime/main.c`](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/main.c) (Native game executable), [`recomp/gen.py`](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/recomp/gen.py) (C generation), [`installer/steps.py`](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/installer/steps.py) (Setup workflow), [`runtime/ui/menu.cpp`](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/ui/menu.cpp) (In-game menu)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_install["Installation"]
  node_installer["Setup workflow<br/>[steps.py]"]
  node_extract["Game extraction<br/>[extract.py]"]
  node_install_config["Install layout<br/>[layout.py]"]
end

subgraph group_lift["Static Recompilation"]
  node_gen["C generation<br/>[gen.py]"]
  node_lifter["AArch64 lifter<br/>[lifter.py]"]
  node_simd["SIMD lowering<br/>[simd_c.py]"]
  node_ipa["Interprocedural analysis<br/>[ipa.py]"]
  node_patches["Code patches<br/>[patches.py]"]
  node_regs["Register allocation<br/>[regs.py]"]
  node_jumptables["Jump tables<br/>[jumptables.py]"]
end

subgraph group_runtime["Runtime Compatibility"]
  node_native["Native game executable<br/>[main.c]"]
  node_host["Guest host services<br/>[host.h]"]
  node_platform["Platform services<br/>[platform.h]"]
  node_config["Runtime settings<br/>[cfg.h]"]
end

subgraph group_graphics["Graphics"]
  node_gfx_replay["NVN replay<br/>[vk_exec_draw.c]"]
  node_pipeline["Vulkan pipelines<br/>[vk_pipeline.c]"]
  node_hdr["HDR output<br/>[vk_hdr.c]"]
  node_upscaling["Upscaling integrations<br/>[vk_fsr3.c]"]
  node_xess["XeSS integration<br/>[vk_xess.c]"]
  node_fsr4["FSR 4 integration<br/>[vk_fsr4.c]"]
end

subgraph group_experience["Player Experience"]
  node_input["Input and remapping<br/>[input.h]"]
  node_menu["In-game menu<br/>[menu.cpp]"]
  node_option_rows["Settings controls<br/>[option_rows.cpp]"]
  node_text["Localized UI text<br/>[ui_text.c]"]
end

node_player(("Player"))

node_player -->|"starts setup"| node_installer
node_installer -->|"extracts game data"| node_extract
node_installer -->|"selects install options"| node_install_config
node_extract -->|"provides game code"| node_gen
node_gen -->|"uses"| node_lifter
node_gen -->|"uses"| node_simd
node_gen -->|"uses"| node_ipa
node_gen -->|"uses"| node_patches
node_gen -->|"uses"| node_regs
node_gen -->|"uses"| node_jumptables
node_gen -->|"builds executable"| node_native
node_player -->|"runs game"| node_native
node_native -->|"uses host services"| node_host
node_native -->|"uses platform layer"| node_platform
node_native -->|"reads settings"| node_config
node_native -.->|"accepts controls"| node_input
node_native -.->|"renders game"| node_gfx_replay
node_gfx_replay -->|"requests pipelines"| node_pipeline
node_player -->|"opens menu"| node_menu
node_menu -->|"uses settings rows"| node_option_rows
node_option_rows -->|"changes settings"| node_config
node_menu -.->|"displays localized text"| node_text
node_native -.->|"offers HDR"| node_hdr
node_native -.->|"offers FSR 3"| node_upscaling
node_native -.->|"offers XeSS"| node_xess
node_native -.->|"offers FSR 4"| node_fsr4

click node_installer "https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/installer/steps.py"
click node_extract "https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/tools/extract.py"
click node_install_config "https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/installer/layout.py"
click node_gen "https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/recomp/gen.py"
click node_lifter "https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/recomp/lifter.py"
click node_simd "https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/recomp/simd_c.py"
click node_ipa "https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/recomp/ipa.py"
click node_patches "https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/recomp/patches.py"
click node_regs "https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/recomp/regs.py"
click node_jumptables "https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/recomp/jumptables.py"
click node_native "https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/main.c"
click node_host "https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/host.h"
click node_platform "https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/platform/platform.h"
click node_config "https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/cfg.h"
click node_input "https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/input.h"
click node_menu "https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/ui/menu.cpp"
click node_option_rows "https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/ui/option_rows.cpp"
click node_text "https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/ui_text.c"
click node_gfx_replay "https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/vk_exec_draw.c"
click node_pipeline "https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/vk_pipeline.c"
click node_hdr "https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/vk_hdr.c"
click node_upscaling "https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/vk_fsr3.c"
click node_xess "https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/vk_xess.c"
click node_fsr4 "https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/vk_fsr4.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_installer,node_extract,node_install_config toneBlue
class node_gen,node_lifter,node_simd,node_ipa,node_patches,node_regs,node_jumptables toneAmber
class node_native,node_host,node_platform,node_config toneMint
class node_gfx_replay,node_pipeline,node_hdr,node_upscaling,node_xess,node_fsr4 toneRose
class node_input,node_menu,node_option_rows,node_text,node_player toneIndigo
```

## Components

### Installation

- [Setup workflow](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/installer/steps.py): `installer/steps.py`
- [Game extraction](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/tools/extract.py): `tools/extract.py`
- [Install layout](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/installer/layout.py): `installer/layout.py`

### Static Recompilation

- [C generation](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/recomp/gen.py): `recomp/gen.py`
- [AArch64 lifter](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/recomp/lifter.py): `recomp/lifter.py`
- [SIMD lowering](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/recomp/simd_c.py): `recomp/simd_c.py`
- [Interprocedural analysis](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/recomp/ipa.py): `recomp/ipa.py`
- [Code patches](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/recomp/patches.py): `recomp/patches.py`
- [Register allocation](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/recomp/regs.py): `recomp/regs.py`
- [Jump tables](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/recomp/jumptables.py): `recomp/jumptables.py`

### Runtime Compatibility

- [Native game executable](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/main.c): `runtime/main.c`
- [Guest host services](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/host.h): `runtime/host.h`
- [Platform services](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/platform/platform.h): `runtime/platform/platform.h`
- [Runtime settings](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/cfg.h): `runtime/cfg.h`

### Graphics

- [NVN replay](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/vk_exec_draw.c): `runtime/vk_exec_draw.c`
- [Vulkan pipelines](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/vk_pipeline.c): `runtime/vk_pipeline.c`
- [HDR output](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/vk_hdr.c): `runtime/vk_hdr.c`
- [Upscaling integrations](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/vk_fsr3.c): `runtime/vk_fsr3.c`
- [XeSS integration](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/vk_xess.c): `runtime/vk_xess.c`
- [FSR 4 integration](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/vk_fsr4.c): `runtime/vk_fsr4.c`

### Player Experience

- [Input and remapping](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/input.h): `runtime/input.h`
- [In-game menu](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/ui/menu.cpp): `runtime/ui/menu.cpp`
- [Settings controls](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/ui/option_rows.cpp): `runtime/ui/option_rows.cpp`
- [Localized UI text](https://github.com/captainj-sparrow/astral-chain-pc-recomp/blob/main/runtime/ui_text.c): `runtime/ui_text.c`

### Other components

- **Player**

## Connections

- Player → Setup workflow: starts setup (evidence: `README.md`)
- Setup workflow → Game extraction: extracts game data (evidence: `README.md`)
- Setup workflow → Install layout: selects install options (evidence: `installer/steps.py`)
- Game extraction → C generation: provides game code (evidence: `README.md`)
- C generation → AArch64 lifter: uses (evidence: `recomp/gen.py`)
- C generation → SIMD lowering: uses (evidence: `recomp/gen.py`)
- C generation → Interprocedural analysis: uses (evidence: `recomp/gen.py`)
- C generation → Code patches: uses (evidence: `recomp/gen.py`)
- C generation → Register allocation: uses (evidence: `recomp/gen.py`)
- C generation → Jump tables: uses (evidence: `recomp/gen.py`)
- C generation → Native game executable: builds executable (evidence: `README.md`)
- Player → Native game executable: runs game (evidence: `README.md`)
- Native game executable → Guest host services: uses host services (evidence: `runtime/main.c`)
- Native game executable → Platform services: uses platform layer (evidence: `runtime/main.c`)
- Native game executable → Runtime settings: reads settings (evidence: `runtime/main.c`)
- Native game executable → Input and remapping: accepts controls (evidence: `README.md`)
- Native game executable → NVN replay: renders game (evidence: `README.md`)
- NVN replay → Vulkan pipelines: requests pipelines (evidence: `runtime/vk_pipeline.c`)
- Player → In-game menu: opens menu (evidence: `README.md`)
- In-game menu → Settings controls: uses settings rows (evidence: `runtime/ui/menu.cpp`)
- Settings controls → Runtime settings: changes settings (evidence: `runtime/ui/option_rows.cpp`)
- In-game menu → Localized UI text: displays localized text (evidence: `README.md`)
- Native game executable → HDR output: offers HDR (evidence: `README.md`)
- Native game executable → Upscaling integrations: offers FSR 3 (evidence: `README.md`)
- Native game executable → XeSS integration: offers XeSS (evidence: `README.md`)
- Native game executable → FSR 4 integration: offers FSR 4 (evidence: `README.md`)
