BTEmu: Amend class member variable naming
This commit is contained in:
parent
77f6e50493
commit
16c6e9fa57
|
@ -29,9 +29,9 @@
|
||||||
|
|
||||||
namespace IOS::HLE
|
namespace IOS::HLE
|
||||||
{
|
{
|
||||||
SQueuedEvent::SQueuedEvent(u32 size, u16 handle) : m_size(size), m_connectionHandle(handle)
|
SQueuedEvent::SQueuedEvent(u32 size_, u16 handle) : size(size_), connection_handle(handle)
|
||||||
{
|
{
|
||||||
if (m_size > 1024)
|
if (size > 1024)
|
||||||
PanicAlert("SQueuedEvent: The size is too large.");
|
PanicAlert("SQueuedEvent: The size is too large.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ BluetoothEmu::BluetoothEmu(Kernel& ios, const std::string& device_name)
|
||||||
if (!Core::WantsDeterminism())
|
if (!Core::WantsDeterminism())
|
||||||
BackUpBTInfoSection(&sysconf);
|
BackUpBTInfoSection(&sysconf);
|
||||||
|
|
||||||
_conf_pads BT_DINF{};
|
ConfPads BT_DINF{};
|
||||||
bdaddr_t tmpBD;
|
bdaddr_t tmpBD;
|
||||||
u8 i = 0;
|
u8 i = 0;
|
||||||
while (i < MAX_BBMOTES)
|
while (i < MAX_BBMOTES)
|
||||||
|
@ -67,7 +67,7 @@ BluetoothEmu::BluetoothEmu(Kernel& ios, const std::string& device_name)
|
||||||
|
|
||||||
DEBUG_LOG(IOS_WIIMOTE, "Wii Remote %d BT ID %x,%x,%x,%x,%x,%x", i, tmpBD[0], tmpBD[1], tmpBD[2],
|
DEBUG_LOG(IOS_WIIMOTE, "Wii Remote %d BT ID %x,%x,%x,%x,%x,%x", i, tmpBD[0], tmpBD[1], tmpBD[2],
|
||||||
tmpBD[3], tmpBD[4], tmpBD[5]);
|
tmpBD[3], tmpBD[4], tmpBD[5]);
|
||||||
m_WiiMotes.emplace_back(this, i, tmpBD, g_wiimote_sources[i] != WIIMOTE_SRC_NONE);
|
m_wiimotes.emplace_back(this, i, tmpBD, g_wiimote_sources[i] != WIIMOTE_SRC_NONE);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,15 +76,15 @@ BluetoothEmu::BluetoothEmu(Kernel& ios, const std::string& device_name)
|
||||||
// save now so that when games load sysconf file it includes the new Wii Remotes
|
// save now so that when games load sysconf file it includes the new Wii Remotes
|
||||||
// and the correct order for connected Wii Remotes
|
// and the correct order for connected Wii Remotes
|
||||||
auto& section = sysconf.GetOrAddEntry("BT.DINF", SysConf::Entry::Type::BigArray)->bytes;
|
auto& section = sysconf.GetOrAddEntry("BT.DINF", SysConf::Entry::Type::BigArray)->bytes;
|
||||||
section.resize(sizeof(_conf_pads));
|
section.resize(sizeof(ConfPads));
|
||||||
std::memcpy(section.data(), &BT_DINF, sizeof(_conf_pads));
|
std::memcpy(section.data(), &BT_DINF, sizeof(ConfPads));
|
||||||
if (!sysconf.Save())
|
if (!sysconf.Save())
|
||||||
PanicAlertT("Failed to write BT.DINF to SYSCONF");
|
PanicAlertT("Failed to write BT.DINF to SYSCONF");
|
||||||
}
|
}
|
||||||
|
|
||||||
BluetoothEmu::~BluetoothEmu()
|
BluetoothEmu::~BluetoothEmu()
|
||||||
{
|
{
|
||||||
m_WiiMotes.clear();
|
m_wiimotes.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -111,18 +111,18 @@ void BluetoothEmu::DoState(PointerWrap& p)
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Do(m_is_active);
|
p.Do(m_is_active);
|
||||||
p.Do(m_ControllerBD);
|
p.Do(m_controller_bd);
|
||||||
DoStateForMessage(m_ios, p, m_CtrlSetup);
|
DoStateForMessage(m_ios, p, m_ctrl_setup);
|
||||||
DoStateForMessage(m_ios, p, m_HCIEndpoint);
|
DoStateForMessage(m_ios, p, m_hci_endpoint);
|
||||||
DoStateForMessage(m_ios, p, m_ACLEndpoint);
|
DoStateForMessage(m_ios, p, m_acl_endpoint);
|
||||||
p.Do(m_last_ticks);
|
p.Do(m_last_ticks);
|
||||||
p.DoArray(m_PacketCount);
|
p.DoArray(m_packet_count);
|
||||||
p.Do(m_ScanEnable);
|
p.Do(m_scan_enable);
|
||||||
p.Do(m_EventQueue);
|
p.Do(m_event_queue);
|
||||||
m_acl_pool.DoState(p);
|
m_acl_pool.DoState(p);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < MAX_BBMOTES; i++)
|
for (unsigned int i = 0; i < MAX_BBMOTES; i++)
|
||||||
m_WiiMotes[i].DoState(p);
|
m_wiimotes[i].DoState(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BluetoothEmu::RemoteDisconnect(u16 _connectionHandle)
|
bool BluetoothEmu::RemoteDisconnect(u16 _connectionHandle)
|
||||||
|
@ -133,11 +133,11 @@ bool BluetoothEmu::RemoteDisconnect(u16 _connectionHandle)
|
||||||
IPCCommandResult BluetoothEmu::Close(u32 fd)
|
IPCCommandResult BluetoothEmu::Close(u32 fd)
|
||||||
{
|
{
|
||||||
// Clean up state
|
// Clean up state
|
||||||
m_ScanEnable = 0;
|
m_scan_enable = 0;
|
||||||
m_last_ticks = 0;
|
m_last_ticks = 0;
|
||||||
memset(m_PacketCount, 0, sizeof(m_PacketCount));
|
memset(m_packet_count, 0, sizeof(m_packet_count));
|
||||||
m_HCIEndpoint.reset();
|
m_hci_endpoint.reset();
|
||||||
m_ACLEndpoint.reset();
|
m_acl_endpoint.reset();
|
||||||
|
|
||||||
return Device::Close(fd);
|
return Device::Close(fd);
|
||||||
}
|
}
|
||||||
|
@ -149,10 +149,10 @@ IPCCommandResult BluetoothEmu::IOCtlV(const IOCtlVRequest& request)
|
||||||
{
|
{
|
||||||
case USB::IOCTLV_USBV0_CTRLMSG: // HCI command is received from the stack
|
case USB::IOCTLV_USBV0_CTRLMSG: // HCI command is received from the stack
|
||||||
{
|
{
|
||||||
m_CtrlSetup = std::make_unique<USB::V0CtrlMessage>(m_ios, request);
|
m_ctrl_setup = std::make_unique<USB::V0CtrlMessage>(m_ios, request);
|
||||||
// Replies are generated inside
|
// Replies are generated inside
|
||||||
ExecuteHCICommandMessage(*m_CtrlSetup);
|
ExecuteHCICommandMessage(*m_ctrl_setup);
|
||||||
m_CtrlSetup.reset();
|
m_ctrl_setup.reset();
|
||||||
send_reply = false;
|
send_reply = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ IPCCommandResult BluetoothEmu::IOCtlV(const IOCtlVRequest& request)
|
||||||
}
|
}
|
||||||
case ACL_DATA_IN: // We are given an ACL buffer to fill
|
case ACL_DATA_IN: // We are given an ACL buffer to fill
|
||||||
{
|
{
|
||||||
m_ACLEndpoint = std::make_unique<USB::V0BulkMessage>(m_ios, request);
|
m_acl_endpoint = std::make_unique<USB::V0BulkMessage>(m_ios, request);
|
||||||
DEBUG_LOG(IOS_WIIMOTE, "ACL_DATA_IN: 0x%08x ", request.address);
|
DEBUG_LOG(IOS_WIIMOTE, "ACL_DATA_IN: 0x%08x ", request.address);
|
||||||
send_reply = false;
|
send_reply = false;
|
||||||
break;
|
break;
|
||||||
|
@ -194,7 +194,7 @@ IPCCommandResult BluetoothEmu::IOCtlV(const IOCtlVRequest& request)
|
||||||
const USB::V0IntrMessage ctrl{m_ios, request};
|
const USB::V0IntrMessage ctrl{m_ios, request};
|
||||||
if (ctrl.endpoint == HCI_EVENT) // We are given a HCI buffer to fill
|
if (ctrl.endpoint == HCI_EVENT) // We are given a HCI buffer to fill
|
||||||
{
|
{
|
||||||
m_HCIEndpoint = std::make_unique<USB::V0IntrMessage>(m_ios, request);
|
m_hci_endpoint = std::make_unique<USB::V0IntrMessage>(m_ios, request);
|
||||||
DEBUG_LOG(IOS_WIIMOTE, "HCI_EVENT: 0x%08x ", request.address);
|
DEBUG_LOG(IOS_WIIMOTE, "HCI_EVENT: 0x%08x ", request.address);
|
||||||
send_reply = false;
|
send_reply = false;
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ void BluetoothEmu::SendToDevice(u16 _ConnectionHandle, u8* _pData, u32 _Size)
|
||||||
|
|
||||||
void BluetoothEmu::IncDataPacket(u16 _ConnectionHandle)
|
void BluetoothEmu::IncDataPacket(u16 _ConnectionHandle)
|
||||||
{
|
{
|
||||||
m_PacketCount[_ConnectionHandle & 0xff]++;
|
m_packet_count[_ConnectionHandle & 0xff]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Here we send ACL packets to CPU. They will consist of header + data.
|
// Here we send ACL packets to CPU. They will consist of header + data.
|
||||||
|
@ -235,21 +235,21 @@ void BluetoothEmu::SendACLPacket(u16 connection_handle, const u8* data, u32 size
|
||||||
{
|
{
|
||||||
DEBUG_LOG(IOS_WIIMOTE, "ACL packet from %x ready to send to stack...", connection_handle);
|
DEBUG_LOG(IOS_WIIMOTE, "ACL packet from %x ready to send to stack...", connection_handle);
|
||||||
|
|
||||||
if (m_ACLEndpoint && !m_HCIEndpoint && m_EventQueue.empty())
|
if (m_acl_endpoint && !m_hci_endpoint && m_event_queue.empty())
|
||||||
{
|
{
|
||||||
DEBUG_LOG(IOS_WIIMOTE, "ACL endpoint valid, sending packet to %08x",
|
DEBUG_LOG(IOS_WIIMOTE, "ACL endpoint valid, sending packet to %08x",
|
||||||
m_ACLEndpoint->ios_request.address);
|
m_acl_endpoint->ios_request.address);
|
||||||
|
|
||||||
hci_acldata_hdr_t* header =
|
hci_acldata_hdr_t* header =
|
||||||
reinterpret_cast<hci_acldata_hdr_t*>(Memory::GetPointer(m_ACLEndpoint->data_address));
|
reinterpret_cast<hci_acldata_hdr_t*>(Memory::GetPointer(m_acl_endpoint->data_address));
|
||||||
header->con_handle = HCI_MK_CON_HANDLE(connection_handle, HCI_PACKET_START, HCI_POINT2POINT);
|
header->con_handle = HCI_MK_CON_HANDLE(connection_handle, HCI_PACKET_START, HCI_POINT2POINT);
|
||||||
header->length = size;
|
header->length = size;
|
||||||
|
|
||||||
// Write the packet to the buffer
|
// Write the packet to the buffer
|
||||||
memcpy(reinterpret_cast<u8*>(header) + sizeof(hci_acldata_hdr_t), data, header->length);
|
memcpy(reinterpret_cast<u8*>(header) + sizeof(hci_acldata_hdr_t), data, header->length);
|
||||||
|
|
||||||
m_ios.EnqueueIPCReply(m_ACLEndpoint->ios_request, sizeof(hci_acldata_hdr_t) + size);
|
m_ios.EnqueueIPCReply(m_acl_endpoint->ios_request, sizeof(hci_acldata_hdr_t) + size);
|
||||||
m_ACLEndpoint.reset();
|
m_acl_endpoint.reset();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -265,70 +265,70 @@ void BluetoothEmu::SendACLPacket(u16 connection_handle, const u8* data, u32 size
|
||||||
// rather than enqueue it to some other memory and this will do good for StateSave
|
// rather than enqueue it to some other memory and this will do good for StateSave
|
||||||
void BluetoothEmu::AddEventToQueue(const SQueuedEvent& _event)
|
void BluetoothEmu::AddEventToQueue(const SQueuedEvent& _event)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(IOS_WIIMOTE, "HCI event %x completed...", ((hci_event_hdr_t*)_event.m_buffer)->event);
|
DEBUG_LOG(IOS_WIIMOTE, "HCI event %x completed...", ((hci_event_hdr_t*)_event.buffer)->event);
|
||||||
|
|
||||||
if (m_HCIEndpoint)
|
if (m_hci_endpoint)
|
||||||
{
|
{
|
||||||
if (m_EventQueue.empty()) // fast path :)
|
if (m_event_queue.empty()) // fast path :)
|
||||||
{
|
{
|
||||||
DEBUG_LOG(IOS_WIIMOTE, "HCI endpoint valid, sending packet to %08x",
|
DEBUG_LOG(IOS_WIIMOTE, "HCI endpoint valid, sending packet to %08x",
|
||||||
m_HCIEndpoint->ios_request.address);
|
m_hci_endpoint->ios_request.address);
|
||||||
m_HCIEndpoint->FillBuffer(_event.m_buffer, _event.m_size);
|
m_hci_endpoint->FillBuffer(_event.buffer, _event.size);
|
||||||
|
|
||||||
// Send a reply to indicate HCI buffer is filled
|
// Send a reply to indicate HCI buffer is filled
|
||||||
m_ios.EnqueueIPCReply(m_HCIEndpoint->ios_request, _event.m_size);
|
m_ios.EnqueueIPCReply(m_hci_endpoint->ios_request, _event.size);
|
||||||
m_HCIEndpoint.reset();
|
m_hci_endpoint.reset();
|
||||||
}
|
}
|
||||||
else // push new one, pop oldest
|
else // push new one, pop oldest
|
||||||
{
|
{
|
||||||
DEBUG_LOG(IOS_WIIMOTE, "HCI endpoint not currently valid, queueing (%zu)...",
|
DEBUG_LOG(IOS_WIIMOTE, "HCI endpoint not currently valid, queueing (%zu)...",
|
||||||
m_EventQueue.size());
|
m_event_queue.size());
|
||||||
m_EventQueue.push_back(_event);
|
m_event_queue.push_back(_event);
|
||||||
const SQueuedEvent& event = m_EventQueue.front();
|
const SQueuedEvent& event = m_event_queue.front();
|
||||||
DEBUG_LOG(IOS_WIIMOTE,
|
DEBUG_LOG(IOS_WIIMOTE,
|
||||||
"HCI event %x "
|
"HCI event %x "
|
||||||
"being written from queue (%zu) to %08x...",
|
"being written from queue (%zu) to %08x...",
|
||||||
((hci_event_hdr_t*)event.m_buffer)->event, m_EventQueue.size() - 1,
|
((hci_event_hdr_t*)event.buffer)->event, m_event_queue.size() - 1,
|
||||||
m_HCIEndpoint->ios_request.address);
|
m_hci_endpoint->ios_request.address);
|
||||||
m_HCIEndpoint->FillBuffer(event.m_buffer, event.m_size);
|
m_hci_endpoint->FillBuffer(event.buffer, event.size);
|
||||||
|
|
||||||
// Send a reply to indicate HCI buffer is filled
|
// Send a reply to indicate HCI buffer is filled
|
||||||
m_ios.EnqueueIPCReply(m_HCIEndpoint->ios_request, event.m_size);
|
m_ios.EnqueueIPCReply(m_hci_endpoint->ios_request, event.size);
|
||||||
m_HCIEndpoint.reset();
|
m_hci_endpoint.reset();
|
||||||
m_EventQueue.pop_front();
|
m_event_queue.pop_front();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DEBUG_LOG(IOS_WIIMOTE, "HCI endpoint not currently valid, queuing (%zu)...",
|
DEBUG_LOG(IOS_WIIMOTE, "HCI endpoint not currently valid, queuing (%zu)...",
|
||||||
m_EventQueue.size());
|
m_event_queue.size());
|
||||||
m_EventQueue.push_back(_event);
|
m_event_queue.push_back(_event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BluetoothEmu::Update()
|
void BluetoothEmu::Update()
|
||||||
{
|
{
|
||||||
// check HCI queue
|
// check HCI queue
|
||||||
if (!m_EventQueue.empty() && m_HCIEndpoint)
|
if (!m_event_queue.empty() && m_hci_endpoint)
|
||||||
{
|
{
|
||||||
// an endpoint has become available, and we have a stored response.
|
// an endpoint has become available, and we have a stored response.
|
||||||
const SQueuedEvent& event = m_EventQueue.front();
|
const SQueuedEvent& event = m_event_queue.front();
|
||||||
DEBUG_LOG(IOS_WIIMOTE, "HCI event %x being written from queue (%zu) to %08x...",
|
DEBUG_LOG(IOS_WIIMOTE, "HCI event %x being written from queue (%zu) to %08x...",
|
||||||
((hci_event_hdr_t*)event.m_buffer)->event, m_EventQueue.size() - 1,
|
((hci_event_hdr_t*)event.buffer)->event, m_event_queue.size() - 1,
|
||||||
m_HCIEndpoint->ios_request.address);
|
m_hci_endpoint->ios_request.address);
|
||||||
m_HCIEndpoint->FillBuffer(event.m_buffer, event.m_size);
|
m_hci_endpoint->FillBuffer(event.buffer, event.size);
|
||||||
|
|
||||||
// Send a reply to indicate HCI buffer is filled
|
// Send a reply to indicate HCI buffer is filled
|
||||||
m_ios.EnqueueIPCReply(m_HCIEndpoint->ios_request, event.m_size);
|
m_ios.EnqueueIPCReply(m_hci_endpoint->ios_request, event.size);
|
||||||
m_HCIEndpoint.reset();
|
m_hci_endpoint.reset();
|
||||||
m_EventQueue.pop_front();
|
m_event_queue.pop_front();
|
||||||
}
|
}
|
||||||
|
|
||||||
// check ACL queue
|
// check ACL queue
|
||||||
if (!m_acl_pool.IsEmpty() && m_ACLEndpoint && m_EventQueue.empty())
|
if (!m_acl_pool.IsEmpty() && m_acl_endpoint && m_event_queue.empty())
|
||||||
{
|
{
|
||||||
m_acl_pool.WriteToEndpoint(*m_ACLEndpoint);
|
m_acl_pool.WriteToEndpoint(*m_acl_endpoint);
|
||||||
m_ACLEndpoint.reset();
|
m_acl_endpoint.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
// We wait for ScanEnable to be sent from the Bluetooth stack through HCI_CMD_WRITE_SCAN_ENABLE
|
// We wait for ScanEnable to be sent from the Bluetooth stack through HCI_CMD_WRITE_SCAN_ENABLE
|
||||||
|
@ -337,19 +337,19 @@ void BluetoothEmu::Update()
|
||||||
// FiRES: TODO find a better way to do this
|
// FiRES: TODO find a better way to do this
|
||||||
|
|
||||||
// Create ACL connection
|
// Create ACL connection
|
||||||
if (m_HCIEndpoint && (m_ScanEnable & HCI_PAGE_SCAN_ENABLE))
|
if (m_hci_endpoint && (m_scan_enable & HCI_PAGE_SCAN_ENABLE))
|
||||||
{
|
{
|
||||||
for (const auto& wiimote : m_WiiMotes)
|
for (const auto& wiimote : m_wiimotes)
|
||||||
{
|
{
|
||||||
if (wiimote.EventPagingChanged(m_ScanEnable))
|
if (wiimote.EventPagingChanged(m_scan_enable))
|
||||||
SendEventRequestConnection(wiimote);
|
SendEventRequestConnection(wiimote);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Link channels when connected
|
// Link channels when connected
|
||||||
if (m_ACLEndpoint)
|
if (m_acl_endpoint)
|
||||||
{
|
{
|
||||||
for (auto& wiimote : m_WiiMotes)
|
for (auto& wiimote : m_wiimotes)
|
||||||
{
|
{
|
||||||
if (wiimote.LinkChannel())
|
if (wiimote.LinkChannel())
|
||||||
break;
|
break;
|
||||||
|
@ -363,8 +363,8 @@ void BluetoothEmu::Update()
|
||||||
if (now - m_last_ticks > interval)
|
if (now - m_last_ticks > interval)
|
||||||
{
|
{
|
||||||
g_controller_interface.UpdateInput();
|
g_controller_interface.UpdateInput();
|
||||||
for (unsigned int i = 0; i < m_WiiMotes.size(); i++)
|
for (unsigned int i = 0; i < m_wiimotes.size(); i++)
|
||||||
Wiimote::Update(i, m_WiiMotes[i].IsConnected());
|
Wiimote::Update(i, m_wiimotes[i].IsConnected());
|
||||||
m_last_ticks = now;
|
m_last_ticks = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@ bool BluetoothEmu::SendEventInquiryComplete()
|
||||||
{
|
{
|
||||||
SQueuedEvent Event(sizeof(SHCIEventInquiryComplete), 0);
|
SQueuedEvent Event(sizeof(SHCIEventInquiryComplete), 0);
|
||||||
|
|
||||||
SHCIEventInquiryComplete* pInquiryComplete = (SHCIEventInquiryComplete*)Event.m_buffer;
|
SHCIEventInquiryComplete* pInquiryComplete = (SHCIEventInquiryComplete*)Event.buffer;
|
||||||
pInquiryComplete->EventType = HCI_EVENT_INQUIRY_COMPL;
|
pInquiryComplete->EventType = HCI_EVENT_INQUIRY_COMPL;
|
||||||
pInquiryComplete->PayloadLength = sizeof(SHCIEventInquiryComplete) - 2;
|
pInquiryComplete->PayloadLength = sizeof(SHCIEventInquiryComplete) - 2;
|
||||||
pInquiryComplete->EventStatus = 0x00;
|
pInquiryComplete->EventStatus = 0x00;
|
||||||
|
@ -433,37 +433,36 @@ bool BluetoothEmu::SendEventInquiryComplete()
|
||||||
|
|
||||||
bool BluetoothEmu::SendEventInquiryResponse()
|
bool BluetoothEmu::SendEventInquiryResponse()
|
||||||
{
|
{
|
||||||
if (m_WiiMotes.empty())
|
if (m_wiimotes.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
DEBUG_ASSERT(sizeof(SHCIEventInquiryResult) - 2 +
|
DEBUG_ASSERT(sizeof(SHCIEventInquiryResult) - 2 +
|
||||||
(m_WiiMotes.size() * sizeof(hci_inquiry_response)) <
|
(m_wiimotes.size() * sizeof(hci_inquiry_response)) <
|
||||||
256);
|
256);
|
||||||
|
|
||||||
SQueuedEvent Event(static_cast<u32>(sizeof(SHCIEventInquiryResult) +
|
SQueuedEvent Event(static_cast<u32>(sizeof(SHCIEventInquiryResult) +
|
||||||
m_WiiMotes.size() * sizeof(hci_inquiry_response)),
|
m_wiimotes.size() * sizeof(hci_inquiry_response)),
|
||||||
0);
|
0);
|
||||||
|
|
||||||
SHCIEventInquiryResult* pInquiryResult = (SHCIEventInquiryResult*)Event.m_buffer;
|
SHCIEventInquiryResult* pInquiryResult = (SHCIEventInquiryResult*)Event.buffer;
|
||||||
|
|
||||||
pInquiryResult->EventType = HCI_EVENT_INQUIRY_RESULT;
|
pInquiryResult->EventType = HCI_EVENT_INQUIRY_RESULT;
|
||||||
pInquiryResult->PayloadLength =
|
pInquiryResult->PayloadLength =
|
||||||
(u8)(sizeof(SHCIEventInquiryResult) - 2 + (m_WiiMotes.size() * sizeof(hci_inquiry_response)));
|
(u8)(sizeof(SHCIEventInquiryResult) - 2 + (m_wiimotes.size() * sizeof(hci_inquiry_response)));
|
||||||
pInquiryResult->num_responses = (u8)m_WiiMotes.size();
|
pInquiryResult->num_responses = (u8)m_wiimotes.size();
|
||||||
|
|
||||||
for (size_t i = 0; i < m_WiiMotes.size(); i++)
|
for (size_t i = 0; i < m_wiimotes.size(); i++)
|
||||||
{
|
{
|
||||||
if (m_WiiMotes[i].IsConnected())
|
if (m_wiimotes[i].IsConnected())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
u8* pBuffer =
|
u8* pBuffer = Event.buffer + sizeof(SHCIEventInquiryResult) + i * sizeof(hci_inquiry_response);
|
||||||
Event.m_buffer + sizeof(SHCIEventInquiryResult) + i * sizeof(hci_inquiry_response);
|
|
||||||
hci_inquiry_response* pResponse = (hci_inquiry_response*)pBuffer;
|
hci_inquiry_response* pResponse = (hci_inquiry_response*)pBuffer;
|
||||||
|
|
||||||
pResponse->bdaddr = m_WiiMotes[i].GetBD();
|
pResponse->bdaddr = m_wiimotes[i].GetBD();
|
||||||
pResponse->uclass[0] = m_WiiMotes[i].GetClass()[0];
|
pResponse->uclass[0] = m_wiimotes[i].GetClass()[0];
|
||||||
pResponse->uclass[1] = m_WiiMotes[i].GetClass()[1];
|
pResponse->uclass[1] = m_wiimotes[i].GetClass()[1];
|
||||||
pResponse->uclass[2] = m_WiiMotes[i].GetClass()[2];
|
pResponse->uclass[2] = m_wiimotes[i].GetClass()[2];
|
||||||
|
|
||||||
pResponse->page_scan_rep_mode = 1;
|
pResponse->page_scan_rep_mode = 1;
|
||||||
pResponse->page_scan_period_mode = 0;
|
pResponse->page_scan_period_mode = 0;
|
||||||
|
@ -489,7 +488,7 @@ bool BluetoothEmu::SendEventConnectionComplete(const bdaddr_t& _bd)
|
||||||
|
|
||||||
SQueuedEvent Event(sizeof(SHCIEventConnectionComplete), 0);
|
SQueuedEvent Event(sizeof(SHCIEventConnectionComplete), 0);
|
||||||
|
|
||||||
SHCIEventConnectionComplete* pConnectionComplete = (SHCIEventConnectionComplete*)Event.m_buffer;
|
SHCIEventConnectionComplete* pConnectionComplete = (SHCIEventConnectionComplete*)Event.buffer;
|
||||||
|
|
||||||
pConnectionComplete->EventType = HCI_EVENT_CON_COMPL;
|
pConnectionComplete->EventType = HCI_EVENT_CON_COMPL;
|
||||||
pConnectionComplete->PayloadLength = sizeof(SHCIEventConnectionComplete) - 2;
|
pConnectionComplete->PayloadLength = sizeof(SHCIEventConnectionComplete) - 2;
|
||||||
|
@ -528,7 +527,7 @@ bool BluetoothEmu::SendEventRequestConnection(const WiimoteDevice& _rWiiMote)
|
||||||
{
|
{
|
||||||
SQueuedEvent Event(sizeof(SHCIEventRequestConnection), 0);
|
SQueuedEvent Event(sizeof(SHCIEventRequestConnection), 0);
|
||||||
|
|
||||||
SHCIEventRequestConnection* pEventRequestConnection = (SHCIEventRequestConnection*)Event.m_buffer;
|
SHCIEventRequestConnection* pEventRequestConnection = (SHCIEventRequestConnection*)Event.buffer;
|
||||||
|
|
||||||
pEventRequestConnection->EventType = HCI_EVENT_CON_REQ;
|
pEventRequestConnection->EventType = HCI_EVENT_CON_REQ;
|
||||||
pEventRequestConnection->PayloadLength = sizeof(SHCIEventRequestConnection) - 2;
|
pEventRequestConnection->PayloadLength = sizeof(SHCIEventRequestConnection) - 2;
|
||||||
|
@ -567,7 +566,7 @@ bool BluetoothEmu::SendEventDisconnect(u16 _connectionHandle, u8 _Reason)
|
||||||
|
|
||||||
SQueuedEvent Event(sizeof(SHCIEventDisconnectCompleted), _connectionHandle);
|
SQueuedEvent Event(sizeof(SHCIEventDisconnectCompleted), _connectionHandle);
|
||||||
|
|
||||||
SHCIEventDisconnectCompleted* pDisconnect = (SHCIEventDisconnectCompleted*)Event.m_buffer;
|
SHCIEventDisconnectCompleted* pDisconnect = (SHCIEventDisconnectCompleted*)Event.buffer;
|
||||||
pDisconnect->EventType = HCI_EVENT_DISCON_COMPL;
|
pDisconnect->EventType = HCI_EVENT_DISCON_COMPL;
|
||||||
pDisconnect->PayloadLength = sizeof(SHCIEventDisconnectCompleted) - 2;
|
pDisconnect->PayloadLength = sizeof(SHCIEventDisconnectCompleted) - 2;
|
||||||
pDisconnect->EventStatus = 0;
|
pDisconnect->EventStatus = 0;
|
||||||
|
@ -592,7 +591,7 @@ bool BluetoothEmu::SendEventAuthenticationCompleted(u16 _connectionHandle)
|
||||||
SQueuedEvent Event(sizeof(SHCIEventAuthenticationCompleted), _connectionHandle);
|
SQueuedEvent Event(sizeof(SHCIEventAuthenticationCompleted), _connectionHandle);
|
||||||
|
|
||||||
SHCIEventAuthenticationCompleted* pEventAuthenticationCompleted =
|
SHCIEventAuthenticationCompleted* pEventAuthenticationCompleted =
|
||||||
(SHCIEventAuthenticationCompleted*)Event.m_buffer;
|
(SHCIEventAuthenticationCompleted*)Event.buffer;
|
||||||
pEventAuthenticationCompleted->EventType = HCI_EVENT_AUTH_COMPL;
|
pEventAuthenticationCompleted->EventType = HCI_EVENT_AUTH_COMPL;
|
||||||
pEventAuthenticationCompleted->PayloadLength = sizeof(SHCIEventAuthenticationCompleted) - 2;
|
pEventAuthenticationCompleted->PayloadLength = sizeof(SHCIEventAuthenticationCompleted) - 2;
|
||||||
pEventAuthenticationCompleted->EventStatus = 0;
|
pEventAuthenticationCompleted->EventStatus = 0;
|
||||||
|
@ -615,7 +614,7 @@ bool BluetoothEmu::SendEventRemoteNameReq(const bdaddr_t& _bd)
|
||||||
|
|
||||||
SQueuedEvent Event(sizeof(SHCIEventRemoteNameReq), 0);
|
SQueuedEvent Event(sizeof(SHCIEventRemoteNameReq), 0);
|
||||||
|
|
||||||
SHCIEventRemoteNameReq* pRemoteNameReq = (SHCIEventRemoteNameReq*)Event.m_buffer;
|
SHCIEventRemoteNameReq* pRemoteNameReq = (SHCIEventRemoteNameReq*)Event.buffer;
|
||||||
|
|
||||||
pRemoteNameReq->EventType = HCI_EVENT_REMOTE_NAME_REQ_COMPL;
|
pRemoteNameReq->EventType = HCI_EVENT_REMOTE_NAME_REQ_COMPL;
|
||||||
pRemoteNameReq->PayloadLength = sizeof(SHCIEventRemoteNameReq) - 2;
|
pRemoteNameReq->PayloadLength = sizeof(SHCIEventRemoteNameReq) - 2;
|
||||||
|
@ -642,7 +641,7 @@ bool BluetoothEmu::SendEventReadRemoteFeatures(u16 _connectionHandle)
|
||||||
|
|
||||||
SQueuedEvent Event(sizeof(SHCIEventReadRemoteFeatures), _connectionHandle);
|
SQueuedEvent Event(sizeof(SHCIEventReadRemoteFeatures), _connectionHandle);
|
||||||
|
|
||||||
SHCIEventReadRemoteFeatures* pReadRemoteFeatures = (SHCIEventReadRemoteFeatures*)Event.m_buffer;
|
SHCIEventReadRemoteFeatures* pReadRemoteFeatures = (SHCIEventReadRemoteFeatures*)Event.buffer;
|
||||||
|
|
||||||
pReadRemoteFeatures->EventType = HCI_EVENT_READ_REMOTE_FEATURES_COMPL;
|
pReadRemoteFeatures->EventType = HCI_EVENT_READ_REMOTE_FEATURES_COMPL;
|
||||||
pReadRemoteFeatures->PayloadLength = sizeof(SHCIEventReadRemoteFeatures) - 2;
|
pReadRemoteFeatures->PayloadLength = sizeof(SHCIEventReadRemoteFeatures) - 2;
|
||||||
|
@ -678,7 +677,7 @@ bool BluetoothEmu::SendEventReadRemoteVerInfo(u16 _connectionHandle)
|
||||||
|
|
||||||
SQueuedEvent Event(sizeof(SHCIEventReadRemoteVerInfo), _connectionHandle);
|
SQueuedEvent Event(sizeof(SHCIEventReadRemoteVerInfo), _connectionHandle);
|
||||||
|
|
||||||
SHCIEventReadRemoteVerInfo* pReadRemoteVerInfo = (SHCIEventReadRemoteVerInfo*)Event.m_buffer;
|
SHCIEventReadRemoteVerInfo* pReadRemoteVerInfo = (SHCIEventReadRemoteVerInfo*)Event.buffer;
|
||||||
pReadRemoteVerInfo->EventType = HCI_EVENT_READ_REMOTE_VER_INFO_COMPL;
|
pReadRemoteVerInfo->EventType = HCI_EVENT_READ_REMOTE_VER_INFO_COMPL;
|
||||||
pReadRemoteVerInfo->PayloadLength = sizeof(SHCIEventReadRemoteVerInfo) - 2;
|
pReadRemoteVerInfo->PayloadLength = sizeof(SHCIEventReadRemoteVerInfo) - 2;
|
||||||
pReadRemoteVerInfo->EventStatus = 0x00;
|
pReadRemoteVerInfo->EventStatus = 0x00;
|
||||||
|
@ -704,7 +703,7 @@ void BluetoothEmu::SendEventCommandComplete(u16 opcode, const void* data, u32 da
|
||||||
|
|
||||||
SQueuedEvent event(sizeof(SHCIEventCommand) + data_size, 0);
|
SQueuedEvent event(sizeof(SHCIEventCommand) + data_size, 0);
|
||||||
|
|
||||||
SHCIEventCommand* hci_event = reinterpret_cast<SHCIEventCommand*>(event.m_buffer);
|
SHCIEventCommand* hci_event = reinterpret_cast<SHCIEventCommand*>(event.buffer);
|
||||||
hci_event->EventType = HCI_EVENT_COMMAND_COMPL;
|
hci_event->EventType = HCI_EVENT_COMMAND_COMPL;
|
||||||
hci_event->PayloadLength = (u8)(sizeof(SHCIEventCommand) - 2 + data_size);
|
hci_event->PayloadLength = (u8)(sizeof(SHCIEventCommand) - 2 + data_size);
|
||||||
hci_event->PacketIndicator = 0x01;
|
hci_event->PacketIndicator = 0x01;
|
||||||
|
@ -713,7 +712,7 @@ void BluetoothEmu::SendEventCommandComplete(u16 opcode, const void* data, u32 da
|
||||||
// add the payload
|
// add the payload
|
||||||
if (data != nullptr && data_size > 0)
|
if (data != nullptr && data_size > 0)
|
||||||
{
|
{
|
||||||
u8* payload = event.m_buffer + sizeof(SHCIEventCommand);
|
u8* payload = event.buffer + sizeof(SHCIEventCommand);
|
||||||
memcpy(payload, data, data_size);
|
memcpy(payload, data, data_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -726,7 +725,7 @@ bool BluetoothEmu::SendEventCommandStatus(u16 _Opcode)
|
||||||
{
|
{
|
||||||
SQueuedEvent Event(sizeof(SHCIEventStatus), 0);
|
SQueuedEvent Event(sizeof(SHCIEventStatus), 0);
|
||||||
|
|
||||||
SHCIEventStatus* pHCIEvent = (SHCIEventStatus*)Event.m_buffer;
|
SHCIEventStatus* pHCIEvent = (SHCIEventStatus*)Event.buffer;
|
||||||
pHCIEvent->EventType = HCI_EVENT_COMMAND_STATUS;
|
pHCIEvent->EventType = HCI_EVENT_COMMAND_STATUS;
|
||||||
pHCIEvent->PayloadLength = sizeof(SHCIEventStatus) - 2;
|
pHCIEvent->PayloadLength = sizeof(SHCIEventStatus) - 2;
|
||||||
pHCIEvent->EventStatus = 0x0;
|
pHCIEvent->EventStatus = 0x0;
|
||||||
|
@ -748,7 +747,7 @@ bool BluetoothEmu::SendEventRoleChange(bdaddr_t _bd, bool _master)
|
||||||
|
|
||||||
SQueuedEvent Event(sizeof(SHCIEventRoleChange), 0);
|
SQueuedEvent Event(sizeof(SHCIEventRoleChange), 0);
|
||||||
|
|
||||||
SHCIEventRoleChange* pRoleChange = (SHCIEventRoleChange*)Event.m_buffer;
|
SHCIEventRoleChange* pRoleChange = (SHCIEventRoleChange*)Event.buffer;
|
||||||
|
|
||||||
pRoleChange->EventType = HCI_EVENT_ROLE_CHANGE;
|
pRoleChange->EventType = HCI_EVENT_ROLE_CHANGE;
|
||||||
pRoleChange->PayloadLength = sizeof(SHCIEventRoleChange) - 2;
|
pRoleChange->PayloadLength = sizeof(SHCIEventRoleChange) - 2;
|
||||||
|
@ -770,12 +769,12 @@ bool BluetoothEmu::SendEventRoleChange(bdaddr_t _bd, bool _master)
|
||||||
bool BluetoothEmu::SendEventNumberOfCompletedPackets()
|
bool BluetoothEmu::SendEventNumberOfCompletedPackets()
|
||||||
{
|
{
|
||||||
SQueuedEvent Event((u32)(sizeof(hci_event_hdr_t) + sizeof(hci_num_compl_pkts_ep) +
|
SQueuedEvent Event((u32)(sizeof(hci_event_hdr_t) + sizeof(hci_num_compl_pkts_ep) +
|
||||||
(sizeof(hci_num_compl_pkts_info) * m_WiiMotes.size())),
|
(sizeof(hci_num_compl_pkts_info) * m_wiimotes.size())),
|
||||||
0);
|
0);
|
||||||
|
|
||||||
DEBUG_LOG(IOS_WIIMOTE, "Event: SendEventNumberOfCompletedPackets");
|
DEBUG_LOG(IOS_WIIMOTE, "Event: SendEventNumberOfCompletedPackets");
|
||||||
|
|
||||||
hci_event_hdr_t* event_hdr = (hci_event_hdr_t*)Event.m_buffer;
|
hci_event_hdr_t* event_hdr = (hci_event_hdr_t*)Event.buffer;
|
||||||
hci_num_compl_pkts_ep* event = (hci_num_compl_pkts_ep*)((u8*)event_hdr + sizeof(hci_event_hdr_t));
|
hci_num_compl_pkts_ep* event = (hci_num_compl_pkts_ep*)((u8*)event_hdr + sizeof(hci_event_hdr_t));
|
||||||
hci_num_compl_pkts_info* info =
|
hci_num_compl_pkts_info* info =
|
||||||
(hci_num_compl_pkts_info*)((u8*)event + sizeof(hci_num_compl_pkts_ep));
|
(hci_num_compl_pkts_info*)((u8*)event + sizeof(hci_num_compl_pkts_ep));
|
||||||
|
@ -786,18 +785,18 @@ bool BluetoothEmu::SendEventNumberOfCompletedPackets()
|
||||||
|
|
||||||
u32 acc = 0;
|
u32 acc = 0;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < m_WiiMotes.size(); i++)
|
for (unsigned int i = 0; i < m_wiimotes.size(); i++)
|
||||||
{
|
{
|
||||||
event_hdr->length += sizeof(hci_num_compl_pkts_info);
|
event_hdr->length += sizeof(hci_num_compl_pkts_info);
|
||||||
event->num_con_handles++;
|
event->num_con_handles++;
|
||||||
info->compl_pkts = m_PacketCount[i];
|
info->compl_pkts = m_packet_count[i];
|
||||||
info->con_handle = m_WiiMotes[i].GetConnectionHandle();
|
info->con_handle = m_wiimotes[i].GetConnectionHandle();
|
||||||
|
|
||||||
DEBUG_LOG(IOS_WIIMOTE, " Connection_Handle: 0x%04x", info->con_handle);
|
DEBUG_LOG(IOS_WIIMOTE, " Connection_Handle: 0x%04x", info->con_handle);
|
||||||
DEBUG_LOG(IOS_WIIMOTE, " Number_Of_Completed_Packets: %i", info->compl_pkts);
|
DEBUG_LOG(IOS_WIIMOTE, " Number_Of_Completed_Packets: %i", info->compl_pkts);
|
||||||
|
|
||||||
acc += info->compl_pkts;
|
acc += info->compl_pkts;
|
||||||
m_PacketCount[i] = 0;
|
m_packet_count[i] = 0;
|
||||||
info++;
|
info++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -821,7 +820,7 @@ bool BluetoothEmu::SendEventModeChange(u16 _connectionHandle, u8 _mode, u16 _val
|
||||||
|
|
||||||
SQueuedEvent Event(sizeof(SHCIEventModeChange), _connectionHandle);
|
SQueuedEvent Event(sizeof(SHCIEventModeChange), _connectionHandle);
|
||||||
|
|
||||||
SHCIEventModeChange* pModeChange = (SHCIEventModeChange*)Event.m_buffer;
|
SHCIEventModeChange* pModeChange = (SHCIEventModeChange*)Event.buffer;
|
||||||
pModeChange->EventType = HCI_EVENT_MODE_CHANGE;
|
pModeChange->EventType = HCI_EVENT_MODE_CHANGE;
|
||||||
pModeChange->PayloadLength = sizeof(SHCIEventModeChange) - 2;
|
pModeChange->PayloadLength = sizeof(SHCIEventModeChange) - 2;
|
||||||
pModeChange->EventStatus = 0;
|
pModeChange->EventStatus = 0;
|
||||||
|
@ -842,7 +841,7 @@ bool BluetoothEmu::SendEventLinkKeyNotification(const u8 num_to_send)
|
||||||
{
|
{
|
||||||
u8 payload_length = sizeof(hci_return_link_keys_ep) + sizeof(hci_link_key_rep_cp) * num_to_send;
|
u8 payload_length = sizeof(hci_return_link_keys_ep) + sizeof(hci_link_key_rep_cp) * num_to_send;
|
||||||
SQueuedEvent Event(2 + payload_length, 0);
|
SQueuedEvent Event(2 + payload_length, 0);
|
||||||
SHCIEventLinkKeyNotification* pEventLinkKey = (SHCIEventLinkKeyNotification*)Event.m_buffer;
|
SHCIEventLinkKeyNotification* pEventLinkKey = (SHCIEventLinkKeyNotification*)Event.buffer;
|
||||||
|
|
||||||
DEBUG_LOG(IOS_WIIMOTE, "Event: SendEventLinkKeyNotification");
|
DEBUG_LOG(IOS_WIIMOTE, "Event: SendEventLinkKeyNotification");
|
||||||
|
|
||||||
|
@ -858,8 +857,8 @@ bool BluetoothEmu::SendEventLinkKeyNotification(const u8 num_to_send)
|
||||||
{
|
{
|
||||||
hci_link_key_rep_cp* link_key_info =
|
hci_link_key_rep_cp* link_key_info =
|
||||||
(hci_link_key_rep_cp*)((u8*)&pEventLinkKey->bdaddr + sizeof(hci_link_key_rep_cp) * i);
|
(hci_link_key_rep_cp*)((u8*)&pEventLinkKey->bdaddr + sizeof(hci_link_key_rep_cp) * i);
|
||||||
link_key_info->bdaddr = m_WiiMotes[i].GetBD();
|
link_key_info->bdaddr = m_wiimotes[i].GetBD();
|
||||||
memcpy(link_key_info->key, m_WiiMotes[i].GetLinkKey(), HCI_KEY_SIZE);
|
memcpy(link_key_info->key, m_wiimotes[i].GetLinkKey(), HCI_KEY_SIZE);
|
||||||
|
|
||||||
DEBUG_LOG(IOS_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", link_key_info->bdaddr[0],
|
DEBUG_LOG(IOS_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", link_key_info->bdaddr[0],
|
||||||
link_key_info->bdaddr[1], link_key_info->bdaddr[2], link_key_info->bdaddr[3],
|
link_key_info->bdaddr[1], link_key_info->bdaddr[2], link_key_info->bdaddr[3],
|
||||||
|
@ -875,7 +874,7 @@ bool BluetoothEmu::SendEventRequestLinkKey(const bdaddr_t& _bd)
|
||||||
{
|
{
|
||||||
SQueuedEvent Event(sizeof(SHCIEventRequestLinkKey), 0);
|
SQueuedEvent Event(sizeof(SHCIEventRequestLinkKey), 0);
|
||||||
|
|
||||||
SHCIEventRequestLinkKey* pEventRequestLinkKey = (SHCIEventRequestLinkKey*)Event.m_buffer;
|
SHCIEventRequestLinkKey* pEventRequestLinkKey = (SHCIEventRequestLinkKey*)Event.buffer;
|
||||||
|
|
||||||
pEventRequestLinkKey->EventType = HCI_EVENT_LINK_KEY_REQ;
|
pEventRequestLinkKey->EventType = HCI_EVENT_LINK_KEY_REQ;
|
||||||
pEventRequestLinkKey->PayloadLength = sizeof(SHCIEventRequestLinkKey) - 2;
|
pEventRequestLinkKey->PayloadLength = sizeof(SHCIEventRequestLinkKey) - 2;
|
||||||
|
@ -901,7 +900,7 @@ bool BluetoothEmu::SendEventReadClockOffsetComplete(u16 _connectionHandle)
|
||||||
SQueuedEvent Event(sizeof(SHCIEventReadClockOffsetComplete), _connectionHandle);
|
SQueuedEvent Event(sizeof(SHCIEventReadClockOffsetComplete), _connectionHandle);
|
||||||
|
|
||||||
SHCIEventReadClockOffsetComplete* pReadClockOffsetComplete =
|
SHCIEventReadClockOffsetComplete* pReadClockOffsetComplete =
|
||||||
(SHCIEventReadClockOffsetComplete*)Event.m_buffer;
|
(SHCIEventReadClockOffsetComplete*)Event.buffer;
|
||||||
pReadClockOffsetComplete->EventType = HCI_EVENT_READ_CLOCK_OFFSET_COMPL;
|
pReadClockOffsetComplete->EventType = HCI_EVENT_READ_CLOCK_OFFSET_COMPL;
|
||||||
pReadClockOffsetComplete->PayloadLength = sizeof(SHCIEventReadClockOffsetComplete) - 2;
|
pReadClockOffsetComplete->PayloadLength = sizeof(SHCIEventReadClockOffsetComplete) - 2;
|
||||||
pReadClockOffsetComplete->EventStatus = 0x00;
|
pReadClockOffsetComplete->EventStatus = 0x00;
|
||||||
|
@ -925,8 +924,7 @@ bool BluetoothEmu::SendEventConPacketTypeChange(u16 _connectionHandle, u16 _pack
|
||||||
|
|
||||||
SQueuedEvent Event(sizeof(SHCIEventConPacketTypeChange), _connectionHandle);
|
SQueuedEvent Event(sizeof(SHCIEventConPacketTypeChange), _connectionHandle);
|
||||||
|
|
||||||
SHCIEventConPacketTypeChange* pChangeConPacketType =
|
SHCIEventConPacketTypeChange* pChangeConPacketType = (SHCIEventConPacketTypeChange*)Event.buffer;
|
||||||
(SHCIEventConPacketTypeChange*)Event.m_buffer;
|
|
||||||
pChangeConPacketType->EventType = HCI_EVENT_CON_PKT_TYPE_CHANGED;
|
pChangeConPacketType->EventType = HCI_EVENT_CON_PKT_TYPE_CHANGED;
|
||||||
pChangeConPacketType->PayloadLength = sizeof(SHCIEventConPacketTypeChange) - 2;
|
pChangeConPacketType->PayloadLength = sizeof(SHCIEventConPacketTypeChange) - 2;
|
||||||
pChangeConPacketType->EventStatus = 0x00;
|
pChangeConPacketType->EventStatus = 0x00;
|
||||||
|
@ -1415,7 +1413,7 @@ void BluetoothEmu::CommandReadStoredLinkKey(const u8* input)
|
||||||
|
|
||||||
if (read_stored_link_key->read_all == 1)
|
if (read_stored_link_key->read_all == 1)
|
||||||
{
|
{
|
||||||
reply.num_keys_read = (u16)m_WiiMotes.size();
|
reply.num_keys_read = (u16)m_wiimotes.size();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1500,7 +1498,7 @@ void BluetoothEmu::CommandWriteScanEnable(const u8* input)
|
||||||
{
|
{
|
||||||
const hci_write_scan_enable_cp* write_scan_enable =
|
const hci_write_scan_enable_cp* write_scan_enable =
|
||||||
reinterpret_cast<const hci_write_scan_enable_cp*>(input);
|
reinterpret_cast<const hci_write_scan_enable_cp*>(input);
|
||||||
m_ScanEnable = write_scan_enable->scan_enable;
|
m_scan_enable = write_scan_enable->scan_enable;
|
||||||
|
|
||||||
hci_write_scan_enable_rp reply;
|
hci_write_scan_enable_rp reply;
|
||||||
reply.status = 0x00;
|
reply.status = 0x00;
|
||||||
|
@ -1693,7 +1691,7 @@ void BluetoothEmu::CommandReadBDAdrr(const u8* input)
|
||||||
{
|
{
|
||||||
hci_read_bdaddr_rp reply;
|
hci_read_bdaddr_rp reply;
|
||||||
reply.status = 0x00;
|
reply.status = 0x00;
|
||||||
reply.bdaddr = m_ControllerBD;
|
reply.bdaddr = m_controller_bd;
|
||||||
|
|
||||||
INFO_LOG(IOS_WIIMOTE, "Command: HCI_CMD_READ_BDADDR:");
|
INFO_LOG(IOS_WIIMOTE, "Command: HCI_CMD_READ_BDADDR:");
|
||||||
DEBUG_LOG(IOS_WIIMOTE, "return:");
|
DEBUG_LOG(IOS_WIIMOTE, "return:");
|
||||||
|
@ -1749,14 +1747,14 @@ WiimoteDevice* BluetoothEmu::AccessWiiMoteByIndex(std::size_t index)
|
||||||
WiimoteDevice* BluetoothEmu::AccessWiiMote(const bdaddr_t& address)
|
WiimoteDevice* BluetoothEmu::AccessWiiMote(const bdaddr_t& address)
|
||||||
{
|
{
|
||||||
const auto iterator =
|
const auto iterator =
|
||||||
std::find_if(m_WiiMotes.begin(), m_WiiMotes.end(),
|
std::find_if(m_wiimotes.begin(), m_wiimotes.end(),
|
||||||
[&address](const WiimoteDevice& remote) { return remote.GetBD() == address; });
|
[&address](const WiimoteDevice& remote) { return remote.GetBD() == address; });
|
||||||
return iterator != m_WiiMotes.cend() ? &*iterator : nullptr;
|
return iterator != m_wiimotes.cend() ? &*iterator : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
WiimoteDevice* BluetoothEmu::AccessWiiMote(u16 _ConnectionHandle)
|
WiimoteDevice* BluetoothEmu::AccessWiiMote(u16 _ConnectionHandle)
|
||||||
{
|
{
|
||||||
for (auto& wiimote : m_WiiMotes)
|
for (auto& wiimote : m_wiimotes)
|
||||||
{
|
{
|
||||||
if (wiimote.GetConnectionHandle() == _ConnectionHandle)
|
if (wiimote.GetConnectionHandle() == _ConnectionHandle)
|
||||||
return &wiimote;
|
return &wiimote;
|
||||||
|
|
|
@ -25,11 +25,11 @@ namespace IOS::HLE
|
||||||
{
|
{
|
||||||
struct SQueuedEvent
|
struct SQueuedEvent
|
||||||
{
|
{
|
||||||
u8 m_buffer[1024] = {0};
|
u8 buffer[1024] = {};
|
||||||
u32 m_size = 0;
|
u32 size = 0;
|
||||||
u16 m_connectionHandle = 0;
|
u16 connection_handle = 0;
|
||||||
|
|
||||||
SQueuedEvent(u32 size, u16 handle);
|
SQueuedEvent(u32 size_, u16 handle);
|
||||||
SQueuedEvent() = default;
|
SQueuedEvent() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,17 +61,17 @@ public:
|
||||||
void DoState(PointerWrap& p) override;
|
void DoState(PointerWrap& p) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<WiimoteDevice> m_WiiMotes;
|
std::vector<WiimoteDevice> m_wiimotes;
|
||||||
|
|
||||||
bdaddr_t m_ControllerBD{{0x11, 0x02, 0x19, 0x79, 0x00, 0xff}};
|
bdaddr_t m_controller_bd{{0x11, 0x02, 0x19, 0x79, 0x00, 0xff}};
|
||||||
|
|
||||||
// this is used to trigger connecting via ACL
|
// this is used to trigger connecting via ACL
|
||||||
u8 m_ScanEnable = 0;
|
u8 m_scan_enable = 0;
|
||||||
|
|
||||||
std::unique_ptr<USB::V0CtrlMessage> m_CtrlSetup;
|
std::unique_ptr<USB::V0CtrlMessage> m_ctrl_setup;
|
||||||
std::unique_ptr<USB::V0IntrMessage> m_HCIEndpoint;
|
std::unique_ptr<USB::V0IntrMessage> m_hci_endpoint;
|
||||||
std::unique_ptr<USB::V0BulkMessage> m_ACLEndpoint;
|
std::unique_ptr<USB::V0BulkMessage> m_acl_endpoint;
|
||||||
std::deque<SQueuedEvent> m_EventQueue;
|
std::deque<SQueuedEvent> m_event_queue;
|
||||||
|
|
||||||
class ACLPool
|
class ACLPool
|
||||||
{
|
{
|
||||||
|
@ -97,7 +97,7 @@ private:
|
||||||
std::deque<Packet> m_queue;
|
std::deque<Packet> m_queue;
|
||||||
} m_acl_pool{m_ios};
|
} m_acl_pool{m_ios};
|
||||||
|
|
||||||
u32 m_PacketCount[MAX_BBMOTES] = {};
|
u32 m_packet_count[MAX_BBMOTES] = {};
|
||||||
u64 m_last_ticks = 0;
|
u64 m_last_ticks = 0;
|
||||||
|
|
||||||
WiimoteDevice* AccessWiiMote(const bdaddr_t& _rAddr);
|
WiimoteDevice* AccessWiiMote(const bdaddr_t& _rAddr);
|
||||||
|
@ -181,18 +181,18 @@ private:
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
#define CONF_PAD_MAX_REGISTERED 10
|
#define CONF_PAD_MAX_REGISTERED 10
|
||||||
|
|
||||||
struct _conf_pad_device
|
struct ConfPadDevice
|
||||||
{
|
{
|
||||||
u8 bdaddr[6];
|
u8 bdaddr[6];
|
||||||
char name[0x40];
|
char name[0x40];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _conf_pads
|
struct ConfPads
|
||||||
{
|
{
|
||||||
u8 num_registered;
|
u8 num_registered;
|
||||||
_conf_pad_device registered[CONF_PAD_MAX_REGISTERED];
|
ConfPadDevice registered[CONF_PAD_MAX_REGISTERED];
|
||||||
_conf_pad_device active[MAX_BBMOTES];
|
ConfPadDevice active[MAX_BBMOTES];
|
||||||
_conf_pad_device unknown;
|
ConfPadDevice unknown;
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue