Merge pull request #7150 from lioncash/naming

BTEmu: Amend variable naming
This commit is contained in:
Léo Lam 2018-06-22 22:50:48 +02:00 committed by GitHub
commit 1da868ee82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 464 additions and 465 deletions

View File

@ -104,7 +104,7 @@ void Connect(unsigned int index, bool connect)
ios->GetDeviceByName("/dev/usb/oh1/57e/305"));
if (bluetooth)
bluetooth->AccessWiiMoteByIndex(index)->Activate(connect);
bluetooth->AccessWiimoteByIndex(index)->Activate(connect);
const char* message = connect ? "Wii Remote %u connected" : "Wii Remote %u disconnected";
Core::DisplayMessage(StringFromFormat(message, index + 1), 3000);

File diff suppressed because it is too large Load Diff

View File

@ -25,11 +25,11 @@ namespace IOS::HLE
{
struct SQueuedEvent
{
u8 m_buffer[1024] = {0};
u32 m_size = 0;
u16 m_connectionHandle = 0;
u8 buffer[1024] = {};
u32 size = 0;
u16 connection_handle = 0;
SQueuedEvent(u32 size, u16 handle);
SQueuedEvent(u32 size_, u16 handle);
SQueuedEvent() = default;
};
@ -54,24 +54,24 @@ public:
// Send ACL data back to Bluetooth stack
void SendACLPacket(u16 connection_handle, const u8* data, u32 size);
bool RemoteDisconnect(u16 _connectionHandle);
bool RemoteDisconnect(u16 connection_handle);
WiimoteDevice* AccessWiiMoteByIndex(std::size_t index);
WiimoteDevice* AccessWiimoteByIndex(std::size_t index);
void DoState(PointerWrap& p) override;
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
u8 m_ScanEnable = 0;
u8 m_scan_enable = 0;
std::unique_ptr<USB::V0CtrlMessage> m_CtrlSetup;
std::unique_ptr<USB::V0IntrMessage> m_HCIEndpoint;
std::unique_ptr<USB::V0BulkMessage> m_ACLEndpoint;
std::deque<SQueuedEvent> m_EventQueue;
std::unique_ptr<USB::V0CtrlMessage> m_ctrl_setup;
std::unique_ptr<USB::V0IntrMessage> m_hci_endpoint;
std::unique_ptr<USB::V0BulkMessage> m_acl_endpoint;
std::deque<SQueuedEvent> m_event_queue;
class ACLPool
{
@ -97,35 +97,35 @@ private:
std::deque<Packet> m_queue;
} m_acl_pool{m_ios};
u32 m_PacketCount[MAX_BBMOTES] = {};
u32 m_packet_count[MAX_BBMOTES] = {};
u64 m_last_ticks = 0;
WiimoteDevice* AccessWiiMote(const bdaddr_t& _rAddr);
WiimoteDevice* AccessWiiMote(u16 _ConnectionHandle);
WiimoteDevice* AccessWiimote(const bdaddr_t& address);
WiimoteDevice* AccessWiimote(u16 connection_handle);
// Send ACL data to a device (wiimote)
void IncDataPacket(u16 _ConnectionHandle);
void SendToDevice(u16 _ConnectionHandle, u8* _pData, u32 _Size);
void IncDataPacket(u16 connection_handle);
void SendToDevice(u16 connection_handle, u8* data, u32 size);
// Events
void AddEventToQueue(const SQueuedEvent& _event);
bool SendEventCommandStatus(u16 _Opcode);
void AddEventToQueue(const SQueuedEvent& event);
bool SendEventCommandStatus(u16 opcode);
void SendEventCommandComplete(u16 opcode, const void* data, u32 data_size);
bool SendEventInquiryResponse();
bool SendEventInquiryComplete();
bool SendEventRemoteNameReq(const bdaddr_t& _bd);
bool SendEventRequestConnection(const WiimoteDevice& _rWiiMote);
bool SendEventConnectionComplete(const bdaddr_t& _bd);
bool SendEventReadClockOffsetComplete(u16 _connectionHandle);
bool SendEventConPacketTypeChange(u16 _connectionHandle, u16 _packetType);
bool SendEventReadRemoteVerInfo(u16 _connectionHandle);
bool SendEventReadRemoteFeatures(u16 _connectionHandle);
bool SendEventRoleChange(bdaddr_t _bd, bool _master);
bool SendEventRemoteNameReq(const bdaddr_t& bd);
bool SendEventRequestConnection(const WiimoteDevice& wiimote);
bool SendEventConnectionComplete(const bdaddr_t& bd);
bool SendEventReadClockOffsetComplete(u16 connection_handle);
bool SendEventConPacketTypeChange(u16 connection_handle, u16 packet_type);
bool SendEventReadRemoteVerInfo(u16 connection_handle);
bool SendEventReadRemoteFeatures(u16 connection_handle);
bool SendEventRoleChange(bdaddr_t bd, bool master);
bool SendEventNumberOfCompletedPackets();
bool SendEventAuthenticationCompleted(u16 _connectionHandle);
bool SendEventModeChange(u16 _connectionHandle, u8 _mode, u16 _value);
bool SendEventDisconnect(u16 _connectionHandle, u8 _Reason);
bool SendEventRequestLinkKey(const bdaddr_t& _bd);
bool SendEventAuthenticationCompleted(u16 connection_handle);
bool SendEventModeChange(u16 connection_handle, u8 mode, u16 value);
bool SendEventDisconnect(u16 connection_handle, u8 reason);
bool SendEventRequestLinkKey(const bdaddr_t& bd);
bool SendEventLinkKeyNotification(const u8 num_to_send);
// Execute HCI Message
@ -176,23 +176,23 @@ private:
void CommandVendorSpecific_FC4C(const u8* input, u32 size);
void CommandVendorSpecific_FC4F(const u8* input, u32 size);
static void DisplayDisconnectMessage(const int wiimoteNumber, const int reason);
static void DisplayDisconnectMessage(int wiimote_number, int reason);
#pragma pack(push, 1)
#define CONF_PAD_MAX_REGISTERED 10
struct _conf_pad_device
struct ConfPadDevice
{
u8 bdaddr[6];
char name[0x40];
};
struct _conf_pads
struct ConfPads
{
u8 num_registered;
_conf_pad_device registered[CONF_PAD_MAX_REGISTERED];
_conf_pad_device active[MAX_BBMOTES];
_conf_pad_device unknown;
ConfPadDevice registered[CONF_PAD_MAX_REGISTERED];
ConfPadDevice active[MAX_BBMOTES];
ConfPadDevice unknown;
};
#pragma pack(pop)
};

View File

@ -926,6 +926,6 @@ void Callback_WiimoteInterruptChannel(int number, u16 channel_id, const u8* data
const auto bt = std::static_pointer_cast<IOS::HLE::Device::BluetoothEmu>(
IOS::HLE::GetIOS()->GetDeviceByName("/dev/usb/oh1/57e/305"));
if (bt)
bt->AccessWiiMoteByIndex(number)->ReceiveL2capData(channel_id, data, size);
bt->AccessWiimoteByIndex(number)->ReceiveL2capData(channel_id, data, size);
}
}

View File

@ -471,7 +471,7 @@ void ChangeWiiPads(bool instantly)
g_wiimote_sources[i] = is_using_wiimote ? WIIMOTE_SRC_EMU : WIIMOTE_SRC_NONE;
if (!SConfig::GetInstance().m_bt_passthrough_enabled && bt)
bt->AccessWiiMoteByIndex(i)->Activate(is_using_wiimote);
bt->AccessWiimoteByIndex(i)->Activate(is_using_wiimote);
}
}

View File

@ -1401,7 +1401,7 @@ void MainWindow::OnConnectWiiRemote(int id)
Core::RunAsCPUThread([&] {
const auto bt = std::static_pointer_cast<IOS::HLE::Device::BluetoothEmu>(
ios->GetDeviceByName("/dev/usb/oh1/57e/305"));
const bool is_connected = bt && bt->AccessWiiMoteByIndex(id)->IsConnected();
const bool is_connected = bt && bt->AccessWiimoteByIndex(id)->IsConnected();
Wiimote::Connect(id, !is_connected);
});
}

View File

@ -923,7 +923,7 @@ void MenuBar::UpdateToolsMenu(bool emulation_started)
wii_remote->setEnabled(enable_wiimotes);
if (enable_wiimotes)
wii_remote->setChecked(bt->AccessWiiMoteByIndex(i)->IsConnected());
wii_remote->setChecked(bt->AccessWiimoteByIndex(i)->IsConnected());
}
}

View File

@ -1539,7 +1539,7 @@ void CFrame::OnConnectWiimote(wxCommandEvent& event)
const auto bt = std::static_pointer_cast<IOS::HLE::Device::BluetoothEmu>(
ios->GetDeviceByName("/dev/usb/oh1/57e/305"));
const unsigned int wiimote_index = event.GetId() - IDM_CONNECT_WIIMOTE1;
const bool is_connected = bt && bt->AccessWiiMoteByIndex(wiimote_index)->IsConnected();
const bool is_connected = bt && bt->AccessWiimoteByIndex(wiimote_index)->IsConnected();
Wiimote::Connect(wiimote_index, !is_connected);
});
}
@ -1715,11 +1715,11 @@ void CFrame::UpdateGUI()
if (should_enable_wiimotes)
{
Core::RunAsCPUThread([&] {
wiimote_1->Check(bt->AccessWiiMoteByIndex(0)->IsConnected());
wiimote_2->Check(bt->AccessWiiMoteByIndex(1)->IsConnected());
wiimote_3->Check(bt->AccessWiiMoteByIndex(2)->IsConnected());
wiimote_4->Check(bt->AccessWiiMoteByIndex(3)->IsConnected());
balance_board->Check(bt->AccessWiiMoteByIndex(4)->IsConnected());
wiimote_1->Check(bt->AccessWiimoteByIndex(0)->IsConnected());
wiimote_2->Check(bt->AccessWiimoteByIndex(1)->IsConnected());
wiimote_3->Check(bt->AccessWiimoteByIndex(2)->IsConnected());
wiimote_4->Check(bt->AccessWiimoteByIndex(3)->IsConnected());
balance_board->Check(bt->AccessWiimoteByIndex(4)->IsConnected());
});
}