mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Move the Wiimote connect code out of Host
I don't know who thought it would be a good idea to put the Wiimote connect code as part of the Host interface, and have that called from both the UI code and the core. And then hack around it by having "force connect" events whenever Host_ConnectWiimote is called from the core...
This commit is contained in:
@ -6,9 +6,15 @@
|
||||
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
||||
#include "Core/HW/WiimoteReal/WiimoteReal.h"
|
||||
#include "Core/IOS/IOS.h"
|
||||
#include "Core/IOS/USB/Bluetooth/BTEmu.h"
|
||||
#include "Core/IOS/USB/Bluetooth/WiimoteDevice.h"
|
||||
#include "Core/Movie.h"
|
||||
|
||||
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
||||
@ -81,6 +87,25 @@ void Initialize(InitializeMode init_mode)
|
||||
Movie::ChangeWiiPads();
|
||||
}
|
||||
|
||||
void Connect(unsigned int index, bool connect)
|
||||
{
|
||||
if (SConfig::GetInstance().m_bt_passthrough_enabled || index >= MAX_BBMOTES)
|
||||
return;
|
||||
|
||||
const auto ios = IOS::HLE::GetIOS();
|
||||
if (!ios)
|
||||
return;
|
||||
|
||||
const auto bluetooth = std::static_pointer_cast<IOS::HLE::Device::BluetoothEmu>(
|
||||
ios->GetDeviceByName("/dev/usb/oh1/57e/305"));
|
||||
|
||||
if (bluetooth)
|
||||
bluetooth->AccessWiiMote(index | 0x100)->Activate(connect);
|
||||
|
||||
const char* message = connect ? "Wii Remote %i connected" : "Wii Remote %i disconnected";
|
||||
Core::DisplayMessage(StringFromFormat(message, index + 1), 3000);
|
||||
}
|
||||
|
||||
void ResetAllWiimotes()
|
||||
{
|
||||
for (int i = WIIMOTE_CHAN_0; i < MAX_BBMOTES; ++i)
|
||||
|
Reference in New Issue
Block a user