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
This commit is contained in:
parent
c344502524
commit
c59409b46a
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue