diff --git a/Externals/libpng/png/png.vcxproj b/Externals/libpng/png/png.vcxproj
index f801a36e93..02acca79fe 100644
--- a/Externals/libpng/png/png.vcxproj
+++ b/Externals/libpng/png/png.vcxproj
@@ -57,7 +57,6 @@
-
@@ -75,7 +74,7 @@
-
+
{ff213b23-2c26-4214-9f88-85271e557e87}
diff --git a/Externals/miniupnpc/miniupnpc.vcxproj b/Externals/miniupnpc/miniupnpc.vcxproj
index e1e8baaab9..74a4ee3e5b 100644
--- a/Externals/miniupnpc/miniupnpc.vcxproj
+++ b/Externals/miniupnpc/miniupnpc.vcxproj
@@ -70,7 +70,6 @@
-
diff --git a/Externals/wxWidgets3/build/msw/wx_base.vcxproj b/Externals/wxWidgets3/build/msw/wx_base.vcxproj
index 09bb56032c..43c558299e 100644
--- a/Externals/wxWidgets3/build/msw/wx_base.vcxproj
+++ b/Externals/wxWidgets3/build/msw/wx_base.vcxproj
@@ -1256,14 +1256,6 @@
true
-
-
- {01573c36-ac6e-49f6-94ba-572517eb9740}
-
-
- {3e1339f5-9311-4122-9442-369702e8fcad}
-
-
wxWidgets
{1C8436C9-DBAF-42BE-83BC-CF3EC9175ABE}
@@ -1294,6 +1286,14 @@
__WXDEBUG__;%(PreprocessorDefinitions)
+
+
+ {01573c36-ac6e-49f6-94ba-572517eb9740}
+
+
+ {3e1339f5-9311-4122-9442-369702e8fcad}
+
+
diff --git a/Source/Core/AudioCommon/AudioCommon.vcxproj b/Source/Core/AudioCommon/AudioCommon.vcxproj
index d80bed06d6..c626ffd77d 100644
--- a/Source/Core/AudioCommon/AudioCommon.vcxproj
+++ b/Source/Core/AudioCommon/AudioCommon.vcxproj
@@ -68,10 +68,10 @@
-
+
{ec082900-b4d8-42e9-9663-77f02f6936ae}
-
+
{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}
diff --git a/Source/Core/AudioCommon/OpenALStream.cpp b/Source/Core/AudioCommon/OpenALStream.cpp
index f82202c5da..b4628453ba 100644
--- a/Source/Core/AudioCommon/OpenALStream.cpp
+++ b/Source/Core/AudioCommon/OpenALStream.cpp
@@ -11,6 +11,10 @@
#if defined HAVE_OPENAL && HAVE_OPENAL
+#ifdef _WIN32
+#pragma comment(lib, "openal32.lib")
+#endif
+
static soundtouch::SoundTouch soundTouch;
//
diff --git a/Source/Core/Common/Common.vcxproj b/Source/Core/Common/Common.vcxproj
index 67f8a9a5a6..814ac4f04f 100644
--- a/Source/Core/Common/Common.vcxproj
+++ b/Source/Core/Common/Common.vcxproj
@@ -127,7 +127,7 @@
-
+
{bdb6578b-0691-4e80-a46c-df21639fd3b8}
diff --git a/Source/Core/Common/CommonFuncs.h b/Source/Core/Common/CommonFuncs.h
index eb26364d51..cf197ef660 100644
--- a/Source/Core/Common/CommonFuncs.h
+++ b/Source/Core/Common/CommonFuncs.h
@@ -161,6 +161,12 @@ extern "C"
__declspec(dllimport) void __stdcall DebugBreak(void);
}
#define Crash() {DebugBreak();}
+
+ #if (_MSC_VER > 1800)
+ #error alignof compat can be removed
+ #else
+ #define alignof(x) __alignof(x)
+ #endif
#endif // WIN32 ndef
// Generic function to get last error message.
diff --git a/Source/Core/Core/Core.vcxproj b/Source/Core/Core/Core.vcxproj
index 3a72bd0f47..70fc5b8022 100644
--- a/Source/Core/Core/Core.vcxproj
+++ b/Source/Core/Core/Core.vcxproj
@@ -419,40 +419,43 @@
-
+
{8ada04d7-6db1-4da4-ab55-64fb12a0997b}
-
+
{349ee8f9-7d25-4909-aaf5-ff3fade72187}
-
+
{ab993f38-c31d-4897-b139-a620c42bc565}
-
+
+ {31643fdb-1bb8-4965-9de7-000fc88d35ae}
+
+
{bdb6578b-0691-4e80-a46c-df21639fd3b8}
-
+
{0a18a071-125e-442f-aff7-a3f68abecf99}
-
+
{93d73454-2512-424e-9cda-4bb357fe13dd}
-
+
{54aa7840-5beb-4a0c-9452-74ba4cc7fd44}
-
+
{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}
-
+
{41279555-f94f-4ebc-99de-af863c10c5c4}
-
+
{160bdc25-5626-4b0d-bdd8-2953d9777fb5}
-
+
{6bbd47cf-91fd-4077-b676-8b76980178a9}
-
+
{3de9ee35-3e91-4f27-a014-2866ad8c3fe3}
diff --git a/Source/Core/Core/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/HW/WiimoteReal/IOWin.cpp
index 67481b3d80..219c2cd421 100644
--- a/Source/Core/Core/HW/WiimoteReal/IOWin.cpp
+++ b/Source/Core/Core/HW/WiimoteReal/IOWin.cpp
@@ -6,6 +6,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -22,52 +23,35 @@
//#define AUTHENTICATE_WIIMOTES
#define SHARE_WRITE_WIIMOTES
-typedef struct _HIDD_ATTRIBUTES
-{
- ULONG Size;
- USHORT VendorID;
- USHORT ProductID;
- USHORT VersionNumber;
-} HIDD_ATTRIBUTES, *PHIDD_ATTRIBUTES;
+// Create func_t function pointer type and declare a nullptr-initialized static variable of that
+// type named "pfunc".
+#define DYN_FUNC_DECLARE(func) \
+ typedef decltype(&func) func ## _t; \
+ static func ## _t p ## func = nullptr;
-typedef VOID (__stdcall *PHidD_GetHidGuid)(LPGUID);
-typedef BOOLEAN (__stdcall *PHidD_GetAttributes)(HANDLE, PHIDD_ATTRIBUTES);
-typedef BOOLEAN (__stdcall *PHidD_SetOutputReport)(HANDLE, PVOID, ULONG);
-typedef BOOLEAN (__stdcall *PHidD_GetProductString)(HANDLE, PVOID, ULONG);
+DYN_FUNC_DECLARE(HidD_GetHidGuid);
+DYN_FUNC_DECLARE(HidD_GetAttributes);
+DYN_FUNC_DECLARE(HidD_SetOutputReport);
+DYN_FUNC_DECLARE(HidD_GetProductString);
-typedef BOOL (__stdcall *PBth_BluetoothFindDeviceClose)(HBLUETOOTH_DEVICE_FIND);
-typedef HBLUETOOTH_DEVICE_FIND (__stdcall *PBth_BluetoothFindFirstDevice)(const BLUETOOTH_DEVICE_SEARCH_PARAMS*, BLUETOOTH_DEVICE_INFO*);
-typedef HBLUETOOTH_RADIO_FIND (__stdcall *PBth_BluetoothFindFirstRadio)(const BLUETOOTH_FIND_RADIO_PARAMS*,HANDLE*);
-typedef BOOL (__stdcall *PBth_BluetoothFindNextDevice)(HBLUETOOTH_DEVICE_FIND, BLUETOOTH_DEVICE_INFO*);
-typedef BOOL (__stdcall *PBth_BluetoothFindNextRadio)(HBLUETOOTH_RADIO_FIND, HANDLE*);
-typedef BOOL (__stdcall *PBth_BluetoothFindRadioClose)(HBLUETOOTH_RADIO_FIND);
-typedef DWORD (__stdcall *PBth_BluetoothGetRadioInfo)(HANDLE, PBLUETOOTH_RADIO_INFO);
-typedef DWORD (__stdcall *PBth_BluetoothRemoveDevice)(const BLUETOOTH_ADDRESS*);
-typedef DWORD (__stdcall *PBth_BluetoothSetServiceState)(HANDLE, const BLUETOOTH_DEVICE_INFO*, const GUID*, DWORD);
-typedef DWORD (__stdcall *PBth_BluetoothAuthenticateDevice)(HWND, HANDLE, BLUETOOTH_DEVICE_INFO*, PWCHAR, ULONG);
-typedef DWORD (__stdcall *PBth_BluetoothEnumerateInstalledServices)(HANDLE, BLUETOOTH_DEVICE_INFO*, DWORD*, GUID*);
+DYN_FUNC_DECLARE(BluetoothFindDeviceClose);
+DYN_FUNC_DECLARE(BluetoothFindFirstDevice);
+DYN_FUNC_DECLARE(BluetoothFindFirstRadio);
+DYN_FUNC_DECLARE(BluetoothFindNextDevice);
+DYN_FUNC_DECLARE(BluetoothFindNextRadio);
+DYN_FUNC_DECLARE(BluetoothFindRadioClose);
+DYN_FUNC_DECLARE(BluetoothGetRadioInfo);
+DYN_FUNC_DECLARE(BluetoothRemoveDevice);
+DYN_FUNC_DECLARE(BluetoothSetServiceState);
+DYN_FUNC_DECLARE(BluetoothAuthenticateDeviceEx);
+DYN_FUNC_DECLARE(BluetoothEnumerateInstalledServices);
-PHidD_GetHidGuid HidD_GetHidGuid = nullptr;
-PHidD_GetAttributes HidD_GetAttributes = nullptr;
-PHidD_SetOutputReport HidD_SetOutputReport = nullptr;
-PHidD_GetProductString HidD_GetProductString = nullptr;
+#undef DYN_FUNC_DECLARE
-PBth_BluetoothFindDeviceClose Bth_BluetoothFindDeviceClose = nullptr;
-PBth_BluetoothFindFirstDevice Bth_BluetoothFindFirstDevice = nullptr;
-PBth_BluetoothFindFirstRadio Bth_BluetoothFindFirstRadio = nullptr;
-PBth_BluetoothFindNextDevice Bth_BluetoothFindNextDevice = nullptr;
-PBth_BluetoothFindNextRadio Bth_BluetoothFindNextRadio = nullptr;
-PBth_BluetoothFindRadioClose Bth_BluetoothFindRadioClose = nullptr;
-PBth_BluetoothGetRadioInfo Bth_BluetoothGetRadioInfo = nullptr;
-PBth_BluetoothRemoveDevice Bth_BluetoothRemoveDevice = nullptr;
-PBth_BluetoothSetServiceState Bth_BluetoothSetServiceState = nullptr;
-PBth_BluetoothAuthenticateDevice Bth_BluetoothAuthenticateDevice = nullptr;
-PBth_BluetoothEnumerateInstalledServices Bth_BluetoothEnumerateInstalledServices = nullptr;
+static HINSTANCE s_hid_lib = nullptr;
+static HINSTANCE s_bthprops_lib = nullptr;
-HINSTANCE hid_lib = nullptr;
-HINSTANCE bthprops_lib = nullptr;
-
-static bool initialized = false;
+static bool s_loaded_ok = false;
std::unordered_map g_connect_times;
@@ -76,59 +60,127 @@ std::unordered_set> g_connected_wiimotes;
std::mutex g_connected_wiimotes_lock;
#endif
+#define DYN_FUNC_UNLOAD(func) \
+ p ## func = nullptr;
+
+// Attempt to load the function from the given module handle.
+#define DYN_FUNC_LOAD(module, func) \
+ p ## func = ( func ## _t)::GetProcAddress(module, # func ); \
+ if (! p ## func ) \
+ { \
+ return false; \
+ }
+
+bool load_hid()
+{
+ auto loader = [&]()
+ {
+ s_hid_lib = ::LoadLibrary(_T("hid.dll"));
+ if (!s_hid_lib)
+ {
+ return false;
+ }
+
+ DYN_FUNC_LOAD(s_hid_lib, HidD_GetHidGuid);
+ DYN_FUNC_LOAD(s_hid_lib, HidD_GetAttributes);
+ DYN_FUNC_LOAD(s_hid_lib, HidD_SetOutputReport);
+ DYN_FUNC_LOAD(s_hid_lib, HidD_GetProductString);
+
+ return true;
+ };
+
+ bool loaded_ok = loader();
+
+ if (!loaded_ok)
+ {
+ DYN_FUNC_UNLOAD(HidD_GetHidGuid);
+ DYN_FUNC_UNLOAD(HidD_GetAttributes);
+ DYN_FUNC_UNLOAD(HidD_SetOutputReport);
+ DYN_FUNC_UNLOAD(HidD_GetProductString);
+
+ if (s_hid_lib)
+ {
+ ::FreeLibrary(s_hid_lib);
+ s_hid_lib = nullptr;
+ }
+ }
+
+ return loaded_ok;
+}
+
+bool load_bthprops()
+{
+ auto loader = [&]()
+ {
+ s_bthprops_lib = ::LoadLibrary(_T("bthprops.cpl"));
+ if (!s_bthprops_lib)
+ {
+ return false;
+ }
+
+ DYN_FUNC_LOAD(s_bthprops_lib, BluetoothFindDeviceClose);
+ DYN_FUNC_LOAD(s_bthprops_lib, BluetoothFindFirstDevice);
+ DYN_FUNC_LOAD(s_bthprops_lib, BluetoothFindFirstRadio);
+ DYN_FUNC_LOAD(s_bthprops_lib, BluetoothFindNextDevice);
+ DYN_FUNC_LOAD(s_bthprops_lib, BluetoothFindNextRadio);
+ DYN_FUNC_LOAD(s_bthprops_lib, BluetoothFindRadioClose);
+ DYN_FUNC_LOAD(s_bthprops_lib, BluetoothGetRadioInfo);
+ DYN_FUNC_LOAD(s_bthprops_lib, BluetoothRemoveDevice);
+ DYN_FUNC_LOAD(s_bthprops_lib, BluetoothSetServiceState);
+ DYN_FUNC_LOAD(s_bthprops_lib, BluetoothAuthenticateDeviceEx);
+ DYN_FUNC_LOAD(s_bthprops_lib, BluetoothEnumerateInstalledServices);
+
+ return true;
+ };
+
+ bool loaded_ok = loader();
+
+ if (!loaded_ok)
+ {
+ DYN_FUNC_UNLOAD(BluetoothFindDeviceClose);
+ DYN_FUNC_UNLOAD(BluetoothFindFirstDevice);
+ DYN_FUNC_UNLOAD(BluetoothFindFirstRadio);
+ DYN_FUNC_UNLOAD(BluetoothFindNextDevice);
+ DYN_FUNC_UNLOAD(BluetoothFindNextRadio);
+ DYN_FUNC_UNLOAD(BluetoothFindRadioClose);
+ DYN_FUNC_UNLOAD(BluetoothGetRadioInfo);
+ DYN_FUNC_UNLOAD(BluetoothRemoveDevice);
+ DYN_FUNC_UNLOAD(BluetoothSetServiceState);
+ DYN_FUNC_UNLOAD(BluetoothAuthenticateDeviceEx);
+ DYN_FUNC_UNLOAD(BluetoothEnumerateInstalledServices);
+
+ if (s_bthprops_lib)
+ {
+ ::FreeLibrary(s_bthprops_lib);
+ s_bthprops_lib = nullptr;
+ }
+ }
+
+ return loaded_ok;
+}
+
+#undef DYN_FUNC_LOAD
+#undef DYN_FUNC_UNLOAD
+
inline void init_lib()
{
+ static bool initialized = false;
+
if (!initialized)
{
- hid_lib = LoadLibrary(_T("hid.dll"));
- if (!hid_lib)
- {
- PanicAlertT("Failed to load hid.dll! Connecting real Wiimotes won't work and Dolphin might crash unexpectedly!");
- return;
- }
-
- HidD_GetHidGuid = (PHidD_GetHidGuid)GetProcAddress(hid_lib, "HidD_GetHidGuid");
- HidD_GetAttributes = (PHidD_GetAttributes)GetProcAddress(hid_lib, "HidD_GetAttributes");
- HidD_SetOutputReport = (PHidD_SetOutputReport)GetProcAddress(hid_lib, "HidD_SetOutputReport");
- HidD_GetProductString = (PHidD_GetProductString)GetProcAddress(hid_lib, "HidD_GetProductString");
- if (!HidD_GetHidGuid || !HidD_GetAttributes ||
- !HidD_SetOutputReport || !HidD_GetProductString)
- {
- PanicAlertT("Failed to load hid.dll! Connecting real Wiimotes won't work and Dolphin might crash unexpectedly!");
- return;
- }
-
- bthprops_lib = LoadLibrary(_T("bthprops.cpl"));
- if (!bthprops_lib)
- {
- PanicAlertT("Failed to load bthprops.cpl! Connecting real Wiimotes won't work and Dolphin might crash unexpectedly!");
- return;
- }
-
- Bth_BluetoothFindDeviceClose = (PBth_BluetoothFindDeviceClose)GetProcAddress(bthprops_lib, "BluetoothFindDeviceClose");
- Bth_BluetoothFindFirstDevice = (PBth_BluetoothFindFirstDevice)GetProcAddress(bthprops_lib, "BluetoothFindFirstDevice");
- Bth_BluetoothFindFirstRadio = (PBth_BluetoothFindFirstRadio)GetProcAddress(bthprops_lib, "BluetoothFindFirstRadio");
- Bth_BluetoothFindNextDevice = (PBth_BluetoothFindNextDevice)GetProcAddress(bthprops_lib, "BluetoothFindNextDevice");
- Bth_BluetoothFindNextRadio = (PBth_BluetoothFindNextRadio)GetProcAddress(bthprops_lib, "BluetoothFindNextRadio");
- Bth_BluetoothFindRadioClose = (PBth_BluetoothFindRadioClose)GetProcAddress(bthprops_lib, "BluetoothFindRadioClose");
- Bth_BluetoothGetRadioInfo = (PBth_BluetoothGetRadioInfo)GetProcAddress(bthprops_lib, "BluetoothGetRadioInfo");
- Bth_BluetoothRemoveDevice = (PBth_BluetoothRemoveDevice)GetProcAddress(bthprops_lib, "BluetoothRemoveDevice");
- Bth_BluetoothSetServiceState = (PBth_BluetoothSetServiceState)GetProcAddress(bthprops_lib, "BluetoothSetServiceState");
- Bth_BluetoothAuthenticateDevice = (PBth_BluetoothAuthenticateDevice)GetProcAddress(bthprops_lib, "BluetoothAuthenticateDevice");
- Bth_BluetoothEnumerateInstalledServices = (PBth_BluetoothEnumerateInstalledServices)GetProcAddress(bthprops_lib, "BluetoothEnumerateInstalledServices");
-
- if (!Bth_BluetoothFindDeviceClose || !Bth_BluetoothFindFirstDevice ||
- !Bth_BluetoothFindFirstRadio || !Bth_BluetoothFindNextDevice ||
- !Bth_BluetoothFindNextRadio || !Bth_BluetoothFindRadioClose ||
- !Bth_BluetoothGetRadioInfo || !Bth_BluetoothRemoveDevice ||
- !Bth_BluetoothSetServiceState || !Bth_BluetoothAuthenticateDevice ||
- !Bth_BluetoothEnumerateInstalledServices)
- {
- PanicAlertT("Failed to load bthprops.cpl! Connecting real Wiimotes won't work and Dolphin might crash unexpectedly!");
- return;
- }
-
+ // Only try once
initialized = true;
+
+ // After these calls, we know all dynamically loaded APIs will either all be valid or
+ // all nullptr.
+ if (!load_hid() || !load_bthprops())
+ {
+ NOTICE_LOG(WIIMOTE,
+ "Failed to load bluetooth support libraries, wiimotes will not function");
+ return;
+ }
+
+ s_loaded_ok = true;
}
}
@@ -167,6 +219,9 @@ WiimoteScanner::~WiimoteScanner()
void WiimoteScanner::Update()
{
+ if (!s_loaded_ok)
+ return;
+
bool forgot_some = false;
ProcessWiimotes(false, [&](HANDLE, BLUETOOTH_RADIO_INFO&, BLUETOOTH_DEVICE_INFO_STRUCT& btdi)
@@ -186,6 +241,9 @@ void WiimoteScanner::Update()
// Returns the total number of found and connected wiimotes.
void WiimoteScanner::FindWiimotes(std::vector & found_wiimotes, Wiimote* & found_board)
{
+ if (!s_loaded_ok)
+ return;
+
ProcessWiimotes(true, [](HANDLE hRadio, const BLUETOOTH_RADIO_INFO& rinfo, BLUETOOTH_DEVICE_INFO_STRUCT& btdi)
{
ForgetWiimote(btdi);
@@ -194,7 +252,7 @@ void WiimoteScanner::FindWiimotes(std::vector & found_wiimotes, Wiimot
// Get the device id
GUID device_id;
- HidD_GetHidGuid(&device_id);
+ pHidD_GetHidGuid(&device_id);
// Get all hid devices connected
HDEVINFO const device_info = SetupDiGetClassDevs(&device_id, nullptr, nullptr, (DIGCF_DEVICEINTERFACE | DIGCF_PRESENT));
@@ -279,7 +337,7 @@ int CheckDeviceType_Read(HANDLE &dev_handle, u8* buf, int attempts)
return read;
}
-// A convoluted way of checking if a device is a Wii Balance Board and if it is a connectable Wiimote.
+// A convoluted way of checking if a device is a Wii Balance Board and if it is a connectible Wiimote.
// Because nothing on Windows should be easy.
// (We can't seem to easily identify the bluetooth device an HID device belongs to...)
void WiimoteScanner::CheckDeviceType(std::basic_string &devicepath, bool &real_wiimote, bool &is_bb)
@@ -305,7 +363,7 @@ void WiimoteScanner::CheckDeviceType(std::basic_string &devicepath, bool
HIDD_ATTRIBUTES attrib;
attrib.Size = sizeof(attrib);
if (!check_vidpid ||
- (HidD_GetAttributes(dev_handle, &attrib) &&
+ (pHidD_GetAttributes(dev_handle, &attrib) &&
(attrib.VendorID == 0x057e) &&
(attrib.ProductID == 0x0306)))
{
@@ -417,17 +475,22 @@ void WiimoteScanner::CheckDeviceType(std::basic_string &devicepath, bool
bool WiimoteScanner::IsReady() const
{
+ if (!s_loaded_ok)
+ {
+ return false;
+ }
+
// TODO: don't search for a radio each time
BLUETOOTH_FIND_RADIO_PARAMS radioParam;
radioParam.dwSize = sizeof(radioParam);
HANDLE hRadio;
- HBLUETOOTH_RADIO_FIND hFindRadio = Bth_BluetoothFindFirstRadio(&radioParam, &hRadio);
+ HBLUETOOTH_RADIO_FIND hFindRadio = pBluetoothFindFirstRadio(&radioParam, &hRadio);
if (nullptr != hFindRadio)
{
- Bth_BluetoothFindRadioClose(hFindRadio);
+ pBluetoothFindRadioClose(hFindRadio);
return true;
}
else
@@ -468,7 +531,7 @@ bool Wiimote::ConnectInternal()
#if 0
TCHAR name[128] = {};
- HidD_GetProductString(dev_handle, name, 128);
+ pHidD_GetProductString(dev_handle, name, 128);
//ERROR_LOG(WIIMOTE, "Product string: %s", TStrToUTF8(name).c_str());
@@ -483,7 +546,7 @@ bool Wiimote::ConnectInternal()
#if 0
HIDD_ATTRIBUTES attr;
attr.Size = sizeof(attr);
- if (!HidD_GetAttributes(dev_handle, &attr))
+ if (!pHidD_GetAttributes(dev_handle, &attr))
{
CloseHandle(dev_handle);
dev_handle = 0;
@@ -640,7 +703,7 @@ int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stac
}
case MSBT_STACK_MS:
{
- auto result = HidD_SetOutputReport(dev_handle, const_cast(buf) + 1, (ULONG)(len - 1));
+ auto result = pHidD_SetOutputReport(dev_handle, const_cast(buf) + 1, (ULONG)(len - 1));
//FlushFileBuffers(dev_handle);
if (!result)
@@ -744,13 +807,13 @@ void ProcessWiimotes(bool new_scan, T& callback)
// TODO: save radio(s) in the WiimoteScanner constructor?
// Enumerate BT radios
- HBLUETOOTH_RADIO_FIND hFindRadio = Bth_BluetoothFindFirstRadio(&radioParam, &hRadio);
+ HBLUETOOTH_RADIO_FIND hFindRadio = pBluetoothFindFirstRadio(&radioParam, &hRadio);
while (hFindRadio)
{
BLUETOOTH_RADIO_INFO radioInfo;
radioInfo.dwSize = sizeof(radioInfo);
- auto const rinfo_result = Bth_BluetoothGetRadioInfo(hRadio, &radioInfo);
+ auto const rinfo_result = pBluetoothGetRadioInfo(hRadio, &radioInfo);
if (ERROR_SUCCESS == rinfo_result)
{
srch.hRadio = hRadio;
@@ -759,7 +822,7 @@ void ProcessWiimotes(bool new_scan, T& callback)
btdi.dwSize = sizeof(btdi);
// Enumerate BT devices
- HBLUETOOTH_DEVICE_FIND hFindDevice = Bth_BluetoothFindFirstDevice(&srch, &btdi);
+ HBLUETOOTH_DEVICE_FIND hFindDevice = pBluetoothFindFirstDevice(&srch, &btdi);
while (hFindDevice)
{
// btdi.szName is sometimes missing it's content - it's a bt feature..
@@ -771,17 +834,17 @@ void ProcessWiimotes(bool new_scan, T& callback)
callback(hRadio, radioInfo, btdi);
}
- if (false == Bth_BluetoothFindNextDevice(hFindDevice, &btdi))
+ if (false == pBluetoothFindNextDevice(hFindDevice, &btdi))
{
- Bth_BluetoothFindDeviceClose(hFindDevice);
+ pBluetoothFindDeviceClose(hFindDevice);
hFindDevice = nullptr;
}
}
}
- if (false == Bth_BluetoothFindNextRadio(hFindRadio, &hRadio))
+ if (false == pBluetoothFindNextRadio(hFindRadio, &hRadio))
{
- Bth_BluetoothFindRadioClose(hFindRadio);
+ pBluetoothFindRadioClose(hFindRadio);
hFindRadio = nullptr;
}
}
@@ -791,7 +854,7 @@ void RemoveWiimote(BLUETOOTH_DEVICE_INFO_STRUCT& btdi)
{
//if (btdi.fConnected)
{
- if (SUCCEEDED(Bth_BluetoothRemoveDevice(&btdi.Address)))
+ if (SUCCEEDED(pBluetoothRemoveDevice(&btdi.Address)))
{
NOTICE_LOG(WIIMOTE, "Removed BT Device", GetLastError());
}
@@ -812,18 +875,21 @@ bool AttachWiimote(HANDLE hRadio, const BLUETOOTH_RADIO_INFO& radio_info, BLUETO
#if defined(AUTHENTICATE_WIIMOTES)
// Authenticate
auto const& radio_addr = radio_info.address.rgBytes;
- const DWORD auth_result = Bth_BluetoothAuthenticateDevice(nullptr, hRadio, &btdi,
- std::vector(radio_addr, radio_addr + 6).data(), 6);
+ // FIXME Not sure this usage of OOB_DATA_INFO is correct...
+ BLUETOOTH_OOB_DATA_INFO oob_data_info = { 0 };
+ memcpy(&oob_data_info.C[0], &radio_addr[0], sizeof(WCHAR) * 6);
+ const DWORD auth_result = pBluetoothAuthenticateDeviceEx(nullptr, hRadio, &btdi,
+ &oob_data_info, MITMProtectionNotDefined);
if (ERROR_SUCCESS != auth_result)
{
- ERROR_LOG(WIIMOTE, "AttachWiimote: BluetoothAuthenticateDevice returned %08x", auth_result);
+ ERROR_LOG(WIIMOTE, "AttachWiimote: BluetoothAuthenticateDeviceEx returned %08x", auth_result);
}
DWORD pcServices = 16;
GUID guids[16];
// If this is not done, the Wii device will not remember the pairing
- const DWORD srv_result = Bth_BluetoothEnumerateInstalledServices(hRadio, &btdi, &pcServices, guids);
+ const DWORD srv_result = pBluetoothEnumerateInstalledServices(hRadio, &btdi, &pcServices, guids);
if (ERROR_SUCCESS != srv_result)
{
@@ -831,8 +897,8 @@ bool AttachWiimote(HANDLE hRadio, const BLUETOOTH_RADIO_INFO& radio_info, BLUETO
}
#endif
// Activate service
- const DWORD hr = Bth_BluetoothSetServiceState(hRadio, &btdi,
- &HumanInterfaceDeviceServiceClass_UUID, BLUETOOTH_SERVICE_ENABLE);
+ const DWORD hr = pBluetoothSetServiceState(hRadio, &btdi,
+ &HumanInterfaceDeviceServiceClass_UUID, BLUETOOTH_SERVICE_ENABLE);
g_connect_times[btdi.Address.ullLong] = std::time(nullptr);
@@ -865,7 +931,7 @@ bool ForgetWiimote(BLUETOOTH_DEVICE_INFO_STRUCT& btdi)
// Make Windows forget about device so it will re-find it if visible.
// This is also required to detect a disconnect for some reason..
NOTICE_LOG(WIIMOTE, "Removing remembered Wiimote.");
- Bth_BluetoothRemoveDevice(&btdi.Address);
+ pBluetoothRemoveDevice(&btdi.Address);
return true;
}
}
diff --git a/Source/Core/DiscIO/DiscIO.vcxproj b/Source/Core/DiscIO/DiscIO.vcxproj
index e28d5b784d..f11b8e4aee 100644
--- a/Source/Core/DiscIO/DiscIO.vcxproj
+++ b/Source/Core/DiscIO/DiscIO.vcxproj
@@ -86,13 +86,13 @@
-
+
{bdb6578b-0691-4e80-a46c-df21639fd3b8}
-
+
{ff213b23-2c26-4214-9f88-85271e557e87}
-
+
{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}
diff --git a/Source/Core/DolphinWX/DolphinWX.vcxproj b/Source/Core/DolphinWX/DolphinWX.vcxproj
index 69131eaefb..848e36f114 100644
--- a/Source/Core/DolphinWX/DolphinWX.vcxproj
+++ b/Source/Core/DolphinWX/DolphinWX.vcxproj
@@ -40,11 +40,11 @@
0x00400000
false
true
- ..\..\..\Externals\SDL2-2.0.1\lib\$(PlatformName);..\..\..\Externals\OpenAL\$(PlatformName);%(AdditionalLibraryDirectories)
- dsound.lib;iphlpapi.lib;winmm.lib;setupapi.lib;vfw32.lib;opengl32.lib;glu32.lib;rpcrt4.lib;comctl32.lib;OpenAL32.lib;%(AdditionalDependencies)
+ $(ExternalsDir)OpenAL\$(PlatformName);%(AdditionalLibraryDirectories)
+ iphlpapi.lib;winmm.lib;setupapi.lib;vfw32.lib;opengl32.lib;glu32.lib;rpcrt4.lib;comctl32.lib;%(AdditionalDependencies)
- ..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories)
+ $(ExternalsDir)wxWidgets3\include;%(AdditionalIncludeDirectories)
@@ -152,58 +152,55 @@
-
+
-
+
{8ada04d7-6db1-4da4-ab55-64fb12a0997b}
-
+
{4c9f135b-a85e-430c-bad4-4c67ef5fc12c}
-
+
{ab993f38-c31d-4897-b139-a620c42bc565}
-
- {31643fdb-1bb8-4965-9de7-000fc88d35ae}
-
-
+
{93d73454-2512-424e-9cda-4bb357fe13dd}
-
+
{1c8436c9-dbaf-42be-83bc-cf3ec9175abe}
-
+
{ff213b23-2c26-4214-9f88-85271e557e87}
-
+
{54aa7840-5beb-4a0c-9452-74ba4cc7fd44}
-
+
{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}
-
+
{41279555-f94f-4ebc-99de-af863c10c5c4}
-
+
{e54cf649-140e-4255-81a5-30a673c1fb36}
-
+
{160bdc25-5626-4b0d-bdd8-2953d9777fb5}
-
+
{6bbd47cf-91fd-4077-b676-8b76980178a9}
-
+
{96020103-4ba5-4fd2-b4aa-5b6d24492d4e}
-
+
{ec1a314c-5588-4506-9c1e-2e58e5817f75}
-
+
{a4c423aa-f57c-46c7-a172-d1a777017d29}
-
+
{3de9ee35-3e91-4f27-a014-2866ad8c3fe3}
@@ -212,8 +209,8 @@
-
-
+
+
diff --git a/Source/Core/InputCommon/InputCommon.vcxproj b/Source/Core/InputCommon/InputCommon.vcxproj
index 2866846075..06e87bc55d 100644
--- a/Source/Core/InputCommon/InputCommon.vcxproj
+++ b/Source/Core/InputCommon/InputCommon.vcxproj
@@ -64,7 +64,7 @@
-
+
{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}
diff --git a/Source/Core/VideoBackends/D3D/D3D.vcxproj b/Source/Core/VideoBackends/D3D/D3D.vcxproj
index 807018a67a..fd95e42b6d 100644
--- a/Source/Core/VideoBackends/D3D/D3D.vcxproj
+++ b/Source/Core/VideoBackends/D3D/D3D.vcxproj
@@ -81,10 +81,10 @@
-
+
{1c8436c9-dbaf-42be-83bc-cf3ec9175abe}
-
+
{3de9ee35-3e91-4f27-a014-2866ad8c3fe3}
diff --git a/Source/Core/VideoBackends/OGL/OGL.vcxproj b/Source/Core/VideoBackends/OGL/OGL.vcxproj
index 293213cb47..d770fbfa05 100644
--- a/Source/Core/VideoBackends/OGL/OGL.vcxproj
+++ b/Source/Core/VideoBackends/OGL/OGL.vcxproj
@@ -98,13 +98,13 @@
-
+
{1c8436c9-dbaf-42be-83bc-cf3ec9175abe}
-
+
{ff213b23-2c26-4214-9f88-85271e557e87}
-
+
{3de9ee35-3e91-4f27-a014-2866ad8c3fe3}
diff --git a/Source/Core/VideoBackends/Software/Software.vcxproj b/Source/Core/VideoBackends/Software/Software.vcxproj
index eb36055da7..d0322a124d 100644
--- a/Source/Core/VideoBackends/Software/Software.vcxproj
+++ b/Source/Core/VideoBackends/Software/Software.vcxproj
@@ -88,10 +88,10 @@
-
+
{1c8436c9-dbaf-42be-83bc-cf3ec9175abe}
-
+
{3de9ee35-3e91-4f27-a014-2866ad8c3fe3}
diff --git a/Source/Core/VideoCommon/VideoCommon.vcxproj b/Source/Core/VideoCommon/VideoCommon.vcxproj
index d7b1fbdb08..9fd00d4deb 100644
--- a/Source/Core/VideoCommon/VideoCommon.vcxproj
+++ b/Source/Core/VideoCommon/VideoCommon.vcxproj
@@ -130,16 +130,16 @@
-
+
{4c9f135b-a85e-430c-bad4-4c67ef5fc12c}
-
+
{b441cc62-877e-4b3f-93e0-0de80544f705}
-
+
{ff213b23-2c26-4214-9f88-85271e557e87}
-
+
{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}
diff --git a/Source/DSPTool/DSPTool.vcxproj b/Source/DSPTool/DSPTool.vcxproj
index a8cb4b32ba..d962c51247 100644
--- a/Source/DSPTool/DSPTool.vcxproj
+++ b/Source/DSPTool/DSPTool.vcxproj
@@ -53,10 +53,10 @@
-
+
{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}
-
+
{e54cf649-140e-4255-81a5-30a673c1fb36}
diff --git a/Source/UnitTests/Common/BitFieldTest.cpp b/Source/UnitTests/Common/BitFieldTest.cpp
index aa98352272..ff317649e6 100644
--- a/Source/UnitTests/Common/BitFieldTest.cpp
+++ b/Source/UnitTests/Common/BitFieldTest.cpp
@@ -139,7 +139,8 @@ TEST(BitField, Alignment)
GC_ALIGNED16(OddlyAlignedTestStruct test_struct);
TestUnion& object = test_struct.obj;
- static_assert(alignof(test_struct.obj.signed_1bit) == 1, "Incorrect variable alignment");
+ static_assert(alignof(decltype(test_struct.obj.signed_1bit)) == 1,
+ "Incorrect variable alignment");
for (u64 val : table)
{
diff --git a/Source/UnitTests/Common/CommonFuncsTest.cpp b/Source/UnitTests/Common/CommonFuncsTest.cpp
index 5fced4c5aa..e9b39b320e 100644
--- a/Source/UnitTests/Common/CommonFuncsTest.cpp
+++ b/Source/UnitTests/Common/CommonFuncsTest.cpp
@@ -13,6 +13,9 @@ TEST(CommonFuncs, ArraySizeMacro)
EXPECT_EQ(4u, ArraySize(test));
EXPECT_EQ(42u, ArraySize(test2));
+
+ (void)test;
+ (void)test2;
}
TEST(CommonFuncs, RoundUpPow2Macro)
diff --git a/Source/UnitTests/Common/FlagTest.cpp b/Source/UnitTests/Common/FlagTest.cpp
index a3a0c3d929..2c087fd739 100644
--- a/Source/UnitTests/Common/FlagTest.cpp
+++ b/Source/UnitTests/Common/FlagTest.cpp
@@ -37,7 +37,7 @@ TEST(Flag, MultiThreaded)
int count = 0;
const int ITERATIONS_COUNT = 100000;
- auto setter = [&f]() {
+ auto setter = [&]() {
for (int i = 0; i < ITERATIONS_COUNT; ++i)
{
while (f.IsSet());
@@ -45,7 +45,7 @@ TEST(Flag, MultiThreaded)
}
};
- auto clearer = [&f, &count]() {
+ auto clearer = [&]() {
for (int i = 0; i < ITERATIONS_COUNT; ++i)
{
while (!f.IsSet());
diff --git a/Source/UnitTests/TestUtils/StubHost.cpp b/Source/UnitTests/TestUtils/StubHost.cpp
index e0363843aa..e55db7bb75 100644
--- a/Source/UnitTests/TestUtils/StubHost.cpp
+++ b/Source/UnitTests/TestUtils/StubHost.cpp
@@ -19,6 +19,7 @@ void Host_UpdateDisasmDialog() {}
void Host_UpdateMainFrame() {}
void Host_GetRenderWindowSize(int&, int&, int&, int&) {}
void Host_RequestRenderWindowSize(int, int) {}
+void Host_RequestFullscreen(bool) {}
void Host_SetStartupDebuggingParameters() {}
bool Host_UIHasFocus() { return false; }
bool Host_RendererHasFocus() { return false; }
diff --git a/Source/UnitTests/UnitTests.vcxproj b/Source/UnitTests/UnitTests.vcxproj
new file mode 100644
index 0000000000..a67c8e5ac0
--- /dev/null
+++ b/Source/UnitTests/UnitTests.vcxproj
@@ -0,0 +1,112 @@
+
+
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ {474661E7-C73A-43A6-AFEE-EE1EC433D49E}
+
+
+
+ Application
+ v120
+ Unicode
+
+
+ true
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(ExternalsDir)gtest\include;$(ExternalsDir)gtest;%(AdditionalIncludeDirectories)
+
+
+
+ 0x00400000
+ false
+ true
+
+ $(ExternalsDir)OpenAL\$(PlatformName);%(AdditionalLibraryDirectories)
+ iphlpapi.lib;winmm.lib;setupapi.lib;vfw32.lib;opengl32.lib;glu32.lib;rpcrt4.lib;comctl32.lib;%(AdditionalDependencies)
+ Console
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {E54CF649-140E-4255-81A5-30A673C1FB36}
+
+
+ {96020103-4ba5-4fd2-b4aa-5b6d24492d4e}
+
+
+ {ec1a314c-5588-4506-9c1e-2e58e5817f75}
+
+
+ {a4c423aa-f57c-46c7-a172-d1a777017d29}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Source/UnitTests/UnitTests.vcxproj.user b/Source/UnitTests/UnitTests.vcxproj.user
new file mode 100644
index 0000000000..e472aa9c6d
--- /dev/null
+++ b/Source/UnitTests/UnitTests.vcxproj.user
@@ -0,0 +1,9 @@
+
+
+
+
+
+ $(BinaryOutputDir)
+ WindowsLocalDebugger
+
+
\ No newline at end of file
diff --git a/Source/VSProps/Base.props b/Source/VSProps/Base.props
index ab98569c86..32b4ebd75e 100644
--- a/Source/VSProps/Base.props
+++ b/Source/VSProps/Base.props
@@ -6,10 +6,11 @@
D
- $(SolutionDir)..\Build\
- $(SolutionDir)..\Binary\
+ $(SolutionDir)..\
+ $(DolphinRootDir)Build\
+ $(DolphinRootDir)Binary\
$(BinaryRootDir)$(Platform)\
- $(SolutionDir)..\Externals\
+ $(DolphinRootDir)Externals\
$(SolutionDir)Core\
@@ -41,7 +42,6 @@
$(ExternalsDir)miniupnpc\src;%(AdditionalIncludeDirectories)
$(ExternalsDir)polarssl\include;%(AdditionalIncludeDirectories)
$(ExternalsDir)portaudio\include;%(AdditionalIncludeDirectories)
- $(ExternalsDir)SDL2-2.0.1\include;%(AdditionalIncludeDirectories)
$(ExternalsDir)SFML\include;%(AdditionalIncludeDirectories)
$(ExternalsDir)SOIL;%(AdditionalIncludeDirectories)
$(ExternalsDir)wxWidgets3;%(AdditionalIncludeDirectories)
diff --git a/Source/dolphin-emu.sln b/Source/dolphin-emu.sln
index 8eef6fcced..141580ca87 100644
--- a/Source/dolphin-emu.sln
+++ b/Source/dolphin-emu.sln
@@ -61,6 +61,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Video Backends", "Video Bac
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pch", "PCH\pch.vcxproj", "{76563A7F-1011-4EAD-B667-7BB18D09568E}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTests", "UnitTests\UnitTests.vcxproj", "{474661E7-C73A-43A6-AFEE-EE1EC433D49E}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@@ -171,6 +173,10 @@ Global
{76563A7F-1011-4EAD-B667-7BB18D09568E}.Debug|x64.Build.0 = Debug|x64
{76563A7F-1011-4EAD-B667-7BB18D09568E}.Release|x64.ActiveCfg = Release|x64
{76563A7F-1011-4EAD-B667-7BB18D09568E}.Release|x64.Build.0 = Release|x64
+ {474661E7-C73A-43A6-AFEE-EE1EC433D49E}.Debug|x64.ActiveCfg = Debug|x64
+ {474661E7-C73A-43A6-AFEE-EE1EC433D49E}.Debug|x64.Build.0 = Debug|x64
+ {474661E7-C73A-43A6-AFEE-EE1EC433D49E}.Release|x64.ActiveCfg = Release|x64
+ {474661E7-C73A-43A6-AFEE-EE1EC433D49E}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE