diff options
| author | JosJuice <josjuice@gmail.com> | 2017-07-22 12:42:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-07-22 12:42:55 +0200 |
| commit | 57affaff22c1beeb08b76d998d72fb6f44376a47 (patch) | |
| tree | 8d9e11ce3a2732b37c5c1bd24e13572a39e045df /Source/Core/DolphinWX/FrameTools.cpp | |
| parent | 2f0bec93cb3eb02f159461f13557bde4bd2771bb (diff) | |
| parent | 5729ac0fc685d42035dfa1c850672822a247851c (diff) | |
Merge pull request #5803 from leoetlino/pause-and-lock
Replace balanced Core::PauseAndLock calls with RunAsCPUThread
Diffstat (limited to 'Source/Core/DolphinWX/FrameTools.cpp')
| -rw-r--r-- | Source/Core/DolphinWX/FrameTools.cpp | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index a403118000..d633561cfd 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -1411,19 +1411,19 @@ void CFrame::ConnectWiimote(int wm_idx, bool connect) if (Core::IsRunning() && SConfig::GetInstance().bWii && !SConfig::GetInstance().m_bt_passthrough_enabled) { - bool was_unpaused = Core::PauseAndLock(true); - const auto ios = IOS::HLE::GetIOS(); - if (!ios) - return; + 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(); - Core::PauseAndLock(false, was_unpaused); + 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(); + }); } } @@ -1432,13 +1432,13 @@ void CFrame::OnConnectWiimote(wxCommandEvent& event) const auto ios = IOS::HLE::GetIOS(); if (!ios || SConfig::GetInstance().m_bt_passthrough_enabled) return; - bool was_unpaused = Core::PauseAndLock(true); - 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); - Core::PauseAndLock(false, was_unpaused); + 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); + }); } // Toggle fullscreen. In Windows the fullscreen mode is accomplished by expanding the m_panel to @@ -1603,15 +1603,15 @@ void CFrame::UpdateGUI() GetMenuBar()->FindItem(IDM_CONNECT_BALANCEBOARD)->Enable(ShouldEnableWiimotes); if (ShouldEnableWiimotes) { - bool was_unpaused = Core::PauseAndLock(true); - GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Check(bt->AccessWiiMote(0x0100)->IsConnected()); - GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE2)->Check(bt->AccessWiiMote(0x0101)->IsConnected()); - GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)->Check(bt->AccessWiiMote(0x0102)->IsConnected()); - GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->Check(bt->AccessWiiMote(0x0103)->IsConnected()); - GetMenuBar() - ->FindItem(IDM_CONNECT_BALANCEBOARD) - ->Check(bt->AccessWiiMote(0x0104)->IsConnected()); - Core::PauseAndLock(false, was_unpaused); + Core::RunAsCPUThread([&] { + GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Check(bt->AccessWiiMote(0x0100)->IsConnected()); + GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE2)->Check(bt->AccessWiiMote(0x0101)->IsConnected()); + GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE3)->Check(bt->AccessWiiMote(0x0102)->IsConnected()); + GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE4)->Check(bt->AccessWiiMote(0x0103)->IsConnected()); + GetMenuBar() + ->FindItem(IDM_CONNECT_BALANCEBOARD) + ->Check(bt->AccessWiiMote(0x0104)->IsConnected()); + }); } GetMenuBar()->FindItem(IDM_RECORD_READ_ONLY)->Enable(Running || Paused); |
