Permalink
Browse files

BTEmu: Rename AccessWiiMote to AccessWiimote

Everywhere else throughout the codebase we use "Wiimote" when referring
to the Wii Remote as a shorthand. This makes the casing consistent.
  • Loading branch information...
lioncash committed Jun 21, 2018
1 parent 56b8d18 commit 25e3ec23f837ecf131ff1ef8c559bdc877656532
@@ -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);
@@ -215,7 +215,7 @@ IPCCommandResult BluetoothEmu::IOCtlV(const IOCtlVRequest& request)
// Here we handle the USB::IOCTLV_USBV0_BLKMSG Ioctlv
void BluetoothEmu::SendToDevice(u16 connection_handle, u8* data, u32 size)
{
WiimoteDevice* wiimote = AccessWiiMote(connection_handle);
WiimoteDevice* wiimote = AccessWiimote(connection_handle);
if (wiimote == nullptr)
return;
@@ -482,7 +482,7 @@ bool BluetoothEmu::SendEventInquiryResponse()
bool BluetoothEmu::SendEventConnectionComplete(const bdaddr_t& bd)
{
WiimoteDevice* wiimote = AccessWiiMote(bd);
WiimoteDevice* wiimote = AccessWiimote(bd);
if (wiimote == nullptr)
return false;
@@ -500,7 +500,7 @@ bool BluetoothEmu::SendEventConnectionComplete(const bdaddr_t& bd)
AddEventToQueue(event);
WiimoteDevice* connection_wiimote = AccessWiiMote(connection_complete->Connection_Handle);
WiimoteDevice* connection_wiimote = AccessWiimote(connection_complete->Connection_Handle);
if (connection_wiimote)
connection_wiimote->EventConnectionAccepted();
@@ -560,7 +560,7 @@ bool BluetoothEmu::SendEventRequestConnection(const WiimoteDevice& wiimote)
bool BluetoothEmu::SendEventDisconnect(u16 connection_handle, u8 reason)
{
WiimoteDevice* wiimote = AccessWiiMote(connection_handle);
WiimoteDevice* wiimote = AccessWiimote(connection_handle);
if (wiimote == nullptr)
return false;
@@ -584,7 +584,7 @@ bool BluetoothEmu::SendEventDisconnect(u16 connection_handle, u8 reason)
bool BluetoothEmu::SendEventAuthenticationCompleted(u16 connection_handle)
{
WiimoteDevice* wiimote = AccessWiiMote(connection_handle);
WiimoteDevice* wiimote = AccessWiimote(connection_handle);
if (wiimote == nullptr)
return false;
@@ -608,7 +608,7 @@ bool BluetoothEmu::SendEventAuthenticationCompleted(u16 connection_handle)
bool BluetoothEmu::SendEventRemoteNameReq(const bdaddr_t& bd)
{
WiimoteDevice* wiimote = AccessWiiMote(bd);
WiimoteDevice* wiimote = AccessWiimote(bd);
if (wiimote == nullptr)
return false;
@@ -635,7 +635,7 @@ bool BluetoothEmu::SendEventRemoteNameReq(const bdaddr_t& bd)
bool BluetoothEmu::SendEventReadRemoteFeatures(u16 connection_handle)
{
WiimoteDevice* wiimote = AccessWiiMote(connection_handle);
WiimoteDevice* wiimote = AccessWiimote(connection_handle);
if (wiimote == nullptr)
return false;
@@ -671,7 +671,7 @@ bool BluetoothEmu::SendEventReadRemoteFeatures(u16 connection_handle)
bool BluetoothEmu::SendEventReadRemoteVerInfo(u16 connection_handle)
{
WiimoteDevice* wiimote = AccessWiiMote(connection_handle);
WiimoteDevice* wiimote = AccessWiimote(connection_handle);
if (wiimote == nullptr)
return false;
@@ -741,7 +741,7 @@ bool BluetoothEmu::SendEventCommandStatus(u16 opcode)
bool BluetoothEmu::SendEventRoleChange(bdaddr_t bd, bool master)
{
WiimoteDevice* wiimote = AccessWiiMote(bd);
WiimoteDevice* wiimote = AccessWiimote(bd);
if (wiimote == nullptr)
return false;
@@ -813,7 +813,7 @@ bool BluetoothEmu::SendEventNumberOfCompletedPackets()
bool BluetoothEmu::SendEventModeChange(u16 connection_handle, u8 mode, u16 value)
{
WiimoteDevice* wiimote = AccessWiiMote(connection_handle);
WiimoteDevice* wiimote = AccessWiimote(connection_handle);
if (wiimote == nullptr)
return false;
@@ -892,7 +892,7 @@ bool BluetoothEmu::SendEventRequestLinkKey(const bdaddr_t& bd)
bool BluetoothEmu::SendEventReadClockOffsetComplete(u16 connection_handle)
{
WiimoteDevice* wiimote = AccessWiiMote(connection_handle);
WiimoteDevice* wiimote = AccessWiimote(connection_handle);
if (wiimote == nullptr)
return false;
@@ -918,7 +918,7 @@ bool BluetoothEmu::SendEventReadClockOffsetComplete(u16 connection_handle)
bool BluetoothEmu::SendEventConPacketTypeChange(u16 connection_handle, u16 packet_type)
{
WiimoteDevice* wiimote = AccessWiiMote(connection_handle);
WiimoteDevice* wiimote = AccessWiimote(connection_handle);
if (wiimote == nullptr)
return false;
@@ -1192,7 +1192,7 @@ void BluetoothEmu::CommandDisconnect(const u8* input)
SendEventCommandStatus(HCI_CMD_DISCONNECT);
SendEventDisconnect(disconnect->con_handle, disconnect->reason);
WiimoteDevice* wiimote = AccessWiiMote(disconnect->con_handle);
WiimoteDevice* wiimote = AccessWiimote(disconnect->con_handle);
if (wiimote)
wiimote->EventDisconnect();
}
@@ -1449,7 +1449,7 @@ void BluetoothEmu::CommandDeleteStoredLinkKey(const u8* input)
delete_stored_link_key->bdaddr[5]);
DEBUG_LOG(IOS_WIIMOTE, " delete_all: 0x%01x", delete_stored_link_key->delete_all);
WiimoteDevice* wiimote = AccessWiiMote(delete_stored_link_key->bdaddr);
WiimoteDevice* wiimote = AccessWiimote(delete_stored_link_key->bdaddr);
if (wiimote == nullptr)
return;
@@ -1739,21 +1739,21 @@ void BluetoothEmu::CommandVendorSpecific_FC4C(const u8* input, u32 size)
// --- helper
//
//
WiimoteDevice* BluetoothEmu::AccessWiiMoteByIndex(std::size_t index)
WiimoteDevice* BluetoothEmu::AccessWiimoteByIndex(std::size_t index)
{
const u16 connection_handle = static_cast<u16>(0x100 + index);
return AccessWiiMote(connection_handle);
return AccessWiimote(connection_handle);
}
WiimoteDevice* BluetoothEmu::AccessWiiMote(const bdaddr_t& address)
WiimoteDevice* BluetoothEmu::AccessWiimote(const bdaddr_t& address)
{
const auto iterator =
std::find_if(m_wiimotes.begin(), m_wiimotes.end(),
[&address](const WiimoteDevice& remote) { return remote.GetBD() == address; });
return iterator != m_wiimotes.cend() ? &*iterator : nullptr;
}
WiimoteDevice* BluetoothEmu::AccessWiiMote(u16 connection_handle)
WiimoteDevice* BluetoothEmu::AccessWiimote(u16 connection_handle)
{
for (auto& wiimote : m_wiimotes)
{
@@ -56,7 +56,7 @@ class BluetoothEmu final : public BluetoothBase
bool RemoteDisconnect(u16 connection_handle);
WiimoteDevice* AccessWiiMoteByIndex(std::size_t index);
WiimoteDevice* AccessWiimoteByIndex(std::size_t index);
void DoState(PointerWrap& p) override;
@@ -100,8 +100,8 @@ class BluetoothEmu final : public BluetoothBase
u32 m_packet_count[MAX_BBMOTES] = {};
u64 m_last_ticks = 0;
WiimoteDevice* AccessWiiMote(const bdaddr_t& address);
WiimoteDevice* AccessWiiMote(u16 connection_handle);
WiimoteDevice* AccessWiimote(const bdaddr_t& address);
WiimoteDevice* AccessWiimote(u16 connection_handle);
// Send ACL data to a device (wiimote)
void IncDataPacket(u16 connection_handle);
@@ -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);
}
}
@@ -470,7 +470,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);
}
}
@@ -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);
});
}
@@ -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());
}
}
@@ -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());
});
}

0 comments on commit 25e3ec2

Please sign in to comment.