Merge pull request #920 from shuffle2/msvc-gtest

Provide a way to build and run unittests on Windows
This commit is contained in:
Pierre Bourdon 2014-09-02 07:40:49 +02:00
commit 5941653d47
25 changed files with 393 additions and 187 deletions

View File

@ -57,7 +57,6 @@
<ClCompile Include="..\pngrtran.c" /> <ClCompile Include="..\pngrtran.c" />
<ClCompile Include="..\pngrutil.c" /> <ClCompile Include="..\pngrutil.c" />
<ClCompile Include="..\pngset.c" /> <ClCompile Include="..\pngset.c" />
<ClCompile Include="..\pngtest.c" />
<ClCompile Include="..\pngtrans.c" /> <ClCompile Include="..\pngtrans.c" />
<ClCompile Include="..\pngvcrd.c" /> <ClCompile Include="..\pngvcrd.c" />
<ClCompile Include="..\pngwio.c" /> <ClCompile Include="..\pngwio.c" />
@ -75,7 +74,7 @@
<ClInclude Include="..\pngstruct.h" /> <ClInclude Include="..\pngstruct.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\zlib\zlib.vcxproj"> <ProjectReference Include="$(ExternalsDir)zlib\zlib.vcxproj">
<Project>{ff213b23-2c26-4214-9f88-85271e557e87}</Project> <Project>{ff213b23-2c26-4214-9f88-85271e557e87}</Project>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>

View File

@ -70,7 +70,6 @@
<ClCompile Include="src\minixml.c" /> <ClCompile Include="src\minixml.c" />
<ClCompile Include="src\portlistingparse.c" /> <ClCompile Include="src\portlistingparse.c" />
<ClCompile Include="src\receivedata.c" /> <ClCompile Include="src\receivedata.c" />
<ClCompile Include="src\upnpc.c" />
<ClCompile Include="src\upnpcommands.c" /> <ClCompile Include="src\upnpcommands.c" />
<ClCompile Include="src\upnperrors.c" /> <ClCompile Include="src\upnperrors.c" />
<ClCompile Include="src\upnpreplyparse.c" /> <ClCompile Include="src\upnpreplyparse.c" />

View File

@ -1256,14 +1256,6 @@
<ExcludedFromBuild>true</ExcludedFromBuild> <ExcludedFromBuild>true</ExcludedFromBuild>
</ResourceCompile> </ResourceCompile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\libpng\png\png.vcxproj">
<Project>{01573c36-ac6e-49f6-94ba-572517eb9740}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\zlib\zlib.vcxproj">
<Project>{3e1339f5-9311-4122-9442-369702e8fcad}</Project>
</ProjectReference>
</ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectName>wxWidgets</ProjectName> <ProjectName>wxWidgets</ProjectName>
<ProjectGuid>{1C8436C9-DBAF-42BE-83BC-CF3EC9175ABE}</ProjectGuid> <ProjectGuid>{1C8436C9-DBAF-42BE-83BC-CF3EC9175ABE}</ProjectGuid>
@ -1294,6 +1286,14 @@
<PreprocessorDefinitions>__WXDEBUG__;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>__WXDEBUG__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile> </ClCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup>
<ProjectReference Include="$(ExternalsDir)libpng\png\png.vcxproj">
<Project>{01573c36-ac6e-49f6-94ba-572517eb9740}</Project>
</ProjectReference>
<ProjectReference Include="$(ExternalsDir)zlib\zlib.vcxproj">
<Project>{3e1339f5-9311-4122-9442-369702e8fcad}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>

View File

@ -68,10 +68,10 @@
<Text Include="CMakeLists.txt" /> <Text Include="CMakeLists.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\Externals\soundtouch\SoundTouch.vcxproj"> <ProjectReference Include="$(ExternalsDir)soundtouch\SoundTouch.vcxproj">
<Project>{ec082900-b4d8-42e9-9663-77f02f6936ae}</Project> <Project>{ec082900-b4d8-42e9-9663-77f02f6936ae}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\Common\Common.vcxproj"> <ProjectReference Include="$(CoreDir)Common\Common.vcxproj">
<Project>{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}</Project> <Project>{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}</Project>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>

View File

@ -11,6 +11,10 @@
#if defined HAVE_OPENAL && HAVE_OPENAL #if defined HAVE_OPENAL && HAVE_OPENAL
#ifdef _WIN32
#pragma comment(lib, "openal32.lib")
#endif
static soundtouch::SoundTouch soundTouch; static soundtouch::SoundTouch soundTouch;
// //

View File

@ -127,7 +127,7 @@
<Text Include="CMakeLists.txt" /> <Text Include="CMakeLists.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\Externals\polarssl\visualc\PolarSSL.vcxproj"> <ProjectReference Include="$(ExternalsDir)polarssl\visualc\PolarSSL.vcxproj">
<Project>{bdb6578b-0691-4e80-a46c-df21639fd3b8}</Project> <Project>{bdb6578b-0691-4e80-a46c-df21639fd3b8}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="SCMRevGen.vcxproj"> <ProjectReference Include="SCMRevGen.vcxproj">

View File

@ -161,6 +161,12 @@ extern "C"
__declspec(dllimport) void __stdcall DebugBreak(void); __declspec(dllimport) void __stdcall DebugBreak(void);
} }
#define Crash() {DebugBreak();} #define Crash() {DebugBreak();}
#if (_MSC_VER > 1800)
#error alignof compat can be removed
#else
#define alignof(x) __alignof(x)
#endif
#endif // WIN32 ndef #endif // WIN32 ndef
// Generic function to get last error message. // Generic function to get last error message.

View File

@ -419,40 +419,43 @@
<Text Include="CMakeLists.txt" /> <Text Include="CMakeLists.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\Externals\Bochs_disasm\Bochs_disasm.vcxproj"> <ProjectReference Include="$(ExternalsDir)Bochs_disasm\Bochs_disasm.vcxproj">
<Project>{8ada04d7-6db1-4da4-ab55-64fb12a0997b}</Project> <Project>{8ada04d7-6db1-4da4-ab55-64fb12a0997b}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\Externals\libusbx\msvc\libusb_static_2013.vcxproj"> <ProjectReference Include="$(ExternalsDir)libusbx\msvc\libusb_static_2013.vcxproj">
<Project>{349ee8f9-7d25-4909-aaf5-ff3fade72187}</Project> <Project>{349ee8f9-7d25-4909-aaf5-ff3fade72187}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\Externals\LZO\LZO.vcxproj"> <ProjectReference Include="$(ExternalsDir)LZO\LZO.vcxproj">
<Project>{ab993f38-c31d-4897-b139-a620c42bc565}</Project> <Project>{ab993f38-c31d-4897-b139-a620c42bc565}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\Externals\polarssl\visualc\PolarSSL.vcxproj"> <ProjectReference Include="$(ExternalsDir)miniupnpc\miniupnpc.vcxproj">
<Project>{31643fdb-1bb8-4965-9de7-000fc88d35ae}</Project>
</ProjectReference>
<ProjectReference Include="$(ExternalsDir)polarssl\visualc\PolarSSL.vcxproj">
<Project>{bdb6578b-0691-4e80-a46c-df21639fd3b8}</Project> <Project>{bdb6578b-0691-4e80-a46c-df21639fd3b8}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\Externals\portaudio\build\portaudio.vcxproj"> <ProjectReference Include="$(ExternalsDir)portaudio\build\portaudio.vcxproj">
<Project>{0a18a071-125e-442f-aff7-a3f68abecf99}</Project> <Project>{0a18a071-125e-442f-aff7-a3f68abecf99}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\Externals\SFML\build\vc2010\SFML_Network.vcxproj"> <ProjectReference Include="$(ExternalsDir)SFML\build\vc2010\SFML_Network.vcxproj">
<Project>{93d73454-2512-424e-9cda-4bb357fe13dd}</Project> <Project>{93d73454-2512-424e-9cda-4bb357fe13dd}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\AudioCommon\AudioCommon.vcxproj"> <ProjectReference Include="$(CoreDir)AudioCommon\AudioCommon.vcxproj">
<Project>{54aa7840-5beb-4a0c-9452-74ba4cc7fd44}</Project> <Project>{54aa7840-5beb-4a0c-9452-74ba4cc7fd44}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\Common\Common.vcxproj"> <ProjectReference Include="$(CoreDir)Common\Common.vcxproj">
<Project>{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}</Project> <Project>{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\Common\SCMRevGen.vcxproj"> <ProjectReference Include="$(CoreDir)Common\SCMRevGen.vcxproj">
<Project>{41279555-f94f-4ebc-99de-af863c10c5c4}</Project> <Project>{41279555-f94f-4ebc-99de-af863c10c5c4}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\DiscIO\DiscIO.vcxproj"> <ProjectReference Include="$(CoreDir)DiscIO\DiscIO.vcxproj">
<Project>{160bdc25-5626-4b0d-bdd8-2953d9777fb5}</Project> <Project>{160bdc25-5626-4b0d-bdd8-2953d9777fb5}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\InputCommon\InputCommon.vcxproj"> <ProjectReference Include="$(CoreDir)InputCommon\InputCommon.vcxproj">
<Project>{6bbd47cf-91fd-4077-b676-8b76980178a9}</Project> <Project>{6bbd47cf-91fd-4077-b676-8b76980178a9}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\VideoCommon\VideoCommon.vcxproj"> <ProjectReference Include="$(CoreDir)VideoCommon\VideoCommon.vcxproj">
<Project>{3de9ee35-3e91-4f27-a014-2866ad8c3fe3}</Project> <Project>{3de9ee35-3e91-4f27-a014-2866ad8c3fe3}</Project>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>

View File

@ -6,6 +6,7 @@
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <ctime> #include <ctime>
#include <hidsdi.h>
#include <unordered_map> #include <unordered_map>
#include <unordered_set> #include <unordered_set>
#include <windows.h> #include <windows.h>
@ -22,52 +23,35 @@
//#define AUTHENTICATE_WIIMOTES //#define AUTHENTICATE_WIIMOTES
#define SHARE_WRITE_WIIMOTES #define SHARE_WRITE_WIIMOTES
typedef struct _HIDD_ATTRIBUTES // Create func_t function pointer type and declare a nullptr-initialized static variable of that
{ // type named "pfunc".
ULONG Size; #define DYN_FUNC_DECLARE(func) \
USHORT VendorID; typedef decltype(&func) func ## _t; \
USHORT ProductID; static func ## _t p ## func = nullptr;
USHORT VersionNumber;
} HIDD_ATTRIBUTES, *PHIDD_ATTRIBUTES;
typedef VOID (__stdcall *PHidD_GetHidGuid)(LPGUID); DYN_FUNC_DECLARE(HidD_GetHidGuid);
typedef BOOLEAN (__stdcall *PHidD_GetAttributes)(HANDLE, PHIDD_ATTRIBUTES); DYN_FUNC_DECLARE(HidD_GetAttributes);
typedef BOOLEAN (__stdcall *PHidD_SetOutputReport)(HANDLE, PVOID, ULONG); DYN_FUNC_DECLARE(HidD_SetOutputReport);
typedef BOOLEAN (__stdcall *PHidD_GetProductString)(HANDLE, PVOID, ULONG); DYN_FUNC_DECLARE(HidD_GetProductString);
typedef BOOL (__stdcall *PBth_BluetoothFindDeviceClose)(HBLUETOOTH_DEVICE_FIND); DYN_FUNC_DECLARE(BluetoothFindDeviceClose);
typedef HBLUETOOTH_DEVICE_FIND (__stdcall *PBth_BluetoothFindFirstDevice)(const BLUETOOTH_DEVICE_SEARCH_PARAMS*, BLUETOOTH_DEVICE_INFO*); DYN_FUNC_DECLARE(BluetoothFindFirstDevice);
typedef HBLUETOOTH_RADIO_FIND (__stdcall *PBth_BluetoothFindFirstRadio)(const BLUETOOTH_FIND_RADIO_PARAMS*,HANDLE*); DYN_FUNC_DECLARE(BluetoothFindFirstRadio);
typedef BOOL (__stdcall *PBth_BluetoothFindNextDevice)(HBLUETOOTH_DEVICE_FIND, BLUETOOTH_DEVICE_INFO*); DYN_FUNC_DECLARE(BluetoothFindNextDevice);
typedef BOOL (__stdcall *PBth_BluetoothFindNextRadio)(HBLUETOOTH_RADIO_FIND, HANDLE*); DYN_FUNC_DECLARE(BluetoothFindNextRadio);
typedef BOOL (__stdcall *PBth_BluetoothFindRadioClose)(HBLUETOOTH_RADIO_FIND); DYN_FUNC_DECLARE(BluetoothFindRadioClose);
typedef DWORD (__stdcall *PBth_BluetoothGetRadioInfo)(HANDLE, PBLUETOOTH_RADIO_INFO); DYN_FUNC_DECLARE(BluetoothGetRadioInfo);
typedef DWORD (__stdcall *PBth_BluetoothRemoveDevice)(const BLUETOOTH_ADDRESS*); DYN_FUNC_DECLARE(BluetoothRemoveDevice);
typedef DWORD (__stdcall *PBth_BluetoothSetServiceState)(HANDLE, const BLUETOOTH_DEVICE_INFO*, const GUID*, DWORD); DYN_FUNC_DECLARE(BluetoothSetServiceState);
typedef DWORD (__stdcall *PBth_BluetoothAuthenticateDevice)(HWND, HANDLE, BLUETOOTH_DEVICE_INFO*, PWCHAR, ULONG); DYN_FUNC_DECLARE(BluetoothAuthenticateDeviceEx);
typedef DWORD (__stdcall *PBth_BluetoothEnumerateInstalledServices)(HANDLE, BLUETOOTH_DEVICE_INFO*, DWORD*, GUID*); DYN_FUNC_DECLARE(BluetoothEnumerateInstalledServices);
PHidD_GetHidGuid HidD_GetHidGuid = nullptr; #undef DYN_FUNC_DECLARE
PHidD_GetAttributes HidD_GetAttributes = nullptr;
PHidD_SetOutputReport HidD_SetOutputReport = nullptr;
PHidD_GetProductString HidD_GetProductString = nullptr;
PBth_BluetoothFindDeviceClose Bth_BluetoothFindDeviceClose = nullptr; static HINSTANCE s_hid_lib = nullptr;
PBth_BluetoothFindFirstDevice Bth_BluetoothFindFirstDevice = nullptr; static HINSTANCE s_bthprops_lib = 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;
HINSTANCE hid_lib = nullptr; static bool s_loaded_ok = false;
HINSTANCE bthprops_lib = nullptr;
static bool initialized = false;
std::unordered_map<BTH_ADDR, std::time_t> g_connect_times; std::unordered_map<BTH_ADDR, std::time_t> g_connect_times;
@ -76,59 +60,127 @@ std::unordered_set<std::basic_string<TCHAR>> g_connected_wiimotes;
std::mutex g_connected_wiimotes_lock; std::mutex g_connected_wiimotes_lock;
#endif #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() inline void init_lib()
{ {
static bool initialized = false;
if (!initialized) if (!initialized)
{ {
hid_lib = LoadLibrary(_T("hid.dll")); // Only try once
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;
}
initialized = true; 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() void WiimoteScanner::Update()
{ {
if (!s_loaded_ok)
return;
bool forgot_some = false; bool forgot_some = false;
ProcessWiimotes(false, [&](HANDLE, BLUETOOTH_RADIO_INFO&, BLUETOOTH_DEVICE_INFO_STRUCT& btdi) 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. // Returns the total number of found and connected wiimotes.
void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimote* & found_board) void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimote* & found_board)
{ {
if (!s_loaded_ok)
return;
ProcessWiimotes(true, [](HANDLE hRadio, const BLUETOOTH_RADIO_INFO& rinfo, BLUETOOTH_DEVICE_INFO_STRUCT& btdi) ProcessWiimotes(true, [](HANDLE hRadio, const BLUETOOTH_RADIO_INFO& rinfo, BLUETOOTH_DEVICE_INFO_STRUCT& btdi)
{ {
ForgetWiimote(btdi); ForgetWiimote(btdi);
@ -194,7 +252,7 @@ void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimot
// Get the device id // Get the device id
GUID device_id; GUID device_id;
HidD_GetHidGuid(&device_id); pHidD_GetHidGuid(&device_id);
// Get all hid devices connected // Get all hid devices connected
HDEVINFO const device_info = SetupDiGetClassDevs(&device_id, nullptr, nullptr, (DIGCF_DEVICEINTERFACE | DIGCF_PRESENT)); 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; 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. // Because nothing on Windows should be easy.
// (We can't seem to easily identify the bluetooth device an HID device belongs to...) // (We can't seem to easily identify the bluetooth device an HID device belongs to...)
void WiimoteScanner::CheckDeviceType(std::basic_string<TCHAR> &devicepath, bool &real_wiimote, bool &is_bb) void WiimoteScanner::CheckDeviceType(std::basic_string<TCHAR> &devicepath, bool &real_wiimote, bool &is_bb)
@ -305,7 +363,7 @@ void WiimoteScanner::CheckDeviceType(std::basic_string<TCHAR> &devicepath, bool
HIDD_ATTRIBUTES attrib; HIDD_ATTRIBUTES attrib;
attrib.Size = sizeof(attrib); attrib.Size = sizeof(attrib);
if (!check_vidpid || if (!check_vidpid ||
(HidD_GetAttributes(dev_handle, &attrib) && (pHidD_GetAttributes(dev_handle, &attrib) &&
(attrib.VendorID == 0x057e) && (attrib.VendorID == 0x057e) &&
(attrib.ProductID == 0x0306))) (attrib.ProductID == 0x0306)))
{ {
@ -417,17 +475,22 @@ void WiimoteScanner::CheckDeviceType(std::basic_string<TCHAR> &devicepath, bool
bool WiimoteScanner::IsReady() const bool WiimoteScanner::IsReady() const
{ {
if (!s_loaded_ok)
{
return false;
}
// TODO: don't search for a radio each time // TODO: don't search for a radio each time
BLUETOOTH_FIND_RADIO_PARAMS radioParam; BLUETOOTH_FIND_RADIO_PARAMS radioParam;
radioParam.dwSize = sizeof(radioParam); radioParam.dwSize = sizeof(radioParam);
HANDLE hRadio; HANDLE hRadio;
HBLUETOOTH_RADIO_FIND hFindRadio = Bth_BluetoothFindFirstRadio(&radioParam, &hRadio); HBLUETOOTH_RADIO_FIND hFindRadio = pBluetoothFindFirstRadio(&radioParam, &hRadio);
if (nullptr != hFindRadio) if (nullptr != hFindRadio)
{ {
Bth_BluetoothFindRadioClose(hFindRadio); pBluetoothFindRadioClose(hFindRadio);
return true; return true;
} }
else else
@ -468,7 +531,7 @@ bool Wiimote::ConnectInternal()
#if 0 #if 0
TCHAR name[128] = {}; 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()); //ERROR_LOG(WIIMOTE, "Product string: %s", TStrToUTF8(name).c_str());
@ -483,7 +546,7 @@ bool Wiimote::ConnectInternal()
#if 0 #if 0
HIDD_ATTRIBUTES attr; HIDD_ATTRIBUTES attr;
attr.Size = sizeof(attr); attr.Size = sizeof(attr);
if (!HidD_GetAttributes(dev_handle, &attr)) if (!pHidD_GetAttributes(dev_handle, &attr))
{ {
CloseHandle(dev_handle); CloseHandle(dev_handle);
dev_handle = 0; dev_handle = 0;
@ -640,7 +703,7 @@ int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stac
} }
case MSBT_STACK_MS: case MSBT_STACK_MS:
{ {
auto result = HidD_SetOutputReport(dev_handle, const_cast<u8*>(buf) + 1, (ULONG)(len - 1)); auto result = pHidD_SetOutputReport(dev_handle, const_cast<u8*>(buf) + 1, (ULONG)(len - 1));
//FlushFileBuffers(dev_handle); //FlushFileBuffers(dev_handle);
if (!result) if (!result)
@ -744,13 +807,13 @@ void ProcessWiimotes(bool new_scan, T& callback)
// TODO: save radio(s) in the WiimoteScanner constructor? // TODO: save radio(s) in the WiimoteScanner constructor?
// Enumerate BT radios // Enumerate BT radios
HBLUETOOTH_RADIO_FIND hFindRadio = Bth_BluetoothFindFirstRadio(&radioParam, &hRadio); HBLUETOOTH_RADIO_FIND hFindRadio = pBluetoothFindFirstRadio(&radioParam, &hRadio);
while (hFindRadio) while (hFindRadio)
{ {
BLUETOOTH_RADIO_INFO radioInfo; BLUETOOTH_RADIO_INFO radioInfo;
radioInfo.dwSize = sizeof(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) if (ERROR_SUCCESS == rinfo_result)
{ {
srch.hRadio = hRadio; srch.hRadio = hRadio;
@ -759,7 +822,7 @@ void ProcessWiimotes(bool new_scan, T& callback)
btdi.dwSize = sizeof(btdi); btdi.dwSize = sizeof(btdi);
// Enumerate BT devices // Enumerate BT devices
HBLUETOOTH_DEVICE_FIND hFindDevice = Bth_BluetoothFindFirstDevice(&srch, &btdi); HBLUETOOTH_DEVICE_FIND hFindDevice = pBluetoothFindFirstDevice(&srch, &btdi);
while (hFindDevice) while (hFindDevice)
{ {
// btdi.szName is sometimes missing it's content - it's a bt feature.. // 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); callback(hRadio, radioInfo, btdi);
} }
if (false == Bth_BluetoothFindNextDevice(hFindDevice, &btdi)) if (false == pBluetoothFindNextDevice(hFindDevice, &btdi))
{ {
Bth_BluetoothFindDeviceClose(hFindDevice); pBluetoothFindDeviceClose(hFindDevice);
hFindDevice = nullptr; hFindDevice = nullptr;
} }
} }
} }
if (false == Bth_BluetoothFindNextRadio(hFindRadio, &hRadio)) if (false == pBluetoothFindNextRadio(hFindRadio, &hRadio))
{ {
Bth_BluetoothFindRadioClose(hFindRadio); pBluetoothFindRadioClose(hFindRadio);
hFindRadio = nullptr; hFindRadio = nullptr;
} }
} }
@ -791,7 +854,7 @@ void RemoveWiimote(BLUETOOTH_DEVICE_INFO_STRUCT& btdi)
{ {
//if (btdi.fConnected) //if (btdi.fConnected)
{ {
if (SUCCEEDED(Bth_BluetoothRemoveDevice(&btdi.Address))) if (SUCCEEDED(pBluetoothRemoveDevice(&btdi.Address)))
{ {
NOTICE_LOG(WIIMOTE, "Removed BT Device", GetLastError()); 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) #if defined(AUTHENTICATE_WIIMOTES)
// Authenticate // Authenticate
auto const& radio_addr = radio_info.address.rgBytes; auto const& radio_addr = radio_info.address.rgBytes;
const DWORD auth_result = Bth_BluetoothAuthenticateDevice(nullptr, hRadio, &btdi, // FIXME Not sure this usage of OOB_DATA_INFO is correct...
std::vector<WCHAR>(radio_addr, radio_addr + 6).data(), 6); 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) 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; DWORD pcServices = 16;
GUID guids[16]; GUID guids[16];
// If this is not done, the Wii device will not remember the pairing // 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) if (ERROR_SUCCESS != srv_result)
{ {
@ -831,8 +897,8 @@ bool AttachWiimote(HANDLE hRadio, const BLUETOOTH_RADIO_INFO& radio_info, BLUETO
} }
#endif #endif
// Activate service // Activate service
const DWORD hr = Bth_BluetoothSetServiceState(hRadio, &btdi, const DWORD hr = pBluetoothSetServiceState(hRadio, &btdi,
&HumanInterfaceDeviceServiceClass_UUID, BLUETOOTH_SERVICE_ENABLE); &HumanInterfaceDeviceServiceClass_UUID, BLUETOOTH_SERVICE_ENABLE);
g_connect_times[btdi.Address.ullLong] = std::time(nullptr); 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. // Make Windows forget about device so it will re-find it if visible.
// This is also required to detect a disconnect for some reason.. // This is also required to detect a disconnect for some reason..
NOTICE_LOG(WIIMOTE, "Removing remembered Wiimote."); NOTICE_LOG(WIIMOTE, "Removing remembered Wiimote.");
Bth_BluetoothRemoveDevice(&btdi.Address); pBluetoothRemoveDevice(&btdi.Address);
return true; return true;
} }
} }

View File

@ -86,13 +86,13 @@
<Text Include="CMakeLists.txt" /> <Text Include="CMakeLists.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\Externals\polarssl\visualc\PolarSSL.vcxproj"> <ProjectReference Include="$(ExternalsDir)polarssl\visualc\PolarSSL.vcxproj">
<Project>{bdb6578b-0691-4e80-a46c-df21639fd3b8}</Project> <Project>{bdb6578b-0691-4e80-a46c-df21639fd3b8}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\Externals\zlib\zlib.vcxproj"> <ProjectReference Include="$(ExternalsDir)zlib\zlib.vcxproj">
<Project>{ff213b23-2c26-4214-9f88-85271e557e87}</Project> <Project>{ff213b23-2c26-4214-9f88-85271e557e87}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\Common\Common.vcxproj"> <ProjectReference Include="$(CoreDir)Common\Common.vcxproj">
<Project>{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}</Project> <Project>{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}</Project>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>

View File

@ -40,11 +40,11 @@
<BaseAddress>0x00400000</BaseAddress> <BaseAddress>0x00400000</BaseAddress>
<RandomizedBaseAddress>false</RandomizedBaseAddress> <RandomizedBaseAddress>false</RandomizedBaseAddress>
<FixedBaseAddress>true</FixedBaseAddress> <FixedBaseAddress>true</FixedBaseAddress>
<AdditionalLibraryDirectories>..\..\..\Externals\SDL2-2.0.1\lib\$(PlatformName);..\..\..\Externals\OpenAL\$(PlatformName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(ExternalsDir)OpenAL\$(PlatformName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>dsound.lib;iphlpapi.lib;winmm.lib;setupapi.lib;vfw32.lib;opengl32.lib;glu32.lib;rpcrt4.lib;comctl32.lib;OpenAL32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>iphlpapi.lib;winmm.lib;setupapi.lib;vfw32.lib;opengl32.lib;glu32.lib;rpcrt4.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
<ResourceCompile> <ResourceCompile>
<AdditionalIncludeDirectories>..\..\..\Externals\wxWidgets3\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ExternalsDir)wxWidgets3\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile> </ResourceCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
@ -152,58 +152,55 @@
<ResourceCompile Include="DolphinWX.rc" /> <ResourceCompile Include="DolphinWX.rc" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Image Include="..\..\..\Installer\Dolphin.ico" /> <Image Include="$(CoreDir)..\..\Installer\Dolphin.ico" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\Externals\Bochs_disasm\Bochs_disasm.vcxproj"> <ProjectReference Include="$(ExternalsDir)Bochs_disasm\Bochs_disasm.vcxproj">
<Project>{8ada04d7-6db1-4da4-ab55-64fb12a0997b}</Project> <Project>{8ada04d7-6db1-4da4-ab55-64fb12a0997b}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\Externals\libpng\png\png.vcxproj"> <ProjectReference Include="$(ExternalsDir)libpng\png\png.vcxproj">
<Project>{4c9f135b-a85e-430c-bad4-4c67ef5fc12c}</Project> <Project>{4c9f135b-a85e-430c-bad4-4c67ef5fc12c}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\Externals\LZO\LZO.vcxproj"> <ProjectReference Include="$(ExternalsDir)LZO\LZO.vcxproj">
<Project>{ab993f38-c31d-4897-b139-a620c42bc565}</Project> <Project>{ab993f38-c31d-4897-b139-a620c42bc565}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\Externals\miniupnpc\miniupnpc.vcxproj"> <ProjectReference Include="$(ExternalsDir)SFML\build\vc2010\SFML_Network.vcxproj">
<Project>{31643fdb-1bb8-4965-9de7-000fc88d35ae}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\Externals\SFML\build\vc2010\SFML_Network.vcxproj">
<Project>{93d73454-2512-424e-9cda-4bb357fe13dd}</Project> <Project>{93d73454-2512-424e-9cda-4bb357fe13dd}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\Externals\wxWidgets3\build\msw\wx_base.vcxproj"> <ProjectReference Include="$(ExternalsDir)wxWidgets3\build\msw\wx_base.vcxproj">
<Project>{1c8436c9-dbaf-42be-83bc-cf3ec9175abe}</Project> <Project>{1c8436c9-dbaf-42be-83bc-cf3ec9175abe}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\Externals\zlib\zlib.vcxproj"> <ProjectReference Include="$(ExternalsDir)zlib\zlib.vcxproj">
<Project>{ff213b23-2c26-4214-9f88-85271e557e87}</Project> <Project>{ff213b23-2c26-4214-9f88-85271e557e87}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\AudioCommon\AudioCommon.vcxproj"> <ProjectReference Include="$(CoreDir)AudioCommon\AudioCommon.vcxproj">
<Project>{54aa7840-5beb-4a0c-9452-74ba4cc7fd44}</Project> <Project>{54aa7840-5beb-4a0c-9452-74ba4cc7fd44}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\Common\Common.vcxproj"> <ProjectReference Include="$(CoreDir)Common\Common.vcxproj">
<Project>{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}</Project> <Project>{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\Common\SCMRevGen.vcxproj"> <ProjectReference Include="$(CoreDir)Common\SCMRevGen.vcxproj">
<Project>{41279555-f94f-4ebc-99de-af863c10c5c4}</Project> <Project>{41279555-f94f-4ebc-99de-af863c10c5c4}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\Core\Core.vcxproj"> <ProjectReference Include="$(CoreDir)Core\Core.vcxproj">
<Project>{e54cf649-140e-4255-81a5-30a673c1fb36}</Project> <Project>{e54cf649-140e-4255-81a5-30a673c1fb36}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\DiscIO\DiscIO.vcxproj"> <ProjectReference Include="$(CoreDir)DiscIO\DiscIO.vcxproj">
<Project>{160bdc25-5626-4b0d-bdd8-2953d9777fb5}</Project> <Project>{160bdc25-5626-4b0d-bdd8-2953d9777fb5}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\InputCommon\InputCommon.vcxproj"> <ProjectReference Include="$(CoreDir)InputCommon\InputCommon.vcxproj">
<Project>{6bbd47cf-91fd-4077-b676-8b76980178a9}</Project> <Project>{6bbd47cf-91fd-4077-b676-8b76980178a9}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\VideoBackends\D3D\D3D.vcxproj"> <ProjectReference Include="$(CoreDir)VideoBackends\D3D\D3D.vcxproj">
<Project>{96020103-4ba5-4fd2-b4aa-5b6d24492d4e}</Project> <Project>{96020103-4ba5-4fd2-b4aa-5b6d24492d4e}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\VideoBackends\OGL\OGL.vcxproj"> <ProjectReference Include="$(CoreDir)VideoBackends\OGL\OGL.vcxproj">
<Project>{ec1a314c-5588-4506-9c1e-2e58e5817f75}</Project> <Project>{ec1a314c-5588-4506-9c1e-2e58e5817f75}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\VideoBackends\Software\Software.vcxproj"> <ProjectReference Include="$(CoreDir)VideoBackends\Software\Software.vcxproj">
<Project>{a4c423aa-f57c-46c7-a172-d1a777017d29}</Project> <Project>{a4c423aa-f57c-46c7-a172-d1a777017d29}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\VideoCommon\VideoCommon.vcxproj"> <ProjectReference Include="$(CoreDir)VideoCommon\VideoCommon.vcxproj">
<Project>{3de9ee35-3e91-4f27-a014-2866ad8c3fe3}</Project> <Project>{3de9ee35-3e91-4f27-a014-2866ad8c3fe3}</Project>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
@ -212,8 +209,8 @@
</ImportGroup> </ImportGroup>
<!--Copy Exe, Data directory and DLLs which should be located in the executable directory--> <!--Copy Exe, Data directory and DLLs which should be located in the executable directory-->
<ItemGroup> <ItemGroup>
<DataDirFiles Include="$(SolutionDir)..\Data\**\*.*" /> <DataDirFiles Include="$(DolphinRootDir)Data\**\*.*" />
<ExternalDlls Include="$(ExternalsDir)OpenAL\$(PlatformName)\*.dll;$(ExternalsDir)SDL2-2.0.1\lib\$(PlatformName)\*.dll;$(ExternalsDir)msvcrt\$(PlatformName)\*.dll" /> <ExternalDlls Include="$(ExternalsDir)OpenAL\$(PlatformName)\*.dll;$(ExternalsDir)msvcrt\$(PlatformName)\*.dll" />
<BinaryFiles Include="$(TargetPath)" /> <BinaryFiles Include="$(TargetPath)" />
<AllInputFiles Include="@(DataDirFiles);@(ExternalDlls);@(BinaryFiles)" /> <AllInputFiles Include="@(DataDirFiles);@(ExternalDlls);@(BinaryFiles)" />
</ItemGroup> </ItemGroup>

View File

@ -64,7 +64,7 @@
<Text Include="CMakeLists.txt" /> <Text Include="CMakeLists.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Common\Common.vcxproj"> <ProjectReference Include="$(CoreDir)Common\Common.vcxproj">
<Project>{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}</Project> <Project>{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}</Project>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>

View File

@ -81,10 +81,10 @@
<ClInclude Include="XFBEncoder.h" /> <ClInclude Include="XFBEncoder.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\..\Externals\wxWidgets3\build\msw\wx_base.vcxproj"> <ProjectReference Include="$(ExternalsDir)wxWidgets3\build\msw\wx_base.vcxproj">
<Project>{1c8436c9-dbaf-42be-83bc-cf3ec9175abe}</Project> <Project>{1c8436c9-dbaf-42be-83bc-cf3ec9175abe}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\Core\VideoCommon\VideoCommon.vcxproj"> <ProjectReference Include="$(CoreDir)VideoCommon\VideoCommon.vcxproj">
<Project>{3de9ee35-3e91-4f27-a014-2866ad8c3fe3}</Project> <Project>{3de9ee35-3e91-4f27-a014-2866ad8c3fe3}</Project>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>

View File

@ -98,13 +98,13 @@
<Text Include="CMakeLists.txt" /> <Text Include="CMakeLists.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\..\Externals\wxWidgets3\build\msw\wx_base.vcxproj"> <ProjectReference Include="$(ExternalsDir)wxWidgets3\build\msw\wx_base.vcxproj">
<Project>{1c8436c9-dbaf-42be-83bc-cf3ec9175abe}</Project> <Project>{1c8436c9-dbaf-42be-83bc-cf3ec9175abe}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\..\Externals\zlib\zlib.vcxproj"> <ProjectReference Include="$(ExternalsDir)zlib\zlib.vcxproj">
<Project>{ff213b23-2c26-4214-9f88-85271e557e87}</Project> <Project>{ff213b23-2c26-4214-9f88-85271e557e87}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\Core\VideoCommon\VideoCommon.vcxproj"> <ProjectReference Include="$(CoreDir)VideoCommon\VideoCommon.vcxproj">
<Project>{3de9ee35-3e91-4f27-a014-2866ad8c3fe3}</Project> <Project>{3de9ee35-3e91-4f27-a014-2866ad8c3fe3}</Project>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>

View File

@ -88,10 +88,10 @@
<Text Include="CMakeLists.txt" /> <Text Include="CMakeLists.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\..\Externals\wxWidgets3\build\msw\wx_base.vcxproj"> <ProjectReference Include="$(ExternalsDir)wxWidgets3\build\msw\wx_base.vcxproj">
<Project>{1c8436c9-dbaf-42be-83bc-cf3ec9175abe}</Project> <Project>{1c8436c9-dbaf-42be-83bc-cf3ec9175abe}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\Core\VideoCommon\VideoCommon.vcxproj"> <ProjectReference Include="$(CoreDir)VideoCommon\VideoCommon.vcxproj">
<Project>{3de9ee35-3e91-4f27-a014-2866ad8c3fe3}</Project> <Project>{3de9ee35-3e91-4f27-a014-2866ad8c3fe3}</Project>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>

View File

@ -130,16 +130,16 @@
<Text Include="CMakeLists.txt" /> <Text Include="CMakeLists.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\Externals\libpng\png\png.vcxproj"> <ProjectReference Include="$(ExternalsDir)libpng\png\png.vcxproj">
<Project>{4c9f135b-a85e-430c-bad4-4c67ef5fc12c}</Project> <Project>{4c9f135b-a85e-430c-bad4-4c67ef5fc12c}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\Externals\SOIL\SOIL.vcxproj"> <ProjectReference Include="$(ExternalsDir)SOIL\SOIL.vcxproj">
<Project>{b441cc62-877e-4b3f-93e0-0de80544f705}</Project> <Project>{b441cc62-877e-4b3f-93e0-0de80544f705}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\Externals\zlib\zlib.vcxproj"> <ProjectReference Include="$(ExternalsDir)zlib\zlib.vcxproj">
<Project>{ff213b23-2c26-4214-9f88-85271e557e87}</Project> <Project>{ff213b23-2c26-4214-9f88-85271e557e87}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\Common\Common.vcxproj"> <ProjectReference Include="$(CoreDir)Common\Common.vcxproj">
<Project>{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}</Project> <Project>{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}</Project>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>

View File

@ -53,10 +53,10 @@
<Text Include="CMakeLists.txt" /> <Text Include="CMakeLists.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Core\Common\Common.vcxproj"> <ProjectReference Include="$(CoreDir)Common\Common.vcxproj">
<Project>{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}</Project> <Project>{2e6c348c-c75c-4d94-8d1e-9c1fcbf3efe4}</Project>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\Core\Core\Core.vcxproj"> <ProjectReference Include="$(CoreDir)Core\Core.vcxproj">
<Project>{e54cf649-140e-4255-81a5-30a673c1fb36}</Project> <Project>{e54cf649-140e-4255-81a5-30a673c1fb36}</Project>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>

View File

@ -139,7 +139,8 @@ TEST(BitField, Alignment)
GC_ALIGNED16(OddlyAlignedTestStruct test_struct); GC_ALIGNED16(OddlyAlignedTestStruct test_struct);
TestUnion& object = test_struct.obj; 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) for (u64 val : table)
{ {

View File

@ -13,6 +13,9 @@ TEST(CommonFuncs, ArraySizeMacro)
EXPECT_EQ(4u, ArraySize(test)); EXPECT_EQ(4u, ArraySize(test));
EXPECT_EQ(42u, ArraySize(test2)); EXPECT_EQ(42u, ArraySize(test2));
(void)test;
(void)test2;
} }
TEST(CommonFuncs, RoundUpPow2Macro) TEST(CommonFuncs, RoundUpPow2Macro)

View File

@ -37,7 +37,7 @@ TEST(Flag, MultiThreaded)
int count = 0; int count = 0;
const int ITERATIONS_COUNT = 100000; const int ITERATIONS_COUNT = 100000;
auto setter = [&f]() { auto setter = [&]() {
for (int i = 0; i < ITERATIONS_COUNT; ++i) for (int i = 0; i < ITERATIONS_COUNT; ++i)
{ {
while (f.IsSet()); while (f.IsSet());
@ -45,7 +45,7 @@ TEST(Flag, MultiThreaded)
} }
}; };
auto clearer = [&f, &count]() { auto clearer = [&]() {
for (int i = 0; i < ITERATIONS_COUNT; ++i) for (int i = 0; i < ITERATIONS_COUNT; ++i)
{ {
while (!f.IsSet()); while (!f.IsSet());

View File

@ -19,6 +19,7 @@ void Host_UpdateDisasmDialog() {}
void Host_UpdateMainFrame() {} void Host_UpdateMainFrame() {}
void Host_GetRenderWindowSize(int&, int&, int&, int&) {} void Host_GetRenderWindowSize(int&, int&, int&, int&) {}
void Host_RequestRenderWindowSize(int, int) {} void Host_RequestRenderWindowSize(int, int) {}
void Host_RequestFullscreen(bool) {}
void Host_SetStartupDebuggingParameters() {} void Host_SetStartupDebuggingParameters() {}
bool Host_UIHasFocus() { return false; } bool Host_UIHasFocus() { return false; }
bool Host_RendererHasFocus() { return false; } bool Host_RendererHasFocus() { return false; }

View File

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{474661E7-C73A-43A6-AFEE-EE1EC433D49E}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\VSProps\Base.props" />
<Import Project="..\VSProps\PCHUse.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup>
<!--This project also compiles gtest-->
<ClCompile>
<AdditionalIncludeDirectories>$(ExternalsDir)gtest\include;$(ExternalsDir)gtest;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<!--This junk is needed for JIT to function correctly-->
<BaseAddress>0x00400000</BaseAddress>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<FixedBaseAddress>true</FixedBaseAddress>
<!--
The following libs are needed since we pull in pretty much the entire
dolphin codebase.
-->
<AdditionalLibraryDirectories>$(ExternalsDir)OpenAL\$(PlatformName);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>iphlpapi.lib;winmm.lib;setupapi.lib;vfw32.lib;opengl32.lib;glu32.lib;rpcrt4.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<!--gtest is rather small, so just include it into the build here-->
<ClCompile Include="$(ExternalsDir)gtest\src\gtest-all.cc" />
<ClCompile Include="$(ExternalsDir)gtest\src\gtest_main.cc" />
<!--Lump all of the tests (and supporting code) into one binary-->
<ClCompile Include="*\*.cpp" />
</ItemGroup>
<ItemGroup>
<Text Include="CMakeLists.txt" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(CoreDir)Core\Core.vcxproj">
<Project>{E54CF649-140E-4255-81A5-30A673C1FB36}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)VideoBackends\D3D\D3D.vcxproj">
<Project>{96020103-4ba5-4fd2-b4aa-5b6d24492d4e}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)VideoBackends\OGL\OGL.vcxproj">
<Project>{ec1a314c-5588-4506-9c1e-2e58e5817f75}</Project>
</ProjectReference>
<ProjectReference Include="$(CoreDir)VideoBackends\Software\Software.vcxproj">
<Project>{a4c423aa-f57c-46c7-a172-d1a777017d29}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<!--
This project is always built, but the outputs are conditionally executed.
The tests will either be run by VS' test runner (requires a plugin to adapt
to gtest - developers will mostly use this method), or via msbuild (the
buildbot does it this way). The gtest adapter has the restriction that it
can only scan for tests on binaries it knows about (e.g. from projects' OutDir),
and it doesn't allow changing the working directory for running the tests.
Essentially this requires all runtime dependencies to be findable from the
context of the tests running with working directory set to OutDir. So...
that was the long-winded explanation of why we copy external things to the
OutDir :)
-->
<ItemGroup>
<ExternalDlls Include="$(ExternalsDir)OpenAL\$(PlatformName)\*.dll" />
</ItemGroup>
<!--Either method of running requires the runtime deps to be copied to pwd-->
<Target Name="CopyDeps"
AfterTargets="AfterBuild"
Inputs="@(ExternalDlls)"
Outputs="@(ExternalDlls -> '$(OutDir)%(RecursiveDir)%(Filename)%(Extension)')">
<Copy SourceFiles="@(ExternalDlls)" DestinationFolder="$(OutDir)"
Condition="!Exists('$(OutDir)%(RecursiveDir)%(Filename)%(ExternalDlls.Extension)') OR $([System.DateTime]::Parse('%(ModifiedTime)').Ticks) &gt; $([System.IO.File]::GetLastWriteTime('$(OutDir)%(RecursiveDir)%(Filename)%(ExternalDlls.Extension)').Ticks)" />
</Target>
<Target Name="ExecUnitTests"
AfterTargets="AfterBuild;CopyDeps"
Condition="'$(RunUnitTests)'=='true'">
<!--This is only executed via msbuild, VS test runner automatically does this-->
<Exec Command="$(TargetPath)"/>
</Target>
</Project>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!--For some stupid reason this has to be in the .user file...-->
<!--This is only used to allow UnitTests to find OpenAL DLL...kinda hacky-->
<LocalDebuggerWorkingDirectory>$(BinaryOutputDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>

View File

@ -6,10 +6,11 @@
<TargetSuffix> <TargetSuffix>
</TargetSuffix> </TargetSuffix>
<TargetSuffix Condition="'$(Configuration)'=='Debug'">D</TargetSuffix> <TargetSuffix Condition="'$(Configuration)'=='Debug'">D</TargetSuffix>
<BuildRootDir>$(SolutionDir)..\Build\</BuildRootDir> <DolphinRootDir>$(SolutionDir)..\</DolphinRootDir>
<BinaryRootDir>$(SolutionDir)..\Binary\</BinaryRootDir> <BuildRootDir>$(DolphinRootDir)Build\</BuildRootDir>
<BinaryRootDir>$(DolphinRootDir)Binary\</BinaryRootDir>
<BinaryOutputDir>$(BinaryRootDir)$(Platform)\</BinaryOutputDir> <BinaryOutputDir>$(BinaryRootDir)$(Platform)\</BinaryOutputDir>
<ExternalsDir>$(SolutionDir)..\Externals\</ExternalsDir> <ExternalsDir>$(DolphinRootDir)Externals\</ExternalsDir>
<CoreDir>$(SolutionDir)Core\</CoreDir> <CoreDir>$(SolutionDir)Core\</CoreDir>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
@ -41,7 +42,6 @@
<AdditionalIncludeDirectories>$(ExternalsDir)miniupnpc\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ExternalsDir)miniupnpc\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ExternalsDir)polarssl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ExternalsDir)polarssl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ExternalsDir)portaudio\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ExternalsDir)portaudio\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ExternalsDir)SDL2-2.0.1\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ExternalsDir)SFML\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ExternalsDir)SFML\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ExternalsDir)SOIL;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ExternalsDir)SOIL;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ExternalsDir)wxWidgets3;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(ExternalsDir)wxWidgets3;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>

View File

@ -61,6 +61,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Video Backends", "Video Bac
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pch", "PCH\pch.vcxproj", "{76563A7F-1011-4EAD-B667-7BB18D09568E}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pch", "PCH\pch.vcxproj", "{76563A7F-1011-4EAD-B667-7BB18D09568E}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTests", "UnitTests\UnitTests.vcxproj", "{474661E7-C73A-43A6-AFEE-EE1EC433D49E}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64 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}.Debug|x64.Build.0 = Debug|x64
{76563A7F-1011-4EAD-B667-7BB18D09568E}.Release|x64.ActiveCfg = Release|x64 {76563A7F-1011-4EAD-B667-7BB18D09568E}.Release|x64.ActiveCfg = Release|x64
{76563A7F-1011-4EAD-B667-7BB18D09568E}.Release|x64.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE