bug fixes for the wiimote emulation

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@927 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
fires.gc 2008-10-21 15:33:16 +00:00
parent 9692f3dd9e
commit 5ad0c43707
6 changed files with 207 additions and 161 deletions

View File

@ -106,4 +106,32 @@ void PrintCallstack()
} }
} }
void PrintCallstack(LogTypes::LOG_TYPE _Log)
{
u32 addr = Memory::ReadUnchecked_U32(PowerPC::ppcState.gpr[1]); // SP
__Log(_Log, "\n == STACK TRACE - SP = %08x ==\n", PowerPC::ppcState.gpr[1]);
if (LR == 0) {
__Log(_Log, " LR = 0 - this is bad\n");
}
int count = 1;
if (g_symbolDB.GetDescription(PowerPC::ppcState.pc) != g_symbolDB.GetDescription(LR))
{
__Log(_Log, " * %s [ LR = %08x ]\n", g_symbolDB.GetDescription(LR), LR);
count++;
}
//walk the stack chain
while ((addr != 0xFFFFFFFF) && (addr != 0) && (count++ < 20) && (PowerPC::ppcState.gpr[1] != 0))
{
u32 func = Memory::ReadUnchecked_U32(addr + 4);
const char *str = g_symbolDB.GetDescription(func);
if (!str || strlen(str) == 0 || !strcmp(str, "Invalid"))
str = "(unknown)";
__Log(_Log, " * %s [ addr = %08x ]\n", str, func);
addr = Memory::ReadUnchecked_U32(addr);
}
}
} // end of namespace Debugger } // end of namespace Debugger

View File

@ -34,6 +34,7 @@ struct CallstackEntry
bool GetCallstack(std::vector<CallstackEntry> &output); bool GetCallstack(std::vector<CallstackEntry> &output);
void PrintCallstack(); void PrintCallstack();
void PrintCallstack(LogTypes::LOG_TYPE _Log);
} // end of namespace Debugger } // end of namespace Debugger

View File

@ -35,6 +35,8 @@
#include "../HW/Memmap.h" #include "../HW/Memmap.h"
#include "../HW/WII_IPC.h" #include "../HW/WII_IPC.h"
#include "../Debugger/Debugger_SymbolMap.h"
namespace WII_IPC_HLE_Interface namespace WII_IPC_HLE_Interface
{ {
@ -174,7 +176,8 @@ bool AckCommand(u32 _Address)
CCPU::Break(); CCPU::Break();
Count++; */ Count++; */
LOG(WII_IPC_HLE, "AckCommand: 0%08x", _Address); // Debugger::PrintCallstack(LogTypes::WII_IPC_HLE);
// LOG(WII_IPC_HLE, "AckCommand: 0%08x", _Address);
m_Ack.push(_Address); m_Ack.push(_Address);

View File

@ -17,17 +17,23 @@
#include "WII_IPC_HLE_Device_usb.h" #include "WII_IPC_HLE_Device_usb.h"
#include "../Plugins/Plugin_Wiimote.h" #include "../Plugins/Plugin_Wiimote.h"
#include <vector>
// ugly hacks for "SendEventNumberOfCompletedPackets"
int g_HCICount = 0; int g_HCICount = 0;
int globalHandle = 0; int g_GlobalHandle = 0;
CWII_IPC_HLE_Device_usb_oh1_57e_305::CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _DeviceID, const std::string& _rDeviceName) 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) : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName)
, m_pACLBuffer(NULL) , m_pACLBuffer(NULL)
, m_pHCIBuffer(NULL) , m_pHCIBuffer(NULL)
, m_UpdateWaitCount(0) , m_ScanEnable(0)
, scan_enable(0) , m_PINType(0)
, m_EventFilterType(0)
, m_EventFilterCondition(0)
, m_HostMaxACLSize(0)
, m_HostMaxSCOSize(0)
, m_HostNumACLPackets(0)
, m_HostNumSCOPackets(0)
{ {
m_WiiMotes.push_back(CWII_IPC_HLE_WiiMote(this, 0)); m_WiiMotes.push_back(CWII_IPC_HLE_WiiMote(this, 0));
@ -37,6 +43,12 @@ CWII_IPC_HLE_Device_usb_oh1_57e_305::CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _De
m_ControllerBD.b[3] = 0x79; m_ControllerBD.b[3] = 0x79;
m_ControllerBD.b[4] = 0x00; m_ControllerBD.b[4] = 0x00;
m_ControllerBD.b[5] = 0xFF; m_ControllerBD.b[5] = 0xFF;
m_ClassOfDevice[0] = 0x00;
m_ClassOfDevice[1] = 0x00;
m_ClassOfDevice[2] = 0x00;
memset(m_LocalName, 0, HCI_UNIT_NAME_SIZE);
} }
CWII_IPC_HLE_Device_usb_oh1_57e_305::~CWII_IPC_HLE_Device_usb_oh1_57e_305() CWII_IPC_HLE_Device_usb_oh1_57e_305::~CWII_IPC_HLE_Device_usb_oh1_57e_305()
@ -57,16 +69,13 @@ 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... // even it it wasn't very useful yet...
// Memory::Write_U8(1, 0x801514A8); // USB_LOG // Memory::Write_U8(1, 0x801514A8); // USB_LOG
// Memory::Write_U8(1, 0x801514D8); // WUD_DEBUGPrint // Memory::Write_U8(1, 0x801514D8); // WUD_DEBUGPrint
// Memory::Write_U8(1, 0x80148E09); // HID LOG
Memory::Write_U8(1, 0x80148E09); // HID LOG
SIOCtlVBuffer CommandBuffer(_CommandAddress); SIOCtlVBuffer CommandBuffer(_CommandAddress);
// LOG(WIIMOTE, "USB_IOCTL_CTRLMSG(0x%x)", CommandBuffer.Parameter); // LOG(WIIMOTE, "USB_IOCTL_CTRLMSG(0x%x)", CommandBuffer.Parameter);
// DumpAsync(CommandBuffer.BufferVector, _CommandAddress, CommandBuffer.NumberInBuffer, CommandBuffer.NumberPayloadBuffer); // DumpAsync(CommandBuffer.BufferVector, _CommandAddress, CommandBuffer.NumberInBuffer, CommandBuffer.NumberPayloadBuffer);
switch(CommandBuffer.Parameter) switch(CommandBuffer.Parameter)
@ -75,23 +84,21 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtlV(u32 _CommandAddress)
{ {
SHCICommandMessage CtrlSetup; 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.bRequestType = *(u8*)Memory::GetPointer(CommandBuffer.InBuffer[0].m_Address);
CtrlSetup.bRequest = *(u8*)Memory::GetPointer(CommandBuffer.InBuffer[1].m_Address); CtrlSetup.bRequest = *(u8*)Memory::GetPointer(CommandBuffer.InBuffer[1].m_Address);
CtrlSetup.wValue = *(u16*)Memory::GetPointer(CommandBuffer.InBuffer[2].m_Address); CtrlSetup.wValue = *(u16*)Memory::GetPointer(CommandBuffer.InBuffer[2].m_Address);
CtrlSetup.wIndex = *(u16*)Memory::GetPointer(CommandBuffer.InBuffer[3].m_Address); CtrlSetup.wIndex = *(u16*)Memory::GetPointer(CommandBuffer.InBuffer[3].m_Address);
CtrlSetup.wLength = *(u16*)Memory::GetPointer(CommandBuffer.InBuffer[4].m_Address); CtrlSetup.wLength = *(u16*)Memory::GetPointer(CommandBuffer.InBuffer[4].m_Address);
#ifdef LOGGING
u8 Termination =*(u8*)Memory::GetPointer(CommandBuffer.InBuffer[5].m_Address);
#endif
CtrlSetup.m_PayLoadAddr = CommandBuffer.PayloadBuffer[0].m_Address; CtrlSetup.m_PayLoadAddr = CommandBuffer.PayloadBuffer[0].m_Address;
CtrlSetup.m_PayLoadSize = CommandBuffer.PayloadBuffer[0].m_Size; CtrlSetup.m_PayLoadSize = CommandBuffer.PayloadBuffer[0].m_Size;
_dbg_assert_msg_(WIIMOTE, Termination == 0, "WIIMOTE: Termination != 0"); // check termination
_dbg_assert_msg_(WIIMOTE, *(u8*)Memory::GetPointer(CommandBuffer.InBuffer[5].m_Address) == 0,
"WIIMOTE: Termination != 0");
#if 0 #if 0
LOG(WIIMOTE, "USB_IOCTL_CTRLMSG (0x%08x) - add to queue and send ack only", _CommandAddress); LOG(WIIMOTE, "USB_IOCTL_CTRLMSG (0x%08x) - execute command", _CommandAddress);
LOG(WIIMOTE, " bRequestType: 0x%x", CtrlSetup.bRequestType); LOG(WIIMOTE, " bRequestType: 0x%x", CtrlSetup.bRequestType);
LOG(WIIMOTE, " bRequest: 0x%x", CtrlSetup.bRequest); LOG(WIIMOTE, " bRequest: 0x%x", CtrlSetup.bRequest);
@ -100,10 +107,11 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtlV(u32 _CommandAddress)
LOG(WIIMOTE, " wLength: 0x%x", CtrlSetup.wLength); LOG(WIIMOTE, " wLength: 0x%x", CtrlSetup.wLength);
#endif #endif
m_HCICommandMessageQueue.push(CtrlSetup); ExecuteHCICommandMessage(CtrlSetup);
// control message has been sent... // control message has been sent executed
Memory::Write_U32(0, _CommandAddress + 0x4); Memory::Write_U32(0, _CommandAddress + 0x4);
return true; return true;
} }
break; break;
@ -162,8 +170,6 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtlV(u32 _CommandAddress)
delete m_pHCIBuffer; delete m_pHCIBuffer;
} }
m_pHCIBuffer = new SIOCtlVBuffer(_CommandAddress); m_pHCIBuffer = new SIOCtlVBuffer(_CommandAddress);
// LOG(WIIMOTE, "HCI_EVENT_ENDPOINT: 0x%08x", _CommandAddress);
return false; return false;
} }
break; break;
@ -221,57 +227,34 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::SendACLFrame(u16 _ConnectionHandle, u8
memcpy(frame.data, _pData, _Size); memcpy(frame.data, _pData, _Size);
frame.size = _Size; frame.size = _Size;
m_AclFrameQue.push(frame); m_AclFrameQue.push(frame);
g_HCICount++;
} }
u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update() u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
{ {
#if 0
if(m_UpdateWaitCount < 5) {
m_UpdateWaitCount++;
return 0;
} else {
m_UpdateWaitCount = 0;
}
#endif
if (!m_EventQueue.empty() && m_pHCIBuffer) if (!m_EventQueue.empty() && m_pHCIBuffer)
{ {
SIOCtlVBuffer* pHCIBuffer = m_pHCIBuffer;
m_pHCIBuffer = NULL;
// copy the event to memory // copy the event to memory
const SQueuedEvent& rEvent = m_EventQueue.front();
u8* pHCIEvent = Memory::GetPointer(pHCIBuffer->PayloadBuffer[0].m_Address);
memcpy(pHCIEvent, rEvent.m_buffer, rEvent.m_size);
// return reply buffer size
Memory::Write_U32(rEvent.m_size, pHCIBuffer->m_Address + 0x4);
if (rEvent.m_connectionHandle > 0)
{ {
const SQueuedEvent& rEvent = m_EventQueue.front(); g_HCICount++;
u8* pHCIEvent = Memory::GetPointer(m_pHCIBuffer->PayloadBuffer[0].m_Address);
memcpy(pHCIEvent, rEvent.m_buffer, rEvent.m_size);
// return reply buffer size
Memory::Write_U32(rEvent.m_size, m_pHCIBuffer->m_Address + 0x4);
if (rEvent.m_connectionHandle > 0)
{
g_HCICount++;
}
m_EventQueue.pop();
} }
u32 Addr = m_pHCIBuffer->m_Address; m_EventQueue.pop();
delete m_pHCIBuffer;
m_pHCIBuffer = NULL;
return Addr; u32 Addr = pHCIBuffer->m_Address;
} delete pHCIBuffer;
// HCI control message/event handling
if (!m_HCICommandMessageQueue.empty() && m_pHCIBuffer)
{
const SHCICommandMessage& rMessage = m_HCICommandMessageQueue.front();
ExecuteHCICommandMessage(rMessage);
m_HCICommandMessageQueue.pop();
u32 Addr = m_pHCIBuffer->m_Address;
delete m_pHCIBuffer;
m_pHCIBuffer = NULL;
return Addr; return Addr;
} }
@ -303,9 +286,9 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
return Addr; return Addr;
} }
if (m_HCICommandMessageQueue.empty() && (globalHandle != 0) && (g_HCICount > 0)) if ((g_GlobalHandle != 0) && (g_HCICount > 0))
{ {
SendEventNumberOfCompletedPackets(globalHandle, g_HCICount*2); SendEventNumberOfCompletedPackets(g_GlobalHandle, g_HCICount*2);
g_HCICount = 0; g_HCICount = 0;
} }
@ -516,7 +499,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventConnectionComplete(bdaddr_t _
AddEventToQueue(Event); AddEventToQueue(Event);
globalHandle = pConnectionComplete->Connection_Handle; g_GlobalHandle = pConnectionComplete->Connection_Handle;
#ifdef LOGGING #ifdef LOGGING
static char s_szLinkType[][128] = static char s_szLinkType[][128] =
@ -683,7 +666,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventNumberOfCompletedPackets(u16
SHCIEventNumberOfCompletedPackets* pNumberOfCompletedPackets = (SHCIEventNumberOfCompletedPackets*)Event.m_buffer; SHCIEventNumberOfCompletedPackets* pNumberOfCompletedPackets = (SHCIEventNumberOfCompletedPackets*)Event.m_buffer;
pNumberOfCompletedPackets->EventType = 0x13; pNumberOfCompletedPackets->EventType = 0x13;
pNumberOfCompletedPackets->PayloadLength = sizeof(SHCIEventReadRemoteFeatures) - 2; pNumberOfCompletedPackets->PayloadLength = sizeof(SHCIEventNumberOfCompletedPackets) - 2;
pNumberOfCompletedPackets->NumberOfHandles = 1; pNumberOfCompletedPackets->NumberOfHandles = 1;
pNumberOfCompletedPackets->Connection_Handle = _connectionHandle; pNumberOfCompletedPackets->Connection_Handle = _connectionHandle;
pNumberOfCompletedPackets->Number_Of_Completed_Packets = _count; pNumberOfCompletedPackets->Number_Of_Completed_Packets = _count;
@ -892,6 +875,9 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::ExecuteHCICommandMessage(const SHCICom
CommandSniffMode(pInput); CommandSniffMode(pInput);
break; break;
case HCI_CMD_DISCONNECT:
PanicAlert("HCI_CMD_DISCONNECT is not implemented");
break;
// //
// --- default --- // --- default ---
// //
@ -902,7 +888,23 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::ExecuteHCICommandMessage(const SHCICom
u16 ogf = HCI_OGF(pMsg->Opcode); u16 ogf = HCI_OGF(pMsg->Opcode);
#endif #endif
_dbg_assert_msg_(WIIMOTE, 0, "Unknown USB_IOCTL_CTRLMSG: 0x%04X (ocf: 0x%x ogf 0x%x)", pMsg->Opcode, ocf, ogf);
PanicAlert("0x%08x", _rHCICommandMessage.m_PayLoadAddr);
if (ogf == 0x3f)
{
PanicAlert("Vendor specific HCI command");
LOG(WIIMOTE, "Command: vendor specific: 0x%04X (ocf: 0x%x)", pMsg->Opcode, ocf);
for (int i=0; i<pMsg->len; i++)
{
LOG(WIIMOTE, " 0x02%x", pInput[i]);
}
}
else
{
_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... // send fake all is okay msg...
SendEventCommandComplete(pMsg->Opcode, NULL, 0); SendEventCommandComplete(pMsg->Opcode, NULL, 0);
@ -1093,10 +1095,10 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandHostBufferSize(u8* _Input)
{ {
// command parameters // command parameters
hci_host_buffer_size_cp* pHostBufferSize = (hci_host_buffer_size_cp*)_Input; hci_host_buffer_size_cp* pHostBufferSize = (hci_host_buffer_size_cp*)_Input;
Host_max_acl_size = pHostBufferSize->max_acl_size; m_HostMaxACLSize = pHostBufferSize->max_acl_size;
Host_max_sco_size = pHostBufferSize->max_sco_size; m_HostMaxSCOSize = pHostBufferSize->max_sco_size;
Host_num_acl_pkts = pHostBufferSize->num_acl_pkts; m_HostNumACLPackets = pHostBufferSize->num_acl_pkts;
Host_num_sco_pkts = pHostBufferSize->num_sco_pkts; m_HostNumSCOPackets = pHostBufferSize->num_sco_pkts;
// reply // reply
hci_host_buffer_size_rp Reply; hci_host_buffer_size_rp Reply;
@ -1134,7 +1136,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteScanEnable(u8* _Input)
{ {
// command parameters // command parameters
hci_write_scan_enable_cp* pWriteScanEnable = (hci_write_scan_enable_cp*)_Input; hci_write_scan_enable_cp* pWriteScanEnable = (hci_write_scan_enable_cp*)_Input;
scan_enable = pWriteScanEnable->scan_enable; m_ScanEnable = pWriteScanEnable->scan_enable;
// reply // reply
hci_write_scan_enable_rp Reply; hci_write_scan_enable_rp Reply;
@ -1157,15 +1159,16 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteScanEnable(u8* _Input)
SendEventCommandComplete(HCI_CMD_WRITE_SCAN_ENABLE, &Reply, sizeof(hci_write_scan_enable_rp)); SendEventCommandComplete(HCI_CMD_WRITE_SCAN_ENABLE, &Reply, sizeof(hci_write_scan_enable_rp));
// TODO: fix this ugly request connection hack :) // TODO: fix this ugly request connection hack :)
// for homebrew works this if (pWriteScanEnable->scan_enable & 2) // check if page scan is enable //for homebrew works this
/* { if (pWriteScanEnable->scan_enable & 2) // check if page scan is enable
{
static bool first = true; static bool first = true;
if (first) if (first)
{ {
first = false; first = false;
SendEventRequestConnection(); // SendEventRequestConnection();
} }
}*/ }
} }
void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteInquiryMode(u8* _Input) void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteInquiryMode(u8* _Input)
@ -1224,8 +1227,8 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandSetEventFilter(u8* _Input)
{ {
// command parameters // command parameters
hci_set_event_filter_cp* pSetEventFilter = (hci_set_event_filter_cp*)_Input; hci_set_event_filter_cp* pSetEventFilter = (hci_set_event_filter_cp*)_Input;
filter_type = pSetEventFilter->filter_type; m_EventFilterType = pSetEventFilter->filter_type;
filter_condition_type = pSetEventFilter->filter_condition_type; m_EventFilterCondition = pSetEventFilter->filter_condition_type;
// reply // reply
hci_set_event_filter_rp Reply; hci_set_event_filter_rp Reply;
@ -1415,6 +1418,10 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadRemoteVerInfo(u8* _Input)
SendEventCommandStatus(HCI_CMD_READ_REMOTE_VER_INFO); SendEventCommandStatus(HCI_CMD_READ_REMOTE_VER_INFO);
SendEventReadRemoteVerInfo(pReadRemoteVerInfo->con_handle); SendEventReadRemoteVerInfo(pReadRemoteVerInfo->con_handle);
// connect
// CWII_IPC_HLE_WiiMote* pWiimote = AccessWiiMote(pReadRemoteVerInfo->con_handle);
// pWiimote->Connect();
} }
void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadRemoteFeatures(u8* _Input) void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadRemoteFeatures(u8* _Input)

View File

@ -25,9 +25,7 @@
#include "WII_IPC_HLE_WiiMote.h" #include "WII_IPC_HLE_WiiMote.h"
class CWII_IPC_HLE_WiiMote; class CWII_IPC_HLE_WiiMote;
struct SCommandMessage;
struct SHCIEventCommand;
struct usb_ctrl_setup;
union UACLHeader union UACLHeader
{ {
@ -41,6 +39,13 @@ union UACLHeader
u32 Hex; u32 Hex;
}; };
struct ACLFrame
{
u16 ConnectionHandle;
u8* data;
u32 size;
};
struct SQueuedEvent struct SQueuedEvent
{ {
u8 m_buffer[1024]; u8 m_buffer[1024];
@ -50,14 +55,13 @@ struct SQueuedEvent
SQueuedEvent(size_t size, u16 connectionHandle) SQueuedEvent(size_t size, u16 connectionHandle)
: m_size(size) : m_size(size)
, m_connectionHandle(connectionHandle) , m_connectionHandle(connectionHandle)
{} {
}; if (m_size > 1024)
{
struct ACLFrame // i know this code sux...
{ PanicAlert("SQueuedEvent: allocate a to big buffer!!");
u16 ConnectionHandle; }
u8* data; }
u32 size;
}; };
class CWII_IPC_HLE_Device_usb_oh1_57e_305 : public IWII_IPC_HLE_Device class CWII_IPC_HLE_Device_usb_oh1_57e_305 : public IWII_IPC_HLE_Device
@ -77,17 +81,16 @@ public:
void SendACLFrame(u16 _ConnectionHandle, u8* _pData, u32 _Size); void SendACLFrame(u16 _ConnectionHandle, u8* _pData, u32 _Size);
//hack for wiimote plugin
public:
std::vector<CWII_IPC_HLE_WiiMote> m_WiiMotes;
CWII_IPC_HLE_WiiMote* AccessWiiMote(const bdaddr_t& _rAddr);
CWII_IPC_HLE_WiiMote* AccessWiiMote(u16 _ConnectionHandle);
private: private:
typedef std::queue<SQueuedEvent> CEventQueue;
CEventQueue m_EventQueue;
void AddEventToQueue(const SQueuedEvent& _event)
{
m_EventQueue.push(_event);
}
enum enum
{ {
USB_IOCTL_HCI_COMMAND_MESSAGE = 0, USB_IOCTL_HCI_COMMAND_MESSAGE = 0,
@ -120,20 +123,34 @@ private:
u32 m_PayLoadSize; u32 m_PayLoadSize;
}; };
bdaddr_t m_ControllerBD;
u8 m_ClassOfDevice[HCI_CLASS_SIZE];
char m_LocalName[HCI_UNIT_NAME_SIZE];
u8 m_PINType;
u8 m_ScanEnable;
// STATE_TO_SAVE u8 m_EventFilterType;
std::queue<SHCICommandMessage> m_HCICommandMessageQueue; u8 m_EventFilterCondition;
std::queue<ACLFrame> m_AclFrameQue;
u16 m_HostMaxACLSize;
u8 m_HostMaxSCOSize;
u16 m_HostNumACLPackets;
u16 m_HostNumSCOPackets;
typedef std::queue<SQueuedEvent> CEventQueue;
typedef std::queue<ACLFrame> CACLFrameQueue;
CEventQueue m_EventQueue;
CACLFrameQueue m_AclFrameQue;
SIOCtlVBuffer* m_pACLBuffer; SIOCtlVBuffer* m_pACLBuffer;
SIOCtlVBuffer* m_pHCIBuffer; SIOCtlVBuffer* m_pHCIBuffer;
// Events
bool SendEventCommandStatus(u16 _Opcode); bool SendEventCommandStatus(u16 _Opcode);
void SendEventCommandComplete(u16 _OpCode, void* _pData, u32 _DataSize); void SendEventCommandComplete(u16 _OpCode, void* _pData, u32 _DataSize);
bool SendEventInquiryResponse(); bool SendEventInquiryResponse();
bool SendEventInquiryComplete(); bool SendEventInquiryComplete();
bool SendEventRemoteNameReq(bdaddr_t _bd); bool SendEventRemoteNameReq(bdaddr_t _bd);
bool SendEventRequestConnection(); bool SendEventRequestConnection();
bool SendEventConnectionComplete(bdaddr_t _bd); bool SendEventConnectionComplete(bdaddr_t _bd);
@ -145,28 +162,13 @@ private:
bool SendEventAuthenticationCompleted(u16 _connectionHandle); bool SendEventAuthenticationCompleted(u16 _connectionHandle);
bool SendEventModeChange(u16 _connectionHandle, u8 _mode, u16 _value); bool SendEventModeChange(u16 _connectionHandle, u8 _mode, u16 _value);
// Execute HCI Message
void ExecuteHCICommandMessage(const SHCICommandMessage& _rCtrlMessage); void ExecuteHCICommandMessage(const SHCICommandMessage& _rCtrlMessage);
// commands // OGF 0x01 Link control commands and return parameters
void CommandReset(u8* _Input);
void CommandReadBufferSize(u8* _Input);
void CommandReadLocalVer(u8* _Input);
void CommandReadBDAdrr(u8* _Input);
void CommandReadLocalFeatures(u8* _Input);
void CommandReadStoredLinkKey(u8* _Input);
void CommandWriteUnitClass(u8* _Input);
void CommandWriteLocalName(u8* _Input);
void CommandWritePinType(u8* _Input);
void CommandHostBufferSize(u8* _Input);
void CommandWritePageTimeOut(u8* _Input);
void CommandWriteScanEnable(u8* _Input);
void CommandWriteInquiryMode(u8* _Input); void CommandWriteInquiryMode(u8* _Input);
void CommandWritePageScanType(u8* _Input); void CommandWritePageScanType(u8* _Input);
void CommandSetEventFilter(u8* _Input); void CommandHostBufferSize(u8* _Input);
void CommandInquiry(u8* _Input);
void CommandWriteInquiryScanType(u8* _Input);
void CommandVendorSpecific_FC4C(u8* _Input, u32 _Size);
void CommandVendorSpecific_FC4F(u8* _Input, u32 _Size);
void CommandInquiryCancel(u8* _Input); void CommandInquiryCancel(u8* _Input);
void CommandRemoteNameReq(u8* _Input); void CommandRemoteNameReq(u8* _Input);
void CommandCreateCon(u8* _Input); void CommandCreateCon(u8* _Input);
@ -174,33 +176,40 @@ private:
void CommandReadClockOffset(u8* _Input); void CommandReadClockOffset(u8* _Input);
void CommandReadRemoteVerInfo(u8* _Input); void CommandReadRemoteVerInfo(u8* _Input);
void CommandReadRemoteFeatures(u8* _Input); void CommandReadRemoteFeatures(u8* _Input);
void CommandWriteLinkPolicy(u8* _Input);
void CommandAuthenticationRequested(u8* _Input); void CommandAuthenticationRequested(u8* _Input);
void CommandInquiry(u8* _Input);
// OGF 0x02 Link policy commands and return parameters
void CommandWriteLinkPolicy(u8* _Input);
void CommandSniffMode(u8* _Input); void CommandSniffMode(u8* _Input);
// OGF 0x03 Host Controller and Baseband commands and return parameters
void CommandReset(u8* _Input);
void CommandWriteLocalName(u8* _Input);
void CommandWritePageTimeOut(u8* _Input);
void CommandWriteScanEnable(u8* _Input);
void CommandWriteUnitClass(u8* _Input);
void CommandReadStoredLinkKey(u8* _Input);
void CommandWritePinType(u8* _Input);
void CommandSetEventFilter(u8* _Input);
void CommandWriteInquiryScanType(u8* _Input);
// OGF 0x04 Informational commands and return parameters
void CommandReadBufferSize(u8* _Input);
void CommandReadLocalVer(u8* _Input);
void CommandReadLocalFeatures(u8* _Input);
void CommandReadBDAdrr(u8* _Input);
// OGF 0x3F Vendor specific
void CommandVendorSpecific_FC4C(u8* _Input, u32 _Size);
void CommandVendorSpecific_FC4F(u8* _Input, u32 _Size);
void SendToDevice(u16 _ConnectionHandle, u8* _pData, u32 _Size); void SendToDevice(u16 _ConnectionHandle, u8* _pData, u32 _Size);
void AddEventToQueue(const SQueuedEvent& _event)
u32 m_UpdateWaitCount; {
m_EventQueue.push(_event);
u8 scan_enable; }
bdaddr_t m_ControllerBD;
u8 m_ClassOfDevice[HCI_CLASS_SIZE];
char m_LocalName[HCI_UNIT_NAME_SIZE];
u8 m_PINType;
u8 filter_type;
u8 filter_condition_type;
u16 Host_max_acl_size; /* Max. size of ACL packet (bytes) */
u8 Host_max_sco_size; /* Max. size of SCO packet (bytes) */
u16 Host_num_acl_pkts; /* Max. number of ACL packets */
u16 Host_num_sco_pkts; /* Max. number of SCO packets */
public: //hack for wiimote plugin
std::vector<CWII_IPC_HLE_WiiMote> m_WiiMotes;
CWII_IPC_HLE_WiiMote* AccessWiiMote(const bdaddr_t& _rAddr);
CWII_IPC_HLE_WiiMote* AccessWiiMote(u16 _ConnectionHandle);
}; };
#endif #endif

View File

@ -59,26 +59,24 @@ void Shutdown()
{ {
} }
//#include "../../Plugins/Plugin_DSP.h"
void patches() void patches()
{ {
// if (Memory::Read_U32(0x80095AC0) != -1) CCPU::Break(); /* if (Memory::Read_U16(0x90000880) == 0x130b)
// if (Memory::Read_U32(0x8003E574) != 0) CCPU::Break(); {
PanicAlert("Memory::Read_U16(0x900008800) == 0x130b");
// if (PC == 0x800077e8) }
/* u32 op = Memory::Read_U32(0x80015180); */
if ((op != 0xc0028218) && (op != 0)) /* if (PC == 0x80074cd4)
{ {
PanicAlert("hrehre %x", op); u16 command = Common::swap16(Memory::Read_U16(PowerPC::ppcState.gpr[3] + 8));
CCPU::Break(); if (command == 0x0b13)
} */ {
PanicAlert("command: %x", command);
// if (PC == 0x80022588) CCPU::Break(); CCPU::Break();
}
// WII_IPC_HLE_Interface::Update(); }*/
} }
void SingleStepInner(void) void SingleStepInner(void)
{ {
static UGeckoInstruction instCode; static UGeckoInstruction instCode;