diff --git a/Binary/win32/WII/shared2/sys/SYSCONF b/Binary/win32/WII/shared2/sys/SYSCONF index 8925006cdb..3b65d5399e 100644 Binary files a/Binary/win32/WII/shared2/sys/SYSCONF and b/Binary/win32/WII/shared2/sys/SYSCONF differ diff --git a/Source/Core/Common/Src/Common.h b/Source/Core/Common/Src/Common.h index 5769e597cb..6160e5e449 100644 --- a/Source/Core/Common/Src/Common.h +++ b/Source/Core/Common/Src/Common.h @@ -193,6 +193,7 @@ class LogTypes WII_IOB, WII_IPC, WII_IPC_HLE, + WIIMOTE, NUMBER_OF_LOGS }; }; @@ -224,8 +225,10 @@ void Host_UpdateLogDisplay(); #define LOG(_t_, ...) #define _dbg_clear_() +#ifndef _dbg_assert_ #define _dbg_assert_(_t_, _a_) ; #define _dbg_assert_msg_(_t_, _a_, _desc_, ...) ; +#endif #define _dbg_update_() ; #endif diff --git a/Source/Core/Core/Src/HLE/HLE.cpp b/Source/Core/Core/Src/HLE/HLE.cpp index 72d7cb5da3..ef3874858a 100644 --- a/Source/Core/Core/Src/HLE/HLE.cpp +++ b/Source/Core/Core/Src/HLE/HLE.cpp @@ -50,21 +50,22 @@ static const SPatch OSPatches[] = { { "FAKE_TO_SKIP_0", HLE_Misc::UnimplementedFunction }, - // speedup - { "OSProtectRange", HLE_Misc::UnimplementedFunctionFalse }, -// { "THPPlayerGetState", HLE_Misc:THPPlayerGetState }, + // speedup + { "OSProtectRange", HLE_Misc::UnimplementedFunctionFalse }, + // { "THPPlayerGetState", HLE_Misc:THPPlayerGetState }, - // debug out is very nice ;) - { "OSReport", HLE_OS::HLE_OSReport }, - { "OSPanic", HLE_OS::HLE_OSPanic }, - { "vprintf", HLE_OS::HLE_vprintf }, - { "printf", HLE_OS::HLE_printf }, + // debug out is very nice ;) + { "OSReport", HLE_OS::HLE_OSReport }, + { "OSPanic", HLE_OS::HLE_OSPanic }, + { "vprintf", HLE_OS::HLE_vprintf }, + { "printf", HLE_OS::HLE_printf }, + { "puts", HLE_OS::HLE_printf }, //gcc-optimized printf? // wii only { "SCCheckStatus", HLE_Misc::UnimplementedFunctionFalse }, { "__OSInitAudioSystem", HLE_Misc::UnimplementedFunction }, - + // Super Monkey Ball { ".evil_vec_cosine", HLE_Misc::SMB_EvilVecCosine }, { ".evil_normalize", HLE_Misc::SMB_EvilNormalize }, @@ -74,9 +75,9 @@ static const SPatch OSPatches[] = { ".rsqrt_internal_needs_cr1", HLE_Misc::SMB_rsqrt_internal }, { ".atan2", HLE_Misc::SMB_atan2}, - // special -// { "GXPeekZ", HLE_Misc::GXPeekZ}, -// { "GXPeekARGB", HLE_Misc::GXPeekARGB}, + // special + // { "GXPeekZ", HLE_Misc::GXPeekZ}, + // { "GXPeekARGB", HLE_Misc::GXPeekARGB}, }; static const SPatch OSBreakPoints[] = @@ -106,7 +107,7 @@ void PatchFunctions() u32 HLEPatchValue = (1 & 0x3f) << 26; for (size_t addr = symbol->address; addr < symbol->address + symbol->size; addr += 4) Memory::Write_U32(HLEPatchValue | i, addr); - LOG(HLE,"Patching %s %08x", OSPatches[i].m_szPatchName, symbol->address); + LOG(HLE,"Patching %s %08x", OSPatches[i].m_szPatchName, symbol->address); } } @@ -115,12 +116,12 @@ void PatchFunctions() Symbol *symbol = g_symbolDB.GetSymbolFromName(OSPatches[i].m_szPatchName); if (symbol > 0) { - CBreakPoints::AddBreakPoint(symbol->address, false); - LOG(HLE,"Adding BP to %s %08x", OSBreakPoints[i].m_szPatchName, symbol->address); + CBreakPoints::AddBreakPoint(symbol->address, false); + LOG(HLE,"Adding BP to %s %08x", OSBreakPoints[i].m_szPatchName, symbol->address); } } -// CBreakPoints::AddBreakPoint(0x8000D3D0, false); + // CBreakPoints::AddBreakPoint(0x8000D3D0, false); } void Execute(u32 _CurrentPC, u32 _Instruction) @@ -135,7 +136,7 @@ void Execute(u32 _CurrentPC, u32 _Instruction) PanicAlert("HLE system tried to call an undefined HLE function %i.", FunctionIndex); } -// _dbg_assert_msg_(HLE,NPC == LR, "Broken HLE function (doesn't set NPC)", OSPatches[pos].m_szPatchName); + // _dbg_assert_msg_(HLE,NPC == LR, "Broken HLE function (doesn't set NPC)", OSPatches[pos].m_szPatchName); } } diff --git a/Source/Core/Core/Src/HLE/HLE_OS.cpp b/Source/Core/Core/Src/HLE/HLE_OS.cpp index 5dd073abc7..3c0dae799e 100644 --- a/Source/Core/Core/Src/HLE/HLE_OS.cpp +++ b/Source/Core/Core/Src/HLE/HLE_OS.cpp @@ -31,22 +31,22 @@ void GetStringVA(std::string& _rOutBuffer); void HLE_OSPanic() { - std::string Error; - GetStringVA(Error); + std::string Error; + GetStringVA(Error); - PanicAlert("OSPanic: %s", Error.c_str()); - LOG(OSREPORT,"(PC=%08x), OSPanic: %s", LR, Error.c_str()); + PanicAlert("OSPanic: %s", Error.c_str()); + LOG(OSREPORT,"(PC=%08x), OSPanic: %s", LR, Error.c_str()); - NPC = LR; + NPC = LR; } void HLE_OSReport() { - std::string ReportMessage; - GetStringVA(ReportMessage); + std::string ReportMessage; + GetStringVA(ReportMessage); -// PanicAlert("(PC=%08x) OSReport: %s", LR, ReportMessage.c_str()); + // PanicAlert("(PC=%08x) OSReport: %s", LR, ReportMessage.c_str()); LOG(OSREPORT,"(PC=%08x) OSReport: %s", LR, ReportMessage.c_str()); NPC = LR; @@ -54,77 +54,79 @@ void HLE_OSReport() void HLE_vprintf() { - std::string ReportMessage; - GetStringVA(ReportMessage); + std::string ReportMessage; + GetStringVA(ReportMessage); - LOG(OSREPORT,"(PC=%08x) VPrintf: %s", LR, ReportMessage.c_str()); - NPC = LR; + LOG(OSREPORT,"(PC=%08x) VPrintf: %s", LR, ReportMessage.c_str()); + NPC = LR; } void HLE_printf() { - std::string ReportMessage; - GetStringVA(ReportMessage); + std::string ReportMessage; + GetStringVA(ReportMessage); - LOG(OSREPORT,"(PC=%08x) Printf: %s ", LR, ReportMessage.c_str()); - NPC = LR; + LOG(OSREPORT,"(PC=%08x) Printf: %s ", LR, ReportMessage.c_str()); + NPC = LR; } void GetStringVA(std::string& _rOutBuffer) { - char ArgumentBuffer[256]; - u32 ParameterCounter = 4; - char* pString = (char*)Memory::GetPointer(GPR(3)); + char ArgumentBuffer[256]; + u32 ParameterCounter = 4; + char* pString = (char*)Memory::GetPointer(GPR(3)); - while(*pString) - { - if (*pString == '%') - { - char* pArgument = ArgumentBuffer; - *pArgument++ = *pString++; - while(*pString < 'A' || *pString > 'z' || *pString == 'l' || *pString == '-') - *pArgument++ = *pString++; + while(*pString) + { + if (*pString == '%') + { + char* pArgument = ArgumentBuffer; + *pArgument++ = *pString++; + while(*pString < 'A' || *pString > 'z' || *pString == 'l' || *pString == '-') + *pArgument++ = *pString++; - *pArgument++ = *pString; - *pArgument = NULL; + *pArgument++ = *pString; + *pArgument = NULL; - u32 Parameter; - if (ParameterCounter > 10) - { - Parameter = Memory::Read_U32(GPR(1) + 0x8 + ((ParameterCounter - 11) * 4)); - } - else - { - Parameter = GPR(ParameterCounter); - } - ParameterCounter++; + u32 Parameter; + if (ParameterCounter > 10) + { + Parameter = Memory::Read_U32(GPR(1) + 0x8 + ((ParameterCounter - 11) * 4)); + } + else + { + Parameter = GPR(ParameterCounter); + } + ParameterCounter++; - switch(*pString) - { - case 's': - _rOutBuffer += StringFromFormat(ArgumentBuffer, (char*)Memory::GetPointer(Parameter)); - break; + switch(*pString) + { + case 's': + _rOutBuffer += StringFromFormat(ArgumentBuffer, (char*)Memory::GetPointer(Parameter)); + break; - case 'd': - { - //u64 Double = Memory::Read_U64(Parameter); - _rOutBuffer += StringFromFormat(ArgumentBuffer, Parameter); - } - break; + case 'd': + { + //u64 Double = Memory::Read_U64(Parameter); + _rOutBuffer += StringFromFormat(ArgumentBuffer, Parameter); + } + break; - default: - _rOutBuffer += StringFromFormat(ArgumentBuffer, Parameter); - break; - } - pString++; - } - else - { - _rOutBuffer += StringFromFormat("%c", *pString); - pString++; - } - } + default: + _rOutBuffer += StringFromFormat(ArgumentBuffer, Parameter); + break; + } + pString++; + } + else + { + _rOutBuffer += StringFromFormat("%c", *pString); + pString++; + } + } + if(_rOutBuffer[_rOutBuffer.length() - 1] == '\n') + _rOutBuffer.resize(_rOutBuffer.length() - 1); } } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp index cb4a24569b..fbfdab264b 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp @@ -18,16 +18,13 @@ #include "WII_IPC_HLE_Device_usb.h" #include - -#define USB_HLE_LOG DSPHLE - CWII_IPC_HLE_Device_usb_oh1_57e_305::CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _DeviceID, const std::string& _rDeviceName) - : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) - , m_ACLAnswer(false) - , m_pACLBuffer(NULL) - , m_pHCIBuffer(NULL) - , m_State(STATE_NONE) - , scan_enable(0) +: IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) +, m_ACLAnswer(false) +, m_pACLBuffer(NULL) +, m_pHCIBuffer(NULL) +, m_State(STATE_NONE) +, scan_enable(0) { m_WiiMotes.push_back(CWII_IPC_HLE_WiiMote(this, 0)); @@ -44,8 +41,8 @@ CWII_IPC_HLE_Device_usb_oh1_57e_305::~CWII_IPC_HLE_Device_usb_oh1_57e_305() bool CWII_IPC_HLE_Device_usb_oh1_57e_305::Open(u32 _CommandAddress) { - Memory::Write_U32(GetDeviceID(), _CommandAddress+4); - return true; + Memory::Write_U32(GetDeviceID(), _CommandAddress+4); + return true; } bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtl(u32 _CommandAddress) @@ -55,12 +52,14 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtl(u32 _CommandAddress) bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtlV(u32 _CommandAddress) { - // wpadsampled.elf - patch so the USB_LOG will print somehting + // wpadsampled.elf - patch so the USB_LOG will print somehting // even it it wasn't very useful yet... - // Memory::Write_U8(1, 0x801514A8); // USB_LOG - Memory::Write_U8(1, 0x801514D8); // WUD_DEBUGPrint - - SIOCtlVBuffer CommandBuffer(_CommandAddress); + // Memory::Write_U8(1, 0x801514A8); // USB_LOG + //Memory::Write_U8(1, 0x801514D8); // WUD_DEBUGPrint + + SIOCtlVBuffer CommandBuffer(_CommandAddress); + + LOG(WIIMOTE, "USB_IOCTL_CTRLMSG(0x%x)", CommandBuffer.Parameter); // DumpAsync(CommandBuffer.BufferVector, _CommandAddress, CommandBuffer.NumberInBuffer, CommandBuffer.NumberPayloadBuffer); @@ -70,7 +69,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtlV(u32 _CommandAddress) { SHCICommandMessage CtrlSetup; - // the USB stuff is little endian + // the USB stuff is little endian CtrlSetup.bRequestType = *(u8*)Memory::GetPointer(CommandBuffer.InBuffer[0].m_Address); CtrlSetup.bRequest = *(u8*)Memory::GetPointer(CommandBuffer.InBuffer[1].m_Address); CtrlSetup.wValue = *(u16*)Memory::GetPointer(CommandBuffer.InBuffer[2].m_Address); @@ -80,24 +79,26 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtlV(u32 _CommandAddress) u8 Termination =*(u8*)Memory::GetPointer(CommandBuffer.InBuffer[5].m_Address); #endif - CtrlSetup.m_PayLoadAddr = CommandBuffer.PayloadBuffer[0].m_Address; - CtrlSetup.m_PayLoadSize = CommandBuffer.PayloadBuffer[0].m_Size; + CtrlSetup.m_PayLoadAddr = CommandBuffer.PayloadBuffer[0].m_Address; + CtrlSetup.m_PayLoadSize = CommandBuffer.PayloadBuffer[0].m_Size; - _dbg_assert_msg_(USB_HLE_LOG, Termination == 0, "USB_HLE_LOG: Termination != 0"); + _dbg_assert_msg_(WIIMOTE, Termination == 0, "WIIMOTE: Termination != 0"); - LOG(USB_HLE_LOG, "USB_IOCTL_CTRLMSG (0x%08x) - add to queue and send ack only", _CommandAddress); +#if 0 + LOG(WIIMOTE, "USB_IOCTL_CTRLMSG (0x%08x) - add to queue and send ack only", _CommandAddress); -/* LOG(USB_HLE_LOG, " bRequestType: 0x%x", CtrlSetup.bRequestType); - LOG(USB_HLE_LOG, " bRequest: 0x%x", CtrlSetup.bRequest); - LOG(USB_HLE_LOG, " wValue: 0x%x", CtrlSetup.wValue); - LOG(USB_HLE_LOG, " wIndex: 0x%x", CtrlSetup.wIndex); - LOG(USB_HLE_LOG, " wLength: 0x%x", CtrlSetup.wLength); */ - - m_HCICommandMessageQueue.push(CtrlSetup); + LOG(WIIMOTE, " bRequestType: 0x%x", CtrlSetup.bRequestType); + LOG(WIIMOTE, " bRequest: 0x%x", CtrlSetup.bRequest); + LOG(WIIMOTE, " wValue: 0x%x", CtrlSetup.wValue); + LOG(WIIMOTE, " wIndex: 0x%x", CtrlSetup.wIndex); + LOG(WIIMOTE, " wLength: 0x%x", CtrlSetup.wLength); +#endif - // control message has been sent... - Memory::Write_U32(0, _CommandAddress + 0x4); - return true; + m_HCICommandMessageQueue.push(CtrlSetup); + + // control message has been sent... + Memory::Write_U32(0, _CommandAddress + 0x4); + return true; } break; @@ -106,35 +107,35 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtlV(u32 _CommandAddress) u8 Command = Memory::Read_U8(CommandBuffer.InBuffer[0].m_Address); switch (Command) { - case ACL_DATA_ENDPOINT_READ: - { - // write - DumpAsync(CommandBuffer.BufferVector, _CommandAddress, CommandBuffer.NumberInBuffer, CommandBuffer.NumberPayloadBuffer); + case ACL_DATA_ENDPOINT_READ: + { + // write + DumpAsync(CommandBuffer.BufferVector, _CommandAddress, CommandBuffer.NumberInBuffer, CommandBuffer.NumberPayloadBuffer); - SIOCtlVBuffer pBulkBuffer(_CommandAddress); - UACLHeader* pACLHeader = (UACLHeader*)Memory::GetPointer(pBulkBuffer.PayloadBuffer[0].m_Address); - - _dbg_assert_(USB_HLE_LOG, pACLHeader->BCFlag == 0); - _dbg_assert_(USB_HLE_LOG, pACLHeader->PBFlag == 2); + SIOCtlVBuffer pBulkBuffer(_CommandAddress); + UACLHeader* pACLHeader = (UACLHeader*)Memory::GetPointer(pBulkBuffer.PayloadBuffer[0].m_Address); - SendToDevice(pACLHeader->ConnectionHandle, Memory::GetPointer(pBulkBuffer.PayloadBuffer[0].m_Address + 4), pACLHeader->Size); - } - break; + _dbg_assert_(WIIMOTE, pACLHeader->BCFlag == 0); + _dbg_assert_(WIIMOTE, pACLHeader->PBFlag == 2); + + SendToDevice(pACLHeader->ConnectionHandle, Memory::GetPointer(pBulkBuffer.PayloadBuffer[0].m_Address + 4), pACLHeader->Size); + } + break; case ACL_DATA_ENDPOINT: { - if (m_pACLBuffer) - delete m_pACLBuffer; - m_pACLBuffer = new SIOCtlVBuffer(_CommandAddress); + if (m_pACLBuffer) + delete m_pACLBuffer; + m_pACLBuffer = new SIOCtlVBuffer(_CommandAddress); - LOG(USB_HLE_LOG, "ACL_DATA_ENDPOINT: 0x%08x ", _CommandAddress); - return false; + LOG(WIIMOTE, "ACL_DATA_ENDPOINT: 0x%08x ", _CommandAddress); + return false; } break; default: { - _dbg_assert_msg_(USB_HLE_LOG, 0, "Unknown USB_IOCTL_BLKMSG: %x", Command); + _dbg_assert_msg_(WIIMOTE, 0, "Unknown USB_IOCTL_BLKMSG: %x", Command); } break; } @@ -149,18 +150,18 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtlV(u32 _CommandAddress) { case HCI_EVENT_ENDPOINT: { - if (m_pHCIBuffer) - delete m_pHCIBuffer; - m_pHCIBuffer = new SIOCtlVBuffer(_CommandAddress); + if (m_pHCIBuffer) + delete m_pHCIBuffer; + m_pHCIBuffer = new SIOCtlVBuffer(_CommandAddress); - LOG(USB_HLE_LOG, "HCI_EVENT_ENDPOINT: 0x%08x", _CommandAddress); - return false; - } + LOG(WIIMOTE, "HCI_EVENT_ENDPOINT: 0x%08x", _CommandAddress); + return false; + } break; default: { - _dbg_assert_msg_(USB_HLE_LOG, 0, "Unknown USB_IOCTL_INTRMSG: %x", Command); + _dbg_assert_msg_(WIIMOTE, 0, "Unknown USB_IOCTL_INTRMSG: %x", Command); } break; } @@ -169,23 +170,23 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtlV(u32 _CommandAddress) default: { - _dbg_assert_msg_(USB_HLE_LOG, 0, "Unknown CWII_IPC_HLE_Device_usb_oh1_57e_305: %x", CommandBuffer.Parameter); + _dbg_assert_msg_(WIIMOTE, 0, "Unknown CWII_IPC_HLE_Device_usb_oh1_57e_305: %x", CommandBuffer.Parameter); - LOG(USB_HLE_LOG, "%s - IOCtlV:", GetDeviceName().c_str()); - LOG(USB_HLE_LOG, " Parameter: 0x%x", CommandBuffer.Parameter); - LOG(USB_HLE_LOG, " NumberIn: 0x%08x", CommandBuffer.NumberInBuffer); - LOG(USB_HLE_LOG, " NumberOut: 0x%08x", CommandBuffer.NumberPayloadBuffer); - LOG(USB_HLE_LOG, " BufferVector: 0x%08x", CommandBuffer.BufferVector); - LOG(USB_HLE_LOG, " BufferSize: 0x%08x", CommandBuffer.BufferSize); - DumpAsync(CommandBuffer.BufferVector, _CommandAddress, CommandBuffer.NumberInBuffer, CommandBuffer.NumberPayloadBuffer); + LOG(WIIMOTE, "%s - IOCtlV:", GetDeviceName().c_str()); + LOG(WIIMOTE, " Parameter: 0x%x", CommandBuffer.Parameter); + LOG(WIIMOTE, " NumberIn: 0x%08x", CommandBuffer.NumberInBuffer); + LOG(WIIMOTE, " NumberOut: 0x%08x", CommandBuffer.NumberPayloadBuffer); + LOG(WIIMOTE, " BufferVector: 0x%08x", CommandBuffer.BufferVector); + LOG(WIIMOTE, " BufferSize: 0x%08x", CommandBuffer.BufferSize); + DumpAsync(CommandBuffer.BufferVector, _CommandAddress, CommandBuffer.NumberInBuffer, CommandBuffer.NumberPayloadBuffer); } break; } - // write return value - Memory::Write_U32(0, _CommandAddress + 0x4); + // write return value + Memory::Write_U32(0, _CommandAddress + 0x4); - return true; + return true; } extern void SendFrame(CWII_IPC_HLE_Device_usb_oh1_57e_305* _pDevice, u16 _ConnectionHandle, u8* _pData, u32 _Size); @@ -199,91 +200,93 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::SendToDevice(u16 _ConnectionHandle, u8 return; } - pWiiMote->SendACLFrame(_pData, _Size); + pWiiMote->SendACLFrame(_pData, _Size); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::SendACLFrame(u16 _ConnectionHandle, u8* _pData, u32 _Size) { - UACLHeader* pHeader = (UACLHeader*)Memory::GetPointer(m_pACLBuffer->PayloadBuffer[0].m_Address); - pHeader->ConnectionHandle = _ConnectionHandle; - pHeader->BCFlag = 0; - pHeader->PBFlag = 2; - pHeader->Size = _Size; + UACLHeader* pHeader = (UACLHeader*)Memory::GetPointer(m_pACLBuffer->PayloadBuffer[0].m_Address); + pHeader->ConnectionHandle = _ConnectionHandle; + pHeader->BCFlag = 0; + pHeader->PBFlag = 2; + pHeader->Size = _Size; - memcpy(Memory::GetPointer(m_pACLBuffer->PayloadBuffer[0].m_Address + sizeof(UACLHeader)), _pData, _Size); + memcpy(Memory::GetPointer(m_pACLBuffer->PayloadBuffer[0].m_Address + sizeof(UACLHeader)), _pData, _Size); - // return reply buffer size - Memory::Write_U32(sizeof(UACLHeader) + _Size, m_pACLBuffer->m_Address + 0x4); + // return reply buffer size + Memory::Write_U32(sizeof(UACLHeader) + _Size, m_pACLBuffer->m_Address + 0x4); - m_ACLAnswer = true; + m_ACLAnswer = true; } -u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update() -{ +u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update() +{ + LOG(WIIMOTE, "Update() %i 0x%08x", + m_HCICommandMessageQueue.size(), m_pHCIBuffer); // check state machine - if (m_pHCIBuffer) - { - bool ReturnHCIBuffer = false; - switch(m_State) - { - case STATE_NONE: - break; + if (m_pHCIBuffer) + { + bool ReturnHCIBuffer = false; + switch(m_State) + { + case STATE_NONE: + break; - case STATE_INQUIRY_RESPONSE: - SendEventInquiryResponse(); - m_State = STATE_INQUIRY_COMPLETE; - ReturnHCIBuffer = true; - break; + case STATE_INQUIRY_RESPONSE: + SendEventInquiryResponse(); + m_State = STATE_INQUIRY_COMPLETE; + ReturnHCIBuffer = true; + break; - case STATE_INQUIRY_COMPLETE: - SendEventInquiryComplete(); - m_State = STATE_NONE; - ReturnHCIBuffer = true; - break; + case STATE_INQUIRY_COMPLETE: + SendEventInquiryComplete(); + m_State = STATE_NONE; + ReturnHCIBuffer = true; + break; case STATE_REMOTE_NAME_REQ: SendEventRemoteNameReq(); m_State = STATE_NONE; - ReturnHCIBuffer = true; - break; + ReturnHCIBuffer = true; + break; case STATE_CONNECTION_COMPLETE_EVENT: SendEventConnectionComplete(); m_State = STATE_NONE; - ReturnHCIBuffer = true; - break; + ReturnHCIBuffer = true; + break; - case STATE_READ_CLOCK_OFFSET: - SendEventReadClockOffsetComplete(); - m_State = STATE_NONE; - ReturnHCIBuffer = true; - break; + case STATE_READ_CLOCK_OFFSET: + SendEventReadClockOffsetComplete(); + m_State = STATE_NONE; + ReturnHCIBuffer = true; + break; - case STATE_READ_REMOTE_VER_INFO: - SendEventReadRemoteVerInfo(); - m_State = STATE_NONE; - ReturnHCIBuffer = true; - break; + case STATE_READ_REMOTE_VER_INFO: + SendEventReadRemoteVerInfo(); + m_State = STATE_NONE; + ReturnHCIBuffer = true; + break; - case STATE_READ_REMOTE_FEATURES: - SendEventReadRemoteFeatures(); - m_State = STATE_NONE; - ReturnHCIBuffer = true; - break; - - default: - PanicAlert("Unknown State in USBDev"); - break; - } + case STATE_READ_REMOTE_FEATURES: + SendEventReadRemoteFeatures(); + m_State = STATE_NONE; + ReturnHCIBuffer = true; + break; - if (ReturnHCIBuffer) - { - u32 Addr = m_pHCIBuffer->m_Address; - delete m_pHCIBuffer; - m_pHCIBuffer = NULL; - return Addr; - } - } + default: + PanicAlert("Unknown State in USBDev"); + break; + } + + if (ReturnHCIBuffer) + { + u32 Addr = m_pHCIBuffer->m_Address; + delete m_pHCIBuffer; + m_pHCIBuffer = NULL; + return Addr; + } + } // HCI control message/event handling if (!m_HCICommandMessageQueue.empty() && m_pHCIBuffer) @@ -310,23 +313,35 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update() return Addr; } + if(scan_enable && m_pHCIBuffer) { + //by now, the emulatee should be listening for incoming L2CAP packets. + //let's send a few. + SendEventRequestConnection(); + scan_enable = 0; + + u32 Addr = m_pHCIBuffer->m_Address; + delete m_pHCIBuffer; + m_pHCIBuffer = NULL; + return Addr; + } + return 0; } bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventCommandStatus(u16 _Opcode) { - SHCIEventStatus* pHCIEvent = (SHCIEventStatus*)Memory::GetPointer(m_pHCIBuffer->PayloadBuffer[0].m_Address); + SHCIEventStatus* pHCIEvent = (SHCIEventStatus*)Memory::GetPointer(m_pHCIBuffer->PayloadBuffer[0].m_Address); - pHCIEvent->EventType = 0x0F; + pHCIEvent->EventType = 0x0F; pHCIEvent->PayloadLength = 0x4; - pHCIEvent->Status = 0x0; + pHCIEvent->Status = 0x0; pHCIEvent->PacketIndicator = 0x01; pHCIEvent->Opcode = _Opcode; - // return reply buffer size - Memory::Write_U32(sizeof(SHCIEventStatus), m_pHCIBuffer->m_Address + 0x4); + // return reply buffer size + Memory::Write_U32(sizeof(SHCIEventStatus), m_pHCIBuffer->m_Address + 0x4); - return true; + return true; } void CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventCommandComplete(u16 _OpCode, void* _pData, u32 _DataSize) @@ -353,11 +368,11 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventInquiryResponse() if (m_WiiMotes.empty()) return false; - SHCIEventInquiryResult* pInquiryResult = (SHCIEventInquiryResult*)Memory::GetPointer(m_pHCIBuffer->PayloadBuffer[0].m_Address); + SHCIEventInquiryResult* pInquiryResult = (SHCIEventInquiryResult*)Memory::GetPointer(m_pHCIBuffer->PayloadBuffer[0].m_Address); - pInquiryResult->EventType = 0x02; + pInquiryResult->EventType = 0x02; pInquiryResult->PayloadLength = 1 + m_WiiMotes.size() * sizeof(hci_inquiry_response); - pInquiryResult->num_responses = m_WiiMotes.size(); + pInquiryResult->num_responses = m_WiiMotes.size(); for (size_t i=0; ipage_scan_mode = 0; pResponse->clock_offset = 0x3818; - LOG(USB_HLE_LOG, "Event: Send Fake Inquriy of one controller"); - LOG(USB_HLE_LOG, " bd: %02x:%02x:%02x:%02x:%02x:%02x", + LOG(WIIMOTE, "Event: Send Fake Inquriy of one controller"); + LOG(WIIMOTE, " 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]); } - // return reply buffer size - Memory::Write_U32(sizeof(SHCIEventInquiryResult) + sizeof(hci_inquiry_response), m_pHCIBuffer->m_Address + 0x4); + // return reply buffer size + Memory::Write_U32(sizeof(SHCIEventInquiryResult) + sizeof(hci_inquiry_response), m_pHCIBuffer->m_Address + 0x4); - return true; + return true; } bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventInquiryComplete() { - SHCIEventInquiryComplete* pInquiryComplete = (SHCIEventInquiryComplete*)Memory::GetPointer(m_pHCIBuffer->PayloadBuffer[0].m_Address); + SHCIEventInquiryComplete* pInquiryComplete = (SHCIEventInquiryComplete*)Memory::GetPointer(m_pHCIBuffer->PayloadBuffer[0].m_Address); pInquiryComplete->EventType = 0x01; pInquiryComplete->PayloadLength = 0x01; - pInquiryComplete->status = 0x00; + pInquiryComplete->status = 0x00; - // control message has been sent... - Memory::Write_U32(sizeof(SHCIEventInquiryComplete), m_pHCIBuffer->m_Address + 0x4); + // control message has been sent... + Memory::Write_U32(sizeof(SHCIEventInquiryComplete), m_pHCIBuffer->m_Address + 0x4); - LOG(USB_HLE_LOG, "Event: Inquiry complete"); + LOG(WIIMOTE, "Event: Inquiry complete"); - return true; + return true; } bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRemoteNameReq() @@ -424,25 +439,25 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRemoteNameReq() // return reply buffer size Memory::Write_U32(sizeof(SHCIEventRemoteNameReq), m_pHCIBuffer->m_Address + 0x4); - LOG(USB_HLE_LOG, "Event: SendEventRemoteNameReq"); - LOG(USB_HLE_LOG, " bd: %02x:%02x:%02x:%02x:%02x:%02x", + LOG(WIIMOTE, "Event: SendEventRemoteNameReq"); + LOG(WIIMOTE, " 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]); - LOG(USB_HLE_LOG, " remotename: %s", pRemoteNameReq->RemoteName); + LOG(WIIMOTE, " remotename: %s", pRemoteNameReq->RemoteName); return true; } bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRequestConnection() { - PanicAlert("unused"); -/* - SHCIEventRequestConnection* pEventRequestConnection = (SHCIEventRequestConnection*)Memory::GetPointer(m_pHCIBuffer->PayloadBuffer[0].m_Address); + //PanicAlert("unused"); + + SHCIEventRequestConnection* pEventRequestConnection = (SHCIEventRequestConnection*)Memory::GetPointer(m_pHCIBuffer->PayloadBuffer[0].m_Address); pEventRequestConnection->EventType = 0x04; pEventRequestConnection->PayloadLength = 13; - pEventRequestConnection->bdaddr = XXXXX; // BD_ADDR of the device that requests the connection + pEventRequestConnection->bdaddr = m_WiiMotes[0].GetBD(); // BD_ADDR of the device that requests the connection pEventRequestConnection->uclass[0] = 0x04; // thanks to shagkur pEventRequestConnection->uclass[1] = 0x25; pEventRequestConnection->uclass[2] = 0x00; @@ -451,15 +466,15 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRequestConnection() // return reply buffer size Memory::Write_U32(sizeof(SHCIEventRequestConnection), m_pHCIBuffer->m_Address + 0x4); - LOG(USB_HLE_LOG, "Event: SendEventRequestConnection"); - LOG(USB_HLE_LOG, " bd: %02x:%02x:%02x:%02x:%02x:%02x", + LOG(WIIMOTE, "Event: SendEventRequestConnection"); + LOG(WIIMOTE, " 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]); - LOG(USB_HLE_LOG, " COD[0]: 0x%02x", pEventRequestConnection->uclass[0]); - LOG(USB_HLE_LOG, " COD[1]: 0x%02x", pEventRequestConnection->uclass[1]); - LOG(USB_HLE_LOG, " COD[2]: 0x%02x", pEventRequestConnection->uclass[2]); - LOG(USB_HLE_LOG, " LinkType: %i", pEventRequestConnection->LinkType); -*/ + LOG(WIIMOTE, " COD[0]: 0x%02x", pEventRequestConnection->uclass[0]); + LOG(WIIMOTE, " COD[1]: 0x%02x", pEventRequestConnection->uclass[1]); + LOG(WIIMOTE, " COD[2]: 0x%02x", pEventRequestConnection->uclass[2]); + LOG(WIIMOTE, " LinkType: %i", pEventRequestConnection->LinkType); + return true; }; @@ -488,13 +503,13 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventConnectionComplete() // return reply buffer size Memory::Write_U32(sizeof(SHCIEventConnectionComplete), m_pHCIBuffer->m_Address + 0x4); - LOG(USB_HLE_LOG, "Event: SendEventConnectionComplete"); - LOG(USB_HLE_LOG, " Connection_Handle: 0x%04x", pConnectionComplete->Connection_Handle); - LOG(USB_HLE_LOG, " bd: %02x:%02x:%02x:%02x:%02x:%02x", + LOG(WIIMOTE, "Event: SendEventConnectionComplete"); + LOG(WIIMOTE, " Connection_Handle: 0x%04x", pConnectionComplete->Connection_Handle); + LOG(WIIMOTE, " 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]); - LOG(USB_HLE_LOG, " LinkType: %i", pConnectionComplete->LinkType); - LOG(USB_HLE_LOG, " EncryptionEnabled: %i", pConnectionComplete->EncryptionEnabled); + LOG(WIIMOTE, " LinkType: %i", pConnectionComplete->LinkType); + LOG(WIIMOTE, " EncryptionEnabled: %i", pConnectionComplete->EncryptionEnabled); return true; } @@ -509,21 +524,21 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadClockOffsetComplete() } m_StateTempConnectionHandle = 0; - SHCIEventReadClockOffsetComplete* pReadClockOffsetComplete = (SHCIEventReadClockOffsetComplete*)Memory::GetPointer(m_pHCIBuffer->PayloadBuffer[0].m_Address); - pReadClockOffsetComplete->EventType = 0x1C; - pReadClockOffsetComplete->PayloadLength = 0x05; - pReadClockOffsetComplete->status = 0x00; - pReadClockOffsetComplete->ConnectionHandle = pWiiMote->GetConnectionHandle(); - pReadClockOffsetComplete->ClockOffset = 0x3818; + SHCIEventReadClockOffsetComplete* pReadClockOffsetComplete = (SHCIEventReadClockOffsetComplete*)Memory::GetPointer(m_pHCIBuffer->PayloadBuffer[0].m_Address); + pReadClockOffsetComplete->EventType = 0x1C; + pReadClockOffsetComplete->PayloadLength = 0x05; + pReadClockOffsetComplete->status = 0x00; + pReadClockOffsetComplete->ConnectionHandle = pWiiMote->GetConnectionHandle(); + pReadClockOffsetComplete->ClockOffset = 0x3818; - // return reply buffer size - Memory::Write_U32(sizeof(SHCIEventReadClockOffsetComplete), m_pHCIBuffer->m_Address + 0x4); + // return reply buffer size + Memory::Write_U32(sizeof(SHCIEventReadClockOffsetComplete), m_pHCIBuffer->m_Address + 0x4); - LOG(USB_HLE_LOG, "Event: SendEventConnectionComplete"); - LOG(USB_HLE_LOG, " Connection_Handle: 0x%04x", pReadClockOffsetComplete->ConnectionHandle); - LOG(USB_HLE_LOG, " ClockOffset: 0x%04x", pReadClockOffsetComplete->ClockOffset); + LOG(WIIMOTE, "Event: SendEventConnectionComplete"); + LOG(WIIMOTE, " Connection_Handle: 0x%04x", pReadClockOffsetComplete->ConnectionHandle); + LOG(WIIMOTE, " ClockOffset: 0x%04x", pReadClockOffsetComplete->ClockOffset); - return true; + return true; } bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadRemoteVerInfo() @@ -536,25 +551,25 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadRemoteVerInfo() } m_StateTempConnectionHandle = 0; - SHCIEventReadRemoteVerInfo* pReadRemoteVerInfo = (SHCIEventReadRemoteVerInfo*)Memory::GetPointer(m_pHCIBuffer->PayloadBuffer[0].m_Address); - pReadRemoteVerInfo->EventType = 0x0C; - pReadRemoteVerInfo->PayloadLength = 0x05; - pReadRemoteVerInfo->status = 0x00; - pReadRemoteVerInfo->ConnectionHandle = pWiiMote->GetConnectionHandle(); - pReadRemoteVerInfo->lmp_version = 0x2; - pReadRemoteVerInfo->manufacturer = 0x000F; - pReadRemoteVerInfo->lmp_subversion = 0x229; + SHCIEventReadRemoteVerInfo* pReadRemoteVerInfo = (SHCIEventReadRemoteVerInfo*)Memory::GetPointer(m_pHCIBuffer->PayloadBuffer[0].m_Address); + pReadRemoteVerInfo->EventType = 0x0C; + pReadRemoteVerInfo->PayloadLength = 0x05; + pReadRemoteVerInfo->status = 0x00; + pReadRemoteVerInfo->ConnectionHandle = pWiiMote->GetConnectionHandle(); + pReadRemoteVerInfo->lmp_version = 0x2; + pReadRemoteVerInfo->manufacturer = 0x000F; + pReadRemoteVerInfo->lmp_subversion = 0x229; - // control message has been sent... - Memory::Write_U32(sizeof(SHCIEventReadRemoteVerInfo), m_pHCIBuffer->m_Address + 0x4); + // control message has been sent... + Memory::Write_U32(sizeof(SHCIEventReadRemoteVerInfo), m_pHCIBuffer->m_Address + 0x4); - LOG(USB_HLE_LOG, "Event: SendEventReadReadRemoteVerInfo"); - LOG(USB_HLE_LOG, " Connection_Handle: 0x%04x", pReadRemoteVerInfo->ConnectionHandle); - LOG(USB_HLE_LOG, " lmp_version: 0x%02x", pReadRemoteVerInfo->lmp_version); - LOG(USB_HLE_LOG, " manufacturer: 0x%04x", pReadRemoteVerInfo->manufacturer); - LOG(USB_HLE_LOG, " lmp_subversion: 0x%04x", pReadRemoteVerInfo->lmp_subversion); + LOG(WIIMOTE, "Event: SendEventReadReadRemoteVerInfo"); + LOG(WIIMOTE, " Connection_Handle: 0x%04x", pReadRemoteVerInfo->ConnectionHandle); + LOG(WIIMOTE, " lmp_version: 0x%02x", pReadRemoteVerInfo->lmp_version); + LOG(WIIMOTE, " manufacturer: 0x%04x", pReadRemoteVerInfo->manufacturer); + LOG(WIIMOTE, " lmp_subversion: 0x%04x", pReadRemoteVerInfo->lmp_subversion); - return true; + return true; } bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadRemoteFeatures() @@ -567,125 +582,127 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadRemoteFeatures() } m_StateTempConnectionHandle = 0; - SHCIEventReadRemoteFeatures* pReadRemoteFeatures = (SHCIEventReadRemoteFeatures*)Memory::GetPointer(m_pHCIBuffer->PayloadBuffer[0].m_Address); - pReadRemoteFeatures->EventType = 0x0C; - pReadRemoteFeatures->PayloadLength = 11; - pReadRemoteFeatures->status = 0x00; - pReadRemoteFeatures->ConnectionHandle = pWiiMote->GetConnectionHandle(); - pReadRemoteFeatures->features[0] = pWiiMote->GetFeatures()[0]; - pReadRemoteFeatures->features[1] = pWiiMote->GetFeatures()[1]; - pReadRemoteFeatures->features[2] = pWiiMote->GetFeatures()[2]; - pReadRemoteFeatures->features[3] = pWiiMote->GetFeatures()[3]; - pReadRemoteFeatures->features[4] = pWiiMote->GetFeatures()[4]; - pReadRemoteFeatures->features[5] = pWiiMote->GetFeatures()[5]; - pReadRemoteFeatures->features[6] = pWiiMote->GetFeatures()[6]; - pReadRemoteFeatures->features[7] = pWiiMote->GetFeatures()[7]; + SHCIEventReadRemoteFeatures* pReadRemoteFeatures = (SHCIEventReadRemoteFeatures*)Memory::GetPointer(m_pHCIBuffer->PayloadBuffer[0].m_Address); + pReadRemoteFeatures->EventType = 0x0C; + pReadRemoteFeatures->PayloadLength = 11; + pReadRemoteFeatures->status = 0x00; + pReadRemoteFeatures->ConnectionHandle = pWiiMote->GetConnectionHandle(); + pReadRemoteFeatures->features[0] = pWiiMote->GetFeatures()[0]; + pReadRemoteFeatures->features[1] = pWiiMote->GetFeatures()[1]; + pReadRemoteFeatures->features[2] = pWiiMote->GetFeatures()[2]; + pReadRemoteFeatures->features[3] = pWiiMote->GetFeatures()[3]; + pReadRemoteFeatures->features[4] = pWiiMote->GetFeatures()[4]; + pReadRemoteFeatures->features[5] = pWiiMote->GetFeatures()[5]; + pReadRemoteFeatures->features[6] = pWiiMote->GetFeatures()[6]; + pReadRemoteFeatures->features[7] = pWiiMote->GetFeatures()[7]; - // control message has been sent... - Memory::Write_U32(sizeof(SHCIEventReadRemoteFeatures), m_pHCIBuffer->m_Address + 0x4); + // control message has been sent... + Memory::Write_U32(sizeof(SHCIEventReadRemoteFeatures), m_pHCIBuffer->m_Address + 0x4); - LOG(USB_HLE_LOG, "Event: SendEventReadReadRemoteVerInfo"); - LOG(USB_HLE_LOG, " Connection_Handle: 0x%04x", pReadRemoteFeatures->ConnectionHandle); - LOG(USB_HLE_LOG, " 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]); + LOG(WIIMOTE, "Event: SendEventReadReadRemoteVerInfo"); + LOG(WIIMOTE, " Connection_Handle: 0x%04x", pReadRemoteFeatures->ConnectionHandle); + LOG(WIIMOTE, " 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]); - return true; + return true; } void CWII_IPC_HLE_Device_usb_oh1_57e_305::ExecuteHCICommandMessage(const SHCICommandMessage& _rHCICommandMessage) { - u8* pInput = Memory::GetPointer(_rHCICommandMessage.m_PayLoadAddr + 3); - SCommandMessage* pMsg = (SCommandMessage*)Memory::GetPointer(_rHCICommandMessage.m_PayLoadAddr); + u8* pInput = Memory::GetPointer(_rHCICommandMessage.m_PayLoadAddr + 3); + SCommandMessage* pMsg = (SCommandMessage*)Memory::GetPointer(_rHCICommandMessage.m_PayLoadAddr); - switch(pMsg->Opcode) - { - // - // --- read commandos --- - // - case HCI_CMD_RESET: - CommandReset(pInput); - break; + LOG(WIIMOTE, "ExecuteHCICommandMessage(0x%04x)", pMsg->Opcode); - case HCI_CMD_READ_BUFFER_SIZE: - CommandReadBufferSize(pInput); - break; + switch(pMsg->Opcode) + { + // + // --- read commandos --- + // + case HCI_CMD_RESET: + CommandReset(pInput); + break; - case HCI_CMD_READ_LOCAL_VER: - CommandReadLocalVer(pInput); - break; + case HCI_CMD_READ_BUFFER_SIZE: + CommandReadBufferSize(pInput); + break; - case HCI_CMD_READ_BDADDR: - CommandReadBDAdrr(pInput); - break; + case HCI_CMD_READ_LOCAL_VER: + CommandReadLocalVer(pInput); + break; - case HCI_CMD_READ_LOCAL_FEATURES: - CommandReadLocalFeatures(pInput); - break; + case HCI_CMD_READ_BDADDR: + CommandReadBDAdrr(pInput); + break; - case HCI_CMD_READ_STORED_LINK_KEY: - CommandReadStoredLinkKey(pInput); - break; + case HCI_CMD_READ_LOCAL_FEATURES: + CommandReadLocalFeatures(pInput); + break; - case HCI_CMD_WRITE_UNIT_CLASS: - CommandWriteUnitClass(pInput); - break; + case HCI_CMD_READ_STORED_LINK_KEY: + CommandReadStoredLinkKey(pInput); + break; - case HCI_CMD_WRITE_LOCAL_NAME: - CommandWriteLocalName(pInput); - break; + case HCI_CMD_WRITE_UNIT_CLASS: + CommandWriteUnitClass(pInput); + break; - case HCI_CMD_WRITE_PIN_TYPE: - CommandWritePinType(pInput); - break; + case HCI_CMD_WRITE_LOCAL_NAME: + CommandWriteLocalName(pInput); + break; - case HCI_CMD_HOST_BUFFER_SIZE: - CommandHostBufferSize(pInput); - break; + case HCI_CMD_WRITE_PIN_TYPE: + CommandWritePinType(pInput); + break; - case HCI_CMD_WRITE_PAGE_TIMEOUT: - CommandWritePageTimeOut(pInput); - break; + case HCI_CMD_HOST_BUFFER_SIZE: + CommandHostBufferSize(pInput); + break; - case HCI_CMD_WRITE_SCAN_ENABLE: - CommandWriteScanEnable(pInput); - break; + case HCI_CMD_WRITE_PAGE_TIMEOUT: + CommandWritePageTimeOut(pInput); + break; - case HCI_CMD_WRITE_INQUIRY_MODE: - CommandWriteInquiryMode(pInput); - break; + case HCI_CMD_WRITE_SCAN_ENABLE: + CommandWriteScanEnable(pInput); + break; - case HCI_CMD_WRITE_PAGE_SCAN_TYPE: - CommandWritePageScanType(pInput); - break; + case HCI_CMD_WRITE_INQUIRY_MODE: + CommandWriteInquiryMode(pInput); + break; - case HCI_CMD_SET_EVENT_FILTER: - CommandSetEventFilter(pInput); - break; + case HCI_CMD_WRITE_PAGE_SCAN_TYPE: + CommandWritePageScanType(pInput); + break; - case HCI_CMD_INQUIRY: - CommandInquiry(pInput); - break; + case HCI_CMD_SET_EVENT_FILTER: + CommandSetEventFilter(pInput); + break; - case HCI_CMD_WRITE_INQUIRY_SCAN_TYPE: - CommandWriteInquiryScanType(pInput); - break; + case HCI_CMD_INQUIRY: + CommandInquiry(pInput); + break; - // vendor specific... - case 0xFC4C: - CommandVendorSpecific_FC4C(pInput, _rHCICommandMessage.m_PayLoadSize - 3); - break; + case HCI_CMD_WRITE_INQUIRY_SCAN_TYPE: + CommandWriteInquiryScanType(pInput); + break; - case 0xFC4F: - CommandVendorSpecific_FC4F(pInput, _rHCICommandMessage.m_PayLoadSize - 3); - break; + // vendor specific... + case 0xFC4C: + CommandVendorSpecific_FC4C(pInput, _rHCICommandMessage.m_PayLoadSize - 3); + break; - case HCI_CMD_INQUIRY_CANCEL: - CommandInquiryCancel(pInput); - break; + case 0xFC4F: + CommandVendorSpecific_FC4F(pInput, _rHCICommandMessage.m_PayLoadSize - 3); + break; + + case HCI_CMD_INQUIRY_CANCEL: + CommandInquiryCancel(pInput); + break; case HCI_CMD_REMOTE_NAME_REQ: CommandRemoteNameReq(pInput); @@ -699,128 +716,128 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::ExecuteHCICommandMessage(const SHCICom CommandAcceptCon(pInput); break; - case HCI_CMD_READ_CLOCK_OFFSET: - CommandReadClockOffset(pInput); - break; - - case HCI_CMD_READ_REMOTE_VER_INFO: - CommandReadRemoteVerInfo(pInput); - break; + case HCI_CMD_READ_CLOCK_OFFSET: + CommandReadClockOffset(pInput); + break; - case HCI_CMD_READ_REMOTE_FEATURES: - CommandReadRemoteFeatures(pInput); - break; + case HCI_CMD_READ_REMOTE_VER_INFO: + CommandReadRemoteVerInfo(pInput); + break; - // - // --- default --- - // - default: + case HCI_CMD_READ_REMOTE_FEATURES: + CommandReadRemoteFeatures(pInput); + break; + + // + // --- default --- + // + default: { #ifdef LOGGING u16 ocf = HCI_OCF(pMsg->Opcode); u16 ogf = HCI_OGF(pMsg->Opcode); #endif - _dbg_assert_msg_(USB_HLE_LOG, 0, "Unknown USB_IOCTL_CTRLMSG: 0x%04X (ocf: 0x%x ogf 0x%x)", pMsg->Opcode, ocf, ogf); + _dbg_assert_msg_(WIIMOTE, 0, "Unknown USB_IOCTL_CTRLMSG: 0x%04X (ocf: 0x%x ogf 0x%x)", pMsg->Opcode, ocf, ogf); // send fake all is okay msg... SendEventCommandComplete(pMsg->Opcode, NULL, 0); } - break; - } + break; + } } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReset(u8* _Input) { // reply - hci_status_rp Reply; - Reply.status = 0x00; + hci_status_rp Reply; + Reply.status = 0x00; SendEventCommandComplete(HCI_CMD_RESET, &Reply, sizeof(hci_status_rp)); - LOG(USB_HLE_LOG, "Command: HCI_CMD_RESET"); + LOG(WIIMOTE, "Command: HCI_CMD_RESET"); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadBufferSize(u8* _Input) { // reply - hci_read_buffer_size_rp Reply; - Reply.status = 0x00; - Reply.max_acl_size = 339; - Reply.num_acl_pkts = 10; - Reply.max_sco_size = 64; - Reply.num_sco_pkts = 0; + hci_read_buffer_size_rp Reply; + Reply.status = 0x00; + Reply.max_acl_size = 339; + Reply.num_acl_pkts = 10; + Reply.max_sco_size = 64; + Reply.num_sco_pkts = 0; SendEventCommandComplete(HCI_CMD_READ_BUFFER_SIZE, &Reply, sizeof(hci_read_buffer_size_rp)); - LOG(USB_HLE_LOG, "Command: HCI_CMD_READ_BUFFER_SIZE:"); - LOG(USB_HLE_LOG, "return:"); - LOG(USB_HLE_LOG, " max_acl_size: %i", Reply.max_acl_size); - LOG(USB_HLE_LOG, " num_acl_pkts: %i", Reply.num_acl_pkts); - LOG(USB_HLE_LOG, " max_sco_size: %i", Reply.max_sco_size); - LOG(USB_HLE_LOG, " num_sco_pkts: %i", Reply.num_sco_pkts); + LOG(WIIMOTE, "Command: HCI_CMD_READ_BUFFER_SIZE:"); + LOG(WIIMOTE, "return:"); + LOG(WIIMOTE, " max_acl_size: %i", Reply.max_acl_size); + LOG(WIIMOTE, " num_acl_pkts: %i", Reply.num_acl_pkts); + LOG(WIIMOTE, " max_sco_size: %i", Reply.max_sco_size); + LOG(WIIMOTE, " num_sco_pkts: %i", Reply.num_sco_pkts); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadLocalVer(u8* _Input) { // reply - hci_read_local_ver_rp Reply; - Reply.status = 0x00; - Reply.hci_version = 0x03; // HCI version: 1.1 - Reply.hci_revision = 0x40a7; // current revision (?) - Reply.lmp_version = 0x03; // LMP version: 1.1 - Reply.manufacturer = 0x000F; // manufacturer: reserved for tests - Reply.lmp_subversion = 0x430e; // LMP subversion + hci_read_local_ver_rp Reply; + Reply.status = 0x00; + Reply.hci_version = 0x03; // HCI version: 1.1 + Reply.hci_revision = 0x40a7; // current revision (?) + Reply.lmp_version = 0x03; // LMP version: 1.1 + Reply.manufacturer = 0x000F; // manufacturer: reserved for tests + Reply.lmp_subversion = 0x430e; // LMP subversion SendEventCommandComplete(HCI_CMD_READ_LOCAL_VER, &Reply, sizeof(hci_read_local_ver_rp)); - LOG(USB_HLE_LOG, "Command: HCI_CMD_READ_LOCAL_VER:"); - LOG(USB_HLE_LOG, "return:"); - LOG(USB_HLE_LOG, " status: %i", Reply.status); - LOG(USB_HLE_LOG, " hci_revision: %i", Reply.hci_revision); - LOG(USB_HLE_LOG, " lmp_version: %i", Reply.lmp_version); - LOG(USB_HLE_LOG, " manufacturer: %i", Reply.manufacturer); - LOG(USB_HLE_LOG, " lmp_subversion: %i", Reply.lmp_subversion); + LOG(WIIMOTE, "Command: HCI_CMD_READ_LOCAL_VER:"); + LOG(WIIMOTE, "return:"); + LOG(WIIMOTE, " status: %i", Reply.status); + LOG(WIIMOTE, " hci_revision: %i", Reply.hci_revision); + LOG(WIIMOTE, " lmp_version: %i", Reply.lmp_version); + LOG(WIIMOTE, " manufacturer: %i", Reply.manufacturer); + LOG(WIIMOTE, " lmp_subversion: %i", Reply.lmp_subversion); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadBDAdrr(u8* _Input) { // reply - hci_read_bdaddr_rp Reply; - Reply.status = 0x00; - Reply.bdaddr = m_ControllerBD; - + hci_read_bdaddr_rp Reply; + Reply.status = 0x00; + Reply.bdaddr = m_ControllerBD; + SendEventCommandComplete(HCI_CMD_READ_BDADDR, &Reply, sizeof(hci_read_bdaddr_rp)); - LOG(USB_HLE_LOG, "Command: HCI_CMD_READ_BDADDR:"); - LOG(USB_HLE_LOG, "return:"); - LOG(USB_HLE_LOG, " 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]); + LOG(WIIMOTE, "Command: HCI_CMD_READ_BDADDR:"); + LOG(WIIMOTE, "return:"); + LOG(WIIMOTE, " 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]); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadLocalFeatures(u8* _Input) { // reply - hci_read_local_features_rp Reply; - Reply.status = 0x00; - Reply.features[0] = 0xFF; - Reply.features[1] = 0xFF; - Reply.features[2] = 0x8D; - Reply.features[3] = 0xFE; - Reply.features[4] = 0x9B; - Reply.features[5] = 0xF9; - Reply.features[6] = 0x00; - Reply.features[7] = 0x80; + hci_read_local_features_rp Reply; + Reply.status = 0x00; + Reply.features[0] = 0xFF; + Reply.features[1] = 0xFF; + Reply.features[2] = 0x8D; + Reply.features[3] = 0xFE; + Reply.features[4] = 0x9B; + Reply.features[5] = 0xF9; + Reply.features[6] = 0x00; + Reply.features[7] = 0x80; SendEventCommandComplete(HCI_CMD_READ_LOCAL_FEATURES, &Reply, sizeof(hci_read_local_features_rp)); - LOG(USB_HLE_LOG, "Command: HCI_CMD_READ_LOCAL_FEATURES:"); - LOG(USB_HLE_LOG, "return:"); - LOG(USB_HLE_LOG, " 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]); + LOG(WIIMOTE, "Command: HCI_CMD_READ_LOCAL_FEATURES:"); + LOG(WIIMOTE, "return:"); + LOG(WIIMOTE, " 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]); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadStoredLinkKey(u8* _Input) @@ -830,97 +847,97 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadStoredLinkKey(u8* _Input) hci_read_stored_link_key_cp* ReadStoredLinkKey = (hci_read_stored_link_key_cp*)_Input; #endif // reply - hci_read_stored_link_key_rp Reply; - Reply.status = 0x00; + hci_read_stored_link_key_rp Reply; + Reply.status = 0x00; SendEventCommandComplete(HCI_CMD_READ_STORED_LINK_KEY, &Reply, sizeof(hci_read_stored_link_key_rp)); - LOG(USB_HLE_LOG, "Command: HCI_CMD_READ_STORED_LINK_KEY:"); - LOG(USB_HLE_LOG, "input:"); - LOG(USB_HLE_LOG, " 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]); - LOG(USB_HLE_LOG, " read_all_ %i", ReadStoredLinkKey->read_all); - LOG(USB_HLE_LOG, "return:"); - LOG(USB_HLE_LOG, " no idea what i should answer :)"); + LOG(WIIMOTE, "Command: HCI_CMD_READ_STORED_LINK_KEY:"); + LOG(WIIMOTE, "input:"); + LOG(WIIMOTE, " 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]); + LOG(WIIMOTE, " read_all_ %i", ReadStoredLinkKey->read_all); + LOG(WIIMOTE, "return:"); + LOG(WIIMOTE, " no idea what i should answer :)"); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteUnitClass(u8* _Input) { - // command parameters - hci_write_unit_class_cp* pWriteUnitClass = (hci_write_unit_class_cp*)_Input; - m_ClassOfDevice[0] = pWriteUnitClass->uclass[0]; - m_ClassOfDevice[1] = pWriteUnitClass->uclass[1]; - m_ClassOfDevice[2] = pWriteUnitClass->uclass[2]; + // command parameters + hci_write_unit_class_cp* pWriteUnitClass = (hci_write_unit_class_cp*)_Input; + m_ClassOfDevice[0] = pWriteUnitClass->uclass[0]; + m_ClassOfDevice[1] = pWriteUnitClass->uclass[1]; + m_ClassOfDevice[2] = pWriteUnitClass->uclass[2]; - // reply - hci_write_unit_class_rp Reply; - Reply.status = 0x00; + // reply + hci_write_unit_class_rp Reply; + Reply.status = 0x00; SendEventCommandComplete(HCI_CMD_WRITE_UNIT_CLASS, &Reply, sizeof(hci_write_unit_class_rp)); - LOG(USB_HLE_LOG, "Command: HCI_CMD_WRITE_UNIT_CLASS:"); - LOG(USB_HLE_LOG, "write:"); - LOG(USB_HLE_LOG, " COD[0]: 0x%02x", pWriteUnitClass->uclass[0]); - LOG(USB_HLE_LOG, " COD[1]: 0x%02x", pWriteUnitClass->uclass[1]); - LOG(USB_HLE_LOG, " COD[2]: 0x%02x", pWriteUnitClass->uclass[2]); + LOG(WIIMOTE, "Command: HCI_CMD_WRITE_UNIT_CLASS:"); + LOG(WIIMOTE, "write:"); + LOG(WIIMOTE, " COD[0]: 0x%02x", pWriteUnitClass->uclass[0]); + LOG(WIIMOTE, " COD[1]: 0x%02x", pWriteUnitClass->uclass[1]); + LOG(WIIMOTE, " COD[2]: 0x%02x", pWriteUnitClass->uclass[2]); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteLocalName(u8* _Input) { - // command parameters - hci_write_local_name_cp* pWriteLocalName = (hci_write_local_name_cp*)_Input; - memcpy(m_LocalName, pWriteLocalName->name, HCI_UNIT_NAME_SIZE); + // command parameters + hci_write_local_name_cp* pWriteLocalName = (hci_write_local_name_cp*)_Input; + memcpy(m_LocalName, pWriteLocalName->name, HCI_UNIT_NAME_SIZE); - // reply - hci_write_local_name_rp Reply; - Reply.status = 0x00; + // reply + hci_write_local_name_rp Reply; + Reply.status = 0x00; SendEventCommandComplete(HCI_CMD_WRITE_LOCAL_NAME, &Reply, sizeof(hci_write_local_name_rp)); - LOG(USB_HLE_LOG, "Command: HCI_CMD_WRITE_LOCAL_NAME:"); - LOG(USB_HLE_LOG, "write:"); - LOG(USB_HLE_LOG, " local_name: %s", pWriteLocalName->name); + LOG(WIIMOTE, "Command: HCI_CMD_WRITE_LOCAL_NAME:"); + LOG(WIIMOTE, "write:"); + LOG(WIIMOTE, " local_name: %s", pWriteLocalName->name); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWritePinType(u8* _Input) { - // command parameters - hci_write_pin_type_cp* pWritePinType = (hci_write_pin_type_cp*)_Input; - m_PINType = pWritePinType->pin_type; + // command parameters + hci_write_pin_type_cp* pWritePinType = (hci_write_pin_type_cp*)_Input; + m_PINType = pWritePinType->pin_type; - // reply - hci_write_pin_type_rp Reply; - Reply.status = 0x00; + // reply + hci_write_pin_type_rp Reply; + Reply.status = 0x00; SendEventCommandComplete(HCI_CMD_WRITE_PIN_TYPE, &Reply, sizeof(hci_write_pin_type_rp)); - LOG(USB_HLE_LOG, "Command: HCI_CMD_WRITE_PIN_TYPE:"); - LOG(USB_HLE_LOG, "write:"); - LOG(USB_HLE_LOG, " pin_type: %x", pWritePinType->pin_type); + LOG(WIIMOTE, "Command: HCI_CMD_WRITE_PIN_TYPE:"); + LOG(WIIMOTE, "write:"); + LOG(WIIMOTE, " pin_type: %x", pWritePinType->pin_type); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandHostBufferSize(u8* _Input) { - // command parameters - hci_host_buffer_size_cp* pHostBufferSize = (hci_host_buffer_size_cp*)_Input; - Host_max_acl_size = pHostBufferSize->max_acl_size; - Host_max_sco_size = pHostBufferSize->max_sco_size; - Host_num_acl_pkts = pHostBufferSize->num_acl_pkts; - Host_num_sco_pkts = pHostBufferSize->num_sco_pkts; + // command parameters + hci_host_buffer_size_cp* pHostBufferSize = (hci_host_buffer_size_cp*)_Input; + Host_max_acl_size = pHostBufferSize->max_acl_size; + Host_max_sco_size = pHostBufferSize->max_sco_size; + Host_num_acl_pkts = pHostBufferSize->num_acl_pkts; + Host_num_sco_pkts = pHostBufferSize->num_sco_pkts; - // reply - hci_host_buffer_size_rp Reply; - Reply.status = 0x00; + // reply + hci_host_buffer_size_rp Reply; + Reply.status = 0x00; SendEventCommandComplete(HCI_CMD_HOST_BUFFER_SIZE, &Reply, sizeof(hci_host_buffer_size_rp)); - LOG(USB_HLE_LOG, "Command: HCI_CMD_HOST_BUFFER_SIZE:"); - LOG(USB_HLE_LOG, "write:"); - LOG(USB_HLE_LOG, " max_acl_size: %i", pHostBufferSize->max_acl_size); - LOG(USB_HLE_LOG, " max_sco_size: %i", pHostBufferSize->max_sco_size); - LOG(USB_HLE_LOG, " num_acl_pkts: %i", pHostBufferSize->num_acl_pkts); - LOG(USB_HLE_LOG, " num_sco_pkts: %i", pHostBufferSize->num_sco_pkts); + LOG(WIIMOTE, "Command: HCI_CMD_HOST_BUFFER_SIZE:"); + LOG(WIIMOTE, "write:"); + LOG(WIIMOTE, " max_acl_size: %i", pHostBufferSize->max_acl_size); + LOG(WIIMOTE, " max_sco_size: %i", pHostBufferSize->max_sco_size); + LOG(WIIMOTE, " num_acl_pkts: %i", pHostBufferSize->num_acl_pkts); + LOG(WIIMOTE, " num_sco_pkts: %i", pHostBufferSize->num_sco_pkts); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWritePageTimeOut(u8* _Input) @@ -930,68 +947,69 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWritePageTimeOut(u8* _Input) hci_write_page_timeout_cp* pWritePageTimeOut = (hci_write_page_timeout_cp*)_Input; #endif - // reply - hci_host_buffer_size_rp Reply; - Reply.status = 0x00; + // reply + hci_host_buffer_size_rp Reply; + Reply.status = 0x00; SendEventCommandComplete(HCI_CMD_WRITE_PAGE_TIMEOUT, &Reply, sizeof(hci_host_buffer_size_rp)); - LOG(USB_HLE_LOG, "Command: HCI_CMD_WRITE_PAGE_TIMEOUT:"); - LOG(USB_HLE_LOG, "write:"); - LOG(USB_HLE_LOG, " timeout: %i", pWritePageTimeOut->timeout); + LOG(WIIMOTE, "Command: HCI_CMD_WRITE_PAGE_TIMEOUT:"); + LOG(WIIMOTE, "write:"); + LOG(WIIMOTE, " timeout: %i", pWritePageTimeOut->timeout); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteScanEnable(u8* _Input) { - // command parameters - hci_write_scan_enable_cp* pWriteScanEnable = (hci_write_scan_enable_cp*)_Input; - scan_enable = pWriteScanEnable->scan_enable; + // command parameters + hci_write_scan_enable_cp* pWriteScanEnable = (hci_write_scan_enable_cp*)_Input; + scan_enable = pWriteScanEnable->scan_enable; - // reply - hci_write_scan_enable_rp Reply; - Reply.status = 0x00; + // reply + hci_write_scan_enable_rp Reply; + Reply.status = 0x00; SendEventCommandComplete(HCI_CMD_WRITE_SCAN_ENABLE, &Reply, sizeof(hci_write_scan_enable_rp)); #ifdef LOGGING - static char Scanning[][128] = - { - { "HCI_NO_SCAN_ENABLE"}, - { "HCI_INQUIRY_SCAN_ENABLE"}, - { "HCI_PAGE_SCAN_ENABLE"}, - { "HCI_INQUIRY_AND_PAGE_SCAN_ENABLE"}, - }; + static char Scanning[][128] = + { + { "HCI_NO_SCAN_ENABLE"}, + { "HCI_INQUIRY_SCAN_ENABLE"}, + { "HCI_PAGE_SCAN_ENABLE"}, + { "HCI_INQUIRY_AND_PAGE_SCAN_ENABLE"}, + }; #endif - LOG(USB_HLE_LOG, "Command: HCI_CMD_WRITE_SCAN_ENABLE:"); - LOG(USB_HLE_LOG, "write:"); - LOG(USB_HLE_LOG, " scan_enable: %s", Scanning[pWriteScanEnable->scan_enable]); + LOG(WIIMOTE, "Command: HCI_CMD_WRITE_SCAN_ENABLE:"); + LOG(WIIMOTE, "write:"); + LOG(WIIMOTE, " scan_enable: %s", Scanning[pWriteScanEnable->scan_enable]); + } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteInquiryMode(u8* _Input) { #ifdef LOGGING - // command parameters + // command parameters hci_write_inquiry_mode_cp* pInquiryMode = (hci_write_inquiry_mode_cp*)_Input; #endif - // reply - hci_write_inquiry_mode_rp Reply; - Reply.status = 0x00; + // reply + hci_write_inquiry_mode_rp Reply; + Reply.status = 0x00; SendEventCommandComplete(HCI_CMD_WRITE_INQUIRY_MODE, &Reply, sizeof(hci_write_inquiry_mode_rp)); #ifdef LOGGING - static char InquiryMode[][128] = - { - { "Standard Inquiry Result event format (default)" }, - { "Inquiry Result format with RSSI" }, - { "Inquiry Result with RSSI format or Extended Inquiry Result format" } - }; + static char InquiryMode[][128] = + { + { "Standard Inquiry Result event format (default)" }, + { "Inquiry Result format with RSSI" }, + { "Inquiry Result with RSSI format or Extended Inquiry Result format" } + }; #endif - LOG(USB_HLE_LOG, "Command: HCI_CMD_WRITE_INQUIRY_MODE:"); - LOG(USB_HLE_LOG, "write:"); - LOG(USB_HLE_LOG, " mode: %s", InquiryMode[pInquiryMode->mode]); + LOG(WIIMOTE, "Command: HCI_CMD_WRITE_INQUIRY_MODE:"); + LOG(WIIMOTE, "write:"); + LOG(WIIMOTE, " mode: %s", InquiryMode[pInquiryMode->mode]); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWritePageScanType(u8* _Input) @@ -1001,63 +1019,63 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWritePageScanType(u8* _Input) hci_write_page_scan_type_cp* pWritePageScanType = (hci_write_page_scan_type_cp*)_Input; #endif - // reply - hci_write_page_scan_type_rp Reply; - Reply.status = 0x00; + // reply + hci_write_page_scan_type_rp Reply; + Reply.status = 0x00; SendEventCommandComplete(HCI_CMD_WRITE_PAGE_SCAN_TYPE, &Reply, sizeof(hci_write_page_scan_type_rp)); #ifdef LOGGING - static char PageScanType[][128] = - { - { "Mandatory: Standard Scan (default)" }, - { "Optional: Interlaced Scan" } - }; + static char PageScanType[][128] = + { + { "Mandatory: Standard Scan (default)" }, + { "Optional: Interlaced Scan" } + }; #endif - LOG(USB_HLE_LOG, "Command: HCI_CMD_WRITE_PAGE_SCAN_TYPE:"); - LOG(USB_HLE_LOG, "write:"); - LOG(USB_HLE_LOG, " type: %s", PageScanType[pWritePageScanType->type]); + LOG(WIIMOTE, "Command: HCI_CMD_WRITE_PAGE_SCAN_TYPE:"); + LOG(WIIMOTE, "write:"); + LOG(WIIMOTE, " type: %s", PageScanType[pWritePageScanType->type]); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandSetEventFilter(u8* _Input) { - // command parameters - hci_set_event_filter_cp* pSetEventFilter = (hci_set_event_filter_cp*)_Input; - filter_type = pSetEventFilter->filter_type; - filter_condition_type = pSetEventFilter->filter_condition_type; + // command parameters + hci_set_event_filter_cp* pSetEventFilter = (hci_set_event_filter_cp*)_Input; + filter_type = pSetEventFilter->filter_type; + filter_condition_type = pSetEventFilter->filter_condition_type; - // reply - hci_set_event_filter_rp Reply; - Reply.status = 0x00; + // reply + hci_set_event_filter_rp Reply; + Reply.status = 0x00; SendEventCommandComplete(HCI_CMD_SET_EVENT_FILTER, &Reply, sizeof(hci_set_event_filter_rp)); - LOG(USB_HLE_LOG, "Command: HCI_CMD_SET_EVENT_FILTER:"); - LOG(USB_HLE_LOG, "write:"); - LOG(USB_HLE_LOG, " filter_type: %i", pSetEventFilter->filter_type); - LOG(USB_HLE_LOG, " filter_condition_type: %i", pSetEventFilter->filter_condition_type); + LOG(WIIMOTE, "Command: HCI_CMD_SET_EVENT_FILTER:"); + LOG(WIIMOTE, "write:"); + LOG(WIIMOTE, " filter_type: %i", pSetEventFilter->filter_type); + LOG(WIIMOTE, " filter_condition_type: %i", pSetEventFilter->filter_condition_type); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandInquiry(u8* _Input) { - // command parameters - hci_inquiry_cp* pInquiry = (hci_inquiry_cp*)_Input; - u8 lap[HCI_LAP_SIZE]; - - memcpy(lap, pInquiry->lap, HCI_LAP_SIZE); + // command parameters + hci_inquiry_cp* pInquiry = (hci_inquiry_cp*)_Input; + u8 lap[HCI_LAP_SIZE]; - _dbg_assert_msg_(USB_HLE_LOG, m_State == STATE_NONE, "m_State != NONE"); - m_State = STATE_INQUIRY_RESPONSE; - SendEventCommandStatus(HCI_CMD_INQUIRY); + memcpy(lap, pInquiry->lap, HCI_LAP_SIZE); - LOG(USB_HLE_LOG, "Command: HCI_CMD_INQUIRY:"); - LOG(USB_HLE_LOG, "write:"); - LOG(USB_HLE_LOG, " LAP[0]: 0x%02x", pInquiry->lap[0]); - LOG(USB_HLE_LOG, " LAP[1]: 0x%02x", pInquiry->lap[1]); - LOG(USB_HLE_LOG, " LAP[2]: 0x%02x", pInquiry->lap[2]); - LOG(USB_HLE_LOG, " inquiry_length: %i (N x 1.28) sec", pInquiry->inquiry_length); - LOG(USB_HLE_LOG, " num_responses: %i (N x 1.28) sec", pInquiry->num_responses); + _dbg_assert_msg_(WIIMOTE, m_State == STATE_NONE, "m_State != NONE"); + m_State = STATE_INQUIRY_RESPONSE; + SendEventCommandStatus(HCI_CMD_INQUIRY); + + LOG(WIIMOTE, "Command: HCI_CMD_INQUIRY:"); + LOG(WIIMOTE, "write:"); + LOG(WIIMOTE, " LAP[0]: 0x%02x", pInquiry->lap[0]); + LOG(WIIMOTE, " LAP[1]: 0x%02x", pInquiry->lap[1]); + LOG(WIIMOTE, " LAP[2]: 0x%02x", pInquiry->lap[2]); + LOG(WIIMOTE, " inquiry_length: %i (N x 1.28) sec", pInquiry->inquiry_length); + LOG(WIIMOTE, " num_responses: %i (N x 1.28) sec", pInquiry->num_responses); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteInquiryScanType(u8* _Input) @@ -1066,65 +1084,65 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteInquiryScanType(u8* _Input // command parameters hci_write_inquiry_scan_type_cp* pSetEventFilter = (hci_write_inquiry_scan_type_cp*)_Input; #endif - // reply - hci_write_inquiry_scan_type_rp Reply; - Reply.status = 0x00; + // reply + hci_write_inquiry_scan_type_rp Reply; + Reply.status = 0x00; SendEventCommandComplete(HCI_CMD_WRITE_INQUIRY_SCAN_TYPE, &Reply, sizeof(hci_write_inquiry_scan_type_rp)); - LOG(USB_HLE_LOG, "Command: HCI_CMD_WRITE_INQUIRY_SCAN_TYPE:"); - LOG(USB_HLE_LOG, "write:"); - LOG(USB_HLE_LOG, " type: %i", pSetEventFilter->type); + LOG(WIIMOTE, "Command: HCI_CMD_WRITE_INQUIRY_SCAN_TYPE:"); + LOG(WIIMOTE, "write:"); + LOG(WIIMOTE, " type: %i", pSetEventFilter->type); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandVendorSpecific_FC4F(u8* _Input, u32 _Size) { - // callstack... - // BTM_VendorSpecificCommad() - // WUDiRemovePatch() - // WUDiAppendRuntimePatch() - // WUDiGetFirmwareVersion() - // WUDiStackSetupComplete() + // callstack... + // BTM_VendorSpecificCommad() + // WUDiRemovePatch() + // WUDiAppendRuntimePatch() + // WUDiGetFirmwareVersion() + // WUDiStackSetupComplete() - // reply - hci_status_rp Reply; + // reply + hci_status_rp Reply; Reply.status = 0x00; SendEventCommandComplete(0xFC4F, &Reply, sizeof(hci_status_rp)); - LOG(USB_HLE_LOG, "Command: CommandVendorSpecific_FC4F:"); - LOG(USB_HLE_LOG, "input (size 0x%x):", _Size); + LOG(WIIMOTE, "Command: CommandVendorSpecific_FC4F:"); + LOG(WIIMOTE, "input (size 0x%x):", _Size); for (u32 i=0; i<_Size; i++) - LOG(USB_HLE_LOG, " Data: 0x%02x", _Input[i]); - LOG(USB_HLE_LOG, "write:"); - LOG(USB_HLE_LOG, " callstack WUDiRemovePatch"); + LOG(WIIMOTE, " Data: 0x%02x", _Input[i]); + LOG(WIIMOTE, "write:"); + LOG(WIIMOTE, " callstack WUDiRemovePatch"); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandVendorSpecific_FC4C(u8* _Input, u32 _Size) { - // reply - hci_status_rp Reply; + // reply + hci_status_rp Reply; Reply.status = 0x00; SendEventCommandComplete(0xFC4C, &Reply, sizeof(hci_status_rp)); - LOG(USB_HLE_LOG, "Command: CommandVendorSpecific_FC4C:"); - LOG(USB_HLE_LOG, "input (size 0x%x):", _Size); + LOG(WIIMOTE, "Command: CommandVendorSpecific_FC4C:"); + LOG(WIIMOTE, "input (size 0x%x):", _Size); for (u32 i=0; i<_Size; i++) - LOG(USB_HLE_LOG, " Data: 0x%02x", _Input[i]); - LOG(USB_HLE_LOG, "write:"); - LOG(USB_HLE_LOG, " perhaps append patch?"); + LOG(WIIMOTE, " Data: 0x%02x", _Input[i]); + LOG(WIIMOTE, "write:"); + LOG(WIIMOTE, " perhaps append patch?"); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandInquiryCancel(u8* _Input) { - // reply - hci_inquiry_cancel_rp Reply; - Reply.status = 0x00; + // reply + hci_inquiry_cancel_rp Reply; + Reply.status = 0x00; SendEventCommandComplete(HCI_CMD_INQUIRY_CANCEL, &Reply, sizeof(hci_inquiry_cancel_rp)); - LOG(USB_HLE_LOG, "Command: HCI_CMD_INQUIRY_CANCEL"); + LOG(WIIMOTE, "Command: HCI_CMD_INQUIRY_CANCEL"); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandRemoteNameReq(u8* _Input) @@ -1132,19 +1150,19 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandRemoteNameReq(u8* _Input) // command parameters hci_remote_name_req_cp* pRemoteNameReq = (hci_remote_name_req_cp*)_Input; - _dbg_assert_msg_(USB_HLE_LOG, m_State == STATE_NONE, "m_State != NONE"); - SendEventCommandStatus(HCI_CMD_REMOTE_NAME_REQ); + _dbg_assert_msg_(WIIMOTE, m_State == STATE_NONE, "m_State != NONE"); + SendEventCommandStatus(HCI_CMD_REMOTE_NAME_REQ); m_StateTempBD = pRemoteNameReq->bdaddr; m_State = STATE_REMOTE_NAME_REQ; - LOG(USB_HLE_LOG, "Command: HCI_CMD_REMOTE_NAME_REQ"); - LOG(USB_HLE_LOG, "Input:"); - LOG(USB_HLE_LOG, " bd: %02x:%02x:%02x:%02x:%02x:%02x", + LOG(WIIMOTE, "Command: HCI_CMD_REMOTE_NAME_REQ"); + LOG(WIIMOTE, "Input:"); + LOG(WIIMOTE, " 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]); - LOG(USB_HLE_LOG, " page_scan_rep_mode: %i", pRemoteNameReq->page_scan_rep_mode); - LOG(USB_HLE_LOG, " page_scan_mode: %i", pRemoteNameReq->page_scan_mode); - LOG(USB_HLE_LOG, " clock_offset: %i", pRemoteNameReq->clock_offset) + LOG(WIIMOTE, " page_scan_rep_mode: %i", pRemoteNameReq->page_scan_rep_mode); + LOG(WIIMOTE, " page_scan_mode: %i", pRemoteNameReq->page_scan_mode); + LOG(WIIMOTE, " clock_offset: %i", pRemoteNameReq->clock_offset) } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandCreateCon(u8* _Input) @@ -1152,22 +1170,22 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandCreateCon(u8* _Input) // command parameters hci_create_con_cp* pCreateCon = (hci_create_con_cp*)_Input; - _dbg_assert_msg_(USB_HLE_LOG, m_State == STATE_NONE, "m_State != NONE"); - m_State = STATE_CONNECTION_COMPLETE_EVENT; + _dbg_assert_msg_(WIIMOTE, m_State == STATE_NONE, "m_State != NONE"); + m_State = STATE_CONNECTION_COMPLETE_EVENT; m_StateTempBD = pCreateCon->bdaddr; - SendEventCommandStatus(HCI_CMD_CREATE_CON); - - LOG(USB_HLE_LOG, "Command: HCI_CMD_CREATE_CON"); - LOG(USB_HLE_LOG, "Input:"); - LOG(USB_HLE_LOG, " bd: %02x:%02x:%02x:%02x:%02x:%02x", + SendEventCommandStatus(HCI_CMD_CREATE_CON); + + LOG(WIIMOTE, "Command: HCI_CMD_CREATE_CON"); + LOG(WIIMOTE, "Input:"); + LOG(WIIMOTE, " 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]); - LOG(USB_HLE_LOG, " pkt_type: %i", pCreateCon->pkt_type); - LOG(USB_HLE_LOG, " page_scan_rep_mode: %i", pCreateCon->page_scan_rep_mode); - LOG(USB_HLE_LOG, " page_scan_mode: %i", pCreateCon->page_scan_mode); - LOG(USB_HLE_LOG, " clock_offset: %i", pCreateCon->clock_offset); - LOG(USB_HLE_LOG, " accept_role_switch: %i", pCreateCon->accept_role_switch); + LOG(WIIMOTE, " pkt_type: %i", pCreateCon->pkt_type); + LOG(WIIMOTE, " page_scan_rep_mode: %i", pCreateCon->page_scan_rep_mode); + LOG(WIIMOTE, " page_scan_mode: %i", pCreateCon->page_scan_mode); + LOG(WIIMOTE, " clock_offset: %i", pCreateCon->clock_offset); + LOG(WIIMOTE, " accept_role_switch: %i", pCreateCon->accept_role_switch); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandAcceptCon(u8* _Input) @@ -1177,57 +1195,57 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandAcceptCon(u8* _Input) hci_accept_con_cp* pAcceptCon = (hci_accept_con_cp*)_Input; #endif - LOG(USB_HLE_LOG, "Command: HCI_CMD_ACCEPT_CON"); - LOG(USB_HLE_LOG, "Input:"); - LOG(USB_HLE_LOG, " bd: %02x:%02x:%02x:%02x:%02x:%02x", + LOG(WIIMOTE, "Command: HCI_CMD_ACCEPT_CON"); + LOG(WIIMOTE, "Input:"); + LOG(WIIMOTE, " 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]); - LOG(USB_HLE_LOG, " role: %i", pAcceptCon->role); + LOG(WIIMOTE, " role: %i", pAcceptCon->role); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadClockOffset(u8* _Input) { - // command parameters - hci_read_clock_offset_cp* pReadClockOffset = (hci_read_clock_offset_cp*)_Input; + // command parameters + hci_read_clock_offset_cp* pReadClockOffset = (hci_read_clock_offset_cp*)_Input; - _dbg_assert_msg_(USB_HLE_LOG, m_State == STATE_NONE, "m_State != NONE"); - m_State = STATE_READ_CLOCK_OFFSET; + _dbg_assert_msg_(WIIMOTE, m_State == STATE_NONE, "m_State != NONE"); + m_State = STATE_READ_CLOCK_OFFSET; m_StateTempConnectionHandle = pReadClockOffset->con_handle; - SendEventCommandStatus(HCI_CMD_READ_CLOCK_OFFSET); - - LOG(USB_HLE_LOG, "Command: HCI_CMD_READ_CLOCK_OFFSET"); - LOG(USB_HLE_LOG, "Input:"); - LOG(USB_HLE_LOG, " ConnectionHandle: 0x%02x", pReadClockOffset->con_handle); + SendEventCommandStatus(HCI_CMD_READ_CLOCK_OFFSET); + + LOG(WIIMOTE, "Command: HCI_CMD_READ_CLOCK_OFFSET"); + LOG(WIIMOTE, "Input:"); + LOG(WIIMOTE, " ConnectionHandle: 0x%02x", pReadClockOffset->con_handle); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadRemoteVerInfo(u8* _Input) { - // command parameters - hci_read_remote_ver_info_cp* pReadRemoteVerInfo = (hci_read_remote_ver_info_cp*)_Input; + // command parameters + hci_read_remote_ver_info_cp* pReadRemoteVerInfo = (hci_read_remote_ver_info_cp*)_Input; - _dbg_assert_msg_(USB_HLE_LOG, m_State == STATE_NONE, "m_State != NONE (%i)", m_State); - m_State = STATE_READ_REMOTE_VER_INFO; + _dbg_assert_msg_(WIIMOTE, m_State == STATE_NONE, "m_State != NONE (%i)", m_State); + m_State = STATE_READ_REMOTE_VER_INFO; m_StateTempConnectionHandle = pReadRemoteVerInfo->con_handle; - SendEventCommandStatus(HCI_CMD_READ_REMOTE_VER_INFO); + SendEventCommandStatus(HCI_CMD_READ_REMOTE_VER_INFO); - LOG(USB_HLE_LOG, "Command: HCI_CMD_READ_REMOTE_VER_INFO"); - LOG(USB_HLE_LOG, "Input:"); - LOG(USB_HLE_LOG, " ConnectionHandle: 0x%02x", pReadRemoteVerInfo->con_handle); + LOG(WIIMOTE, "Command: HCI_CMD_READ_REMOTE_VER_INFO"); + LOG(WIIMOTE, "Input:"); + LOG(WIIMOTE, " ConnectionHandle: 0x%02x", pReadRemoteVerInfo->con_handle); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadRemoteFeatures(u8* _Input) { - // command parameters - hci_read_remote_features_cp* pReadRemoteFeatures = (hci_read_remote_features_cp*)_Input; + // command parameters + hci_read_remote_features_cp* pReadRemoteFeatures = (hci_read_remote_features_cp*)_Input; - _dbg_assert_msg_(USB_HLE_LOG, m_State == STATE_NONE, "m_State != NONE"); - m_State = STATE_READ_REMOTE_FEATURES; + _dbg_assert_msg_(WIIMOTE, m_State == STATE_NONE, "m_State != NONE"); + m_State = STATE_READ_REMOTE_FEATURES; m_StateTempConnectionHandle = pReadRemoteFeatures->con_handle; - SendEventCommandStatus(HCI_CMD_READ_REMOTE_FEATURES); + SendEventCommandStatus(HCI_CMD_READ_REMOTE_FEATURES); - LOG(USB_HLE_LOG, "Command: HCI_CMD_READ_REMOTE_FEATURES"); - LOG(USB_HLE_LOG, "Input:"); - LOG(USB_HLE_LOG, " ConnectionHandle: 0x%02x", pReadRemoteFeatures->con_handle); + LOG(WIIMOTE, "Command: HCI_CMD_READ_REMOTE_FEATURES"); + LOG(WIIMOTE, "Input:"); + LOG(WIIMOTE, " ConnectionHandle: 0x%02x", pReadRemoteFeatures->con_handle); } CWII_IPC_HLE_WiiMote* CWII_IPC_HLE_Device_usb_oh1_57e_305::AccessWiiMote(const bdaddr_t& _rAddr) diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp index 0aeb9b476e..84639b66f9 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp @@ -113,12 +113,9 @@ struct SL2CAP_CommandConfigurationResponse // 0x05 #endif - -#define USB_HLE_LOG DSPHLE - CWII_IPC_HLE_WiiMote::CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305* _pHost, int _Number) - : m_Name("Nintendo RVL-CNT-01") - , m_pHost(_pHost) +: m_Name("Nintendo RVL-CNT-01") +, m_pHost(_pHost) { m_BD.b[0] = 0x11; m_BD.b[1] = 0x02; @@ -147,7 +144,7 @@ void CWII_IPC_HLE_WiiMote::SendACLFrame(u8* _pData, u32 _Size) { // dump raw data { - LOG(USB_HLE_LOG, "SendToDevice: 0x%x", GetConnectionHandle()); + LOG(WIIMOTE, "SendToDevice: 0x%x", GetConnectionHandle()); std::string Temp; for (u32 j=0; j<_Size; j++) { @@ -155,7 +152,7 @@ void CWII_IPC_HLE_WiiMote::SendACLFrame(u8* _pData, u32 _Size) sprintf(Buffer, "%02x ", _pData[j]); Temp.append(Buffer); } - LOG(USB_HLE_LOG, " Data: %s", Temp.c_str()); + LOG(WIIMOTE, " Data: %s", Temp.c_str()); } // parse the command @@ -166,7 +163,7 @@ void CWII_IPC_HLE_WiiMote::SendACLFrame(u8* _pData, u32 _Size) switch (pHeader->CID) { case 0x0001: - LOG(USB_HLE_LOG, "L2Cap-SendFrame: SignalChannel (0x%04x)", pHeader->CID); + LOG(WIIMOTE, "L2Cap-SendFrame: SignalChannel (0x%04x)", pHeader->CID); SignalChannel(pData, DataSize); break; @@ -192,9 +189,9 @@ void CWII_IPC_HLE_WiiMote::SendCommandToACL(u8 _Ident, u8 _Code, u8 _CommandLeng memcpy(&DataFrame[Offset], _pCommandData, _CommandLength); - LOG(USB_HLE_LOG, " SendCommandToACL (answer)"); - LOG(USB_HLE_LOG, " Ident: 0x%02x", _Ident); - LOG(USB_HLE_LOG, " Code: 0x%02x", _Code); + LOG(WIIMOTE, " SendCommandToACL (answer)"); + LOG(WIIMOTE, " Ident: 0x%02x", _Ident); + LOG(WIIMOTE, " Code: 0x%02x", _Code); // send .... m_pHost->SendACLFrame(GetConnectionHandle(), DataFrame, pHeader->Length + sizeof(SL2CAP_Header)); @@ -227,7 +224,7 @@ void CWII_IPC_HLE_WiiMote::SignalChannel(u8* _pData, u32 _Size) default: PanicAlert("SignalChannel %x",pCommand->code); - LOG(USB_HLE_LOG, " Unknown Command-Code (0x%02x)", pCommand->code); + LOG(WIIMOTE, " Unknown Command-Code (0x%02x)", pCommand->code); return; } @@ -245,11 +242,11 @@ void CWII_IPC_HLE_WiiMote::CommandConnectionReq(u8 _Ident, u8* _pData, u32 _Size rChannel.SCID = pCommandConnectionReq->scid; rChannel.DCID = pCommandConnectionReq->scid; - LOG(USB_HLE_LOG, " CommandConnectionReq"); - LOG(USB_HLE_LOG, " Ident: 0x%02x", _Ident); - LOG(USB_HLE_LOG, " PSM: 0x%04x", rChannel.PSM); - LOG(USB_HLE_LOG, " SCID: 0x%04x", rChannel.SCID); - LOG(USB_HLE_LOG, " DCID: 0x%04x", rChannel.DCID); + LOG(WIIMOTE, " CommandConnectionReq"); + LOG(WIIMOTE, " Ident: 0x%02x", _Ident); + LOG(WIIMOTE, " PSM: 0x%04x", rChannel.PSM); + LOG(WIIMOTE, " SCID: 0x%04x", rChannel.SCID); + LOG(WIIMOTE, " DCID: 0x%04x", rChannel.DCID); // response SL2CAP_ConnectionResponse Rsp; @@ -266,16 +263,16 @@ void CWII_IPC_HLE_WiiMote::CommandCofigurationReq(u8 _Ident, u8* _pData, u32 _Si u32 Offset = 0; SL2CAP_CommandConfigurationReq* pCommandConfigReq = (SL2CAP_CommandConfigurationReq*)_pData; - _dbg_assert_(USB_HLE_LOG, pCommandConfigReq->flags == 0x00); // 1 means that the options are send in multi-packets + _dbg_assert_(WIIMOTE, pCommandConfigReq->flags == 0x00); // 1 means that the options are send in multi-packets - _dbg_assert_(USB_HLE_LOG, DoesChannelExist(pCommandConfigReq->dcid)); + _dbg_assert_(WIIMOTE, DoesChannelExist(pCommandConfigReq->dcid)); SChannel& rChanel = m_Channel[pCommandConfigReq->dcid]; - LOG(USB_HLE_LOG, " CommandCofigurationReq"); - LOG(USB_HLE_LOG, " Ident: 0x%02x", _Ident); - LOG(USB_HLE_LOG, " DCID: 0x%04x", pCommandConfigReq->dcid); - LOG(USB_HLE_LOG, " Flags: 0x%04x", pCommandConfigReq->flags); - + LOG(WIIMOTE, " CommandCofigurationReq"); + LOG(WIIMOTE, " Ident: 0x%02x", _Ident); + LOG(WIIMOTE, " DCID: 0x%04x", pCommandConfigReq->dcid); + LOG(WIIMOTE, " Flags: 0x%04x", pCommandConfigReq->flags); + Offset += sizeof(SL2CAP_CommandConfigurationReq); @@ -301,24 +298,24 @@ void CWII_IPC_HLE_WiiMote::CommandCofigurationReq(u8 _Ident, u8* _pData, u32 _Si { case 0x01: { - _dbg_assert_(USB_HLE_LOG, pOptions->length == 2); + _dbg_assert_(WIIMOTE, pOptions->length == 2); SL2CAP_OptionsMTU* pMTU = (SL2CAP_OptionsMTU*)&_pData[Offset]; rChanel.MTU = pMTU->MTU; - LOG(USB_HLE_LOG, " Config MTU: 0x%04x", pMTU->MTU); + LOG(WIIMOTE, " Config MTU: 0x%04x", pMTU->MTU); } break; case 0x02: { - _dbg_assert_(USB_HLE_LOG, pOptions->length == 2); + _dbg_assert_(WIIMOTE, pOptions->length == 2); SL2CAP_OptionsFlushTimeOut* pFlushTimeOut = (SL2CAP_OptionsFlushTimeOut*)&_pData[Offset]; rChanel.FlushTimeOut = pFlushTimeOut->TimeOut; - LOG(USB_HLE_LOG, " Config FlushTimeOut: 0x%04x", pFlushTimeOut->TimeOut); + LOG(WIIMOTE, " Config FlushTimeOut: 0x%04x", pFlushTimeOut->TimeOut); } break; default: - _dbg_assert_msg_(USB_HLE_LOG, 0, "Unknown Option: 0x%02x", pOptions->type); + _dbg_assert_msg_(WIIMOTE, 0, "Unknown Option: 0x%02x", pOptions->type); break; } @@ -328,7 +325,7 @@ void CWII_IPC_HLE_WiiMote::CommandCofigurationReq(u8 _Ident, u8* _pData, u32 _Si memcpy(&TempBuffer[RespLen], pOptions, OptionSize); RespLen += OptionSize; } - + SendCommandToACL(_Ident, L2CAP_CONF_RSP, RespLen, TempBuffer); } diff --git a/Source/Core/Core/Src/LogManager.cpp b/Source/Core/Core/Src/LogManager.cpp index 2d076d0f08..6d2e497e61 100644 --- a/Source/Core/Core/Src/LogManager.cpp +++ b/Source/Core/Core/Src/LogManager.cpp @@ -87,15 +87,15 @@ void LogManager::Init() m_Log[LogTypes::MASTER_LOG] = new CDebugger_Log("*", "Master Log"); m_Log[LogTypes::BOOT] = new CDebugger_Log("BOOT", "Boot"); m_Log[LogTypes::PIXELENGINE] = new CDebugger_Log("PE", "PixelEngine"); - m_Log[LogTypes::COMMANDPROCESSOR] = new CDebugger_Log("CP", "CommandProc"); - m_Log[LogTypes::VIDEOINTERFACE] = new CDebugger_Log("VI", "VideoInt"); - m_Log[LogTypes::SERIALINTERFACE] = new CDebugger_Log("SI", "SerialInt"); - m_Log[LogTypes::PERIPHERALINTERFACE]= new CDebugger_Log("PI", "PeripheralInt"); + m_Log[LogTypes::COMMANDPROCESSOR] = new CDebugger_Log("CP", "CommandProc"); + m_Log[LogTypes::VIDEOINTERFACE] = new CDebugger_Log("VI", "VideoInt"); + m_Log[LogTypes::SERIALINTERFACE] = new CDebugger_Log("SI", "SerialInt"); + m_Log[LogTypes::PERIPHERALINTERFACE]= new CDebugger_Log("PI", "PeripheralInt"); m_Log[LogTypes::MEMMAP] = new CDebugger_Log("MI", "MI & memmap"); m_Log[LogTypes::STREAMINGINTERFACE] = new CDebugger_Log("Stream", "StreamingInt"); - m_Log[LogTypes::DSPINTERFACE] = new CDebugger_Log("DSP", "DSPInterface"); - m_Log[LogTypes::DVDINTERFACE] = new CDebugger_Log("DVD", "DVDInterface"); - m_Log[LogTypes::GPFIFO] = new CDebugger_Log("GP", "GPFifo"); + m_Log[LogTypes::DSPINTERFACE] = new CDebugger_Log("DSP", "DSPInterface"); + m_Log[LogTypes::DVDINTERFACE] = new CDebugger_Log("DVD", "DVDInterface"); + m_Log[LogTypes::GPFIFO] = new CDebugger_Log("GP", "GPFifo"); m_Log[LogTypes::EXPANSIONINTERFACE] = new CDebugger_Log("EXI", "ExpansionInt."); m_Log[LogTypes::AUDIO_INTERFACE] = new CDebugger_Log("AI", "AudioInt."); m_Log[LogTypes::GEKKO] = new CDebugger_Log("GEKKO", "IBM CPU"); @@ -109,8 +109,8 @@ void LogManager::Init() m_Log[LogTypes::WII_IOB] = new CDebugger_Log("WII_IOB", "WII IO Bridge"); m_Log[LogTypes::WII_IPC] = new CDebugger_Log("WII_IPC", "WII IPC"); m_Log[LogTypes::WII_IPC_HLE] = new CDebugger_Log("WII_IPC_HLE", "WII IPC HLE"); - - + m_Log[LogTypes::WIIMOTE] = new CDebugger_Log("WIIMOTE", "WIIMOTE"); + for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++) { m_Log[i]->Init(); diff --git a/Source/Core/VideoCommon/VideoCommon.vcproj b/Source/Core/VideoCommon/VideoCommon.vcproj index 7f775ee9aa..48e921c4a5 100644 --- a/Source/Core/VideoCommon/VideoCommon.vcproj +++ b/Source/Core/VideoCommon/VideoCommon.vcproj @@ -1,7 +1,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -