# nefarius/bthps3 architecture

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

- Interactive diagram: https://gitdiagram.com/nefarius/bthps3
- Repository: https://github.com/nefarius/bthps3

## Overview

BthPS3 is a Windows kernel-mode Bluetooth profile and host-radio filter driver suite for connecting PS3 peripherals. Its main runtime path extends the Windows Bluetooth stack with an L2CAP profile service, identifies incoming peripherals, and exposes HID control/interrupt channels through bus child devices. A separate lower filter patches and reroutes L2CAP traffic. The repository also provides a settings GUI and CLI, plus an installer. Relationships in the driver map rely mainly on the README’s architecture description; unsampled implementation details are not inferred.

Main entry points: [`BthPS3/Bluetooth.c`](https://github.com/nefarius/bthps3/blob/master/BthPS3/Bluetooth.c) (Profile driver), [`BthPS3/BusLogic.c`](https://github.com/nefarius/bthps3/blob/master/BthPS3/BusLogic.c) (Bus driver), [`BthPS3CfgUI/ProfileDriverSettingsViewModel.cs`](https://github.com/nefarius/bthps3/blob/master/BthPS3CfgUI/ProfileDriverSettingsViewModel.cs) (Settings GUI), [`BthPS3Installer/InstallScript.cs`](https://github.com/nefarius/bthps3/blob/master/BthPS3Installer/InstallScript.cs) (Driver installer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_profile["Profile and bus driver"]
  node_profile_driver["Profile driver<br/>[Bluetooth.c]"]
  node_l2cap_server["L2CAP service<br/>[L2CAP.Connect.c]"]
  node_l2cap_disconnect["L2CAP disconnect<br/>[L2CAP.Disconnect.c]"]
  node_l2cap_transfer["L2CAP transfer<br/>[L2CAP.Transfer.c]"]
  node_device_classify["Device classification<br/>[Device.c]"]
  node_bus_driver["Bus driver<br/>[BusLogic.c]"]
  node_bus_io["Child device I/O<br/>[BusLogic.IO.c]"]
  node_bus_state["Child device state<br/>[BusLogic.State.c]"]
end

subgraph group_filter["Radio filter driver"]
  node_radio_filter["Bluetooth radio filter<br/>[Filter.c]"]
  node_filter_device["Filter device control<br/>[Device.c]"]
  node_sideband["Sideband routing<br/>[Sideband.c]"]
  node_packet_queue["Packet queue<br/>[Queue.c]"]
end

subgraph group_config["Configuration tools"]
  node_shared_filter_api["Filter control API<br/>[FilterDriver.cs]"]
  node_bluetooth_helper["Radio availability<br/>[BluetoothHelper.cs]"]
  node_settings_ui["Settings GUI"]
  node_cli["Settings CLI<br/>[BthPS3Util.cpp]"]
end

subgraph group_setup["Installation"]
  node_installer["Driver installer<br/>[InstallScript.cs]"]
  node_install_actions["Install actions<br/>[CustomActions.cs]"]
  node_radio_transport["Radio transport detection<br/>[RadioTransport.cs]"]
end

node_windows_stack["Windows Bluetooth stack"]
node_ps3_devices(("PS3 peripherals"))
node_hid_children["HID channel children"]

node_windows_stack -->|"hosts service"| node_profile_driver
node_profile_driver -->|"provides service"| node_l2cap_server
node_profile_driver -->|"classifies devices"| node_device_classify
node_profile_driver -->|"exposes channels"| node_bus_driver
node_l2cap_server -.->|"disconnects"| node_l2cap_disconnect
node_l2cap_server -.->|"transfers data"| node_l2cap_transfer
node_ps3_devices -->|"connect over Bluetooth"| node_windows_stack
node_bus_driver -->|"creates child devices"| node_hid_children
node_bus_driver -.->|"handles I/O"| node_bus_io
node_bus_driver -.->|"tracks state"| node_bus_state
node_radio_filter -->|"extends host stack"| node_windows_stack
node_radio_filter -.->|"reroutes traffic"| node_sideband
node_sideband -.->|"queues packets"| node_packet_queue
node_shared_filter_api -->|"sends control IOCTLs"| node_filter_device
node_settings_ui -->|"controls patching"| node_shared_filter_api
node_settings_ui -->|"checks radio"| node_bluetooth_helper
node_settings_ui -->|"edits registry settings"| node_profile_driver
node_cli -.->|"configures filter"| node_shared_filter_api
node_installer -->|"configures actions"| node_install_actions
node_install_actions -->|"detects transport"| node_radio_transport
node_installer -->|"installs driver"| node_profile_driver
node_installer -->|"installs filter"| node_radio_filter

click node_profile_driver "https://github.com/nefarius/bthps3/blob/master/BthPS3/Bluetooth.c"
click node_l2cap_server "https://github.com/nefarius/bthps3/blob/master/BthPS3/L2CAP.Connect.c"
click node_l2cap_disconnect "https://github.com/nefarius/bthps3/blob/master/BthPS3/L2CAP.Disconnect.c"
click node_l2cap_transfer "https://github.com/nefarius/bthps3/blob/master/BthPS3/L2CAP.Transfer.c"
click node_device_classify "https://github.com/nefarius/bthps3/blob/master/BthPS3/Device.c"
click node_bus_driver "https://github.com/nefarius/bthps3/blob/master/BthPS3/BusLogic.c"
click node_bus_io "https://github.com/nefarius/bthps3/blob/master/BthPS3/BusLogic.IO.c"
click node_bus_state "https://github.com/nefarius/bthps3/blob/master/BthPS3/BusLogic.State.c"
click node_radio_filter "https://github.com/nefarius/bthps3/blob/master/BthPS3PSM/Filter.c"
click node_filter_device "https://github.com/nefarius/bthps3/blob/master/BthPS3PSM/Device.c"
click node_sideband "https://github.com/nefarius/bthps3/blob/master/BthPS3PSM/Sideband.c"
click node_packet_queue "https://github.com/nefarius/bthps3/blob/master/BthPS3PSM/Queue.c"
click node_shared_filter_api "https://github.com/nefarius/bthps3/blob/master/shared/FilterDriver.cs"
click node_bluetooth_helper "https://github.com/nefarius/bthps3/blob/master/shared/BluetoothHelper.cs"
click node_settings_ui "https://github.com/nefarius/bthps3/blob/master/BthPS3CfgUI/ProfileDriverSettingsViewModel.cs"
click node_cli "https://github.com/nefarius/bthps3/blob/master/BthPS3Util/BthPS3Util.cpp"
click node_installer "https://github.com/nefarius/bthps3/blob/master/BthPS3Installer/InstallScript.cs"
click node_install_actions "https://github.com/nefarius/bthps3/blob/master/BthPS3Installer/CustomActions.cs"
click node_radio_transport "https://github.com/nefarius/bthps3/blob/master/BthPS3Installer/RadioTransport.cs"

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_profile_driver,node_l2cap_server,node_l2cap_disconnect,node_l2cap_transfer,node_device_classify,node_bus_driver,node_bus_io,node_bus_state toneBlue
class node_radio_filter,node_filter_device,node_sideband,node_packet_queue toneAmber
class node_shared_filter_api,node_bluetooth_helper,node_settings_ui,node_cli toneMint
class node_installer,node_install_actions,node_radio_transport toneRose
class node_windows_stack,node_ps3_devices,node_hid_children toneIndigo
```

## Components

### Profile and bus driver

- [Profile driver](https://github.com/nefarius/bthps3/blob/master/BthPS3/Bluetooth.c): `BthPS3/Bluetooth.c`
- [L2CAP service](https://github.com/nefarius/bthps3/blob/master/BthPS3/L2CAP.Connect.c): `BthPS3/L2CAP.Connect.c`
- [L2CAP disconnect](https://github.com/nefarius/bthps3/blob/master/BthPS3/L2CAP.Disconnect.c): `BthPS3/L2CAP.Disconnect.c`
- [L2CAP transfer](https://github.com/nefarius/bthps3/blob/master/BthPS3/L2CAP.Transfer.c): `BthPS3/L2CAP.Transfer.c`
- [Device classification](https://github.com/nefarius/bthps3/blob/master/BthPS3/Device.c): `BthPS3/Device.c`
- [Bus driver](https://github.com/nefarius/bthps3/blob/master/BthPS3/BusLogic.c): `BthPS3/BusLogic.c`
- [Child device I/O](https://github.com/nefarius/bthps3/blob/master/BthPS3/BusLogic.IO.c): `BthPS3/BusLogic.IO.c`
- [Child device state](https://github.com/nefarius/bthps3/blob/master/BthPS3/BusLogic.State.c): `BthPS3/BusLogic.State.c`

### Radio filter driver

- [Bluetooth radio filter](https://github.com/nefarius/bthps3/blob/master/BthPS3PSM/Filter.c): `BthPS3PSM/Filter.c`
- [Filter device control](https://github.com/nefarius/bthps3/blob/master/BthPS3PSM/Device.c): `BthPS3PSM/Device.c`
- [Sideband routing](https://github.com/nefarius/bthps3/blob/master/BthPS3PSM/Sideband.c): `BthPS3PSM/Sideband.c`
- [Packet queue](https://github.com/nefarius/bthps3/blob/master/BthPS3PSM/Queue.c): `BthPS3PSM/Queue.c`

### Configuration tools

- [Filter control API](https://github.com/nefarius/bthps3/blob/master/shared/FilterDriver.cs): `shared/FilterDriver.cs`
- [Radio availability](https://github.com/nefarius/bthps3/blob/master/shared/BluetoothHelper.cs): `shared/BluetoothHelper.cs`
- [Settings GUI](https://github.com/nefarius/bthps3/blob/master/BthPS3CfgUI/ProfileDriverSettingsViewModel.cs): `BthPS3CfgUI/ProfileDriverSettingsViewModel.cs`
- [Settings CLI](https://github.com/nefarius/bthps3/blob/master/BthPS3Util/BthPS3Util.cpp): `BthPS3Util/BthPS3Util.cpp`

### Installation

- [Driver installer](https://github.com/nefarius/bthps3/blob/master/BthPS3Installer/InstallScript.cs): `BthPS3Installer/InstallScript.cs`
- [Install actions](https://github.com/nefarius/bthps3/blob/master/BthPS3Installer/CustomActions.cs): `BthPS3Installer/CustomActions.cs`
- [Radio transport detection](https://github.com/nefarius/bthps3/blob/master/BthPS3Installer/RadioTransport.cs): `BthPS3Installer/RadioTransport.cs`

### Other components

- **Windows Bluetooth stack**
- **PS3 peripherals**
- **HID channel children**

## Connections

- Windows Bluetooth stack → Profile driver: hosts service
- Profile driver → L2CAP service: provides service
- Profile driver → Device classification: classifies devices
- Profile driver → Bus driver: exposes channels
- L2CAP service → L2CAP disconnect: disconnects
- L2CAP service → L2CAP transfer: transfers data
- PS3 peripherals → Windows Bluetooth stack: connect over Bluetooth
- Bus driver → HID channel children: creates child devices
- Bus driver → Child device I/O: handles I/O
- Bus driver → Child device state: tracks state
- Bluetooth radio filter → Windows Bluetooth stack: extends host stack
- Bluetooth radio filter → Sideband routing: reroutes traffic
- Sideband routing → Packet queue: queues packets
- Filter control API → Filter device control: sends control IOCTLs (evidence: `shared/FilterDriver.cs`)
- Settings GUI → Filter control API: controls patching (evidence: `BthPS3CfgUI/ProfileDriverSettingsViewModel.cs`)
- Settings GUI → Radio availability: checks radio (evidence: `BthPS3CfgUI/ProfileDriverSettingsViewModel.cs`)
- Settings GUI → Profile driver: edits registry settings (evidence: `BthPS3CfgUI/ProfileDriverSettingsViewModel.cs`)
- Settings CLI → Filter control API: configures filter
- Driver installer → Install actions: configures actions (evidence: `BthPS3Installer/InstallScript.cs`)
- Install actions → Radio transport detection: detects transport (evidence: `BthPS3Installer/CustomActions.cs`)
- Driver installer → Profile driver: installs driver (evidence: `BthPS3Installer/InstallScript.cs`)
- Driver installer → Bluetooth radio filter: installs filter (evidence: `BthPS3Installer/InstallScript.cs`)
