diff options
| author | John Peterson <jpeterson57@gmail.com> | 2009-02-04 06:40:05 +0000 |
|---|---|---|
| committer | John Peterson <jpeterson57@gmail.com> | 2009-02-04 06:40:05 +0000 |
| commit | cf303e70e9e03419d64ef8c43be550bc9b8899e1 (patch) | |
| tree | 91adda62afafafba2074f1cafb896183119b8675 /Source/Core | |
| parent | 701d4146b6b15906c41a76d82e37b48bc16aab2c (diff) | |
Wiimote: Show the decrypted Nunchuck calibration values in the log when a real Wiimote and Nunchuck is used. Fixed an earlier bug that made the neutral emulated nunchuck accelerometer values zero, now they are back to 0x80,0x80,0xb3.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2104 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Common/Src/StringUtil.cpp | 3 | ||||
| -rw-r--r-- | Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp | 27 |
2 files changed, 13 insertions, 17 deletions
diff --git a/Source/Core/Common/Src/StringUtil.cpp b/Source/Core/Common/Src/StringUtil.cpp index ef95259bd0..27ec6a7a2d 100644 --- a/Source/Core/Common/Src/StringUtil.cpp +++ b/Source/Core/Common/Src/StringUtil.cpp @@ -151,14 +151,13 @@ std::string StringFromFormat(const char* format, ...) // ---------------- std::string ArrayToString(const u8 *data, u32 size, u32 offset, int line_len, bool Spaces) { - //const u8* _data = (const u8*)data; std::string Temp; for (u32 i = 0; i < size; i++) { char Buffer[128]; if (Spaces) sprintf(Buffer, "%02x ", data[i + offset]); else sprintf(Buffer, "%02x", data[i + offset]); - if((i + 1) % line_len == 0) Temp.append("\n"); // break long lines + if(i > 0 && i % line_len == 0) Temp.append("\n"); // break long lines Temp.append(Buffer); } return Temp; diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp index e79d6cc096..01da7a8385 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp @@ -996,26 +996,29 @@ void CWII_IPC_HLE_WiiMote::SendCommandToACL(u8 _Ident, u8 _Code, u8 _CommandLeng // ---------------- void CWII_IPC_HLE_WiiMote::SendL2capData(u16 scid, const void* _pData, u32 _Size) { - //allocate + // Allocate DataFrame u8 DataFrame[1024]; u32 Offset = 0; SL2CAP_Header* pHeader = (SL2CAP_Header*)DataFrame; Offset += sizeof(SL2CAP_Header); + // Check if we are already reporting on this channel _dbg_assert_(WII_IPC_WIIMOTE, DoesChannelExist(scid)); SChannel& rChannel = m_Channel[scid]; - //assemble + // Add an additonal 4 byte header to the Wiimote report pHeader->CID = rChannel.DCID; pHeader->Length = _Size; + // Copy the Wiimote report to DataFrame memcpy(DataFrame + Offset, _pData, _Size); + // Update Offset to the final size of the report Offset += _Size; - //send + // Send the report m_pHost->SendACLFrame(GetConnectionHandle(), DataFrame, Offset); - // + // Update the status bar Host_SetWiiMoteConnectionState(2); } @@ -1023,22 +1026,16 @@ void CWII_IPC_HLE_WiiMote::SendL2capData(u16 scid, const void* _pData, u32 _Size namespace Core { - /* This is called continously from the Wiimote plugin as soon as it has received - a reporting mode */ + /* This is called continuously from the Wiimote plugin as soon as it has received + a reporting mode. _Size is the byte size of the report. */ void Callback_WiimoteInput(u16 _channelID, const void* _pData, u32 _Size) { LOGV(WII_IPC_WIIMOTE, 3, "========================================================="); const u8* pData = (const u8*)_pData; LOGV(WII_IPC_WIIMOTE, 3, "Callback_WiimoteInput:"); - std::string Temp; - for (u32 j=0; j<_Size; j++) - { - char Buffer[128]; - sprintf(Buffer, "%02x ", pData[j]); - Temp.append(Buffer); - } - LOGV(WII_IPC_WIIMOTE, 3, " Data: %s", Temp.c_str()); - //LOGV(WII_IPC_WIIMOTE, 3, " Channel: %s", _channelID); + //std::string Temp = ArrayToString(pData, _Size, 0, 50); + //LOGV(WII_IPC_WIIMOTE, 3, " Data: %s", Temp.c_str()); + LOGV(WII_IPC_WIIMOTE, 3, " Channel: %s", _channelID); s_Usb->m_WiiMotes[0].SendL2capData(_channelID, _pData, _Size); LOGV(WII_IPC_WIIMOTE, 3, "========================================================="); |
