summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/MainWindow.cpp
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2021-04-12 12:49:29 +0200
committerLéo Lam <leo@leolam.fr>2021-04-12 18:16:56 +0200
commit336518049d0c1d63dbdfd9dcd55d1e84fcb5ba21 (patch)
tree76d8b451af0692be64f25d3c051a59001b5d2d9c /Source/Core/DolphinQt/MainWindow.cpp
parent136f59b434e8bdaf678f5b1888ba641e7031c568 (diff)
WiiUtils: Add helper functions to get emulated/real Bluetooth device
This adds a function to get the emulated or real Bluetooth device for an active emulation instance. This lets us deduplicate all the `ios->GetDeviceByName("/dev/usb/oh1/57e/305")` calls that are currently scattered in the codebase and ensures Bluetooth passthrough is being handled correctly. This also fixes the broken check in WiimoteCommon::UpdateSource. There was a confusion between "emulated Bluetooth" (as opposed to "real Bluetooth" aka Bluetooth passthrough) and "emulated Wiimote".
Diffstat (limited to 'Source/Core/DolphinQt/MainWindow.cpp')
-rw-r--r--Source/Core/DolphinQt/MainWindow.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp
index afe1c2a07b..3261a4b740 100644
--- a/Source/Core/DolphinQt/MainWindow.cpp
+++ b/Source/Core/DolphinQt/MainWindow.cpp
@@ -57,6 +57,7 @@
#include "Core/NetPlayProto.h"
#include "Core/NetPlayServer.h"
#include "Core/State.h"
+#include "Core/WiiUtils.h"
#include "DiscIO/NANDImporter.h"
@@ -1723,12 +1724,8 @@ void MainWindow::ShowTASInput()
void MainWindow::OnConnectWiiRemote(int id)
{
- const auto ios = IOS::HLE::GetIOS();
- if (!ios || SConfig::GetInstance().m_bt_passthrough_enabled)
- return;
Core::RunAsCPUThread([&] {
- if (const auto bt = std::static_pointer_cast<IOS::HLE::BluetoothEmuDevice>(
- ios->GetDeviceByName("/dev/usb/oh1/57e/305")))
+ if (const auto bt = WiiUtils::GetBluetoothEmuDevice())
{
const auto wm = bt->AccessWiimoteByIndex(id);
wm->Activate(!wm->IsConnected());