Wiiuse: Hopefully fix the Windows real wiimote connecting issues caused by r5940. An "index = 0;" line was accidentally removed.(uninitialized value being used) Hopefully this fixes issue 3067, issue 3058, issue 3057, issue 3054, issue 3012, and issue 2975. Some other minor cleanup to Wiiuse.(recreated the vcprog because it had hard coded include paths and it sucked)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6107 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Jordan Woyak
2010-08-18 00:22:08 +00:00
parent cf078067e7
commit 84152919dc
12 changed files with 252 additions and 297 deletions

View File

@ -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
}