diff options
-rw-r--r-- | LibOVR/Src/Kernel/OVR_ThreadsWinAPI.cpp | 7 | ||||
-rw-r--r-- | LibOVR/Src/OVR_CAPI.cpp | 6 | ||||
-rw-r--r-- | LibOVR/Src/OVR_Profile.cpp | 2 | ||||
-rw-r--r-- | LibOVR/Src/OVR_SensorImpl.cpp | 4 | ||||
-rw-r--r-- | LibOVR/Src/OVR_Win32_DeviceStatus.cpp | 5 | ||||
-rw-r--r-- | LibOVR/Src/OVR_Win32_HIDDevice.cpp | 2 | ||||
-rw-r--r-- | LibOVR/Src/OVR_Win32_HIDDevice.h | 1 | ||||
-rw-r--r-- | LibOVR/Src/OVR_Win32_HMDDevice.cpp | 2 |
8 files changed, 20 insertions, 9 deletions
diff --git a/LibOVR/Src/Kernel/OVR_ThreadsWinAPI.cpp b/LibOVR/Src/Kernel/OVR_ThreadsWinAPI.cpp index 91a5e31..1779fb0 100644 --- a/LibOVR/Src/Kernel/OVR_ThreadsWinAPI.cpp +++ b/LibOVR/Src/Kernel/OVR_ThreadsWinAPI.cpp @@ -821,7 +821,7 @@ unsigned WINAPI Thread_Win32StartFn(void * phandle) // Ensure that ThreadId is assigned once thread is running, in case
// beginthread hasn't filled it in yet.
- pthread->IdValue = (ThreadId)::GetCurrentThreadId();
+ pthread->IdValue = (ThreadId)(intptr_t)::GetCurrentThreadId(); // should be: typedef intptr_t ThreadId;
DWORD result = pthread->PRun();
// Signal the thread as done and release it atomically.
@@ -953,7 +953,8 @@ bool Thread::MSleep(unsigned msecs) void Thread::SetThreadName( const char* name )
{
-#if !defined(OVR_BUILD_SHIPPING) || defined(OVR_BUILD_PROFILING)
+ // MinGW does not support SEH exceptions, hence CPP: && defined(OVR_CC_MSVC)
+#if ( !defined(OVR_BUILD_SHIPPING) || defined(OVR_BUILD_PROFILING) ) && defined(OVR_CC_MSVC)
// Looks ugly, but it is the recommended way to name a thread.
typedef struct tagTHREADNAME_INFO {
DWORD dwType; // Must be 0x1000
@@ -995,7 +996,7 @@ int Thread::GetCPUCount() // comparison purposes.
ThreadId GetCurrentThreadId()
{
- return (ThreadId)::GetCurrentThreadId();
+ return (ThreadId)(intptr_t)::GetCurrentThreadId(); // should be: typedef intptr_t ThreadId;
}
} // OVR
diff --git a/LibOVR/Src/OVR_CAPI.cpp b/LibOVR/Src/OVR_CAPI.cpp index a7f921f..497d1a2 100644 --- a/LibOVR/Src/OVR_CAPI.cpp +++ b/LibOVR/Src/OVR_CAPI.cpp @@ -670,7 +670,11 @@ OVR_EXPORT ovrEyeRenderDesc ovrHmd_GetRenderDesc(ovrHmd hmd, -#define OVR_OFFSET_OF(s, field) ((size_t)&((s*)0)->field) +#if defined(OVR_CC_MSVC) + #define OVR_OFFSET_OF(s, field) ((size_t)&((s*)0)->field) +#else + #define OVR_OFFSET_OF(s, field) (1) +#endif diff --git a/LibOVR/Src/OVR_Profile.cpp b/LibOVR/Src/OVR_Profile.cpp index 4844c29..12f4a46 100644 --- a/LibOVR/Src/OVR_Profile.cpp +++ b/LibOVR/Src/OVR_Profile.cpp @@ -40,7 +40,7 @@ limitations under the License. #include "Kernel/OVR_Array.h" #ifdef OVR_OS_WIN32 -#include <Shlobj.h> +#include <shlobj.h> #else #include <dirent.h> #include <sys/stat.h> diff --git a/LibOVR/Src/OVR_SensorImpl.cpp b/LibOVR/Src/OVR_SensorImpl.cpp index 91ae7e0..c7d3acd 100644 --- a/LibOVR/Src/OVR_SensorImpl.cpp +++ b/LibOVR/Src/OVR_SensorImpl.cpp @@ -870,7 +870,7 @@ bool SensorDeviceImpl::SetMagCalibrationReport(const MagCalibrationReport &data) // time stamp the calibration char time_str[64]; -#ifdef OVR_OS_WIN32 +#if defined(OVR_OS_WIN32) && defined(OVR_CC_MSVC) struct tm caltime; time_t now = time(0); localtime_s(&caltime, &now); @@ -1074,7 +1074,7 @@ bool SensorDeviceImpl::GetMagCalibrationReport(MagCalibrationReport* data) tm ct; memset(&ct, 0, sizeof(tm)); -#ifdef OVR_OS_WIN32 +#if defined(OVR_OS_WIN32) && defined(OVR_CC_MSVC) struct tm nowtime; localtime_s(&nowtime, &now); ct.tm_isdst = nowtime.tm_isdst; diff --git a/LibOVR/Src/OVR_Win32_DeviceStatus.cpp b/LibOVR/Src/OVR_Win32_DeviceStatus.cpp index 1dfcd6a..6eee1c0 100644 --- a/LibOVR/Src/OVR_Win32_DeviceStatus.cpp +++ b/LibOVR/Src/OVR_Win32_DeviceStatus.cpp @@ -32,6 +32,11 @@ limitations under the License. #include <dbt.h>
+#ifndef DEVICE_NOTIFY_ALL_INTERFACE_CLASSES
+// Normally defined in winuser.h
+#define DEVICE_NOTIFY_ALL_INTERFACE_CLASSES 0x00000004
+#endif
+
namespace OVR { namespace Win32 {
static TCHAR windowClassName[] = TEXT("LibOVR_DeviceStatus_WindowClass");
diff --git a/LibOVR/Src/OVR_Win32_HIDDevice.cpp b/LibOVR/Src/OVR_Win32_HIDDevice.cpp index 75d71f4..67d9204 100644 --- a/LibOVR/Src/OVR_Win32_HIDDevice.cpp +++ b/LibOVR/Src/OVR_Win32_HIDDevice.cpp @@ -289,7 +289,7 @@ bool HIDDevice::HIDInitialize(const String& path) if (!openDevice())
{
- LogText("OVR::Win32::HIDDevice - Failed to open HIDDevice: ", path);
+ LogText("OVR::Win32::HIDDevice - Failed to open HIDDevice: ", path.ToCStr());
return false;
}
diff --git a/LibOVR/Src/OVR_Win32_HIDDevice.h b/LibOVR/Src/OVR_Win32_HIDDevice.h index 4e75914..c186ccd 100644 --- a/LibOVR/Src/OVR_Win32_HIDDevice.h +++ b/LibOVR/Src/OVR_Win32_HIDDevice.h @@ -31,6 +31,7 @@ limitations under the License. #include "OVR_Win32_DeviceManager.h"
#include <windows.h>
+#include <ntdef.h> // Needed for declaration of NTSTATUS
#include <setupapi.h>
//-------------------------------------------------------------------------------------
diff --git a/LibOVR/Src/OVR_Win32_HMDDevice.cpp b/LibOVR/Src/OVR_Win32_HMDDevice.cpp index e16a060..c0fc5ae 100644 --- a/LibOVR/Src/OVR_Win32_HMDDevice.cpp +++ b/LibOVR/Src/OVR_Win32_HMDDevice.cpp @@ -297,7 +297,7 @@ void HMDDeviceFactory::EnumerateDevices(EnumerateVisitor& visitor) {
info.cbSize = sizeof(MONITORINFOEX);
GetMonitorInfo(monitors.Monitors[m], &info);
- if (_tcsstr(ddm.DeviceName, info.szDevice) == ddm.DeviceName)
+ if (wcsstr(ddm.DeviceName, info.szDevice) == ddm.DeviceName)
{ // If the device name starts with the monitor name
// then we found the matching DISPLAY_DEVICE and MONITORINFO
// so we can gather the monitor coordinates
|