Core/WiimoteReal: Make wiimote source type an enum class and add Get/SetWiimoteSource functions. Add connected real Wii Remotes to a pool when a slot is not available.

This commit is contained in:
Jordan Woyak
2019-11-12 18:50:16 -06:00
parent f35f4f2bf0
commit 956339df4e
11 changed files with 181 additions and 105 deletions

View File

@ -160,7 +160,7 @@ std::string GetInputDisplay()
{
if (SerialInterface::GetDeviceType(i) != SerialInterface::SIDEVICE_NONE)
s_controllers |= (1 << i);
if (g_wiimote_sources[i] != WIIMOTE_SRC_NONE)
if (WiimoteCommon::GetSource(i) != WiimoteSource::None)
s_controllers |= (1 << (i + 4));
}
}
@ -463,7 +463,7 @@ void ChangeWiiPads(bool instantly)
int controllers = 0;
for (int i = 0; i < MAX_WIIMOTES; ++i)
if (g_wiimote_sources[i] != WIIMOTE_SRC_NONE)
if (WiimoteCommon::GetSource(i) != WiimoteSource::None)
controllers |= (1 << i);
// This is important for Wiimotes, because they can desync easily if they get re-activated
@ -478,7 +478,7 @@ void ChangeWiiPads(bool instantly)
{
const bool is_using_wiimote = IsUsingWiimote(i);
g_wiimote_sources[i] = is_using_wiimote ? WIIMOTE_SRC_EMU : WIIMOTE_SRC_NONE;
WiimoteCommon::SetSource(i, is_using_wiimote ? WiimoteSource::Emulated : WiimoteSource::None);
if (!SConfig::GetInstance().m_bt_passthrough_enabled && bt)
bt->AccessWiimoteByIndex(i)->Activate(is_using_wiimote);
}