# crementif/botw-bettervr architecture

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

- Interactive diagram: https://gitdiagram.com/crementif/botw-bettervr
- Repository: https://github.com/crementif/botw-bettervr

## Overview

BetterVR is a Windows VR mod for Breath of the Wild running inside Cemu. The user launches it alongside Cemu, starts the game, and the mod intercepts Cemu’s Vulkan output and routes it through Vulkan–D3D12 interop for OpenXR stereo presentation. In parallel, OpenXR controller input drives game hooks for roomscale movement, hands, weapons, and gestures; an in-game menu exposes settings and controls. The README documents these capabilities, but several implementation files were not sampled, so uncertain internal call paths are omitted.

Main entry points: [`src/hooking/cemu_hooks.h`](https://github.com/crementif/botw-bettervr/blob/main/src/hooking/cemu_hooks.h) (Cemu hooks), [`src/rendering/renderer.cpp`](https://github.com/crementif/botw-bettervr/blob/main/src/rendering/renderer.cpp) (Frame renderer), [`launcher/main.cpp`](https://github.com/crementif/botw-bettervr/blob/main/launcher/main.cpp) (Launcher), [`src/rendering/openxr.cpp`](https://github.com/crementif/botw-bettervr/blob/main/src/rendering/openxr.cpp) (OpenXR session)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_launch["Launch"]
  node_launcher["Launcher<br/>[main.cpp]"]
  node_launch_config["Launch support<br/>[launcher_common.h]"]
end

subgraph group_runtime["VR Runtime"]
  node_vulkan_layer["Vulkan layer<br/>[layer.cpp]"]
  node_vr_manager["VR manager<br/>[instance.h]"]
  node_openxr["OpenXR session<br/>[openxr.cpp]"]
  node_bindings["Controller bindings"]
  node_renderer["Frame renderer<br/>[renderer.cpp]"]
  node_vulkan["Vulkan interop<br/>[vulkan.cpp]"]
  node_d3d12["D3D12 renderer<br/>[d3d12.cpp]"]
  node_render_utils["Render utilities<br/>[render_utils.h]"]
end

subgraph group_gameplay["Game Hooks"]
  node_hooks["Cemu hooks<br/>[cemu_hooks.h]"]
  node_entity_control["Roomscale control"]
  node_camera["Camera control<br/>[camera.cpp]"]
  node_weapon["Weapon handling<br/>[weapon.cpp]"]
  node_bow["Bow handling<br/>[bow.cpp]"]
  node_skeleton["Hands and arms<br/>[skeleton.cpp]"]
  node_controls["Gameplay controls<br/>[controls.cpp]"]
end

subgraph group_interface["Interface"]
  node_settings["Settings model<br/>[mod_settings.h]"]
  node_menus["In-game menu<br/>[imgui_menus.cpp]"]
  node_debug_draw["Debug drawing<br/>[debug_draw.cpp]"]
end

node_user(("Player"))
node_cemu["Cemu"]
node_headset["OpenXR headset"]

node_user -->|"launches"| node_launcher
node_launcher -->|"starts alongside"| node_cemu
node_cemu -->|"enables layer"| node_vulkan_layer
node_vulkan_layer -->|"intercepts frames"| node_renderer
node_renderer -->|"presents stereo"| node_headset
node_renderer -->|"uses interop"| node_d3d12
node_d3d12 -.->|"submits frames"| node_headset
node_headset -.->|"provides tracking"| node_openxr
node_openxr -->|"supplies input"| node_controls
node_controls -.->|"drives gameplay"| node_hooks
node_hooks -->|"supports roomscale"| node_entity_control
node_hooks -->|"supports camera modes"| node_camera
node_hooks -->|"supports wielding"| node_weapon
node_hooks -.->|"supports bow use"| node_bow
node_hooks -->|"supports hands"| node_skeleton
node_user -->|"opens controls"| node_menus
node_menus -->|"edits settings"| node_settings
node_entity_control -->|"draws diagnostics"| node_debug_draw
node_openxr -.->|"uses bindings"| node_bindings
node_launcher -.->|"uses launch support"| node_launch_config
node_renderer -.->|"captures Vulkan images"| node_vulkan
node_renderer -.->|"uses render helpers"| node_render_utils

click node_launcher "https://github.com/crementif/botw-bettervr/blob/main/launcher/main.cpp"
click node_launch_config "https://github.com/crementif/botw-bettervr/blob/main/launcher/launcher_common.h"
click node_vulkan_layer "https://github.com/crementif/botw-bettervr/blob/main/src/hooking/layer.cpp"
click node_hooks "https://github.com/crementif/botw-bettervr/blob/main/src/hooking/cemu_hooks.h"
click node_vr_manager "https://github.com/crementif/botw-bettervr/blob/main/src/instance.h"
click node_openxr "https://github.com/crementif/botw-bettervr/blob/main/src/rendering/openxr.cpp"
click node_bindings "https://github.com/crementif/botw-bettervr/blob/main/src/utils/controller_bindings.h"
click node_renderer "https://github.com/crementif/botw-bettervr/blob/main/src/rendering/renderer.cpp"
click node_vulkan "https://github.com/crementif/botw-bettervr/blob/main/src/rendering/vulkan.cpp"
click node_d3d12 "https://github.com/crementif/botw-bettervr/blob/main/src/rendering/d3d12.cpp"
click node_render_utils "https://github.com/crementif/botw-bettervr/blob/main/src/utils/render_utils.h"
click node_entity_control "https://github.com/crementif/botw-bettervr/blob/main/src/hooking/entity_controller.cpp"
click node_camera "https://github.com/crementif/botw-bettervr/blob/main/src/hooking/camera.cpp"
click node_weapon "https://github.com/crementif/botw-bettervr/blob/main/src/hooking/weapon.cpp"
click node_bow "https://github.com/crementif/botw-bettervr/blob/main/src/hooking/bow.cpp"
click node_skeleton "https://github.com/crementif/botw-bettervr/blob/main/src/hooking/skeleton.cpp"
click node_controls "https://github.com/crementif/botw-bettervr/blob/main/src/hooking/controls.cpp"
click node_settings "https://github.com/crementif/botw-bettervr/blob/main/src/utils/mod_settings.h"
click node_menus "https://github.com/crementif/botw-bettervr/blob/main/src/hooking/imgui_menus.cpp"
click node_debug_draw "https://github.com/crementif/botw-bettervr/blob/main/src/utils/debug_draw.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_launcher,node_launch_config toneBlue
class node_vulkan_layer,node_vr_manager,node_openxr,node_bindings,node_renderer,node_vulkan,node_d3d12,node_render_utils toneAmber
class node_hooks,node_entity_control,node_camera,node_weapon,node_bow,node_skeleton,node_controls toneMint
class node_settings,node_menus,node_debug_draw toneRose
class node_user,node_cemu,node_headset toneIndigo
```

## Components

### Launch

- [Launcher](https://github.com/crementif/botw-bettervr/blob/main/launcher/main.cpp): `launcher/main.cpp`
- [Launch support](https://github.com/crementif/botw-bettervr/blob/main/launcher/launcher_common.h): `launcher/launcher_common.h`

### VR Runtime

- [Vulkan layer](https://github.com/crementif/botw-bettervr/blob/main/src/hooking/layer.cpp): `src/hooking/layer.cpp`
- [VR manager](https://github.com/crementif/botw-bettervr/blob/main/src/instance.h): `src/instance.h`
- [OpenXR session](https://github.com/crementif/botw-bettervr/blob/main/src/rendering/openxr.cpp): `src/rendering/openxr.cpp`
- [Controller bindings](https://github.com/crementif/botw-bettervr/blob/main/src/utils/controller_bindings.h): `src/utils/controller_bindings.h`
- [Frame renderer](https://github.com/crementif/botw-bettervr/blob/main/src/rendering/renderer.cpp): `src/rendering/renderer.cpp`
- [Vulkan interop](https://github.com/crementif/botw-bettervr/blob/main/src/rendering/vulkan.cpp): `src/rendering/vulkan.cpp`
- [D3D12 renderer](https://github.com/crementif/botw-bettervr/blob/main/src/rendering/d3d12.cpp): `src/rendering/d3d12.cpp`
- [Render utilities](https://github.com/crementif/botw-bettervr/blob/main/src/utils/render_utils.h): `src/utils/render_utils.h`

### Game Hooks

- [Cemu hooks](https://github.com/crementif/botw-bettervr/blob/main/src/hooking/cemu_hooks.h): `src/hooking/cemu_hooks.h`
- [Roomscale control](https://github.com/crementif/botw-bettervr/blob/main/src/hooking/entity_controller.cpp): `src/hooking/entity_controller.cpp`
- [Camera control](https://github.com/crementif/botw-bettervr/blob/main/src/hooking/camera.cpp): `src/hooking/camera.cpp`
- [Weapon handling](https://github.com/crementif/botw-bettervr/blob/main/src/hooking/weapon.cpp): `src/hooking/weapon.cpp`
- [Bow handling](https://github.com/crementif/botw-bettervr/blob/main/src/hooking/bow.cpp): `src/hooking/bow.cpp`
- [Hands and arms](https://github.com/crementif/botw-bettervr/blob/main/src/hooking/skeleton.cpp): `src/hooking/skeleton.cpp`
- [Gameplay controls](https://github.com/crementif/botw-bettervr/blob/main/src/hooking/controls.cpp): `src/hooking/controls.cpp`

### Interface

- [Settings model](https://github.com/crementif/botw-bettervr/blob/main/src/utils/mod_settings.h): `src/utils/mod_settings.h`
- [In-game menu](https://github.com/crementif/botw-bettervr/blob/main/src/hooking/imgui_menus.cpp): `src/hooking/imgui_menus.cpp`
- [Debug drawing](https://github.com/crementif/botw-bettervr/blob/main/src/utils/debug_draw.cpp): `src/utils/debug_draw.cpp`

### Other components

- **Player**
- **Cemu**
- **OpenXR headset**

## Connections

- Player → Launcher: launches
- Launcher → Cemu: starts alongside
- Cemu → Vulkan layer: enables layer
- Vulkan layer → Frame renderer: intercepts frames
- Frame renderer → OpenXR headset: presents stereo
- Frame renderer → D3D12 renderer: uses interop
- D3D12 renderer → OpenXR headset: submits frames
- OpenXR headset → OpenXR session: provides tracking
- OpenXR session → Gameplay controls: supplies input
- Gameplay controls → Cemu hooks: drives gameplay
- Cemu hooks → Roomscale control: supports roomscale (evidence: `src/hooking/entity_controller.cpp`)
- Cemu hooks → Camera control: supports camera modes (evidence: `src/hooking/camera.cpp`)
- Cemu hooks → Weapon handling: supports wielding
- Cemu hooks → Bow handling: supports bow use (evidence: `src/hooking/bow.cpp`)
- Cemu hooks → Hands and arms: supports hands
- Player → In-game menu: opens controls
- In-game menu → Settings model: edits settings (evidence: `src/hooking/imgui_menus.cpp`)
- Roomscale control → Debug drawing: draws diagnostics (evidence: `src/hooking/entity_controller.cpp`)
- OpenXR session → Controller bindings: uses bindings
- Launcher → Launch support: uses launch support (evidence: `launcher/main.cpp`)
- Frame renderer → Vulkan interop: captures Vulkan images
- Frame renderer → Render utilities: uses render helpers (evidence: `src/rendering/renderer.cpp`)
