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