wii finds a wiimote now

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@925 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
fires.gc
2008-10-20 20:30:37 +00:00
parent 03763372ac
commit 6faea5668a
13 changed files with 307 additions and 139 deletions

View File

@ -76,7 +76,7 @@ void Callback_DSPLog(const TCHAR* _szMessage);
void Callback_DSPInterrupt();
void Callback_PADLog(const TCHAR* _szMessage);
void Callback_WiimoteLog(const TCHAR* _szMessage);
void Callback_WiimoteInput(const void* _pData, u32 _Size);
void Callback_WiimoteInput(u16 _channelID, const void* _pData, u32 _Size);
// For keyboard shortcuts.
void Callback_KeyPress(int key, BOOL shift, BOOL control);

View File

@ -174,6 +174,8 @@ bool AckCommand(u32 _Address)
CCPU::Break();
Count++; */
LOG(WII_IPC_HLE, "AckCommand: 0%08x", _Address);
m_Ack.push(_Address);
return true;

View File

@ -19,6 +19,9 @@
#include "../Plugins/Plugin_Wiimote.h"
#include <vector>
int g_HCICount = 0;
int globalHandle = 0;
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_pACLBuffer(NULL)
@ -54,8 +57,11 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtlV(u32 _CommandAddress)
{
// 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
// Memory::Write_U8(1, 0x801514A8); // USB_LOG
// Memory::Write_U8(1, 0x801514D8); // WUD_DEBUGPrint
Memory::Write_U8(1, 0x80148E09); // HID LOG
SIOCtlVBuffer CommandBuffer(_CommandAddress);
@ -228,7 +234,6 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
}
#endif
//LOG(WIIMOTE, "Update() %i 0x%08x", m_HCICommandMessageQueue.size(), m_pHCIBuffer);
if (!m_EventQueue.empty() && m_pHCIBuffer)
{
// copy the event to memory
@ -241,6 +246,11 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
// 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();
}
@ -265,7 +275,7 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
return Addr;
}
// check if we can fill the aclbuffer
if(!m_AclFrameQue.empty() && m_pACLBuffer)
{
@ -290,11 +300,15 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
delete m_pACLBuffer;
m_pACLBuffer = NULL;
// SendEventNumberOfCompletedPackets(frame.ConnectionHandle);
return Addr;
}
if (m_HCICommandMessageQueue.empty() && (globalHandle != 0) && (g_HCICount > 0))
{
SendEventNumberOfCompletedPackets(globalHandle, g_HCICount*2);
g_HCICount = 0;
}
PluginWiimote::Wiimote_Update();
return 0;
@ -310,7 +324,7 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventCommandStatus(u16 _Opcode)
{
SQueuedEvent Event(sizeof(SHCIEventStatus));
SQueuedEvent Event(sizeof(SHCIEventStatus), 0);
SHCIEventStatus* pHCIEvent = (SHCIEventStatus*)Event.m_buffer;
pHCIEvent->EventType = 0x0F;
@ -322,14 +336,14 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventCommandStatus(u16 _Opcode)
AddEventToQueue(Event);
LOG(WIIMOTE, "Event: Command Status");
LOG(WIIMOTE, " Opcode: %i", pHCIEvent->Opcode);
LOG(WIIMOTE, " Opcode: 0x%04x", pHCIEvent->Opcode);
return true;
}
void CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventCommandComplete(u16 _OpCode, void* _pData, u32 _DataSize)
{
SQueuedEvent Event(sizeof(SHCIEventCommand) + _DataSize);
SQueuedEvent Event(sizeof(SHCIEventCommand) + _DataSize, 0);
SHCIEventCommand* pHCIEvent = (SHCIEventCommand*)Event.m_buffer;
pHCIEvent->EventType = 0x0E;
@ -347,7 +361,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventCommandComplete(u16 _OpCode,
AddEventToQueue(Event);
LOG(WIIMOTE, "Event: Command Complete");
LOG(WIIMOTE, " Opcode: %i", pHCIEvent->Opcode);
LOG(WIIMOTE, " Opcode: 0x%04x", pHCIEvent->Opcode);
}
bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventInquiryResponse()
@ -355,7 +369,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventInquiryResponse()
if (m_WiiMotes.empty())
return false;
SQueuedEvent Event(sizeof(SHCIEventInquiryResult) + m_WiiMotes.size()*sizeof(hci_inquiry_response));
SQueuedEvent Event(sizeof(SHCIEventInquiryResult) + m_WiiMotes.size()*sizeof(hci_inquiry_response), 0);
SHCIEventInquiryResult* pInquiryResult = (SHCIEventInquiryResult*)Event.m_buffer;
@ -391,7 +405,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventInquiryResponse()
bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventInquiryComplete()
{
SQueuedEvent Event(sizeof(SHCIEventInquiryComplete));
SQueuedEvent Event(sizeof(SHCIEventInquiryComplete), 0);
SHCIEventInquiryComplete* pInquiryComplete = (SHCIEventInquiryComplete*)Event.m_buffer;
pInquiryComplete->EventType = 0x01;
@ -416,7 +430,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRemoteNameReq(bdaddr_t _bd)
return false;
}
SQueuedEvent Event(sizeof(SHCIEventRemoteNameReq));
SQueuedEvent Event(sizeof(SHCIEventRemoteNameReq), 0);
SHCIEventRemoteNameReq* pRemoteNameReq = (SHCIEventRemoteNameReq*)Event.m_buffer;
@ -441,7 +455,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRequestConnection()
{
const CWII_IPC_HLE_WiiMote rWiiMote = m_WiiMotes[0];
SQueuedEvent Event(sizeof(SHCIEventRequestConnection));
SQueuedEvent Event(sizeof(SHCIEventRequestConnection), 0);
SHCIEventRequestConnection* pEventRequestConnection = (SHCIEventRequestConnection*)Event.m_buffer;
@ -488,7 +502,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventConnectionComplete(bdaddr_t _
return false;
}
SQueuedEvent Event(sizeof(SHCIEventConnectionComplete));
SQueuedEvent Event(sizeof(SHCIEventConnectionComplete), 0);
SHCIEventConnectionComplete* pConnectionComplete = (SHCIEventConnectionComplete*)Event.m_buffer;
@ -502,6 +516,8 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventConnectionComplete(bdaddr_t _
AddEventToQueue(Event);
globalHandle = pConnectionComplete->Connection_Handle;
#ifdef LOGGING
static char s_szLinkType[][128] =
{
@ -533,7 +549,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRoleChange(bdaddr_t _bd)
return false;
}
SQueuedEvent Event(sizeof(SHCIEventRoleChange));
SQueuedEvent Event(sizeof(SHCIEventRoleChange), 0);
SHCIEventRoleChange* pRoleChange = (SHCIEventRoleChange*)Event.m_buffer;
@ -565,7 +581,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadClockOffsetComplete(u16 _
return false;
}
SQueuedEvent Event(sizeof(SHCIEventReadClockOffsetComplete));
SQueuedEvent Event(sizeof(SHCIEventReadClockOffsetComplete), _connectionHandle);
SHCIEventReadClockOffsetComplete* pReadClockOffsetComplete = (SHCIEventReadClockOffsetComplete*)Event.m_buffer;
pReadClockOffsetComplete->EventType = 0x1C;
@ -593,7 +609,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadRemoteVerInfo(u16 _connec
return false;
}
SQueuedEvent Event(sizeof(SHCIEventReadRemoteVerInfo));
SQueuedEvent Event(sizeof(SHCIEventReadRemoteVerInfo), _connectionHandle);
SHCIEventReadRemoteVerInfo* pReadRemoteVerInfo = (SHCIEventReadRemoteVerInfo*)Event.m_buffer;
pReadRemoteVerInfo->EventType = 0x0C;
@ -625,7 +641,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadRemoteFeatures(u16 _conne
return false;
}
SQueuedEvent Event(sizeof(SHCIEventReadRemoteFeatures));
SQueuedEvent Event(sizeof(SHCIEventReadRemoteFeatures), _connectionHandle);
SHCIEventReadRemoteFeatures* pReadRemoteFeatures = (SHCIEventReadRemoteFeatures*)Event.m_buffer;
pReadRemoteFeatures->EventType = 0x0C;
@ -654,7 +670,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadRemoteFeatures(u16 _conne
return true;
}
bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventNumberOfCompletedPackets(u16 _connectionHandle)
bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventNumberOfCompletedPackets(u16 _connectionHandle, u16 _count)
{
CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle);
if (pWiiMote == NULL)
@ -663,14 +679,14 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventNumberOfCompletedPackets(u16
return false;
}
SQueuedEvent Event(sizeof(SHCIEventNumberOfCompletedPackets));
SQueuedEvent Event(sizeof(SHCIEventNumberOfCompletedPackets), 0); // zero, so this packet isnt counted
SHCIEventNumberOfCompletedPackets* pNumberOfCompletedPackets = (SHCIEventNumberOfCompletedPackets*)Event.m_buffer;
pNumberOfCompletedPackets->EventType = 0x13;
pNumberOfCompletedPackets->PayloadLength = sizeof(SHCIEventReadRemoteFeatures) - 2;
pNumberOfCompletedPackets->value = 1;
pNumberOfCompletedPackets->NumberOfHandles = 1;
pNumberOfCompletedPackets->Connection_Handle = _connectionHandle;
pNumberOfCompletedPackets->Number_Of_Completed_Packets = 1;
pNumberOfCompletedPackets->Number_Of_Completed_Packets = _count;
AddEventToQueue(Event);
@ -691,12 +707,12 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventAuthenticationCompleted(u16 _
return false;
}
SQueuedEvent Event(sizeof(SHCIEventAuthenticationCompleted));
SQueuedEvent Event(sizeof(SHCIEventAuthenticationCompleted), _connectionHandle);
SHCIEventAuthenticationCompleted* pEventAuthenticationCompleted = (SHCIEventAuthenticationCompleted*)Event.m_buffer;
pEventAuthenticationCompleted->EventType = 0x13;
pEventAuthenticationCompleted->PayloadLength = sizeof(SHCIEventReadRemoteFeatures) - 2;
pEventAuthenticationCompleted->value = 1;
pEventAuthenticationCompleted->EventType = 0x06;
pEventAuthenticationCompleted->PayloadLength = sizeof(SHCIEventAuthenticationCompleted) - 2;
pEventAuthenticationCompleted->value = 0;
pEventAuthenticationCompleted->Connection_Handle = _connectionHandle;
AddEventToQueue(Event);
@ -708,6 +724,36 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventAuthenticationCompleted(u16 _
return true;
}
bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventModeChange(u16 _connectionHandle, u8 _mode, u16 _value)
{
CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_connectionHandle);
if (pWiiMote == NULL)
{
PanicAlert("SendEventModeChange: Cant find WiiMote by connection handle %02x", _connectionHandle);
return false;
}
SQueuedEvent Event(sizeof(SHCIEventModeChange), _connectionHandle);
SHCIEventModeChange* pModeChange = (SHCIEventModeChange*)Event.m_buffer;
pModeChange->EventType = 0x14;
pModeChange->PayloadLength = sizeof(SHCIEventModeChange) - 2;
pModeChange->Status = 0;
pModeChange->Connection_Handle = _connectionHandle;
pModeChange->CurrentMode = _mode;
pModeChange->Value = _value;
AddEventToQueue(Event);
// Log
LOG(WIIMOTE, "Event: SendEventModeChange");
LOG(WIIMOTE, " Connection_Handle: 0x%04x", pModeChange->Connection_Handle);
LOG(WIIMOTE, " missing other paramter :)");
return true;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
//
@ -842,6 +888,10 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::ExecuteHCICommandMessage(const SHCICom
CommandAuthenticationRequested(pInput);
break;
case HCI_CMD_SNIFF_MODE:
CommandSniffMode(pInput);
break;
//
// --- default ---
//
@ -1107,16 +1157,15 @@ 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));
// 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;
if (first)
{
first = false;
SendEventRequestConnection();
}
}
}*/
}
void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteInquiryMode(u8* _Input)
@ -1208,6 +1257,8 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandInquiry(u8* _Input)
SendEventCommandStatus(HCI_CMD_INQUIRY);
SendEventInquiryResponse();
SendEventInquiryComplete();
}
void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteInquiryScanType(u8* _Input)
@ -1394,8 +1445,8 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteLinkPolicy(u8* _Input)
PanicAlert("The connect should be send after the command status... check it");
// for homebrew works this
CWII_IPC_HLE_WiiMote* pWiimote = AccessWiiMote(pLinkPolicy->con_handle);
pWiimote->Connect();
// CWII_IPC_HLE_WiiMote* pWiimote = AccessWiiMote(pLinkPolicy->con_handle);
// pWiimote->Connect();
}
void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandAuthenticationRequested(u8* _Input)
@ -1411,6 +1462,23 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandAuthenticationRequested(u8* _In
SendEventAuthenticationCompleted(pAuthReq->con_handle);
}
void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandSniffMode(u8* _Input)
{
// command parameters
hci_sniff_mode_cp* pSniffMode = (hci_sniff_mode_cp*)_Input;
LOG(WIIMOTE, "Command: HCI_CMD_SNIFF_MODE");
LOG(WIIMOTE, "Input:");
LOG(WIIMOTE, " ConnectionHandle: 0x%04x", pSniffMode->con_handle);
LOG(WIIMOTE, " max_interval: 0x%04x", pSniffMode->max_interval);
LOG(WIIMOTE, " min_interval: 0x%04x", pSniffMode->min_interval);
LOG(WIIMOTE, " attempt: 0x%04x", pSniffMode->attempt);
LOG(WIIMOTE, " timeout: 0x%04x", pSniffMode->timeout);
SendEventCommandStatus(HCI_CMD_SNIFF_MODE);
SendEventModeChange(pSniffMode->con_handle, 0x02, pSniffMode->max_interval); // sniff mode
}
////////////////////////////////////////////////////////////////////////////////////////////////////
//
//

View File

@ -45,8 +45,11 @@ struct SQueuedEvent
{
u8 m_buffer[1024];
size_t m_size;
SQueuedEvent(size_t size) :
m_size(size)
u16 m_connectionHandle;
SQueuedEvent(size_t size, u16 connectionHandle)
: m_size(size)
, m_connectionHandle(connectionHandle)
{}
};
@ -138,8 +141,9 @@ private:
bool SendEventReadRemoteVerInfo(u16 _connectionHandle);
bool SendEventReadRemoteFeatures(u16 _connectionHandle);
bool SendEventRoleChange(bdaddr_t _bd);
bool SendEventNumberOfCompletedPackets(u16 _connectionHandle);
bool SendEventNumberOfCompletedPackets(u16 _connectionHandle, u16 _count);
bool SendEventAuthenticationCompleted(u16 _connectionHandle);
bool SendEventModeChange(u16 _connectionHandle, u8 _mode, u16 _value);
void ExecuteHCICommandMessage(const SHCICommandMessage& _rCtrlMessage);
@ -172,6 +176,7 @@ private:
void CommandReadRemoteFeatures(u8* _Input);
void CommandWriteLinkPolicy(u8* _Input);
void CommandAuthenticationRequested(u8* _Input);
void CommandSniffMode(u8* _Input);
void SendToDevice(u16 _ConnectionHandle, u8* _pData, u32 _Size);

View File

@ -30,12 +30,6 @@
#define HIDP_OUTPUT_CHANNEL 0x11
#define HIDP_INPUT_CHANNEL 0x13
// #define HID_OUTPUT_SCID 0x1234
// #define HID_INPUT_SCID 0x5678
#define HID_OUTPUT_SCID 0x0040
#define HID_INPUT_SCID 0x0040
struct SL2CAP_Header
{
@ -138,8 +132,9 @@ struct SL2CAP_CommandDisconnectionResponse // 0x07
static CWII_IPC_HLE_Device_usb_oh1_57e_305* s_Usb;
namespace Core {
void Callback_WiimoteInput(const void* _pData, u32 _Size) {
s_Usb->m_WiiMotes[0].SendL2capData(HID_OUTPUT_SCID, _pData, _Size);
void Callback_WiimoteInput(u16 _channelID, const void* _pData, u32 _Size)
{
s_Usb->m_WiiMotes[0].SendL2capData(_channelID, _pData, _Size);
}
}
@ -178,7 +173,7 @@ CWII_IPC_HLE_WiiMote::CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305*
void CWII_IPC_HLE_WiiMote::SendACLFrame(u8* _pData, u32 _Size)
{
// dump raw data
/* // dump raw data
{
LOG(WIIMOTE, "SendToDevice: 0x%x", GetConnectionHandle());
std::string Temp;
@ -190,7 +185,7 @@ void CWII_IPC_HLE_WiiMote::SendACLFrame(u8* _pData, u32 _Size)
}
LOG(WIIMOTE, " Data: %s", Temp.c_str());
}
*/
// parse the command
SL2CAP_Header* pHeader = (SL2CAP_Header*)_pData;
u8* pData = _pData + sizeof(SL2CAP_Header);
@ -224,8 +219,29 @@ void CWII_IPC_HLE_WiiMote::SendACLFrame(u8* _pData, u32 _Size)
}
break;
case 0x11: // HID Output
{
PanicAlert("CWII_IPC_HLE_WiiMote: HID Output %x, %x",rChannel.SCID, rChannel.DCID);
PluginWiimote::Wiimote_Output(rChannel.DCID, pData, DataSize);
//return handshake
// u8 handshake = 0;
// SendL2capData(rChannel.DCID, &handshake, 1);
}
break;
case 0x13: // HID Input
{
PluginWiimote::Wiimote_Input(rChannel.DCID, pData, DataSize);
//return handshake
u8 handshake = 0;
SendL2capData(rChannel.DCID, &handshake, 1);
}
break;
default:
PanicAlert("channel %i has unknow PSM %x", pHeader->CID);
PanicAlert("channel 0x04%x has unknow PSM %x", pHeader->CID, rChannel.PSM);
break;
}
}
@ -263,7 +279,7 @@ void CWII_IPC_HLE_WiiMote::SendCommandToACL(u8 _Ident, u8 _Code, u8 _CommandLeng
m_pHost->SendACLFrame(GetConnectionHandle(), DataFrame, pHeader->Length + sizeof(SL2CAP_Header));
// dump raw data
/* // dump raw data
{
LOG(WIIMOTE, "m_pHost->SendACLFrame: 0x%x", GetConnectionHandle());
std::string Temp;
@ -274,13 +290,13 @@ void CWII_IPC_HLE_WiiMote::SendCommandToACL(u8 _Ident, u8 _Code, u8 _CommandLeng
Temp.append(Buffer);
}
LOG(WIIMOTE, " Data: %s", Temp.c_str());
}
}*/
}
void CWII_IPC_HLE_WiiMote::Connect()
{
SendConnectionRequest(HID_OUTPUT_SCID, HIDP_OUTPUT_CHANNEL);
SendConnectionRequest(HID_INPUT_SCID, HIDP_INPUT_CHANNEL);
SendConnectionRequest(0x0040, HIDP_OUTPUT_CHANNEL);
SendConnectionRequest(0x0041, HIDP_INPUT_CHANNEL);
}
void CWII_IPC_HLE_WiiMote::SendConnectionRequest(u16 scid, u16 psm)
@ -340,6 +356,9 @@ void CWII_IPC_HLE_WiiMote::SendConfigurationRequest(u16 scid, u16* MTU, u16* Flu
LOG(WIIMOTE, " Dcid: 0x%04x", cr->dcid);
LOG(WIIMOTE, " Flags: 0x%04x", cr->flags);
// hack:
static u8 ident = 99;
ident++;
SendCommandToACL(L2CAP_CONF_REQ, L2CAP_CONF_REQ, Offset, Buffer);
}
@ -368,7 +387,6 @@ void CWII_IPC_HLE_WiiMote::SignalChannel(u8* _pData, u32 _Size)
case L2CAP_DISCONN_REQ:
CommandDisconnectionReq(pCommand->ident, _pData, pCommand->len);
PanicAlert("SignalChannel - L2CAP_DISCONN_REQ (something went wrong)",pCommand->code);
break;
case L2CAP_CONF_RSP:
@ -389,16 +407,6 @@ void CWII_IPC_HLE_WiiMote::SignalChannel(u8* _pData, u32 _Size)
}
}
void CWII_IPC_HLE_WiiMote::HidOutput(u8* _pData, u32 _Size)
{
PluginWiimote::Wiimote_Output(_pData, _Size);
//return handshake
u8 handshake = 0;
SendL2capData(HID_OUTPUT_SCID, &handshake, 1);
}
void CWII_IPC_HLE_WiiMote::SendL2capData(u16 scid, const void* _pData, u32 _Size)
{
//allocate
@ -580,8 +588,6 @@ void CWII_IPC_HLE_WiiMote::CommandConnectionResponse(u8 _Ident, u8* _pData, u32
_dbg_assert_(WIIMOTE, DoesChannelExist(rsp->scid));
SChannel& rChannel = m_Channel[rsp->scid];
rChannel.DCID = rsp->dcid;
// SendConfigurationRequest(rsp->scid);
}
void CWII_IPC_HLE_WiiMote::CommandDisconnectionReq(u8 _Ident, u8* _pData, u32 _Size)
@ -800,7 +806,7 @@ void CWII_IPC_HLE_WiiMote::SDPSendServiceAttributeResponse(u16 cid, u16 Transact
m_pHost->SendACLFrame(GetConnectionHandle(), DataFrame, pHeader->Length + sizeof(SL2CAP_Header));
// dump raw data
/* // dump raw data
{
LOG(WIIMOTE, "test response: 0x%x", GetConnectionHandle());
for (u32 j=0; j<pHeader->Length + sizeof(SL2CAP_Header);)
@ -819,14 +825,14 @@ void CWII_IPC_HLE_WiiMote::SDPSendServiceAttributeResponse(u16 cid, u16 Transact
LOG(WIIMOTE, " Data: %s", Temp.c_str());
}
}
}*/
}
void CWII_IPC_HLE_WiiMote::HandleSDP(u16 cid, u8* _pData, u32 _Size)
{
// dump raw data
/* // dump raw data
{
LOG(WIIMOTE, "HandleSDP: 0x%x", GetConnectionHandle());
std::string Temp;
@ -838,7 +844,7 @@ void CWII_IPC_HLE_WiiMote::HandleSDP(u16 cid, u8* _pData, u32 _Size)
}
LOG(WIIMOTE, " Data: %s", Temp.c_str());
}
*/
CBigEndianBuffer buffer(_pData);

View File

@ -145,8 +145,6 @@ private:
void SignalChannel(u8* _pData, u32 _Size);
void HidOutput(u8* _pData, u32 _Size);
void SendConnectionRequest(u16 scid, u16 psm);
void SendConfigurationRequest(u16 scid, u16* MTU, u16* FlushTimeOut);

View File

@ -2500,7 +2500,7 @@ struct SHCIEventNumberOfCompletedPackets
{
u8 EventType;
u8 PayloadLength;
u8 value;
u8 NumberOfHandles;
u16 Connection_Handle;
u16 Number_Of_Completed_Packets;
};
@ -2514,6 +2514,16 @@ struct SHCIEventAuthenticationCompleted
};
struct SHCIEventModeChange
{
u8 EventType;
u8 PayloadLength;
u8 Status;
u16 Connection_Handle;
u8 CurrentMode;
u16 Value;
};
#ifdef __cplusplus
}
#endif

View File

@ -180,6 +180,9 @@ u32 lastPC;
std::string lastSymbol;
void LogManager::Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...)
{
if (m_LogSettings == NULL)
return;
// declarations
int v; // verbosity level
int type; // the log type, CONSOLE etc.

View File

@ -28,6 +28,7 @@ namespace PluginWiimote
TWiimote_Initialize Wiimote_Initialize = 0;
TWiimote_Shutdown Wiimote_Shutdown = 0;
TWiimote_Output Wiimote_Output = 0;
TWiimote_Input Wiimote_Input = 0;
TWiimote_Update Wiimote_Update = 0;
TWiimote_GetAttachedControllers Wiimote_GetAttachedControllers = 0;
TWiimote_DoState Wiimote_DoState = 0;
@ -50,6 +51,7 @@ namespace PluginWiimote
Wiimote_Initialize = 0;
Wiimote_Shutdown = 0;
Wiimote_Output = 0;
Wiimote_Input = 0;
Wiimote_Update = 0;
Wiimote_GetAttachedControllers = 0;
Wiimote_DoState = 0;
@ -65,6 +67,7 @@ namespace PluginWiimote
Wiimote_Initialize = reinterpret_cast<TWiimote_Initialize> (plugin.Get("Wiimote_Initialize"));
Wiimote_Shutdown = reinterpret_cast<TWiimote_Shutdown> (plugin.Get("Wiimote_Shutdown"));
Wiimote_Output = reinterpret_cast<TWiimote_Output> (plugin.Get("Wiimote_Output"));
Wiimote_Input = reinterpret_cast<TWiimote_Input> (plugin.Get("Wiimote_Input"));
Wiimote_Update = reinterpret_cast<TWiimote_Update> (plugin.Get("Wiimote_Update"));
Wiimote_GetAttachedControllers = reinterpret_cast<TWiimote_GetAttachedControllers> (plugin.Get("Wiimote_GetAttachedControllers"));
Wiimote_DoState = reinterpret_cast<TWiimote_DoState> (plugin.Get("Wiimote_DoState"));
@ -74,6 +77,7 @@ namespace PluginWiimote
LOG(MASTER_LOG, "%s: 0x%p", "Wiimote_Initialize", Wiimote_Initialize);
LOG(MASTER_LOG, "%s: 0x%p", "Wiimote_Shutdown", Wiimote_Shutdown);
LOG(MASTER_LOG, "%s: 0x%p", "Wiimote_Output", Wiimote_Output);
LOG(MASTER_LOG, "%s: 0x%p", "Wiimote_Input", Wiimote_Input);
LOG(MASTER_LOG, "%s: 0x%p", "Wiimote_Update", Wiimote_Update);
LOG(MASTER_LOG, "%s: 0x%p", "Wiimote_GetAttachedControllers", Wiimote_GetAttachedControllers);
LOG(MASTER_LOG, "%s: 0x%p", "Wiimote_DoState", Wiimote_DoState);
@ -81,6 +85,7 @@ namespace PluginWiimote
(Wiimote_Initialize != 0) &&
(Wiimote_Shutdown != 0) &&
(Wiimote_Output != 0) &&
(Wiimote_Input != 0) &&
(Wiimote_Update != 0) &&
(Wiimote_GetAttachedControllers != 0) &&
(Wiimote_DoState != 0))

View File

@ -33,19 +33,21 @@ typedef void (__cdecl* TDllConfig)(HWND);
typedef void (__cdecl* TWiimote_Initialize)(SWiimoteInitialize);
typedef void (__cdecl* TWiimote_Shutdown)();
typedef void (__cdecl* TWiimote_Update)();
typedef void (__cdecl* TWiimote_Output)(const void* _pData, u32 _Size);
typedef void (__cdecl* TWiimote_Output)(u16 _channelID, const void* _pData, u32 _Size);
typedef void (__cdecl* TWiimote_Input)(u16 _channelID, const void* _pData, u32 _Size);
typedef unsigned int (__cdecl* TWiimote_GetAttachedControllers)();
typedef void (__cdecl* TWiimote_DoState)(void *ptr, int mode);
// Function Pointers
extern TGetDllInfo GetDllInfo;
extern TDllConfig DllConfig;
extern TWiimote_Initialize Wiimote_Initialize;
extern TWiimote_Shutdown Wiimote_Shutdown;
extern TWiimote_Output Wiimote_Output;
extern TWiimote_Update Wiimote_Update;
extern TWiimote_GetAttachedControllers Wiimote_GetAttachedControllers;
extern TWiimote_DoState Wiimote_DoState;
extern TGetDllInfo GetDllInfo;
extern TDllConfig DllConfig;
extern TWiimote_Initialize Wiimote_Initialize;
extern TWiimote_Shutdown Wiimote_Shutdown;
extern TWiimote_Output Wiimote_Output;
extern TWiimote_Input Wiimote_Input;
extern TWiimote_Update Wiimote_Update;
extern TWiimote_GetAttachedControllers Wiimote_GetAttachedControllers;
extern TWiimote_DoState Wiimote_DoState;
} // end of namespace PluginWiimote