mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-24 23:11:14 +01:00
Real Wiimote: fix a crash some people were having, and fix IR behavior (by turning off some msvc++ optimizations...)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4610 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
7118900d3b
commit
6145dd2967
BIN
Externals/WiiUse/Win32/wiiuse.dll
vendored
BIN
Externals/WiiUse/Win32/wiiuse.dll
vendored
Binary file not shown.
BIN
Externals/WiiUse/Win32/wiiuse.lib
vendored
BIN
Externals/WiiUse/Win32/wiiuse.lib
vendored
Binary file not shown.
BIN
Externals/WiiUse/X64/wiiuse.dll
vendored
BIN
Externals/WiiUse/X64/wiiuse.dll
vendored
Binary file not shown.
BIN
Externals/WiiUse/X64/wiiuse.lib
vendored
BIN
Externals/WiiUse/X64/wiiuse.lib
vendored
Binary file not shown.
8
Externals/WiiUseSrc/wiiuse.vcproj
vendored
8
Externals/WiiUseSrc/wiiuse.vcproj
vendored
@ -51,8 +51,8 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="2"
|
Optimization="0"
|
||||||
InlineFunctionExpansion="1"
|
InlineFunctionExpansion="2"
|
||||||
AdditionalIncludeDirectories="C:\WinDDK\7600.16385.0\inc\api;C:\WinDDK\7600.16385.0\inc\crt"
|
AdditionalIncludeDirectories="C:\WinDDK\7600.16385.0\inc\api;C:\WinDDK\7600.16385.0\inc\crt"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;WIIUSE_EXPORTS"
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;WIIUSE_EXPORTS"
|
||||||
IgnoreStandardIncludePath="true"
|
IgnoreStandardIncludePath="true"
|
||||||
@ -147,8 +147,8 @@
|
|||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="2"
|
Optimization="0"
|
||||||
InlineFunctionExpansion="1"
|
InlineFunctionExpansion="2"
|
||||||
AdditionalIncludeDirectories="C:\WinDDK\7600.16385.0\inc\api;C:\WinDDK\7600.16385.0\inc\crt"
|
AdditionalIncludeDirectories="C:\WinDDK\7600.16385.0\inc\api;C:\WinDDK\7600.16385.0\inc\crt"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;WIIUSE_EXPORTS;_WIN64"
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;WIIUSE_EXPORTS;_WIN64"
|
||||||
IgnoreStandardIncludePath="true"
|
IgnoreStandardIncludePath="true"
|
||||||
|
@ -37,10 +37,12 @@
|
|||||||
|
|
||||||
namespace WiiMoteReal
|
namespace WiiMoteReal
|
||||||
{
|
{
|
||||||
int GetReportSize(struct wiimote_t* wm)
|
int GetIRDataSize(struct wiimote_t* wm)
|
||||||
{
|
{
|
||||||
// The report size is 0x33 = 18, 0x37 = 22 withouth the leading (a1) byte
|
if (WIIUSE_USING_EXP(wm))
|
||||||
if(WIIUSE_USING_EXP(wm)) return 22; else return 18;
|
return 10;
|
||||||
|
else
|
||||||
|
return 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_ctrl_status(struct wiimote_t* wm)
|
void handle_ctrl_status(struct wiimote_t* wm)
|
||||||
@ -56,19 +58,14 @@ void handle_ctrl_status(struct wiimote_t* wm)
|
|||||||
|
|
||||||
bool IRDataOK(struct wiimote_t* wm)
|
bool IRDataOK(struct wiimote_t* wm)
|
||||||
{
|
{
|
||||||
//DEBUG_LOG(WIIMOTE, "IRDataOK: ");
|
// This check is valid because 0 should only be returned if the data
|
||||||
// The report size is 0x33 = 18, 0x37 = 22 withouth the leading (a1) byte
|
// hasn't been filled in by wiiuse
|
||||||
int ReportSize = GetReportSize(wm);
|
int IRDataSize = GetIRDataSize(wm);
|
||||||
for(int i = 0; i < ReportSize; i++)
|
for (int i = 7; i < IRDataSize; i++)
|
||||||
{
|
if (wm->event_buf[i] == 0)
|
||||||
//DEBUG_LOG(WIIMOTE, "%02x ", wm->event_buf[i]);
|
return false;
|
||||||
if (wm->event_buf[i] > 0)
|
|
||||||
{
|
return true;
|
||||||
//DEBUG_LOG(WIIMOTE, "");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_event(struct wiimote_t* wm)
|
void handle_event(struct wiimote_t* wm)
|
||||||
@ -129,17 +126,12 @@ void handle_event(struct wiimote_t* wm)
|
|||||||
Tmp += StringFromFormat("G-Force x, y, z: %1.2f %1.2f %1.2f\n", wm->gforce.x, wm->gforce.y, wm->gforce.z);
|
Tmp += StringFromFormat("G-Force x, y, z: %1.2f %1.2f %1.2f\n", wm->gforce.x, wm->gforce.y, wm->gforce.z);
|
||||||
Tmp += StringFromFormat("Accel x, y, z: %03i %03i %03i\n", wm->accel.x, wm->accel.y, wm->accel.z);
|
Tmp += StringFromFormat("Accel x, y, z: %03i %03i %03i\n", wm->accel.x, wm->accel.y, wm->accel.z);
|
||||||
|
|
||||||
// The report size is 0x33 = 18, 0x37 = 22
|
|
||||||
int ReportSize; if(WIIUSE_USING_EXP(wm)) ReportSize = 22; else ReportSize = 18;
|
|
||||||
|
|
||||||
// wm->event_buf is cleared at the end of all wiiuse_poll(), so wm->event_buf will always be zero
|
// wm->event_buf is cleared at the end of all wiiuse_poll(), so wm->event_buf will always be zero
|
||||||
// after that. To get the raw IR data we need to read the wiimote again. This seems to work most of the time,
|
// after that. To get the raw IR data we need to read the wiimote again. This seems to work most of the time,
|
||||||
// it seems to fails with a regular interval about each tenth read.
|
// it seems to fails with a regular interval about each tenth read.
|
||||||
if(wiiuse_io_read(wm))
|
if (wiiuse_io_read(wm))
|
||||||
{
|
if (IRDataOK(wm))
|
||||||
// Check that it's not zero
|
memcpy(g_EventBuffer, wm->event_buf, GetIRDataSize(wm));
|
||||||
if (IRDataOK(wm)) memcpy(g_EventBuffer, wm->event_buf, ReportSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Go through each of the 4 possible IR sources
|
// Go through each of the 4 possible IR sources
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i)
|
||||||
@ -163,7 +155,6 @@ void handle_event(struct wiimote_t* wm)
|
|||||||
//std::string TmpData = ArrayToString(g_EventBuffer, ReportSize, 0, 30);
|
//std::string TmpData = ArrayToString(g_EventBuffer, ReportSize, 0, 30);
|
||||||
//Tmp += "Data: " + TmpData;
|
//Tmp += "Data: " + TmpData;
|
||||||
|
|
||||||
//Console::ClearScreen();
|
|
||||||
//DEBUG_LOG(WIIMOTE, "%s", Tmp.c_str());
|
//DEBUG_LOG(WIIMOTE, "%s", Tmp.c_str());
|
||||||
|
|
||||||
#if defined(HAVE_WX) && HAVE_WX
|
#if defined(HAVE_WX) && HAVE_WX
|
||||||
@ -211,13 +202,10 @@ void handle_event(struct wiimote_t* wm)
|
|||||||
|
|
||||||
if(m_RecordingConfigFrame->m_bRecording)
|
if(m_RecordingConfigFrame->m_bRecording)
|
||||||
DEBUG_LOG(WIIMOTE, "Wiiuse Recorded accel x, y, z: %03i %03i %03i", Gx, Gy, Gz);
|
DEBUG_LOG(WIIMOTE, "Wiiuse Recorded accel x, y, z: %03i %03i %03i", Gx, Gy, Gz);
|
||||||
//DEBUG_LOG(WIIMOTE, "Wiiuse Recorded accel x, y, z: %02x %02x %02x", Gx, Gy, Gz);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send the data to be saved
|
// Send the data to be saved
|
||||||
//const u8* data = (const u8*)wm->event_buf;
|
m_RecordingConfigFrame->DoRecordMovement(Gx, Gy, Gz, g_EventBuffer + 6, GetIRDataSize(wm));
|
||||||
m_RecordingConfigFrame->DoRecordMovement(Gx, Gy, Gz, (g_EventBuffer + 6),
|
|
||||||
(WIIUSE_USING_EXP(wm) ? 10 : 12));
|
|
||||||
|
|
||||||
// Turn recording on and off
|
// Turn recording on and off
|
||||||
if (IS_PRESSED(wm, WIIMOTE_BUTTON_A)) m_RecordingConfigFrame->DoRecordA(true);
|
if (IS_PRESSED(wm, WIIMOTE_BUTTON_A)) m_RecordingConfigFrame->DoRecordA(true);
|
||||||
@ -226,7 +214,6 @@ void handle_event(struct wiimote_t* wm)
|
|||||||
// ------------------------------------
|
// ------------------------------------
|
||||||
// Show roll and pitch in the status box
|
// Show roll and pitch in the status box
|
||||||
// --------------
|
// --------------
|
||||||
|
|
||||||
if(!g_DebugData)
|
if(!g_DebugData)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(WIIMOTE, "Roll:%03i Pitch:%03i", (int)wm->orient.roll, (int)wm->orient.pitch);
|
DEBUG_LOG(WIIMOTE, "Roll:%03i Pitch:%03i", (int)wm->orient.roll, (int)wm->orient.pitch);
|
||||||
|
@ -144,14 +144,14 @@ void ReadData()
|
|||||||
if (pBuffer[1] >= 0x30)
|
if (pBuffer[1] >= 0x30)
|
||||||
{
|
{
|
||||||
// Copy Buffer to LastReport
|
// Copy Buffer to LastReport
|
||||||
memcpy(m_LastReport.m_PayLoad, pBuffer + 1, MAX_PAYLOAD);
|
memcpy(m_LastReport.m_PayLoad, pBuffer + 1, MAX_PAYLOAD - 1);
|
||||||
m_LastReportValid = true;
|
m_LastReportValid = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Copy Buffer to ImportantEvent
|
// Copy Buffer to ImportantEvent
|
||||||
SEvent ImportantEvent;
|
SEvent ImportantEvent;
|
||||||
memcpy(ImportantEvent.m_PayLoad, pBuffer + 1, MAX_PAYLOAD);
|
memcpy(ImportantEvent.m_PayLoad, pBuffer + 1, MAX_PAYLOAD - 1);
|
||||||
|
|
||||||
// Put it in the read queue right away
|
// Put it in the read queue right away
|
||||||
m_EventReadQueue.push(ImportantEvent);
|
m_EventReadQueue.push(ImportantEvent);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user