Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ValveSoftware/openvr.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoe Ludwig <joe@valvesoftware.com>2020-03-17 04:03:23 +0300
committerJoe Ludwig <joe@valvesoftware.com>2020-03-17 04:03:23 +0300
commit26fa19eb86ab3c589af2bdbc77449d61a8ff799b (patch)
treee58c9d49f5fb751de759143e4243821ce2b5b469 /src
parent39205f6b281a6131d1373d0217c1ab9ed19735ea (diff)
# OpenVR SDK 1.10.30v1.10.30
IVRHeadsetView: * Allows scene applications access the contents of the "VR View" window, including modifying properties of their own instances of that window. See the header file for details. IVROverlayView: * Allows applications to read overlay textures and send mouse events to those overlays. See the header file for details. IVRCompositor: * Added Submit_FrameDiscontinuity flag which can be passed to Submit to identify a discontinuity with the previous frame (e.g. when the player teleports). This prevents SteamVR’s Motion Smoothing from being applied using that pair of frames. * IVRCompositor::Submit – Can now handle DirectX Texture Arrays. Index 0 for the left eye, Index 1 for the right eye IVRRenderModels: * Added VRComponentProperty_IsHighlighted, which is set to true for any render model component that should be highlighted for an input binding. IVROverlay: * The DualAnalog input method is no longer supported. * Added VROverlayFlags_WantsModalBehavior. This flag causes an overlay to get a VREvent_Modal_Cancel event whenever the user clicks off of the overlay. This is ignored for dashboard overlays. * Added flags for keyboard usage. “minimal mode” is now specified with KeyboardFlag_Minimal. * Made modal keyboard behavior optional. To get the behavior from pre-1.10 SDKs, pass KeyboardFlag_Modal. * Added VREvent_LockMousePosition and VREvent_UnlockMousePosition, which are sent to overlays when a user is laser mousing over the overlay and performs the LockMousePosition compositor action. * Removed support for rendermodels attached to overlays. This feature is no longer supported. IVRInput: * Added global action set priority. When this is enabled in settings, overlay applications can override part or all of the input available to scene applications. See the header file comments for more details. * Added GetDominandHand/SetDominantHand. This allows an application to flip left and right hands on bindings. Applications that support this must add “supports_dominant_hand_setting” to true in their action manifest file. * Added GetComponentStateForBinding. This allows applications to get the render model component transform for any component on a render model for a set of input bindings. * Added GetBindingVariant. This allows applications to provide multiple binding files for a controller type and determine which of them the user currently has selected. The value returned here is the “variant” field from the options block in the binding JSON file. [git-p4: depot-paths = "//vr/steamvr/sdk_release/": change = 5759046]
Diffstat (limited to 'src')
-rw-r--r--src/vrcommon/hmderrors_public.cpp5
-rw-r--r--src/vrcommon/pathtools_public.cpp5
-rw-r--r--src/vrcommon/strtools_public.cpp90
-rw-r--r--src/vrcommon/strtools_public.h8
-rw-r--r--src/vrcommon/vrpathregistry_public.cpp39
-rw-r--r--src/vrcommon/vrpathregistry_public.h2
6 files changed, 113 insertions, 36 deletions
diff --git a/src/vrcommon/hmderrors_public.cpp b/src/vrcommon/hmderrors_public.cpp
index 7374759..e02c370 100644
--- a/src/vrcommon/hmderrors_public.cpp
+++ b/src/vrcommon/hmderrors_public.cpp
@@ -281,7 +281,7 @@ const char *GetIDForVRInitError( vr::EVRInitError eError )
RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateFallbackSyncTexture );
RETURN_ENUM_AS_STRING( VRInitError_Compositor_ShareFallbackSyncTexture );
RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateOverlayIndexBuffer );
- RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateOverlayVertextBuffer );
+ RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateOverlayVertexBuffer );
RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateTextVertexBuffer );
RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateTextIndexBuffer );
RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateMirrorTextures );
@@ -289,6 +289,9 @@ const char *GetIDForVRInitError( vr::EVRInitError eError )
RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateMirrorOverlay );
RETURN_ENUM_AS_STRING( VRInitError_Compositor_FailedToCreateVirtualDisplayBackbuffer );
RETURN_ENUM_AS_STRING( VRInitError_Compositor_DisplayModeNotSupported );
+ RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateOverlayInvalidCall );
+ RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateOverlayAlreadyInitialized );
+ RETURN_ENUM_AS_STRING( VRInitError_Compositor_FailedToCreateMailbox );
// Vendor-specific errors
RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_UnableToConnectToOculusRuntime);
diff --git a/src/vrcommon/pathtools_public.cpp b/src/vrcommon/pathtools_public.cpp
index 80eadb8..eb1373a 100644
--- a/src/vrcommon/pathtools_public.cpp
+++ b/src/vrcommon/pathtools_public.cpp
@@ -361,8 +361,9 @@ std::string Path_Compact( const std::string & sRawPath, char slash )
std::string::size_type len = sPath.length();
if( sPath[ len-1 ] == '.' && sPath[ len-2 ] == slash )
{
- // sPath.pop_back();
- sPath[len-1] = 0; // for now, at least
+ sPath.pop_back();
+ //Not sure why the following line of code was used for a while. It causes problems with strlen.
+ //sPath[len-1] = 0; // for now, at least
}
}
diff --git a/src/vrcommon/strtools_public.cpp b/src/vrcommon/strtools_public.cpp
index 661325a..f9ce0fd 100644
--- a/src/vrcommon/strtools_public.cpp
+++ b/src/vrcommon/strtools_public.cpp
@@ -10,6 +10,10 @@
#include <locale>
#include <codecvt>
+#if defined( _WIN32 )
+#include <windows.h>
+#endif
+
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
@@ -53,15 +57,15 @@ bool StringHasSuffixCaseSensitive( const std::string &sString, const std::string
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
+typedef std::codecvt_utf8< wchar_t > convert_type;
std::string UTF16to8(const wchar_t * in)
{
+ static std::wstring_convert< convert_type, wchar_t > s_converter; // construction of this can be expensive (or even serialized) depending on locale
+
try
{
- typedef std::codecvt_utf8< wchar_t > convert_type;
- std::wstring_convert< convert_type, wchar_t > converter;
-
- return converter.to_bytes( in );
+ return s_converter.to_bytes( in );
}
catch ( ... )
{
@@ -69,15 +73,16 @@ std::string UTF16to8(const wchar_t * in)
}
}
+std::string UTF16to8( const std::wstring & in ) { return UTF16to8( in.c_str() ); }
+
std::wstring UTF8to16(const char * in)
{
+ static std::wstring_convert< convert_type, wchar_t > s_converter; // construction of this can be expensive (or even serialized) depending on locale
+
try
{
- typedef std::codecvt_utf8< wchar_t > convert_type;
- std::wstring_convert< convert_type, wchar_t > converter;
-
- return converter.from_bytes( in );
+ return s_converter.from_bytes( in );
}
catch ( ... )
{
@@ -85,14 +90,37 @@ std::wstring UTF8to16(const char * in)
}
}
+std::wstring UTF8to16( const std::string & in ) { return UTF8to16( in.c_str() ); }
+
+
+#if defined( _WIN32 )
+//-----------------------------------------------------------------------------
+// Purpose: Convert LPSTR in the default CodePage to UTF8
+//-----------------------------------------------------------------------------
+std::string DefaultACPtoUTF8( const char *pszStr )
+{
+ if ( GetACP() == CP_UTF8 )
+ {
+ return pszStr;
+ }
+ else
+ {
+ std::vector<wchar_t> vecBuf( strlen( pszStr ) + 1 ); // should be guaranteed to be enough
+ MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, pszStr, -1, vecBuf.data(), (int) vecBuf.size() );
+ return UTF16to8( vecBuf.data() );
+ }
+}
+#endif
+// --------------------------------------------------------------------
+// Purpose:
+// --------------------------------------------------------------------
void strcpy_safe( char *pchBuffer, size_t unBufferSizeBytes, const char *pchSource )
{
strncpy( pchBuffer, pchSource, unBufferSizeBytes - 1 );
pchBuffer[unBufferSizeBytes - 1] = '\0';
}
-
// --------------------------------------------------------------------
// Purpose: converts a string to upper case
// --------------------------------------------------------------------
@@ -438,19 +466,17 @@ bool RepairUTF8( const char *pbegin, const char *pend, std::string & sOutputUtf8
bool bSqueakyClean = true;
const char *pmid = pbegin;
-
while ( pmid != pend )
{
+ bool bHasError = false;
+ bool bHasValidData = false;
+
char32_t out = 0xdeadbeef, *pout;
pbegin = pmid;
switch ( myfacet.in( mystate, pbegin, pend, pmid, &out, &out + 1, pout ) )
{
case facet_type::ok:
- // could convert back, but no need
- for ( const char *p = pbegin; p != pmid; ++p )
- {
- sOutputUtf8 += *p;
- }
+ bHasValidData = true;
break;
case facet_type::noconv:
@@ -459,17 +485,41 @@ bool RepairUTF8( const char *pbegin, const char *pend, std::string & sOutputUtf8
break;
case facet_type::partial:
- sOutputUtf8 += '?';
- pmid++; // partial consumes 0, so make progress
- bSqueakyClean = false;
+ bHasError = pbegin == pmid;
+ if ( bHasError )
+ {
+ bSqueakyClean = false;
+ }
+ else
+ {
+ bHasValidData = true;
+ }
break;
case facet_type::error:
- sOutputUtf8 += '?';
- // error consumes some bytes
+ bHasError = true;
bSqueakyClean = false;
break;
}
+
+ if ( bHasValidData )
+ {
+ // could convert back, but no need
+ for ( const char *p = pbegin; p != pmid; ++p )
+ {
+ sOutputUtf8 += *p;
+ }
+ }
+
+ if ( bHasError )
+ {
+ sOutputUtf8 += '?';
+ }
+
+ if ( pmid == pbegin )
+ {
+ pmid++;
+ }
}
return bSqueakyClean;
diff --git a/src/vrcommon/strtools_public.h b/src/vrcommon/strtools_public.h
index 9a53907..349b5b3 100644
--- a/src/vrcommon/strtools_public.h
+++ b/src/vrcommon/strtools_public.h
@@ -15,12 +15,18 @@ bool StringHasSuffix( const std::string &sString, const std::string &sSuffix );
bool StringHasSuffixCaseSensitive( const std::string &sString, const std::string &sSuffix );
/** converts a UTF-16 string to a UTF-8 string */
-std::string UTF16to8(const wchar_t * in);
+std::string UTF16to8( const wchar_t * in );
+std::string UTF16to8( const std::wstring & in );
/** converts a UTF-8 string to a UTF-16 string */
std::wstring UTF8to16(const char * in);
+std::wstring UTF8to16( const std::string & in );
#define Utf16FromUtf8 UTF8to16
+#if defined( _WIN32 )
+std::string DefaultACPtoUTF8( const char *pszStr );
+#endif
+
/** Repairs a should-be-UTF-8 string to a for-sure-is-UTF-8 string, plus return boolean if we subbed in '?' somewhere */
bool RepairUTF8( const char *begin, const char *end, std::string & sOutputUtf8 );
bool RepairUTF8( const std::string & sInputUtf8, std::string & sOutputUtf8 );
diff --git a/src/vrcommon/vrpathregistry_public.cpp b/src/vrcommon/vrpathregistry_public.cpp
index e4be52f..6a7f457 100644
--- a/src/vrcommon/vrpathregistry_public.cpp
+++ b/src/vrcommon/vrpathregistry_public.cpp
@@ -212,19 +212,25 @@ bool CVRPathRegistry_Public::ToJsonString( std::string &sJsonString )
// ---------------------------------------------------------------------------
// Purpose: Loads the config file from its well known location
// ---------------------------------------------------------------------------
-bool CVRPathRegistry_Public::BLoadFromFile()
+bool CVRPathRegistry_Public::BLoadFromFile( std::string *psLoadError )
{
std::string sRegPath = GetVRPathRegistryFilename();
if( sRegPath.empty() )
{
- VRLog( "Unable to determine VR Path Registry filename\n" );
+ if ( psLoadError )
+ {
+ *psLoadError = "Unable to determine VR Path Registry filename";
+ }
return false;
}
std::string sRegistryContents = Path_ReadTextFile( sRegPath );
if( sRegistryContents.empty() )
{
- VRLog( "Unable to read VR Path Registry from %s\n", sRegPath.c_str() );
+ if ( psLoadError )
+ {
+ *psLoadError = "Unable to read VR Path Registry from " + sRegPath;
+ }
return false;
}
@@ -236,7 +242,10 @@ bool CVRPathRegistry_Public::BLoadFromFile()
try {
if ( !parseFromStream( builder, istream, &root, &sErrors ) )
{
- VRLog( "Unable to parse %s: %s\n", sRegPath.c_str(), sErrors.c_str() );
+ if ( psLoadError )
+ {
+ *psLoadError = "Unable to parse " + sRegPath + ": " + sErrors;
+ }
return false;
}
@@ -250,7 +259,10 @@ bool CVRPathRegistry_Public::BLoadFromFile()
}
catch ( ... )
{
- VRLog( "Unable to parse %s: %s\n", sRegPath.c_str(), "exception thrown in JSON library" );
+ if ( psLoadError )
+ {
+ *psLoadError = "Unable to parse " + sRegPath + ": exception thrown in JSON library";
+ }
return false;
}
@@ -263,9 +275,6 @@ bool CVRPathRegistry_Public::BLoadFromFile()
// ---------------------------------------------------------------------------
bool CVRPathRegistry_Public::BSaveToFile() const
{
-#if defined( DASHBOARD_BUILD_MODE )
- return false;
-#else
std::string sRegPath = GetVRPathRegistryFilename();
if( sRegPath.empty() )
return false;
@@ -298,7 +307,6 @@ bool CVRPathRegistry_Public::BSaveToFile() const
}
return true;
-#endif
}
@@ -345,12 +353,15 @@ std::string CVRPathRegistry_Public::GetLogPath() const
// ---------------------------------------------------------------------------
bool CVRPathRegistry_Public::GetPaths( std::string *psRuntimePath, std::string *psConfigPath, std::string *psLogPath, const char *pchConfigPathOverride, const char *pchLogPathOverride, std::vector<std::string> *pvecExternalDrivers )
{
+ std::string sLoadError;
CVRPathRegistry_Public pathReg;
- bool bLoadedRegistry = pathReg.BLoadFromFile();
+ bool bLoadedRegistry = pathReg.BLoadFromFile( &sLoadError );
int nCountEnvironmentVariables = 0;
+ int nRequestedPaths = 0;
if( psRuntimePath )
{
+ nRequestedPaths++;
if ( GetEnvironmentVariable( k_pchRuntimeOverrideVar ).length() != 0 )
{
*psRuntimePath = GetEnvironmentVariable( k_pchRuntimeOverrideVar );
@@ -368,6 +379,7 @@ bool CVRPathRegistry_Public::GetPaths( std::string *psRuntimePath, std::string *
if( psConfigPath )
{
+ nRequestedPaths++;
if ( GetEnvironmentVariable( k_pchConfigOverrideVar ).length() != 0 )
{
*psConfigPath = GetEnvironmentVariable( k_pchConfigOverrideVar );
@@ -389,6 +401,7 @@ bool CVRPathRegistry_Public::GetPaths( std::string *psRuntimePath, std::string *
if( psLogPath )
{
+ nRequestedPaths++;
if ( GetEnvironmentVariable( k_pchLogOverrideVar ).length() != 0 )
{
*psLogPath = GetEnvironmentVariable( k_pchLogOverrideVar );
@@ -413,11 +426,15 @@ bool CVRPathRegistry_Public::GetPaths( std::string *psRuntimePath, std::string *
*pvecExternalDrivers = pathReg.m_vecExternalDrivers;
}
- if ( nCountEnvironmentVariables == 3 )
+ if ( nCountEnvironmentVariables == nRequestedPaths )
{
// all three environment variables were set, so we don't need the physical file
return true;
}
+ else if( !bLoadedRegistry )
+ {
+ VRLog( "%s\n", sLoadError.c_str() );
+ }
return bLoadedRegistry;
}
diff --git a/src/vrcommon/vrpathregistry_public.h b/src/vrcommon/vrpathregistry_public.h
index 4838a10..776935a 100644
--- a/src/vrcommon/vrpathregistry_public.h
+++ b/src/vrcommon/vrpathregistry_public.h
@@ -22,7 +22,7 @@ public:
* Returns false if the path registry could not be read. Valid paths might still be returned based on environment variables. */
static bool GetPaths( std::string *psRuntimePath, std::string *psConfigPath, std::string *psLogPath, const char *pchConfigPathOverride, const char *pchLogPathOverride, std::vector<std::string> *pvecExternalDrivers = NULL );
- bool BLoadFromFile();
+ bool BLoadFromFile( std::string *psError = nullptr );
bool BSaveToFile() const;
bool ToJsonString( std::string &sJsonString );