some more wpad stuff
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@974 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
c9a8672987
commit
6b021b874c
|
@ -308,7 +308,7 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
|
||||||
PluginWiimote::Wiimote_Update();
|
PluginWiimote::Wiimote_Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
static bool test = true;
|
static bool test = true;
|
||||||
if (GetAsyncKeyState(VK_LBUTTON) && GetAsyncKeyState(VK_RBUTTON))
|
if (GetAsyncKeyState(VK_LBUTTON) && GetAsyncKeyState(VK_RBUTTON))
|
||||||
{
|
{
|
||||||
|
@ -316,7 +316,7 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
|
||||||
{
|
{
|
||||||
for (size_t i=0; i<m_WiiMotes.size(); i++)
|
for (size_t i=0; i<m_WiiMotes.size(); i++)
|
||||||
{
|
{
|
||||||
// if (m_WiiMotes[i].EventPagingChanged(2))
|
if (m_WiiMotes[i].EventPagingChanged(2))
|
||||||
{
|
{
|
||||||
SendEventRequestConnection(m_WiiMotes[i].GetBD());
|
SendEventRequestConnection(m_WiiMotes[i].GetBD());
|
||||||
}
|
}
|
||||||
|
@ -324,10 +324,11 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
|
||||||
test = false;
|
test = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
/* else
|
||||||
{
|
{
|
||||||
test = true;
|
test = true;
|
||||||
}
|
}*/
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -540,6 +541,32 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRequestLinkKey(bdaddr_t _bd)
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventLinkKeyNotification(const CWII_IPC_HLE_WiiMote& _rWiiMote)
|
||||||
|
{
|
||||||
|
SQueuedEvent Event(sizeof(SHCIEventLinkKeyNotification), 0);
|
||||||
|
|
||||||
|
SHCIEventLinkKeyNotification* pEventLinkKey = (SHCIEventLinkKeyNotification*)Event.m_buffer;
|
||||||
|
|
||||||
|
pEventLinkKey->EventType = 0x18;
|
||||||
|
pEventLinkKey->PayloadLength = sizeof(SHCIEventLinkKeyNotification) - 2;
|
||||||
|
pEventLinkKey->bdaddr = _rWiiMote.GetBD();
|
||||||
|
memcpy(pEventLinkKey->LinkKey, _rWiiMote.GetLinkKey(), 16);
|
||||||
|
pEventLinkKey->Key_Type = 0x00;
|
||||||
|
|
||||||
|
AddEventToQueue(Event);
|
||||||
|
|
||||||
|
|
||||||
|
LOG(WIIMOTE, "Event: SendEventLinkKeyNotification");
|
||||||
|
LOG(WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x",
|
||||||
|
pEventLinkKey->bdaddr.b[0], pEventLinkKey->bdaddr.b[1], pEventLinkKey->bdaddr.b[2],
|
||||||
|
pEventLinkKey->bdaddr.b[3], pEventLinkKey->bdaddr.b[4], pEventLinkKey->bdaddr.b[5]);
|
||||||
|
LOG(WIIMOTE, " link key: no reason to show it...");
|
||||||
|
LOG(WIIMOTE, " key type: 0x02%x", pEventLinkKey->Key_Type);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventConnectionComplete(bdaddr_t _bd)
|
bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventConnectionComplete(bdaddr_t _bd)
|
||||||
{
|
{
|
||||||
|
@ -588,7 +615,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventConnectionComplete(bdaddr_t _
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRoleChange(bdaddr_t _bd)
|
bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRoleChange(bdaddr_t _bd, bool _master)
|
||||||
{
|
{
|
||||||
CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_bd);
|
CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(_bd);
|
||||||
if (pWiiMote == NULL)
|
if (pWiiMote == NULL)
|
||||||
|
@ -607,7 +634,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRoleChange(bdaddr_t _bd)
|
||||||
pRoleChange->PayloadLength = sizeof(SHCIEventRoleChange) - 2;
|
pRoleChange->PayloadLength = sizeof(SHCIEventRoleChange) - 2;
|
||||||
pRoleChange->Status = 0x00;
|
pRoleChange->Status = 0x00;
|
||||||
pRoleChange->bdaddr = pWiiMote->GetBD();
|
pRoleChange->bdaddr = pWiiMote->GetBD();
|
||||||
pRoleChange->NewRole = 0x00;
|
pRoleChange->NewRole = _master ? 0x00 : 0x01;
|
||||||
|
|
||||||
AddEventToQueue(Event);
|
AddEventToQueue(Event);
|
||||||
|
|
||||||
|
@ -984,6 +1011,11 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::ExecuteHCICommandMessage(const SHCICom
|
||||||
CommandLinkKeyNegRep(pInput);
|
CommandLinkKeyNegRep(pInput);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case HCI_CMD_LINK_KEY_REP:
|
||||||
|
CommandLinkKeyRep(pInput);
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// --- default ---
|
// --- default ---
|
||||||
//
|
//
|
||||||
|
@ -1123,9 +1155,6 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadStoredLinkKey(u8* _Input)
|
||||||
// command parameters
|
// command parameters
|
||||||
hci_read_stored_link_key_cp* ReadStoredLinkKey = (hci_read_stored_link_key_cp*)_Input;
|
hci_read_stored_link_key_cp* ReadStoredLinkKey = (hci_read_stored_link_key_cp*)_Input;
|
||||||
#endif
|
#endif
|
||||||
// reply
|
|
||||||
hci_read_stored_link_key_rp Reply;
|
|
||||||
Reply.status = 0x00;
|
|
||||||
|
|
||||||
LOG(WIIMOTE, "Command: HCI_CMD_READ_STORED_LINK_KEY:");
|
LOG(WIIMOTE, "Command: HCI_CMD_READ_STORED_LINK_KEY:");
|
||||||
LOG(WIIMOTE, "input:");
|
LOG(WIIMOTE, "input:");
|
||||||
|
@ -1136,7 +1165,28 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadStoredLinkKey(u8* _Input)
|
||||||
LOG(WIIMOTE, "return:");
|
LOG(WIIMOTE, "return:");
|
||||||
LOG(WIIMOTE, " no idea what i should answer :)");
|
LOG(WIIMOTE, " no idea what i should answer :)");
|
||||||
|
|
||||||
|
|
||||||
|
// reply
|
||||||
|
hci_read_stored_link_key_rp Reply;
|
||||||
|
Reply.status = 0x00;
|
||||||
|
|
||||||
|
Reply.max_num_keys = 255;
|
||||||
|
if (ReadStoredLinkKey->read_all)
|
||||||
|
{
|
||||||
|
Reply.num_keys_read = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PanicAlert("CommandReadStoredLinkKey");
|
||||||
|
}
|
||||||
|
|
||||||
SendEventCommandComplete(HCI_CMD_READ_STORED_LINK_KEY, &Reply, sizeof(hci_read_stored_link_key_rp));
|
SendEventCommandComplete(HCI_CMD_READ_STORED_LINK_KEY, &Reply, sizeof(hci_read_stored_link_key_rp));
|
||||||
|
|
||||||
|
// generate link key
|
||||||
|
for (int i=0; i<m_WiiMotes.size(); i++)
|
||||||
|
{
|
||||||
|
SendEventLinkKeyNotification(m_WiiMotes[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteUnitClass(u8* _Input)
|
void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteUnitClass(u8* _Input)
|
||||||
|
@ -1495,6 +1545,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandAcceptCon(u8* _Input)
|
||||||
pWiimote->EventConnectionAccepted();
|
pWiimote->EventConnectionAccepted();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SendEventRoleChange(pAcceptCon->bdaddr, false);
|
||||||
SendEventConnectionComplete(pAcceptCon->bdaddr);
|
SendEventConnectionComplete(pAcceptCon->bdaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1510,7 +1561,10 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadClockOffset(u8* _Input)
|
||||||
SendEventCommandStatus(HCI_CMD_READ_CLOCK_OFFSET);
|
SendEventCommandStatus(HCI_CMD_READ_CLOCK_OFFSET);
|
||||||
SendEventReadClockOffsetComplete(pReadClockOffset->con_handle);
|
SendEventReadClockOffsetComplete(pReadClockOffset->con_handle);
|
||||||
|
|
||||||
//CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(pReadClockOffset->con_handle);
|
CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(pReadClockOffset->con_handle);
|
||||||
|
SendEventRequestLinkKey(pWiiMote->GetBD());
|
||||||
|
|
||||||
|
// CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(pReadClockOffset->con_handle);
|
||||||
// pWiiMote->Connect();
|
// pWiiMote->Connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1646,6 +1700,33 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandLinkKeyNegRep(u8* _Input)
|
||||||
// pWiiMote->Connect();
|
// pWiiMote->Connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandLinkKeyRep(u8* _Input)
|
||||||
|
{
|
||||||
|
// command parameters
|
||||||
|
hci_link_key_rep_cp* pKeyRep = (hci_link_key_rep_cp*)_Input;
|
||||||
|
|
||||||
|
LOG(WIIMOTE, "Command: HCI_CMD_LINK_KEY_REP");
|
||||||
|
LOG(WIIMOTE, "Input:");
|
||||||
|
LOG(WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x",
|
||||||
|
pKeyRep->bdaddr.b[0], pKeyRep->bdaddr.b[1], pKeyRep->bdaddr.b[2],
|
||||||
|
pKeyRep->bdaddr.b[3], pKeyRep->bdaddr.b[4], pKeyRep->bdaddr.b[5]);
|
||||||
|
LOG(WIIMOTE, " link key: %02x (all the values are the same)", pKeyRep->key[0]);
|
||||||
|
|
||||||
|
|
||||||
|
hci_link_key_rep_rp Reply;
|
||||||
|
Reply.status = 0x00;
|
||||||
|
Reply.bdaddr = pKeyRep->bdaddr;
|
||||||
|
|
||||||
|
SendEventCommandComplete(HCI_CMD_LINK_KEY_REP, &Reply, sizeof(hci_link_key_rep_rp));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CWII_IPC_HLE_WiiMote* pWiiMote = AccessWiiMote(pKeyRep->bdaddr);
|
||||||
|
SendEventAuthenticationCompleted(pWiiMote->GetConnectionHandle());
|
||||||
|
|
||||||
|
pWiiMote->Connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -157,12 +157,13 @@ private:
|
||||||
bool SendEventReadClockOffsetComplete(u16 _connectionHandle);
|
bool SendEventReadClockOffsetComplete(u16 _connectionHandle);
|
||||||
bool SendEventReadRemoteVerInfo(u16 _connectionHandle);
|
bool SendEventReadRemoteVerInfo(u16 _connectionHandle);
|
||||||
bool SendEventReadRemoteFeatures(u16 _connectionHandle);
|
bool SendEventReadRemoteFeatures(u16 _connectionHandle);
|
||||||
bool SendEventRoleChange(bdaddr_t _bd);
|
bool SendEventRoleChange(bdaddr_t _bd, bool _master);
|
||||||
bool SendEventNumberOfCompletedPackets(u16 _connectionHandle, u16 _count);
|
bool SendEventNumberOfCompletedPackets(u16 _connectionHandle, u16 _count);
|
||||||
bool SendEventAuthenticationCompleted(u16 _connectionHandle);
|
bool SendEventAuthenticationCompleted(u16 _connectionHandle);
|
||||||
bool SendEventModeChange(u16 _connectionHandle, u8 _mode, u16 _value);
|
bool SendEventModeChange(u16 _connectionHandle, u8 _mode, u16 _value);
|
||||||
bool SendEventDisconnect(u16 _connectionHandle, u8 _Reason);
|
bool SendEventDisconnect(u16 _connectionHandle, u8 _Reason);
|
||||||
bool SendEventRequestLinkKey(bdaddr_t _bd);
|
bool SendEventRequestLinkKey(bdaddr_t _bd);
|
||||||
|
bool SendEventLinkKeyNotification(const CWII_IPC_HLE_WiiMote& _rWiiMote);
|
||||||
|
|
||||||
// Execute HCI Message
|
// Execute HCI Message
|
||||||
void ExecuteHCICommandMessage(const SHCICommandMessage& _rCtrlMessage);
|
void ExecuteHCICommandMessage(const SHCICommandMessage& _rCtrlMessage);
|
||||||
|
@ -182,6 +183,7 @@ private:
|
||||||
void CommandInquiry(u8* _Input);
|
void CommandInquiry(u8* _Input);
|
||||||
void CommandDisconnect(u8* _Input);
|
void CommandDisconnect(u8* _Input);
|
||||||
void CommandLinkKeyNegRep(u8* _Input);
|
void CommandLinkKeyNegRep(u8* _Input);
|
||||||
|
void CommandLinkKeyRep(u8* _Input);
|
||||||
|
|
||||||
// OGF 0x02 Link policy commands and return parameters
|
// OGF 0x02 Link policy commands and return parameters
|
||||||
void CommandWriteLinkPolicy(u8* _Input);
|
void CommandWriteLinkPolicy(u8* _Input);
|
||||||
|
|
|
@ -184,6 +184,8 @@ CWII_IPC_HLE_WiiMote::CWII_IPC_HLE_WiiMote(CWII_IPC_HLE_Device_usb_oh1_57e_305*
|
||||||
|
|
||||||
lmp_version = 0x2;
|
lmp_version = 0x2;
|
||||||
lmp_subversion = 0x229;
|
lmp_subversion = 0x229;
|
||||||
|
|
||||||
|
memset(m_LinkKey, _Number+1, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_WiiMote::EventConnectionAccepted()
|
void CWII_IPC_HLE_WiiMote::EventConnectionAccepted()
|
||||||
|
@ -322,10 +324,10 @@ void CWII_IPC_HLE_WiiMote::SendCommandToACL(u8 _Ident, u8 _Code, u8 _CommandLeng
|
||||||
|
|
||||||
void CWII_IPC_HLE_WiiMote::Connect()
|
void CWII_IPC_HLE_WiiMote::Connect()
|
||||||
{
|
{
|
||||||
SendConnectionRequest(0x0040, 1);
|
// SendConnectionRequest(0x0040, 1);
|
||||||
|
|
||||||
// SendConnectionRequest(0x0041, HIDP_OUTPUT_CHANNEL);
|
SendConnectionRequest(0x0041, HIDP_OUTPUT_CHANNEL);
|
||||||
// SendConnectionRequest(0x0042, HIDP_INPUT_CHANNEL);
|
SendConnectionRequest(0x0042, HIDP_INPUT_CHANNEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWII_IPC_HLE_WiiMote::SendConnectionRequest(u16 scid, u16 psm)
|
void CWII_IPC_HLE_WiiMote::SendConnectionRequest(u16 scid, u16 psm)
|
||||||
|
|
|
@ -113,6 +113,8 @@ public:
|
||||||
|
|
||||||
void SendL2capData(u16 scid, const void* _pData, u32 _Size); //from wiimote
|
void SendL2capData(u16 scid, const void* _pData, u32 _Size); //from wiimote
|
||||||
|
|
||||||
|
const u8* GetLinkKey() const { return m_LinkKey; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool m_Connected;
|
bool m_Connected;
|
||||||
|
@ -130,6 +132,7 @@ private:
|
||||||
|
|
||||||
u16 lmp_subversion;
|
u16 lmp_subversion;
|
||||||
|
|
||||||
|
u8 m_LinkKey[16];
|
||||||
|
|
||||||
std::string m_Name;
|
std::string m_Name;
|
||||||
|
|
||||||
|
|
|
@ -2541,6 +2541,15 @@ struct SHCIEventRequestLinkKey
|
||||||
bdaddr_t bdaddr;
|
bdaddr_t bdaddr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct SHCIEventLinkKeyNotification
|
||||||
|
{
|
||||||
|
u8 EventType;
|
||||||
|
u8 PayloadLength;
|
||||||
|
bdaddr_t bdaddr;
|
||||||
|
u8 LinkKey[16];
|
||||||
|
u8 Key_Type;
|
||||||
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue