(Thought) Virtual BT Adapter?

Originally posted by mbc07

So, I have a DualShock 3 controller and I'm aware of its non-standard Bluetooth communication which makes it impossible to use it wireless without dedicating an entire BT Adapter just for it (e.g. with ScpToolkit or the new AirBender). But digging a little in both Dolphin Emulator source code and also in ViGEm and AirBender source code, something came into my mind and I need to ask if that's feasible (disclaimer, it's not actually a feature request, I'm just curious if that's possible).

When running Wii software on Dolphin Emulator there's a "bluetooth passthrough" mode where you override your BT Adapter driver with libusb and the emulator then exposes this adapter directly to the emulated Wii software, which then handles all BT communication by itself (connect/pair to Wiimotes and its accesories, etc), as it would do if running on a real Wii (AFAICT all Wii Games have their own BT Stack interfacing with the BT adapter of the console directly, and that also extends to homebrews).

From what I can see, the way BT Passthrough works in Dolphin is very similar to what ScpToolkit (and also AirBender) does to communicate with PS3 Controllers, by sending/receiving HCI commands directly to/from the BT Adapter. With that in mind and given how ViGEm essentially handles virtual devices through drivers, would it be possible to implement a "virtual" BT adapter where the standard Windows Bluetooth Stack could be loaded and used while still having AirBender controlling the real BT adapter by itself? Kinda like a firewall:

Real BT Adapter (your physical adapter)
AirBender driver (uses libusb for RAW communication?)
Virtual BT Adapter (spawned by AirBender, probably through a virtual Bus like ViGEm)
Standard Windows BT drivers (think it's communicating to a real adapter)

AirBender would analyse and process all "packets" (in this case, HCI commands?), if they're originating from or are destined to a PS3 Controller, it wouldn't forward those to the Virtual BT adapter, rather handling these packets by itself (e.g. extracting and sending relevant data to Shibari/ViGEm). Everything else not going to / coming from a PS3 Controller would get "passed through" to the Virtual BT Adapter where it would be handled by the Windows BT Stack.

The goal of all of this would be allowing simultaneous usage of PS3 Controllers and other Bluetooth peripherals, which were not possible with ScpToolkit and (at least on current state) it's not possible with AirBender either...

Originally posted by nefarius

That actually is a damn good idea 😲 Not with AirBender though since it's based on UMDF which can't do advanced kernel stuff but we've already developed a successor to AirBender anyways 😉

Only downside popping up immediately; I doubt a true *simultaneous* operation would ever be possible because we then basically have two host controller drivers active and one has to take the lead. But it would be a nicer alternative to swapping the entire device driver every time you want to go back to using your wireless headphones.