# bnuuysolutions/psvr2toolkit architecture

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

- Interactive diagram: https://gitdiagram.com/bnuuysolutions/psvr2toolkit
- Repository: https://github.com/bnuuysolutions/psvr2toolkit
- Video tour (about a minute): https://gitdiagram.com/bnuuysolutions/psvr2toolkit/video

## Overview

PlayStation VR2 Toolkit modifies the official PSVR2 PC driver and exposes its added capabilities through a C API and IPC. The principal flow is driver-side device hooks and feature handlers exchanging gaze, haptics, trigger and camera-related state through shared managers, then making capabilities available to applications. The README identifies eye tracking/calibration, camera feed, IPD assistance, play-area and tracking improvements, passthrough, night mode and refresh-rate switching as product capabilities. Unsampled feature implementations are represented only where the README supports them; source-index evidence supports the cited internal links.

Main entry points: [`projects/libcustomshare/custom_share_manager.cpp`](https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/libcustomshare/custom_share_manager.cpp) (Custom share manager), [`projects/psvr2_toolkit_capi_loader/psvr2tk_capi_loader.cpp`](https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_toolkit_capi_loader/psvr2tk_capi_loader.cpp) (C API loader), [`projects/psvr2_openvr_driver_ex/usb_thread_gaze.cpp`](https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_openvr_driver_ex/usb_thread_gaze.cpp) (Gaze capture), [`projects/psvr2_toolkit_capi/psvr2tk_capi.cpp`](https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_toolkit_capi/psvr2tk_capi.cpp) (C API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_driver["Driver extensions"]
  node_loader["Driver loader"]
  node_hooks["Driver hooks"]
  node_gaze["Gaze capture"]
  node_controllers["Controller handling"]
  node_triggers["Adaptive triggers"]
  node_features["Other VR features"]
end

subgraph group_sharing["State and IPC"]
  node_share["Driver sharing<br/>[share_manager.cpp]"]
  node_customshare["Custom share manager"]
  node_crossipc["Cross-platform IPC<br/>[cross_ipc.cpp]"]
end

subgraph group_api["Developer API"]
  node_capi["C API<br/>[psvr2tk_capi.cpp]"]
  node_loaderapi["C API loader"]
  node_legacy["Legacy IPC server<br/>[main.cpp]"]
end

subgraph group_apps["User applications"]
  node_app["Toolkit app<br/>[main.cpp]"]
  node_testapp["C API test UI<br/>[main.cpp]"]
end

node_user(("Toolkit user"))
node_official["Official HMD driver"]
node_headset["PSVR2 headset"]
node_client(("API client"))

node_user -.->|"uses"| node_app
node_loader -.->|"loads"| node_official
node_hooks -->|"installs hooks"| node_loader
node_hooks -->|"starts thread"| node_gaze
node_headset -.->|"provides gaze"| node_gaze
node_gaze -.->|"publishes state"| node_share
node_controllers -->|"reads PCM"| node_customshare
node_controllers -.->|"sends reports"| node_headset
node_triggers -->|"uses sharing"| node_customshare
node_share -->|"uses IPC"| node_crossipc
node_customshare -->|"uses IPC"| node_crossipc
node_capi -->|"accesses shared data"| node_customshare
node_client -.->|"loads API"| node_loaderapi
node_loaderapi -->|"loads functions"| node_capi
node_legacy -->|"initializes API"| node_loaderapi
node_legacy -.->|"serves IPC"| node_client
node_testapp -->|"initializes API"| node_loaderapi
node_testapp -.->|"uses capabilities"| node_capi
node_user -.->|"uses improvements"| node_features
node_features -.->|"enhances operation"| node_headset

click node_loader "https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_openvr_driver_ex/hmd_driver_loader.h"
click node_hooks "https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_openvr_driver_ex/driver_hooks/caesar_manager_hooks.cpp"
click node_gaze "https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_openvr_driver_ex/usb_thread_gaze.cpp"
click node_controllers "https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_openvr_driver_ex/sense_controller.cpp"
click node_triggers "https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_openvr_driver_ex/trigger_effect_manager.cpp"
click node_features "https://github.com/bnuuysolutions/psvr2toolkit/tree/main/projects/psvr2_openvr_driver_ex"
click node_share "https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_openvr_driver_ex/driver_interface/share_manager.cpp"
click node_customshare "https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/libcustomshare/custom_share_manager.cpp"
click node_crossipc "https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/libcrossipc/cross_ipc.cpp"
click node_capi "https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_toolkit_capi/psvr2tk_capi.cpp"
click node_loaderapi "https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_toolkit_capi_loader/psvr2tk_capi_loader.cpp"
click node_legacy "https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_toolkit_legacy_ipc_server/main.cpp"
click node_app "https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_toolkit_app/main.cpp"
click node_testapp "https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_toolkit_capi_test/main.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_loader,node_hooks,node_gaze,node_controllers,node_triggers,node_features,node_user,node_client toneBlue
class node_share,node_customshare,node_crossipc toneAmber
class node_capi,node_loaderapi,node_legacy toneMint
class node_app,node_testapp toneRose
class node_official,node_headset toneIndigo
```

## Components

### Driver extensions

- [Driver loader](https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_openvr_driver_ex/hmd_driver_loader.h): `projects/psvr2_openvr_driver_ex/hmd_driver_loader.h`
- [Driver hooks](https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_openvr_driver_ex/driver_hooks/caesar_manager_hooks.cpp): `projects/psvr2_openvr_driver_ex/driver_hooks/caesar_manager_hooks.cpp`
- [Gaze capture](https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_openvr_driver_ex/usb_thread_gaze.cpp): `projects/psvr2_openvr_driver_ex/usb_thread_gaze.cpp`
- [Controller handling](https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_openvr_driver_ex/sense_controller.cpp): `projects/psvr2_openvr_driver_ex/sense_controller.cpp`
- [Adaptive triggers](https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_openvr_driver_ex/trigger_effect_manager.cpp): `projects/psvr2_openvr_driver_ex/trigger_effect_manager.cpp`
- [Other VR features](https://github.com/bnuuysolutions/psvr2toolkit/tree/main/projects/psvr2_openvr_driver_ex): `projects/psvr2_openvr_driver_ex`

### State and IPC

- [Driver sharing](https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_openvr_driver_ex/driver_interface/share_manager.cpp): `projects/psvr2_openvr_driver_ex/driver_interface/share_manager.cpp`
- [Custom share manager](https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/libcustomshare/custom_share_manager.cpp): `projects/libcustomshare/custom_share_manager.cpp`
- [Cross-platform IPC](https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/libcrossipc/cross_ipc.cpp): `projects/libcrossipc/cross_ipc.cpp`

### Developer API

- [C API](https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_toolkit_capi/psvr2tk_capi.cpp): `projects/psvr2_toolkit_capi/psvr2tk_capi.cpp`
- [C API loader](https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_toolkit_capi_loader/psvr2tk_capi_loader.cpp): `projects/psvr2_toolkit_capi_loader/psvr2tk_capi_loader.cpp`
- [Legacy IPC server](https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_toolkit_legacy_ipc_server/main.cpp): `projects/psvr2_toolkit_legacy_ipc_server/main.cpp`

### User applications

- [Toolkit app](https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_toolkit_app/main.cpp): `projects/psvr2_toolkit_app/main.cpp`
- [C API test UI](https://github.com/bnuuysolutions/psvr2toolkit/blob/main/projects/psvr2_toolkit_capi_test/main.cpp): `projects/psvr2_toolkit_capi_test/main.cpp`

### Other components

- **Toolkit user**
- **Official HMD driver**
- **PSVR2 headset**
- **API client**

## Connections

- Toolkit user → Toolkit app: uses
- Driver loader → Official HMD driver: loads
- Driver hooks → Driver loader: installs hooks (evidence: `projects/psvr2_openvr_driver_ex/driver_hooks/caesar_manager_hooks.cpp`)
- Driver hooks → Gaze capture: starts thread (evidence: `projects/psvr2_openvr_driver_ex/driver_hooks/caesar_manager_hooks.cpp`)
- PSVR2 headset → Gaze capture: provides gaze
- Gaze capture → Driver sharing: publishes state
- Controller handling → Custom share manager: reads PCM (evidence: `projects/psvr2_openvr_driver_ex/sense_controller.cpp`)
- Controller handling → PSVR2 headset: sends reports
- Adaptive triggers → Custom share manager: uses sharing (evidence: `projects/psvr2_openvr_driver_ex/trigger_effect_manager.cpp`)
- Driver sharing → Cross-platform IPC: uses IPC (evidence: `projects/psvr2_openvr_driver_ex/driver_interface/share_manager.cpp`)
- Custom share manager → Cross-platform IPC: uses IPC
- C API → Custom share manager: accesses shared data (evidence: `projects/psvr2_toolkit_capi/psvr2tk_capi.cpp`)
- API client → C API loader: loads API
- C API loader → C API: loads functions
- Legacy IPC server → C API loader: initializes API (evidence: `projects/psvr2_toolkit_legacy_ipc_server/main.cpp`)
- Legacy IPC server → API client: serves IPC
- C API test UI → C API loader: initializes API (evidence: `projects/psvr2_toolkit_capi_test/main.cpp`)
- C API test UI → C API: uses capabilities
- Toolkit user → Other VR features: uses improvements
- Other VR features → PSVR2 headset: enhances operation
