mirror of https://github.com/AxioDL/boo.git
Windows fixes and include refinements
This commit is contained in:
parent
c77fe94313
commit
dbf7b9bcf8
|
@ -209,6 +209,7 @@ add_library(boo
|
|||
lib/inputdev/DualshockPad.cpp include/boo/inputdev/DualshockPad.hpp
|
||||
lib/inputdev/GenericPad.cpp include/boo/inputdev/GenericPad.hpp
|
||||
lib/inputdev/DeviceSignature.cpp include/boo/inputdev/DeviceSignature.hpp
|
||||
lib/inputdev/DeviceFinder.cpp include/boo/inputdev/DeviceFinder.hpp
|
||||
lib/inputdev/IHIDDevice.hpp
|
||||
lib/audiodev/WAVOut.cpp
|
||||
lib/audiodev/AudioMatrix.hpp
|
||||
|
|
|
@ -54,6 +54,8 @@ namespace boo
|
|||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <D3Dcommon.h>
|
||||
#include <wrl/client.h>
|
||||
template <class T>
|
||||
using ComPtr = Microsoft::WRL::ComPtr<T>;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "IGraphicsCommandQueue.hpp"
|
||||
#include "boo/IGraphicsContext.hpp"
|
||||
#include "boo/System.hpp"
|
||||
#include <D3Dcommon.h>
|
||||
#include <vector>
|
||||
#include <unordered_set>
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <Dbt.h>
|
||||
#endif
|
||||
|
||||
namespace boo
|
||||
|
@ -162,43 +161,7 @@ public:
|
|||
|
||||
#if _WIN32
|
||||
/* Windows-specific WM_DEVICECHANGED handler */
|
||||
static LRESULT winDevChangedHandler(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
PDEV_BROADCAST_HDR dbh = (PDEV_BROADCAST_HDR)lParam;
|
||||
PDEV_BROADCAST_DEVICEINTERFACE dbhi = (PDEV_BROADCAST_DEVICEINTERFACE)lParam;
|
||||
DeviceFinder* finder = instance();
|
||||
if (!finder)
|
||||
return 0;
|
||||
|
||||
if (wParam == DBT_DEVICEARRIVAL)
|
||||
{
|
||||
if (dbh->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE)
|
||||
{
|
||||
#ifdef UNICODE
|
||||
char devPath[1024];
|
||||
wcstombs(devPath, dbhi->dbcc_name, 1024);
|
||||
finder->m_listener->_extDevConnect(devPath);
|
||||
#else
|
||||
finder->m_listener->_extDevConnect(dbhi->dbcc_name);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (wParam == DBT_DEVICEREMOVECOMPLETE)
|
||||
{
|
||||
if (dbh->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE)
|
||||
{
|
||||
#ifdef UNICODE
|
||||
char devPath[1024];
|
||||
wcstombs(devPath, dbhi->dbcc_name, 1024);
|
||||
finder->m_listener->_extDevDisconnect(devPath);
|
||||
#else
|
||||
finder->m_listener->_extDevDisconnect(dbhi->dbcc_name);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
static LRESULT winDevChangedHandler(WPARAM wParam, LPARAM lParam);
|
||||
#endif
|
||||
|
||||
};
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
#include "boo/inputdev/DeviceFinder.hpp"
|
||||
|
||||
#if _WIN32
|
||||
#include <Dbt.h>
|
||||
#endif
|
||||
|
||||
namespace boo
|
||||
{
|
||||
|
||||
#if _WIN32
|
||||
/* Windows-specific WM_DEVICECHANGED handler */
|
||||
LRESULT DeviceFinder::winDevChangedHandler(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
PDEV_BROADCAST_HDR dbh = (PDEV_BROADCAST_HDR)lParam;
|
||||
PDEV_BROADCAST_DEVICEINTERFACE dbhi = (PDEV_BROADCAST_DEVICEINTERFACE)lParam;
|
||||
DeviceFinder* finder = instance();
|
||||
if (!finder)
|
||||
return 0;
|
||||
|
||||
if (wParam == DBT_DEVICEARRIVAL)
|
||||
{
|
||||
if (dbh->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE)
|
||||
{
|
||||
#ifdef UNICODE
|
||||
char devPath[1024];
|
||||
wcstombs(devPath, dbhi->dbcc_name, 1024);
|
||||
finder->m_listener->_extDevConnect(devPath);
|
||||
#else
|
||||
finder->m_listener->_extDevConnect(dbhi->dbcc_name);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (wParam == DBT_DEVICEREMOVECOMPLETE)
|
||||
{
|
||||
if (dbh->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE)
|
||||
{
|
||||
#ifdef UNICODE
|
||||
char devPath[1024];
|
||||
wcstombs(devPath, dbhi->dbcc_name, 1024);
|
||||
finder->m_listener->_extDevDisconnect(devPath);
|
||||
#else
|
||||
finder->m_listener->_extDevDisconnect(dbhi->dbcc_name);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
|
@ -3,6 +3,7 @@
|
|||
#include <initguid.h>
|
||||
#include <Usbiodef.h>
|
||||
#include <winver.h>
|
||||
#include <Dbt.h>
|
||||
|
||||
#if _DEBUG
|
||||
#define D3D11_CREATE_DEVICE_FLAGS D3D11_CREATE_DEVICE_DEBUG
|
||||
|
|
Loading…
Reference in New Issue