Skip to content
This repository has been archived by the owner on May 3, 2021. It is now read-only.

Commit

Permalink
Build fixes for OpenVR API 1.0.2
Browse files Browse the repository at this point in the history
* Fixed up CClientDriver_PSMoveService::Init to accept a driver
* Fixed size_t warnings
  • Loading branch information
HipsterSloth committed Jul 8, 2016
1 parent 068aa37 commit 1b48a2c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 13 deletions.
39 changes: 28 additions & 11 deletions src/openvr_plugin/driver_psmoveservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ const char * const *CServerDriver_PSMoveService::GetInterfaceVersions()

uint32_t CServerDriver_PSMoveService::GetTrackedDeviceCount()
{
return m_vecTrackedDevices.size();
return static_cast<uint32_t>(m_vecTrackedDevices.size());
}

vr::ITrackedDeviceServerDriver * CServerDriver_PSMoveService::GetTrackedDeviceDriver(
Expand Down Expand Up @@ -583,11 +583,28 @@ CClientDriver_PSMoveService::~CClientDriver_PSMoveService()
{
}

vr::EVRInitError CClientDriver_PSMoveService::Init( vr::IDriverLog * pDriverLog, vr::IClientDriverHost * pDriverHost, const char * pchUserDriverConfigDir, const char * pchDriverInstallDir )
vr::EVRInitError CClientDriver_PSMoveService::Init(
vr::EClientDriverMode driverMode,
vr::IDriverLog * pDriverLog,
vr::IClientDriverHost * pDriverHost,
const char * pchUserDriverConfigDir,
const char * pchDriverInstallDir )
{
InitDriverLog( pDriverLog );
m_pDriverHost = pDriverHost;
return vr::VRInitError_None;
vr::EVRInitError result= vr::VRInitError_Driver_Failed;

switch(driverMode)
{
case vr::ClientDriverMode_Normal:
InitDriverLog( pDriverLog );
m_pDriverHost = pDriverHost;
result= vr::VRInitError_None;
break;
case vr::ClientDriverMode_Watchdog: // client should return VRInitError_Init_LowPowerWatchdogNotSupported if it can't support this mode
result= vr::VRInitError_Init_LowPowerWatchdogNotSupported;
break;
}

return result;
}

void CClientDriver_PSMoveService::Cleanup()
Expand Down Expand Up @@ -805,13 +822,13 @@ uint32_t CPSMoveTrackedDeviceLatest::GetStringTrackedDeviceProperty(
else if (sRetVal.size() + 1 > unBufferSize)
{
*pError = vr::TrackedProp_BufferTooSmall;
return sRetVal.size() + 1; // caller needs to know how to size buffer
return static_cast<uint32_t>(sRetVal.size() + 1); // caller needs to know how to size buffer
}
else
{
snprintf(pchValue, unBufferSize, sRetVal.c_str());
*pError = vr::TrackedProp_Success;
return sRetVal.size() + 1;
return static_cast<uint32_t>(sRetVal.size() + 1);
}
}

Expand Down Expand Up @@ -1118,13 +1135,13 @@ uint32_t CPSMoveControllerLatest::GetStringTrackedDeviceProperty(
else if ( sRetVal.size() + 1 > unBufferSize )
{
*pError = vr::TrackedProp_BufferTooSmall;
return sRetVal.size() + 1; // caller needs to know how to size buffer
return static_cast<uint32_t>(sRetVal.size() + 1); // caller needs to know how to size buffer
}
else
{
snprintf( pchValue, unBufferSize, sRetVal.c_str() );
*pError = vr::TrackedProp_Success;
return sRetVal.size() + 1;
return static_cast<uint32_t>(sRetVal.size() + 1);
}
}

Expand Down Expand Up @@ -1596,13 +1613,13 @@ uint32_t CPSMoveTrackerLatest::GetStringTrackedDeviceProperty(
else if (sRetVal.size() + 1 > unBufferSize)
{
*pError = vr::TrackedProp_BufferTooSmall;
return sRetVal.size() + 1; // caller needs to know how to size buffer
return static_cast<uint32_t>(sRetVal.size() + 1); // caller needs to know how to size buffer
}
else
{
snprintf(pchValue, unBufferSize, sRetVal.c_str());
*pError = vr::TrackedProp_Success;
return sRetVal.size() + 1;
return static_cast<uint32_t>(sRetVal.size() + 1);
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/openvr_plugin/driver_psmoveservice.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class CClientDriver_PSMoveService : public vr::IClientTrackedDeviceProvider
virtual ~CClientDriver_PSMoveService();

// Inherited via IClientTrackedDeviceProvider
virtual vr::EVRInitError Init( vr::IDriverLog * pDriverLog, vr::IClientDriverHost * pDriverHost, const char * pchUserDriverConfigDir, const char * pchDriverInstallDir ) override;
virtual vr::EVRInitError Init( vr::EClientDriverMode eDriverMode, vr::IDriverLog * pDriverLog, vr::IClientDriverHost * pDriverHost, const char * pchUserDriverConfigDir, const char * pchDriverInstallDir ) override;
virtual void Cleanup() override;
virtual bool BIsHmdPresent( const char * pchUserConfigDir ) override;
virtual vr::EVRInitError SetDisplayId( const char * pchDisplayId ) override;
Expand All @@ -85,7 +85,6 @@ class CClientDriver_PSMoveService : public vr::IClientTrackedDeviceProvider

private:
vr::IClientDriverHost* m_pDriverHost;

};

class CPSMoveTrackedDeviceLatest : public vr::ITrackedDeviceServerDriver
Expand Down

0 comments on commit 1b48a2c

Please sign in to comment.