DolphinWX: In Host_ConnectWiimote(), instead of calling CFrame::ConnectWiimote() directly, dispatch an event that will call it for us in the GUI thread.

This eliminates a possible stutter/short freeze that can happen during PowerPC::Pause().
This commit is contained in:
Admiral H. Curtiss 2015-07-16 02:00:56 +02:00
parent 5594b107eb
commit 935292c6fc
3 changed files with 38 additions and 1 deletions

View File

@ -776,6 +776,22 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
case IDM_STOPPED:
OnStopped();
break;
case IDM_FORCE_CONNECT_WIIMOTE1:
case IDM_FORCE_CONNECT_WIIMOTE2:
case IDM_FORCE_CONNECT_WIIMOTE3:
case IDM_FORCE_CONNECT_WIIMOTE4:
case IDM_FORCE_CONNECT_BALANCEBOARD:
ConnectWiimote(event.GetId() - IDM_FORCE_CONNECT_WIIMOTE1, true);
break;
case IDM_FORCE_DISCONNECT_WIIMOTE1:
case IDM_FORCE_DISCONNECT_WIIMOTE2:
case IDM_FORCE_DISCONNECT_WIIMOTE3:
case IDM_FORCE_DISCONNECT_WIIMOTE4:
case IDM_FORCE_DISCONNECT_BALANCEBOARD:
ConnectWiimote(event.GetId() - IDM_FORCE_DISCONNECT_WIIMOTE1, false);
break;
}
}

View File

@ -298,6 +298,18 @@ enum
IDM_HOST_MESSAGE,
IDM_FULLSCREEN_REQUEST,
// Used for Host_ConnectWiimote()
IDM_FORCE_CONNECT_WIIMOTE1,
IDM_FORCE_CONNECT_WIIMOTE2,
IDM_FORCE_CONNECT_WIIMOTE3,
IDM_FORCE_CONNECT_WIIMOTE4,
IDM_FORCE_CONNECT_BALANCEBOARD,
IDM_FORCE_DISCONNECT_WIIMOTE1,
IDM_FORCE_DISCONNECT_WIIMOTE2,
IDM_FORCE_DISCONNECT_WIIMOTE3,
IDM_FORCE_DISCONNECT_WIIMOTE4,
IDM_FORCE_DISCONNECT_BALANCEBOARD,
IDM_MPANEL, ID_STATUSBAR,
IDM_FREELOOK_DECREASE_SPEED,

View File

@ -540,7 +540,16 @@ bool Host_RendererIsFullscreen()
void Host_ConnectWiimote(int wm_idx, bool connect)
{
CFrame::ConnectWiimote(wm_idx, connect);
if (connect)
{
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_FORCE_CONNECT_WIIMOTE1 + wm_idx);
main_frame->GetEventHandler()->AddPendingEvent(event);
}
else
{
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_FORCE_DISCONNECT_WIIMOTE1 + wm_idx);
main_frame->GetEventHandler()->AddPendingEvent(event);
}
}
void Host_ShowVideoConfig(void* parent, const std::string& backend_name,