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...
This commit is contained in:
Léo Lam
2017-07-19 15:55:45 +08:00
parent 9237137c3a
commit ee868e2362
14 changed files with 42 additions and 114 deletions

View File

@ -5,7 +5,6 @@
#include <OptionParser.h>
#include <cstdio>
#include <cstring>
#include <mutex>
#include <string>
#include <utility>
#include <wx/app.h>
@ -70,8 +69,6 @@ std::string wxStringTranslator(const char*);
CFrame* main_frame = nullptr;
static std::mutex s_init_mutex;
bool DolphinApp::Initialize(int& c, wxChar** v)
{
#if defined HAVE_X11 && HAVE_X11
@ -122,8 +119,6 @@ bool DolphinApp::OnInit()
ParseCommandLine();
std::lock_guard<std::mutex> lk(s_init_mutex);
UICommon::SetUserDirectory(m_user_path.ToStdString());
UICommon::CreateDirectories();
InitLanguageSupport(); // The language setting is loaded from the user directory
@ -473,21 +468,6 @@ bool Host_RendererIsFullscreen()
return main_frame->RendererIsFullscreen();
}
void Host_ConnectWiimote(int wm_idx, bool connect)
{
std::lock_guard<std::mutex> lk(s_init_mutex);
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)
{
wxWindow* const parent_window = static_cast<wxWindow*>(parent);