# tunepham/hookshot architecture

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

- Interactive diagram: https://gitdiagram.com/tunepham/hookshot
- Repository: https://github.com/tunepham/hookshot

## Overview

Hookshot turns a player’s own supported game files into a native Windows or Linux game, then launches that game. The README describes the major stages and capabilities; the source index additionally confirms selected builder, shader-baking, recompiler, and rendering relationships. Several runtime subsystems are represented by their exact enclosing directories because their implementation files were not sampled.

Main entry points: [`host/hos_main.c`](https://github.com/tunepham/hookshot/blob/main/host/hos_main.c) (Console services), [`gpu/vk`](https://github.com/tunepham/hookshot/tree/main/gpu/vk) (Graphics features), [`builder/linux/hookshot_builder.py`](https://github.com/tunepham/hookshot/blob/main/builder/linux/hookshot_builder.py) (Build orchestration), [`nx2/make_game.py`](https://github.com/tunepham/hookshot/blob/main/nx2/make_game.py) (Native game)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_build["Build and launch"]
  node_builder["Builder UI<br/>[window.py]"]
  node_buildflow["Build orchestration"]
  node_gamefiles["Game files"]
  node_nativegame["Native game<br/>[make_game.py]"]
  node_launcher["Game launcher<br/>[linux_update.py]"]
end

subgraph group_recompile["Game recompilation"]
  node_staticrecomp["Static recompilation"]
  node_shaderbake["Shader baking<br/>[bake_ds.cpp]"]
  node_shaderbatch["Shader batch<br/>[shaderbatch.cpp]"]
  node_shaderfront["Shader frontend<br/>[translate.cpp]"]
  node_shaderir["Shader IR<br/>[program.h]"]
  node_shaderopt["IR optimization"]
  node_spirv["SPIR-V backend<br/>[emit_spirv.cpp]"]
end

subgraph group_runtime["Host runtime"]
  node_hostos["Console services<br/>[hos_main.c]"]
  node_hostinput["Input and audio"]
  node_hostsave["Saves and files<br/>[nn_fs.c]"]
  node_mods["Game mods<br/>[mods.c]"]
end

subgraph group_graphics["Graphics and performance"]
  node_render["Vulkan renderer<br/>[rx_draw.cpp]"]
  node_vkfeatures["Graphics features"]
  node_menu["In-game menu<br/>[vk_menu.cpp]"]
  node_pipelinecache[("Pipeline cache<br/>[vk_progcache.cpp]")]
end

node_player(("Player"))

node_player -->|"selects files"| node_builder
node_gamefiles -->|"provides input"| node_builder
node_builder -.->|"starts build"| node_buildflow
node_buildflow -->|"builds"| node_nativegame
node_buildflow -->|"runs recompilation"| node_staticrecomp
node_nativegame -->|"launches through"| node_launcher
node_launcher -->|"offers Play"| node_player
node_staticrecomp -.->|"bakes shaders"| node_shaderbake
node_shaderbake -->|"translates programs"| node_shaderfront
node_shaderbatch -->|"translates programs"| node_shaderfront
node_shaderfront -.->|"produces IR"| node_shaderir
node_shaderopt -.->|"rewrites IR"| node_shaderir
node_shaderbatch -->|"emits SPIR-V"| node_spirv
node_shaderbake -->|"emits SPIR-V"| node_spirv
node_nativegame -->|"runs with"| node_hostos
node_hostos -.->|"provides services"| node_hostinput
node_hostos -.->|"provides services"| node_hostsave
node_hostos -.->|"loads mods"| node_mods
node_hostos -->|"uses renderer"| node_render
node_render -.->|"uses Vulkan"| node_vkfeatures
node_vkfeatures -->|"exposes controls"| node_menu
node_vkfeatures -.->|"caches pipelines"| node_pipelinecache
node_vkfeatures -->|"provides upscaling and frame generation"| node_player

click node_builder "https://github.com/tunepham/hookshot/blob/main/builder/py/hookshot_builder/window.py"
click node_buildflow "https://github.com/tunepham/hookshot/blob/main/builder/linux/hookshot_builder.py"
click node_nativegame "https://github.com/tunepham/hookshot/blob/main/nx2/make_game.py"
click node_launcher "https://github.com/tunepham/hookshot/blob/main/builder/linux/linux_update.py"
click node_staticrecomp "https://github.com/tunepham/hookshot/tree/main/nx2"
click node_shaderbake "https://github.com/tunepham/hookshot/blob/main/nx2/bake_ds/bake_ds.cpp"
click node_shaderbatch "https://github.com/tunepham/hookshot/blob/main/gpu/shaderbatch.cpp"
click node_shaderfront "https://github.com/tunepham/hookshot/blob/main/gpu/vk/eden/shader_recompiler/frontend/maxwell/translate/translate.cpp"
click node_shaderir "https://github.com/tunepham/hookshot/blob/main/gpu/vk/eden/shader_recompiler/frontend/ir/program.h"
click node_shaderopt "https://github.com/tunepham/hookshot/blob/main/gpu/vk/eden/shader_recompiler/ir_opt/global_memory_to_storage_buffer_pass.cpp"
click node_spirv "https://github.com/tunepham/hookshot/blob/main/gpu/vk/eden/shader_recompiler/backend/spirv/emit_spirv.cpp"
click node_hostos "https://github.com/tunepham/hookshot/blob/main/host/hos_main.c"
click node_hostinput "https://github.com/tunepham/hookshot/tree/main/host"
click node_hostsave "https://github.com/tunepham/hookshot/blob/main/host/nn_fs.c"
click node_mods "https://github.com/tunepham/hookshot/blob/main/host/mods.c"
click node_render "https://github.com/tunepham/hookshot/blob/main/gpu/render/rx_draw.cpp"
click node_vkfeatures "https://github.com/tunepham/hookshot/tree/main/gpu/vk"
click node_menu "https://github.com/tunepham/hookshot/blob/main/gpu/vk/vk_menu.cpp"
click node_pipelinecache "https://github.com/tunepham/hookshot/blob/main/gpu/vk/vk_progcache.cpp"

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_builder,node_buildflow,node_gamefiles,node_nativegame,node_launcher toneBlue
class node_staticrecomp,node_shaderbake,node_shaderbatch,node_shaderfront,node_shaderir,node_shaderopt,node_spirv toneAmber
class node_hostos,node_hostinput,node_hostsave,node_mods toneMint
class node_render,node_vkfeatures,node_menu,node_pipelinecache toneRose
class node_player toneIndigo
```

## Components

### Build and launch

- [Builder UI](https://github.com/tunepham/hookshot/blob/main/builder/py/hookshot_builder/window.py): `builder/py/hookshot_builder/window.py`
- [Build orchestration](https://github.com/tunepham/hookshot/blob/main/builder/linux/hookshot_builder.py): `builder/linux/hookshot_builder.py`
- **Game files**
- [Native game](https://github.com/tunepham/hookshot/blob/main/nx2/make_game.py): `nx2/make_game.py`
- [Game launcher](https://github.com/tunepham/hookshot/blob/main/builder/linux/linux_update.py): `builder/linux/linux_update.py`

### Game recompilation

- [Static recompilation](https://github.com/tunepham/hookshot/tree/main/nx2): `nx2`
- [Shader baking](https://github.com/tunepham/hookshot/blob/main/nx2/bake_ds/bake_ds.cpp): `nx2/bake_ds/bake_ds.cpp`
- [Shader batch](https://github.com/tunepham/hookshot/blob/main/gpu/shaderbatch.cpp): `gpu/shaderbatch.cpp`
- [Shader frontend](https://github.com/tunepham/hookshot/blob/main/gpu/vk/eden/shader_recompiler/frontend/maxwell/translate/translate.cpp): `gpu/vk/eden/shader_recompiler/frontend/maxwell/translate/translate.cpp`
- [Shader IR](https://github.com/tunepham/hookshot/blob/main/gpu/vk/eden/shader_recompiler/frontend/ir/program.h): `gpu/vk/eden/shader_recompiler/frontend/ir/program.h`
- [IR optimization](https://github.com/tunepham/hookshot/blob/main/gpu/vk/eden/shader_recompiler/ir_opt/global_memory_to_storage_buffer_pass.cpp): `gpu/vk/eden/shader_recompiler/ir_opt/global_memory_to_storage_buffer_pass.cpp`
- [SPIR-V backend](https://github.com/tunepham/hookshot/blob/main/gpu/vk/eden/shader_recompiler/backend/spirv/emit_spirv.cpp): `gpu/vk/eden/shader_recompiler/backend/spirv/emit_spirv.cpp`

### Host runtime

- [Console services](https://github.com/tunepham/hookshot/blob/main/host/hos_main.c): `host/hos_main.c`
- [Input and audio](https://github.com/tunepham/hookshot/tree/main/host): `host`
- [Saves and files](https://github.com/tunepham/hookshot/blob/main/host/nn_fs.c): `host/nn_fs.c`
- [Game mods](https://github.com/tunepham/hookshot/blob/main/host/mods.c): `host/mods.c`

### Graphics and performance

- [Vulkan renderer](https://github.com/tunepham/hookshot/blob/main/gpu/render/rx_draw.cpp): `gpu/render/rx_draw.cpp`
- [Graphics features](https://github.com/tunepham/hookshot/tree/main/gpu/vk): `gpu/vk`
- [In-game menu](https://github.com/tunepham/hookshot/blob/main/gpu/vk/vk_menu.cpp): `gpu/vk/vk_menu.cpp`
- [Pipeline cache](https://github.com/tunepham/hookshot/blob/main/gpu/vk/vk_progcache.cpp): `gpu/vk/vk_progcache.cpp`

### Other components

- **Player**

## Connections

- Player → Builder UI: selects files
- Game files → Builder UI: provides input
- Builder UI → Build orchestration: starts build
- Build orchestration → Native game: builds (evidence: `builder/linux/hookshot_builder.py`)
- Build orchestration → Static recompilation: runs recompilation (evidence: `builder/linux/hookshot_builder.py`)
- Native game → Game launcher: launches through
- Game launcher → Player: offers Play
- Static recompilation → Shader baking: bakes shaders
- Shader baking → Shader frontend: translates programs (evidence: `nx2/bake_ds/bake_ds.cpp`)
- Shader batch → Shader frontend: translates programs (evidence: `gpu/shaderbatch.cpp`)
- Shader frontend → Shader IR: produces IR
- IR optimization → Shader IR: rewrites IR
- Shader batch → SPIR-V backend: emits SPIR-V (evidence: `gpu/shaderbatch.cpp`)
- Shader baking → SPIR-V backend: emits SPIR-V (evidence: `nx2/bake_ds/bake_ds.cpp`)
- Native game → Console services: runs with
- Console services → Input and audio: provides services
- Console services → Saves and files: provides services
- Console services → Game mods: loads mods
- Console services → Vulkan renderer: uses renderer
- Vulkan renderer → Graphics features: uses Vulkan (evidence: `gpu/render/rx_draw.cpp`)
- Graphics features → In-game menu: exposes controls
- Graphics features → Pipeline cache: caches pipelines
- Graphics features → Player: provides upscaling and frame generation
