diff options
| author | Lioncash <mathew1800@gmail.com> | 2018-06-20 15:27:31 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2018-06-20 17:05:54 -0400 |
| commit | 7eb86cdb67031f103434afc384fba7e98f84adbd (patch) | |
| tree | 1d2c17823f10ca8ada2f03decd970a13d3b13fb4 /Source/Core/DolphinQt2/MenuBar.cpp | |
| parent | e4b6d7626b296ca88900f28536f8a02878422741 (diff) | |
BTEmu: Add helper function for accessing WiimoteDevice instances by index
This makes it much more straightforward to access WiimoteDevice
instances and also keeps the implementation details of accessing those
instances in one spot.
Given as all external accesses to the WiimoteDevice instances go through
this function, we can make the other two private.
Diffstat (limited to 'Source/Core/DolphinQt2/MenuBar.cpp')
| -rw-r--r-- | Source/Core/DolphinQt2/MenuBar.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Source/Core/DolphinQt2/MenuBar.cpp b/Source/Core/DolphinQt2/MenuBar.cpp index 712e3de39f..cb14663896 100644 --- a/Source/Core/DolphinQt2/MenuBar.cpp +++ b/Source/Core/DolphinQt2/MenuBar.cpp @@ -914,14 +914,16 @@ void MenuBar::UpdateToolsMenu(bool emulation_started) const auto bt = ios ? std::static_pointer_cast<IOS::HLE::Device::BluetoothEmu>( ios->GetDeviceByName("/dev/usb/oh1/57e/305")) : nullptr; - bool enable_wiimotes = + const bool enable_wiimotes = emulation_started && bt && !SConfig::GetInstance().m_bt_passthrough_enabled; - for (int i = 0; i < 5; i++) + for (std::size_t i = 0; i < m_wii_remotes.size(); i++) { - m_wii_remotes[i]->setEnabled(enable_wiimotes); + QAction* const wii_remote = m_wii_remotes[i]; + + wii_remote->setEnabled(enable_wiimotes); if (enable_wiimotes) - m_wii_remotes[i]->setChecked(bt->AccessWiiMote(0x0100 + i)->IsConnected()); + wii_remote->setChecked(bt->AccessWiiMoteByIndex(i)->IsConnected()); } } |
