some cleanup
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1227 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
58f998cb55
commit
12a8174446
|
@ -86,6 +86,7 @@ void GetMousePos(float& x, float& y)
|
||||||
x = point.x / (float)width;
|
x = point.x / (float)width;
|
||||||
y = point.y / (float)height;
|
y = point.y / (float)height;
|
||||||
#else
|
#else
|
||||||
|
// TODO fix on linux
|
||||||
x = 0.5f;
|
x = 0.5f;
|
||||||
y = 0.5f;
|
y = 0.5f;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -36,9 +36,9 @@ namespace WiiMoteReal
|
||||||
{
|
{
|
||||||
#define MAX_WIIMOTES 1
|
#define MAX_WIIMOTES 1
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
// Forwording
|
// Forwarding
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
class CWiiMote;
|
class CWiiMote;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -46,9 +46,9 @@ namespace WiiMoteReal
|
||||||
#else
|
#else
|
||||||
void* ReadWiimote_ThreadFunc(void* arg);
|
void* ReadWiimote_ThreadFunc(void* arg);
|
||||||
#endif
|
#endif
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
// Variable declarations
|
// Variable declarations
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
wiimote_t** g_WiiMotesFromWiiUse = NULL;
|
wiimote_t** g_WiiMotesFromWiiUse = NULL;
|
||||||
Common::Thread* g_pReadThread = NULL;
|
Common::Thread* g_pReadThread = NULL;
|
||||||
|
@ -56,9 +56,9 @@ namespace WiiMoteReal
|
||||||
CWiiMote* g_WiiMotes[MAX_WIIMOTES];
|
CWiiMote* g_WiiMotes[MAX_WIIMOTES];
|
||||||
bool g_Shutdown = false;
|
bool g_Shutdown = false;
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
// Prolly this class should be in its own file
|
// Probably this class should be in its own file
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
class CWiiMote
|
class CWiiMote
|
||||||
{
|
{
|
||||||
|
@ -100,7 +100,8 @@ namespace WiiMoteReal
|
||||||
m_pCriticalSection->Leave();
|
m_pCriticalSection->Leave();
|
||||||
}
|
}
|
||||||
|
|
||||||
// read data from wiimote (but don't send it to the core, just filter and queue)
|
// read data from wiimote (but don't send it to the core, just filter
|
||||||
|
// and queue)
|
||||||
void ReadData()
|
void ReadData()
|
||||||
{
|
{
|
||||||
m_pCriticalSection->Enter();
|
m_pCriticalSection->Enter();
|
||||||
|
@ -118,7 +119,8 @@ namespace WiiMoteReal
|
||||||
{
|
{
|
||||||
const byte* pBuffer = m_pWiiMote->event_buf;
|
const byte* pBuffer = m_pWiiMote->event_buf;
|
||||||
|
|
||||||
// check if we have a channel (connection) if so save the data...
|
// check if we have a channel (connection) if so save the
|
||||||
|
// data...
|
||||||
if (m_channelID > 0)
|
if (m_channelID > 0)
|
||||||
{
|
{
|
||||||
m_pCriticalSection->Enter();
|
m_pCriticalSection->Enter();
|
||||||
|
@ -126,13 +128,15 @@ namespace WiiMoteReal
|
||||||
// filter out reports
|
// filter out reports
|
||||||
if (pBuffer[0] >= 0x30)
|
if (pBuffer[0] >= 0x30)
|
||||||
{
|
{
|
||||||
memcpy(m_LastReport.m_PayLoad, pBuffer, MAX_PAYLOAD);
|
memcpy(m_LastReport.m_PayLoad, pBuffer,
|
||||||
|
MAX_PAYLOAD);
|
||||||
m_LastReportValid = true;
|
m_LastReportValid = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SEvent ImportantEvent;
|
SEvent ImportantEvent;
|
||||||
memcpy(ImportantEvent.m_PayLoad, pBuffer, MAX_PAYLOAD);
|
memcpy(ImportantEvent.m_PayLoad, pBuffer,
|
||||||
|
MAX_PAYLOAD);
|
||||||
m_EventReadQueue.push(ImportantEvent);
|
m_EventReadQueue.push(ImportantEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,9 +207,9 @@ namespace WiiMoteReal
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
// Function Definitions
|
// Function Definitions
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
int Initialize()
|
int Initialize()
|
||||||
{
|
{
|
||||||
|
@ -218,12 +222,10 @@ namespace WiiMoteReal
|
||||||
g_WiiMotes[i] = new CWiiMote(i+1, g_WiiMotesFromWiiUse[i]);
|
g_WiiMotes[i] = new CWiiMote(i+1, g_WiiMotesFromWiiUse[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_NumberOfWiiMotes == 0)
|
if (g_NumberOfWiiMotes > 0)
|
||||||
return 0;
|
|
||||||
|
|
||||||
g_pReadThread = new Common::Thread(ReadWiimote_ThreadFunc, NULL);
|
g_pReadThread = new Common::Thread(ReadWiimote_ThreadFunc, NULL);
|
||||||
|
|
||||||
return true;
|
return g_NumberOfWiiMotes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoState(void* ptr, int mode)
|
void DoState(void* ptr, int mode)
|
||||||
|
|
Loading…
Reference in New Issue