From 82cb4c0ca9efbbcc409339489ab91dcee8c5e96c Mon Sep 17 00:00:00 2001 From: "fires.gc" Date: Sun, 19 Oct 2008 21:17:08 +0000 Subject: [PATCH] WIP code for the wiimote ... wii creates a channel with PSM 0x11 now :) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@916 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp | 46 +++- .../Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.h | 2 + .../Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp | 249 ++++++++++++------ .../Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.h | 6 +- .../Core/Src/IPC_HLE/WiiMote_HID_Attr.cpp | 187 +++++++++---- .../Core/Core/Src/IPC_HLE/WiiMote_HID_Attr.h | 2 + Source/Core/Core/Src/IPC_HLE/hci.h | 9 + .../Plugins/Plugin_DSP_LLE/Res/resources.rc | 3 +- 8 files changed, 374 insertions(+), 130 deletions(-) diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp index 73851051a6..0a5f114d3a 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp @@ -659,7 +659,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventNumberOfCompletedPackets(u16 CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle); if (pWiiMote == NULL) { - PanicAlert("Cant find WiiMote by connection handle: %02x", _connectionHandle); + PanicAlert("SendEventNumberOfCompletedPackets: Cant find WiiMote by connection handle %02x", _connectionHandle); return false; } @@ -682,6 +682,33 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventNumberOfCompletedPackets(u16 return true; } +bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventAuthenticationCompleted(u16 _connectionHandle) +{ + CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle); + if (pWiiMote == NULL) + { + PanicAlert("SendEventAuthenticationCompleted: Cant find WiiMote by connection handle %02x", _connectionHandle); + return false; + } + + SQueuedEvent Event(sizeof(SHCIEventAuthenticationCompleted)); + + SHCIEventAuthenticationCompleted* pEventAuthenticationCompleted = (SHCIEventAuthenticationCompleted*)Event.m_buffer; + pEventAuthenticationCompleted->EventType = 0x13; + pEventAuthenticationCompleted->PayloadLength = sizeof(SHCIEventReadRemoteFeatures) - 2; + pEventAuthenticationCompleted->value = 1; + pEventAuthenticationCompleted->Connection_Handle = _connectionHandle; + + AddEventToQueue(Event); + + // Log + LOG(WIIMOTE, "Event: SendEventAuthenticationCompleted"); + LOG(WIIMOTE, " Connection_Handle: 0x%04x", pEventAuthenticationCompleted->Connection_Handle); + + return true; +} + + //////////////////////////////////////////////////////////////////////////////////////////////////// // // @@ -811,6 +838,10 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::ExecuteHCICommandMessage(const SHCICom CommandWriteLinkPolicy(pInput); break; + case HCI_CMD_AUTH_REQ: + CommandAuthenticationRequested(pInput); + break; + // // --- default --- // @@ -1367,6 +1398,19 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteLinkPolicy(u8* _Input) pWiimote->Connect(); } +void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandAuthenticationRequested(u8* _Input) +{ + // command parameters + hci_auth_req_cp* pAuthReq = (hci_auth_req_cp*)_Input; + + LOG(WIIMOTE, "Command: HCI_CMD_AUTH_REQ"); + LOG(WIIMOTE, "Input:"); + LOG(WIIMOTE, " ConnectionHandle: 0x%04x", pAuthReq->con_handle); + + SendEventCommandStatus(HCI_CMD_AUTH_REQ); + SendEventAuthenticationCompleted(pAuthReq->con_handle); +} + //////////////////////////////////////////////////////////////////////////////////////////////////// // // diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.h index fae6a1ba1a..96dd75711e 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.h @@ -139,6 +139,7 @@ private: bool SendEventReadRemoteFeatures(u16 _connectionHandle); bool SendEventRoleChange(bdaddr_t _bd); bool SendEventNumberOfCompletedPackets(u16 _connectionHandle); + bool SendEventAuthenticationCompleted(u16 _connectionHandle); void ExecuteHCICommandMessage(const SHCICommandMessage& _rCtrlMessage); @@ -170,6 +171,7 @@ private: void CommandReadRemoteVerInfo(u8* _Input); void CommandReadRemoteFeatures(u8* _Input); void CommandWriteLinkPolicy(u8* _Input); + void CommandAuthenticationRequested(u8* _Input); void SendToDevice(u16 _ConnectionHandle, u8* _pData, u32 _Size); 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 ab1073ce52..cbc911e723 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 @@ -119,6 +119,18 @@ struct SL2CAP_CommandConfigurationResponse // 0x05 u16 result; }; +struct SL2CAP_CommandDisconnectionReq // 0x06 +{ + u16 dcid; + u16 scid; +}; + +struct SL2CAP_CommandDisconnectionResponse // 0x07 +{ + u16 dcid; + u16 scid; +}; + #if defined(_MSC_VER) #pragma pack(pop) #endif @@ -346,6 +358,7 @@ void CWII_IPC_HLE_WiiMote::SignalChannel(u8* _pData, u32 _Size) break; case L2CAP_DISCONN_REQ: + CommandDisconnectionReq(pCommand->ident, _pData, pCommand->len); PanicAlert("SignalChannel - L2CAP_DISCONN_REQ (something went wrong)",pCommand->code); break; @@ -562,6 +575,28 @@ void CWII_IPC_HLE_WiiMote::CommandConnectionResponse(u8 _Ident, u8* _pData, u32 SendConfigurationRequest(rsp->scid); } +void CWII_IPC_HLE_WiiMote::CommandDisconnectionReq(u8 _Ident, u8* _pData, u32 _Size) +{ + SL2CAP_CommandDisconnectionReq* pCommandDisconnectionReq = (SL2CAP_CommandDisconnectionReq*)_pData; + + // create the channel + _dbg_assert_(WIIMOTE, m_Channel.find(pCommandDisconnectionReq->scid) != m_Channel.end()); + + LOG(WIIMOTE, " CommandDisconnectionReq"); + LOG(WIIMOTE, " Ident: 0x%02x", _Ident); + LOG(WIIMOTE, " SCID: 0x%04x", pCommandDisconnectionReq->dcid); + LOG(WIIMOTE, " DCID: 0x%04x", pCommandDisconnectionReq->scid); + + // response + SL2CAP_CommandDisconnectionResponse Rsp; + Rsp.scid = pCommandDisconnectionReq->scid; + Rsp.dcid = pCommandDisconnectionReq->dcid; + + SendCommandToACL(_Ident, L2CAP_DISCONN_RSP, sizeof(SL2CAP_CommandDisconnectionResponse), (u8*)&Rsp); +} + + + void CWII_IPC_HLE_WiiMote::CommandCofigurationResponse(u8 _Ident, u8* _pData, u32 _Size) { #ifdef LOGGING l2cap_conf_rsp* rsp = (l2cap_conf_rsp*)_pData; @@ -583,11 +618,11 @@ void CWII_IPC_HLE_WiiMote::CommandCofigurationResponse(u8 _Ident, u8* _pData, u3 ///////////////////////////////////////////////////////////////////////////////////////////////// -#define SDP_UINT8 0x08 -#define SDP_UINT16 0x09 +#define SDP_UINT8 0x08 +#define SDP_UINT16 0x09 #define SDP_UINT32 0x0A -#define SDP_SEQ8 0x35 -#define SDP_SEQ16 0x36 +#define SDP_SEQ8 0x35 +#define SDP_SEQ16 0x36 @@ -611,22 +646,41 @@ void CWII_IPC_HLE_WiiMote::SDPSendServiceSearchResponse(u16 cid, u16 Transaction int Offset = 0; SL2CAP_Header* pHeader = (SL2CAP_Header*)&DataFrame[Offset]; Offset += sizeof(SL2CAP_Header); pHeader->CID = cid; - pHeader->Length = 0x14; buffer.Write8 (Offset, 0x03); Offset++; buffer.Write16(Offset, TransactionID); Offset += 2; // transaction ID buffer.Write16(Offset, 0x0009); Offset += 2; // param length buffer.Write16(Offset, 0x0001); Offset += 2; // TotalServiceRecordCount - buffer.Write16(Offset, 0x0001); Offset += 2; // CurrentServiceRecordCount - buffer.Write32(Offset, 0x1234ABCD); Offset += 4; // ServiceRecordHandleList[4] - buffer.Write8( Offset, 0x00); Offset++; // no continuation state; + buffer.Write16(Offset, 0x0001); Offset += 2; // CurrentServiceRecordCount + buffer.Write32(Offset, 0x10000); Offset += 4; // ServiceRecordHandleList[4] + buffer.Write8(Offset, 0x00); Offset++; // no continuation state; + pHeader->Length = Offset - sizeof(SL2CAP_Header); - - m_pHost->SendACLFrame(GetConnectionHandle(), DataFrame, Offset); + m_pHost->SendACLFrame(GetConnectionHandle(), DataFrame, pHeader->Length + sizeof(SL2CAP_Header)); } -void GetStartAndEndID(u8* pAttribIDList, u16& _startID, u16& _endID) +u32 ParseCont(u8* pCont) +{ + u32 attribOffset = 0; + CBigEndianBuffer attribList(pCont); + u8 typeID = attribList.Read8(attribOffset); attribOffset++; + + if (typeID == 0x02) + { + return attribList.Read16(attribOffset); + } + else if (typeID == 0x00) + { + return 0x00; + } + + PanicAlert("wrong cont: %i", typeID); + return 0; +} + + +int ParseAttribList(u8* pAttribIDList, u16& _startID, u16& _endID) { u32 attribOffset = 0; CBigEndianBuffer attribList(pAttribIDList); @@ -642,15 +696,83 @@ void GetStartAndEndID(u8* pAttribIDList, u16& _startID, u16& _endID) } else { - _startID = attribList.Read8(attribOffset); attribOffset += 2; + _startID = attribList.Read16(attribOffset); attribOffset += 2; _endID = _startID; PanicAlert("Read just a single attrib - not tested"); } + + return attribOffset; } -void CWII_IPC_HLE_WiiMote::SDPSendServiceAttributeResponse(u16 cid, u16 TransactionID, u32 ServiceHandle, u8* pAttribIDList, u16 AttribListIDSize) +u8 g_Buffer[2048]; +u32 g_Size = 0; + + +u32 GenerateAttribBuffer(u16 _startID, u16 _endID) { + CBigEndianBuffer buffer(g_Buffer); + int Offset = 0; + + buffer.Write8(Offset, SDP_SEQ16); Offset++; + + Offset += 2; // save some memory for seq size + + // walk through the table + const CAttribTable& rAttribTable = GetAttribTable(); + CAttribTable::const_iterator itr = rAttribTable.begin(); + + u32 sequenceSize = 0; + while(itr != rAttribTable.end()) + { + const SAttrib& rAttrib = *itr; + + if ((rAttrib.ID >= _startID) && (rAttrib.ID <= _endID)) + { + _dbg_assert_(WIIMOTE, rAttrib.size <= 230); + + // ATTRIB TYPE ID + buffer.Write8(Offset, SDP_UINT16); Offset ++; + buffer.Write16(Offset, rAttrib.ID); Offset += 2; + sequenceSize += 3; + + // RAW ATTRIB DATA + memcpy(buffer.GetPointer(Offset), rAttrib.pData, rAttrib.size); + Offset += rAttrib.size; + + sequenceSize += rAttrib.size; + } + itr++; + } + + buffer.Write16(1, sequenceSize); + + g_Size = Offset; + + + + return g_Size; +} + + +void CWII_IPC_HLE_WiiMote::SDPSendServiceAttributeResponse(u16 cid, u16 TransactionID, u32 ServiceHandle, + u16 startAttrID, u16 endAttrID, + u16 MaximumAttributeByteCount, u8* pContinuationState) +{ + if (ServiceHandle != 0x10000) + { + PanicAlert("unknown service handle %x" , ServiceHandle); + } + + +// _dbg_assert_(WIIMOTE, ServiceHandle == 0x10000); + + u32 contState = ParseCont(pContinuationState); + + u32 packetSize = 0; + const u8* pPacket = GetAttribPacket(ServiceHandle, contState, packetSize); + + // generate package u8 DataFrame[1000]; CBigEndianBuffer buffer(DataFrame); @@ -658,78 +780,39 @@ void CWII_IPC_HLE_WiiMote::SDPSendServiceAttributeResponse(u16 cid, u16 Transact SL2CAP_Header* pHeader = (SL2CAP_Header*)&DataFrame[Offset]; Offset += sizeof(SL2CAP_Header); pHeader->CID = cid; - buffer.Write8 (Offset, 0x05); Offset++; - buffer.Write16(Offset, TransactionID); Offset += 2; // transaction ID + buffer.Write8 (Offset, 0x05); Offset++; + buffer.Write16(Offset, TransactionID); Offset += 2; // transaction ID + + memcpy(buffer.GetPointer(Offset), pPacket, packetSize); Offset += packetSize; - { - u32 paraLenOffset = Offset; Offset += 2; - u32 AttributeListByteCountOffset = Offset; Offset += 2; - - buffer.Write8(Offset, SDP_SEQ16); Offset ++; // write 16 bit sequencer - u32 sequenceSizeOffset = Offset; Offset += 2; - - // get attrib range - u16 startAttrID; - u16 endAttrID; - GetStartAndEndID(pAttribIDList, startAttrID, endAttrID); - - // walk through the table - const CAttribTable& rAttribTable = GetAttribTable(); - CAttribTable::const_iterator itr = rAttribTable.begin(); - - u32 sequenceSize = 0; - while(itr != rAttribTable.end()) - { - const SAttrib& rAttrib = *itr; - - if ((rAttrib.ID >= startAttrID) && (rAttrib.ID <= endAttrID)) - { - _dbg_assert_(WIIMOTE, rAttrib.size <= 230); - - // ATTRIB TYPE ID - buffer.Write8(Offset, SDP_UINT16); Offset ++; - buffer.Write16(Offset, rAttrib.ID); Offset += 2; - sequenceSize += 3; - - // RAW ATTRIB DATA SEQ HEADER - buffer.Write8(Offset, SDP_SEQ8); Offset ++; - buffer.Write8(Offset, rAttrib.size); Offset ++; - sequenceSize += 2; - - // RAW ATTRIB DATA - memcpy(buffer.GetPointer(Offset), rAttrib.pData, rAttrib.size); - Offset += rAttrib.size; - - sequenceSize += rAttrib.size; - } - itr++; - } - buffer.Write16(sequenceSizeOffset, sequenceSize); - buffer.Write16(AttributeListByteCountOffset, sequenceSize + 4); // AttributeListByteCount - buffer.Write16(paraLenOffset, sequenceSize + 4 + 3); // param length - } - - buffer.Write8(Offset, 0x00); Offset++; // no continuation state; - pHeader->Length = Offset - sizeof(SL2CAP_Header); + m_pHost->SendACLFrame(GetConnectionHandle(), DataFrame, pHeader->Length + sizeof(SL2CAP_Header)); // dump raw data { - LOG(WIIMOTE, "test response: 0x%x", GetConnectionHandle()); - std::string Temp; - for (u32 j=0; jLength + sizeof(SL2CAP_Header); j++) + LOG(WIIMOTE, "test response: 0x%x", GetConnectionHandle()); + for (u32 j=0; jLength + sizeof(SL2CAP_Header);) { - char Buffer[128]; - sprintf(Buffer, "%02x ", DataFrame[j]); - Temp.append(Buffer); + std::string Temp; + for (int i=0; i<16; i++) + { + char Buffer[128]; + sprintf(Buffer, "%02x ", DataFrame[j++]); + Temp.append(Buffer); + + if (j >= pHeader->Length + sizeof(SL2CAP_Header)) + break; + } + + LOG(WIIMOTE, " Data: %s", Temp.c_str()); } - LOG(WIIMOTE, " Data: %s", Temp.c_str()); + } - m_pHost->SendACLFrame(GetConnectionHandle(), DataFrame, pHeader->Length + sizeof(SL2CAP_Header)); + } void CWII_IPC_HLE_WiiMote::HandleSDP(u16 cid, u8* _pData, u32 _Size) @@ -775,15 +858,17 @@ void CWII_IPC_HLE_WiiMote::HandleSDP(u16 cid, u8* _pData, u32 _Size) { LOG(WIIMOTE, "!!! SDP_ServiceAttributeRequest !!!"); - u16 TransactionID = buffer.Read16(1); - u16 ParameterLength = buffer.Read16(3); - u32 ServiceHandle = buffer.Read32(5); - u16 MaximumAttributeByteCount = buffer.Read16(9); // MaximumAttributeByteCount - u8* pAttribIDList = buffer.GetPointer(11); - u8 ContinuationState = buffer.Read8(16); + u16 startAttrID, endAttrID; + u32 offset = 1; - u8 AttribListIDSize = ParameterLength - sizeof(ContinuationState) - sizeof(ServiceHandle) -sizeof(MaximumAttributeByteCount); - SDPSendServiceAttributeResponse(cid, TransactionID, ServiceHandle, pAttribIDList, AttribListIDSize); + u16 TransactionID = buffer.Read16(offset); offset += 2; + u16 ParameterLength = buffer.Read16(offset); offset += 2; + u32 ServiceHandle = buffer.Read32(offset); offset += 4; + u16 MaximumAttributeByteCount = buffer.Read16(offset); offset += 2; + offset += ParseAttribList(buffer.GetPointer(offset), startAttrID, endAttrID); + u8* pContinuationState = buffer.GetPointer(offset); + + SDPSendServiceAttributeResponse(cid, TransactionID, ServiceHandle, startAttrID, endAttrID, MaximumAttributeByteCount, pContinuationState); } break; @@ -791,4 +876,4 @@ void CWII_IPC_HLE_WiiMote::HandleSDP(u16 cid, u8* _pData, u32 _Size) PanicAlert("Unknown SDP command %x", _pData[0]); break; } -} \ No newline at end of file +} \ No newline at end of file diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.h index d95066e528..e7d0940ca4 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.h @@ -153,6 +153,7 @@ private: void CommandConnectionReq(u8 _Ident, u8* _pData, u32 _Size); void CommandCofigurationReq(u8 _Ident, u8* _pData, u32 _Size); void CommandConnectionResponse(u8 _Ident, u8* _pData, u32 _Size); + void CommandDisconnectionReq(u8 _Ident, u8* _pData, u32 _Size); void CommandCofigurationResponse(u8 _Ident, u8* _pData, u32 _Size); @@ -163,7 +164,10 @@ private: // void HandleSDP(u16 cid, u8* _pData, u32 _Size); void SDPSendServiceSearchResponse(u16 cid, u16 TransactionID, u8* pServiceSearchPattern, u16 MaximumServiceRecordCount); - void SDPSendServiceAttributeResponse(u16 cid, u16 TransactionID, u32 ServiceHandle, u8* pAttribIDList, u16 AttribListIDSize); + + void SDPSendServiceAttributeResponse(u16 cid, u16 TransactionID, u32 ServiceHandle, + u16 startAttrID, u16 endAttrID, + u16 MaximumAttributeByteCount, u8* pContinuationState); u16 AddAttribToList(int attribID, u8* pBuffer); }; diff --git a/Source/Core/Core/Src/IPC_HLE/WiiMote_HID_Attr.cpp b/Source/Core/Core/Src/IPC_HLE/WiiMote_HID_Attr.cpp index fea6e594b5..440b5b8ece 100644 --- a/Source/Core/Core/Src/IPC_HLE/WiiMote_HID_Attr.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WiiMote_HID_Attr.cpp @@ -22,37 +22,39 @@ CAttribTable m_AttribTable; -// 0x00 +// 0x00 (checked) u8 ServiceRecordHandle[] = { 0x0a, 0x00, 0x01, 0x00, 0x00 }; -// 0x01 +// 0x01 (checked) u8 SrvClassIDList[] = { 0x35, 0x03, 0x19, 0x11, 0x24 }; -// 0x04 +// 0x04 (checked) u8 ProtocolDescriptorList[] = { 0x35, 0x0D, 0x35, 0x06, 0x19, 0x01, 0x00, // Element 0 0x09, 0x00, 0x11, // Element 1 0x35, 0x03, 0x19, 0x00, 0x11}; // Element 0 -// 0x5 -u8 BrowseGroupList[] = { 0x35, 0x03, 0x09, 0x10, 0x02 }; -// 0x6 +// 0x5 (checked) +u8 BrowseGroupList[] = { 0x35, 0x03, + 0x19, 0x10, 0x02 }; +// 0x6 (checked) u8 LanguageBaseAttributeIDList[] = { 0x35, 0x09, 0x09, 0x65, 0x6e, 0x09, 0x00, 0x6a, 0x09, 0x01, 0x00 }; -// 0x09 +// 0x09 (checked) u8 BluetoothProfileDescriptorList[] = { 0x35, 0x08, 0x35, 0x06, - 0x19, 0x00, 0x11, + 0x19, 0x11, 0x24, 0x09, 0x01, 0x00 }; -// 0x0D -u8 AdditionalProtocolDescriptorLists[] = { 0x35, 0x0a, - 0x35, 0x03, - 0x19, 0x01, 0x00, - 0x09, 0x00, 0x13, - 0x35, 0x03, - 0x19, 0x00, 0x11 }; +// 0x0D (checked) +u8 AdditionalProtocolDescriptorLists[] = { 0x35, 0x0F, + 0x35, 0x0D, + 0x35, 0x06, + 0x19, 0x01, 0x00, + 0x09, 0x00, 0x13, + 0x35, 0x03, + 0x19, 0x00, 0x11 }; // 0x100 u8 ServiceName[] = { 0x25, 0x13, 'N','i','n','t','e','n','d','o',' ','R','V','L','-','C','N','T','-','0','1' }; // 0x101 @@ -76,37 +78,37 @@ u8 HIDReconnectInitiate[] = { 0x09, 0x00, 0x01 }; // 0x206 u8 HIDDescriptorList[] = { 0x35, 0xDF, 0x35, 0xDD, - 0x08, 0x22, // Element 0 - 0x25, 0xD9, + 0x08, 0x22, // Element 0 + 0x25, 0xD9, // hmm... <- 0x25 is a string but there is Data // 0xD9 Bytes - Element 1 - 0x05, 0x01, 0x09, 0x05, 0xa1, 0x01, 0x85, 0x10, - 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, - 0x01, 0x06, 0x00, 0xff, 0x09, 0x01, 0x91, 0x00, - 0x85, 0x11, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, - 0x85, 0x12, 0x95, 0x02, 0x09, 0x01, 0x91, 0x00, - 0x85, 0x13, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, - 0x85, 0x14, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, - 0x85, 0x15, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, - 0x85, 0x16, 0x95, 0x15, 0x09, 0x01, 0x91, 0x00, - 0x85, 0x17, 0x95, 0x06, 0x09, 0x01, 0x91, 0x00, - 0x85, 0x18, 0x95, 0x15, 0x09, 0x01, 0x91, 0x00, - 0x85, 0x19, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, - 0x85, 0x1a, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, - 0x85, 0x20, 0x95, 0x06, 0x09, 0x01, 0x81, 0x00, - 0x85, 0x21, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00, - 0x85, 0x22, 0x95, 0x04, 0x09, 0x01, 0x81, 0x00, - 0x85, 0x30, 0x95, 0x02, 0x09, 0x01, 0x81, 0x00, - 0x85, 0x31, 0x95, 0x05, 0x09, 0x01, 0x81, 0x00, - 0x85, 0x32, 0x95, 0x0a, 0x09, 0x01, 0x81, 0x00, - 0x85, 0x33, 0x95, 0x11, 0x09, 0x01, 0x81, 0x00, - 0x85, 0x34, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00, - 0x85, 0x35, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00, - 0x85, 0x36, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00, - 0x85, 0x37, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00, - 0x85, 0x3d, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00, - 0x85, 0x3e, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00, - 0x85, 0x3f, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00, + 0x05, 0x01, 0x09, 0x05, 0xa1, 0x01, 0x85, 0x10, + 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, + 0x01, 0x06, 0x00, 0xff, 0x09, 0x01, 0x91, 0x00, + 0x85, 0x11, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, + 0x85, 0x12, 0x95, 0x02, 0x09, 0x01, 0x91, 0x00, + 0x85, 0x13, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, + 0x85, 0x14, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, + 0x85, 0x15, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, + 0x85, 0x16, 0x95, 0x15, 0x09, 0x01, 0x91, 0x00, + 0x85, 0x17, 0x95, 0x06, 0x09, 0x01, 0x91, 0x00, + 0x85, 0x18, 0x95, 0x15, 0x09, 0x01, 0x91, 0x00, + 0x85, 0x19, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, + 0x85, 0x1a, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, + 0x85, 0x20, 0x95, 0x06, 0x09, 0x01, 0x81, 0x00, + 0x85, 0x21, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00, + 0x85, 0x22, 0x95, 0x04, 0x09, 0x01, 0x81, 0x00, + 0x85, 0x30, 0x95, 0x02, 0x09, 0x01, 0x81, 0x00, + 0x85, 0x31, 0x95, 0x05, 0x09, 0x01, 0x81, 0x00, + 0x85, 0x32, 0x95, 0x0a, 0x09, 0x01, 0x81, 0x00, + 0x85, 0x33, 0x95, 0x11, 0x09, 0x01, 0x81, 0x00, + 0x85, 0x34, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00, + 0x85, 0x35, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00, + 0x85, 0x36, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00, + 0x85, 0x37, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00, + 0x85, 0x3d, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00, + 0x85, 0x3e, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00, + 0x85, 0x3f, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00, 0xc0 }; // end tag @@ -127,11 +129,106 @@ u8 HIDUnk_020B[] = { 0x09, 0x01, 0x00 }; // 0x20c u8 HIDUnk_020C[] = { 0x09, 0x0c, 0x80 }; // 0x20d -u8 HIDUnk_020D[] = { 0x09, 0x00, 0x00 }; +u8 HIDUnk_020D[] = { 0x28, 0x00 }; // 0x20e u8 HIDBootDevice[] = { 0x28, 0x00 }; +u8 packet1[] = { + 0x00, 0x7b, 0x00, 0x76, 0x36, 0x01, 0xcc, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x01, + 0x00, 0x00, 0x09, 0x00, 0x01, 0x35, 0x03, 0x19, 0x11, 0x24, 0x09, 0x00, 0x04, 0x35, 0x0d, 0x35, + 0x06, 0x19, 0x01, 0x00, 0x09, 0x00, 0x11, 0x35, 0x03, 0x19, 0x00, 0x11, 0x09, 0x00, 0x05, 0x35, + 0x03, 0x19, 0x10, 0x02, 0x09, 0x00, 0x06, 0x35, 0x09, 0x09, 0x65, 0x6e, 0x09, 0x00, 0x6a, 0x09, + 0x01, 0x00, 0x09, 0x00, 0x09, 0x35, 0x08, 0x35, 0x06, 0x19, 0x11, 0x24, 0x09, 0x01, 0x00, 0x09, + 0x00, 0x0d, 0x35, 0x0f, 0x35, 0x0d, 0x35, 0x06, 0x19, 0x01, 0x00, 0x09, 0x00, 0x13, 0x35, 0x03, + 0x19, 0x00, 0x11, 0x09, 0x01, 0x00, 0x25, 0x13, 0x4e, 0x69, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x6f, + 0x20, 0x52, 0x56, 0x4c, 0x2d, 0x43, 0x4e, 0x54, 0x2d, 0x30, 0x31, 0x09, 0x01, 0x02, 0x00, 0x76, +}; + +u8 packet2[] = { + 0x00, 0x7b, 0x00, 0x76, 0x01, 0x25, 0x13, 0x4e, 0x69, 0x6e, 0x74, 0x65, 0x6e, + 0x64, 0x6f, 0x20, 0x52, 0x56, 0x4c, 0x2d, 0x43, 0x4e, 0x54, 0x2d, 0x30, 0x31, 0x09, 0x01, 0x02, + 0x25, 0x08, 0x4e, 0x69, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x6f, 0x09, 0x02, 0x00, 0x09, 0x01, 0x00, + 0x09, 0x02, 0x01, 0x09, 0x01, 0x11, 0x09, 0x02, 0x02, 0x08, 0x04, 0x09, 0x02, 0x03, 0x08, 0x33, + 0x09, 0x02, 0x04, 0x28, 0x00, 0x09, 0x02, 0x05, 0x28, 0x01, 0x09, 0x02, 0x06, 0x35, 0xdf, 0x35, + 0xdd, 0x08, 0x22, 0x25, 0xd9, 0x05, 0x01, 0x09, 0x05, 0xa1, 0x01, 0x85, 0x10, 0x15, 0x00, 0x26, + 0xff, 0x00, 0x75, 0x08, 0x95, 0x01, 0x06, 0x00, 0xff, 0x09, 0x01, 0x91, 0x00, 0x85, 0x11, 0x95, + 0x01, 0x09, 0x01, 0x91, 0x00, 0x85, 0x12, 0x95, 0x02, 0x09, 0x01, 0x91, 0x00, 0x02, 0x00, 0xec, +}; + +u8 packet3[] = { + + 0x00, 0x7b, 0x00, 0x76, 0x85, 0x13, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, 0x85, + 0x14, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, 0x85, 0x15, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, 0x85, + 0x16, 0x95, 0x15, 0x09, 0x01, 0x91, 0x00, 0x85, 0x17, 0x95, 0x06, 0x09, 0x01, 0x91, 0x00, 0x85, + 0x18, 0x95, 0x15, 0x09, 0x01, 0x91, 0x00, 0x85, 0x19, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, 0x85, + 0x1a, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, 0x85, 0x20, 0x95, 0x06, 0x09, 0x01, 0x81, 0x00, 0x85, + 0x21, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00, 0x85, 0x22, 0x95, 0x04, 0x09, 0x01, 0x81, 0x00, 0x85, + 0x30, 0x95, 0x02, 0x09, 0x01, 0x81, 0x00, 0x85, 0x31, 0x95, 0x05, 0x09, 0x01, 0x81, 0x00, 0x85, + 0x32, 0x95, 0x0a, 0x09, 0x01, 0x81, 0x00, 0x85, 0x33, 0x95, 0x11, 0x09, 0x01, 0x02, 0x01, 0x62, +}; + +u8 packet4[] = { + 0x00, 0x70, 0x00, 0x6d, 0x81, 0x00, 0x85, 0x34, 0x95, 0x15, 0x09, 0x01, 0x81, + 0x00, 0x85, 0x35, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00, 0x85, 0x36, 0x95, 0x15, 0x09, 0x01, 0x81, + 0x00, 0x85, 0x37, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00, 0x85, 0x3d, 0x95, 0x15, 0x09, 0x01, 0x81, + 0x00, 0x85, 0x3e, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00, 0x85, 0x3f, 0x95, 0x15, 0x09, 0x01, 0x81, + 0x00, 0xc0, 0x09, 0x02, 0x07, 0x35, 0x08, 0x35, 0x06, 0x09, 0x04, 0x09, 0x09, 0x01, 0x00, 0x09, + 0x02, 0x08, 0x28, 0x00, 0x09, 0x02, 0x09, 0x28, 0x01, 0x09, 0x02, 0x0a, 0x28, 0x01, 0x09, 0x02, + 0x0b, 0x09, 0x01, 0x00, 0x09, 0x02, 0x0c, 0x09, 0x0c, 0x80, 0x09, 0x02, 0x0d, 0x28, 0x00, 0x09, + 0x02, 0x0e, 0x28, 0x00, 0x00, + +}; + + +u8 packet4_0x10001[] = { + 0x00, 0x60, 0x00, 0x5d, 0x36, 0x00, 0x5a, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x01, + 0x00, 0x01, 0x09, 0x00, 0x01, 0x35, 0x03, 0x19, 0x12, 0x00, 0x09, 0x00, 0x04, 0x35, 0x0d, 0x35, + 0x06, 0x19, 0x01, 0x00, 0x09, 0x00, 0x01, 0x35, 0x03, 0x19, 0x00, 0x01, 0x09, 0x00, 0x05, 0x35, + 0x03, 0x19, 0x10, 0x02, 0x09, 0x00, 0x09, 0x35, 0x08, 0x35, 0x06, 0x19, 0x12, 0x00, 0x09, 0x01, + 0x00, 0x09, 0x02, 0x00, 0x09, 0x01, 0x00, 0x09, 0x02, 0x01, 0x09, 0x05, 0x7e, 0x09, 0x02, 0x02, + 0x09, 0x03, 0x06, 0x09, 0x02, 0x03, 0x09, 0x06, 0x00, 0x09, 0x02, 0x04, 0x28, 0x01, 0x09, 0x02, + 0x05, 0x09, 0x00, 0x02, 0x00, +}; + + + +const u8* GetAttribPacket(u32 serviceHandle, u32 cont, u32& _size) +{ + if (serviceHandle == 0x10000) + { + if (cont == 0) + { + _size = sizeof(packet1); + return packet1; + } + else if (cont == 0x76) + { + _size = sizeof(packet2); + return packet2; + } + else if (cont == 0xec) + { + _size = sizeof(packet3); + return packet3; + } + else if (cont == 0x162) + { + _size = sizeof(packet4); + return packet4; + } + } + + if (serviceHandle == 0x10001) + { + _dbg_assert_(WIIMOTE, cont == 0x00); + _size = sizeof(packet4_0x10001); + return packet4_0x10001; + } + + return 0; +} + void InitAttribTable() { m_AttribTable.push_back(SAttrib(0x00, ServiceRecordHandle, sizeof(ServiceRecordHandle))); diff --git a/Source/Core/Core/Src/IPC_HLE/WiiMote_HID_Attr.h b/Source/Core/Core/Src/IPC_HLE/WiiMote_HID_Attr.h index 3b60ee7456..e6aeca6803 100644 --- a/Source/Core/Core/Src/IPC_HLE/WiiMote_HID_Attr.h +++ b/Source/Core/Core/Src/IPC_HLE/WiiMote_HID_Attr.h @@ -35,4 +35,6 @@ typedef std::vector CAttribTable; const CAttribTable& GetAttribTable(); +const u8* GetAttribPacket(u32 serviceHandle, u32 cont, u32& _size); + #endif \ No newline at end of file diff --git a/Source/Core/Core/Src/IPC_HLE/hci.h b/Source/Core/Core/Src/IPC_HLE/hci.h index 20e0115f03..ab5223a24b 100644 --- a/Source/Core/Core/Src/IPC_HLE/hci.h +++ b/Source/Core/Core/Src/IPC_HLE/hci.h @@ -2505,6 +2505,15 @@ struct SHCIEventNumberOfCompletedPackets u16 Number_Of_Completed_Packets; }; +struct SHCIEventAuthenticationCompleted +{ + u8 EventType; + u8 PayloadLength; + u8 value; + u16 Connection_Handle; +}; + + #ifdef __cplusplus } #endif diff --git a/Source/Plugins/Plugin_DSP_LLE/Res/resources.rc b/Source/Plugins/Plugin_DSP_LLE/Res/resources.rc index 119abe4430..030efd07b1 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Res/resources.rc +++ b/Source/Plugins/Plugin_DSP_LLE/Res/resources.rc @@ -316,7 +316,8 @@ END // // Generated from the TEXTINCLUDE 3 resource. // - + + ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED