From c59409b46a00530ad6805f37aaf0adbe1baa5b25 Mon Sep 17 00:00:00 2001 From: snzgoo Date: Mon, 26 Apr 2010 17:51:32 +0000 Subject: [PATCH] Introducing WM_DEVICECHANGE win32callback. No need to press the "refresh wiimotes" button on pair up anymore, checking the extended pair up box(still experimental) allows u to pair and hook up the wiimote while being ingame. You still need to do the ALT+F5/F6/F7/F8 connect, but you wont need to press the pair up button + refresh button anymore, feel free to test it, its not perfect yes. Just press 1+2 on your Wiimote to pair it up ingame(you need to check the extended pair up box for that feature). PS I hope I didnt break nonwin32 builds, I gave my best however. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5413 8ced0084-cf51-0410-be5f-012b33b47a6e --- Externals/WiiUse/Inc/wiiuse.h | 4 + Source/Plugins/Plugin_Wiimote/Src/Config.cpp | 2 + Source/Plugins/Plugin_Wiimote/Src/Config.h | 2 +- .../Plugin_Wiimote/Src/ConfigBasicDlg.cpp | 34 +++- .../Plugin_Wiimote/Src/ConfigBasicDlg.h | 3 + Source/Plugins/Plugin_Wiimote/Src/main.cpp | 24 ++- Source/Plugins/Plugin_Wiimote/Src/main.h | 1 + .../Plugin_Wiimote/Src/wiimote_real.cpp | 177 +++++++++++++++++- .../Plugins/Plugin_Wiimote/Src/wiimote_real.h | 9 + 9 files changed, 238 insertions(+), 18 deletions(-) diff --git a/Externals/WiiUse/Inc/wiiuse.h b/Externals/WiiUse/Inc/wiiuse.h index 8b46c900f2..42e57f08c8 100644 --- a/Externals/WiiUse/Inc/wiiuse.h +++ b/Externals/WiiUse/Inc/wiiuse.h @@ -628,6 +628,10 @@ WIIUSE_EXPORT extern void wiiuse_set_accel_threshold(struct wiimote_t* wm, int t WIIUSE_EXPORT extern int wiiuse_find(struct wiimote_t** wm, int max_wiimotes, int timeout); WIIUSE_EXPORT extern int wiiuse_connect(struct wiimote_t** wm, int wiimotes); WIIUSE_EXPORT extern void wiiuse_disconnect(struct wiimote_t* wm); +#ifdef WIN32 +WIIUSE_EXPORT extern int wiiuse_check_system_notification(unsigned int nMsg, WPARAM wParam, LPARAM lParam); +WIIUSE_EXPORT extern int wiiuse_register_system_notification(HWND hwnd); +#endif /* events.c */ WIIUSE_EXPORT extern int wiiuse_poll(struct wiimote_t** wm, int wiimotes); diff --git a/Source/Plugins/Plugin_Wiimote/Src/Config.cpp b/Source/Plugins/Plugin_Wiimote/Src/Config.cpp index 4fd633884c..9bbb8fce0f 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/Config.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/Config.cpp @@ -265,6 +265,7 @@ void Config::Load() // Real Wiimote iniFile.Get("Real", "UpdateStatus", &bUpdateRealWiimote, true); iniFile.Get("Real", "Unpair", &bUnpairRealWiimote, false); + iniFile.Get("Real", "Autopair", &bPairRealWiimote, false); iniFile.Get("Real", "AccNeutralX", &iAccNeutralX, 0); iniFile.Get("Real", "AccNeutralY", &iAccNeutralY, 0); iniFile.Get("Real", "AccNeutralZ", &iAccNeutralZ, 0); @@ -390,6 +391,7 @@ void Config::Save() iniFile.Set("Real", "UpdateStatus", bUpdateRealWiimote); iniFile.Set("Real", "Unpair", bUnpairRealWiimote); + iniFile.Set("Real", "Autopair", bPairRealWiimote); iniFile.Set("Real", "AccNeutralX", iAccNeutralX); iniFile.Set("Real", "AccNeutralY", iAccNeutralY); iniFile.Set("Real", "AccNeutralZ", iAccNeutralZ); diff --git a/Source/Plugins/Plugin_Wiimote/Src/Config.h b/Source/Plugins/Plugin_Wiimote/Src/Config.h index 46952a6d1b..85f0072907 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/Config.h +++ b/Source/Plugins/Plugin_Wiimote/Src/Config.h @@ -33,7 +33,7 @@ struct Config int CurrentPage; // Real Wiimote - bool bUpdateRealWiimote, bUnpairRealWiimote; + bool bUpdateRealWiimote, bUnpairRealWiimote, bPairRealWiimote; int bNumberRealWiimotes, bNumberEmuWiimotes; int iIRLeft, iIRTop, iIRWidth, iIRHeight, iIRLevel; int iAccNeutralX, iAccNeutralY, iAccNeutralZ; diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.cpp b/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.cpp index a47bbafcb4..0989882b5a 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.cpp @@ -42,6 +42,7 @@ BEGIN_EVENT_TABLE(WiimoteBasicConfigDialog,wxDialog) EVT_CHECKBOX(IDC_MOTIONPLUSCONNECTED, WiimoteBasicConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(IDC_WIIAUTORECONNECT, WiimoteBasicConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(IDC_WIIAUTOUNPAIR, WiimoteBasicConfigDialog::GeneralSettingsChanged) + EVT_CHECKBOX(IDC_WIIAUTOPAIR, WiimoteBasicConfigDialog::GeneralSettingsChanged) EVT_CHOICE(IDC_EXTCONNECTED, WiimoteBasicConfigDialog::GeneralSettingsChanged) //UDPWii @@ -120,15 +121,8 @@ void WiimoteBasicConfigDialog::ButtonClick(wxCommandEvent& event) case IDB_PAIRUP_REAL: if (g_EmulatorState != PLUGIN_EMUSTATE_PLAY) { - m_PairUpRealWiimote[m_Page]->Enable(false); - if (WiiMoteReal::WiimotePairUp(false) > 0) - { // Only temporay solution TODO: 2nd step: threaded. - // sleep would be required (but not best way to solve that cuz 3000ms~ would be needed, which is not convenient),cuz BT device is not ready yet when calling DoRefreshReal() - DoRefreshReal(); - } - m_PairUpRealWiimote[m_Page]->Enable(true); + WiiMoteReal::g_StartAutopairThread.Set(); } - UpdateGUI(); break; #endif case IDB_REFRESH_REAL: @@ -206,6 +200,8 @@ void WiimoteBasicConfigDialog::CreateGUIControls() m_WiiAutoReconnect[i]->SetToolTip(wxT("This makes dolphin automatically reconnect a wiimote when it has being disconnected.\nThis will cause problems when 2 controllers are connected for a 1 player game.")); m_WiiAutoUnpair[i] = new wxCheckBox(m_Controller[i], IDC_WIIAUTOUNPAIR, wxT("Unpair Wiimote on close")); m_WiiAutoUnpair[i]->SetToolTip(wxT("This makes dolphin automatically unpair a wiimote when dolphin is about to be closed.")); + m_WiiExtendedPairUp[i] = new wxCheckBox(m_Controller[i], IDC_WIIAUTOPAIR, wxT("Extended PairUp/Connect")); + m_WiiExtendedPairUp[i]->SetToolTip(wxT("This makes dolphin automatically pair up and connect Wiimotes on pressing 1+2 on your Wiimote.")); #ifndef _WIN32 m_WiiAutoUnpair[i]->Enable(false); #endif @@ -258,6 +254,7 @@ void WiimoteBasicConfigDialog::CreateGUIControls() m_SizeRealAuto[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Automatic")); m_SizeRealAuto[i]->Add(m_WiiAutoReconnect[i], 0, wxEXPAND | (wxDOWN | wxTOP), 5); m_SizeRealAuto[i]->Add(m_WiiAutoUnpair[i], 0, wxEXPAND | (wxDOWN | wxTOP), 5); + m_SizeRealAuto[i]->Add(m_WiiExtendedPairUp[i], 0, wxEXPAND | (wxDOWN | wxTOP), 5); m_SizeReal[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Real Wiimote")); m_SizeReal[i]->Add(m_PairUpRealWiimote[i], 0, wxEXPAND | wxALL, 5); @@ -362,6 +359,19 @@ void WiimoteBasicConfigDialog::DoRefreshReal() WiiMoteReal::Initialize(); } + +void WiimoteBasicConfigDialog::UpdateBasicConfigDialog(bool state) { + if (m_BasicConfigFrame != NULL) { + if (state) { + m_PairUpRealWiimote[m_Page]->Enable(true); + m_BasicConfigFrame->UpdateGUI(); + } + else + m_PairUpRealWiimote[m_Page]->Enable(false); + } +} + + void WiimoteBasicConfigDialog::DoUseReal() { if (!g_RealWiiMotePresent) @@ -463,6 +473,13 @@ void WiimoteBasicConfigDialog::GeneralSettingsChanged(wxCommandEvent& event) case IDC_WIIAUTOUNPAIR: g_Config.bUnpairRealWiimote = m_WiiAutoUnpair[m_Page]->IsChecked(); break; +#ifdef _WIN32 + case IDC_WIIAUTOPAIR: + if (m_WiiExtendedPairUp[m_Page]->IsChecked()) + WiiMoteReal::g_StartAutopairThread.Set(); + g_Config.bPairRealWiimote = m_WiiExtendedPairUp[m_Page]->IsChecked(); + break; +#endif case IDC_EXTCONNECTED: // Disconnect the extension so that the game recognize the change DoExtensionConnectedDisconnected(WiiMoteEmu::EXT_NONE); @@ -567,6 +584,7 @@ void WiimoteBasicConfigDialog::UpdateGUI() m_WiiMotionPlusConnected[m_Page]->SetValue(WiiMoteEmu::WiiMapping[m_Page].bMotionPlusConnected); m_WiiAutoReconnect[m_Page]->SetValue(WiiMoteEmu::WiiMapping[m_Page].bWiiAutoReconnect); m_WiiAutoUnpair[m_Page]->SetValue(g_Config.bUnpairRealWiimote); + m_WiiExtendedPairUp[m_Page]->SetValue(g_Config.bPairRealWiimote); m_Extension[m_Page]->SetSelection(WiiMoteEmu::WiiMapping[m_Page].iExtensionConnected); // Update the Wiimote IR pointer calibration diff --git a/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.h b/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.h index 1858332e8e..a20a77628e 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.h +++ b/Source/Plugins/Plugin_Wiimote/Src/ConfigBasicDlg.h @@ -45,6 +45,7 @@ class WiimoteBasicConfigDialog : public wxDialog // General open, close and event functions void UpdateGUI(); + void UpdateBasicConfigDialog(bool state); void ButtonClick(wxCommandEvent& event); void ShutDown(wxTimerEvent& WXUNUSED(event)); void UpdateOnce(wxTimerEvent& event); @@ -86,6 +87,7 @@ class WiimoteBasicConfigDialog : public wxDialog *m_Crop[MAX_WIIMOTES], *m_WiiAutoReconnect[MAX_WIIMOTES], *m_WiiAutoUnpair[MAX_WIIMOTES], + *m_WiiExtendedPairUp[MAX_WIIMOTES], *m_UDPWiiEnable[MAX_WIIMOTES], *m_UDPWiiAccel[MAX_WIIMOTES], *m_UDPWiiButt[MAX_WIIMOTES], @@ -142,6 +144,7 @@ class WiimoteBasicConfigDialog : public wxDialog IDC_MOTIONPLUSCONNECTED, IDC_WIIAUTORECONNECT, IDC_WIIAUTOUNPAIR, + IDC_WIIAUTOPAIR, IDC_EXTCONNECTED, //UDPWii diff --git a/Source/Plugins/Plugin_Wiimote/Src/main.cpp b/Source/Plugins/Plugin_Wiimote/Src/main.cpp index fee6285c78..8d6ce2cdc2 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/main.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/main.cpp @@ -104,12 +104,17 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle break; case DLL_PROCESS_DETACH: + { #ifdef _WIN32 - if (g_Config.bUnpairRealWiimote) WiiMoteReal::WiimotePairUp(true); + if (g_Config.bUnpairRealWiimote){ + WiiMoteReal::Shutdown(); + WiiMoteReal::WiimotePairUp(true); + } #endif #if defined(HAVE_WX) && HAVE_WX wxUninitialize(); #endif + } break; } @@ -159,6 +164,13 @@ void DllDebugger(HWND _hParent, bool Show) {} void DllConfig(HWND _hParent) { +#ifdef _WIN32 + if (WiiMoteReal::g_AutoPairUpInvisibleWindow == NULL) + { + WiiMoteReal::g_AutoPairUpInvisibleWindow = new Common::Thread(WiiMoteReal::RunInvisibleMessageWindow_ThreadFunc, NULL); + WiiMoteReal::g_AutoPairUpMonitoring = new Common::Thread(WiiMoteReal::PairUp_ThreadFunc, NULL); + } +#endif if (!g_SearchDeviceDone) { // Load settings @@ -168,6 +180,7 @@ void DllConfig(HWND _hParent) g_SearchDeviceDone = true; } + #if defined(HAVE_WX) && HAVE_WX wxWindow *frame = GetParentedWxWindow(_hParent); m_BasicConfigFrame = new WiimoteBasicConfigDialog(frame); @@ -223,8 +236,16 @@ void Initialize(void *init) Wiimote connected or not. It takes no time for Wiiuse to check for connected Wiimotes. */ #if HAVE_WIIUSE + WiiMoteReal::Initialize(); WiiMoteReal::Allocate(); +#ifdef _WIN32 + if (WiiMoteReal::g_AutoPairUpInvisibleWindow == NULL) + { + WiiMoteReal::g_AutoPairUpInvisibleWindow = new Common::Thread(WiiMoteReal::RunInvisibleMessageWindow_ThreadFunc, NULL); + WiiMoteReal::g_AutoPairUpMonitoring = new Common::Thread(WiiMoteReal::PairUp_ThreadFunc, NULL); + } +#endif #endif } @@ -273,6 +294,7 @@ void EmuStateChange(PLUGIN_EMUSTATE newState) g_EmulatorState = newState; } + /* This function produce Wiimote Input (reports from the Wiimote) in response to Output from the Wii. It's called from WII_IPC_HLE_WiiMote.cpp. diff --git a/Source/Plugins/Plugin_Wiimote/Src/main.h b/Source/Plugins/Plugin_Wiimote/Src/main.h index 9b1fff3b57..8680a14ba4 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/main.h +++ b/Source/Plugins/Plugin_Wiimote/Src/main.h @@ -63,6 +63,7 @@ struct SRecordingAll extern u32 g_ISOId; extern bool g_SearchDeviceDone; extern bool g_RealWiiMotePresent; + extern HINSTANCE g_hInstance; // Debugging extern bool g_DebugAccelerometer; diff --git a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp index 4461704249..1e94ee5666 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp @@ -36,6 +36,7 @@ #include "wiimote_real.h" #if defined(HAVE_WX) && HAVE_WX #include "ConfigRecordingDlg.h" +#include "ConfigBasicDlg.h" #endif #ifdef WIN32 @@ -56,9 +57,6 @@ bool g_RealWiiMoteAllocated = false; class CWiiMote; -THREAD_RETURN ReadWiimote_ThreadFunc(void* arg); -THREAD_RETURN SafeCloseReadWiimote_ThreadFunc(void* arg); - // Variable declarations wiimote_t** g_WiiMotesFromWiiUse = NULL; @@ -77,8 +75,25 @@ bool g_RunTemporary = false; int g_RunTemporaryCountdown = 0; u8 g_EventBuffer[32]; bool g_WiimoteInUse[MAX_WIIMOTES]; - Common::Event NeedsConnect; - Common::Event Connected; +Common::Event NeedsConnect; +Common::Event Connected; + +#if defined(_WIN32) && defined(HAVE_WIIUSE) +//Autopairup +Common::Thread* g_AutoPairUpInvisibleWindow = NULL; +Common::Thread* g_AutoPairUpMonitoring = NULL; +Common::Event g_StartAutopairThread; + +int stoprefresh = 0; +unsigned int PairUpTimer = 2000; + +int PaiUpRefreshWiimote(); +THREAD_RETURN PairUp_ThreadFunc(void* arg); +THREAD_RETURN RunInvisibleMessageWindow_ThreadFunc(void* arg); +#endif + +THREAD_RETURN ReadWiimote_ThreadFunc(void* arg); +THREAD_RETURN SafeCloseReadWiimote_ThreadFunc(void* arg); // Probably this class should be in its own file @@ -644,7 +659,7 @@ int WiimotePairUp(bool unpair) return -1; } nRadios--; - // DEBUG_LOG(WIIMOTE, "Pair-Up: Found %d radios\n", nRadios); + //DEBUG_LOG(WIIMOTE, "Pair-Up: Found %d radios\n", nRadios); // Pair with Wii device(s) int radio = 0; @@ -671,7 +686,7 @@ int WiimotePairUp(bool unpair) srch.cTimeoutMultiplier = 1; srch.hRadio = hRadios[radio]; - //DEBUG_LOG(WIIMOTE, _T("Pair-Up: Scanning for BT Device(s)")); + //DEBUG_LOG(WIIMOTE, "Pair-Up: Scanning for BT Device(s)"); hFind = BluetoothFindFirstDevice(&srch, &btdi); @@ -683,6 +698,7 @@ int WiimotePairUp(bool unpair) do { + //btdi.szName is sometimes missings it's content - it's a bt feature.. if ((!wcscmp(btdi.szName, L"Nintendo RVL-WBC-01") || !wcscmp(btdi.szName, L"Nintendo RVL-CNT-01")) && !btdi.fConnected && !unpair) { //TODO: improve the readd of the BT driver, esp. when batteries of the wiimote are removed while beeing fConnected @@ -710,7 +726,8 @@ int WiimotePairUp(bool unpair) { BluetoothRemoveDevice(&btdi.Address); - NOTICE_LOG(WIIMOTE, "Pair-Up: Automatically removed BT Device on shutdown: %08x", GetLastError()); + NOTICE_LOG(WIIMOTE, "Pair-Up: Automatically removed BT Device on shutdown: %08x", GetLastError()); + nPaired++; } } while (BluetoothFindNextDevice(hFind, &btdi)); @@ -728,6 +745,150 @@ int WiimotePairUp(bool unpair) return nPaired; } + +#ifdef HAVE_WIIUSE +LRESULT CALLBACK CallBackDeviceChange(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch(uMsg) + { + + case WM_DEVICECHANGE: + + // DBT_DEVNODES_CHANGED 0x007 (devnodes are atm not received); DBT_DEVICEARRIVAL 0x8000 DBT_DEVICEREMOVECOMPLETE 0x8004 // avoiding header file^^ + if ( ( wParam == 0x8000 || wParam == 0x8004 || wParam == 0x0007 ) ) + { + if (wiiuse_check_system_notification(uMsg, wParam, lParam)) //extern wiiuse function: returns 1 if the event came from a wiimote + { + switch (wParam) + { + case 0x8000: + if (stoprefresh) // arrival will pop up twice //need to rewrite the stoprefresh thing, to support multiple pair ups in one go + { + stoprefresh = 0; + + PaiUpRefreshWiimote(); + break; + } + else stoprefresh = 1; //fake arrival wait for second go + break; + + case 0x8004: + if (!stoprefresh) // removal event will pop up only once (it will also pop up if we add a device: fake arrival, fake removal, real arrival. + { + PaiUpRefreshWiimote(); + } + break; + } + } + } + return DefWindowProc(hWnd, uMsg, wParam, lParam); + + default: + return DefWindowProc(hWnd, uMsg, wParam, lParam); + } + +return 0; +} + +THREAD_RETURN RunInvisibleMessageWindow_ThreadFunc(void* arg) +{ + MSG Msg; + HWND hwnd; + + WNDCLASSEX WCEx; + ZeroMemory(&WCEx, sizeof(WCEx)); + WCEx.cbSize = sizeof(WCEx); + WCEx.lpfnWndProc = CallBackDeviceChange; + WCEx.hInstance = g_hInstance; + WCEx.lpszClassName = L"MSGWND"; + + if (RegisterClassEx(&WCEx) != 0) + { + hwnd = CreateWindowEx(0, WCEx.lpszClassName, NULL,0, + 0, 0, 0, 0, HWND_MESSAGE, NULL, g_hInstance, NULL); + + if (!hwnd) { + UnregisterClass(WCEx.lpszClassName, g_hInstance); + return 1; + } + } + + wiiuse_register_system_notification(hwnd); //function moved into wiiuse to avoid ddk/wdk dependicies + + while(GetMessage(&Msg, 0, 0, 0) > 0) + { + TranslateMessage(&Msg); + DispatchMessage(&Msg); + } + + UnregisterClass(WCEx.lpszClassName, g_hInstance); + + if (g_Config.bUnpairRealWiimote) + WiiMoteReal::WiimotePairUp(true); + + return (int)Msg.wParam; + +} + +int PaiUpRefreshWiimote() +{ + if (g_EmulatorState != PLUGIN_EMUSTATE_PLAY) + { + Shutdown(); + Initialize(); + //Allocate(); + if (m_BasicConfigFrame != NULL) + m_BasicConfigFrame->UpdateGUI(); + } + else { + + Sleep(100); + PostMessage(GetParent(g_WiimoteInitialize.hWnd), WM_USER, WM_USER_PAUSE, 0); + while (g_EmulatorState == PLUGIN_EMUSTATE_PLAY) Sleep(50); + Shutdown(); + Initialize(); + Allocate(); + PostMessage(GetParent(g_WiimoteInitialize.hWnd), WM_USER, WM_USER_PAUSE, 0); + while (g_EmulatorState != PLUGIN_EMUSTATE_PLAY) Sleep(50); + + } + return 0; +} + + +THREAD_RETURN PairUp_ThreadFunc(void* arg) +{ + Sleep(100); //small pause till the callback is registered on first start + DEBUG_LOG(WIIMOTE, "PairUp_ThreadFunc started."); + g_StartAutopairThread.Init(); + int result; + + while(1) { + if (g_Config.bPairRealWiimote) { + PairUpTimer = 2000; + result = g_StartAutopairThread.Wait(PairUpTimer); + } + else { + result = g_StartAutopairThread.Wait(); + } + + if (result) + WiimotePairUp(false); + else { + if (m_BasicConfigFrame != NULL) + m_BasicConfigFrame->UpdateBasicConfigDialog(false); + WiimotePairUp(false); + if (m_BasicConfigFrame != NULL) + m_BasicConfigFrame->UpdateBasicConfigDialog(true); + + } + + } + DEBUG_LOG(WIIMOTE, "PairUp_ThreadFunc terminated."); +return 0; +} + +#endif #endif }; // end of namespace diff --git a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.h b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.h index 8d31f832a9..0708ebb25b 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.h +++ b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.h @@ -32,7 +32,9 @@ namespace WiiMoteReal { int Initialize(); +#ifdef _WIN32 int WiimotePairUp(bool unpair); +#endif void Allocate(); void DoState(PointerWrap &p); @@ -64,6 +66,13 @@ bool IRDataOK(struct wiimote_t* wm); extern bool g_RunTemporary; extern int g_RunTemporaryCountdown; extern u8 g_EventBuffer[32]; +#ifdef _WIN32 + extern Common::Thread* g_AutoPairUpInvisibleWindow; + extern Common::Thread* g_AutoPairUpMonitoring; + extern Common::Event g_StartAutopairThread; + THREAD_RETURN PairUp_ThreadFunc(void* arg); + THREAD_RETURN RunInvisibleMessageWindow_ThreadFunc(void* arg); +#endif #endif }; // WiiMoteReal