diff options
author | Joe Ludwig <joe@valvesoftware.com> | 2019-08-02 23:56:44 +0300 |
---|---|---|
committer | Joe Ludwig <joe@valvesoftware.com> | 2019-08-02 23:56:44 +0300 |
commit | d9cffe2ff87bf0bac69b56bcf6fb60652a9d4009 (patch) | |
tree | 3f336dfa1daaae03a50ec3c0ca5eb968cdd62672 /src | |
parent | cdaf2b330c8df58986391b253cd8f04328139823 (diff) |
OpenVR SDK 1.6.10v1.6.10
IVRSystem:
* Added GetAppContainerFilePaths – Call this function to get a semicolon-delimited list of file paths that any app container that intends to act as a SteamVR application will need access to.
* Added GetRuntimeVersion – This returns the version of the SteamVR runtime as a string.
IVROverlay:
* VROverlayFlags_ProtectedContent – This flag prevents the overlay in question from being readable by any OpenVR SDK, and prevents it from showing up in the overlay viewer.
CVRPropertyHelpers:
* Added getters and setters for 2, 3, and 4 element vectors
Driver Interface:
* Added IVRServerDriverHost::GetFrameTimings, which allows drivers to retrieve frame timing data
* Added tracked device class to IVRWatchdogHost::WatchdogWakeUp – This allows more precise logging of how the user caused SteamVR to wake up from hardware activity.
[git-p4: depot-paths = "//vr/steamvr/sdk_release/": change = 5271985]
Diffstat (limited to 'src')
-rw-r--r-- | src/vrcommon/envvartools_public.cpp | 42 | ||||
-rw-r--r-- | src/vrcommon/envvartools_public.h | 1 | ||||
-rw-r--r-- | src/vrcommon/hmderrors_public.cpp | 7 | ||||
-rw-r--r-- | src/vrcommon/pathtools_public.cpp | 17 | ||||
-rw-r--r-- | src/vrcommon/strtools_public.cpp | 11 | ||||
-rw-r--r-- | src/vrcommon/strtools_public.h | 6 | ||||
-rw-r--r-- | src/vrcommon/vrpathregistry_public.cpp | 4 |
7 files changed, 83 insertions, 5 deletions
diff --git a/src/vrcommon/envvartools_public.cpp b/src/vrcommon/envvartools_public.cpp index f958495..4fb4817 100644 --- a/src/vrcommon/envvartools_public.cpp +++ b/src/vrcommon/envvartools_public.cpp @@ -1,6 +1,9 @@ //========= Copyright Valve Corporation ============// #include "envvartools_public.h" +#include "strtools_public.h" #include <stdlib.h> +#include <string> +#include <cctype> #if defined(_WIN32) #include <windows.h> @@ -30,6 +33,45 @@ std::string GetEnvironmentVariable( const char *pchVarName ) #endif } +bool GetEnvironmentVariableAsBool( const char *pchVarName, bool bDefault ) +{ + std::string sValue = GetEnvironmentVariable( pchVarName ); + + if ( sValue.empty() ) + { + return bDefault; + } + + sValue = StringToLower( sValue ); + std::string sYesValues[] = { "y", "yes", "true" }; + std::string sNoValues[] = { "n", "no", "false" }; + + for ( std::string &sMatch : sYesValues ) + { + if ( sMatch == sValue ) + { + return true; + } + } + + for ( std::string &sMatch : sNoValues ) + { + if ( sMatch == sValue ) + { + return false; + } + } + + if ( std::isdigit( sValue.at(0) ) ) + { + return atoi( sValue.c_str() ) != 0; + } + + fprintf( stderr, + "GetEnvironmentVariableAsBool(%s): Unable to parse value '%s', using default %d\n", + pchVarName, sValue.c_str(), bDefault ); + return bDefault; +} bool SetEnvironmentVariable( const char *pchVarName, const char *pchVarValue ) { diff --git a/src/vrcommon/envvartools_public.h b/src/vrcommon/envvartools_public.h index 7de981a..7cd4c20 100644 --- a/src/vrcommon/envvartools_public.h +++ b/src/vrcommon/envvartools_public.h @@ -4,4 +4,5 @@ #include <string> std::string GetEnvironmentVariable( const char *pchVarName ); +bool GetEnvironmentVariableAsBool( const char *pchVarName, bool bDefault ); bool SetEnvironmentVariable( const char *pchVarName, const char *pchVarValue ); diff --git a/src/vrcommon/hmderrors_public.cpp b/src/vrcommon/hmderrors_public.cpp index dcc9857..6e314f1 100644 --- a/src/vrcommon/hmderrors_public.cpp +++ b/src/vrcommon/hmderrors_public.cpp @@ -81,6 +81,8 @@ const char *GetEnglishStringForHmdError( vr::EVRInitError eError ) case VRInitError_IPC_CompositorConnectFailed: return "Shared IPC Compositor Connect Failed (306)"; case VRInitError_IPC_CompositorInvalidConnectResponse: return "Shared IPC Compositor Invalid Connect Response (307)"; case VRInitError_IPC_ConnectFailedAfterMultipleAttempts: return "Shared IPC Connect Failed After Multiple Attempts (308)"; + case VRInitError_IPC_ConnectFailedAfterTargetExited: return "Shared IPC Connect Failed After Target Exited (309)"; + case VRInitError_IPC_NamespaceUnavailable: return "Shared IPC Namespace Unavailable (310)"; case VRInitError_Compositor_Failed: return "Compositor failed to initialize (400)"; case VRInitError_Compositor_D3D11HardwareRequired: return "Compositor failed to find DX11 hardware (401)"; @@ -169,6 +171,7 @@ const char *GetIDForVRInitError( vr::EVRInitError eError ) RETURN_ENUM_AS_STRING( VRInitError_Init_TrackerManagerInitFailed ); RETURN_ENUM_AS_STRING( VRInitError_Init_AlreadyRunning ); RETURN_ENUM_AS_STRING( VRInitError_Init_FailedForVrMonitor); + RETURN_ENUM_AS_STRING( VRInitError_Init_PropertyManagerInitFailed ); RETURN_ENUM_AS_STRING( VRInitError_Driver_Failed ); RETURN_ENUM_AS_STRING( VRInitError_Driver_Unknown ); @@ -193,7 +196,9 @@ const char *GetIDForVRInitError( vr::EVRInitError eError ) RETURN_ENUM_AS_STRING( VRInitError_IPC_Failed); RETURN_ENUM_AS_STRING( VRInitError_IPC_CompositorConnectFailed); RETURN_ENUM_AS_STRING( VRInitError_IPC_CompositorInvalidConnectResponse); - RETURN_ENUM_AS_STRING( VRInitError_IPC_ConnectFailedAfterMultipleAttempts); + RETURN_ENUM_AS_STRING( VRInitError_IPC_ConnectFailedAfterMultipleAttempts ); + RETURN_ENUM_AS_STRING( VRInitError_IPC_ConnectFailedAfterTargetExited ); + RETURN_ENUM_AS_STRING( VRInitError_IPC_NamespaceUnavailable ); RETURN_ENUM_AS_STRING( VRInitError_Compositor_Failed ); RETURN_ENUM_AS_STRING( VRInitError_Compositor_D3D11HardwareRequired ); diff --git a/src/vrcommon/pathtools_public.cpp b/src/vrcommon/pathtools_public.cpp index 0f8573e..26bc1be 100644 --- a/src/vrcommon/pathtools_public.cpp +++ b/src/vrcommon/pathtools_public.cpp @@ -16,7 +16,9 @@ #include <stdio.h> #include <unistd.h> #include <stdlib.h> +#include <alloca.h> #endif + #if defined OSX #include <Foundation/Foundation.h> #include <AppKit/AppKit.h> @@ -814,7 +816,12 @@ std::string Path_FilePathToUrl( const std::string & sRelativePath, const std::st if ( sAbsolute.empty() ) return sAbsolute; sAbsolute = Path_FixSlashes( sAbsolute, '/' ); - return std::string( FILE_URL_PREFIX ) + sAbsolute; + + size_t unBufferSize = sAbsolute.length() * 3; + char *pchBuffer = (char *)alloca( unBufferSize ); + V_URLEncodeNoPlusForSpace( pchBuffer, (int)unBufferSize, sAbsolute.c_str(), (int)sAbsolute.length() ); + + return std::string( FILE_URL_PREFIX ) + pchBuffer; } } @@ -825,9 +832,11 @@ std::string Path_UrlToFilePath( const std::string & sFileUrl ) { if ( !strnicmp( sFileUrl.c_str(), FILE_URL_PREFIX, strlen( FILE_URL_PREFIX ) ) ) { - std::string sRet = sFileUrl.c_str() + strlen( FILE_URL_PREFIX ); - sRet = Path_FixSlashes( sRet ); - return sRet; + char *pchBuffer = (char *)alloca( sFileUrl.length() ); + V_URLDecodeNoPlusForSpace( pchBuffer, (int)sFileUrl.length(), + sFileUrl.c_str() + strlen( FILE_URL_PREFIX ), (int)( sFileUrl.length() - strlen( FILE_URL_PREFIX ) ) ); + + return Path_FixSlashes( pchBuffer ); } else { diff --git a/src/vrcommon/strtools_public.cpp b/src/vrcommon/strtools_public.cpp index 46b9c5a..61cf324 100644 --- a/src/vrcommon/strtools_public.cpp +++ b/src/vrcommon/strtools_public.cpp @@ -401,6 +401,12 @@ void V_URLEncode( char *pchDest, int nDestLen, const char *pchSource, int nSourc } +void V_URLEncodeNoPlusForSpace( char *pchDest, int nDestLen, const char *pchSource, int nSourceLen ) +{ + return V_URLEncodeInternal( pchDest, nDestLen, pchSource, nSourceLen, false ); +} + + //----------------------------------------------------------------------------- // Purpose: Decodes a string (or binary data) from URL encoding format, see rfc1738 section 2.2. // This version of the call isn't a strict RFC implementation, but uses + for space as is @@ -414,6 +420,11 @@ size_t V_URLDecode( char *pchDecodeDest, int nDecodeDestLen, const char *pchEnco return V_URLDecodeInternal( pchDecodeDest, nDecodeDestLen, pchEncodedSource, nEncodedSourceLen, true ); } +size_t V_URLDecodeNoPlusForSpace( char *pchDecodeDest, int nDecodeDestLen, const char *pchEncodedSource, int nEncodedSourceLen ) +{ + return V_URLDecodeInternal( pchDecodeDest, nDecodeDestLen, pchEncodedSource, nEncodedSourceLen, false ); +} + //----------------------------------------------------------------------------- void V_StripExtension( std::string &in ) { diff --git a/src/vrcommon/strtools_public.h b/src/vrcommon/strtools_public.h index b817d9f..10c9d99 100644 --- a/src/vrcommon/strtools_public.h +++ b/src/vrcommon/strtools_public.h @@ -112,6 +112,9 @@ uint64_t StringToUint64( const std::string & sValue ); //----------------------------------------------------------------------------- void V_URLEncode( char *pchDest, int nDestLen, const char *pchSource, int nSourceLen ); +/** Same as V_URLEncode, but without plus for space. */ +void V_URLEncodeNoPlusForSpace( char *pchDest, int nDestLen, const char *pchSource, int nSourceLen ); + //----------------------------------------------------------------------------- // Purpose: Decodes a string (or binary data) from URL encoding format, see rfc1738 section 2.2. // This version of the call isn't a strict RFC implementation, but uses + for space as is @@ -122,6 +125,9 @@ void V_URLEncode( char *pchDest, int nDestLen, const char *pchSource, int nSourc //----------------------------------------------------------------------------- size_t V_URLDecode( char *pchDecodeDest, int nDecodeDestLen, const char *pchEncodedSource, int nEncodedSourceLen ); +/** Same as V_URLDecode, but without plus for space. */ +size_t V_URLDecodeNoPlusForSpace( char *pchDecodeDest, int nDecodeDestLen, const char *pchEncodedSource, int nEncodedSourceLen ); + //----------------------------------------------------------------------------- // Purpose: strip extension from a path //----------------------------------------------------------------------------- diff --git a/src/vrcommon/vrpathregistry_public.cpp b/src/vrcommon/vrpathregistry_public.cpp index 42de3e1..bd9b8d4 100644 --- a/src/vrcommon/vrpathregistry_public.cpp +++ b/src/vrcommon/vrpathregistry_public.cpp @@ -132,6 +132,10 @@ std::string CVRPathRegistry_Public::GetOpenVRConfigPath() //----------------------------------------------------------------------------- std::string CVRPathRegistry_Public::GetVRPathRegistryFilename() { + std::string sOverridePath = GetEnvironmentVariable( "VR_PATHREG_OVERRIDE" ); + if ( !sOverridePath.empty() ) + return sOverridePath; + std::string sPath = GetOpenVRConfigPath(); if ( sPath.empty() ) return ""; |