Bug Summary

File:Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp
Location:line 1523, 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 Wiimote::Update(i);
469 }
470 m_last_ticks = now;
471 }
472
473 SendEventNumberOfCompletedPackets();
474
475 return packet_transferred;
476}
477
478void CWII_IPC_HLE_Device_usb_oh1_57e_305::ACLPool::Store(const u8* data, const u16 size, const u16 conn_handle)
479{
480 if (m_queue.size() >= 100)
481 {
482 // Many simultaneous exchanges of ACL packets tend to cause the queue to fill up.
483 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"
, 483, "ACL queue size reached 100 - current packet will be dropped!"
); } } while (0)
;
484 return;
485 }
486
487 _dbg_assert_msg_(WII_IPC_WIIMOTE,{}
488 size < m_acl_pkt_size, "ACL packet too large for pool"){};
489
490 m_queue.push_back(Packet());
491 auto& packet = m_queue.back();
492
493 std::copy(data, data + size, packet.data);
494 packet.size = size;
495 packet.conn_handle = conn_handle;
496}
497
498void CWII_IPC_HLE_Device_usb_oh1_57e_305::ACLPool::WriteToEndpoint(CtrlBuffer& endpoint)
499{
500 auto& packet = m_queue.front();
501
502 const u8* const data = packet.data;
503 const u16 size = packet.size;
504 const u16 conn_handle = packet.conn_handle;
505
506 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"
, 507, "ACL packet being written from " "queue to %08x", endpoint
.m_address); } } while (0)
507 "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"
, 507, "ACL packet being written from " "queue to %08x", endpoint
.m_address); } } while (0)
;
508
509 hci_acldata_hdr_t* pHeader = (hci_acldata_hdr_t*)Memory::GetPointer(endpoint.m_buffer);
510 pHeader->con_handle = HCI_MK_CON_HANDLE(conn_handle, HCI_PACKET_START, HCI_POINT2POINT)(((conn_handle) & 0x0fff) | (((0x2) & 3) << 12)
| (((0x0) & 3) << 14))
;
511 pHeader->length = size;
512
513 // Write the packet to the buffer
514 std::copy(data, data + size, (u8*)pHeader + sizeof(hci_acldata_hdr_t));
515
516 endpoint.SetRetVal(sizeof(hci_acldata_hdr_t) + size);
517
518 m_queue.pop_front();
519
520 WII_IPC_HLE_Interface::EnqReply(endpoint.m_address);
521 endpoint.Invalidate();
522}
523
524bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventInquiryComplete()
525{
526 SQueuedEvent Event(sizeof(SHCIEventInquiryComplete), 0);
527
528 SHCIEventInquiryComplete* pInquiryComplete = (SHCIEventInquiryComplete*)Event.m_buffer;
529 pInquiryComplete->EventType = HCI_EVENT_INQUIRY_COMPL0x01;
530 pInquiryComplete->PayloadLength = sizeof(SHCIEventInquiryComplete) - 2;
531 pInquiryComplete->EventStatus = 0x00;
532
533 AddEventToQueue(Event);
534
535 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"
, 535, "Event: Inquiry complete"); } } while (0)
;
536
537 return true;
538}
539
540bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventInquiryResponse()
541{
542 if (m_WiiMotes.empty())
543 return false;
544
545 _dbg_assert_(WII_IPC_WIIMOTE, sizeof(SHCIEventInquiryResult) - 2 + (m_WiiMotes.size() * sizeof(hci_inquiry_response)) < 256){};
546
547 SQueuedEvent Event(static_cast<u32>(sizeof(SHCIEventInquiryResult) + m_WiiMotes.size()*sizeof(hci_inquiry_response)), 0);
548
549 SHCIEventInquiryResult* pInquiryResult = (SHCIEventInquiryResult*)Event.m_buffer;
550
551 pInquiryResult->EventType = HCI_EVENT_INQUIRY_RESULT0x02;
552 pInquiryResult->PayloadLength = (u8)(sizeof(SHCIEventInquiryResult) - 2 + (m_WiiMotes.size() * sizeof(hci_inquiry_response)));
553 pInquiryResult->num_responses = (u8)m_WiiMotes.size();
554
555 for (size_t i=0; i < m_WiiMotes.size(); i++)
556 {
557 if (m_WiiMotes[i].IsConnected())
558 continue;
559
560 u8* pBuffer = Event.m_buffer + sizeof(SHCIEventInquiryResult) + i*sizeof(hci_inquiry_response);
561 hci_inquiry_response* pResponse = (hci_inquiry_response*)pBuffer;
562
563 pResponse->bdaddr = m_WiiMotes[i].GetBD();
564 pResponse->uclass[0]= m_WiiMotes[i].GetClass()[0];
565 pResponse->uclass[1]= m_WiiMotes[i].GetClass()[1];
566 pResponse->uclass[2]= m_WiiMotes[i].GetClass()[2];
567
568 pResponse->page_scan_rep_mode = 1;
569 pResponse->page_scan_period_mode = 0;
570 pResponse->page_scan_mode = 0;
571 pResponse->clock_offset = 0x3818;
572
573 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"
, 573, "Event: Send Fake Inquiry of one controller"); } } while
(0)
;
574 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"
, 576, " 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)
575 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"
, 576, " 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[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"
, 576, " 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 }
578
579 AddEventToQueue(Event);
580
581 return true;
582}
583
584bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventConnectionComplete(const bdaddr_t& _bd)
585{
586 CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_bd);
587 if (pWiiMote == NULL__null)
588 return false;
589
590 SQueuedEvent Event(sizeof(SHCIEventConnectionComplete), 0);
591
592 SHCIEventConnectionComplete* pConnectionComplete = (SHCIEventConnectionComplete*)Event.m_buffer;
593
594 pConnectionComplete->EventType = HCI_EVENT_CON_COMPL0x03;
595 pConnectionComplete->PayloadLength = sizeof(SHCIEventConnectionComplete) - 2;
596 pConnectionComplete->EventStatus = 0x00;
597 pConnectionComplete->Connection_Handle = pWiiMote->GetConnectionHandle();
598 pConnectionComplete->bdaddr = _bd;
599 pConnectionComplete->LinkType = HCI_LINK_ACL0x01;
600 pConnectionComplete->EncryptionEnabled = HCI_ENCRYPTION_MODE_NONE0x00;
601
602 AddEventToQueue(Event);
603
604 CWII_IPC_HLE_WiiMote* pWiimote = AccessWiiMote(pConnectionComplete->Connection_Handle);
605 if (pWiimote)
606 pWiimote->EventConnectionAccepted();
607
608 static char s_szLinkType[][128] =
609 {
610 { "HCI_LINK_SCO 0x00 - Voice"},
611 { "HCI_LINK_ACL 0x01 - Data"},
612 { "HCI_LINK_eSCO 0x02 - eSCO"},
613 };
614
615 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"
, 615, "Event: SendEventConnectionComplete"); } } while (0)
;
616 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"
, 616, " Connection_Handle: 0x%04x", pConnectionComplete->
Connection_Handle); } } while (0)
;
617 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"
, 619, " 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)
618 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"
, 619, " 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[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"
, 619, " 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 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"
, 620, " LinkType: %s", s_szLinkType[pConnectionComplete->
LinkType]); } } while (0)
;
621 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"
, 621, " EncryptionEnabled: %i", pConnectionComplete->EncryptionEnabled
); } } while (0)
;
622
623 return true;
624}
625
626// This is called from Update() after ScanEnable has been enabled.
627bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRequestConnection(CWII_IPC_HLE_WiiMote& _rWiiMote)
628{
629 SQueuedEvent Event(sizeof(SHCIEventRequestConnection), 0);
630
631 SHCIEventRequestConnection* pEventRequestConnection = (SHCIEventRequestConnection*)Event.m_buffer;
632
633 pEventRequestConnection->EventType = HCI_EVENT_CON_REQ0x04;
634 pEventRequestConnection->PayloadLength = sizeof(SHCIEventRequestConnection) - 2;
635 pEventRequestConnection->bdaddr = _rWiiMote.GetBD();
636 pEventRequestConnection->uclass[0] = _rWiiMote.GetClass()[0];
637 pEventRequestConnection->uclass[1] = _rWiiMote.GetClass()[1];
638 pEventRequestConnection->uclass[2] = _rWiiMote.GetClass()[2];
639 pEventRequestConnection->LinkType = HCI_LINK_ACL0x01;
640
641 AddEventToQueue(Event);
642
643 static char LinkType[][128] =
644 {
645 { "HCI_LINK_SCO 0x00 - Voice"},
646 { "HCI_LINK_ACL 0x01 - Data" },
647 { "HCI_LINK_eSCO 0x02 - eSCO" },
648 };
649
650 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"
, 650, "Event: SendEventRequestConnection"); } } while (0)
;
651 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"
, 653, " 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)
652 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"
, 653, " 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[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"
, 653, " 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 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"
, 654, " COD[0]: 0x%02x", pEventRequestConnection->uclass
[0]); } } while (0)
;
655 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"
, 655, " COD[1]: 0x%02x", pEventRequestConnection->uclass
[1]); } } while (0)
;
656 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"
, 656, " COD[2]: 0x%02x", pEventRequestConnection->uclass
[2]); } } while (0)
;
657 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"
, 657, " LinkType: %s", LinkType[pEventRequestConnection->
LinkType]); } } while (0)
;
658
659 return true;
660}
661
662bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventDisconnect(u16 _connectionHandle, u8 _Reason)
663{
664 CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle);
665 if (pWiiMote == NULL__null)
666 return false;
667
668 SQueuedEvent Event(sizeof(SHCIEventDisconnectCompleted), _connectionHandle);
669
670 SHCIEventDisconnectCompleted* pDisconnect = (SHCIEventDisconnectCompleted*)Event.m_buffer;
671 pDisconnect->EventType = HCI_EVENT_DISCON_COMPL0x05;
672 pDisconnect->PayloadLength = sizeof(SHCIEventDisconnectCompleted) - 2;
673 pDisconnect->EventStatus = 0;
674 pDisconnect->Connection_Handle = _connectionHandle;
675 pDisconnect->Reason = _Reason;
676
677 AddEventToQueue(Event);
678
679 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"
, 679, "Event: SendEventDisconnect"); } } while (0)
;
680 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"
, 680, " Connection_Handle: 0x%04x", pDisconnect->Connection_Handle
); } } while (0)
;
681 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"
, 681, " Reason: 0x%02x", pDisconnect->Reason); } } while
(0)
;
682
683 return true;
684}
685
686bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventAuthenticationCompleted(u16 _connectionHandle)
687{
688 CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle);
689 if (pWiiMote == NULL__null)
690 return false;
691
692 SQueuedEvent Event(sizeof(SHCIEventAuthenticationCompleted), _connectionHandle);
693
694 SHCIEventAuthenticationCompleted* pEventAuthenticationCompleted = (SHCIEventAuthenticationCompleted*)Event.m_buffer;
695 pEventAuthenticationCompleted->EventType = HCI_EVENT_AUTH_COMPL0x06;
696 pEventAuthenticationCompleted->PayloadLength = sizeof(SHCIEventAuthenticationCompleted) - 2;
697 pEventAuthenticationCompleted->EventStatus = 0;
698 pEventAuthenticationCompleted->Connection_Handle = _connectionHandle;
699
700 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"
, 700, "Event: SendEventAuthenticationCompleted"); } } while (
0)
;
701 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"
, 701, " Connection_Handle: 0x%04x", pEventAuthenticationCompleted
->Connection_Handle); } } while (0)
;
702
703 AddEventToQueue(Event);
704
705 return true;
706}
707
708bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRemoteNameReq(const bdaddr_t& _bd)
709{
710 CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_bd);
711 if (pWiiMote == NULL__null)
712 return false;
713
714 SQueuedEvent Event(sizeof(SHCIEventRemoteNameReq), 0);
715
716 SHCIEventRemoteNameReq* pRemoteNameReq = (SHCIEventRemoteNameReq*)Event.m_buffer;
717
718 pRemoteNameReq->EventType = HCI_EVENT_REMOTE_NAME_REQ_COMPL0x07;
719 pRemoteNameReq->PayloadLength = sizeof(SHCIEventRemoteNameReq) - 2;
720 pRemoteNameReq->EventStatus = 0x00;
721 pRemoteNameReq->bdaddr = _bd;
722 strcpy((char*)pRemoteNameReq->RemoteName, pWiiMote->GetName());
723
724 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"
, 724, "Event: SendEventRemoteNameReq"); } } while (0)
;
725 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"
, 727, " 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)
726 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"
, 727, " 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[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"
, 727, " 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 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"
, 728, " RemoteName: %s", pRemoteNameReq->RemoteName); } }
while (0)
;
729
730 AddEventToQueue(Event);
731
732 return true;
733}
734
735bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadRemoteFeatures(u16 _connectionHandle)
736{
737 CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle);
738 if (pWiiMote == NULL__null)
739 return false;
740
741 SQueuedEvent Event(sizeof(SHCIEventReadRemoteFeatures), _connectionHandle);
742
743 SHCIEventReadRemoteFeatures* pReadRemoteFeatures = (SHCIEventReadRemoteFeatures*)Event.m_buffer;
744
745 pReadRemoteFeatures->EventType = HCI_EVENT_READ_REMOTE_FEATURES_COMPL0x0b;
746 pReadRemoteFeatures->PayloadLength = sizeof(SHCIEventReadRemoteFeatures) - 2;
747 pReadRemoteFeatures->EventStatus = 0x00;
748 pReadRemoteFeatures->ConnectionHandle = _connectionHandle;
749 pReadRemoteFeatures->features[0] = pWiiMote->GetFeatures()[0];
750 pReadRemoteFeatures->features[1] = pWiiMote->GetFeatures()[1];
751 pReadRemoteFeatures->features[2] = pWiiMote->GetFeatures()[2];
752 pReadRemoteFeatures->features[3] = pWiiMote->GetFeatures()[3];
753 pReadRemoteFeatures->features[4] = pWiiMote->GetFeatures()[4];
754 pReadRemoteFeatures->features[5] = pWiiMote->GetFeatures()[5];
755 pReadRemoteFeatures->features[6] = pWiiMote->GetFeatures()[6];
756 pReadRemoteFeatures->features[7] = pWiiMote->GetFeatures()[7];
757
758 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"
, 758, "Event: SendEventReadRemoteFeatures"); } } while (0)
;
759 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"
, 759, " Connection_Handle: 0x%04x", pReadRemoteFeatures->
ConnectionHandle); } } while (0)
;
760 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"
, 763, " 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)
761 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"
, 763, " 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[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"
, 763, " 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[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"
, 763, " 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
765 AddEventToQueue(Event);
766
767 return true;
768}
769
770bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadRemoteVerInfo(u16 _connectionHandle)
771{
772 CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle);
773 if (pWiiMote == NULL__null)
774 return false;
775
776 SQueuedEvent Event(sizeof(SHCIEventReadRemoteVerInfo), _connectionHandle);
777
778 SHCIEventReadRemoteVerInfo* pReadRemoteVerInfo = (SHCIEventReadRemoteVerInfo*)Event.m_buffer;
779 pReadRemoteVerInfo->EventType = HCI_EVENT_READ_REMOTE_VER_INFO_COMPL0x0c;
780 pReadRemoteVerInfo->PayloadLength = sizeof(SHCIEventReadRemoteVerInfo) - 2;
781 pReadRemoteVerInfo->EventStatus = 0x00;
782 pReadRemoteVerInfo->ConnectionHandle = _connectionHandle;
783 pReadRemoteVerInfo->lmp_version = pWiiMote->GetLMPVersion();
784 pReadRemoteVerInfo->manufacturer = pWiiMote->GetManufactorID();
785 pReadRemoteVerInfo->lmp_subversion = pWiiMote->GetLMPSubVersion();
786
787 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"
, 787, "Event: SendEventReadRemoteVerInfo"); } } while (0)
;
788 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"
, 788, " Connection_Handle: 0x%04x", pReadRemoteVerInfo->
ConnectionHandle); } } while (0)
;
789 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"
, 789, " lmp_version: 0x%02x", pReadRemoteVerInfo->lmp_version
); } } while (0)
;
790 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"
, 790, " manufacturer: 0x%04x", pReadRemoteVerInfo->manufacturer
); } } while (0)
;
791 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"
, 791, " lmp_subversion: 0x%04x", pReadRemoteVerInfo->lmp_subversion
); } } while (0)
;
792
793 AddEventToQueue(Event);
794
795 return true;
796}
797
798void CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventCommandComplete(u16 _OpCode, void* _pData, u32 _DataSize)
799{
800 _dbg_assert_(WII_IPC_WIIMOTE, (sizeof(SHCIEventCommand) - 2 + _DataSize) < 256){};
801
802 SQueuedEvent Event(sizeof(SHCIEventCommand) + _DataSize, 0);
803
804 SHCIEventCommand* pHCIEvent = (SHCIEventCommand*)Event.m_buffer;
805 pHCIEvent->EventType = HCI_EVENT_COMMAND_COMPL0x0e;
806 pHCIEvent->PayloadLength = (u8)(sizeof(SHCIEventCommand) - 2 + _DataSize);
807 pHCIEvent->PacketIndicator = 0x01;
808 pHCIEvent->Opcode = _OpCode;
809
810 // add the payload
811 if ((_pData != NULL__null) && (_DataSize > 0))
812 {
813 u8* pPayload = Event.m_buffer + sizeof(SHCIEventCommand);
814 memcpy(pPayload, _pData, _DataSize);
815 }
816
817 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"
, 817, "Event: Command Complete (Opcode: 0x%04x)", pHCIEvent->
Opcode); } } while (0)
;
818
819 AddEventToQueue(Event);
820}
821
822bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventCommandStatus(u16 _Opcode)
823{
824 SQueuedEvent Event(sizeof(SHCIEventStatus), 0);
825
826 SHCIEventStatus* pHCIEvent = (SHCIEventStatus*)Event.m_buffer;
827 pHCIEvent->EventType = HCI_EVENT_COMMAND_STATUS0x0f;
828 pHCIEvent->PayloadLength = sizeof(SHCIEventStatus) - 2;
829 pHCIEvent->EventStatus = 0x0;
830 pHCIEvent->PacketIndicator = 0x01;
831 pHCIEvent->Opcode = _Opcode;
832
833 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"
, 833, "Event: Command Status (Opcode: 0x%04x)", pHCIEvent->
Opcode); } } while (0)
;
834
835 AddEventToQueue(Event);
836
837 return true;
838}
839
840bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRoleChange(bdaddr_t _bd, bool _master)
841{
842 CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_bd);
843 if (pWiiMote == NULL__null)
844 return false;
845
846 SQueuedEvent Event(sizeof(SHCIEventRoleChange), 0);
847
848 SHCIEventRoleChange* pRoleChange = (SHCIEventRoleChange*)Event.m_buffer;
849
850 pRoleChange->EventType = HCI_EVENT_ROLE_CHANGE0x12;
851 pRoleChange->PayloadLength = sizeof(SHCIEventRoleChange) - 2;
852 pRoleChange->EventStatus = 0x00;
853 pRoleChange->bdaddr = _bd;
854 pRoleChange->NewRole = _master ? 0x00 : 0x01;
855
856 AddEventToQueue(Event);
857
858 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"
, 858, "Event: SendEventRoleChange"); } } while (0)
;
859 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"
, 861, " 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)
860 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"
, 861, " 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[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"
, 861, " 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 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"
, 862, " NewRole: %i", pRoleChange->NewRole); } } while (
0)
;
863
864 return true;
865}
866
867bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventNumberOfCompletedPackets()
868{
869 SQueuedEvent Event(sizeof(hci_event_hdr_t) + sizeof(hci_num_compl_pkts_ep) + sizeof(hci_num_compl_pkts_info) * m_WiiMotes.size(), 0);
870
871 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"
, 871, "Event: SendEventNumberOfCompletedPackets"); } } while
(0)
;
872
873 hci_event_hdr_t* event_hdr = (hci_event_hdr_t*)Event.m_buffer;
874 hci_num_compl_pkts_ep* event = (hci_num_compl_pkts_ep*)((u8*)event_hdr + sizeof(hci_event_hdr_t));
875 hci_num_compl_pkts_info* info = (hci_num_compl_pkts_info*)((u8*)event + sizeof(hci_num_compl_pkts_ep));
876
877 event_hdr->event = HCI_EVENT_NUM_COMPL_PKTS0x13;
878 event_hdr->length = sizeof(hci_num_compl_pkts_ep);
879 event->num_con_handles = 0;
880
881 u32 acc = 0;
882
883 for (unsigned int i = 0; i < m_WiiMotes.size(); i++)
884 {
885 event_hdr->length += sizeof(hci_num_compl_pkts_info);
886 event->num_con_handles++;
887 info->compl_pkts = m_PacketCount[i];
888 info->con_handle = m_WiiMotes[i].GetConnectionHandle();
889
890 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"
, 890, " Connection_Handle: 0x%04x", info->con_handle); }
} while (0)
;
891 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"
, 891, " Number_Of_Completed_Packets: %i", info->compl_pkts
); } } while (0)
;
892
893 acc += info->compl_pkts;
894 m_PacketCount[i] = 0;
895 info++;
896 }
897
898 if (acc)
899 {
900 AddEventToQueue(Event);
901 }
902 else
903 {
904 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"
, 904, "SendEventNumberOfCompletedPackets: no packets; no event"
); } } while (0)
;
905 }
906
907 return true;
908}
909
910bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventModeChange(u16 _connectionHandle, u8 _mode, u16 _value)
911{
912 CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle);
913 if (pWiiMote == NULL__null)
914 return false;
915
916 SQueuedEvent Event(sizeof(SHCIEventModeChange), _connectionHandle);
917
918 SHCIEventModeChange* pModeChange = (SHCIEventModeChange*)Event.m_buffer;
919 pModeChange->EventType = HCI_EVENT_MODE_CHANGE0x14;
920 pModeChange->PayloadLength = sizeof(SHCIEventModeChange) - 2;
921 pModeChange->EventStatus = 0;
922 pModeChange->Connection_Handle = _connectionHandle;
923 pModeChange->CurrentMode = _mode;
924 pModeChange->Value = _value;
925
926 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"
, 926, "Event: SendEventModeChange"); } } while (0)
;
927 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"
, 927, " Connection_Handle: 0x%04x", pModeChange->Connection_Handle
); } } while (0)
;
928 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"
, 928, " Current Mode: 0x%02x", pModeChange->CurrentMode =
_mode); } } while (0)
;
929
930 AddEventToQueue(Event);
931
932 return true;
933}
934
935bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventLinkKeyNotification(const u8 num_to_send)
936{
937 u8 payload_length = sizeof(hci_return_link_keys_ep) + sizeof(hci_link_key_rep_cp) * num_to_send;
938 SQueuedEvent Event(2 + payload_length, 0);
939 SHCIEventLinkKeyNotification* pEventLinkKey = (SHCIEventLinkKeyNotification*)Event.m_buffer;
940
941 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"
, 941, "Event: SendEventLinkKeyNotification"); } } while (0)
;
942
943 // event header
944 pEventLinkKey->EventType = HCI_EVENT_RETURN_LINK_KEYS0x15;
945 pEventLinkKey->PayloadLength = payload_length;
946 // this is really hci_return_link_keys_ep.num_keys
947 pEventLinkKey->numKeys = num_to_send;
948
949 // copy infos - this only works correctly if we're meant to start at first device and read all keys
950 for (int i = 0; i < num_to_send; i++)
951 {
952 hci_link_key_rep_cp* link_key_info
953 = (hci_link_key_rep_cp*)((u8*)&pEventLinkKey->bdaddr + sizeof(hci_link_key_rep_cp) * i);
954 link_key_info->bdaddr = m_WiiMotes[i].GetBD();
955 memcpy(link_key_info->key, m_WiiMotes[i].GetLinkKey(), HCI_KEY_SIZE16);
956
957 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"
, 959, " 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)
958 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"
, 959, " 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[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"
, 959, " 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 LOG_LinkKey(link_key_info->key);
961 }
962
963 AddEventToQueue(Event);
964
965 return true;
966};
967
968bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRequestLinkKey(const bdaddr_t& _bd)
969{
970 SQueuedEvent Event(sizeof(SHCIEventRequestLinkKey), 0);
971
972 SHCIEventRequestLinkKey* pEventRequestLinkKey = (SHCIEventRequestLinkKey*)Event.m_buffer;
973
974 pEventRequestLinkKey->EventType = HCI_EVENT_LINK_KEY_REQ0x17;
975 pEventRequestLinkKey->PayloadLength = sizeof(SHCIEventRequestLinkKey) - 2;
976 pEventRequestLinkKey->bdaddr = _bd;
977
978 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"
, 978, "Event: SendEventRequestLinkKey"); } } while (0)
;
979 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"
, 981, " 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)
980 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"
, 981, " 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[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"
, 981, " 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
983 AddEventToQueue(Event);
984
985 return true;
986};
987
988bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadClockOffsetComplete(u16 _connectionHandle)
989{
990 CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle);
991 if (pWiiMote == NULL__null)
992 return false;
993
994 SQueuedEvent Event(sizeof(SHCIEventReadClockOffsetComplete), _connectionHandle);
995
996 SHCIEventReadClockOffsetComplete* pReadClockOffsetComplete = (SHCIEventReadClockOffsetComplete*)Event.m_buffer;
997 pReadClockOffsetComplete->EventType = HCI_EVENT_READ_CLOCK_OFFSET_COMPL0x1c;
998 pReadClockOffsetComplete->PayloadLength = sizeof(SHCIEventReadClockOffsetComplete) - 2;
999 pReadClockOffsetComplete->EventStatus = 0x00;
1000 pReadClockOffsetComplete->ConnectionHandle = _connectionHandle;
1001 pReadClockOffsetComplete->ClockOffset = 0x3818;
1002
1003 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"
, 1003, "Event: SendEventReadClockOffsetComplete"); } } while
(0)
;
1004 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"
, 1004, " Connection_Handle: 0x%04x", pReadClockOffsetComplete
->ConnectionHandle); } } while (0)
;
1005 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"
, 1005, " ClockOffset: 0x%04x", pReadClockOffsetComplete->
ClockOffset); } } while (0)
;
1006
1007 AddEventToQueue(Event);
1008
1009 return true;
1010}
1011
1012bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventConPacketTypeChange(u16 _connectionHandle, u16 _packetType)
1013{
1014 CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle);
1015 if (pWiiMote == NULL__null)
1016 return false;
1017
1018 SQueuedEvent Event(sizeof(SHCIEventConPacketTypeChange), _connectionHandle);
1019
1020 SHCIEventConPacketTypeChange* pChangeConPacketType = (SHCIEventConPacketTypeChange*)Event.m_buffer;
1021 pChangeConPacketType->EventType = HCI_EVENT_CON_PKT_TYPE_CHANGED0x1d;
1022 pChangeConPacketType->PayloadLength = sizeof(SHCIEventConPacketTypeChange) - 2;
1023 pChangeConPacketType->EventStatus = 0x00;
1024 pChangeConPacketType->ConnectionHandle = _connectionHandle;
1025 pChangeConPacketType->PacketType = _packetType;
1026
1027 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"
, 1027, "Event: SendEventConPacketTypeChange"); } } while (0)
;
1028 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"
, 1028, " Connection_Handle: 0x%04x", pChangeConPacketType->
ConnectionHandle); } } while (0)
;
1029 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"
, 1029, " PacketType: 0x%04x", pChangeConPacketType->PacketType
); } } while (0)
;
1030
1031 AddEventToQueue(Event);
1032
1033 return true;
1034}
1035
1036
1037// Command dispatcher
1038// This is called from the USBV0_IOCTL_CTRLMSG Ioctlv
1039void CWII_IPC_HLE_Device_usb_oh1_57e_305::ExecuteHCICommandMessage(const SHCICommandMessage& _rHCICommandMessage)
1040{
1041 u8* pInput = Memory::GetPointer(_rHCICommandMessage.m_PayLoadAddr + 3);
1042 SCommandMessage* pMsg = (SCommandMessage*)Memory::GetPointer(_rHCICommandMessage.m_PayLoadAddr);
1043
1044 u16 ocf = HCI_OCF(pMsg->Opcode)((pMsg->Opcode) & 0x3ff);
1045 u16 ogf = HCI_OGF(pMsg->Opcode)(((pMsg->Opcode) >> 10) & 0x3f);
1046
1047 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"
, 1047, "**************************************************")
; } } while (0)
;
1048 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"
, 1048, "Execute HCI Command: 0x%04x (ocf: 0x%02x, ogf: 0x%02x)"
, pMsg->Opcode, ocf, ogf); } } while (0)
;
1049
1050 switch (pMsg->Opcode)
1051 {
1052 //
1053 // --- read commands ---
1054 //
1055 case HCI_CMD_RESET0x0C03:
1056 CommandReset(pInput);
1057 break;
1058
1059 case HCI_CMD_READ_BUFFER_SIZE0x1005:
1060 CommandReadBufferSize(pInput);
1061 break;
1062
1063 case HCI_CMD_READ_LOCAL_VER0x1001:
1064 CommandReadLocalVer(pInput);
1065 break;
1066
1067 case HCI_CMD_READ_BDADDR0x1009:
1068 CommandReadBDAdrr(pInput);
1069 break;
1070
1071 case HCI_CMD_READ_LOCAL_FEATURES0x1003:
1072 CommandReadLocalFeatures(pInput);
1073 break;
1074
1075 case HCI_CMD_READ_STORED_LINK_KEY0x0C0D:
1076 CommandReadStoredLinkKey(pInput);
1077 break;
1078
1079 case HCI_CMD_WRITE_UNIT_CLASS0x0C24:
1080 CommandWriteUnitClass(pInput);
1081 break;
1082
1083 case HCI_CMD_WRITE_LOCAL_NAME0x0C13:
1084 CommandWriteLocalName(pInput);
1085 break;
1086
1087 case HCI_CMD_WRITE_PIN_TYPE0x0C0A:
1088 CommandWritePinType(pInput);
1089 break;
1090
1091 case HCI_CMD_HOST_BUFFER_SIZE0x0C33:
1092 CommandHostBufferSize(pInput);
1093 break;
1094
1095 case HCI_CMD_WRITE_PAGE_TIMEOUT0x0C18:
1096 CommandWritePageTimeOut(pInput);
1097 break;
1098
1099 case HCI_CMD_WRITE_SCAN_ENABLE0x0C1A:
1100 CommandWriteScanEnable(pInput);
1101 break;
1102
1103 case HCI_CMD_WRITE_INQUIRY_MODE0x0C45:
1104 CommandWriteInquiryMode(pInput);
1105 break;
1106
1107 case HCI_CMD_WRITE_PAGE_SCAN_TYPE0x0C47:
1108 CommandWritePageScanType(pInput);
1109 break;
1110
1111 case HCI_CMD_SET_EVENT_FILTER0x0C05:
1112 CommandSetEventFilter(pInput);
1113 break;
1114
1115 case HCI_CMD_INQUIRY0x0401:
1116 CommandInquiry(pInput);
1117 break;
1118
1119 case HCI_CMD_WRITE_INQUIRY_SCAN_TYPE0x0C43:
1120 CommandWriteInquiryScanType(pInput);
1121 break;
1122
1123 // vendor specific...
1124 case 0xFC4C:
1125 CommandVendorSpecific_FC4C(pInput, _rHCICommandMessage.m_PayLoadSize - 3);
1126 break;
1127
1128 case 0xFC4F:
1129 CommandVendorSpecific_FC4F(pInput, _rHCICommandMessage.m_PayLoadSize - 3);
1130 break;
1131
1132 case HCI_CMD_INQUIRY_CANCEL0x0402:
1133 CommandInquiryCancel(pInput);
1134 break;
1135
1136 case HCI_CMD_REMOTE_NAME_REQ0x0419:
1137 CommandRemoteNameReq(pInput);
1138 break;
1139
1140 case HCI_CMD_CREATE_CON0x0405:
1141 CommandCreateCon(pInput);
1142 break;
1143
1144 case HCI_CMD_ACCEPT_CON0x0409:
1145 CommandAcceptCon(pInput);
1146 break;
1147
1148 case HCI_CMD_CHANGE_CON_PACKET_TYPE0x040F:
1149 CommandChangeConPacketType(pInput);
1150 break;
1151
1152 case HCI_CMD_READ_CLOCK_OFFSET0x041F:
1153 CommandReadClockOffset(pInput);
1154 break;
1155
1156 case HCI_CMD_READ_REMOTE_VER_INFO0x041D:
1157 CommandReadRemoteVerInfo(pInput);
1158 break;
1159
1160 case HCI_CMD_READ_REMOTE_FEATURES0x041B:
1161 CommandReadRemoteFeatures(pInput);
1162 break;
1163
1164 case HCI_CMD_WRITE_LINK_POLICY_SETTINGS0x080D:
1165 CommandWriteLinkPolicy(pInput);
1166 break;
1167
1168 case HCI_CMD_AUTH_REQ0x0411:
1169 CommandAuthenticationRequested(pInput);
1170 break;
1171
1172 case HCI_CMD_SNIFF_MODE0x0803:
1173 CommandSniffMode(pInput);
1174 break;
1175
1176 case HCI_CMD_DISCONNECT0x0406:
1177 CommandDisconnect(pInput);
1178 break;
1179
1180 case HCI_CMD_WRITE_LINK_SUPERVISION_TIMEOUT0x0C37:
1181 CommandWriteLinkSupervisionTimeout(pInput);
1182 break;
1183
1184 case HCI_CMD_LINK_KEY_NEG_REP0x040C:
1185 CommandLinkKeyNegRep(pInput);
1186 break;
1187
1188 case HCI_CMD_LINK_KEY_REP0x040B:
1189 CommandLinkKeyRep(pInput);
1190 break;
1191
1192 case HCI_CMD_DELETE_STORED_LINK_KEY0x0C12:
1193 CommandDeleteStoredLinkKey(pInput);
1194 break;
1195
1196 default:
1197 // send fake okay msg...
1198 SendEventCommandComplete(pMsg->Opcode, NULL__null, 0);
1199
1200 if (ogf == HCI_OGF_VENDOR0x3f)
1201 {
1202 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"
, 1202, "Command: vendor specific: 0x%04X (ocf: 0x%x)", pMsg->
Opcode, ocf); } } while (0)
;
1203 for (int i = 0; i < pMsg->len; i++)
1204 {
1205 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"
, 1205, " 0x02%x", pInput[i]); } } while (0)
;
1206 }
1207 }
1208 else
1209 {
1210 _dbg_assert_msg_(WII_IPC_WIIMOTE, 0,{}
1211 "Unknown USB_IOCTL_CTRLMSG: 0x%04X (ocf: 0x%x ogf 0x%x)", pMsg->Opcode, ocf, ogf){};
1212 }
1213 break;
1214 }
1215
1216 // HCI command is finished, send a reply to command
1217 WII_IPC_HLE_Interface::EnqReply(_rHCICommandMessage.m_Address);
1218}
1219
1220
1221//
1222//
1223// --- command helper
1224//
1225//
1226void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandInquiry(u8* _Input)
1227{
1228 // Inquiry should not be called normally
1229 hci_inquiry_cp* pInquiry = (hci_inquiry_cp*)_Input;
1230
1231 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"
, 1231, "Command: HCI_CMD_INQUIRY:"); } } while (0)
;
1232 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"
, 1232, "write:"); } } while (0)
;
1233 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"
, 1233, " LAP[0]: 0x%02x", pInquiry->lap[0]); } } while (
0)
;
1234 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"
, 1234, " LAP[1]: 0x%02x", pInquiry->lap[1]); } } while (
0)
;
1235 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"
, 1235, " LAP[2]: 0x%02x", pInquiry->lap[2]); } } while (
0)
;
1236 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"
, 1236, " inquiry_length: %i (N x 1.28) sec", pInquiry->inquiry_length
); } } while (0)
;
1237 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"
, 1237, " num_responses: %i (N x 1.28) sec", pInquiry->num_responses
); } } while (0)
;
1238
1239 SendEventCommandStatus(HCI_CMD_INQUIRY0x0401);
1240 SendEventInquiryResponse();
1241 SendEventInquiryComplete();
1242}
1243
1244void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandInquiryCancel(u8* _Input)
1245{
1246 hci_inquiry_cancel_rp Reply;
1247 Reply.status = 0x00;
1248
1249 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"
, 1249, "Command: HCI_CMD_INQUIRY_CANCEL"); } } while (0)
;
1250
1251 SendEventCommandComplete(HCI_CMD_INQUIRY_CANCEL0x0402, &Reply, sizeof(hci_inquiry_cancel_rp));
1252}
1253
1254void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandCreateCon(u8* _Input)
1255{
1256 hci_create_con_cp* pCreateCon = (hci_create_con_cp*)_Input;
1257
1258 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"
, 1258, "Command: HCI_CMD_CREATE_CON"); } } while (0)
;
1259 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"
, 1259, "Input:"); } } while (0)
;
1260 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"
, 1262, " 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)
1261 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"
, 1262, " 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[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"
, 1262, " 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
1264 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"
, 1264, " pkt_type: %i", pCreateCon->pkt_type); } } while
(0)
;
1265 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"
, 1265, " page_scan_rep_mode: %i", pCreateCon->page_scan_rep_mode
); } } while (0)
;
1266 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"
, 1266, " page_scan_mode: %i", pCreateCon->page_scan_mode
); } } while (0)
;
1267 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"
, 1267, " clock_offset: %i", pCreateCon->clock_offset); }
} while (0)
;
1268 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"
, 1268, " accept_role_switch: %i", pCreateCon->accept_role_switch
); } } while (0)
;
1269
1270 SendEventCommandStatus(HCI_CMD_CREATE_CON0x0405);
1271 SendEventConnectionComplete(pCreateCon->bdaddr);
1272}
1273
1274void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandDisconnect(u8* _Input)
1275{
1276 hci_discon_cp* pDiscon = (hci_discon_cp*)_Input;
1277
1278 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"
, 1278, "Command: HCI_CMD_DISCONNECT"); } } while (0)
;
1279 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"
, 1279, " ConnectionHandle: 0x%04x", pDiscon->con_handle)
; } } while (0)
;
1280 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"
, 1280, " Reason: 0x%02x", pDiscon->reason); } } while (0
)
;
1281
1282 Host_SetWiiMoteConnectionState(0);
1283
1284 SendEventCommandStatus(HCI_CMD_DISCONNECT0x0406);
1285 SendEventDisconnect(pDiscon->con_handle, pDiscon->reason);
1286
1287 CWII_IPC_HLE_WiiMote* pWiimote = AccessWiiMote(pDiscon->con_handle);
1288 if (pWiimote)
1289 pWiimote->EventDisconnect();
1290}
1291
1292void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandAcceptCon(u8* _Input)
1293{
1294 hci_accept_con_cp* pAcceptCon = (hci_accept_con_cp*)_Input;
1295
1296 static char s_szRole[][128] =
1297 {
1298 { "Master (0x00)"},
1299 { "Slave (0x01)"},
1300 };
1301
1302 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"
, 1302, "Command: HCI_CMD_ACCEPT_CON"); } } while (0)
;
1303 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"
, 1305, " 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)
1304 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"
, 1305, " 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[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"
, 1305, " 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 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"
, 1306, " role: %s", s_szRole[pAcceptCon->role]); } } while
(0)
;
1307
1308 SendEventCommandStatus(HCI_CMD_ACCEPT_CON0x0409);
1309
1310 // this connection wants to be the master
1311 if (pAcceptCon->role == 0)
1312 {
1313 SendEventRoleChange(pAcceptCon->bdaddr, true);
1314 }
1315
1316 SendEventConnectionComplete(pAcceptCon->bdaddr);
1317}
1318
1319void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandLinkKeyRep(u8* _Input)
1320{
1321 hci_link_key_rep_cp* pKeyRep = (hci_link_key_rep_cp*)_Input;
1322
1323 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"
, 1323, "Command: HCI_CMD_LINK_KEY_REP"); } } while (0)
;
1324 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"
, 1326, " 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)
1325 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"
, 1326, " 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[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"
, 1326, " 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 LOG_LinkKey(pKeyRep->key);
1328
1329
1330 hci_link_key_rep_rp Reply;
1331 Reply.status = 0x00;
1332 Reply.bdaddr = pKeyRep->bdaddr;
1333
1334 SendEventCommandComplete(HCI_CMD_LINK_KEY_REP0x040B, &Reply, sizeof(hci_link_key_rep_rp));
1335}
1336
1337void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandLinkKeyNegRep(u8* _Input)
1338{
1339 hci_link_key_neg_rep_cp* pKeyNeg = (hci_link_key_neg_rep_cp*)_Input;
1340
1341 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"
, 1341, "Command: HCI_CMD_LINK_KEY_NEG_REP"); } } while (0)
;
1342 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"
, 1344, " 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)
1343 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"
, 1344, " 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[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"
, 1344, " 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
1346 hci_link_key_neg_rep_rp Reply;
1347 Reply.status = 0x00;
1348 Reply.bdaddr = pKeyNeg->bdaddr;
1349
1350 SendEventCommandComplete(HCI_CMD_LINK_KEY_NEG_REP0x040C, &Reply, sizeof(hci_link_key_neg_rep_rp));
1351}
1352
1353void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandChangeConPacketType(u8* _Input)
1354{
1355 hci_change_con_pkt_type_cp* pChangePacketType = (hci_change_con_pkt_type_cp*)_Input;
1356
1357 // ntd stack sets packet type 0xcc18, which is HCI_PKT_DH5 | HCI_PKT_DM5 | HCI_PKT_DH1 | HCI_PKT_DM1
1358 // dunno what to do...run awayyyyyy!
1359 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"
, 1359, "Command: HCI_CMD_CHANGE_CON_PACKET_TYPE"); } } while
(0)
;
1360 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"
, 1360, " ConnectionHandle: 0x%04x", pChangePacketType->con_handle
); } } while (0)
;
1361 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"
, 1361, " PacketType: 0x%04x", pChangePacketType->pkt_type
); } } while (0)
;
1362
1363 SendEventCommandStatus(HCI_CMD_CHANGE_CON_PACKET_TYPE0x040F);
1364 SendEventConPacketTypeChange(pChangePacketType->con_handle, pChangePacketType->pkt_type);
1365}
1366
1367void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandAuthenticationRequested(u8* _Input)
1368{
1369 hci_auth_req_cp* pAuthReq = (hci_auth_req_cp*)_Input;
1370
1371 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"
, 1371, "Command: HCI_CMD_AUTH_REQ"); } } while (0)
;
1372 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"
, 1372, " ConnectionHandle: 0x%04x", pAuthReq->con_handle
); } } while (0)
;
1373
1374 SendEventCommandStatus(HCI_CMD_AUTH_REQ0x0411);
1375 SendEventAuthenticationCompleted(pAuthReq->con_handle);
1376}
1377
1378void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandRemoteNameReq(u8* _Input)
1379{
1380 hci_remote_name_req_cp* pRemoteNameReq = (hci_remote_name_req_cp*)_Input;
1381
1382 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"
, 1382, "Command: HCI_CMD_REMOTE_NAME_REQ"); } } while (0)
;
1383 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"
, 1385, " 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)
1384 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"
, 1385, " 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[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"
, 1385, " 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 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"
, 1386, " page_scan_rep_mode: %i", pRemoteNameReq->page_scan_rep_mode
); } } while (0)
;
1387 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"
, 1387, " page_scan_mode: %i", pRemoteNameReq->page_scan_mode
); } } while (0)
;
1388 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"
, 1388, " clock_offset: %i", pRemoteNameReq->clock_offset
); } } while (0)
;
1389
1390 SendEventCommandStatus(HCI_CMD_REMOTE_NAME_REQ0x0419);
1391 SendEventRemoteNameReq(pRemoteNameReq->bdaddr);
1392}
1393
1394void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadRemoteFeatures(u8* _Input)
1395{
1396 hci_read_remote_features_cp* pReadRemoteFeatures = (hci_read_remote_features_cp*)_Input;
1397
1398 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"
, 1398, "Command: HCI_CMD_READ_REMOTE_FEATURES"); } } while (
0)
;
1399 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"
, 1399, " ConnectionHandle: 0x%04x", pReadRemoteFeatures->
con_handle); } } while (0)
;
1400
1401 SendEventCommandStatus(HCI_CMD_READ_REMOTE_FEATURES0x041B);
1402 SendEventReadRemoteFeatures(pReadRemoteFeatures->con_handle);
1403}
1404
1405void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadRemoteVerInfo(u8* _Input)
1406{
1407 hci_read_remote_ver_info_cp* pReadRemoteVerInfo = (hci_read_remote_ver_info_cp*)_Input;
1408
1409 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"
, 1409, "Command: HCI_CMD_READ_REMOTE_VER_INFO"); } } while (
0)
;
1410 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"
, 1410, " ConnectionHandle: 0x%02x", pReadRemoteVerInfo->
con_handle); } } while (0)
;
1411
1412 SendEventCommandStatus(HCI_CMD_READ_REMOTE_VER_INFO0x041D);
1413 SendEventReadRemoteVerInfo(pReadRemoteVerInfo->con_handle);
1414}
1415
1416void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadClockOffset(u8* _Input)
1417{
1418 hci_read_clock_offset_cp* pReadClockOffset = (hci_read_clock_offset_cp*)_Input;
1419
1420 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"
, 1420, "Command: HCI_CMD_READ_CLOCK_OFFSET"); } } while (0)
;
1421 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"
, 1421, " ConnectionHandle: 0x%02x", pReadClockOffset->con_handle
); } } while (0)
;
1422
1423 SendEventCommandStatus(HCI_CMD_READ_CLOCK_OFFSET0x041F);
1424 SendEventReadClockOffsetComplete(pReadClockOffset->con_handle);
1425}
1426
1427void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandSniffMode(u8* _Input)
1428{
1429 hci_sniff_mode_cp* pSniffMode = (hci_sniff_mode_cp*)_Input;
1430
1431 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"
, 1431, "Command: HCI_CMD_SNIFF_MODE"); } } while (0)
;
1432 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"
, 1432, " ConnectionHandle: 0x%04x", pSniffMode->con_handle
); } } while (0)
;
1433 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"
, 1433, " max_interval: %f msec", pSniffMode->max_interval
* .625); } } while (0)
;
1434 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"
, 1434, " min_interval: %f msec", pSniffMode->min_interval
* .625); } } while (0)
;
1435 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"
, 1435, " attempt: %f msec", pSniffMode->attempt * 1.25);
} } while (0)
;
1436 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"
, 1436, " timeout: %f msec", pSniffMode->timeout * 1.25);
} } while (0)
;
1437
1438 SendEventCommandStatus(HCI_CMD_SNIFF_MODE0x0803);
1439 SendEventModeChange(pSniffMode->con_handle, 0x02, pSniffMode->max_interval); // 0x02 - sniff mode
1440}
1441
1442void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteLinkPolicy(u8* _Input)
1443{
1444 hci_write_link_policy_settings_cp* pLinkPolicy = (hci_write_link_policy_settings_cp*)_Input;
1445
1446 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"
, 1446, "Command: HCI_CMD_WRITE_LINK_POLICY_SETTINGS"); } } while
(0)
;
1447 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"
, 1447, " ConnectionHandle: 0x%04x", pLinkPolicy->con_handle
); } } while (0)
;
1448 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"
, 1448, " Policy: 0x%04x", pLinkPolicy->settings); } } while
(0)
;
1449
1450 //hci_write_link_policy_settings_rp Reply;
1451 //Reply.status = 0x00;
1452 //Reply.con_handle = pLinkPolicy->con_handle;
1453
1454 SendEventCommandStatus(HCI_CMD_WRITE_LINK_POLICY_SETTINGS0x080D);
1455
1456 //AccessWiiMote(pLinkPolicy->con_handle)->ResetChannels();
1457}
1458
1459void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReset(u8* _Input)
1460{
1461 hci_status_rp Reply;
1462 Reply.status = 0x00;
1463
1464 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"
, 1464, "Command: HCI_CMD_RESET"); } } while (0)
;
1465
1466 SendEventCommandComplete(HCI_CMD_RESET0x0C03, &Reply, sizeof(hci_status_rp));
1467}
1468
1469void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandSetEventFilter(u8* _Input)
1470{
1471 hci_set_event_filter_cp* pSetEventFilter = (hci_set_event_filter_cp*)_Input;
1472
1473 hci_set_event_filter_rp Reply;
1474 Reply.status = 0x00;
1475
1476 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"
, 1476, "Command: HCI_CMD_SET_EVENT_FILTER:"); } } while (0)
;
1477 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"
, 1477, " filter_type: %i", pSetEventFilter->filter_type)
; } } while (0)
;
1478 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"
, 1478, " filter_condition_type: %i", pSetEventFilter->filter_condition_type
); } } while (0)
;
1479
1480 SendEventCommandComplete(HCI_CMD_SET_EVENT_FILTER0x0C05, &Reply, sizeof(hci_set_event_filter_rp));
1481}
1482
1483void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWritePinType(u8* _Input)
1484{
1485 hci_write_pin_type_cp* pWritePinType = (hci_write_pin_type_cp*)_Input;
1486
1487 hci_write_pin_type_rp Reply;
1488 Reply.status = 0x00;
1489
1490 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"
, 1490, "Command: HCI_CMD_WRITE_PIN_TYPE:"); } } while (0)
;
1491 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"
, 1491, " pin_type: %x", pWritePinType->pin_type); } } while
(0)
;
1492
1493 SendEventCommandComplete(HCI_CMD_WRITE_PIN_TYPE0x0C0A, &Reply, sizeof(hci_write_pin_type_rp));
1494}
1495
1496void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadStoredLinkKey(u8* _Input)
1497{
1498 hci_read_stored_link_key_cp* ReadStoredLinkKey = (hci_read_stored_link_key_cp*)_Input;
1499
1500 hci_read_stored_link_key_rp Reply;
1501 Reply.status = 0x00;
1502 Reply.max_num_keys = 255;
1503
1504 if (ReadStoredLinkKey->read_all == 1)
1
Taking false branch
1505 {
1506 Reply.num_keys_read = (u16)m_WiiMotes.size();
1507 }
1508 else
1509 {
1510 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"
, 1510, "CommandReadStoredLinkKey isn't looking for all devices"
); } } while (0)
;
1511 }
1512
1513 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"
, 1513, "Command: HCI_CMD_READ_STORED_LINK_KEY:"); } } while (
0)
;
1514 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"
, 1514, "input:"); } } while (0)
;
1515 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"
, 1517, " 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)
1516 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"
, 1517, " 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[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"
, 1517, " 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 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"
, 1518, " read_all: %i", ReadStoredLinkKey->read_all); } }
while (0)
;
1519 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"
, 1519, "return:"); } } while (0)
;
1520 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"
, 1520, " max_num_keys: %i", Reply.max_num_keys); } } while (
0)
;
1521 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"
, 1521, " num_keys_read: %i", Reply.num_keys_read); } } while
(0)
;
1522
1523 SendEventLinkKeyNotification((u8)Reply.num_keys_read);
2
Function call argument is an uninitialized value
1524 SendEventCommandComplete(HCI_CMD_READ_STORED_LINK_KEY0x0C0D, &Reply, sizeof(hci_read_stored_link_key_rp));
1525}
1526
1527void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandDeleteStoredLinkKey(u8* _Input)
1528{
1529 hci_delete_stored_link_key_cp* pDeleteStoredLinkKey = (hci_delete_stored_link_key_cp*)_Input;
1530
1531 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"
, 1531, "Command: HCI_OCF_DELETE_STORED_LINK_KEY"); } } while
(0)
;
1532 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"
, 1534, " 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)
1533 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"
, 1534, " 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[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"
, 1534, " 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 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"
, 1535, " delete_all: 0x%01x", pDeleteStoredLinkKey->delete_all
); } } while (0)
;
1536
1537
1538 CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(pDeleteStoredLinkKey->bdaddr);
1539 if (pWiiMote == NULL__null)
1540 return;
1541
1542 hci_delete_stored_link_key_rp Reply;
1543 Reply.status = 0x00;
1544 Reply.num_keys_deleted = 0;
1545
1546 SendEventCommandComplete(HCI_CMD_DELETE_STORED_LINK_KEY0x0C12, &Reply, sizeof(hci_delete_stored_link_key_rp));
1547
1548 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"
, 1548, "HCI: CommandDeleteStoredLinkKey... Probably the security for linking has failed. Could be a problem with loading the SCONF"
); } } while (0)
;
1549}
1550
1551void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteLocalName(u8* _Input)
1552{
1553 hci_write_local_name_cp* pWriteLocalName = (hci_write_local_name_cp*)_Input;
1554
1555 hci_write_local_name_rp Reply;
1556 Reply.status = 0x00;
1557
1558 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"
, 1558, "Command: HCI_CMD_WRITE_LOCAL_NAME:"); } } while (0)
;
1559 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"
, 1559, " local_name: %s", pWriteLocalName->name); } } while
(0)
;
1560
1561 SendEventCommandComplete(HCI_CMD_WRITE_LOCAL_NAME0x0C13, &Reply, sizeof(hci_write_local_name_rp));
1562}
1563
1564// Here we normally receive the timeout interval.
1565// But not from homebrew games that use lwbt. Why not?
1566void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWritePageTimeOut(u8* _Input)
1567{
1568 hci_write_page_timeout_cp* pWritePageTimeOut = (hci_write_page_timeout_cp*)_Input;
1569
1570 hci_host_buffer_size_rp Reply;
1571 Reply.status = 0x00;
1572
1573 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"
, 1573, "Command: HCI_CMD_WRITE_PAGE_TIMEOUT:"); } } while (0
)
;
1574 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"
, 1574, " timeout: %i", pWritePageTimeOut->timeout); } } while
(0)
;
1575
1576 SendEventCommandComplete(HCI_CMD_WRITE_PAGE_TIMEOUT0x0C18, &Reply, sizeof(hci_host_buffer_size_rp));
1577}
1578
1579/* This will enable ScanEnable so that Update() can start the Wiimote. */
1580void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteScanEnable(u8* _Input)
1581{
1582 hci_write_scan_enable_cp* pWriteScanEnable = (hci_write_scan_enable_cp*)_Input;
1583 m_ScanEnable = pWriteScanEnable->scan_enable;
1584
1585 hci_write_scan_enable_rp Reply;
1586 Reply.status = 0x00;
1587
1588 static char Scanning[][128] =
1589 {
1590 { "HCI_NO_SCAN_ENABLE"},
1591 { "HCI_INQUIRY_SCAN_ENABLE"},
1592 { "HCI_PAGE_SCAN_ENABLE"},
1593 { "HCI_INQUIRY_AND_PAGE_SCAN_ENABLE"},
1594 };
1595
1596 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"
, 1596, "Command: HCI_CMD_WRITE_SCAN_ENABLE: (0x%02x)", pWriteScanEnable
->scan_enable); } } while (0)
;
1597 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"
, 1597, " scan_enable: %s", Scanning[pWriteScanEnable->scan_enable
]); } } while (0)
;
1598
1599 SendEventCommandComplete(HCI_CMD_WRITE_SCAN_ENABLE0x0C1A, &Reply, sizeof(hci_write_scan_enable_rp));
1600}
1601
1602void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteUnitClass(u8* _Input)
1603{
1604 hci_write_unit_class_cp* pWriteUnitClass = (hci_write_unit_class_cp*)_Input;
1605
1606 hci_write_unit_class_rp Reply;
1607 Reply.status = 0x00;
1608
1609 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"
, 1609, "Command: HCI_CMD_WRITE_UNIT_CLASS:"); } } while (0)
;
1610 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"
, 1610, " COD[0]: 0x%02x", pWriteUnitClass->uclass[0]); }
} while (0)
;
1611 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"
, 1611, " COD[1]: 0x%02x", pWriteUnitClass->uclass[1]); }
} while (0)
;
1612 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"
, 1612, " COD[2]: 0x%02x", pWriteUnitClass->uclass[2]); }
} while (0)
;
1613
1614 SendEventCommandComplete(HCI_CMD_WRITE_UNIT_CLASS0x0C24, &Reply, sizeof(hci_write_unit_class_rp));
1615}
1616
1617void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandHostBufferSize(u8* _Input)
1618{
1619 hci_host_buffer_size_cp* pHostBufferSize = (hci_host_buffer_size_cp*)_Input;
1620
1621 hci_host_buffer_size_rp Reply;
1622 Reply.status = 0x00;
1623
1624 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"
, 1624, "Command: HCI_CMD_HOST_BUFFER_SIZE:"); } } while (0)
;
1625 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"
, 1625, " max_acl_size: %i", pHostBufferSize->max_acl_size
); } } while (0)
;
1626 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"
, 1626, " max_sco_size: %i", pHostBufferSize->max_sco_size
); } } while (0)
;
1627 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"
, 1627, " num_acl_pkts: %i", pHostBufferSize->num_acl_pkts
); } } while (0)
;
1628 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"
, 1628, " num_sco_pkts: %i", pHostBufferSize->num_sco_pkts
); } } while (0)
;
1629
1630 SendEventCommandComplete(HCI_CMD_HOST_BUFFER_SIZE0x0C33, &Reply, sizeof(hci_host_buffer_size_rp));
1631}
1632
1633void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteLinkSupervisionTimeout(u8* _Input)
1634{
1635 hci_write_link_supervision_timeout_cp* pSuperVision = (hci_write_link_supervision_timeout_cp*)_Input;
1636
1637 // timeout of 0 means timing out is disabled
1638 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"
, 1638, "Command: HCI_CMD_WRITE_LINK_SUPERVISION_TIMEOUT"); }
} while (0)
;
1639 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"
, 1639, " con_handle: 0x%04x", pSuperVision->con_handle);
} } while (0)
;
1640 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"
, 1640, " timeout: 0x%02x", pSuperVision->timeout); } } while
(0)
;
1641
1642 hci_write_link_supervision_timeout_rp Reply;
1643 Reply.status = 0x00;
1644 Reply.con_handle = pSuperVision->con_handle;
1645
1646 SendEventCommandComplete(HCI_CMD_WRITE_LINK_SUPERVISION_TIMEOUT0x0C37, &Reply, sizeof(hci_write_link_supervision_timeout_rp));
1647}
1648
1649void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteInquiryScanType(u8* _Input)
1650{
1651 hci_write_inquiry_scan_type_cp* pSetEventFilter = (hci_write_inquiry_scan_type_cp*)_Input;
1652
1653 hci_write_inquiry_scan_type_rp Reply;
1654 Reply.status = 0x00;
1655
1656 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"
, 1656, "Command: HCI_CMD_WRITE_INQUIRY_SCAN_TYPE:"); } } while
(0)
;
1657 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"
, 1657, " type: %i", pSetEventFilter->type); } } while (0
)
;
1658
1659 SendEventCommandComplete(HCI_CMD_WRITE_INQUIRY_SCAN_TYPE0x0C43, &Reply, sizeof(hci_write_inquiry_scan_type_rp));
1660}
1661
1662void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteInquiryMode(u8* _Input)
1663{
1664 hci_write_inquiry_mode_cp* pInquiryMode = (hci_write_inquiry_mode_cp*)_Input;
1665
1666 hci_write_inquiry_mode_rp Reply;
1667 Reply.status = 0x00;
1668
1669 static char InquiryMode[][128] =
1670 {
1671 { "Standard Inquiry Result event format (default)" },
1672 { "Inquiry Result format with RSSI" },
1673 { "Inquiry Result with RSSI format or Extended Inquiry Result format" }
1674 };
1675 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"
, 1675, "Command: HCI_CMD_WRITE_INQUIRY_MODE:"); } } while (0
)
;
1676 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"
, 1676, " mode: %s", InquiryMode[pInquiryMode->mode]); } }
while (0)
;
1677
1678 SendEventCommandComplete(HCI_CMD_WRITE_INQUIRY_MODE0x0C45, &Reply, sizeof(hci_write_inquiry_mode_rp));
1679}
1680
1681void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWritePageScanType(u8* _Input)
1682{
1683 hci_write_page_scan_type_cp* pWritePageScanType = (hci_write_page_scan_type_cp*)_Input;
1684
1685 hci_write_page_scan_type_rp Reply;
1686 Reply.status = 0x00;
1687
1688 static char PageScanType[][128] =
1689 {
1690 { "Mandatory: Standard Scan (default)" },
1691 { "Optional: Interlaced Scan" }
1692 };
1693
1694 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"
, 1694, "Command: HCI_CMD_WRITE_PAGE_SCAN_TYPE:"); } } while (
0)
;
1695 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"
, 1695, " type: %s", PageScanType[pWritePageScanType->type
]); } } while (0)
;
1696
1697 SendEventCommandComplete(HCI_CMD_WRITE_PAGE_SCAN_TYPE0x0C47, &Reply, sizeof(hci_write_page_scan_type_rp));
1698}
1699
1700void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadLocalVer(u8* _Input)
1701{
1702 hci_read_local_ver_rp Reply;
1703 Reply.status = 0x00;
1704 Reply.hci_version = 0x03; // HCI version: 1.1
1705 Reply.hci_revision = 0x40a7; // current revision (?)
1706 Reply.lmp_version = 0x03; // LMP version: 1.1
1707 Reply.manufacturer = 0x000F; // manufacturer: reserved for tests
1708 Reply.lmp_subversion = 0x430e; // LMP subversion
1709
1710 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"
, 1710, "Command: HCI_CMD_READ_LOCAL_VER:"); } } while (0)
;
1711 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"
, 1711, "return:"); } } while (0)
;
1712 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"
, 1712, " status: %i", Reply.status); } } while (0)
;
1713 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"
, 1713, " hci_revision: %i", Reply.hci_revision); } } while
(0)
;
1714 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"
, 1714, " lmp_version: %i", Reply.lmp_version); } } while
(0)
;
1715 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"
, 1715, " manufacturer: %i", Reply.manufacturer); } } while
(0)
;
1716 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"
, 1716, " lmp_subversion: %i", Reply.lmp_subversion); } } while
(0)
;
1717
1718 SendEventCommandComplete(HCI_CMD_READ_LOCAL_VER0x1001, &Reply, sizeof(hci_read_local_ver_rp));
1719}
1720
1721void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadLocalFeatures(u8* _Input)
1722{
1723 hci_read_local_features_rp Reply;
1724 Reply.status = 0x00;
1725 Reply.features[0] = 0xFF;
1726 Reply.features[1] = 0xFF;
1727 Reply.features[2] = 0x8D;
1728 Reply.features[3] = 0xFE;
1729 Reply.features[4] = 0x9B;
1730 Reply.features[5] = 0xF9;
1731 Reply.features[6] = 0x00;
1732 Reply.features[7] = 0x80;
1733
1734 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"
, 1734, "Command: HCI_CMD_READ_LOCAL_FEATURES:"); } } while (
0)
;
1735 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"
, 1735, "return:"); } } while (0)
;
1736 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"
, 1739, " 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)
1737 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"
, 1739, " 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[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"
, 1739, " 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[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"
, 1739, " 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
1741 SendEventCommandComplete(HCI_CMD_READ_LOCAL_FEATURES0x1003, &Reply, sizeof(hci_read_local_features_rp));
1742}
1743
1744void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadBufferSize(u8* _Input)
1745{
1746 hci_read_buffer_size_rp Reply;
1747 Reply.status = 0x00;
1748 Reply.max_acl_size = m_acl_pkt_size;
1749 // Due to how the widcomm stack which Nintendo uses is coded, we must never
1750 // let the stack think the controller is buffering more than 10 data packets
1751 // - it will cause a u8 underflow and royally screw things up.
1752 Reply.num_acl_pkts = m_acl_pkts_num;
1753 Reply.max_sco_size = 64;
1754 Reply.num_sco_pkts = 0;
1755
1756 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"
, 1756, "Command: HCI_CMD_READ_BUFFER_SIZE:"); } } while (0)
;
1757 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"
, 1757, "return:"); } } while (0)
;
1758 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"
, 1758, " max_acl_size: %i", Reply.max_acl_size); } } while (
0)
;
1759 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"
, 1759, " num_acl_pkts: %i", Reply.num_acl_pkts); } } while (
0)
;
1760 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"
, 1760, " max_sco_size: %i", Reply.max_sco_size); } } while (
0)
;
1761 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"
, 1761, " num_sco_pkts: %i", Reply.num_sco_pkts); } } while (
0)
;
1762
1763 SendEventCommandComplete(HCI_CMD_READ_BUFFER_SIZE0x1005, &Reply, sizeof(hci_read_buffer_size_rp));
1764}
1765
1766void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadBDAdrr(u8* _Input)
1767{
1768 hci_read_bdaddr_rp Reply;
1769 Reply.status = 0x00;
1770 Reply.bdaddr = m_ControllerBD;
1771
1772 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"
, 1772, "Command: HCI_CMD_READ_BDADDR:"); } } while (0)
;
1773 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"
, 1773, "return:"); } } while (0)
;
1774 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"
, 1776, " 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)
1775 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"
, 1776, " 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[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"
, 1776, " 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
1778 SendEventCommandComplete(HCI_CMD_READ_BDADDR0x1009, &Reply, sizeof(hci_read_bdaddr_rp));
1779}
1780
1781void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandVendorSpecific_FC4F(u8* _Input, u32 _Size)
1782{
1783 // callstack...
1784 // BTM_VendorSpecificCommad()
1785 // WUDiRemovePatch()
1786 // WUDiAppendRuntimePatch()
1787 // WUDiGetFirmwareVersion()
1788 // WUDiStackSetupComplete()
1789
1790 hci_status_rp Reply;
1791 Reply.status = 0x00;
1792
1793 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"
, 1793, "Command: CommandVendorSpecific_FC4F: (callstack WUDiRemovePatch)"
); } } while (0)
;
1794 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"
, 1794, "Input (size 0x%x):", _Size); } } while (0)
;
1795
1796 Dolphin_Debugger::PrintDataBuffer(LogTypes::WII_IPC_WIIMOTE, _Input, _Size, "Data: ");
1797
1798 SendEventCommandComplete(0xFC4F, &Reply, sizeof(hci_status_rp));
1799}
1800
1801void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandVendorSpecific_FC4C(u8* _Input, u32 _Size)
1802{
1803 hci_status_rp Reply;
1804 Reply.status = 0x00;
1805
1806 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"
, 1806, "Command: CommandVendorSpecific_FC4C:"); } } while (0
)
;
1807 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"
, 1807, "Input (size 0x%x):", _Size); } } while (0)
;
1808 Dolphin_Debugger::PrintDataBuffer(LogTypes::WII_IPC_WIIMOTE, _Input, _Size, "Data: ");
1809
1810 SendEventCommandComplete(0xFC4C, &Reply, sizeof(hci_status_rp));
1811}
1812
1813
1814//
1815//
1816// --- helper
1817//
1818//
1819CWII_IPC_HLE_WiiMote* CWII_IPC_HLE_Device_usb_oh1_57e_305::AccessWiiMote(const bdaddr_t& _rAddr)
1820{
1821 for (size_t i=0; i<m_WiiMotes.size(); i++)
1822 {
1823 const bdaddr_t& BD = m_WiiMotes[i].GetBD();
1824 if ((_rAddr.b[0] == BD.b[0]) &&
1825 (_rAddr.b[1] == BD.b[1]) &&
1826 (_rAddr.b[2] == BD.b[2]) &&
1827 (_rAddr.b[3] == BD.b[3]) &&
1828 (_rAddr.b[4] == BD.b[4]) &&
1829 (_rAddr.b[5] == BD.b[5]))
1830 return &m_WiiMotes[i];
1831 }
1832
1833 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"
, 1834, "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)
1834 _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"
, 1834, "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 return NULL__null;
1836}
1837
1838CWII_IPC_HLE_WiiMote* CWII_IPC_HLE_Device_usb_oh1_57e_305::AccessWiiMote(u16 _ConnectionHandle)
1839{
1840 for (size_t i=0; i<m_WiiMotes.size(); i++)
1841 {
1842 if (m_WiiMotes[i].GetConnectionHandle() == _ConnectionHandle)
1843 return &m_WiiMotes[i];
1844 }
1845
1846 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"
, 1846, "Can't find WiiMote by connection handle %02x", _ConnectionHandle
); } } while (0)
;
1847 PanicAlertT("Can't find WiiMote by connection handle %02x", _ConnectionHandle)MsgAlert(false, WARNING, "Can't find WiiMote by connection handle %02x"
, _ConnectionHandle)
;
1848 return NULL__null;
1849}
1850
1851void CWII_IPC_HLE_Device_usb_oh1_57e_305::LOG_LinkKey(const u8* _pLinkKey)
1852{
1853 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"
, 1857, " 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)
1854 "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"
, 1857, " 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"
, 1857, " 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 , _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"
, 1857, " 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[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"
, 1857, " 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
1859}