Bug Summary

File:Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp
Location:line 1524, column 2
Description:Function call argument is an uninitialized value

Annotated Source Code

1// Copyright 2013 Dolphin Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#include "../Core.h"
6#include "../Debugger/Debugger_SymbolMap.h"
7#include "../Host.h"
8#include "../HW/SystemTimers.h"
9#include "../HW/Wiimote.h"
10#include "../HW/WII_IPC.h"
11#include "WII_IPC_HLE.h"
12#include "WII_IPC_HLE_Device_usb.h"
13#include "../ConfigManager.h"
14#include "../Movie.h"
15#include "CoreTiming.h"
16
17// The device class
18CWII_IPC_HLE_Device_usb_oh1_57e_305::CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _DeviceID, const std::string& _rDeviceName)
19 : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
20 , m_ScanEnable(0)
21 , m_HCIEndpoint(0)
22 , m_ACLEndpoint(0)
23 , m_last_ticks(0)
24{
25 // Activate only first Wiimote by default
26
27 _conf_pads BT_DINF;
28 SetUsbPointer(this);
29 if (!SConfig::GetInstance().m_SYSCONF->GetArrayData("BT.DINF", (u8*)&BT_DINF, sizeof(_conf_pads)))
30 {
31 PanicAlertT("Trying to read from invalid SYSCONF\nWiimote bt ids are not available")MsgAlert(false, WARNING, "Trying to read from invalid SYSCONF\nWiimote bt ids are not available"
)
;
32 }
33 else
34 {
35 bdaddr_t tmpBD = BDADDR_ANY{ { 0, 0, 0, 0, 0, 0 } };
36 u8 i = 0;
37 while (i < MAX_BBMOTES)
38 {
39 if (i < BT_DINF.num_registered)
40 {
41 tmpBD.b[5] = BT_DINF.active[i].bdaddr[0] = BT_DINF.registered[i].bdaddr[0];
42 tmpBD.b[4] = BT_DINF.active[i].bdaddr[1] = BT_DINF.registered[i].bdaddr[1];
43 tmpBD.b[3] = BT_DINF.active[i].bdaddr[2] = BT_DINF.registered[i].bdaddr[2];
44 tmpBD.b[2] = BT_DINF.active[i].bdaddr[3] = BT_DINF.registered[i].bdaddr[3];
45 tmpBD.b[1] = BT_DINF.active[i].bdaddr[4] = BT_DINF.registered[i].bdaddr[4];
46 tmpBD.b[0] = BT_DINF.active[i].bdaddr[5] = BT_DINF.registered[i].bdaddr[5];
47 }
48 else
49 {
50 tmpBD.b[5] = BT_DINF.active[i].bdaddr[0] = BT_DINF.registered[i].bdaddr[0] = i;
51 tmpBD.b[4] = BT_DINF.active[i].bdaddr[1] = BT_DINF.registered[i].bdaddr[1] = 0;
52 tmpBD.b[3] = BT_DINF.active[i].bdaddr[2] = BT_DINF.registered[i].bdaddr[2] = 0x79;
53 tmpBD.b[2] = BT_DINF.active[i].bdaddr[3] = BT_DINF.registered[i].bdaddr[3] = 0x19;
54 tmpBD.b[1] = BT_DINF.active[i].bdaddr[4] = BT_DINF.registered[i].bdaddr[4] = 2;
55 tmpBD.b[0] = BT_DINF.active[i].bdaddr[5] = BT_DINF.registered[i].bdaddr[5] = 0x11;
56 }
57
58 const char* wmName;
59 if (i == WIIMOTE_BALANCE_BOARD)
60 wmName = "Nintendo RVL-WBC-01";
61 else
62 wmName = "Nintendo RVL-CNT-01";
63 memcpy(BT_DINF.registered[i].name, wmName, 20);
64 memcpy(BT_DINF.active[i].name, wmName, 20);
65
66 INFO_LOG(WII_IPC_WIIMOTE, "Wiimote %d BT ID %x,%x,%x,%x,%x,%x", i, tmpBD.b[0], tmpBD.b[1], tmpBD.b[2], tmpBD.b[3], tmpBD.b[4], tmpBD.b[5])do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 66, "Wiimote %d BT ID %x,%x,%x,%x,%x,%x", i, tmpBD.b[0], tmpBD
.b[1], tmpBD.b[2], tmpBD.b[3], tmpBD.b[4], tmpBD.b[5]); } } while
(0)
;
67 m_WiiMotes.push_back(CWII_IPC_HLE_WiiMote(this, i, tmpBD, false));
68 i++;
69 }
70
71 // save now so that when games load sysconf file it includes the new wiimotes
72 // and the correct order for connected wiimotes
73 if (!SConfig::GetInstance().m_SYSCONF->SetArrayData("BT.DINF", (u8*)&BT_DINF, sizeof(_conf_pads)) || !SConfig::GetInstance().m_SYSCONF->Save())
74 PanicAlertT("Failed to write BT.DINF to SYSCONF")MsgAlert(false, WARNING, "Failed to write BT.DINF to SYSCONF"
)
;
75 }
76
77 // The BCM2045's btaddr:
78 m_ControllerBD.b[0] = 0x11;
79 m_ControllerBD.b[1] = 0x02;
80 m_ControllerBD.b[2] = 0x19;
81 m_ControllerBD.b[3] = 0x79;
82 m_ControllerBD.b[4] = 0x00;
83 m_ControllerBD.b[5] = 0xFF;
84
85 memset(m_PacketCount, 0, sizeof(m_PacketCount));
86
87 Host_SetWiiMoteConnectionState(0);
88}
89
90CWII_IPC_HLE_Device_usb_oh1_57e_305::~CWII_IPC_HLE_Device_usb_oh1_57e_305()
91{
92 m_WiiMotes.clear();
93 SetUsbPointer(NULL__null);
94}
95
96void CWII_IPC_HLE_Device_usb_oh1_57e_305::DoState(PointerWrap &p)
97{
98 p.Do(m_Active);
99 p.Do(m_ControllerBD);
100 p.Do(m_CtrlSetup);
101 p.Do(m_ACLSetup);
102 p.DoPOD(m_HCIEndpoint);
103 p.DoPOD(m_ACLEndpoint);
104 p.Do(m_last_ticks);
105 p.DoArray(m_PacketCount,MAX_BBMOTES);
106 p.Do(m_ScanEnable);
107 p.Do(m_EventQueue);
108 m_acl_pool.DoState(p);
109
110 for (unsigned int i = 0; i < MAX_BBMOTES; i++)
111 m_WiiMotes[i].DoState(p);
112}
113
114bool CWII_IPC_HLE_Device_usb_oh1_57e_305::RemoteDisconnect(u16 _connectionHandle)
115{
116 return SendEventDisconnect(_connectionHandle, 0x13);
117}
118
119bool CWII_IPC_HLE_Device_usb_oh1_57e_305::Open(u32 _CommandAddress, u32 _Mode)
120{
121 m_ScanEnable = 0;
122
123 m_last_ticks = 0;
124 memset(m_PacketCount, 0, sizeof(m_PacketCount));
125
126 m_HCIEndpoint.m_address = 0;
127 m_ACLEndpoint.m_address = 0;
128
129 Memory::Write_U32(GetDeviceID(), _CommandAddress + 4);
130 m_Active = true;
131 return true;
132}
133
134bool CWII_IPC_HLE_Device_usb_oh1_57e_305::Close(u32 _CommandAddress, bool _bForce)
135{
136 m_ScanEnable = 0;
137
138 m_last_ticks = 0;
139 memset(m_PacketCount, 0, sizeof(m_PacketCount));
140
141 m_HCIEndpoint.m_address = 0;
142 m_ACLEndpoint.m_address = 0;
143
144 if (!_bForce)
145 Memory::Write_U32(0, _CommandAddress + 4);
146 m_Active = false;
147 return true;
148}
149
150bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtl(u32 _CommandAddress)
151{
152 //ERROR_LOG(WII_IPC_WIIMOTE, "Passing ioctl to ioctlv");
153 return IOCtlV(_CommandAddress); //hack
154}
155
156bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtlV(u32 _CommandAddress)
157{
158/*
159 Memory::Write_U8(255, 0x80149950); // BTM LOG // 3 logs L2Cap // 4 logs l2_csm$
160 Memory::Write_U8(255, 0x80149949); // Security Manager
161 Memory::Write_U8(255, 0x80149048); // HID
162 Memory::Write_U8(3, 0x80152058); // low ?? // >= 4 and you will get a lot of event messages of the same type
163 Memory::Write_U8(1, 0x80152018); // WUD
164 Memory::Write_U8(1, 0x80151FC8); // DEBUGPrint
165 Memory::Write_U8(1, 0x80151488); // WPAD_LOG
166 Memory::Write_U8(1, 0x801514A8); // USB_LOG
167 Memory::Write_U8(1, 0x801514D8); // WUD_DEBUGPrint
168 Memory::Write_U8(1, 0x80148E09); // HID LOG
169*/
170
171 bool _SendReply = false;
172
173 SIOCtlVBuffer CommandBuffer(_CommandAddress);
174
175 switch (CommandBuffer.Parameter)
176 {
177 case USBV0_IOCTL_CTRLMSG: // HCI command is received from the stack
178 {
179 // This is the HCI datapath from CPU to Wiimote, the USB stuff is little endian..
180 m_CtrlSetup.bRequestType = *( u8*)Memory::GetPointer(CommandBuffer.InBuffer[0].m_Address);
181 m_CtrlSetup.bRequest = *( u8*)Memory::GetPointer(CommandBuffer.InBuffer[1].m_Address);
182 m_CtrlSetup.wValue = *(u16*)Memory::GetPointer(CommandBuffer.InBuffer[2].m_Address);
183 m_CtrlSetup.wIndex = *(u16*)Memory::GetPointer(CommandBuffer.InBuffer[3].m_Address);
184 m_CtrlSetup.wLength = *(u16*)Memory::GetPointer(CommandBuffer.InBuffer[4].m_Address);
185 m_CtrlSetup.m_PayLoadAddr = CommandBuffer.PayloadBuffer[0].m_Address;
186 m_CtrlSetup.m_PayLoadSize = CommandBuffer.PayloadBuffer[0].m_Size;
187 m_CtrlSetup.m_Address = CommandBuffer.m_Address;
188
189 // check termination
190 _dbg_assert_msg_(WII_IPC_WIIMOTE, *(u8*)Memory::GetPointer(CommandBuffer.InBuffer[5].m_Address) == 0,{}
191 "WIIMOTE: Termination != 0"){};
192
193 #if 0 // this log can get really annoying
194 DEBUG_LOG(WII_IPC_WIIMOTE, "USB_IOCTL_CTRLMSG (0x%08x) - execute command", _CommandAddress)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 194, "USB_IOCTL_CTRLMSG (0x%08x) - execute command", _CommandAddress
); } } while (0)
;
195 DEBUG_LOG(WII_IPC_WIIMOTE, " bRequestType: 0x%x", m_CtrlSetup.bRequestType)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 195, " bRequestType: 0x%x", m_CtrlSetup.bRequestType); }
} while (0)
;
196 DEBUG_LOG(WII_IPC_WIIMOTE, " bRequest: 0x%x", m_CtrlSetup.bRequest)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 196, " bRequest: 0x%x", m_CtrlSetup.bRequest); } } while
(0)
;
197 DEBUG_LOG(WII_IPC_WIIMOTE, " wValue: 0x%x", m_CtrlSetup.wValue)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 197, " wValue: 0x%x", m_CtrlSetup.wValue); } } while (0)
;
198 DEBUG_LOG(WII_IPC_WIIMOTE, " wIndex: 0x%x", m_CtrlSetup.wIndex)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 198, " wIndex: 0x%x", m_CtrlSetup.wIndex); } } while (0)
;
199 DEBUG_LOG(WII_IPC_WIIMOTE, " wLength: 0x%x", m_CtrlSetup.wLength)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 199, " wLength: 0x%x", m_CtrlSetup.wLength); } } while (
0)
;
200 DEBUG_LOG(WII_IPC_WIIMOTE, " m_PayLoadAddr: 0x%x", m_CtrlSetup.m_PayLoadAddr)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 200, " m_PayLoadAddr: 0x%x", m_CtrlSetup.m_PayLoadAddr)
; } } while (0)
;
201 DEBUG_LOG(WII_IPC_WIIMOTE, " m_PayLoadSize: 0x%x", m_CtrlSetup.m_PayLoadSize)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 201, " m_PayLoadSize: 0x%x", m_CtrlSetup.m_PayLoadSize)
; } } while (0)
;
202 #endif
203
204 // Replies are generated inside
205 ExecuteHCICommandMessage(m_CtrlSetup);
206 }
207 break;
208
209 case USBV0_IOCTL_BLKMSG:
210 {
211 u8 Command = Memory::Read_U8(CommandBuffer.InBuffer[0].m_Address);
212 switch (Command)
213 {
214 case ACL_DATA_OUT: // ACL data is received from the stack
215 {
216 // This is the ACL datapath from CPU to Wiimote
217 // Here we only need to record the command address in case we need to delay the reply
218 m_ACLSetup = CommandBuffer.m_Address;
219
220 #if defined(_DEBUG) || defined(DEBUGFAST)
221 DumpAsync(CommandBuffer.BufferVector, CommandBuffer.NumberInBuffer, CommandBuffer.NumberPayloadBuffer);
222 #endif
223
224 CtrlBuffer BulkBuffer(_CommandAddress);
225 hci_acldata_hdr_t* pACLHeader = (hci_acldata_hdr_t*)Memory::GetPointer(BulkBuffer.m_buffer);
226
227 _dbg_assert_(WII_IPC_WIIMOTE, HCI_BC_FLAG(pACLHeader->con_handle) == HCI_POINT2POINT){};
228 _dbg_assert_(WII_IPC_WIIMOTE, HCI_PB_FLAG(pACLHeader->con_handle) == HCI_PACKET_START){};
229
230 SendToDevice(HCI_CON_HANDLE(pACLHeader->con_handle)((pACLHeader->con_handle) & 0x0fff),
231 Memory::GetPointer(BulkBuffer.m_buffer + sizeof(hci_acldata_hdr_t)),
232 pACLHeader->length);
233
234 _SendReply = true;
235 }
236 break;
237
238 case ACL_DATA_IN: // We are given an ACL buffer to fill
239 {
240 CtrlBuffer temp(_CommandAddress);
241 m_ACLEndpoint = temp;
242
243 DEBUG_LOG(WII_IPC_WIIMOTE, "ACL_DATA_IN: 0x%08x ", _CommandAddress)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 243, "ACL_DATA_IN: 0x%08x ", _CommandAddress); } } while (0
)
;
244 }
245 break;
246
247 default:
248 {
249 _dbg_assert_msg_(WII_IPC_WIIMOTE, 0, "Unknown USBV0_IOCTL_BLKMSG: %x", Command){};
250 }
251 break;
252 }
253 }
254 break;
255
256
257 case USBV0_IOCTL_INTRMSG:
258 {
259 u8 Command = Memory::Read_U8(CommandBuffer.InBuffer[0].m_Address);
260 if (Command == HCI_EVENT) // We are given a HCI buffer to fill
261 {
262 CtrlBuffer temp(_CommandAddress);
263 m_HCIEndpoint = temp;
264
265 DEBUG_LOG(WII_IPC_WIIMOTE, "HCI_EVENT: 0x%08x ", _CommandAddress)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 265, "HCI_EVENT: 0x%08x ", _CommandAddress); } } while (0)
;
266 }
267 else
268 {
269 _dbg_assert_msg_(WII_IPC_WIIMOTE, 0, "Unknown USBV0_IOCTL_INTRMSG: %x", Command){};
270 }
271 }
272 break;
273
274 default:
275 {
276 _dbg_assert_msg_(WII_IPC_WIIMOTE, 0, "Unknown CWII_IPC_HLE_Device_usb_oh1_57e_305: %x", CommandBuffer.Parameter){};
277
278 DEBUG_LOG(WII_IPC_WIIMOTE, "%s - IOCtlV:", GetDeviceName().c_str())do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 278, "%s - IOCtlV:", GetDeviceName().c_str()); } } while (0
)
;
279 DEBUG_LOG(WII_IPC_WIIMOTE, " Parameter: 0x%x", CommandBuffer.Parameter)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 279, " Parameter: 0x%x", CommandBuffer.Parameter); } } while
(0)
;
280 DEBUG_LOG(WII_IPC_WIIMOTE, " NumberIn: 0x%08x", CommandBuffer.NumberInBuffer)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 280, " NumberIn: 0x%08x", CommandBuffer.NumberInBuffer);
} } while (0)
;
281 DEBUG_LOG(WII_IPC_WIIMOTE, " NumberOut: 0x%08x", CommandBuffer.NumberPayloadBuffer)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 281, " NumberOut: 0x%08x", CommandBuffer.NumberPayloadBuffer
); } } while (0)
;
282 DEBUG_LOG(WII_IPC_WIIMOTE, " BufferVector: 0x%08x", CommandBuffer.BufferVector)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 282, " BufferVector: 0x%08x", CommandBuffer.BufferVector
); } } while (0)
;
283 DEBUG_LOG(WII_IPC_WIIMOTE, " PayloadAddr: 0x%08x", CommandBuffer.PayloadBuffer[0].m_Address)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 283, " PayloadAddr: 0x%08x", CommandBuffer.PayloadBuffer
[0].m_Address); } } while (0)
;
284 DEBUG_LOG(WII_IPC_WIIMOTE, " PayloadSize: 0x%08x", CommandBuffer.PayloadBuffer[0].m_Size)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 284, " PayloadSize: 0x%08x", CommandBuffer.PayloadBuffer
[0].m_Size); } } while (0)
;
285 #if defined(_DEBUG) || defined(DEBUGFAST)
286 DumpAsync(CommandBuffer.BufferVector, CommandBuffer.NumberInBuffer, CommandBuffer.NumberPayloadBuffer);
287 #endif
288 }
289 break;
290 }
291
292 // write return value
293 Memory::Write_U32(0, _CommandAddress + 4);
294 return _SendReply;
295}
296
297
298// Here we handle the USBV0_IOCTL_BLKMSG Ioctlv
299void CWII_IPC_HLE_Device_usb_oh1_57e_305::SendToDevice(u16 _ConnectionHandle, u8* _pData, u32 _Size)
300{
301 CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_ConnectionHandle);
302 if (pWiiMote == NULL__null)
303 return;
304
305 INFO_LOG(WII_IPC_WIIMOTE, "Send ACL Packet to ConnectionHandle 0x%04x", _ConnectionHandle)do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 305, "Send ACL Packet to ConnectionHandle 0x%04x", _ConnectionHandle
); } } while (0)
;
306 IncDataPacket(_ConnectionHandle);
307 pWiiMote->ExecuteL2capCmd(_pData, _Size);
308}
309
310void CWII_IPC_HLE_Device_usb_oh1_57e_305::IncDataPacket(u16 _ConnectionHandle)
311{
312 m_PacketCount[_ConnectionHandle & 0xff]++;
313
314 // I don't think this makes sense or should be necessary
315 // m_PacketCount refers to "completed" packets and is not related to some buffer size, yes?
316#if 0
317 if (m_PacketCount[_ConnectionHandle & 0xff] > (unsigned int)m_acl_pkts_num)
318 {
319 DEBUG_LOG(WII_IPC_WIIMOTE, "ACL buffer overflow")do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 319, "ACL buffer overflow"); } } while (0)
;
320 m_PacketCount[_ConnectionHandle & 0xff] = m_acl_pkts_num;
321 }
322#endif
323}
324
325// Here we send ACL packets to CPU. They will consist of header + data.
326// The header is for example 07 00 41 00 which means size 0x0007 and channel 0x0041.
327void CWII_IPC_HLE_Device_usb_oh1_57e_305::SendACLPacket(u16 _ConnectionHandle, u8* _pData, u32 _Size)
328{
329 DEBUG_LOG(WII_IPC_WIIMOTE, "ACL packet from %x ready to send to stack...", _ConnectionHandle)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 329, "ACL packet from %x ready to send to stack...", _ConnectionHandle
); } } while (0)
;
330
331 if (m_ACLEndpoint.IsValid() && !m_HCIEndpoint.IsValid() && m_EventQueue.empty())
332 {
333 DEBUG_LOG(WII_IPC_WIIMOTE, "ACL endpoint valid, sending packet to %08x", m_ACLEndpoint.m_address)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 333, "ACL endpoint valid, sending packet to %08x", m_ACLEndpoint
.m_address); } } while (0)
;
334
335 hci_acldata_hdr_t* pHeader = (hci_acldata_hdr_t*)Memory::GetPointer(m_ACLEndpoint.m_buffer);
336 pHeader->con_handle = HCI_MK_CON_HANDLE(_ConnectionHandle, HCI_PACKET_START, HCI_POINT2POINT)(((_ConnectionHandle) & 0x0fff) | (((0x2) & 3) <<
12) | (((0x0) & 3) << 14))
;
337 pHeader->length = _Size;
338
339 // Write the packet to the buffer
340 memcpy((u8*)pHeader + sizeof(hci_acldata_hdr_t), _pData, pHeader->length);
341
342 m_ACLEndpoint.SetRetVal(sizeof(hci_acldata_hdr_t) + _Size);
343 WII_IPC_HLE_Interface::EnqReply(m_ACLEndpoint.m_address);
344 m_ACLEndpoint.Invalidate();
345 }
346 else
347 {
348 DEBUG_LOG(WII_IPC_WIIMOTE, "ACL endpoint not currently valid, queuing...")do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 348, "ACL endpoint not currently valid, queuing..."); } } while
(0)
;
349 m_acl_pool.Store(_pData, _Size, _ConnectionHandle);
350 }
351}
352
353// These messages are sent from the Wiimote to the game, for example RequestConnection()
354// or ConnectionComplete().
355//
356// Our WII_IPC_HLE is so efficient that we could fill the buffer immediately
357// rather than enqueue it to some other memory and this will do good for StateSave
358void CWII_IPC_HLE_Device_usb_oh1_57e_305::AddEventToQueue(const SQueuedEvent& _event)
359{
360 DEBUG_LOG(WII_IPC_WIIMOTE, "HCI event %x completed...", ((hci_event_hdr_t*)_event.m_buffer)->event)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 360, "HCI event %x completed...", ((hci_event_hdr_t*)_event
.m_buffer)->event); } } while (0)
;
361
362 if (m_HCIEndpoint.IsValid())
363 {
364 if (m_EventQueue.empty()) // fast path :)
365 {
366 DEBUG_LOG(WII_IPC_WIIMOTE, "HCI endpoint valid, sending packet to %08x", m_HCIEndpoint.m_address)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 366, "HCI endpoint valid, sending packet to %08x", m_HCIEndpoint
.m_address); } } while (0)
;
367 m_HCIEndpoint.FillBuffer(_event.m_buffer, _event.m_size);
368 m_HCIEndpoint.SetRetVal(_event.m_size);
369 // Send a reply to indicate HCI buffer is filled
370 WII_IPC_HLE_Interface::EnqReply(m_HCIEndpoint.m_address);
371 m_HCIEndpoint.Invalidate();
372 }
373 else // push new one, pop oldest
374 {
375 DEBUG_LOG(WII_IPC_WIIMOTE, "HCI endpoint not "do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 377, "HCI endpoint not " "currently valid, queueing(%lu)..."
, (unsigned long)m_EventQueue.size()); } } while (0)
376 "currently valid, queueing(%lu)...",do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 377, "HCI endpoint not " "currently valid, queueing(%lu)..."
, (unsigned long)m_EventQueue.size()); } } while (0)
377 (unsigned long)m_EventQueue.size())do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 377, "HCI endpoint not " "currently valid, queueing(%lu)..."
, (unsigned long)m_EventQueue.size()); } } while (0)
;
378 m_EventQueue.push_back(_event);
379 const SQueuedEvent& event = m_EventQueue.front();
380 DEBUG_LOG(WII_IPC_WIIMOTE, "HCI event %x "do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 384, "HCI event %x " "being written from queue(%lu) to %08x..."
, ((hci_event_hdr_t*)event.m_buffer)->event, (unsigned long
)m_EventQueue.size()-1, m_HCIEndpoint.m_address); } } while (
0)
381 "being written from queue(%lu) to %08x...",do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 384, "HCI event %x " "being written from queue(%lu) to %08x..."
, ((hci_event_hdr_t*)event.m_buffer)->event, (unsigned long
)m_EventQueue.size()-1, m_HCIEndpoint.m_address); } } while (
0)
382 ((hci_event_hdr_t*)event.m_buffer)->event,do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 384, "HCI event %x " "being written from queue(%lu) to %08x..."
, ((hci_event_hdr_t*)event.m_buffer)->event, (unsigned long
)m_EventQueue.size()-1, m_HCIEndpoint.m_address); } } while (
0)
383 (unsigned long)m_EventQueue.size()-1,do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 384, "HCI event %x " "being written from queue(%lu) to %08x..."
, ((hci_event_hdr_t*)event.m_buffer)->event, (unsigned long
)m_EventQueue.size()-1, m_HCIEndpoint.m_address); } } while (
0)
384 m_HCIEndpoint.m_address)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 384, "HCI event %x " "being written from queue(%lu) to %08x..."
, ((hci_event_hdr_t*)event.m_buffer)->event, (unsigned long
)m_EventQueue.size()-1, m_HCIEndpoint.m_address); } } while (
0)
;
385 m_HCIEndpoint.FillBuffer(event.m_buffer, event.m_size);
386 m_HCIEndpoint.SetRetVal(event.m_size);
387 // Send a reply to indicate HCI buffer is filled
388 WII_IPC_HLE_Interface::EnqReply(m_HCIEndpoint.m_address);
389 m_HCIEndpoint.Invalidate();
390 m_EventQueue.pop_front();
391 }
392 }
393 else
394 {
395 DEBUG_LOG(WII_IPC_WIIMOTE, "HCI endpoint not currently valid, "do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 396, "HCI endpoint not currently valid, " "queuing(%lu)..."
, (unsigned long)m_EventQueue.size()); } } while (0)
396 "queuing(%lu)...", (unsigned long)m_EventQueue.size())do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 396, "HCI endpoint not currently valid, " "queuing(%lu)..."
, (unsigned long)m_EventQueue.size()); } } while (0)
;
397 m_EventQueue.push_back(_event);
398 }
399}
400
401u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
402{
403 bool packet_transferred = false;
404
405 // check HCI queue
406 if (!m_EventQueue.empty() && m_HCIEndpoint.IsValid())
407 {
408 // an endpoint has become available, and we have a stored response.
409 const SQueuedEvent& event = m_EventQueue.front();
410 DEBUG_LOG(WII_IPC_WIIMOTE,do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 414, "HCI event %x being written from queue(%lu) to %08x..."
, ((hci_event_hdr_t*)event.m_buffer)->event, (unsigned long
)m_EventQueue.size()-1, m_HCIEndpoint.m_address); } } while (
0)
411 "HCI event %x being written from queue(%lu) to %08x...",do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 414, "HCI event %x being written from queue(%lu) to %08x..."
, ((hci_event_hdr_t*)event.m_buffer)->event, (unsigned long
)m_EventQueue.size()-1, m_HCIEndpoint.m_address); } } while (
0)
412 ((hci_event_hdr_t*)event.m_buffer)->event,do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 414, "HCI event %x being written from queue(%lu) to %08x..."
, ((hci_event_hdr_t*)event.m_buffer)->event, (unsigned long
)m_EventQueue.size()-1, m_HCIEndpoint.m_address); } } while (
0)
413 (unsigned long)m_EventQueue.size()-1,do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 414, "HCI event %x being written from queue(%lu) to %08x..."
, ((hci_event_hdr_t*)event.m_buffer)->event, (unsigned long
)m_EventQueue.size()-1, m_HCIEndpoint.m_address); } } while (
0)
414 m_HCIEndpoint.m_address)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 414, "HCI event %x being written from queue(%lu) to %08x..."
, ((hci_event_hdr_t*)event.m_buffer)->event, (unsigned long
)m_EventQueue.size()-1, m_HCIEndpoint.m_address); } } while (
0)
;
415 m_HCIEndpoint.FillBuffer(event.m_buffer, event.m_size);
416 m_HCIEndpoint.SetRetVal(event.m_size);
417 // Send a reply to indicate HCI buffer is filled
418 WII_IPC_HLE_Interface::EnqReply(m_HCIEndpoint.m_address);
419 m_HCIEndpoint.Invalidate();
420 m_EventQueue.pop_front();
421 packet_transferred = true;
422 }
423
424 // check ACL queue
425 if (!m_acl_pool.IsEmpty() && m_ACLEndpoint.IsValid() && m_EventQueue.empty())
426 {
427 m_acl_pool.WriteToEndpoint(m_ACLEndpoint);
428 packet_transferred = true;
429 }
430
431 // We wait for ScanEnable to be sent from the bt stack through HCI_CMD_WRITE_SCAN_ENABLE
432 // before we initiate the connection.
433 //
434 // FiRES: TODO find a better way to do this
435
436 // Create ACL connection
437 if (m_HCIEndpoint.IsValid() && (m_ScanEnable & HCI_PAGE_SCAN_ENABLE0x02))
438 {
439 for (unsigned int i = 0; i < m_WiiMotes.size(); i++)
440 {
441 if (m_WiiMotes[i].EventPagingChanged(m_ScanEnable))
442 {
443 Host_SetWiiMoteConnectionState(1);
444 SendEventRequestConnection(m_WiiMotes[i]);
445 }
446 }
447 }
448
449 // Link channels when connected
450 if (m_ACLEndpoint.IsValid())
451 {
452 for (unsigned int i = 0; i < m_WiiMotes.size(); i++)
453 {
454 if (m_WiiMotes[i].LinkChannel())
455 break;
456 }
457 }
458
459 // The Real Wiimote sends report every ~5ms (200 Hz).
460 const u64 interval = SystemTimers::GetTicksPerSecond() / 200;
461 const u64 now = CoreTiming::GetTicks();
462
463 if (now - m_last_ticks > interval)
464 {
465 for (unsigned int i = 0; i < m_WiiMotes.size(); i++)
466 if (m_WiiMotes[i].IsConnected())
467 {
468 NetPlay_WiimoteUpdate(i);
469 Wiimote::Update(i);
470 }
471 m_last_ticks = now;
472 }
473
474 SendEventNumberOfCompletedPackets();
475
476 return packet_transferred;
477}
478
479void CWII_IPC_HLE_Device_usb_oh1_57e_305::ACLPool::Store(const u8* data, const u16 size, const u16 conn_handle)
480{
481 if (m_queue.size() >= 100)
482 {
483 // Many simultaneous exchanges of ACL packets tend to cause the queue to fill up.
484 ERROR_LOG(WII_IPC_WIIMOTE, "ACL queue size reached 100 - current packet will be dropped!")do { { if (LogTypes::LERROR <= 3) GenericLog(LogTypes::LERROR
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 484, "ACL queue size reached 100 - current packet will be dropped!"
); } } while (0)
;
485 return;
486 }
487
488 _dbg_assert_msg_(WII_IPC_WIIMOTE,{}
489 size < m_acl_pkt_size, "ACL packet too large for pool"){};
490
491 m_queue.push_back(Packet());
492 auto& packet = m_queue.back();
493
494 std::copy(data, data + size, packet.data);
495 packet.size = size;
496 packet.conn_handle = conn_handle;
497}
498
499void CWII_IPC_HLE_Device_usb_oh1_57e_305::ACLPool::WriteToEndpoint(CtrlBuffer& endpoint)
500{
501 auto& packet = m_queue.front();
502
503 const u8* const data = packet.data;
504 const u16 size = packet.size;
505 const u16 conn_handle = packet.conn_handle;
506
507 DEBUG_LOG(WII_IPC_WIIMOTE, "ACL packet being written from "do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 508, "ACL packet being written from " "queue to %08x", endpoint
.m_address); } } while (0)
508 "queue to %08x", endpoint.m_address)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 508, "ACL packet being written from " "queue to %08x", endpoint
.m_address); } } while (0)
;
509
510 hci_acldata_hdr_t* pHeader = (hci_acldata_hdr_t*)Memory::GetPointer(endpoint.m_buffer);
511 pHeader->con_handle = HCI_MK_CON_HANDLE(conn_handle, HCI_PACKET_START, HCI_POINT2POINT)(((conn_handle) & 0x0fff) | (((0x2) & 3) << 12)
| (((0x0) & 3) << 14))
;
512 pHeader->length = size;
513
514 // Write the packet to the buffer
515 std::copy(data, data + size, (u8*)pHeader + sizeof(hci_acldata_hdr_t));
516
517 endpoint.SetRetVal(sizeof(hci_acldata_hdr_t) + size);
518
519 m_queue.pop_front();
520
521 WII_IPC_HLE_Interface::EnqReply(endpoint.m_address);
522 endpoint.Invalidate();
523}
524
525bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventInquiryComplete()
526{
527 SQueuedEvent Event(sizeof(SHCIEventInquiryComplete), 0);
528
529 SHCIEventInquiryComplete* pInquiryComplete = (SHCIEventInquiryComplete*)Event.m_buffer;
530 pInquiryComplete->EventType = HCI_EVENT_INQUIRY_COMPL0x01;
531 pInquiryComplete->PayloadLength = sizeof(SHCIEventInquiryComplete) - 2;
532 pInquiryComplete->EventStatus = 0x00;
533
534 AddEventToQueue(Event);
535
536 INFO_LOG(WII_IPC_WIIMOTE, "Event: Inquiry complete")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 536, "Event: Inquiry complete"); } } while (0)
;
537
538 return true;
539}
540
541bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventInquiryResponse()
542{
543 if (m_WiiMotes.empty())
544 return false;
545
546 _dbg_assert_(WII_IPC_WIIMOTE, sizeof(SHCIEventInquiryResult) - 2 + (m_WiiMotes.size() * sizeof(hci_inquiry_response)) < 256){};
547
548 SQueuedEvent Event(static_cast<u32>(sizeof(SHCIEventInquiryResult) + m_WiiMotes.size()*sizeof(hci_inquiry_response)), 0);
549
550 SHCIEventInquiryResult* pInquiryResult = (SHCIEventInquiryResult*)Event.m_buffer;
551
552 pInquiryResult->EventType = HCI_EVENT_INQUIRY_RESULT0x02;
553 pInquiryResult->PayloadLength = (u8)(sizeof(SHCIEventInquiryResult) - 2 + (m_WiiMotes.size() * sizeof(hci_inquiry_response)));
554 pInquiryResult->num_responses = (u8)m_WiiMotes.size();
555
556 for (size_t i=0; i < m_WiiMotes.size(); i++)
557 {
558 if (m_WiiMotes[i].IsConnected())
559 continue;
560
561 u8* pBuffer = Event.m_buffer + sizeof(SHCIEventInquiryResult) + i*sizeof(hci_inquiry_response);
562 hci_inquiry_response* pResponse = (hci_inquiry_response*)pBuffer;
563
564 pResponse->bdaddr = m_WiiMotes[i].GetBD();
565 pResponse->uclass[0]= m_WiiMotes[i].GetClass()[0];
566 pResponse->uclass[1]= m_WiiMotes[i].GetClass()[1];
567 pResponse->uclass[2]= m_WiiMotes[i].GetClass()[2];
568
569 pResponse->page_scan_rep_mode = 1;
570 pResponse->page_scan_period_mode = 0;
571 pResponse->page_scan_mode = 0;
572 pResponse->clock_offset = 0x3818;
573
574 INFO_LOG(WII_IPC_WIIMOTE, "Event: Send Fake Inquiry of one controller")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 574, "Event: Send Fake Inquiry of one controller"); } } while
(0)
;
575 INFO_LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x",do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 577, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pResponse->bdaddr
.b[0], pResponse->bdaddr.b[1], pResponse->bdaddr.b[2], pResponse
->bdaddr.b[3], pResponse->bdaddr.b[4], pResponse->bdaddr
.b[5]); } } while (0)
576 pResponse->bdaddr.b[0], pResponse->bdaddr.b[1], pResponse->bdaddr.b[2],do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 577, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pResponse->bdaddr
.b[0], pResponse->bdaddr.b[1], pResponse->bdaddr.b[2], pResponse
->bdaddr.b[3], pResponse->bdaddr.b[4], pResponse->bdaddr
.b[5]); } } while (0)
577 pResponse->bdaddr.b[3], pResponse->bdaddr.b[4], pResponse->bdaddr.b[5])do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 577, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pResponse->bdaddr
.b[0], pResponse->bdaddr.b[1], pResponse->bdaddr.b[2], pResponse
->bdaddr.b[3], pResponse->bdaddr.b[4], pResponse->bdaddr
.b[5]); } } while (0)
;
578 }
579
580 AddEventToQueue(Event);
581
582 return true;
583}
584
585bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventConnectionComplete(const bdaddr_t& _bd)
586{
587 CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_bd);
588 if (pWiiMote == NULL__null)
589 return false;
590
591 SQueuedEvent Event(sizeof(SHCIEventConnectionComplete), 0);
592
593 SHCIEventConnectionComplete* pConnectionComplete = (SHCIEventConnectionComplete*)Event.m_buffer;
594
595 pConnectionComplete->EventType = HCI_EVENT_CON_COMPL0x03;
596 pConnectionComplete->PayloadLength = sizeof(SHCIEventConnectionComplete) - 2;
597 pConnectionComplete->EventStatus = 0x00;
598 pConnectionComplete->Connection_Handle = pWiiMote->GetConnectionHandle();
599 pConnectionComplete->bdaddr = _bd;
600 pConnectionComplete->LinkType = HCI_LINK_ACL0x01;
601 pConnectionComplete->EncryptionEnabled = HCI_ENCRYPTION_MODE_NONE0x00;
602
603 AddEventToQueue(Event);
604
605 CWII_IPC_HLE_WiiMote* pWiimote = AccessWiiMote(pConnectionComplete->Connection_Handle);
606 if (pWiimote)
607 pWiimote->EventConnectionAccepted();
608
609 static char s_szLinkType[][128] =
610 {
611 { "HCI_LINK_SCO 0x00 - Voice"},
612 { "HCI_LINK_ACL 0x01 - Data"},
613 { "HCI_LINK_eSCO 0x02 - eSCO"},
614 };
615
616 INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventConnectionComplete")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 616, "Event: SendEventConnectionComplete"); } } while (0)
;
617 INFO_LOG(WII_IPC_WIIMOTE, " Connection_Handle: 0x%04x", pConnectionComplete->Connection_Handle)do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 617, " Connection_Handle: 0x%04x", pConnectionComplete->
Connection_Handle); } } while (0)
;
618 DEBUG_LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x",do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 620, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pConnectionComplete
->bdaddr.b[0], pConnectionComplete->bdaddr.b[1], pConnectionComplete
->bdaddr.b[2], pConnectionComplete->bdaddr.b[3], pConnectionComplete
->bdaddr.b[4], pConnectionComplete->bdaddr.b[5]); } } while
(0)
619 pConnectionComplete->bdaddr.b[0], pConnectionComplete->bdaddr.b[1], pConnectionComplete->bdaddr.b[2],do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 620, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pConnectionComplete
->bdaddr.b[0], pConnectionComplete->bdaddr.b[1], pConnectionComplete
->bdaddr.b[2], pConnectionComplete->bdaddr.b[3], pConnectionComplete
->bdaddr.b[4], pConnectionComplete->bdaddr.b[5]); } } while
(0)
620 pConnectionComplete->bdaddr.b[3], pConnectionComplete->bdaddr.b[4], pConnectionComplete->bdaddr.b[5])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 620, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pConnectionComplete
->bdaddr.b[0], pConnectionComplete->bdaddr.b[1], pConnectionComplete
->bdaddr.b[2], pConnectionComplete->bdaddr.b[3], pConnectionComplete
->bdaddr.b[4], pConnectionComplete->bdaddr.b[5]); } } while
(0)
;
621 DEBUG_LOG(WII_IPC_WIIMOTE, " LinkType: %s", s_szLinkType[pConnectionComplete->LinkType])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 621, " LinkType: %s", s_szLinkType[pConnectionComplete->
LinkType]); } } while (0)
;
622 DEBUG_LOG(WII_IPC_WIIMOTE, " EncryptionEnabled: %i", pConnectionComplete->EncryptionEnabled)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 622, " EncryptionEnabled: %i", pConnectionComplete->EncryptionEnabled
); } } while (0)
;
623
624 return true;
625}
626
627// This is called from Update() after ScanEnable has been enabled.
628bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRequestConnection(CWII_IPC_HLE_WiiMote& _rWiiMote)
629{
630 SQueuedEvent Event(sizeof(SHCIEventRequestConnection), 0);
631
632 SHCIEventRequestConnection* pEventRequestConnection = (SHCIEventRequestConnection*)Event.m_buffer;
633
634 pEventRequestConnection->EventType = HCI_EVENT_CON_REQ0x04;
635 pEventRequestConnection->PayloadLength = sizeof(SHCIEventRequestConnection) - 2;
636 pEventRequestConnection->bdaddr = _rWiiMote.GetBD();
637 pEventRequestConnection->uclass[0] = _rWiiMote.GetClass()[0];
638 pEventRequestConnection->uclass[1] = _rWiiMote.GetClass()[1];
639 pEventRequestConnection->uclass[2] = _rWiiMote.GetClass()[2];
640 pEventRequestConnection->LinkType = HCI_LINK_ACL0x01;
641
642 AddEventToQueue(Event);
643
644 static char LinkType[][128] =
645 {
646 { "HCI_LINK_SCO 0x00 - Voice"},
647 { "HCI_LINK_ACL 0x01 - Data" },
648 { "HCI_LINK_eSCO 0x02 - eSCO" },
649 };
650
651 INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventRequestConnection")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 651, "Event: SendEventRequestConnection"); } } while (0)
;
652 INFO_LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x",do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 654, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pEventRequestConnection
->bdaddr.b[0], pEventRequestConnection->bdaddr.b[1], pEventRequestConnection
->bdaddr.b[2], pEventRequestConnection->bdaddr.b[3], pEventRequestConnection
->bdaddr.b[4], pEventRequestConnection->bdaddr.b[5]); }
} while (0)
653 pEventRequestConnection->bdaddr.b[0], pEventRequestConnection->bdaddr.b[1], pEventRequestConnection->bdaddr.b[2],do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 654, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pEventRequestConnection
->bdaddr.b[0], pEventRequestConnection->bdaddr.b[1], pEventRequestConnection
->bdaddr.b[2], pEventRequestConnection->bdaddr.b[3], pEventRequestConnection
->bdaddr.b[4], pEventRequestConnection->bdaddr.b[5]); }
} while (0)
654 pEventRequestConnection->bdaddr.b[3], pEventRequestConnection->bdaddr.b[4], pEventRequestConnection->bdaddr.b[5])do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 654, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pEventRequestConnection
->bdaddr.b[0], pEventRequestConnection->bdaddr.b[1], pEventRequestConnection
->bdaddr.b[2], pEventRequestConnection->bdaddr.b[3], pEventRequestConnection
->bdaddr.b[4], pEventRequestConnection->bdaddr.b[5]); }
} while (0)
;
655 DEBUG_LOG(WII_IPC_WIIMOTE, " COD[0]: 0x%02x", pEventRequestConnection->uclass[0])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 655, " COD[0]: 0x%02x", pEventRequestConnection->uclass
[0]); } } while (0)
;
656 DEBUG_LOG(WII_IPC_WIIMOTE, " COD[1]: 0x%02x", pEventRequestConnection->uclass[1])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 656, " COD[1]: 0x%02x", pEventRequestConnection->uclass
[1]); } } while (0)
;
657 DEBUG_LOG(WII_IPC_WIIMOTE, " COD[2]: 0x%02x", pEventRequestConnection->uclass[2])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 657, " COD[2]: 0x%02x", pEventRequestConnection->uclass
[2]); } } while (0)
;
658 DEBUG_LOG(WII_IPC_WIIMOTE, " LinkType: %s", LinkType[pEventRequestConnection->LinkType])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 658, " LinkType: %s", LinkType[pEventRequestConnection->
LinkType]); } } while (0)
;
659
660 return true;
661}
662
663bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventDisconnect(u16 _connectionHandle, u8 _Reason)
664{
665 CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle);
666 if (pWiiMote == NULL__null)
667 return false;
668
669 SQueuedEvent Event(sizeof(SHCIEventDisconnectCompleted), _connectionHandle);
670
671 SHCIEventDisconnectCompleted* pDisconnect = (SHCIEventDisconnectCompleted*)Event.m_buffer;
672 pDisconnect->EventType = HCI_EVENT_DISCON_COMPL0x05;
673 pDisconnect->PayloadLength = sizeof(SHCIEventDisconnectCompleted) - 2;
674 pDisconnect->EventStatus = 0;
675 pDisconnect->Connection_Handle = _connectionHandle;
676 pDisconnect->Reason = _Reason;
677
678 AddEventToQueue(Event);
679
680 INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventDisconnect")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 680, "Event: SendEventDisconnect"); } } while (0)
;
681 INFO_LOG(WII_IPC_WIIMOTE, " Connection_Handle: 0x%04x", pDisconnect->Connection_Handle)do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 681, " Connection_Handle: 0x%04x", pDisconnect->Connection_Handle
); } } while (0)
;
682 INFO_LOG(WII_IPC_WIIMOTE, " Reason: 0x%02x", pDisconnect->Reason)do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 682, " Reason: 0x%02x", pDisconnect->Reason); } } while
(0)
;
683
684 return true;
685}
686
687bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventAuthenticationCompleted(u16 _connectionHandle)
688{
689 CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle);
690 if (pWiiMote == NULL__null)
691 return false;
692
693 SQueuedEvent Event(sizeof(SHCIEventAuthenticationCompleted), _connectionHandle);
694
695 SHCIEventAuthenticationCompleted* pEventAuthenticationCompleted = (SHCIEventAuthenticationCompleted*)Event.m_buffer;
696 pEventAuthenticationCompleted->EventType = HCI_EVENT_AUTH_COMPL0x06;
697 pEventAuthenticationCompleted->PayloadLength = sizeof(SHCIEventAuthenticationCompleted) - 2;
698 pEventAuthenticationCompleted->EventStatus = 0;
699 pEventAuthenticationCompleted->Connection_Handle = _connectionHandle;
700
701 INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventAuthenticationCompleted")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 701, "Event: SendEventAuthenticationCompleted"); } } while (
0)
;
702 INFO_LOG(WII_IPC_WIIMOTE, " Connection_Handle: 0x%04x", pEventAuthenticationCompleted->Connection_Handle)do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 702, " Connection_Handle: 0x%04x", pEventAuthenticationCompleted
->Connection_Handle); } } while (0)
;
703
704 AddEventToQueue(Event);
705
706 return true;
707}
708
709bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRemoteNameReq(const bdaddr_t& _bd)
710{
711 CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_bd);
712 if (pWiiMote == NULL__null)
713 return false;
714
715 SQueuedEvent Event(sizeof(SHCIEventRemoteNameReq), 0);
716
717 SHCIEventRemoteNameReq* pRemoteNameReq = (SHCIEventRemoteNameReq*)Event.m_buffer;
718
719 pRemoteNameReq->EventType = HCI_EVENT_REMOTE_NAME_REQ_COMPL0x07;
720 pRemoteNameReq->PayloadLength = sizeof(SHCIEventRemoteNameReq) - 2;
721 pRemoteNameReq->EventStatus = 0x00;
722 pRemoteNameReq->bdaddr = _bd;
723 strcpy((char*)pRemoteNameReq->RemoteName, pWiiMote->GetName());
724
725 INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventRemoteNameReq")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 725, "Event: SendEventRemoteNameReq"); } } while (0)
;
726 INFO_LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x",do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 728, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pRemoteNameReq->
bdaddr.b[0], pRemoteNameReq->bdaddr.b[1], pRemoteNameReq->
bdaddr.b[2], pRemoteNameReq->bdaddr.b[3], pRemoteNameReq->
bdaddr.b[4], pRemoteNameReq->bdaddr.b[5]); } } while (0)
727 pRemoteNameReq->bdaddr.b[0], pRemoteNameReq->bdaddr.b[1], pRemoteNameReq->bdaddr.b[2],do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 728, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pRemoteNameReq->
bdaddr.b[0], pRemoteNameReq->bdaddr.b[1], pRemoteNameReq->
bdaddr.b[2], pRemoteNameReq->bdaddr.b[3], pRemoteNameReq->
bdaddr.b[4], pRemoteNameReq->bdaddr.b[5]); } } while (0)
728 pRemoteNameReq->bdaddr.b[3], pRemoteNameReq->bdaddr.b[4], pRemoteNameReq->bdaddr.b[5])do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 728, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pRemoteNameReq->
bdaddr.b[0], pRemoteNameReq->bdaddr.b[1], pRemoteNameReq->
bdaddr.b[2], pRemoteNameReq->bdaddr.b[3], pRemoteNameReq->
bdaddr.b[4], pRemoteNameReq->bdaddr.b[5]); } } while (0)
;
729 DEBUG_LOG(WII_IPC_WIIMOTE, " RemoteName: %s", pRemoteNameReq->RemoteName)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 729, " RemoteName: %s", pRemoteNameReq->RemoteName); } }
while (0)
;
730
731 AddEventToQueue(Event);
732
733 return true;
734}
735
736bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadRemoteFeatures(u16 _connectionHandle)
737{
738 CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle);
739 if (pWiiMote == NULL__null)
740 return false;
741
742 SQueuedEvent Event(sizeof(SHCIEventReadRemoteFeatures), _connectionHandle);
743
744 SHCIEventReadRemoteFeatures* pReadRemoteFeatures = (SHCIEventReadRemoteFeatures*)Event.m_buffer;
745
746 pReadRemoteFeatures->EventType = HCI_EVENT_READ_REMOTE_FEATURES_COMPL0x0b;
747 pReadRemoteFeatures->PayloadLength = sizeof(SHCIEventReadRemoteFeatures) - 2;
748 pReadRemoteFeatures->EventStatus = 0x00;
749 pReadRemoteFeatures->ConnectionHandle = _connectionHandle;
750 pReadRemoteFeatures->features[0] = pWiiMote->GetFeatures()[0];
751 pReadRemoteFeatures->features[1] = pWiiMote->GetFeatures()[1];
752 pReadRemoteFeatures->features[2] = pWiiMote->GetFeatures()[2];
753 pReadRemoteFeatures->features[3] = pWiiMote->GetFeatures()[3];
754 pReadRemoteFeatures->features[4] = pWiiMote->GetFeatures()[4];
755 pReadRemoteFeatures->features[5] = pWiiMote->GetFeatures()[5];
756 pReadRemoteFeatures->features[6] = pWiiMote->GetFeatures()[6];
757 pReadRemoteFeatures->features[7] = pWiiMote->GetFeatures()[7];
758
759 INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventReadRemoteFeatures")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 759, "Event: SendEventReadRemoteFeatures"); } } while (0)
;
760 DEBUG_LOG(WII_IPC_WIIMOTE, " Connection_Handle: 0x%04x", pReadRemoteFeatures->ConnectionHandle)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 760, " Connection_Handle: 0x%04x", pReadRemoteFeatures->
ConnectionHandle); } } while (0)
;
761 DEBUG_LOG(WII_IPC_WIIMOTE, " features: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 764, " features: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
pReadRemoteFeatures->features[0], pReadRemoteFeatures->
features[1], pReadRemoteFeatures->features[2], pReadRemoteFeatures
->features[3], pReadRemoteFeatures->features[4], pReadRemoteFeatures
->features[5], pReadRemoteFeatures->features[6], pReadRemoteFeatures
->features[7]); } } while (0)
762 pReadRemoteFeatures->features[0], pReadRemoteFeatures->features[1], pReadRemoteFeatures->features[2],do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 764, " features: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
pReadRemoteFeatures->features[0], pReadRemoteFeatures->
features[1], pReadRemoteFeatures->features[2], pReadRemoteFeatures
->features[3], pReadRemoteFeatures->features[4], pReadRemoteFeatures
->features[5], pReadRemoteFeatures->features[6], pReadRemoteFeatures
->features[7]); } } while (0)
763 pReadRemoteFeatures->features[3], pReadRemoteFeatures->features[4], pReadRemoteFeatures->features[5],do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 764, " features: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
pReadRemoteFeatures->features[0], pReadRemoteFeatures->
features[1], pReadRemoteFeatures->features[2], pReadRemoteFeatures
->features[3], pReadRemoteFeatures->features[4], pReadRemoteFeatures
->features[5], pReadRemoteFeatures->features[6], pReadRemoteFeatures
->features[7]); } } while (0)
764 pReadRemoteFeatures->features[6], pReadRemoteFeatures->features[7])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 764, " features: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
pReadRemoteFeatures->features[0], pReadRemoteFeatures->
features[1], pReadRemoteFeatures->features[2], pReadRemoteFeatures
->features[3], pReadRemoteFeatures->features[4], pReadRemoteFeatures
->features[5], pReadRemoteFeatures->features[6], pReadRemoteFeatures
->features[7]); } } while (0)
;
765
766 AddEventToQueue(Event);
767
768 return true;
769}
770
771bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadRemoteVerInfo(u16 _connectionHandle)
772{
773 CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle);
774 if (pWiiMote == NULL__null)
775 return false;
776
777 SQueuedEvent Event(sizeof(SHCIEventReadRemoteVerInfo), _connectionHandle);
778
779 SHCIEventReadRemoteVerInfo* pReadRemoteVerInfo = (SHCIEventReadRemoteVerInfo*)Event.m_buffer;
780 pReadRemoteVerInfo->EventType = HCI_EVENT_READ_REMOTE_VER_INFO_COMPL0x0c;
781 pReadRemoteVerInfo->PayloadLength = sizeof(SHCIEventReadRemoteVerInfo) - 2;
782 pReadRemoteVerInfo->EventStatus = 0x00;
783 pReadRemoteVerInfo->ConnectionHandle = _connectionHandle;
784 pReadRemoteVerInfo->lmp_version = pWiiMote->GetLMPVersion();
785 pReadRemoteVerInfo->manufacturer = pWiiMote->GetManufactorID();
786 pReadRemoteVerInfo->lmp_subversion = pWiiMote->GetLMPSubVersion();
787
788 INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventReadRemoteVerInfo")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 788, "Event: SendEventReadRemoteVerInfo"); } } while (0)
;
789 DEBUG_LOG(WII_IPC_WIIMOTE, " Connection_Handle: 0x%04x", pReadRemoteVerInfo->ConnectionHandle)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 789, " Connection_Handle: 0x%04x", pReadRemoteVerInfo->
ConnectionHandle); } } while (0)
;
790 DEBUG_LOG(WII_IPC_WIIMOTE, " lmp_version: 0x%02x", pReadRemoteVerInfo->lmp_version)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 790, " lmp_version: 0x%02x", pReadRemoteVerInfo->lmp_version
); } } while (0)
;
791 DEBUG_LOG(WII_IPC_WIIMOTE, " manufacturer: 0x%04x", pReadRemoteVerInfo->manufacturer)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 791, " manufacturer: 0x%04x", pReadRemoteVerInfo->manufacturer
); } } while (0)
;
792 DEBUG_LOG(WII_IPC_WIIMOTE, " lmp_subversion: 0x%04x", pReadRemoteVerInfo->lmp_subversion)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 792, " lmp_subversion: 0x%04x", pReadRemoteVerInfo->lmp_subversion
); } } while (0)
;
793
794 AddEventToQueue(Event);
795
796 return true;
797}
798
799void CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventCommandComplete(u16 _OpCode, void* _pData, u32 _DataSize)
800{
801 _dbg_assert_(WII_IPC_WIIMOTE, (sizeof(SHCIEventCommand) - 2 + _DataSize) < 256){};
802
803 SQueuedEvent Event(sizeof(SHCIEventCommand) + _DataSize, 0);
804
805 SHCIEventCommand* pHCIEvent = (SHCIEventCommand*)Event.m_buffer;
806 pHCIEvent->EventType = HCI_EVENT_COMMAND_COMPL0x0e;
807 pHCIEvent->PayloadLength = (u8)(sizeof(SHCIEventCommand) - 2 + _DataSize);
808 pHCIEvent->PacketIndicator = 0x01;
809 pHCIEvent->Opcode = _OpCode;
810
811 // add the payload
812 if ((_pData != NULL__null) && (_DataSize > 0))
813 {
814 u8* pPayload = Event.m_buffer + sizeof(SHCIEventCommand);
815 memcpy(pPayload, _pData, _DataSize);
816 }
817
818 INFO_LOG(WII_IPC_WIIMOTE, "Event: Command Complete (Opcode: 0x%04x)", pHCIEvent->Opcode)do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 818, "Event: Command Complete (Opcode: 0x%04x)", pHCIEvent->
Opcode); } } while (0)
;
819
820 AddEventToQueue(Event);
821}
822
823bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventCommandStatus(u16 _Opcode)
824{
825 SQueuedEvent Event(sizeof(SHCIEventStatus), 0);
826
827 SHCIEventStatus* pHCIEvent = (SHCIEventStatus*)Event.m_buffer;
828 pHCIEvent->EventType = HCI_EVENT_COMMAND_STATUS0x0f;
829 pHCIEvent->PayloadLength = sizeof(SHCIEventStatus) - 2;
830 pHCIEvent->EventStatus = 0x0;
831 pHCIEvent->PacketIndicator = 0x01;
832 pHCIEvent->Opcode = _Opcode;
833
834 INFO_LOG(WII_IPC_WIIMOTE, "Event: Command Status (Opcode: 0x%04x)", pHCIEvent->Opcode)do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 834, "Event: Command Status (Opcode: 0x%04x)", pHCIEvent->
Opcode); } } while (0)
;
835
836 AddEventToQueue(Event);
837
838 return true;
839}
840
841bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRoleChange(bdaddr_t _bd, bool _master)
842{
843 CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_bd);
844 if (pWiiMote == NULL__null)
845 return false;
846
847 SQueuedEvent Event(sizeof(SHCIEventRoleChange), 0);
848
849 SHCIEventRoleChange* pRoleChange = (SHCIEventRoleChange*)Event.m_buffer;
850
851 pRoleChange->EventType = HCI_EVENT_ROLE_CHANGE0x12;
852 pRoleChange->PayloadLength = sizeof(SHCIEventRoleChange) - 2;
853 pRoleChange->EventStatus = 0x00;
854 pRoleChange->bdaddr = _bd;
855 pRoleChange->NewRole = _master ? 0x00 : 0x01;
856
857 AddEventToQueue(Event);
858
859 INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventRoleChange")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 859, "Event: SendEventRoleChange"); } } while (0)
;
860 DEBUG_LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x",do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 862, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pRoleChange->
bdaddr.b[0], pRoleChange->bdaddr.b[1], pRoleChange->bdaddr
.b[2], pRoleChange->bdaddr.b[3], pRoleChange->bdaddr.b[
4], pRoleChange->bdaddr.b[5]); } } while (0)
861 pRoleChange->bdaddr.b[0], pRoleChange->bdaddr.b[1], pRoleChange->bdaddr.b[2],do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 862, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pRoleChange->
bdaddr.b[0], pRoleChange->bdaddr.b[1], pRoleChange->bdaddr
.b[2], pRoleChange->bdaddr.b[3], pRoleChange->bdaddr.b[
4], pRoleChange->bdaddr.b[5]); } } while (0)
862 pRoleChange->bdaddr.b[3], pRoleChange->bdaddr.b[4], pRoleChange->bdaddr.b[5])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 862, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pRoleChange->
bdaddr.b[0], pRoleChange->bdaddr.b[1], pRoleChange->bdaddr
.b[2], pRoleChange->bdaddr.b[3], pRoleChange->bdaddr.b[
4], pRoleChange->bdaddr.b[5]); } } while (0)
;
863 DEBUG_LOG(WII_IPC_WIIMOTE, " NewRole: %i", pRoleChange->NewRole)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 863, " NewRole: %i", pRoleChange->NewRole); } } while (
0)
;
864
865 return true;
866}
867
868bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventNumberOfCompletedPackets()
869{
870 SQueuedEvent Event(sizeof(hci_event_hdr_t) + sizeof(hci_num_compl_pkts_ep) + sizeof(hci_num_compl_pkts_info) * m_WiiMotes.size(), 0);
871
872 INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventNumberOfCompletedPackets")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 872, "Event: SendEventNumberOfCompletedPackets"); } } while
(0)
;
873
874 hci_event_hdr_t* event_hdr = (hci_event_hdr_t*)Event.m_buffer;
875 hci_num_compl_pkts_ep* event = (hci_num_compl_pkts_ep*)((u8*)event_hdr + sizeof(hci_event_hdr_t));
876 hci_num_compl_pkts_info* info = (hci_num_compl_pkts_info*)((u8*)event + sizeof(hci_num_compl_pkts_ep));
877
878 event_hdr->event = HCI_EVENT_NUM_COMPL_PKTS0x13;
879 event_hdr->length = sizeof(hci_num_compl_pkts_ep);
880 event->num_con_handles = 0;
881
882 u32 acc = 0;
883
884 for (unsigned int i = 0; i < m_WiiMotes.size(); i++)
885 {
886 event_hdr->length += sizeof(hci_num_compl_pkts_info);
887 event->num_con_handles++;
888 info->compl_pkts = m_PacketCount[i];
889 info->con_handle = m_WiiMotes[i].GetConnectionHandle();
890
891 DEBUG_LOG(WII_IPC_WIIMOTE, " Connection_Handle: 0x%04x", info->con_handle)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 891, " Connection_Handle: 0x%04x", info->con_handle); }
} while (0)
;
892 DEBUG_LOG(WII_IPC_WIIMOTE, " Number_Of_Completed_Packets: %i", info->compl_pkts)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 892, " Number_Of_Completed_Packets: %i", info->compl_pkts
); } } while (0)
;
893
894 acc += info->compl_pkts;
895 m_PacketCount[i] = 0;
896 info++;
897 }
898
899 if (acc)
900 {
901 AddEventToQueue(Event);
902 }
903 else
904 {
905 INFO_LOG(WII_IPC_WIIMOTE, "SendEventNumberOfCompletedPackets: no packets; no event")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 905, "SendEventNumberOfCompletedPackets: no packets; no event"
); } } while (0)
;
906 }
907
908 return true;
909}
910
911bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventModeChange(u16 _connectionHandle, u8 _mode, u16 _value)
912{
913 CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle);
914 if (pWiiMote == NULL__null)
915 return false;
916
917 SQueuedEvent Event(sizeof(SHCIEventModeChange), _connectionHandle);
918
919 SHCIEventModeChange* pModeChange = (SHCIEventModeChange*)Event.m_buffer;
920 pModeChange->EventType = HCI_EVENT_MODE_CHANGE0x14;
921 pModeChange->PayloadLength = sizeof(SHCIEventModeChange) - 2;
922 pModeChange->EventStatus = 0;
923 pModeChange->Connection_Handle = _connectionHandle;
924 pModeChange->CurrentMode = _mode;
925 pModeChange->Value = _value;
926
927 INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventModeChange")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 927, "Event: SendEventModeChange"); } } while (0)
;
928 DEBUG_LOG(WII_IPC_WIIMOTE, " Connection_Handle: 0x%04x", pModeChange->Connection_Handle)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 928, " Connection_Handle: 0x%04x", pModeChange->Connection_Handle
); } } while (0)
;
929 DEBUG_LOG(WII_IPC_WIIMOTE, " Current Mode: 0x%02x", pModeChange->CurrentMode = _mode)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 929, " Current Mode: 0x%02x", pModeChange->CurrentMode =
_mode); } } while (0)
;
930
931 AddEventToQueue(Event);
932
933 return true;
934}
935
936bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventLinkKeyNotification(const u8 num_to_send)
937{
938 u8 payload_length = sizeof(hci_return_link_keys_ep) + sizeof(hci_link_key_rep_cp) * num_to_send;
939 SQueuedEvent Event(2 + payload_length, 0);
940 SHCIEventLinkKeyNotification* pEventLinkKey = (SHCIEventLinkKeyNotification*)Event.m_buffer;
941
942 INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventLinkKeyNotification")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 942, "Event: SendEventLinkKeyNotification"); } } while (0)
;
943
944 // event header
945 pEventLinkKey->EventType = HCI_EVENT_RETURN_LINK_KEYS0x15;
946 pEventLinkKey->PayloadLength = payload_length;
947 // this is really hci_return_link_keys_ep.num_keys
948 pEventLinkKey->numKeys = num_to_send;
949
950 // copy infos - this only works correctly if we're meant to start at first device and read all keys
951 for (int i = 0; i < num_to_send; i++)
952 {
953 hci_link_key_rep_cp* link_key_info
954 = (hci_link_key_rep_cp*)((u8*)&pEventLinkKey->bdaddr + sizeof(hci_link_key_rep_cp) * i);
955 link_key_info->bdaddr = m_WiiMotes[i].GetBD();
956 memcpy(link_key_info->key, m_WiiMotes[i].GetLinkKey(), HCI_KEY_SIZE16);
957
958 DEBUG_LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x",do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 960, " bd: %02x:%02x:%02x:%02x:%02x:%02x", link_key_info->
bdaddr.b[0], link_key_info->bdaddr.b[1], link_key_info->
bdaddr.b[2], link_key_info->bdaddr.b[3], link_key_info->
bdaddr.b[4], link_key_info->bdaddr.b[5]); } } while (0)
959 link_key_info->bdaddr.b[0], link_key_info->bdaddr.b[1], link_key_info->bdaddr.b[2],do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 960, " bd: %02x:%02x:%02x:%02x:%02x:%02x", link_key_info->
bdaddr.b[0], link_key_info->bdaddr.b[1], link_key_info->
bdaddr.b[2], link_key_info->bdaddr.b[3], link_key_info->
bdaddr.b[4], link_key_info->bdaddr.b[5]); } } while (0)
960 link_key_info->bdaddr.b[3], link_key_info->bdaddr.b[4], link_key_info->bdaddr.b[5])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 960, " bd: %02x:%02x:%02x:%02x:%02x:%02x", link_key_info->
bdaddr.b[0], link_key_info->bdaddr.b[1], link_key_info->
bdaddr.b[2], link_key_info->bdaddr.b[3], link_key_info->
bdaddr.b[4], link_key_info->bdaddr.b[5]); } } while (0)
;
961 LOG_LinkKey(link_key_info->key);
962 }
963
964 AddEventToQueue(Event);
965
966 return true;
967};
968
969bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRequestLinkKey(const bdaddr_t& _bd)
970{
971 SQueuedEvent Event(sizeof(SHCIEventRequestLinkKey), 0);
972
973 SHCIEventRequestLinkKey* pEventRequestLinkKey = (SHCIEventRequestLinkKey*)Event.m_buffer;
974
975 pEventRequestLinkKey->EventType = HCI_EVENT_LINK_KEY_REQ0x17;
976 pEventRequestLinkKey->PayloadLength = sizeof(SHCIEventRequestLinkKey) - 2;
977 pEventRequestLinkKey->bdaddr = _bd;
978
979 INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventRequestLinkKey")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 979, "Event: SendEventRequestLinkKey"); } } while (0)
;
980 DEBUG_LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x",do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 982, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pEventRequestLinkKey
->bdaddr.b[0], pEventRequestLinkKey->bdaddr.b[1], pEventRequestLinkKey
->bdaddr.b[2], pEventRequestLinkKey->bdaddr.b[3], pEventRequestLinkKey
->bdaddr.b[4], pEventRequestLinkKey->bdaddr.b[5]); } } while
(0)
981 pEventRequestLinkKey->bdaddr.b[0], pEventRequestLinkKey->bdaddr.b[1], pEventRequestLinkKey->bdaddr.b[2],do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 982, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pEventRequestLinkKey
->bdaddr.b[0], pEventRequestLinkKey->bdaddr.b[1], pEventRequestLinkKey
->bdaddr.b[2], pEventRequestLinkKey->bdaddr.b[3], pEventRequestLinkKey
->bdaddr.b[4], pEventRequestLinkKey->bdaddr.b[5]); } } while
(0)
982 pEventRequestLinkKey->bdaddr.b[3], pEventRequestLinkKey->bdaddr.b[4], pEventRequestLinkKey->bdaddr.b[5])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 982, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pEventRequestLinkKey
->bdaddr.b[0], pEventRequestLinkKey->bdaddr.b[1], pEventRequestLinkKey
->bdaddr.b[2], pEventRequestLinkKey->bdaddr.b[3], pEventRequestLinkKey
->bdaddr.b[4], pEventRequestLinkKey->bdaddr.b[5]); } } while
(0)
;
983
984 AddEventToQueue(Event);
985
986 return true;
987};
988
989bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadClockOffsetComplete(u16 _connectionHandle)
990{
991 CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle);
992 if (pWiiMote == NULL__null)
993 return false;
994
995 SQueuedEvent Event(sizeof(SHCIEventReadClockOffsetComplete), _connectionHandle);
996
997 SHCIEventReadClockOffsetComplete* pReadClockOffsetComplete = (SHCIEventReadClockOffsetComplete*)Event.m_buffer;
998 pReadClockOffsetComplete->EventType = HCI_EVENT_READ_CLOCK_OFFSET_COMPL0x1c;
999 pReadClockOffsetComplete->PayloadLength = sizeof(SHCIEventReadClockOffsetComplete) - 2;
1000 pReadClockOffsetComplete->EventStatus = 0x00;
1001 pReadClockOffsetComplete->ConnectionHandle = _connectionHandle;
1002 pReadClockOffsetComplete->ClockOffset = 0x3818;
1003
1004 INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventReadClockOffsetComplete")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1004, "Event: SendEventReadClockOffsetComplete"); } } while
(0)
;
1005 DEBUG_LOG(WII_IPC_WIIMOTE, " Connection_Handle: 0x%04x", pReadClockOffsetComplete->ConnectionHandle)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1005, " Connection_Handle: 0x%04x", pReadClockOffsetComplete
->ConnectionHandle); } } while (0)
;
1006 DEBUG_LOG(WII_IPC_WIIMOTE, " ClockOffset: 0x%04x", pReadClockOffsetComplete->ClockOffset)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1006, " ClockOffset: 0x%04x", pReadClockOffsetComplete->
ClockOffset); } } while (0)
;
1007
1008 AddEventToQueue(Event);
1009
1010 return true;
1011}
1012
1013bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventConPacketTypeChange(u16 _connectionHandle, u16 _packetType)
1014{
1015 CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle);
1016 if (pWiiMote == NULL__null)
1017 return false;
1018
1019 SQueuedEvent Event(sizeof(SHCIEventConPacketTypeChange), _connectionHandle);
1020
1021 SHCIEventConPacketTypeChange* pChangeConPacketType = (SHCIEventConPacketTypeChange*)Event.m_buffer;
1022 pChangeConPacketType->EventType = HCI_EVENT_CON_PKT_TYPE_CHANGED0x1d;
1023 pChangeConPacketType->PayloadLength = sizeof(SHCIEventConPacketTypeChange) - 2;
1024 pChangeConPacketType->EventStatus = 0x00;
1025 pChangeConPacketType->ConnectionHandle = _connectionHandle;
1026 pChangeConPacketType->PacketType = _packetType;
1027
1028 INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventConPacketTypeChange")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1028, "Event: SendEventConPacketTypeChange"); } } while (0)
;
1029 DEBUG_LOG(WII_IPC_WIIMOTE, " Connection_Handle: 0x%04x", pChangeConPacketType->ConnectionHandle)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1029, " Connection_Handle: 0x%04x", pChangeConPacketType->
ConnectionHandle); } } while (0)
;
1030 DEBUG_LOG(WII_IPC_WIIMOTE, " PacketType: 0x%04x", pChangeConPacketType->PacketType)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1030, " PacketType: 0x%04x", pChangeConPacketType->PacketType
); } } while (0)
;
1031
1032 AddEventToQueue(Event);
1033
1034 return true;
1035}
1036
1037
1038// Command dispatcher
1039// This is called from the USBV0_IOCTL_CTRLMSG Ioctlv
1040void CWII_IPC_HLE_Device_usb_oh1_57e_305::ExecuteHCICommandMessage(const SHCICommandMessage& _rHCICommandMessage)
1041{
1042 u8* pInput = Memory::GetPointer(_rHCICommandMessage.m_PayLoadAddr + 3);
1043 SCommandMessage* pMsg = (SCommandMessage*)Memory::GetPointer(_rHCICommandMessage.m_PayLoadAddr);
1044
1045 u16 ocf = HCI_OCF(pMsg->Opcode)((pMsg->Opcode) & 0x3ff);
1046 u16 ogf = HCI_OGF(pMsg->Opcode)(((pMsg->Opcode) >> 10) & 0x3f);
1047
1048 INFO_LOG(WII_IPC_WIIMOTE, "**************************************************")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1048, "**************************************************")
; } } while (0)
;
1049 INFO_LOG(WII_IPC_WIIMOTE, "Execute HCI Command: 0x%04x (ocf: 0x%02x, ogf: 0x%02x)", pMsg->Opcode, ocf, ogf)do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1049, "Execute HCI Command: 0x%04x (ocf: 0x%02x, ogf: 0x%02x)"
, pMsg->Opcode, ocf, ogf); } } while (0)
;
1050
1051 switch (pMsg->Opcode)
1052 {
1053 //
1054 // --- read commands ---
1055 //
1056 case HCI_CMD_RESET0x0C03:
1057 CommandReset(pInput);
1058 break;
1059
1060 case HCI_CMD_READ_BUFFER_SIZE0x1005:
1061 CommandReadBufferSize(pInput);
1062 break;
1063
1064 case HCI_CMD_READ_LOCAL_VER0x1001:
1065 CommandReadLocalVer(pInput);
1066 break;
1067
1068 case HCI_CMD_READ_BDADDR0x1009:
1069 CommandReadBDAdrr(pInput);
1070 break;
1071
1072 case HCI_CMD_READ_LOCAL_FEATURES0x1003:
1073 CommandReadLocalFeatures(pInput);
1074 break;
1075
1076 case HCI_CMD_READ_STORED_LINK_KEY0x0C0D:
1077 CommandReadStoredLinkKey(pInput);
1078 break;
1079
1080 case HCI_CMD_WRITE_UNIT_CLASS0x0C24:
1081 CommandWriteUnitClass(pInput);
1082 break;
1083
1084 case HCI_CMD_WRITE_LOCAL_NAME0x0C13:
1085 CommandWriteLocalName(pInput);
1086 break;
1087
1088 case HCI_CMD_WRITE_PIN_TYPE0x0C0A:
1089 CommandWritePinType(pInput);
1090 break;
1091
1092 case HCI_CMD_HOST_BUFFER_SIZE0x0C33:
1093 CommandHostBufferSize(pInput);
1094 break;
1095
1096 case HCI_CMD_WRITE_PAGE_TIMEOUT0x0C18:
1097 CommandWritePageTimeOut(pInput);
1098 break;
1099
1100 case HCI_CMD_WRITE_SCAN_ENABLE0x0C1A:
1101 CommandWriteScanEnable(pInput);
1102 break;
1103
1104 case HCI_CMD_WRITE_INQUIRY_MODE0x0C45:
1105 CommandWriteInquiryMode(pInput);
1106 break;
1107
1108 case HCI_CMD_WRITE_PAGE_SCAN_TYPE0x0C47:
1109 CommandWritePageScanType(pInput);
1110 break;
1111
1112 case HCI_CMD_SET_EVENT_FILTER0x0C05:
1113 CommandSetEventFilter(pInput);
1114 break;
1115
1116 case HCI_CMD_INQUIRY0x0401:
1117 CommandInquiry(pInput);
1118 break;
1119
1120 case HCI_CMD_WRITE_INQUIRY_SCAN_TYPE0x0C43:
1121 CommandWriteInquiryScanType(pInput);
1122 break;
1123
1124 // vendor specific...
1125 case 0xFC4C:
1126 CommandVendorSpecific_FC4C(pInput, _rHCICommandMessage.m_PayLoadSize - 3);
1127 break;
1128
1129 case 0xFC4F:
1130 CommandVendorSpecific_FC4F(pInput, _rHCICommandMessage.m_PayLoadSize - 3);
1131 break;
1132
1133 case HCI_CMD_INQUIRY_CANCEL0x0402:
1134 CommandInquiryCancel(pInput);
1135 break;
1136
1137 case HCI_CMD_REMOTE_NAME_REQ0x0419:
1138 CommandRemoteNameReq(pInput);
1139 break;
1140
1141 case HCI_CMD_CREATE_CON0x0405:
1142 CommandCreateCon(pInput);
1143 break;
1144
1145 case HCI_CMD_ACCEPT_CON0x0409:
1146 CommandAcceptCon(pInput);
1147 break;
1148
1149 case HCI_CMD_CHANGE_CON_PACKET_TYPE0x040F:
1150 CommandChangeConPacketType(pInput);
1151 break;
1152
1153 case HCI_CMD_READ_CLOCK_OFFSET0x041F:
1154 CommandReadClockOffset(pInput);
1155 break;
1156
1157 case HCI_CMD_READ_REMOTE_VER_INFO0x041D:
1158 CommandReadRemoteVerInfo(pInput);
1159 break;
1160
1161 case HCI_CMD_READ_REMOTE_FEATURES0x041B:
1162 CommandReadRemoteFeatures(pInput);
1163 break;
1164
1165 case HCI_CMD_WRITE_LINK_POLICY_SETTINGS0x080D:
1166 CommandWriteLinkPolicy(pInput);
1167 break;
1168
1169 case HCI_CMD_AUTH_REQ0x0411:
1170 CommandAuthenticationRequested(pInput);
1171 break;
1172
1173 case HCI_CMD_SNIFF_MODE0x0803:
1174 CommandSniffMode(pInput);
1175 break;
1176
1177 case HCI_CMD_DISCONNECT0x0406:
1178 CommandDisconnect(pInput);
1179 break;
1180
1181 case HCI_CMD_WRITE_LINK_SUPERVISION_TIMEOUT0x0C37:
1182 CommandWriteLinkSupervisionTimeout(pInput);
1183 break;
1184
1185 case HCI_CMD_LINK_KEY_NEG_REP0x040C:
1186 CommandLinkKeyNegRep(pInput);
1187 break;
1188
1189 case HCI_CMD_LINK_KEY_REP0x040B:
1190 CommandLinkKeyRep(pInput);
1191 break;
1192
1193 case HCI_CMD_DELETE_STORED_LINK_KEY0x0C12:
1194 CommandDeleteStoredLinkKey(pInput);
1195 break;
1196
1197 default:
1198 // send fake okay msg...
1199 SendEventCommandComplete(pMsg->Opcode, NULL__null, 0);
1200
1201 if (ogf == HCI_OGF_VENDOR0x3f)
1202 {
1203 ERROR_LOG(WII_IPC_WIIMOTE, "Command: vendor specific: 0x%04X (ocf: 0x%x)", pMsg->Opcode, ocf)do { { if (LogTypes::LERROR <= 3) GenericLog(LogTypes::LERROR
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1203, "Command: vendor specific: 0x%04X (ocf: 0x%x)", pMsg->
Opcode, ocf); } } while (0)
;
1204 for (int i = 0; i < pMsg->len; i++)
1205 {
1206 ERROR_LOG(WII_IPC_WIIMOTE, " 0x02%x", pInput[i])do { { if (LogTypes::LERROR <= 3) GenericLog(LogTypes::LERROR
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1206, " 0x02%x", pInput[i]); } } while (0)
;
1207 }
1208 }
1209 else
1210 {
1211 _dbg_assert_msg_(WII_IPC_WIIMOTE, 0,{}
1212 "Unknown USB_IOCTL_CTRLMSG: 0x%04X (ocf: 0x%x ogf 0x%x)", pMsg->Opcode, ocf, ogf){};
1213 }
1214 break;
1215 }
1216
1217 // HCI command is finished, send a reply to command
1218 WII_IPC_HLE_Interface::EnqReply(_rHCICommandMessage.m_Address);
1219}
1220
1221
1222//
1223//
1224// --- command helper
1225//
1226//
1227void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandInquiry(u8* _Input)
1228{
1229 // Inquiry should not be called normally
1230 hci_inquiry_cp* pInquiry = (hci_inquiry_cp*)_Input;
1231
1232 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_INQUIRY:")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1232, "Command: HCI_CMD_INQUIRY:"); } } while (0)
;
1233 DEBUG_LOG(WII_IPC_WIIMOTE, "write:")do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1233, "write:"); } } while (0)
;
1234 DEBUG_LOG(WII_IPC_WIIMOTE, " LAP[0]: 0x%02x", pInquiry->lap[0])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1234, " LAP[0]: 0x%02x", pInquiry->lap[0]); } } while (
0)
;
1235 DEBUG_LOG(WII_IPC_WIIMOTE, " LAP[1]: 0x%02x", pInquiry->lap[1])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1235, " LAP[1]: 0x%02x", pInquiry->lap[1]); } } while (
0)
;
1236 DEBUG_LOG(WII_IPC_WIIMOTE, " LAP[2]: 0x%02x", pInquiry->lap[2])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1236, " LAP[2]: 0x%02x", pInquiry->lap[2]); } } while (
0)
;
1237 DEBUG_LOG(WII_IPC_WIIMOTE, " inquiry_length: %i (N x 1.28) sec", pInquiry->inquiry_length)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1237, " inquiry_length: %i (N x 1.28) sec", pInquiry->inquiry_length
); } } while (0)
;
1238 DEBUG_LOG(WII_IPC_WIIMOTE, " num_responses: %i (N x 1.28) sec", pInquiry->num_responses)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1238, " num_responses: %i (N x 1.28) sec", pInquiry->num_responses
); } } while (0)
;
1239
1240 SendEventCommandStatus(HCI_CMD_INQUIRY0x0401);
1241 SendEventInquiryResponse();
1242 SendEventInquiryComplete();
1243}
1244
1245void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandInquiryCancel(u8* _Input)
1246{
1247 hci_inquiry_cancel_rp Reply;
1248 Reply.status = 0x00;
1249
1250 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_INQUIRY_CANCEL")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1250, "Command: HCI_CMD_INQUIRY_CANCEL"); } } while (0)
;
1251
1252 SendEventCommandComplete(HCI_CMD_INQUIRY_CANCEL0x0402, &Reply, sizeof(hci_inquiry_cancel_rp));
1253}
1254
1255void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandCreateCon(u8* _Input)
1256{
1257 hci_create_con_cp* pCreateCon = (hci_create_con_cp*)_Input;
1258
1259 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_CREATE_CON")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1259, "Command: HCI_CMD_CREATE_CON"); } } while (0)
;
1260 DEBUG_LOG(WII_IPC_WIIMOTE, "Input:")do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1260, "Input:"); } } while (0)
;
1261 DEBUG_LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x",do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1263, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pCreateCon->
bdaddr.b[0], pCreateCon->bdaddr.b[1], pCreateCon->bdaddr
.b[2], pCreateCon->bdaddr.b[3], pCreateCon->bdaddr.b[4]
, pCreateCon->bdaddr.b[5]); } } while (0)
1262 pCreateCon->bdaddr.b[0], pCreateCon->bdaddr.b[1], pCreateCon->bdaddr.b[2],do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1263, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pCreateCon->
bdaddr.b[0], pCreateCon->bdaddr.b[1], pCreateCon->bdaddr
.b[2], pCreateCon->bdaddr.b[3], pCreateCon->bdaddr.b[4]
, pCreateCon->bdaddr.b[5]); } } while (0)
1263 pCreateCon->bdaddr.b[3], pCreateCon->bdaddr.b[4], pCreateCon->bdaddr.b[5])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1263, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pCreateCon->
bdaddr.b[0], pCreateCon->bdaddr.b[1], pCreateCon->bdaddr
.b[2], pCreateCon->bdaddr.b[3], pCreateCon->bdaddr.b[4]
, pCreateCon->bdaddr.b[5]); } } while (0)
;
1264
1265 DEBUG_LOG(WII_IPC_WIIMOTE, " pkt_type: %i", pCreateCon->pkt_type)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1265, " pkt_type: %i", pCreateCon->pkt_type); } } while
(0)
;
1266 DEBUG_LOG(WII_IPC_WIIMOTE, " page_scan_rep_mode: %i", pCreateCon->page_scan_rep_mode)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1266, " page_scan_rep_mode: %i", pCreateCon->page_scan_rep_mode
); } } while (0)
;
1267 DEBUG_LOG(WII_IPC_WIIMOTE, " page_scan_mode: %i", pCreateCon->page_scan_mode)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1267, " page_scan_mode: %i", pCreateCon->page_scan_mode
); } } while (0)
;
1268 DEBUG_LOG(WII_IPC_WIIMOTE, " clock_offset: %i", pCreateCon->clock_offset)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1268, " clock_offset: %i", pCreateCon->clock_offset); }
} while (0)
;
1269 DEBUG_LOG(WII_IPC_WIIMOTE, " accept_role_switch: %i", pCreateCon->accept_role_switch)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1269, " accept_role_switch: %i", pCreateCon->accept_role_switch
); } } while (0)
;
1270
1271 SendEventCommandStatus(HCI_CMD_CREATE_CON0x0405);
1272 SendEventConnectionComplete(pCreateCon->bdaddr);
1273}
1274
1275void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandDisconnect(u8* _Input)
1276{
1277 hci_discon_cp* pDiscon = (hci_discon_cp*)_Input;
1278
1279 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_DISCONNECT")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1279, "Command: HCI_CMD_DISCONNECT"); } } while (0)
;
1280 DEBUG_LOG(WII_IPC_WIIMOTE, " ConnectionHandle: 0x%04x", pDiscon->con_handle)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1280, " ConnectionHandle: 0x%04x", pDiscon->con_handle)
; } } while (0)
;
1281 DEBUG_LOG(WII_IPC_WIIMOTE, " Reason: 0x%02x", pDiscon->reason)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1281, " Reason: 0x%02x", pDiscon->reason); } } while (0
)
;
1282
1283 Host_SetWiiMoteConnectionState(0);
1284
1285 SendEventCommandStatus(HCI_CMD_DISCONNECT0x0406);
1286 SendEventDisconnect(pDiscon->con_handle, pDiscon->reason);
1287
1288 CWII_IPC_HLE_WiiMote* pWiimote = AccessWiiMote(pDiscon->con_handle);
1289 if (pWiimote)
1290 pWiimote->EventDisconnect();
1291}
1292
1293void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandAcceptCon(u8* _Input)
1294{
1295 hci_accept_con_cp* pAcceptCon = (hci_accept_con_cp*)_Input;
1296
1297 static char s_szRole[][128] =
1298 {
1299 { "Master (0x00)"},
1300 { "Slave (0x01)"},
1301 };
1302
1303 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_ACCEPT_CON")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1303, "Command: HCI_CMD_ACCEPT_CON"); } } while (0)
;
1304 DEBUG_LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x",do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1306, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pAcceptCon->
bdaddr.b[0], pAcceptCon->bdaddr.b[1], pAcceptCon->bdaddr
.b[2], pAcceptCon->bdaddr.b[3], pAcceptCon->bdaddr.b[4]
, pAcceptCon->bdaddr.b[5]); } } while (0)
1305 pAcceptCon->bdaddr.b[0], pAcceptCon->bdaddr.b[1], pAcceptCon->bdaddr.b[2],do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1306, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pAcceptCon->
bdaddr.b[0], pAcceptCon->bdaddr.b[1], pAcceptCon->bdaddr
.b[2], pAcceptCon->bdaddr.b[3], pAcceptCon->bdaddr.b[4]
, pAcceptCon->bdaddr.b[5]); } } while (0)
1306 pAcceptCon->bdaddr.b[3], pAcceptCon->bdaddr.b[4], pAcceptCon->bdaddr.b[5])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1306, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pAcceptCon->
bdaddr.b[0], pAcceptCon->bdaddr.b[1], pAcceptCon->bdaddr
.b[2], pAcceptCon->bdaddr.b[3], pAcceptCon->bdaddr.b[4]
, pAcceptCon->bdaddr.b[5]); } } while (0)
;
1307 DEBUG_LOG(WII_IPC_WIIMOTE, " role: %s", s_szRole[pAcceptCon->role])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1307, " role: %s", s_szRole[pAcceptCon->role]); } } while
(0)
;
1308
1309 SendEventCommandStatus(HCI_CMD_ACCEPT_CON0x0409);
1310
1311 // this connection wants to be the master
1312 if (pAcceptCon->role == 0)
1313 {
1314 SendEventRoleChange(pAcceptCon->bdaddr, true);
1315 }
1316
1317 SendEventConnectionComplete(pAcceptCon->bdaddr);
1318}
1319
1320void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandLinkKeyRep(u8* _Input)
1321{
1322 hci_link_key_rep_cp* pKeyRep = (hci_link_key_rep_cp*)_Input;
1323
1324 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_LINK_KEY_REP")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1324, "Command: HCI_CMD_LINK_KEY_REP"); } } while (0)
;
1325 DEBUG_LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x",do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1327, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pKeyRep->bdaddr
.b[0], pKeyRep->bdaddr.b[1], pKeyRep->bdaddr.b[2], pKeyRep
->bdaddr.b[3], pKeyRep->bdaddr.b[4], pKeyRep->bdaddr
.b[5]); } } while (0)
1326 pKeyRep->bdaddr.b[0], pKeyRep->bdaddr.b[1], pKeyRep->bdaddr.b[2],do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1327, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pKeyRep->bdaddr
.b[0], pKeyRep->bdaddr.b[1], pKeyRep->bdaddr.b[2], pKeyRep
->bdaddr.b[3], pKeyRep->bdaddr.b[4], pKeyRep->bdaddr
.b[5]); } } while (0)
1327 pKeyRep->bdaddr.b[3], pKeyRep->bdaddr.b[4], pKeyRep->bdaddr.b[5])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1327, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pKeyRep->bdaddr
.b[0], pKeyRep->bdaddr.b[1], pKeyRep->bdaddr.b[2], pKeyRep
->bdaddr.b[3], pKeyRep->bdaddr.b[4], pKeyRep->bdaddr
.b[5]); } } while (0)
;
1328 LOG_LinkKey(pKeyRep->key);
1329
1330
1331 hci_link_key_rep_rp Reply;
1332 Reply.status = 0x00;
1333 Reply.bdaddr = pKeyRep->bdaddr;
1334
1335 SendEventCommandComplete(HCI_CMD_LINK_KEY_REP0x040B, &Reply, sizeof(hci_link_key_rep_rp));
1336}
1337
1338void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandLinkKeyNegRep(u8* _Input)
1339{
1340 hci_link_key_neg_rep_cp* pKeyNeg = (hci_link_key_neg_rep_cp*)_Input;
1341
1342 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_LINK_KEY_NEG_REP")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1342, "Command: HCI_CMD_LINK_KEY_NEG_REP"); } } while (0)
;
1343 DEBUG_LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x",do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1345, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pKeyNeg->bdaddr
.b[0], pKeyNeg->bdaddr.b[1], pKeyNeg->bdaddr.b[2], pKeyNeg
->bdaddr.b[3], pKeyNeg->bdaddr.b[4], pKeyNeg->bdaddr
.b[5]); } } while (0)
1344 pKeyNeg->bdaddr.b[0], pKeyNeg->bdaddr.b[1], pKeyNeg->bdaddr.b[2],do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1345, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pKeyNeg->bdaddr
.b[0], pKeyNeg->bdaddr.b[1], pKeyNeg->bdaddr.b[2], pKeyNeg
->bdaddr.b[3], pKeyNeg->bdaddr.b[4], pKeyNeg->bdaddr
.b[5]); } } while (0)
1345 pKeyNeg->bdaddr.b[3], pKeyNeg->bdaddr.b[4], pKeyNeg->bdaddr.b[5])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1345, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pKeyNeg->bdaddr
.b[0], pKeyNeg->bdaddr.b[1], pKeyNeg->bdaddr.b[2], pKeyNeg
->bdaddr.b[3], pKeyNeg->bdaddr.b[4], pKeyNeg->bdaddr
.b[5]); } } while (0)
;
1346
1347 hci_link_key_neg_rep_rp Reply;
1348 Reply.status = 0x00;
1349 Reply.bdaddr = pKeyNeg->bdaddr;
1350
1351 SendEventCommandComplete(HCI_CMD_LINK_KEY_NEG_REP0x040C, &Reply, sizeof(hci_link_key_neg_rep_rp));
1352}
1353
1354void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandChangeConPacketType(u8* _Input)
1355{
1356 hci_change_con_pkt_type_cp* pChangePacketType = (hci_change_con_pkt_type_cp*)_Input;
1357
1358 // ntd stack sets packet type 0xcc18, which is HCI_PKT_DH5 | HCI_PKT_DM5 | HCI_PKT_DH1 | HCI_PKT_DM1
1359 // dunno what to do...run awayyyyyy!
1360 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_CHANGE_CON_PACKET_TYPE")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1360, "Command: HCI_CMD_CHANGE_CON_PACKET_TYPE"); } } while
(0)
;
1361 DEBUG_LOG(WII_IPC_WIIMOTE, " ConnectionHandle: 0x%04x", pChangePacketType->con_handle)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1361, " ConnectionHandle: 0x%04x", pChangePacketType->con_handle
); } } while (0)
;
1362 DEBUG_LOG(WII_IPC_WIIMOTE, " PacketType: 0x%04x", pChangePacketType->pkt_type)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1362, " PacketType: 0x%04x", pChangePacketType->pkt_type
); } } while (0)
;
1363
1364 SendEventCommandStatus(HCI_CMD_CHANGE_CON_PACKET_TYPE0x040F);
1365 SendEventConPacketTypeChange(pChangePacketType->con_handle, pChangePacketType->pkt_type);
1366}
1367
1368void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandAuthenticationRequested(u8* _Input)
1369{
1370 hci_auth_req_cp* pAuthReq = (hci_auth_req_cp*)_Input;
1371
1372 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_AUTH_REQ")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1372, "Command: HCI_CMD_AUTH_REQ"); } } while (0)
;
1373 DEBUG_LOG(WII_IPC_WIIMOTE, " ConnectionHandle: 0x%04x", pAuthReq->con_handle)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1373, " ConnectionHandle: 0x%04x", pAuthReq->con_handle
); } } while (0)
;
1374
1375 SendEventCommandStatus(HCI_CMD_AUTH_REQ0x0411);
1376 SendEventAuthenticationCompleted(pAuthReq->con_handle);
1377}
1378
1379void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandRemoteNameReq(u8* _Input)
1380{
1381 hci_remote_name_req_cp* pRemoteNameReq = (hci_remote_name_req_cp*)_Input;
1382
1383 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_REMOTE_NAME_REQ")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1383, "Command: HCI_CMD_REMOTE_NAME_REQ"); } } while (0)
;
1384 DEBUG_LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x",do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1386, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pRemoteNameReq
->bdaddr.b[0], pRemoteNameReq->bdaddr.b[1], pRemoteNameReq
->bdaddr.b[2], pRemoteNameReq->bdaddr.b[3], pRemoteNameReq
->bdaddr.b[4], pRemoteNameReq->bdaddr.b[5]); } } while (
0)
1385 pRemoteNameReq->bdaddr.b[0], pRemoteNameReq->bdaddr.b[1], pRemoteNameReq->bdaddr.b[2],do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1386, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pRemoteNameReq
->bdaddr.b[0], pRemoteNameReq->bdaddr.b[1], pRemoteNameReq
->bdaddr.b[2], pRemoteNameReq->bdaddr.b[3], pRemoteNameReq
->bdaddr.b[4], pRemoteNameReq->bdaddr.b[5]); } } while (
0)
1386 pRemoteNameReq->bdaddr.b[3], pRemoteNameReq->bdaddr.b[4], pRemoteNameReq->bdaddr.b[5])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1386, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pRemoteNameReq
->bdaddr.b[0], pRemoteNameReq->bdaddr.b[1], pRemoteNameReq
->bdaddr.b[2], pRemoteNameReq->bdaddr.b[3], pRemoteNameReq
->bdaddr.b[4], pRemoteNameReq->bdaddr.b[5]); } } while (
0)
;
1387 DEBUG_LOG(WII_IPC_WIIMOTE, " page_scan_rep_mode: %i", pRemoteNameReq->page_scan_rep_mode)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1387, " page_scan_rep_mode: %i", pRemoteNameReq->page_scan_rep_mode
); } } while (0)
;
1388 DEBUG_LOG(WII_IPC_WIIMOTE, " page_scan_mode: %i", pRemoteNameReq->page_scan_mode)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1388, " page_scan_mode: %i", pRemoteNameReq->page_scan_mode
); } } while (0)
;
1389 DEBUG_LOG(WII_IPC_WIIMOTE, " clock_offset: %i", pRemoteNameReq->clock_offset)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1389, " clock_offset: %i", pRemoteNameReq->clock_offset
); } } while (0)
;
1390
1391 SendEventCommandStatus(HCI_CMD_REMOTE_NAME_REQ0x0419);
1392 SendEventRemoteNameReq(pRemoteNameReq->bdaddr);
1393}
1394
1395void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadRemoteFeatures(u8* _Input)
1396{
1397 hci_read_remote_features_cp* pReadRemoteFeatures = (hci_read_remote_features_cp*)_Input;
1398
1399 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_READ_REMOTE_FEATURES")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1399, "Command: HCI_CMD_READ_REMOTE_FEATURES"); } } while (
0)
;
1400 DEBUG_LOG(WII_IPC_WIIMOTE, " ConnectionHandle: 0x%04x", pReadRemoteFeatures->con_handle)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1400, " ConnectionHandle: 0x%04x", pReadRemoteFeatures->
con_handle); } } while (0)
;
1401
1402 SendEventCommandStatus(HCI_CMD_READ_REMOTE_FEATURES0x041B);
1403 SendEventReadRemoteFeatures(pReadRemoteFeatures->con_handle);
1404}
1405
1406void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadRemoteVerInfo(u8* _Input)
1407{
1408 hci_read_remote_ver_info_cp* pReadRemoteVerInfo = (hci_read_remote_ver_info_cp*)_Input;
1409
1410 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_READ_REMOTE_VER_INFO")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1410, "Command: HCI_CMD_READ_REMOTE_VER_INFO"); } } while (
0)
;
1411 DEBUG_LOG(WII_IPC_WIIMOTE, " ConnectionHandle: 0x%02x", pReadRemoteVerInfo->con_handle)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1411, " ConnectionHandle: 0x%02x", pReadRemoteVerInfo->
con_handle); } } while (0)
;
1412
1413 SendEventCommandStatus(HCI_CMD_READ_REMOTE_VER_INFO0x041D);
1414 SendEventReadRemoteVerInfo(pReadRemoteVerInfo->con_handle);
1415}
1416
1417void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadClockOffset(u8* _Input)
1418{
1419 hci_read_clock_offset_cp* pReadClockOffset = (hci_read_clock_offset_cp*)_Input;
1420
1421 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_READ_CLOCK_OFFSET")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1421, "Command: HCI_CMD_READ_CLOCK_OFFSET"); } } while (0)
;
1422 DEBUG_LOG(WII_IPC_WIIMOTE, " ConnectionHandle: 0x%02x", pReadClockOffset->con_handle)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1422, " ConnectionHandle: 0x%02x", pReadClockOffset->con_handle
); } } while (0)
;
1423
1424 SendEventCommandStatus(HCI_CMD_READ_CLOCK_OFFSET0x041F);
1425 SendEventReadClockOffsetComplete(pReadClockOffset->con_handle);
1426}
1427
1428void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandSniffMode(u8* _Input)
1429{
1430 hci_sniff_mode_cp* pSniffMode = (hci_sniff_mode_cp*)_Input;
1431
1432 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_SNIFF_MODE")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1432, "Command: HCI_CMD_SNIFF_MODE"); } } while (0)
;
1433 INFO_LOG(WII_IPC_WIIMOTE, " ConnectionHandle: 0x%04x", pSniffMode->con_handle)do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1433, " ConnectionHandle: 0x%04x", pSniffMode->con_handle
); } } while (0)
;
1434 DEBUG_LOG(WII_IPC_WIIMOTE, " max_interval: %f msec", pSniffMode->max_interval * .625)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1434, " max_interval: %f msec", pSniffMode->max_interval
* .625); } } while (0)
;
1435 DEBUG_LOG(WII_IPC_WIIMOTE, " min_interval: %f msec", pSniffMode->min_interval * .625)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1435, " min_interval: %f msec", pSniffMode->min_interval
* .625); } } while (0)
;
1436 DEBUG_LOG(WII_IPC_WIIMOTE, " attempt: %f msec", pSniffMode->attempt * 1.25)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1436, " attempt: %f msec", pSniffMode->attempt * 1.25);
} } while (0)
;
1437 DEBUG_LOG(WII_IPC_WIIMOTE, " timeout: %f msec", pSniffMode->timeout * 1.25)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1437, " timeout: %f msec", pSniffMode->timeout * 1.25);
} } while (0)
;
1438
1439 SendEventCommandStatus(HCI_CMD_SNIFF_MODE0x0803);
1440 SendEventModeChange(pSniffMode->con_handle, 0x02, pSniffMode->max_interval); // 0x02 - sniff mode
1441}
1442
1443void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteLinkPolicy(u8* _Input)
1444{
1445 hci_write_link_policy_settings_cp* pLinkPolicy = (hci_write_link_policy_settings_cp*)_Input;
1446
1447 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_WRITE_LINK_POLICY_SETTINGS")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1447, "Command: HCI_CMD_WRITE_LINK_POLICY_SETTINGS"); } } while
(0)
;
1448 DEBUG_LOG(WII_IPC_WIIMOTE, " ConnectionHandle: 0x%04x", pLinkPolicy->con_handle)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1448, " ConnectionHandle: 0x%04x", pLinkPolicy->con_handle
); } } while (0)
;
1449 DEBUG_LOG(WII_IPC_WIIMOTE, " Policy: 0x%04x", pLinkPolicy->settings)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1449, " Policy: 0x%04x", pLinkPolicy->settings); } } while
(0)
;
1450
1451 //hci_write_link_policy_settings_rp Reply;
1452 //Reply.status = 0x00;
1453 //Reply.con_handle = pLinkPolicy->con_handle;
1454
1455 SendEventCommandStatus(HCI_CMD_WRITE_LINK_POLICY_SETTINGS0x080D);
1456
1457 //AccessWiiMote(pLinkPolicy->con_handle)->ResetChannels();
1458}
1459
1460void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReset(u8* _Input)
1461{
1462 hci_status_rp Reply;
1463 Reply.status = 0x00;
1464
1465 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_RESET")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1465, "Command: HCI_CMD_RESET"); } } while (0)
;
1466
1467 SendEventCommandComplete(HCI_CMD_RESET0x0C03, &Reply, sizeof(hci_status_rp));
1468}
1469
1470void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandSetEventFilter(u8* _Input)
1471{
1472 hci_set_event_filter_cp* pSetEventFilter = (hci_set_event_filter_cp*)_Input;
1473
1474 hci_set_event_filter_rp Reply;
1475 Reply.status = 0x00;
1476
1477 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_SET_EVENT_FILTER:")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1477, "Command: HCI_CMD_SET_EVENT_FILTER:"); } } while (0)
;
1478 DEBUG_LOG(WII_IPC_WIIMOTE, " filter_type: %i", pSetEventFilter->filter_type)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1478, " filter_type: %i", pSetEventFilter->filter_type)
; } } while (0)
;
1479 DEBUG_LOG(WII_IPC_WIIMOTE, " filter_condition_type: %i", pSetEventFilter->filter_condition_type)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1479, " filter_condition_type: %i", pSetEventFilter->filter_condition_type
); } } while (0)
;
1480
1481 SendEventCommandComplete(HCI_CMD_SET_EVENT_FILTER0x0C05, &Reply, sizeof(hci_set_event_filter_rp));
1482}
1483
1484void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWritePinType(u8* _Input)
1485{
1486 hci_write_pin_type_cp* pWritePinType = (hci_write_pin_type_cp*)_Input;
1487
1488 hci_write_pin_type_rp Reply;
1489 Reply.status = 0x00;
1490
1491 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_WRITE_PIN_TYPE:")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1491, "Command: HCI_CMD_WRITE_PIN_TYPE:"); } } while (0)
;
1492 DEBUG_LOG(WII_IPC_WIIMOTE, " pin_type: %x", pWritePinType->pin_type)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1492, " pin_type: %x", pWritePinType->pin_type); } } while
(0)
;
1493
1494 SendEventCommandComplete(HCI_CMD_WRITE_PIN_TYPE0x0C0A, &Reply, sizeof(hci_write_pin_type_rp));
1495}
1496
1497void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadStoredLinkKey(u8* _Input)
1498{
1499 hci_read_stored_link_key_cp* ReadStoredLinkKey = (hci_read_stored_link_key_cp*)_Input;
1500
1501 hci_read_stored_link_key_rp Reply;
1502 Reply.status = 0x00;
1503 Reply.max_num_keys = 255;
1504
1505 if (ReadStoredLinkKey->read_all == 1)
1
Taking false branch
1506 {
1507 Reply.num_keys_read = (u16)m_WiiMotes.size();
1508 }
1509 else
1510 {
1511 ERROR_LOG(WII_IPC_WIIMOTE, "CommandReadStoredLinkKey isn't looking for all devices")do { { if (LogTypes::LERROR <= 3) GenericLog(LogTypes::LERROR
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1511, "CommandReadStoredLinkKey isn't looking for all devices"
); } } while (0)
;
1512 }
1513
1514 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_READ_STORED_LINK_KEY:")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1514, "Command: HCI_CMD_READ_STORED_LINK_KEY:"); } } while (
0)
;
1515 DEBUG_LOG(WII_IPC_WIIMOTE, "input:")do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1515, "input:"); } } while (0)
;
1516 DEBUG_LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x",do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1518, " bd: %02x:%02x:%02x:%02x:%02x:%02x", ReadStoredLinkKey
->bdaddr.b[0], ReadStoredLinkKey->bdaddr.b[1], ReadStoredLinkKey
->bdaddr.b[2], ReadStoredLinkKey->bdaddr.b[3], ReadStoredLinkKey
->bdaddr.b[4], ReadStoredLinkKey->bdaddr.b[5]); } } while
(0)
1517 ReadStoredLinkKey->bdaddr.b[0], ReadStoredLinkKey->bdaddr.b[1], ReadStoredLinkKey->bdaddr.b[2],do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1518, " bd: %02x:%02x:%02x:%02x:%02x:%02x", ReadStoredLinkKey
->bdaddr.b[0], ReadStoredLinkKey->bdaddr.b[1], ReadStoredLinkKey
->bdaddr.b[2], ReadStoredLinkKey->bdaddr.b[3], ReadStoredLinkKey
->bdaddr.b[4], ReadStoredLinkKey->bdaddr.b[5]); } } while
(0)
1518 ReadStoredLinkKey->bdaddr.b[3], ReadStoredLinkKey->bdaddr.b[4], ReadStoredLinkKey->bdaddr.b[5])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1518, " bd: %02x:%02x:%02x:%02x:%02x:%02x", ReadStoredLinkKey
->bdaddr.b[0], ReadStoredLinkKey->bdaddr.b[1], ReadStoredLinkKey
->bdaddr.b[2], ReadStoredLinkKey->bdaddr.b[3], ReadStoredLinkKey
->bdaddr.b[4], ReadStoredLinkKey->bdaddr.b[5]); } } while
(0)
;
1519 DEBUG_LOG(WII_IPC_WIIMOTE, " read_all: %i", ReadStoredLinkKey->read_all)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1519, " read_all: %i", ReadStoredLinkKey->read_all); } }
while (0)
;
1520 DEBUG_LOG(WII_IPC_WIIMOTE, "return:")do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1520, "return:"); } } while (0)
;
1521 DEBUG_LOG(WII_IPC_WIIMOTE, " max_num_keys: %i", Reply.max_num_keys)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1521, " max_num_keys: %i", Reply.max_num_keys); } } while (
0)
;
1522 DEBUG_LOG(WII_IPC_WIIMOTE, " num_keys_read: %i", Reply.num_keys_read)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1522, " num_keys_read: %i", Reply.num_keys_read); } } while
(0)
;
1523
1524 SendEventLinkKeyNotification((u8)Reply.num_keys_read);
2
Function call argument is an uninitialized value
1525 SendEventCommandComplete(HCI_CMD_READ_STORED_LINK_KEY0x0C0D, &Reply, sizeof(hci_read_stored_link_key_rp));
1526}
1527
1528void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandDeleteStoredLinkKey(u8* _Input)
1529{
1530 hci_delete_stored_link_key_cp* pDeleteStoredLinkKey = (hci_delete_stored_link_key_cp*)_Input;
1531
1532 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_OCF_DELETE_STORED_LINK_KEY")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1532, "Command: HCI_OCF_DELETE_STORED_LINK_KEY"); } } while
(0)
;
1533 DEBUG_LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x",do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1535, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pDeleteStoredLinkKey
->bdaddr.b[0], pDeleteStoredLinkKey->bdaddr.b[1], pDeleteStoredLinkKey
->bdaddr.b[2], pDeleteStoredLinkKey->bdaddr.b[3], pDeleteStoredLinkKey
->bdaddr.b[4], pDeleteStoredLinkKey->bdaddr.b[5]); } } while
(0)
1534 pDeleteStoredLinkKey->bdaddr.b[0], pDeleteStoredLinkKey->bdaddr.b[1], pDeleteStoredLinkKey->bdaddr.b[2],do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1535, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pDeleteStoredLinkKey
->bdaddr.b[0], pDeleteStoredLinkKey->bdaddr.b[1], pDeleteStoredLinkKey
->bdaddr.b[2], pDeleteStoredLinkKey->bdaddr.b[3], pDeleteStoredLinkKey
->bdaddr.b[4], pDeleteStoredLinkKey->bdaddr.b[5]); } } while
(0)
1535 pDeleteStoredLinkKey->bdaddr.b[3], pDeleteStoredLinkKey->bdaddr.b[4], pDeleteStoredLinkKey->bdaddr.b[5])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1535, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pDeleteStoredLinkKey
->bdaddr.b[0], pDeleteStoredLinkKey->bdaddr.b[1], pDeleteStoredLinkKey
->bdaddr.b[2], pDeleteStoredLinkKey->bdaddr.b[3], pDeleteStoredLinkKey
->bdaddr.b[4], pDeleteStoredLinkKey->bdaddr.b[5]); } } while
(0)
;
1536 DEBUG_LOG(WII_IPC_WIIMOTE, " delete_all: 0x%01x", pDeleteStoredLinkKey->delete_all)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1536, " delete_all: 0x%01x", pDeleteStoredLinkKey->delete_all
); } } while (0)
;
1537
1538
1539 CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(pDeleteStoredLinkKey->bdaddr);
1540 if (pWiiMote == NULL__null)
1541 return;
1542
1543 hci_delete_stored_link_key_rp Reply;
1544 Reply.status = 0x00;
1545 Reply.num_keys_deleted = 0;
1546
1547 SendEventCommandComplete(HCI_CMD_DELETE_STORED_LINK_KEY0x0C12, &Reply, sizeof(hci_delete_stored_link_key_rp));
1548
1549 ERROR_LOG(WII_IPC_WIIMOTE, "HCI: CommandDeleteStoredLinkKey... Probably the security for linking has failed. Could be a problem with loading the SCONF")do { { if (LogTypes::LERROR <= 3) GenericLog(LogTypes::LERROR
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1549, "HCI: CommandDeleteStoredLinkKey... Probably the security for linking has failed. Could be a problem with loading the SCONF"
); } } while (0)
;
1550}
1551
1552void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteLocalName(u8* _Input)
1553{
1554 hci_write_local_name_cp* pWriteLocalName = (hci_write_local_name_cp*)_Input;
1555
1556 hci_write_local_name_rp Reply;
1557 Reply.status = 0x00;
1558
1559 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_WRITE_LOCAL_NAME:")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1559, "Command: HCI_CMD_WRITE_LOCAL_NAME:"); } } while (0)
;
1560 DEBUG_LOG(WII_IPC_WIIMOTE, " local_name: %s", pWriteLocalName->name)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1560, " local_name: %s", pWriteLocalName->name); } } while
(0)
;
1561
1562 SendEventCommandComplete(HCI_CMD_WRITE_LOCAL_NAME0x0C13, &Reply, sizeof(hci_write_local_name_rp));
1563}
1564
1565// Here we normally receive the timeout interval.
1566// But not from homebrew games that use lwbt. Why not?
1567void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWritePageTimeOut(u8* _Input)
1568{
1569 hci_write_page_timeout_cp* pWritePageTimeOut = (hci_write_page_timeout_cp*)_Input;
1570
1571 hci_host_buffer_size_rp Reply;
1572 Reply.status = 0x00;
1573
1574 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_WRITE_PAGE_TIMEOUT:")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1574, "Command: HCI_CMD_WRITE_PAGE_TIMEOUT:"); } } while (0
)
;
1575 DEBUG_LOG(WII_IPC_WIIMOTE, " timeout: %i", pWritePageTimeOut->timeout)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1575, " timeout: %i", pWritePageTimeOut->timeout); } } while
(0)
;
1576
1577 SendEventCommandComplete(HCI_CMD_WRITE_PAGE_TIMEOUT0x0C18, &Reply, sizeof(hci_host_buffer_size_rp));
1578}
1579
1580/* This will enable ScanEnable so that Update() can start the Wiimote. */
1581void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteScanEnable(u8* _Input)
1582{
1583 hci_write_scan_enable_cp* pWriteScanEnable = (hci_write_scan_enable_cp*)_Input;
1584 m_ScanEnable = pWriteScanEnable->scan_enable;
1585
1586 hci_write_scan_enable_rp Reply;
1587 Reply.status = 0x00;
1588
1589 static char Scanning[][128] =
1590 {
1591 { "HCI_NO_SCAN_ENABLE"},
1592 { "HCI_INQUIRY_SCAN_ENABLE"},
1593 { "HCI_PAGE_SCAN_ENABLE"},
1594 { "HCI_INQUIRY_AND_PAGE_SCAN_ENABLE"},
1595 };
1596
1597 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_WRITE_SCAN_ENABLE: (0x%02x)", pWriteScanEnable->scan_enable)do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1597, "Command: HCI_CMD_WRITE_SCAN_ENABLE: (0x%02x)", pWriteScanEnable
->scan_enable); } } while (0)
;
1598 DEBUG_LOG(WII_IPC_WIIMOTE, " scan_enable: %s", Scanning[pWriteScanEnable->scan_enable])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1598, " scan_enable: %s", Scanning[pWriteScanEnable->scan_enable
]); } } while (0)
;
1599
1600 SendEventCommandComplete(HCI_CMD_WRITE_SCAN_ENABLE0x0C1A, &Reply, sizeof(hci_write_scan_enable_rp));
1601}
1602
1603void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteUnitClass(u8* _Input)
1604{
1605 hci_write_unit_class_cp* pWriteUnitClass = (hci_write_unit_class_cp*)_Input;
1606
1607 hci_write_unit_class_rp Reply;
1608 Reply.status = 0x00;
1609
1610 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_WRITE_UNIT_CLASS:")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1610, "Command: HCI_CMD_WRITE_UNIT_CLASS:"); } } while (0)
;
1611 DEBUG_LOG(WII_IPC_WIIMOTE, " COD[0]: 0x%02x", pWriteUnitClass->uclass[0])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1611, " COD[0]: 0x%02x", pWriteUnitClass->uclass[0]); }
} while (0)
;
1612 DEBUG_LOG(WII_IPC_WIIMOTE, " COD[1]: 0x%02x", pWriteUnitClass->uclass[1])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1612, " COD[1]: 0x%02x", pWriteUnitClass->uclass[1]); }
} while (0)
;
1613 DEBUG_LOG(WII_IPC_WIIMOTE, " COD[2]: 0x%02x", pWriteUnitClass->uclass[2])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1613, " COD[2]: 0x%02x", pWriteUnitClass->uclass[2]); }
} while (0)
;
1614
1615 SendEventCommandComplete(HCI_CMD_WRITE_UNIT_CLASS0x0C24, &Reply, sizeof(hci_write_unit_class_rp));
1616}
1617
1618void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandHostBufferSize(u8* _Input)
1619{
1620 hci_host_buffer_size_cp* pHostBufferSize = (hci_host_buffer_size_cp*)_Input;
1621
1622 hci_host_buffer_size_rp Reply;
1623 Reply.status = 0x00;
1624
1625 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_HOST_BUFFER_SIZE:")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1625, "Command: HCI_CMD_HOST_BUFFER_SIZE:"); } } while (0)
;
1626 DEBUG_LOG(WII_IPC_WIIMOTE, " max_acl_size: %i", pHostBufferSize->max_acl_size)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1626, " max_acl_size: %i", pHostBufferSize->max_acl_size
); } } while (0)
;
1627 DEBUG_LOG(WII_IPC_WIIMOTE, " max_sco_size: %i", pHostBufferSize->max_sco_size)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1627, " max_sco_size: %i", pHostBufferSize->max_sco_size
); } } while (0)
;
1628 DEBUG_LOG(WII_IPC_WIIMOTE, " num_acl_pkts: %i", pHostBufferSize->num_acl_pkts)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1628, " num_acl_pkts: %i", pHostBufferSize->num_acl_pkts
); } } while (0)
;
1629 DEBUG_LOG(WII_IPC_WIIMOTE, " num_sco_pkts: %i", pHostBufferSize->num_sco_pkts)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1629, " num_sco_pkts: %i", pHostBufferSize->num_sco_pkts
); } } while (0)
;
1630
1631 SendEventCommandComplete(HCI_CMD_HOST_BUFFER_SIZE0x0C33, &Reply, sizeof(hci_host_buffer_size_rp));
1632}
1633
1634void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteLinkSupervisionTimeout(u8* _Input)
1635{
1636 hci_write_link_supervision_timeout_cp* pSuperVision = (hci_write_link_supervision_timeout_cp*)_Input;
1637
1638 // timeout of 0 means timing out is disabled
1639 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_WRITE_LINK_SUPERVISION_TIMEOUT")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1639, "Command: HCI_CMD_WRITE_LINK_SUPERVISION_TIMEOUT"); }
} while (0)
;
1640 DEBUG_LOG(WII_IPC_WIIMOTE, " con_handle: 0x%04x", pSuperVision->con_handle)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1640, " con_handle: 0x%04x", pSuperVision->con_handle);
} } while (0)
;
1641 DEBUG_LOG(WII_IPC_WIIMOTE, " timeout: 0x%02x", pSuperVision->timeout)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1641, " timeout: 0x%02x", pSuperVision->timeout); } } while
(0)
;
1642
1643 hci_write_link_supervision_timeout_rp Reply;
1644 Reply.status = 0x00;
1645 Reply.con_handle = pSuperVision->con_handle;
1646
1647 SendEventCommandComplete(HCI_CMD_WRITE_LINK_SUPERVISION_TIMEOUT0x0C37, &Reply, sizeof(hci_write_link_supervision_timeout_rp));
1648}
1649
1650void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteInquiryScanType(u8* _Input)
1651{
1652 hci_write_inquiry_scan_type_cp* pSetEventFilter = (hci_write_inquiry_scan_type_cp*)_Input;
1653
1654 hci_write_inquiry_scan_type_rp Reply;
1655 Reply.status = 0x00;
1656
1657 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_WRITE_INQUIRY_SCAN_TYPE:")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1657, "Command: HCI_CMD_WRITE_INQUIRY_SCAN_TYPE:"); } } while
(0)
;
1658 DEBUG_LOG(WII_IPC_WIIMOTE, " type: %i", pSetEventFilter->type)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1658, " type: %i", pSetEventFilter->type); } } while (0
)
;
1659
1660 SendEventCommandComplete(HCI_CMD_WRITE_INQUIRY_SCAN_TYPE0x0C43, &Reply, sizeof(hci_write_inquiry_scan_type_rp));
1661}
1662
1663void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteInquiryMode(u8* _Input)
1664{
1665 hci_write_inquiry_mode_cp* pInquiryMode = (hci_write_inquiry_mode_cp*)_Input;
1666
1667 hci_write_inquiry_mode_rp Reply;
1668 Reply.status = 0x00;
1669
1670 static char InquiryMode[][128] =
1671 {
1672 { "Standard Inquiry Result event format (default)" },
1673 { "Inquiry Result format with RSSI" },
1674 { "Inquiry Result with RSSI format or Extended Inquiry Result format" }
1675 };
1676 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_WRITE_INQUIRY_MODE:")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1676, "Command: HCI_CMD_WRITE_INQUIRY_MODE:"); } } while (0
)
;
1677 DEBUG_LOG(WII_IPC_WIIMOTE, " mode: %s", InquiryMode[pInquiryMode->mode])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1677, " mode: %s", InquiryMode[pInquiryMode->mode]); } }
while (0)
;
1678
1679 SendEventCommandComplete(HCI_CMD_WRITE_INQUIRY_MODE0x0C45, &Reply, sizeof(hci_write_inquiry_mode_rp));
1680}
1681
1682void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWritePageScanType(u8* _Input)
1683{
1684 hci_write_page_scan_type_cp* pWritePageScanType = (hci_write_page_scan_type_cp*)_Input;
1685
1686 hci_write_page_scan_type_rp Reply;
1687 Reply.status = 0x00;
1688
1689 static char PageScanType[][128] =
1690 {
1691 { "Mandatory: Standard Scan (default)" },
1692 { "Optional: Interlaced Scan" }
1693 };
1694
1695 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_WRITE_PAGE_SCAN_TYPE:")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1695, "Command: HCI_CMD_WRITE_PAGE_SCAN_TYPE:"); } } while (
0)
;
1696 DEBUG_LOG(WII_IPC_WIIMOTE, " type: %s", PageScanType[pWritePageScanType->type])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1696, " type: %s", PageScanType[pWritePageScanType->type
]); } } while (0)
;
1697
1698 SendEventCommandComplete(HCI_CMD_WRITE_PAGE_SCAN_TYPE0x0C47, &Reply, sizeof(hci_write_page_scan_type_rp));
1699}
1700
1701void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadLocalVer(u8* _Input)
1702{
1703 hci_read_local_ver_rp Reply;
1704 Reply.status = 0x00;
1705 Reply.hci_version = 0x03; // HCI version: 1.1
1706 Reply.hci_revision = 0x40a7; // current revision (?)
1707 Reply.lmp_version = 0x03; // LMP version: 1.1
1708 Reply.manufacturer = 0x000F; // manufacturer: reserved for tests
1709 Reply.lmp_subversion = 0x430e; // LMP subversion
1710
1711 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_READ_LOCAL_VER:")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1711, "Command: HCI_CMD_READ_LOCAL_VER:"); } } while (0)
;
1712 DEBUG_LOG(WII_IPC_WIIMOTE, "return:")do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1712, "return:"); } } while (0)
;
1713 DEBUG_LOG(WII_IPC_WIIMOTE, " status: %i", Reply.status)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1713, " status: %i", Reply.status); } } while (0)
;
1714 DEBUG_LOG(WII_IPC_WIIMOTE, " hci_revision: %i", Reply.hci_revision)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1714, " hci_revision: %i", Reply.hci_revision); } } while
(0)
;
1715 DEBUG_LOG(WII_IPC_WIIMOTE, " lmp_version: %i", Reply.lmp_version)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1715, " lmp_version: %i", Reply.lmp_version); } } while
(0)
;
1716 DEBUG_LOG(WII_IPC_WIIMOTE, " manufacturer: %i", Reply.manufacturer)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1716, " manufacturer: %i", Reply.manufacturer); } } while
(0)
;
1717 DEBUG_LOG(WII_IPC_WIIMOTE, " lmp_subversion: %i", Reply.lmp_subversion)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1717, " lmp_subversion: %i", Reply.lmp_subversion); } } while
(0)
;
1718
1719 SendEventCommandComplete(HCI_CMD_READ_LOCAL_VER0x1001, &Reply, sizeof(hci_read_local_ver_rp));
1720}
1721
1722void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadLocalFeatures(u8* _Input)
1723{
1724 hci_read_local_features_rp Reply;
1725 Reply.status = 0x00;
1726 Reply.features[0] = 0xFF;
1727 Reply.features[1] = 0xFF;
1728 Reply.features[2] = 0x8D;
1729 Reply.features[3] = 0xFE;
1730 Reply.features[4] = 0x9B;
1731 Reply.features[5] = 0xF9;
1732 Reply.features[6] = 0x00;
1733 Reply.features[7] = 0x80;
1734
1735 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_READ_LOCAL_FEATURES:")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1735, "Command: HCI_CMD_READ_LOCAL_FEATURES:"); } } while (
0)
;
1736 DEBUG_LOG(WII_IPC_WIIMOTE, "return:")do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1736, "return:"); } } while (0)
;
1737 DEBUG_LOG(WII_IPC_WIIMOTE, " features: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1740, " features: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x"
, Reply.features[0], Reply.features[1], Reply.features[2], Reply
.features[3], Reply.features[4], Reply.features[5], Reply.features
[6], Reply.features[7]); } } while (0)
1738 Reply.features[0], Reply.features[1], Reply.features[2],do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1740, " features: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x"
, Reply.features[0], Reply.features[1], Reply.features[2], Reply
.features[3], Reply.features[4], Reply.features[5], Reply.features
[6], Reply.features[7]); } } while (0)
1739 Reply.features[3], Reply.features[4], Reply.features[5],do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1740, " features: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x"
, Reply.features[0], Reply.features[1], Reply.features[2], Reply
.features[3], Reply.features[4], Reply.features[5], Reply.features
[6], Reply.features[7]); } } while (0)
1740 Reply.features[6], Reply.features[7])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1740, " features: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x"
, Reply.features[0], Reply.features[1], Reply.features[2], Reply
.features[3], Reply.features[4], Reply.features[5], Reply.features
[6], Reply.features[7]); } } while (0)
;
1741
1742 SendEventCommandComplete(HCI_CMD_READ_LOCAL_FEATURES0x1003, &Reply, sizeof(hci_read_local_features_rp));
1743}
1744
1745void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadBufferSize(u8* _Input)
1746{
1747 hci_read_buffer_size_rp Reply;
1748 Reply.status = 0x00;
1749 Reply.max_acl_size = m_acl_pkt_size;
1750 // Due to how the widcomm stack which Nintendo uses is coded, we must never
1751 // let the stack think the controller is buffering more than 10 data packets
1752 // - it will cause a u8 underflow and royally screw things up.
1753 Reply.num_acl_pkts = m_acl_pkts_num;
1754 Reply.max_sco_size = 64;
1755 Reply.num_sco_pkts = 0;
1756
1757 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_READ_BUFFER_SIZE:")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1757, "Command: HCI_CMD_READ_BUFFER_SIZE:"); } } while (0)
;
1758 DEBUG_LOG(WII_IPC_WIIMOTE, "return:")do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1758, "return:"); } } while (0)
;
1759 DEBUG_LOG(WII_IPC_WIIMOTE, " max_acl_size: %i", Reply.max_acl_size)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1759, " max_acl_size: %i", Reply.max_acl_size); } } while (
0)
;
1760 DEBUG_LOG(WII_IPC_WIIMOTE, " num_acl_pkts: %i", Reply.num_acl_pkts)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1760, " num_acl_pkts: %i", Reply.num_acl_pkts); } } while (
0)
;
1761 DEBUG_LOG(WII_IPC_WIIMOTE, " max_sco_size: %i", Reply.max_sco_size)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1761, " max_sco_size: %i", Reply.max_sco_size); } } while (
0)
;
1762 DEBUG_LOG(WII_IPC_WIIMOTE, " num_sco_pkts: %i", Reply.num_sco_pkts)do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1762, " num_sco_pkts: %i", Reply.num_sco_pkts); } } while (
0)
;
1763
1764 SendEventCommandComplete(HCI_CMD_READ_BUFFER_SIZE0x1005, &Reply, sizeof(hci_read_buffer_size_rp));
1765}
1766
1767void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadBDAdrr(u8* _Input)
1768{
1769 hci_read_bdaddr_rp Reply;
1770 Reply.status = 0x00;
1771 Reply.bdaddr = m_ControllerBD;
1772
1773 INFO_LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_READ_BDADDR:")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1773, "Command: HCI_CMD_READ_BDADDR:"); } } while (0)
;
1774 DEBUG_LOG(WII_IPC_WIIMOTE, "return:")do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1774, "return:"); } } while (0)
;
1775 DEBUG_LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x",do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1777, " bd: %02x:%02x:%02x:%02x:%02x:%02x", Reply.bdaddr.b
[0], Reply.bdaddr.b[1], Reply.bdaddr.b[2], Reply.bdaddr.b[3],
Reply.bdaddr.b[4], Reply.bdaddr.b[5]); } } while (0)
1776 Reply.bdaddr.b[0], Reply.bdaddr.b[1], Reply.bdaddr.b[2],do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1777, " bd: %02x:%02x:%02x:%02x:%02x:%02x", Reply.bdaddr.b
[0], Reply.bdaddr.b[1], Reply.bdaddr.b[2], Reply.bdaddr.b[3],
Reply.bdaddr.b[4], Reply.bdaddr.b[5]); } } while (0)
1777 Reply.bdaddr.b[3], Reply.bdaddr.b[4], Reply.bdaddr.b[5])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1777, " bd: %02x:%02x:%02x:%02x:%02x:%02x", Reply.bdaddr.b
[0], Reply.bdaddr.b[1], Reply.bdaddr.b[2], Reply.bdaddr.b[3],
Reply.bdaddr.b[4], Reply.bdaddr.b[5]); } } while (0)
;
1778
1779 SendEventCommandComplete(HCI_CMD_READ_BDADDR0x1009, &Reply, sizeof(hci_read_bdaddr_rp));
1780}
1781
1782void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandVendorSpecific_FC4F(u8* _Input, u32 _Size)
1783{
1784 // callstack...
1785 // BTM_VendorSpecificCommad()
1786 // WUDiRemovePatch()
1787 // WUDiAppendRuntimePatch()
1788 // WUDiGetFirmwareVersion()
1789 // WUDiStackSetupComplete()
1790
1791 hci_status_rp Reply;
1792 Reply.status = 0x00;
1793
1794 INFO_LOG(WII_IPC_WIIMOTE, "Command: CommandVendorSpecific_FC4F: (callstack WUDiRemovePatch)")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1794, "Command: CommandVendorSpecific_FC4F: (callstack WUDiRemovePatch)"
); } } while (0)
;
1795 INFO_LOG(WII_IPC_WIIMOTE, "Input (size 0x%x):", _Size)do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1795, "Input (size 0x%x):", _Size); } } while (0)
;
1796
1797 Dolphin_Debugger::PrintDataBuffer(LogTypes::WII_IPC_WIIMOTE, _Input, _Size, "Data: ");
1798
1799 SendEventCommandComplete(0xFC4F, &Reply, sizeof(hci_status_rp));
1800}
1801
1802void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandVendorSpecific_FC4C(u8* _Input, u32 _Size)
1803{
1804 hci_status_rp Reply;
1805 Reply.status = 0x00;
1806
1807 INFO_LOG(WII_IPC_WIIMOTE, "Command: CommandVendorSpecific_FC4C:")do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1807, "Command: CommandVendorSpecific_FC4C:"); } } while (0
)
;
1808 INFO_LOG(WII_IPC_WIIMOTE, "Input (size 0x%x):", _Size)do { { if (LogTypes::LINFO <= 3) GenericLog(LogTypes::LINFO
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1808, "Input (size 0x%x):", _Size); } } while (0)
;
1809 Dolphin_Debugger::PrintDataBuffer(LogTypes::WII_IPC_WIIMOTE, _Input, _Size, "Data: ");
1810
1811 SendEventCommandComplete(0xFC4C, &Reply, sizeof(hci_status_rp));
1812}
1813
1814
1815//
1816//
1817// --- helper
1818//
1819//
1820CWII_IPC_HLE_WiiMote* CWII_IPC_HLE_Device_usb_oh1_57e_305::AccessWiiMote(const bdaddr_t& _rAddr)
1821{
1822 for (size_t i=0; i<m_WiiMotes.size(); i++)
1823 {
1824 const bdaddr_t& BD = m_WiiMotes[i].GetBD();
1825 if ((_rAddr.b[0] == BD.b[0]) &&
1826 (_rAddr.b[1] == BD.b[1]) &&
1827 (_rAddr.b[2] == BD.b[2]) &&
1828 (_rAddr.b[3] == BD.b[3]) &&
1829 (_rAddr.b[4] == BD.b[4]) &&
1830 (_rAddr.b[5] == BD.b[5]))
1831 return &m_WiiMotes[i];
1832 }
1833
1834 ERROR_LOG(WII_IPC_WIIMOTE,"Can't find WiiMote by bd: %02x:%02x:%02x:%02x:%02x:%02x",do { { if (LogTypes::LERROR <= 3) GenericLog(LogTypes::LERROR
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1835, "Can't find WiiMote by bd: %02x:%02x:%02x:%02x:%02x:%02x"
, _rAddr.b[0], _rAddr.b[1], _rAddr.b[2], _rAddr.b[3], _rAddr.
b[4], _rAddr.b[5]); } } while (0)
1835 _rAddr.b[0], _rAddr.b[1], _rAddr.b[2], _rAddr.b[3], _rAddr.b[4], _rAddr.b[5])do { { if (LogTypes::LERROR <= 3) GenericLog(LogTypes::LERROR
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1835, "Can't find WiiMote by bd: %02x:%02x:%02x:%02x:%02x:%02x"
, _rAddr.b[0], _rAddr.b[1], _rAddr.b[2], _rAddr.b[3], _rAddr.
b[4], _rAddr.b[5]); } } while (0)
;
1836 return NULL__null;
1837}
1838
1839CWII_IPC_HLE_WiiMote* CWII_IPC_HLE_Device_usb_oh1_57e_305::AccessWiiMote(u16 _ConnectionHandle)
1840{
1841 for (size_t i=0; i<m_WiiMotes.size(); i++)
1842 {
1843 if (m_WiiMotes[i].GetConnectionHandle() == _ConnectionHandle)
1844 return &m_WiiMotes[i];
1845 }
1846
1847 ERROR_LOG(WII_IPC_WIIMOTE, "Can't find WiiMote by connection handle %02x", _ConnectionHandle)do { { if (LogTypes::LERROR <= 3) GenericLog(LogTypes::LERROR
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1847, "Can't find WiiMote by connection handle %02x", _ConnectionHandle
); } } while (0)
;
1848 PanicAlertT("Can't find WiiMote by connection handle %02x", _ConnectionHandle)MsgAlert(false, WARNING, "Can't find WiiMote by connection handle %02x"
, _ConnectionHandle)
;
1849 return NULL__null;
1850}
1851
1852void CWII_IPC_HLE_Device_usb_oh1_57e_305::LOG_LinkKey(const u8* _pLinkKey)
1853{
1854 DEBUG_LOG(WII_IPC_WIIMOTE, " link key: "do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1858, " link key: " "0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x "
"0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x " ,
_pLinkKey[0], _pLinkKey[1], _pLinkKey[2], _pLinkKey[3], _pLinkKey
[4], _pLinkKey[5], _pLinkKey[6], _pLinkKey[7] , _pLinkKey[8],
_pLinkKey[9], _pLinkKey[10], _pLinkKey[11], _pLinkKey[12], _pLinkKey
[13], _pLinkKey[14], _pLinkKey[15]); } } while (0)
1855 "0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x "do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1858, " link key: " "0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x "
"0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x " ,
_pLinkKey[0], _pLinkKey[1], _pLinkKey[2], _pLinkKey[3], _pLinkKey
[4], _pLinkKey[5], _pLinkKey[6], _pLinkKey[7] , _pLinkKey[8],
_pLinkKey[9], _pLinkKey[10], _pLinkKey[11], _pLinkKey[12], _pLinkKey
[13], _pLinkKey[14], _pLinkKey[15]); } } while (0)
1856 "0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x "do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1858, " link key: " "0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x "
"0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x " ,
_pLinkKey[0], _pLinkKey[1], _pLinkKey[2], _pLinkKey[3], _pLinkKey
[4], _pLinkKey[5], _pLinkKey[6], _pLinkKey[7] , _pLinkKey[8],
_pLinkKey[9], _pLinkKey[10], _pLinkKey[11], _pLinkKey[12], _pLinkKey
[13], _pLinkKey[14], _pLinkKey[15]); } } while (0)
1857 , _pLinkKey[0], _pLinkKey[1], _pLinkKey[2], _pLinkKey[3], _pLinkKey[4], _pLinkKey[5], _pLinkKey[6], _pLinkKey[7]do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1858, " link key: " "0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x "
"0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x " ,
_pLinkKey[0], _pLinkKey[1], _pLinkKey[2], _pLinkKey[3], _pLinkKey
[4], _pLinkKey[5], _pLinkKey[6], _pLinkKey[7] , _pLinkKey[8],
_pLinkKey[9], _pLinkKey[10], _pLinkKey[11], _pLinkKey[12], _pLinkKey
[13], _pLinkKey[14], _pLinkKey[15]); } } while (0)
1858 , _pLinkKey[8], _pLinkKey[9], _pLinkKey[10], _pLinkKey[11], _pLinkKey[12], _pLinkKey[13], _pLinkKey[14], _pLinkKey[15])do { { if (LogTypes::LDEBUG <= 3) GenericLog(LogTypes::LDEBUG
, LogTypes::WII_IPC_WIIMOTE, "/home/anal/dolphin-emu/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp"
, 1858, " link key: " "0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x "
"0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x " ,
_pLinkKey[0], _pLinkKey[1], _pLinkKey[2], _pLinkKey[3], _pLinkKey
[4], _pLinkKey[5], _pLinkKey[6], _pLinkKey[7] , _pLinkKey[8],
_pLinkKey[9], _pLinkKey[10], _pLinkKey[11], _pLinkKey[12], _pLinkKey
[13], _pLinkKey[14], _pLinkKey[15]); } } while (0)
;
1859
1860}