diff --git a/Externals/WiiUse/Src/definitions.h b/Externals/WiiUse/Src/definitions.h index 05519bd5d4..77e98a2b2a 100644 --- a/Externals/WiiUse/Src/definitions.h +++ b/Externals/WiiUse/Src/definitions.h @@ -34,7 +34,7 @@ #ifndef DEFINITIONS_H_INCLUDED #define DEFINITIONS_H_INCLUDED -#ifndef WIN32 +#ifndef _WIN32 #include "Log.h" // NOTICE_LEVEL is more appropriate for the uses of WIIUSE_INFO than INFO_LEVEL diff --git a/Externals/WiiUse/Src/io_win.c b/Externals/WiiUse/Src/io_win.c index 992da0213e..60b13479a2 100644 --- a/Externals/WiiUse/Src/io_win.c +++ b/Externals/WiiUse/Src/io_win.c @@ -31,7 +31,7 @@ * @brief Handles device I/O for Windows. */ -#ifdef WIN32 +#ifdef _WIN32 #include #include @@ -44,6 +44,8 @@ #include "definitions.h" #include "wiiuse_internal.h" +int wiiuse_remove(struct wiimote_t** wm, int wiimotes, int max_wiimotes); + int wiiuse_find(struct wiimote_t** wm, int max_wiimotes, int wiimotes) { GUID device_id; HANDLE dev; @@ -58,8 +60,8 @@ int wiiuse_find(struct wiimote_t** wm, int max_wiimotes, int wiimotes) { // todo: handle/remove (unexpected and forced) disconnected wiimotes here // removal of unneeded wiimotes and exiting when we got enough wiimotes connected - if(wiiuse_remove(wm, wiimotes, max_wiimotes)) - return wm; + if (wiiuse_remove(wm, wiimotes, max_wiimotes)) + return max_wiimotes; device_data.cbSize = sizeof(device_data); @@ -69,7 +71,7 @@ int wiiuse_find(struct wiimote_t** wm, int max_wiimotes, int wiimotes) { // get all hid devices connected device_info = SetupDiGetClassDevs(&device_id, NULL, NULL, (DIGCF_DEVICEINTERFACE | DIGCF_PRESENT)); - for (;wiimotes < max_wiimotes; ++index) { + for (index = 0; wiimotes < max_wiimotes; ++index) { if (detail_data) { free(detail_data); @@ -398,4 +400,4 @@ int wiiuse_remove(struct wiimote_t** wm, int wiimotes, int max_wiimotes) { } -#endif /* ifdef WIN32 */ +#endif /* ifdef _WIN32 */ diff --git a/Externals/WiiUse/Src/ir.c b/Externals/WiiUse/Src/ir.c index 2e815ae74b..9e9206bbbb 100644 --- a/Externals/WiiUse/Src/ir.c +++ b/Externals/WiiUse/Src/ir.c @@ -34,7 +34,7 @@ #include #include -#ifndef WIN32 +#ifndef _WIN32 #include #endif diff --git a/Externals/WiiUse/Src/wiiuse.c b/Externals/WiiUse/Src/wiiuse.c index d76a196430..59cc15beda 100644 --- a/Externals/WiiUse/Src/wiiuse.c +++ b/Externals/WiiUse/Src/wiiuse.c @@ -38,7 +38,7 @@ #include #include -#ifndef WIN32 +#ifndef _WIN32 #include #else #include @@ -352,7 +352,7 @@ int wiiuse_send(struct wiimote_t* wm, byte report_type, byte* msg, int len) { { int x = 2; printf("[DEBUG] (id %i) SEND: (%x) %.2x ", wm->unid, buf[0], buf[1]); - #ifndef WIN32 + #ifndef _WIN32 for (; x < len+2; ++x) #else for (; x < len+1; ++x) @@ -376,7 +376,7 @@ int wiiuse_send(struct wiimote_t* wm, byte report_type, byte* msg, int len) { * @param type The type of bluetooth stack to use. */ void wiiuse_set_bluetooth_stack(struct wiimote_t** wm, int wiimotes, enum win_bt_stack_t type) { - #ifdef WIN32 + #ifdef _WIN32 int i; if (!wm) return; diff --git a/Externals/WiiUse/Src/wiiuse.h b/Externals/WiiUse/Src/wiiuse.h index 5ab1e0f02e..ae8253c44f 100644 --- a/Externals/WiiUse/Src/wiiuse.h +++ b/Externals/WiiUse/Src/wiiuse.h @@ -220,7 +220,7 @@ WIIUSE_EXPORT extern int wiiuse_connect(struct wiimote_t** wm, int wiimotes); WIIUSE_EXPORT extern void wiiuse_disconnect(struct wiimote_t* wm); WIIUSE_EXPORT extern void wiiuse_set_timeout(struct wiimote_t** wm, int wiimotes, byte timeout); -#ifdef WIN32 +#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 diff --git a/Externals/WiiUse/Win32/wiiuse.dll b/Externals/WiiUse/Win32/wiiuse.dll index 2edeb22052..989e55f40a 100644 Binary files a/Externals/WiiUse/Win32/wiiuse.dll and b/Externals/WiiUse/Win32/wiiuse.dll differ diff --git a/Externals/WiiUse/Win32/wiiuse.lib b/Externals/WiiUse/Win32/wiiuse.lib index 47ff73a1ed..8d5a76b2fd 100644 Binary files a/Externals/WiiUse/Win32/wiiuse.lib and b/Externals/WiiUse/Win32/wiiuse.lib differ diff --git a/Externals/WiiUse/X64/wiiuse.dll b/Externals/WiiUse/X64/wiiuse.dll index b8de62db4f..a818456452 100644 Binary files a/Externals/WiiUse/X64/wiiuse.dll and b/Externals/WiiUse/X64/wiiuse.dll differ diff --git a/Externals/WiiUse/X64/wiiuse.lib b/Externals/WiiUse/X64/wiiuse.lib index 419dceb614..fa0c8499a9 100644 Binary files a/Externals/WiiUse/X64/wiiuse.lib and b/Externals/WiiUse/X64/wiiuse.lib differ diff --git a/Externals/WiiUse/wiiuse.sln b/Externals/WiiUse/wiiuse.sln index 005518bf33..acfb7eec48 100644 --- a/Externals/WiiUse/wiiuse.sln +++ b/Externals/WiiUse/wiiuse.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wiiuse", "wiiuse.vcproj", "{944EF6DE-471D-447E-A2FD-D37D58805169}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wiiuse", "wiiuse.vcproj", "{52F70249-373A-4401-A70A-FF22760EC1B8}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,14 +11,14 @@ Global Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {944EF6DE-471D-447E-A2FD-D37D58805169}.Debug|Win32.ActiveCfg = Debug|Win32 - {944EF6DE-471D-447E-A2FD-D37D58805169}.Debug|Win32.Build.0 = Debug|Win32 - {944EF6DE-471D-447E-A2FD-D37D58805169}.Debug|x64.ActiveCfg = Debug|x64 - {944EF6DE-471D-447E-A2FD-D37D58805169}.Debug|x64.Build.0 = Debug|x64 - {944EF6DE-471D-447E-A2FD-D37D58805169}.Release|Win32.ActiveCfg = Release|Win32 - {944EF6DE-471D-447E-A2FD-D37D58805169}.Release|Win32.Build.0 = Release|Win32 - {944EF6DE-471D-447E-A2FD-D37D58805169}.Release|x64.ActiveCfg = Release|x64 - {944EF6DE-471D-447E-A2FD-D37D58805169}.Release|x64.Build.0 = Release|x64 + {52F70249-373A-4401-A70A-FF22760EC1B8}.Debug|Win32.ActiveCfg = Debug|Win32 + {52F70249-373A-4401-A70A-FF22760EC1B8}.Debug|Win32.Build.0 = Debug|Win32 + {52F70249-373A-4401-A70A-FF22760EC1B8}.Debug|x64.ActiveCfg = Debug|x64 + {52F70249-373A-4401-A70A-FF22760EC1B8}.Debug|x64.Build.0 = Debug|x64 + {52F70249-373A-4401-A70A-FF22760EC1B8}.Release|Win32.ActiveCfg = Release|Win32 + {52F70249-373A-4401-A70A-FF22760EC1B8}.Release|Win32.Build.0 = Release|Win32 + {52F70249-373A-4401-A70A-FF22760EC1B8}.Release|x64.ActiveCfg = Release|x64 + {52F70249-373A-4401-A70A-FF22760EC1B8}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Externals/WiiUse/wiiuse.vcproj b/Externals/WiiUse/wiiuse.vcproj index a18e08c208..ae2491cd2c 100644 --- a/Externals/WiiUse/wiiuse.vcproj +++ b/Externals/WiiUse/wiiuse.vcproj @@ -1,11 +1,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - diff --git a/Source/Plugins/Plugin_WiimoteNew/Src/WiimoteReal/WiimoteReal.cpp b/Source/Plugins/Plugin_WiimoteNew/Src/WiimoteReal/WiimoteReal.cpp index 1f0cae2568..53f857d4df 100644 --- a/Source/Plugins/Plugin_WiimoteNew/Src/WiimoteReal/WiimoteReal.cpp +++ b/Source/Plugins/Plugin_WiimoteNew/Src/WiimoteReal/WiimoteReal.cpp @@ -36,7 +36,7 @@ namespace WiimoteReal bool g_real_wiimotes_initialized = false; wiimote_t** g_wiimotes_from_wiiuse = NULL; unsigned int g_wiimotes_found = 0; -volatile unsigned int g_wiimotes_lastfound = 0; +// removed g_wiimotes_lastfound because Refresh() isn't taking advantage of it volatile bool g_run_wiimote_thread = false; Common::Thread *g_wiimote_threads[MAX_WIIMOTES] = {}; @@ -274,20 +274,19 @@ unsigned int Initialize() // initialized g_real_wiimotes_initialized = true; -#ifdef WIN32 +#ifdef _WIN32 // Alloc memory for wiimote structure only if we're starting fresh if(!g_wiimotes_from_wiiuse) g_wiimotes_from_wiiuse = wiiuse_init(MAX_WIIMOTES); // on windows wiiuse_find() expects as a 3rd parameter the amount of last connected wiimotes instead of the timeout, // a timeout parameter is useless on win32 here, since at this points we already have the wiimotes discovered and paired up, just not connected. - g_wiimotes_found = wiiuse_find(g_wiimotes_from_wiiuse, wanted_wiimotes, g_wiimotes_lastfound); + g_wiimotes_found = wiiuse_find(g_wiimotes_from_wiiuse, wanted_wiimotes, 0); #else g_wiimotes_from_wiiuse = wiiuse_init(MAX_WIIMOTES); g_wiimotes_found = wiiuse_find(g_wiimotes_from_wiiuse, wanted_wiimotes, 5); #endif - g_wiimotes_lastfound = g_wiimotes_found; - DEBUG_LOG(WIIMOTE, "Found %i Real Wiimotes, %i wanted and %i previously found", - g_wiimotes_found, wanted_wiimotes, g_wiimotes_lastfound); + DEBUG_LOG(WIIMOTE, "Found %i Real Wiimotes, %i wanted", + g_wiimotes_found, wanted_wiimotes); g_wiimotes_found = wiiuse_connect(g_wiimotes_from_wiiuse, g_wiimotes_found); @@ -327,7 +326,7 @@ void Shutdown(void) // Clean up wiiuse, win32: we cant just delete the struct on win32, since wiiuse_find() maintains it and // adds/removes wimotes directly to/from it to prevent problems, which would occur when using more than 1 wiimote if we create it from scratch everytime -#ifndef WIN32 +#ifndef _WIN32 wiiuse_cleanup(g_wiimotes_from_wiiuse, MAX_WIIMOTES); #endif }