Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/Core/DolphinLibretro/Common/Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ static struct retro_core_option_v2_definition option_defs[] = {
Libretro::Options::main_bluetooth::BLUETOOTH_PASSTHROUGH,
"System Configuration > Bluetooth passthrough mode",
"Bluetooth passthrough mode",
"Pass all traffic directly to the host's Bluetooth adapter. This might CRASH if your adaptor is not compatible.",
"Pass all traffic directly to the host's Bluetooth adapter. Press F12 to begin the sync process.",
nullptr,
CATEGORY_SYSCONF,
{
Expand Down
22 changes: 18 additions & 4 deletions Source/Core/DolphinLibretro/Input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "Common/IniFile.h"
#include "Common/Logging/Log.h"
#include "Core/Config/MainSettings.h"
#include "Core/Config/WiimoteSettings.h"
#include "Core/ConfigManager.h"
#include "Core/FreeLookManager.h"
#include "Core/HW/GBAPad.h"
Expand All @@ -21,8 +22,10 @@
#include "Core/HW/WiimoteReal/WiimoteReal.h"
#include "Core/HW/SI/SI.h"
#include "Core/HW/SI/SI_Device.h"
#include "Core/IOS/USB/Bluetooth/BTReal.h"
#include "Core/Host.h"
#include "Core/System.h"
#include "Core/WiiUtils.h"
#include "DolphinLibretro/Input.h"
#include "DolphinLibretro/Common/Options.h"
#include "InputCommon/ControlReference/ControlReference.h"
Expand All @@ -34,10 +37,6 @@
#include "InputCommon/GCAdapter.h"
#include "InputCommon/GCPadStatus.h"
#include "InputCommon/InputConfig.h"
#include "Core/Config/WiimoteSettings.h"

//#include "UICommon/UICommon.h"
//#include "Core/HotkeyManager.h"

#define RETRO_DEVICE_WIIMOTE RETRO_DEVICE_JOYPAD
#define RETRO_DEVICE_WIIMOTE_SW ((2 << 8) | RETRO_DEVICE_JOYPAD)
Expand Down Expand Up @@ -581,6 +580,21 @@ void ResetControllers()
retro_set_controller_port_device(port, input_types[port]);
}

void BluetoothPassthroughBind()
{
static bool was_pressed = false;
bool sync = Libretro::Input::input_cb(0, RETRO_DEVICE_KEYBOARD, 0, RETROK_F12);

if (sync && !was_pressed)
{
auto bt_real = WiiUtils::GetBluetoothRealDevice();
if (bt_real)
bt_real->TriggerSyncButtonPressedEvent();
}

was_pressed = sync;
}

} // namespace Input
} // namespace Libretro

Expand Down
1 change: 1 addition & 0 deletions Source/Core/DolphinLibretro/Input.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ void InitStage2();
void Update();
void Shutdown();
void ResetControllers();
void BluetoothPassthroughBind();
}
}
4 changes: 3 additions & 1 deletion Source/Core/DolphinLibretro/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include "VideoCommon/VideoConfig.h"
#include "VideoCommon/Widescreen.h"
#include "Core/Boot/Boot.h"
#include "Core/HW/CPU.h"

#ifdef PERF_TEST
static struct retro_perf_callback perf_cb;
Expand Down Expand Up @@ -245,6 +244,9 @@ void retro_run(void)
WiimoteReal::Initialize(Wiimote::InitializeMode::DO_NOT_WAIT_FOR_WIIMOTES);
}

if (Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED))
Libretro::Input::BluetoothPassthroughBind();

RETRO_PERFORMANCE_INIT(dolphin_main_func);
RETRO_PERFORMANCE_START(dolphin_main_func);

Expand Down