Skip to content
Permalink
Browse files

Merge pull request #4195 from leoetlino/direct-hci

Add ability to passthrough a Bluetooth adapter
  • Loading branch information...
shuffle2 committed Oct 3, 2016
2 parents 2c66f5b + 6ff06ed commit 6ec756980d0560ec39d717be98c20c8f2424586f
Showing with 1,776 additions and 647 deletions.
  1. +1 −0 Source/Core/Common/CommonPaths.h
  2. +3 −0 Source/Core/Core/BootManager.cpp
  3. +5 −2 Source/Core/Core/CMakeLists.txt
  4. +23 −0 Source/Core/Core/ConfigManager.cpp
  5. +8 −0 Source/Core/Core/ConfigManager.h
  6. +5 −5 Source/Core/Core/Core.cpp
  7. +10 −2 Source/Core/Core/Core.vcxproj
  8. +20 −2 Source/Core/Core/Core.vcxproj.filters
  9. +2 −1 Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp
  10. +1 −0 Source/Core/Core/HotkeyManager.cpp
  11. +1 −0 Source/Core/Core/HotkeyManager.h
  12. +160 −148 Source/Core/Core/IPC_HLE/WII_IPC_HLE.cpp
  13. +0 −1 Source/Core/Core/IPC_HLE/WII_IPC_HLE.h
  14. +21 −16 Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_es.cpp
  15. +90 −0 Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.cpp
  16. +83 −0 Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.h
  17. +139 −142 Source/Core/Core/IPC_HLE/{WII_IPC_HLE_Device_usb.cpp → WII_IPC_HLE_Device_usb_bt_emu.cpp}
  18. +11 −55 Source/Core/Core/IPC_HLE/{WII_IPC_HLE_Device_usb.h → WII_IPC_HLE_Device_usb_bt_emu.h}
  19. +618 −0 Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_real.cpp
  20. +102 −0 Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_real.h
  21. +24 −0 Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_stub.cpp
  22. +24 −0 Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_stub.h
  23. +1 −1 Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_usb_kbd.cpp
  24. +16 −6 Source/Core/Core/IPC_HLE/WII_IPC_HLE_WiiMote.cpp
  25. +5 −5 Source/Core/Core/IPC_HLE/WII_IPC_HLE_WiiMote.h
  26. +3 −2 Source/Core/Core/Movie.cpp
  27. +1 −1 Source/Core/Core/NetPlayClient.cpp
  28. +1 −1 Source/Core/Core/State.cpp
  29. +81 −0 Source/Core/DolphinWX/Config/WiiConfigPane.cpp
  30. +12 −0 Source/Core/DolphinWX/Config/WiiConfigPane.h
  31. +241 −199 Source/Core/DolphinWX/ControllerConfigDiag.cpp
  32. +36 −45 Source/Core/DolphinWX/ControllerConfigDiag.h
  33. +1 −1 Source/Core/DolphinWX/DolphinWX.vcxproj
  34. +10 −0 Source/Core/DolphinWX/Frame.cpp
  35. +13 −9 Source/Core/DolphinWX/FrameTools.cpp
  36. +3 −2 Source/Core/DolphinWX/MainNoGUI.cpp
  37. +1 −1 Source/VSProps/Base.props
@@ -120,6 +120,7 @@
#define WII_STATE "state.dat"

#define WII_SDCARD "sd.raw"
#define WII_BTDINF_BACKUP "btdinf.bak"

#define WII_SETTING "setting.txt"

@@ -35,6 +35,7 @@
#include "Core/HW/Sram.h"
#include "Core/HW/WiimoteReal/WiimoteReal.h"
#include "Core/Host.h"
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.h"
#include "Core/Movie.h"
#include "Core/NetPlayProto.h"
#include "VideoCommon/VideoBackendBase.h"
@@ -399,6 +400,8 @@ bool BootCore(const std::string& _rFilename)
// TODO: remove this if and once Dolphin supports WC24 standby mode.
SConfig::GetInstance().m_SYSCONF->SetData<u8>("IPL.IDL", 0x00);
NOTICE_LOG(BOOT, "Disabling WC24 'standby' (shutdown to idle) to avoid hanging on shutdown");

RestoreBTInfoSection();
}

// Run the game
@@ -145,7 +145,9 @@ set(SRCS ActionReplay.cpp
IPC_HLE/WII_IPC_HLE_Device_net_ssl.cpp
IPC_HLE/WII_IPC_HLE_Device_stm.cpp
IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp
IPC_HLE/WII_IPC_HLE_Device_usb.cpp
IPC_HLE/WII_IPC_HLE_Device_usb_bt_base.cpp
IPC_HLE/WII_IPC_HLE_Device_usb_bt_emu.cpp
IPC_HLE/WII_IPC_HLE_Device_usb_bt_stub.cpp
IPC_HLE/WII_IPC_HLE_Device_usb_kbd.cpp
IPC_HLE/WII_IPC_HLE_Device_usb_ven.cpp
IPC_HLE/WII_IPC_HLE_WiiMote.cpp
@@ -243,7 +245,8 @@ set(LIBS
if(LIBUSB_FOUND)
# Using shared LibUSB
set(LIBS ${LIBS} ${LIBUSB_LIBRARIES})
set(SRCS ${SRCS} IPC_HLE/WII_IPC_HLE_Device_hid.cpp)
set(SRCS ${SRCS} IPC_HLE/WII_IPC_HLE_Device_hid.cpp
IPC_HLE/WII_IPC_HLE_Device_usb_bt_real.cpp)
endif(LIBUSB_FOUND)

set(LIBS ${LIBS} ${MBEDTLS_LIBRARIES})
@@ -55,6 +55,7 @@ void SConfig::SaveSettings()
NOTICE_LOG(BOOT, "Saving settings to %s", File::GetUserPath(F_DOLPHINCONFIG_IDX).c_str());
IniFile ini;
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); // load first to not kill unknown stuff
m_SYSCONF->Reload();

SaveGeneralSettings(ini);
SaveInterfaceSettings(ini);
@@ -67,6 +68,7 @@ void SConfig::SaveSettings()
SaveFifoPlayerSettings(ini);
SaveAnalyticsSettings(ini);
SaveNetworkSettings(ini);
SaveBluetoothPassthroughSettings(ini);

ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX));
m_SYSCONF->Save();
@@ -322,6 +324,16 @@ void SConfig::SaveAnalyticsSettings(IniFile& ini)
analytics->Set("PermissionAsked", m_analytics_permission_asked);
}

void SConfig::SaveBluetoothPassthroughSettings(IniFile& ini)
{
IniFile::Section* section = ini.GetOrCreateSection("BluetoothPassthrough");

section->Set("Enabled", m_bt_passthrough_enabled);
section->Set("VID", m_bt_passthrough_vid);
section->Set("PID", m_bt_passthrough_pid);
section->Set("LinkKeys", m_bt_passthrough_link_keys);
}

void SConfig::LoadSettings()
{
INFO_LOG(BOOT, "Loading Settings from %s", File::GetUserPath(F_DOLPHINCONFIG_IDX).c_str());
@@ -339,6 +351,7 @@ void SConfig::LoadSettings()
LoadFifoPlayerSettings(ini);
LoadNetworkSettings(ini);
LoadAnalyticsSettings(ini);
LoadBluetoothPassthroughSettings(ini);

m_SYSCONF = new SysConf();
}
@@ -604,6 +617,16 @@ void SConfig::LoadAnalyticsSettings(IniFile& ini)
analytics->Get("PermissionAsked", &m_analytics_permission_asked, false);
}

void SConfig::LoadBluetoothPassthroughSettings(IniFile& ini)
{
IniFile::Section* section = ini.GetOrCreateSection("BluetoothPassthrough");

section->Get("Enabled", &m_bt_passthrough_enabled, false);
section->Get("VID", &m_bt_passthrough_vid, -1);
section->Get("PID", &m_bt_passthrough_pid, -1);
section->Get("LinkKeys", &m_bt_passthrough_link_keys, "");
}

void SConfig::LoadDefaults()
{
bEnableDebugging = false;
@@ -143,6 +143,12 @@ struct SConfig : NonCopyable
bool m_analytics_enabled = false;
bool m_analytics_permission_asked = false;

// Bluetooth passthrough mode settings
bool m_bt_passthrough_enabled = false;
int m_bt_passthrough_pid = -1;
int m_bt_passthrough_vid = -1;
std::string m_bt_passthrough_link_keys;

// Fifo Player related settings
bool bLoopFifoReplay = true;

@@ -325,6 +331,7 @@ struct SConfig : NonCopyable
void SaveFifoPlayerSettings(IniFile& ini);
void SaveNetworkSettings(IniFile& ini);
void SaveAnalyticsSettings(IniFile& ini);
void SaveBluetoothPassthroughSettings(IniFile& ini);

void LoadGeneralSettings(IniFile& ini);
void LoadInterfaceSettings(IniFile& ini);
@@ -337,6 +344,7 @@ struct SConfig : NonCopyable
void LoadFifoPlayerSettings(IniFile& ini);
void LoadNetworkSettings(IniFile& ini);
void LoadAnalyticsSettings(IniFile& ini);
void LoadBluetoothPassthroughSettings(IniFile& ini);

static SConfig* m_Instance;
};
@@ -52,7 +52,7 @@
#include "Core/HW/SystemTimers.h"
#include "Core/HW/VideoInterface.h"
#include "Core/HW/Wiimote.h"
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb.h"
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_emu.h"
#include "Core/IPC_HLE/WII_IPC_HLE_WiiMote.h"
#include "Core/IPC_HLE/WII_Socket.h"
#include "Core/Movie.h"
@@ -297,7 +297,7 @@ void Stop() // - Hammertime!

g_video_backend->Video_ExitLoop();
}
#if defined(__LIBUSB__) || defined(_WIN32)
#if defined(__LIBUSB__)
GCAdapter::ResetRumble();
#endif

@@ -528,7 +528,7 @@ void EmuThread()
}

// Load and Init Wiimotes - only if we are booting in Wii mode
if (core_parameter.bWii)
if (core_parameter.bWii && !SConfig::GetInstance().m_bt_passthrough_enabled)
{
if (init_controllers)
Wiimote::Initialize(s_window_handle, !s_state_filename.empty() ?
@@ -698,7 +698,7 @@ void SetState(EState state)
// stopped (including the CPU).
CPU::EnableStepping(true); // Break
Wiimote::Pause();
#if defined(__LIBUSB__) || defined(_WIN32)
#if defined(__LIBUSB__)
GCAdapter::ResetRumble();
#endif
break;
@@ -818,7 +818,7 @@ bool PauseAndLock(bool do_lock, bool unpause_on_unlock)
// (s_efbAccessRequested).
Fifo::PauseAndLock(do_lock, false);

#if defined(__LIBUSB__) || defined(_WIN32)
#if defined(__LIBUSB__)
GCAdapter::ResetRumble();
#endif

@@ -185,7 +185,12 @@
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_net_ssl.cpp" />
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_stm.cpp" />
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_sdio_slot0.cpp" />
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb.cpp" />
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_base.cpp" />
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_emu.cpp" />
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_real.cpp">
<DisableSpecificWarnings>4200;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_stub.cpp" />
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_kbd.cpp" />
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_ven.cpp" />
<ClCompile Include="IPC_HLE\WII_IPC_HLE_WiiMote.cpp" />
@@ -389,7 +394,10 @@
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_net_ssl.h" />
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_stm.h" />
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_sdio_slot0.h" />
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb.h" />
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_base.h" />
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_emu.h" />
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_real.h" />
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_stub.h" />
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_kbd.h" />
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_ven.h" />
<ClInclude Include="IPC_HLE\WII_IPC_HLE_WiiMote.h" />
@@ -591,7 +591,16 @@
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_hid.cpp">
<Filter>IPC HLE %28IOS/Starlet%29\USB</Filter>
</ClCompile>
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb.cpp">
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_base.cpp">
<Filter>IPC HLE %28IOS/Starlet%29\USB/BT/Wiimote</Filter>
</ClCompile>
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_emu.cpp">
<Filter>IPC HLE %28IOS/Starlet%29\USB/BT/Wiimote</Filter>
</ClCompile>
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_real.cpp">
<Filter>IPC HLE %28IOS/Starlet%29\USB/BT/Wiimote</Filter>
</ClCompile>
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_stub.cpp">
<Filter>IPC HLE %28IOS/Starlet%29\USB/BT/Wiimote</Filter>
</ClCompile>
<ClCompile Include="IPC_HLE\WII_IPC_HLE_WiiMote.cpp">
@@ -1148,7 +1157,16 @@
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_hid.h">
<Filter>IPC HLE %28IOS/Starlet%29\USB</Filter>
</ClInclude>
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb.h">
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_base.h">
<Filter>IPC HLE %28IOS/Starlet%29\USB/BT/Wiimote</Filter>
</ClInclude>
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_emu.h">
<Filter>IPC HLE %28IOS/Starlet%29\USB/BT/Wiimote</Filter>
</ClInclude>
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_real.h">
<Filter>IPC HLE %28IOS/Starlet%29\USB/BT/Wiimote</Filter>
</ClInclude>
<ClInclude Include="IPC_HLE\WII_IPC_HLE_Device_usb_bt_stub.h">
<Filter>IPC HLE %28IOS/Starlet%29\USB/BT/Wiimote</Filter>
</ClInclude>
<ClInclude Include="IPC_HLE\WII_IPC_HLE_WiiMote.h">
@@ -702,7 +702,8 @@ void Initialize(::Wiimote::InitializeMode init_mode)
g_wiimote_scanner.StartThread();
}

if (SConfig::GetInstance().m_WiimoteContinuousScanning)
if (SConfig::GetInstance().m_WiimoteContinuousScanning &&
!SConfig::GetInstance().m_bt_passthrough_enabled)
g_wiimote_scanner.SetScanMode(WiimoteScanMode::CONTINUOUSLY_SCAN);
else
g_wiimote_scanner.SetScanMode(WiimoteScanMode::DO_NOT_SCAN);
@@ -32,6 +32,7 @@ const std::string hotkey_labels[] = {
_trans("Take Screenshot"),
_trans("Exit"),

_trans("Press Sync Button"),
_trans("Connect Wiimote 1"),
_trans("Connect Wiimote 2"),
_trans("Connect Wiimote 3"),
@@ -31,6 +31,7 @@ enum Hotkey
HK_SCREENSHOT,
HK_EXIT,

HK_TRIGGER_SYNC_BUTTON,
HK_WIIMOTE1_CONNECT,
HK_WIIMOTE2_CONNECT,
HK_WIIMOTE3_CONNECT,
Oops, something went wrong.

0 comments on commit 6ec7569

Please sign in to comment.
You can’t perform that action at this time.