summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/FrameTools.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/DolphinWX/FrameTools.cpp')
-rw-r--r--Source/Core/DolphinWX/FrameTools.cpp56
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);