diff options
| author | Léo Lam <leo@innovatetechnologi.es> | 2017-07-19 15:55:45 +0800 |
|---|---|---|
| committer | Léo Lam <leo@innovatetechnologi.es> | 2017-07-23 15:47:32 +0800 |
| commit | ee868e2362d09427d6416c52f37dff85bf25a6e1 (patch) | |
| tree | b19c3c92a6010b8542c601ec4704f2ed4ec2bce8 /Source/Core/DolphinWX/FrameTools.cpp | |
| parent | 9237137c3a23938ab8c3fd98d1864a5cf8f0af5a (diff) | |
Move the Wiimote connect code out of Host
I don't know who thought it would be a good idea to put the Wiimote
connect code as part of the Host interface, and have that called
from both the UI code and the core. And then hack around it by having
"force connect" events whenever Host_ConnectWiimote is called
from the core...
Diffstat (limited to 'Source/Core/DolphinWX/FrameTools.cpp')
| -rw-r--r-- | Source/Core/DolphinWX/FrameTools.cpp | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index d633561cfd..e448d2329c 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -1406,27 +1406,6 @@ void CFrame::OnFifoPlayer(wxCommandEvent& WXUNUSED(event)) } } -void CFrame::ConnectWiimote(int wm_idx, bool connect) -{ - if (Core::IsRunning() && SConfig::GetInstance().bWii && - !SConfig::GetInstance().m_bt_passthrough_enabled) - { - Core::RunAsCPUThread([&] { - const auto ios = IOS::HLE::GetIOS(); - if (!ios) - return; - - const auto bt = std::static_pointer_cast<IOS::HLE::Device::BluetoothEmu>( - ios->GetDeviceByName("/dev/usb/oh1/57e/305")); - if (bt) - bt->AccessWiiMote(wm_idx | 0x100)->Activate(connect); - const char* message = connect ? "Wii Remote %i connected" : "Wii Remote %i disconnected"; - Core::DisplayMessage(StringFromFormat(message, wm_idx + 1), 3000); - Host_UpdateMainFrame(); - }); - } -} - void CFrame::OnConnectWiimote(wxCommandEvent& event) { const auto ios = IOS::HLE::GetIOS(); @@ -1435,9 +1414,9 @@ void CFrame::OnConnectWiimote(wxCommandEvent& event) Core::RunAsCPUThread([&] { const auto bt = std::static_pointer_cast<IOS::HLE::Device::BluetoothEmu>( ios->GetDeviceByName("/dev/usb/oh1/57e/305")); - const bool is_connected = - bt && bt->AccessWiiMote((event.GetId() - IDM_CONNECT_WIIMOTE1) | 0x100)->IsConnected(); - ConnectWiimote(event.GetId() - IDM_CONNECT_WIIMOTE1, !is_connected); + const unsigned int wiimote_index = event.GetId() - IDM_CONNECT_WIIMOTE1; + const bool is_connected = bt && bt->AccessWiiMote(wiimote_index | 0x100)->IsConnected(); + Wiimote::Connect(wiimote_index, !is_connected); }); } |
