mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Some Wiimote Cleanup, re/moved some globals to where they belong.
A few things could be solved differently/in a better way, but that would involve some classes and stuff (plus work) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5097 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -49,6 +49,9 @@ extern SWiimoteInitialize g_WiimoteInitialize;
|
||||
namespace WiiMoteReal
|
||||
{
|
||||
|
||||
bool g_RealWiiMoteInitialized = false;
|
||||
bool g_RealWiiMoteAllocated = false;
|
||||
|
||||
// Forwarding
|
||||
|
||||
class CWiiMote;
|
||||
@ -387,6 +390,8 @@ int Initialize()
|
||||
// Allocate each Real WiiMote found to a WiiMote slot with Source set to "WiiMote Real"
|
||||
void Allocate()
|
||||
{
|
||||
if (g_RealWiiMoteAllocated)
|
||||
return;
|
||||
if (!g_RealWiiMoteInitialized)
|
||||
Initialize();
|
||||
|
||||
@ -469,6 +474,8 @@ void DoState(PointerWrap &p)
|
||||
|
||||
void Shutdown(void)
|
||||
{
|
||||
if (!g_RealWiiMoteInitialized)
|
||||
return;
|
||||
// Stop the loop in the thread
|
||||
g_Shutdown = true; // not safe .. might crash when still @ReadWiimote
|
||||
|
||||
@ -553,6 +560,20 @@ THREAD_RETURN ReadWiimote_ThreadFunc(void* arg)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Returns whether SafeClose_ThreadFunc will take over closing of Recording dialog.
|
||||
// FIXME: this whole threading stuff is bad, and should be removed.
|
||||
// OSX is having problems with the threading anyways, since WiiUse is used
|
||||
// from multiple threads, and not just the one where it was created on.
|
||||
bool SafeClose()
|
||||
{
|
||||
if (!g_RealWiiMoteInitialized)
|
||||
return false;
|
||||
|
||||
g_StopThreadTemporary.Set();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Thread to avoid racing conditions by directly closing of ReadWiimote_ThreadFunc() resp. ReadWiimote()
|
||||
// shutting down the Dlg while still beeing @ReadWiimote will result in a crash;
|
||||
THREAD_RETURN SafeCloseReadWiimote_ThreadFunc(void* arg)
|
||||
|
Reference in New Issue
Block a user