Bug 1423731 - Update OpenVR to 1.0.18 r=rbarker

MozReview-Commit-ID: HnsMlUukB6z

--HG--
extra : rebase_source : 4c270d99cf6e54dfff653a1475a32b43548d4a77
This commit is contained in:
Kearwood Gilbert 2018-05-04 16:31:58 -07:00
parent 0839e43771
commit a6a73845e8
10 changed files with 522 additions and 230 deletions

View File

@ -1024,6 +1024,7 @@ VRSystemManagerOpenVR::GetGamepadHandFromControllerRole(
switch(aRole) {
case ::vr::ETrackedControllerRole::TrackedControllerRole_Invalid:
case ::vr::ETrackedControllerRole::TrackedControllerRole_OptOut:
hand = dom::GamepadHand::_empty;
break;
case ::vr::ETrackedControllerRole::TrackedControllerRole_LeftHand:
@ -1033,6 +1034,7 @@ VRSystemManagerOpenVR::GetGamepadHandFromControllerRole(
hand = dom::GamepadHand::Right;
break;
default:
hand = dom::GamepadHand::_empty;
MOZ_ASSERT(false);
break;
}

View File

@ -1,4 +1,4 @@
This directory contains files from the OpenVR SDK, version 1.0.8.
This directory contains files from the OpenVR SDK, version 1.0.18.
This SDK contains the OpenVR API interface headers and functions to load the
OpenVR runtime libraries which actually implement the functionality. The

View File

@ -36,7 +36,7 @@ typedef uint32_t glUInt_t;
// right-handed system
// +y is up
// +x is to the right
// -z is going away from you
// -z is forward
// Distance unit is meters
struct HmdMatrix34_t
{
@ -112,6 +112,8 @@ enum ETextureType
TextureType_Vulkan = 2, // Handle is a pointer to a VRVulkanTextureData_t structure
TextureType_IOSurface = 3, // Handle is a macOS cross-process-sharable IOSurfaceRef
TextureType_DirectX12 = 4, // Handle is a pointer to a D3D12TextureData_t structure
TextureType_DXGISharedHandle = 5, // Handle is a HANDLE DXGI share handle, only supported for Overlay render targets.
// this texture is used directly by our renderer, so only perform atomic (copyresource or resolve) on it
};
enum EColorSpace
@ -151,7 +153,7 @@ static const uint32_t k_unMaxDriverDebugResponseSize = 32768;
/** Used to pass device IDs to API calls */
typedef uint32_t TrackedDeviceIndex_t;
static const uint32_t k_unTrackedDeviceIndex_Hmd = 0;
static const uint32_t k_unMaxTrackedDeviceCount = 16;
static const uint32_t k_unMaxTrackedDeviceCount = 64;
static const uint32_t k_unTrackedDeviceIndexOther = 0xFFFFFFFE;
static const uint32_t k_unTrackedDeviceIndexInvalid = 0xFFFFFFFF;
@ -173,6 +175,8 @@ enum ETrackedControllerRole
TrackedControllerRole_Invalid = 0, // Invalid value for controller type
TrackedControllerRole_LeftHand = 1, // Tracked device associated with the left hand
TrackedControllerRole_RightHand = 2, // Tracked device associated with the right hand
TrackedControllerRole_OptOut = 3, // Tracked device is opting out of left/right hand selection
TrackedControllerRole_Max = 4
};
@ -199,6 +203,9 @@ enum ETrackingUniverseOrigin
TrackingUniverseRawAndUncalibrated = 2, // Poses are provided in the coordinate system defined by the driver. It has Y up and is unified for devices of the same driver. You usually don't want this one.
};
typedef uint64_t WebConsoleHandle_t;
#define INVALID_WEB_CONSOLE_HANDLE ((vr::WebConsoleHandle_t)0)
// Refers to a single container of properties
typedef uint64_t PropertyContainerHandle_t;
typedef uint32_t PropertyTypeTag_t;
@ -206,6 +213,9 @@ typedef uint32_t PropertyTypeTag_t;
static const PropertyContainerHandle_t k_ulInvalidPropertyContainer = 0;
static const PropertyTypeTag_t k_unInvalidPropertyTag = 0;
typedef PropertyContainerHandle_t DriverHandle_t;
static const PropertyContainerHandle_t k_ulInvalidDriverHandle = 0;
// Use these tags to set/get common types as struct properties
static const PropertyTypeTag_t k_unFloatPropertyTag = 1;
static const PropertyTypeTag_t k_unInt32PropertyTag = 2;
@ -219,6 +229,11 @@ static const PropertyTypeTag_t k_unHmdVector3PropertyTag = 22;
static const PropertyTypeTag_t k_unHmdVector4PropertyTag = 23;
static const PropertyTypeTag_t k_unHiddenAreaPropertyTag = 30;
static const PropertyTypeTag_t k_unPathHandleInfoTag = 31;
static const PropertyTypeTag_t k_unActionPropertyTag = 32;
static const PropertyTypeTag_t k_unInputValuePropertyTag = 33;
static const PropertyTypeTag_t k_unWildcardPropertyTag = 34;
static const PropertyTypeTag_t k_unHapticVibrationPropertyTag = 35;
static const PropertyTypeTag_t k_unOpenVRInternalReserved_Start = 1000;
static const PropertyTypeTag_t k_unOpenVRInternalReserved_End = 10000;
@ -267,6 +282,11 @@ enum ETrackedDeviceProperty
Prop_ViveSystemButtonFixRequired_Bool = 1033,
Prop_ParentDriver_Uint64 = 1034,
Prop_ResourceRoot_String = 1035,
Prop_RegisteredDeviceType_String = 1036,
Prop_InputProfilePath_String = 1037, // input profile to use for this device in the input system. Will default to tracking system name if this isn't provided
Prop_NeverTracked_Bool = 1038, // Used for devices that will never have a valid pose by design
Prop_NumCameras_Int32 = 1039,
Prop_CameraFrameLayout_Int32 = 1040, // EVRTrackedCameraFrameLayout value
// Properties that are unique to TrackedDeviceClass_HMD
Prop_ReportsTimeSinceVSync_Bool = 2000,
@ -316,6 +336,20 @@ enum ETrackedDeviceProperty
Prop_DisplayDebugMode_Bool = 2044,
Prop_GraphicsAdapterLuid_Uint64 = 2045,
Prop_DriverProvidedChaperonePath_String = 2048,
Prop_ExpectedTrackingReferenceCount_Int32 = 2049, // expected number of sensors or basestations to reserve UI space for
Prop_ExpectedControllerCount_Int32 = 2050, // expected number of tracked controllers to reserve UI space for
Prop_NamedIconPathControllerLeftDeviceOff_String = 2051, // placeholder icon for "left" controller if not yet detected/loaded
Prop_NamedIconPathControllerRightDeviceOff_String = 2052, // placeholder icon for "right" controller if not yet detected/loaded
Prop_NamedIconPathTrackingReferenceDeviceOff_String = 2053, // placeholder icon for sensor/base if not yet detected/loaded
Prop_DoNotApplyPrediction_Bool = 2054,
Prop_CameraToHeadTransforms_Matrix34_Array = 2055,
Prop_DistortionMeshResolution_Int32 = 2056, // custom resolution of compositor calls to IVRSystem::ComputeDistortion
Prop_DriverIsDrawingControllers_Bool = 2057,
Prop_DriverRequestsApplicationPause_Bool = 2058,
Prop_DriverRequestsReducedRendering_Bool = 2059,
Prop_MinimumIpdStepMeters_Float = 2060,
Prop_AudioBridgeFirmwareVersion_Uint64 = 2061,
Prop_ImageBridgeFirmwareVersion_Uint64 = 2062,
// Properties that are unique to TrackedDeviceClass_Controller
Prop_AttachedDeviceId_String = 3000,
@ -350,6 +384,7 @@ enum ETrackedDeviceProperty
// Properties that are used by helpers, but are opaque to applications
Prop_DisplayHiddenArea_Binary_Start = 5100,
Prop_DisplayHiddenArea_Binary_End = 5150,
Prop_ParentContainer = 5151,
// Properties that are unique to drivers
Prop_UserConfigPath_String = 6000,
@ -360,9 +395,15 @@ enum ETrackedDeviceProperty
Prop_HasDriverDirectModeComponent_Bool = 6005,
Prop_HasVirtualDisplayComponent_Bool = 6006,
// Properties that are set internally based on other information provided by drivers
Prop_ControllerType_String = 7000,
Prop_LegacyInputProfile_String = 7001,
// Vendors are free to expose private debug data in this reserved region
Prop_VendorSpecific_Reserved_Start = 10000,
Prop_VendorSpecific_Reserved_End = 10999,
Prop_TrackedDeviceProperty_Max = 1000000,
};
/** No string property will ever be longer than this length */
@ -383,6 +424,7 @@ enum ETrackedPropertyError
TrackedProp_NotYetAvailable = 9, // The property value isn't known yet, but is expected soon. Call again later.
TrackedProp_PermissionDenied = 10,
TrackedProp_InvalidOperation = 11,
TrackedProp_CannotWriteToWildcards = 12,
};
/** Allows the application to control what part of the provided texture will be used in the
@ -393,6 +435,28 @@ struct VRTextureBounds_t
float uMax, vMax;
};
/** Allows specifying pose used to render provided scene texture (if different from value returned by WaitGetPoses). */
struct VRTextureWithPose_t : public Texture_t
{
HmdMatrix34_t mDeviceToAbsoluteTracking; // Actual pose used to render scene textures.
};
struct VRTextureDepthInfo_t
{
void* handle; // See ETextureType definition above
HmdMatrix44_t mProjection;
HmdVector2_t vRange; // 0..1
};
struct VRTextureWithDepth_t : public Texture_t
{
VRTextureDepthInfo_t depth;
};
struct VRTextureWithPoseAndDepth_t : public VRTextureWithPose_t
{
VRTextureDepthInfo_t depth;
};
/** Allows the application to control how scene textures are used by the compositor when calling Submit. */
enum EVRSubmitFlags
@ -410,6 +474,14 @@ enum EVRSubmitFlags
// Do not use
Submit_Reserved = 0x04,
// Set to indicate that pTexture is a pointer to a VRTextureWithPose_t.
// This flag can be combined with Submit_TextureWithDepth to pass a VRTextureWithPoseAndDepth_t.
Submit_TextureWithPose = 0x08,
// Set to indicate that pTexture is a pointer to a VRTextureWithDepth_t.
// This flag can be combined with Submit_TextureWithPose to pass a VRTextureWithPoseAndDepth_t.
Submit_TextureWithDepth = 0x10,
};
/** Data required for passing Vulkan textures to IVRCompositor::Submit.
@ -473,6 +545,15 @@ enum EVREventType
VREvent_ButtonTouch = 202, // data is controller
VREvent_ButtonUntouch = 203, // data is controller
VREvent_DualAnalog_Press = 250, // data is dualAnalog
VREvent_DualAnalog_Unpress = 251, // data is dualAnalog
VREvent_DualAnalog_Touch = 252, // data is dualAnalog
VREvent_DualAnalog_Untouch = 253, // data is dualAnalog
VREvent_DualAnalog_Move = 254, // data is dualAnalog
VREvent_DualAnalog_ModeSwitch1 = 255, // data is dualAnalog
VREvent_DualAnalog_ModeSwitch2 = 256, // data is dualAnalog
VREvent_DualAnalog_Cancel = 257, // data is dualAnalog
VREvent_MouseMove = 300, // data is mouse
VREvent_MouseButtonDown = 301, // data is mouse
VREvent_MouseButtonUp = 302, // data is mouse
@ -490,10 +571,15 @@ enum EVREventType
VREvent_SceneFocusChanged = 405, // data is process - New app got access to draw the scene
VREvent_InputFocusChanged = 406, // data is process
VREvent_SceneApplicationSecondaryRenderingStarted = 407, // data is process
VREvent_SceneApplicationUsingWrongGraphicsAdapter = 408, // data is process
VREvent_ActionBindingReloaded = 409, // data is process - The App that action binds reloaded for
VREvent_HideRenderModels = 410, // Sent to the scene application to request hiding render models temporarily
VREvent_ShowRenderModels = 411, // Sent to the scene application to request restoring render model visibility
VREvent_ConsoleOpened = 420,
VREvent_ConsoleClosed = 421,
VREvent_OverlayShown = 500,
VREvent_OverlayHidden = 501,
VREvent_DashboardActivated = 502,
@ -508,11 +594,12 @@ enum EVREventType
VREvent_OverlayGamepadFocusGained = 511, // Sent to an overlay when IVROverlay::SetFocusOverlay is called on it
VREvent_OverlayGamepadFocusLost = 512, // Send to an overlay when it previously had focus and IVROverlay::SetFocusOverlay is called on something else
VREvent_OverlaySharedTextureChanged = 513,
VREvent_DashboardGuideButtonDown = 514,
VREvent_DashboardGuideButtonUp = 515,
//VREvent_DashboardGuideButtonDown = 514, // These are no longer sent
//VREvent_DashboardGuideButtonUp = 515,
VREvent_ScreenshotTriggered = 516, // Screenshot button combo was pressed, Dashboard should request a screenshot
VREvent_ImageFailed = 517, // Sent to overlays when a SetOverlayRaw or SetOverlayfromFail fails to load
VREvent_DashboardOverlayCreated = 518,
VREvent_SwitchGamepadFocus = 519,
// Screenshot API
VREvent_RequestScreenshot = 520, // Sent by vrclient application to compositor to take a screenshot
@ -522,6 +609,8 @@ enum EVREventType
VREvent_ScreenshotProgressToDashboard = 524, // Sent by compositor to the dashboard that a completed screenshot was submitted
VREvent_PrimaryDashboardDeviceChanged = 525,
VREvent_RoomViewShown = 526, // Sent by compositor whenever room-view is enabled
VREvent_RoomViewHidden = 527, // Sent by compositor whenever room-view is disabled
VREvent_Notification_Shown = 600,
VREvent_Notification_Hidden = 601,
@ -542,16 +631,27 @@ enum EVREventType
VREvent_AudioSettingsHaveChanged = 820,
VREvent_BackgroundSettingHasChanged = 850,
VREvent_CameraSettingsHaveChanged = 851,
VREvent_ReprojectionSettingHasChanged = 852,
VREvent_ModelSkinSettingsHaveChanged = 853,
VREvent_EnvironmentSettingsHaveChanged = 854,
VREvent_PowerSettingsHaveChanged = 855,
VREvent_EnableHomeAppSettingsHaveChanged = 856,
VREvent_BackgroundSettingHasChanged = 850,
VREvent_CameraSettingsHaveChanged = 851,
VREvent_ReprojectionSettingHasChanged = 852,
VREvent_ModelSkinSettingsHaveChanged = 853,
VREvent_EnvironmentSettingsHaveChanged = 854,
VREvent_PowerSettingsHaveChanged = 855,
VREvent_EnableHomeAppSettingsHaveChanged = 856,
VREvent_SteamVRSectionSettingChanged = 857,
VREvent_LighthouseSectionSettingChanged = 858,
VREvent_NullSectionSettingChanged = 859,
VREvent_UserInterfaceSectionSettingChanged = 860,
VREvent_NotificationsSectionSettingChanged = 861,
VREvent_KeyboardSectionSettingChanged = 862,
VREvent_PerfSectionSettingChanged = 863,
VREvent_DashboardSectionSettingChanged = 864,
VREvent_WebInterfaceSectionSettingChanged = 865,
VREvent_StatusUpdate = 900,
VREvent_WebInterface_InstallDriverCompleted = 950,
VREvent_MCImageUpdated = 1000,
VREvent_FirmwareUpdateStarted = 1100,
@ -586,7 +686,10 @@ enum EVREventType
VREvent_PerformanceTest_FidelityLevel = 1602,
VREvent_MessageOverlay_Closed = 1650,
VREvent_MessageOverlayCloseRequested = 1651,
VREvent_Input_HapticVibration = 1700, // data is hapticVibration
// Vendors are free to expose private events in this reserved region
VREvent_VendorSpecific_Reserved_Start = 10000,
VREvent_VendorSpecific_Reserved_End = 19999,
@ -670,7 +773,8 @@ struct VREvent_Scroll_t
};
/** when in mouse input mode you can receive data from the touchpad, these events are only sent if the users finger
is on the touchpad (or just released from it)
is on the touchpad (or just released from it). These events are sent to overlays with the VROverlayFlags_SendVRTouchpadEvents
flag set.
**/
struct VREvent_TouchPadMove_t
{
@ -709,6 +813,7 @@ struct VREvent_Process_t
struct VREvent_Overlay_t
{
uint64_t overlayHandle;
uint64_t devicePath;
};
@ -741,6 +846,8 @@ struct VREvent_Reserved_t
{
uint64_t reserved0;
uint64_t reserved1;
uint64_t reserved2;
uint64_t reserved3;
};
struct VREvent_PerformanceTest_t
@ -787,6 +894,33 @@ struct VREvent_Property_t
ETrackedDeviceProperty prop;
};
enum EDualAnalogWhich
{
k_EDualAnalog_Left = 0,
k_EDualAnalog_Right = 1,
};
struct VREvent_DualAnalog_t
{
float x, y; // coordinates are -1..1 analog values
float transformedX, transformedY; // transformed by the center and radius numbers provided by the overlay
EDualAnalogWhich which;
};
struct VREvent_HapticVibration_t
{
uint64_t containerHandle; // property container handle of the device with the haptic component
uint64_t componentHandle; // Which haptic component needs to vibrate
float fDurationSeconds;
float fFrequency;
float fAmplitude;
};
struct VREvent_WebConsole_t
{
WebConsoleHandle_t webConsoleHandle;
};
/** NOTE!!! If you change this you MUST manually update openvr_interop.cs.py */
typedef union
{
@ -810,6 +944,9 @@ typedef union
VREvent_EditingCameraSurface_t cameraSurface;
VREvent_MessageOverlay_t messageOverlay;
VREvent_Property_t property;
VREvent_DualAnalog_t dualAnalog;
VREvent_HapticVibration_t hapticVibration;
VREvent_WebConsole_t webConsole;
} VREvent_Data_t;
@ -833,6 +970,21 @@ struct VREvent_t
#pragma pack( pop )
#endif
enum EVRInputError
{
VRInputError_None = 0,
VRInputError_NameNotFound = 1,
VRInputError_WrongType = 2,
VRInputError_InvalidHandle = 3,
VRInputError_InvalidParam = 4,
VRInputError_NoSteam = 5,
VRInputError_MaxCapacityReached = 6,
VRInputError_IPCError = 7,
VRInputError_NoActiveActionSet = 8,
VRInputError_InvalidDevice = 9,
};
/** The mesh to draw into the stencil (or depth) buffer to perform
* early stencil (or depth) kills of pixels that will never appear on the HMD.
* This mesh draws on all the pixels that will be hidden after distortion.
@ -970,6 +1122,9 @@ enum EVROverlayError
VROverlayError_NoNeighbor = 27,
VROverlayError_TooManyMaskPrimitives = 29,
VROverlayError_BadMaskPrimitive = 30,
VROverlayError_TextureAlreadyLocked = 31,
VROverlayError_TextureLockCapacityReached = 32,
VROverlayError_TextureNotLocked = 33,
};
/** enum values to pass in to VR_Init to identify whether the application will
@ -1019,65 +1174,70 @@ enum EVRInitError
VRInitError_None = 0,
VRInitError_Unknown = 1,
VRInitError_Init_InstallationNotFound = 100,
VRInitError_Init_InstallationCorrupt = 101,
VRInitError_Init_VRClientDLLNotFound = 102,
VRInitError_Init_FileNotFound = 103,
VRInitError_Init_FactoryNotFound = 104,
VRInitError_Init_InterfaceNotFound = 105,
VRInitError_Init_InvalidInterface = 106,
VRInitError_Init_UserConfigDirectoryInvalid = 107,
VRInitError_Init_HmdNotFound = 108,
VRInitError_Init_NotInitialized = 109,
VRInitError_Init_PathRegistryNotFound = 110,
VRInitError_Init_NoConfigPath = 111,
VRInitError_Init_NoLogPath = 112,
VRInitError_Init_PathRegistryNotWritable = 113,
VRInitError_Init_AppInfoInitFailed = 114,
VRInitError_Init_Retry = 115, // Used internally to cause retries to vrserver
VRInitError_Init_InitCanceledByUser = 116, // The calling application should silently exit. The user canceled app startup
VRInitError_Init_AnotherAppLaunching = 117,
VRInitError_Init_SettingsInitFailed = 118,
VRInitError_Init_ShuttingDown = 119,
VRInitError_Init_TooManyObjects = 120,
VRInitError_Init_NoServerForBackgroundApp = 121,
VRInitError_Init_NotSupportedWithCompositor = 122,
VRInitError_Init_NotAvailableToUtilityApps = 123,
VRInitError_Init_Internal = 124,
VRInitError_Init_HmdDriverIdIsNone = 125,
VRInitError_Init_HmdNotFoundPresenceFailed = 126,
VRInitError_Init_VRMonitorNotFound = 127,
VRInitError_Init_VRMonitorStartupFailed = 128,
VRInitError_Init_LowPowerWatchdogNotSupported = 129,
VRInitError_Init_InvalidApplicationType = 130,
VRInitError_Init_NotAvailableToWatchdogApps = 131,
VRInitError_Init_WatchdogDisabledInSettings = 132,
VRInitError_Init_VRDashboardNotFound = 133,
VRInitError_Init_VRDashboardStartupFailed = 134,
VRInitError_Init_VRHomeNotFound = 135,
VRInitError_Init_VRHomeStartupFailed = 136,
VRInitError_Init_InstallationNotFound = 100,
VRInitError_Init_InstallationCorrupt = 101,
VRInitError_Init_VRClientDLLNotFound = 102,
VRInitError_Init_FileNotFound = 103,
VRInitError_Init_FactoryNotFound = 104,
VRInitError_Init_InterfaceNotFound = 105,
VRInitError_Init_InvalidInterface = 106,
VRInitError_Init_UserConfigDirectoryInvalid = 107,
VRInitError_Init_HmdNotFound = 108,
VRInitError_Init_NotInitialized = 109,
VRInitError_Init_PathRegistryNotFound = 110,
VRInitError_Init_NoConfigPath = 111,
VRInitError_Init_NoLogPath = 112,
VRInitError_Init_PathRegistryNotWritable = 113,
VRInitError_Init_AppInfoInitFailed = 114,
VRInitError_Init_Retry = 115, // Used internally to cause retries to vrserver
VRInitError_Init_InitCanceledByUser = 116, // The calling application should silently exit. The user canceled app startup
VRInitError_Init_AnotherAppLaunching = 117,
VRInitError_Init_SettingsInitFailed = 118,
VRInitError_Init_ShuttingDown = 119,
VRInitError_Init_TooManyObjects = 120,
VRInitError_Init_NoServerForBackgroundApp = 121,
VRInitError_Init_NotSupportedWithCompositor = 122,
VRInitError_Init_NotAvailableToUtilityApps = 123,
VRInitError_Init_Internal = 124,
VRInitError_Init_HmdDriverIdIsNone = 125,
VRInitError_Init_HmdNotFoundPresenceFailed = 126,
VRInitError_Init_VRMonitorNotFound = 127,
VRInitError_Init_VRMonitorStartupFailed = 128,
VRInitError_Init_LowPowerWatchdogNotSupported = 129,
VRInitError_Init_InvalidApplicationType = 130,
VRInitError_Init_NotAvailableToWatchdogApps = 131,
VRInitError_Init_WatchdogDisabledInSettings = 132,
VRInitError_Init_VRDashboardNotFound = 133,
VRInitError_Init_VRDashboardStartupFailed = 134,
VRInitError_Init_VRHomeNotFound = 135,
VRInitError_Init_VRHomeStartupFailed = 136,
VRInitError_Init_RebootingBusy = 137,
VRInitError_Init_FirmwareUpdateBusy = 138,
VRInitError_Init_FirmwareRecoveryBusy = 139,
VRInitError_Init_USBServiceBusy = 140,
VRInitError_Init_VRWebHelperStartupFailed = 141,
VRInitError_Driver_Failed = 200,
VRInitError_Driver_Unknown = 201,
VRInitError_Driver_HmdUnknown = 202,
VRInitError_Driver_NotLoaded = 203,
VRInitError_Driver_RuntimeOutOfDate = 204,
VRInitError_Driver_HmdInUse = 205,
VRInitError_Driver_NotCalibrated = 206,
VRInitError_Driver_CalibrationInvalid = 207,
VRInitError_Driver_HmdDisplayNotFound = 208,
VRInitError_Driver_Failed = 200,
VRInitError_Driver_Unknown = 201,
VRInitError_Driver_HmdUnknown = 202,
VRInitError_Driver_NotLoaded = 203,
VRInitError_Driver_RuntimeOutOfDate = 204,
VRInitError_Driver_HmdInUse = 205,
VRInitError_Driver_NotCalibrated = 206,
VRInitError_Driver_CalibrationInvalid = 207,
VRInitError_Driver_HmdDisplayNotFound = 208,
VRInitError_Driver_TrackedDeviceInterfaceUnknown = 209,
// VRInitError_Driver_HmdDisplayNotFoundAfterFix = 210, // not needed: here for historic reasons
VRInitError_Driver_HmdDriverIdOutOfBounds = 211,
VRInitError_Driver_HmdDisplayMirrored = 212,
// VRInitError_Driver_HmdDisplayNotFoundAfterFix = 210, // not needed: here for historic reasons
VRInitError_Driver_HmdDriverIdOutOfBounds = 211,
VRInitError_Driver_HmdDisplayMirrored = 212,
VRInitError_IPC_ServerInitFailed = 300,
VRInitError_IPC_ConnectFailed = 301,
VRInitError_IPC_SharedStateInitFailed = 302,
VRInitError_IPC_CompositorInitFailed = 303,
VRInitError_IPC_MutexInitFailed = 304,
VRInitError_IPC_Failed = 305,
VRInitError_IPC_CompositorConnectFailed = 306,
VRInitError_IPC_ServerInitFailed = 300,
VRInitError_IPC_ConnectFailed = 301,
VRInitError_IPC_SharedStateInitFailed = 302,
VRInitError_IPC_CompositorInitFailed = 303,
VRInitError_IPC_MutexInitFailed = 304,
VRInitError_IPC_Failed = 305,
VRInitError_IPC_CompositorConnectFailed = 306,
VRInitError_IPC_CompositorInvalidConnectResponse = 307,
VRInitError_IPC_ConnectFailedAfterMultipleAttempts = 308,
@ -1088,7 +1248,8 @@ enum EVRInitError
VRInitError_Compositor_ScreenshotsInitFailed = 404,
VRInitError_Compositor_UnableToCreateDevice = 405,
VRInitError_VendorSpecific_UnableToConnectToOculusRuntime = 1000,
VRInitError_VendorSpecific_UnableToConnectToOculusRuntime = 1000,
VRInitError_VendorSpecific_WindowsNotInDevMode = 1001,
VRInitError_VendorSpecific_HmdFound_CantOpenDevice = 1101,
VRInitError_VendorSpecific_HmdFound_UnableToRequestConfigStart = 1102,
@ -1144,6 +1305,14 @@ enum EVRTrackedCameraError
VRTrackedCameraError_InvalidFrameBufferSize = 115,
};
enum EVRTrackedCameraFrameLayout
{
EVRTrackedCameraFrameLayout_Mono = 0x0001,
EVRTrackedCameraFrameLayout_Stereo = 0x0002,
EVRTrackedCameraFrameLayout_VerticalLayout = 0x0010, // Stereo frames are Top/Bottom (left/right)
EVRTrackedCameraFrameLayout_HorizontalLayout = 0x0020, // Stereo frames are Left/Right
};
enum EVRTrackedCameraFrameType
{
VRTrackedCameraFrameType_Distorted = 0, // This is the camera video frame size in pixels, still distorted.
@ -1173,17 +1342,30 @@ typedef uint32_t ScreenshotHandle_t;
static const uint32_t k_unScreenshotHandleInvalid = 0;
/** Frame timing data provided by direct mode drivers. */
struct DriverDirectMode_FrameTiming
{
uint32_t m_nSize; // Set to sizeof( DriverDirectMode_FrameTiming )
uint32_t m_nNumFramePresents; // number of times frame was presented
uint32_t m_nNumMisPresented; // number of times frame was presented on a vsync other than it was originally predicted to
uint32_t m_nNumDroppedFrames; // number of additional times previous frame was scanned out (i.e. compositor missed vsync)
uint32_t m_nReprojectionFlags;
};
enum EVSync
{
VSync_None,
VSync_WaitRender, // block following render work until vsync
VSync_NoWaitRender, // do not block following render work (allow to get started early)
};
#pragma pack( pop )
// Mozilla changed VR_INTERFACE. We don't want to extern the API functions.
// See README.mozilla
#define VR_INTERFACE
#define VR_INTERFACE
/*
// figure out how to import from the VR API dll
#if defined(_WIN32)
#ifdef VR_API_EXPORT
#define VR_INTERFACE extern "C" __declspec( dllexport )
#else
@ -1203,6 +1385,7 @@ static const uint32_t k_unScreenshotHandleInvalid = 0;
#endif
*/
#if defined( _WIN32 )
#define VR_CALLTYPE __cdecl
#else
@ -1289,17 +1472,25 @@ public:
* Returns platform- and texture-type specific adapter identification so that applications and the
* compositor are creating textures and swap chains on the same GPU. If an error occurs the device
* will be set to 0.
* pInstance is an optional parameter that is required only when textureType is TextureType_Vulkan.
* [D3D10/11/12 Only (D3D9 Not Supported)]
* Returns the adapter LUID that identifies the GPU attached to the HMD. The user should
* enumerate all adapters using IDXGIFactory::EnumAdapters and IDXGIAdapter::GetDesc to find
* the adapter with the matching LUID, or use IDXGIFactory4::EnumAdapterByLuid.
* The discovered IDXGIAdapter should be used to create the device and swap chain.
* [Vulkan Only]
* Returns the vk::PhysicalDevice that should be used by the application.
* Returns the VkPhysicalDevice that should be used by the application.
* pInstance must be the instance the application will use to query for the VkPhysicalDevice. The application
* must create the VkInstance with extensions returned by IVRCompositor::GetVulkanInstanceExtensionsRequired enabled.
* [macOS Only]
* Returns an id<MTLDevice> that should be used by the application.
* For TextureType_IOSurface returns the id<MTLDevice> that should be used by the application.
* On 10.13+ for TextureType_OpenGL returns the 'registryId' of the renderer which should be used
* by the application. See Apple Technical Q&A QA1168 for information on enumerating GL Renderers, and the
* new kCGLRPRegistryIDLow and kCGLRPRegistryIDHigh CGLRendererProperty values in the 10.13 SDK.
* Pre 10.13 for TextureType_OpenGL returns 0, as there is no dependable way to correlate the HMDs MTLDevice
* with a GL Renderer.
*/
virtual void GetOutputDevice( uint64_t *pnDevice, ETextureType textureType ) = 0;
virtual void GetOutputDevice( uint64_t *pnDevice, ETextureType textureType, VkInstance_T *pInstance = nullptr ) = 0;
// ------------------------------------
// Display Mode methods
@ -1406,6 +1597,11 @@ public:
/** Returns a matrix property. If the device index is not valid or the property is not a matrix type, this function will return identity. */
virtual HmdMatrix34_t GetMatrix34TrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ) = 0;
/** Returns an array of one type of property. If the device index is not valid or the property is not a single value or an array of the specified type,
* this function will return 0. Otherwise it returns the number of bytes necessary to hold the array of properties. If unBufferSize is
* greater than the returned size and pBuffer is non-NULL, pBuffer is filled with the contents of array of properties. */
virtual uint32_t GetArrayTrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, PropertyTypeTag_t propType, void *pBuffer, uint32_t unBufferSize, ETrackedPropertyError *pError = 0L ) = 0;
/** Returns a string property. If the device index is not valid or the property is not a string type this function will
* return 0. Otherwise it returns the length of the number of bytes necessary to hold this string including the trailing
@ -1470,17 +1666,21 @@ public:
/** returns the name of an EVRControllerAxisType enum value */
virtual const char *GetControllerAxisTypeNameFromEnum( EVRControllerAxisType eAxisType ) = 0;
/** Tells OpenVR that this process wants exclusive access to controller button states and button events. Other apps will be notified that
* they have lost input focus with a VREvent_InputFocusCaptured event. Returns false if input focus could not be captured for
* some reason. */
virtual bool CaptureInputFocus() = 0;
/** Returns true if this application is receiving input from the system. This would return false if
* system-related functionality is consuming the input stream. */
virtual bool IsInputAvailable() = 0;
/** Tells OpenVR that this process no longer wants exclusive access to button states and button events. Other apps will be notified
* that input focus has been released with a VREvent_InputFocusReleased event. */
virtual void ReleaseInputFocus() = 0;
/** Returns true SteamVR is drawing controllers on top of the application. Applications should consider
* not drawing anything attached to the user's hands in this case. */
virtual bool IsSteamVRDrawingControllers() = 0;
/** Returns true if input focus is captured by another process. */
virtual bool IsInputFocusCapturedByAnotherProcess() = 0;
/** Returns true if the user has put SteamVR into a mode that is distracting them from the application.
* For applications where this is appropriate, the application should pause ongoing activity. */
virtual bool ShouldApplicationPause() = 0;
/** Returns true if SteamVR is doing significant rendering work and the game should do what it can to reduce
* its own workload. One common way to do this is to reduce the size of the render target provided for each eye. */
virtual bool ShouldApplicationReduceRenderingWork() = 0;
// ------------------------------------
// Debug Methods
@ -1489,7 +1689,7 @@ public:
/** Sends a request to the driver for the specified device and returns the response. The maximum response size is 32k,
* but this method can be called with a smaller buffer. If the response exceeds the size of the buffer, it is truncated.
* The size of the response including its terminating null is returned. */
virtual uint32_t DriverDebugRequest( vr::TrackedDeviceIndex_t unDeviceIndex, const char *pchRequest, char *pchResponseBuffer, uint32_t unResponseBufferSize ) = 0;
virtual uint32_t DriverDebugRequest( vr::TrackedDeviceIndex_t unDeviceIndex, const char *pchRequest, VR_OUT_STRING() char *pchResponseBuffer, uint32_t unResponseBufferSize ) = 0;
// ------------------------------------
// Firmware methods
@ -1517,7 +1717,7 @@ public:
};
static const char * const IVRSystem_Version = "IVRSystem_016";
static const char * const IVRSystem_Version = "IVRSystem_019";
}
@ -1572,6 +1772,7 @@ namespace vr
VRApplicationProperty_NewsURL_String = 51,
VRApplicationProperty_ImagePath_String = 52,
VRApplicationProperty_Source_String = 53,
VRApplicationProperty_ActionManifestURL_String = 54,
VRApplicationProperty_IsDashboardOverlay_Bool = 60,
VRApplicationProperty_IsTemplate_Bool = 61,
@ -1629,7 +1830,7 @@ namespace vr
/** Returns the key of the application for the specified Process Id. The buffer should be at least
* k_unMaxApplicationKeyLength in order to fit the key. */
virtual EVRApplicationError GetApplicationKeyByProcessId( uint32_t unProcessId, char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0;
virtual EVRApplicationError GetApplicationKeyByProcessId( uint32_t unProcessId, VR_OUT_STRING() char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0;
/** Launches the application. The existing scene application will exit and then the new application will start.
* This call is not valid for dashboard overlay applications. */
@ -1683,21 +1884,21 @@ namespace vr
virtual EVRApplicationError SetDefaultApplicationForMimeType( const char *pchAppKey, const char *pchMimeType ) = 0;
/** return the app key that will open this mime type */
virtual bool GetDefaultApplicationForMimeType( const char *pchMimeType, char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0;
virtual bool GetDefaultApplicationForMimeType( const char *pchMimeType, VR_OUT_STRING() char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0;
/** Get the list of supported mime types for this application, comma-delimited */
virtual bool GetApplicationSupportedMimeTypes( const char *pchAppKey, char *pchMimeTypesBuffer, uint32_t unMimeTypesBuffer ) = 0;
virtual bool GetApplicationSupportedMimeTypes( const char *pchAppKey, VR_OUT_STRING() char *pchMimeTypesBuffer, uint32_t unMimeTypesBuffer ) = 0;
/** Get the list of app-keys that support this mime type, comma-delimited, the return value is number of bytes you need to return the full string */
virtual uint32_t GetApplicationsThatSupportMimeType( const char *pchMimeType, char *pchAppKeysThatSupportBuffer, uint32_t unAppKeysThatSupportBuffer ) = 0;
virtual uint32_t GetApplicationsThatSupportMimeType( const char *pchMimeType, VR_OUT_STRING() char *pchAppKeysThatSupportBuffer, uint32_t unAppKeysThatSupportBuffer ) = 0;
/** Get the args list from an app launch that had the process already running, you call this when you get a VREvent_ApplicationMimeTypeLoad */
virtual uint32_t GetApplicationLaunchArguments( uint32_t unHandle, char *pchArgs, uint32_t unArgs ) = 0;
virtual uint32_t GetApplicationLaunchArguments( uint32_t unHandle, VR_OUT_STRING() char *pchArgs, uint32_t unArgs ) = 0;
// --------------- Transition methods --------------- //
/** Returns the app key for the application that is starting up */
virtual EVRApplicationError GetStartingApplication( char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0;
virtual EVRApplicationError GetStartingApplication( VR_OUT_STRING() char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0;
/** Returns the application transition state */
virtual EVRApplicationTransitionState GetTransitionState() = 0;
@ -1824,15 +2025,25 @@ namespace vr
static const char * const k_pch_SteamVR_RetailDemo_Bool = "retailDemo";
static const char * const k_pch_SteamVR_IpdOffset_Float = "ipdOffset";
static const char * const k_pch_SteamVR_AllowSupersampleFiltering_Bool = "allowSupersampleFiltering";
static const char * const k_pch_SteamVR_SupersampleManualOverride_Bool = "supersampleManualOverride";
static const char * const k_pch_SteamVR_EnableLinuxVulkanAsync_Bool = "enableLinuxVulkanAsync";
static const char * const k_pch_SteamVR_AllowDisplayLockedMode_Bool = "allowDisplayLockedMode";
static const char * const k_pch_SteamVR_HaveStartedTutorialForNativeChaperoneDriver_Bool = "haveStartedTutorialForNativeChaperoneDriver";
static const char * const k_pch_SteamVR_ForceWindows32bitVRMonitor = "forceWindows32BitVRMonitor";
static const char * const k_pch_SteamVR_DebugInput = "debugInput";
static const char * const k_pch_SteamVR_LegacyInputRebinding = "legacyInputRebinding";
//-----------------------------------------------------------------------------
// lighthouse keys
static const char * const k_pch_Lighthouse_Section = "driver_lighthouse";
static const char * const k_pch_Lighthouse_DisableIMU_Bool = "disableimu";
static const char * const k_pch_Lighthouse_DisableIMUExceptHMD_Bool = "disableimuexcepthmd";
static const char * const k_pch_Lighthouse_UseDisambiguation_String = "usedisambiguation";
static const char * const k_pch_Lighthouse_DisambiguationDebug_Int32 = "disambiguationdebug";
static const char * const k_pch_Lighthouse_PrimaryBasestation_Int32 = "primarybasestation";
static const char * const k_pch_Lighthouse_DBHistory_Bool = "dbhistory";
static const char * const k_pch_Lighthouse_EnableBluetooth_Bool = "enableBluetooth";
static const char * const k_pch_Lighthouse_PowerManagedBaseStations_String = "PowerManagedBaseStations";
//-----------------------------------------------------------------------------
// null keys
@ -1908,6 +2119,7 @@ namespace vr
static const char * const k_pch_Camera_BoundsColorGammaB_Int32 = "cameraBoundsColorGammaB";
static const char * const k_pch_Camera_BoundsColorGammaA_Int32 = "cameraBoundsColorGammaA";
static const char * const k_pch_Camera_BoundsStrength_Int32 = "cameraBoundsStrength";
static const char * const k_pch_Camera_RoomViewMode_Int32 = "cameraRoomViewMode";
//-----------------------------------------------------------------------------
// audio keys
@ -1934,6 +2146,8 @@ namespace vr
static const char * const k_pch_Dashboard_Section = "dashboard";
static const char * const k_pch_Dashboard_EnableDashboard_Bool = "enableDashboard";
static const char * const k_pch_Dashboard_ArcadeMode_Bool = "arcadeMode";
static const char * const k_pch_Dashboard_EnableWebUI = "webUI";
static const char * const k_pch_Dashboard_EnableWebUIDevTools = "webUIDevTools";
//-----------------------------------------------------------------------------
// model skin keys
@ -1943,6 +2157,11 @@ namespace vr
// driver keys - These could be checked in any driver_<name> section
static const char * const k_pch_Driver_Enable_Bool = "enable";
//-----------------------------------------------------------------------------
// web interface keys
static const char* const k_pch_WebInterface_Section = "WebInterface";
static const char* const k_pch_WebInterface_WebPort_String = "WebPort";
} // namespace vr
// ivrchaperone.h
@ -2129,6 +2348,14 @@ enum EVRCompositorError
VRCompositorError_InvalidBounds = 109,
};
/** Timing mode passed to SetExplicitTimingMode(); see that function for documentation */
enum EVRCompositorTimingMode
{
VRCompositorTimingMode_Implicit = 0,
VRCompositorTimingMode_Explicit_RuntimePerformsPostPresentHandoff = 1,
VRCompositorTimingMode_Explicit_ApplicationPerformsPostPresentHandoff = 2,
};
const uint32_t VRCompositor_ReprojectionReason_Cpu = 0x01;
const uint32_t VRCompositor_ReprojectionReason_Gpu = 0x02;
const uint32_t VRCompositor_ReprojectionAsync = 0x04; // This flag indicates the async reprojection mode is active,
@ -2375,9 +2602,36 @@ public:
* null. The string will be a space separated list of required device extensions to enable in VkCreateDevice */
virtual uint32_t GetVulkanDeviceExtensionsRequired( VkPhysicalDevice_T *pPhysicalDevice, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize ) = 0;
/** [ Vulkan/D3D12 Only ]
* There are two purposes for SetExplicitTimingMode:
* 1. To get a more accurate GPU timestamp for when the frame begins in Vulkan/D3D12 applications.
* 2. (Optional) To avoid having WaitGetPoses access the Vulkan queue so that the queue can be accessed from
* another thread while WaitGetPoses is executing.
*
* More accurate GPU timestamp for the start of the frame is achieved by the application calling
* SubmitExplicitTimingData immediately before its first submission to the Vulkan/D3D12 queue.
* This is more accurate because normally this GPU timestamp is recorded during WaitGetPoses. In D3D11,
* WaitGetPoses queues a GPU timestamp write, but it does not actually get submitted to the GPU until the
* application flushes. By using SubmitExplicitTimingData, the timestamp is recorded at the same place for
* Vulkan/D3D12 as it is for D3D11, resulting in a more accurate GPU time measurement for the frame.
*
* Avoiding WaitGetPoses accessing the Vulkan queue can be achieved using SetExplicitTimingMode as well. If this is desired,
* the application should set the timing mode to Explicit_ApplicationPerformsPostPresentHandoff and *MUST* call PostPresentHandoff
* itself. If these conditions are met, then WaitGetPoses is guaranteed not to access the queue. Note that PostPresentHandoff
* and SubmitExplicitTimingData will access the queue, so only WaitGetPoses becomes safe for accessing the queue from another
* thread. */
virtual void SetExplicitTimingMode( EVRCompositorTimingMode eTimingMode ) = 0;
/** [ Vulkan/D3D12 Only ]
* Submit explicit timing data. When SetExplicitTimingMode is true, this must be called immediately before
* the application's first vkQueueSubmit (Vulkan) or ID3D12CommandQueue::ExecuteCommandLists (D3D12) of each frame.
* This function will insert a GPU timestamp write just before the application starts its rendering. This function
* will perform a vkQueueSubmit on Vulkan so must not be done simultaneously with VkQueue operations on another thread.
* Returns VRCompositorError_RequestFailed if SetExplicitTimingMode is not enabled. */
virtual EVRCompositorError SubmitExplicitTimingData() = 0;
};
static const char * const IVRCompositor_Version = "IVRCompositor_020";
static const char * const IVRCompositor_Version = "IVRCompositor_022";
} // namespace vr
@ -2493,6 +2747,7 @@ namespace vr
{
VROverlayInputMethod_None = 0, // No input events will be generated automatically for this overlay
VROverlayInputMethod_Mouse = 1, // Tracked controllers will get mouse events automatically
VROverlayInputMethod_DualAnalog = 2, // Analog inputs from tracked controllers are turned into DualAnalog events
};
/** Allows the caller to figure out which overlay transform getter to call. */
@ -2760,7 +3015,7 @@ namespace vr
virtual EVROverlayError GetOverlayTextureBounds( VROverlayHandle_t ulOverlayHandle, VRTextureBounds_t *pOverlayTextureBounds ) = 0;
/** Gets render model to draw behind this overlay */
virtual uint32_t GetOverlayRenderModel( vr::VROverlayHandle_t ulOverlayHandle, char *pchValue, uint32_t unBufferSize, HmdColor_t *pColor, vr::EVROverlayError *pError ) = 0;
virtual uint32_t GetOverlayRenderModel( vr::VROverlayHandle_t ulOverlayHandle, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize, HmdColor_t *pColor, vr::EVROverlayError *pError ) = 0;
/** Sets render model to draw behind this overlay and the vertex color to use, pass null for pColor to match the overlays vertex color.
The model is scaled by the same amount as the overlay, with a default of 1m. */
@ -2786,7 +3041,7 @@ namespace vr
virtual EVROverlayError SetOverlayTransformTrackedDeviceComponent( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t unDeviceIndex, const char *pchComponentName ) = 0;
/** Gets the transform information when the overlay is rendering on a component. */
virtual EVROverlayError GetOverlayTransformTrackedDeviceComponent( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t *punDeviceIndex, char *pchComponentName, uint32_t unComponentNameSize ) = 0;
virtual EVROverlayError GetOverlayTransformTrackedDeviceComponent( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t *punDeviceIndex, VR_OUT_STRING() char *pchComponentName, uint32_t unComponentNameSize ) = 0;
/** Gets the transform if it is relative to another overlay. Returns an error if the transform is some other type. */
virtual vr::EVROverlayError GetOverlayTransformOverlayRelative( VROverlayHandle_t ulOverlayHandle, VROverlayHandle_t *ulOverlayHandleParent, HmdMatrix34_t *pmatParentOverlayToOverlayTransform ) = 0;
@ -2832,13 +3087,6 @@ namespace vr
* specified settings. Returns false if there is no intersection. */
virtual bool ComputeOverlayIntersection( VROverlayHandle_t ulOverlayHandle, const VROverlayIntersectionParams_t *pParams, VROverlayIntersectionResults_t *pResults ) = 0;
/** Processes mouse input from the specified controller as though it were a mouse pointed at a compositor overlay with the
* specified settings. The controller is treated like a laser pointer on the -z axis. The point where the laser pointer would
* intersect with the overlay is the mouse position, the trigger is left mouse, and the track pad is right mouse.
*
* Return true if the controller is pointed at the overlay and an event was generated. */
virtual bool HandleControllerOverlayInteractionAsMouse( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t unControllerDeviceIndex ) = 0;
/** Returns true if the specified overlay is the hover target. An overlay is the hover target when it is the last overlay "moused over"
* by the virtual mouse pointer */
virtual bool IsHoverTargetOverlay( VROverlayHandle_t ulOverlayHandle ) = 0;
@ -2858,6 +3106,12 @@ namespace vr
* neighbor in that direction */
virtual EVROverlayError MoveGamepadFocusToNeighbor( EOverlayDirection eDirection, VROverlayHandle_t ulFrom ) = 0;
/** Sets the analog input to Dual Analog coordinate scale for the specified overlay. */
virtual EVROverlayError SetOverlayDualAnalogTransform( VROverlayHandle_t ulOverlay, EDualAnalogWhich eWhich, const HmdVector2_t & vCenter, float fRadius ) = 0;
/** Gets the analog input to Dual Analog coordinate scale for the specified overlay. */
virtual EVROverlayError GetOverlayDualAnalogTransform( VROverlayHandle_t ulOverlay, EDualAnalogWhich eWhich, HmdVector2_t *pvCenter, float *pfRadius ) = 0;
// ---------------------------------------------
// Overlay texture methods
// ---------------------------------------------
@ -2962,9 +3216,12 @@ namespace vr
/** Show the message overlay. This will block and return you a result. **/
virtual VRMessageOverlayResponse ShowMessageOverlay( const char* pchText, const char* pchCaption, const char* pchButton0Text, const char* pchButton1Text = nullptr, const char* pchButton2Text = nullptr, const char* pchButton3Text = nullptr ) = 0;
/** If the calling process owns the overlay and it's open, this will close it. **/
virtual void CloseMessageOverlay() = 0;
};
static const char * const IVROverlay_Version = "IVROverlay_016";
static const char * const IVROverlay_Version = "IVROverlay_018";
} // namespace vr
@ -3384,7 +3641,7 @@ public:
/** Provides the full path to the specified resource. Resource names can include named directories for
* drivers and other things, and this resolves all of those and returns the actual physical path.
* pchResourceTypeDirectory is the subdirectory of resources to look in. */
virtual uint32_t GetResourceFullPath( const char *pchResourceName, const char *pchResourceTypeDirectory, char *pchPathBuffer, uint32_t unBufferLen ) = 0;
virtual uint32_t GetResourceFullPath( const char *pchResourceName, const char *pchResourceTypeDirectory, VR_OUT_STRING() char *pchPathBuffer, uint32_t unBufferLen ) = 0;
};
static const char * const IVRResources_Version = "IVRResources_001";
@ -3402,6 +3659,8 @@ public:
/** Returns the length of the number of bytes necessary to hold this string including the trailing null. */
virtual uint32_t GetDriverName( vr::DriverId_t nDriver, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize ) = 0;
virtual DriverHandle_t GetDriverHandle( const char *pchDriverName ) = 0;
};
static const char * const IVRDriverManager_Version = "IVRDriverManager_001";
@ -3422,8 +3681,10 @@ namespace vr
*
* This path is to the "root" of the VR API install. That's the directory with
* the "drivers" directory and a platform (i.e. "win32") directory in it, not the directory with the DLL itself.
*
* pStartupInfo is reserved for future use.
*/
inline IVRSystem *VR_Init( EVRInitError *peError, EVRApplicationType eApplicationType );
inline IVRSystem *VR_Init( EVRInitError *peError, EVRApplicationType eApplicationType, const char *pStartupInfo = nullptr );
/** unloads vrclient.dll. Any interface pointers from the interface are
* invalid after this point */
@ -3693,17 +3954,17 @@ namespace vr
m_pVRScreenshots = nullptr;
m_pVRDriverManager = nullptr;
}
VR_INTERFACE uint32_t VR_CALLTYPE VR_InitInternal( EVRInitError *peError, EVRApplicationType eApplicationType );
VR_INTERFACE uint32_t VR_CALLTYPE VR_InitInternal2( EVRInitError *peError, EVRApplicationType eApplicationType, const char *pStartupInfo );
VR_INTERFACE void VR_CALLTYPE VR_ShutdownInternal();
/** Finds the active installation of vrclient.dll and initializes it */
inline IVRSystem *VR_Init( EVRInitError *peError, EVRApplicationType eApplicationType )
inline IVRSystem *VR_Init( EVRInitError *peError, EVRApplicationType eApplicationType, const char *pStartupInfo )
{
IVRSystem *pVRSystem = nullptr;
EVRInitError eError;
VRToken() = VR_InitInternal( &eError, eApplicationType );
VRToken() = VR_InitInternal2( &eError, eApplicationType, pStartupInfo );
COpenVRContext &ctx = OpenVRInternal_ModuleContext();
ctx.Clear();

View File

@ -13,76 +13,80 @@ const char *GetEnglishStringForHmdError( vr::EVRInitError eError )
{
switch( eError )
{
case VRInitError_None: return "No Error (0)";
case VRInitError_None: return "No Error (0)";
case VRInitError_Init_InstallationNotFound: return "Installation Not Found (100)";
case VRInitError_Init_InstallationCorrupt: return "Installation Corrupt (101)";
case VRInitError_Init_VRClientDLLNotFound: return "vrclient Shared Lib Not Found (102)";
case VRInitError_Init_FileNotFound: return "File Not Found (103)";
case VRInitError_Init_FactoryNotFound: return "Factory Function Not Found (104)";
case VRInitError_Init_InterfaceNotFound: return "Interface Not Found (105)";
case VRInitError_Init_InvalidInterface: return "Invalid Interface (106)";
case VRInitError_Init_UserConfigDirectoryInvalid: return "User Config Directory Invalid (107)";
case VRInitError_Init_HmdNotFound: return "Hmd Not Found (108)";
case VRInitError_Init_NotInitialized: return "Not Initialized (109)";
case VRInitError_Init_PathRegistryNotFound: return "Installation path could not be located (110)";
case VRInitError_Init_NoConfigPath: return "Config path could not be located (111)";
case VRInitError_Init_NoLogPath: return "Log path could not be located (112)";
case VRInitError_Init_PathRegistryNotWritable: return "Unable to write path registry (113)";
case VRInitError_Init_AppInfoInitFailed: return "App info manager init failed (114)";
case VRInitError_Init_Retry: return "Internal Retry (115)";
case VRInitError_Init_InitCanceledByUser: return "User Canceled Init (116)";
case VRInitError_Init_AnotherAppLaunching: return "Another app was already launching (117)";
case VRInitError_Init_SettingsInitFailed: return "Settings manager init failed (118)";
case VRInitError_Init_ShuttingDown: return "VR system shutting down (119)";
case VRInitError_Init_TooManyObjects: return "Too many tracked objects (120)";
case VRInitError_Init_NoServerForBackgroundApp: return "Not starting vrserver for background app (121)";
case VRInitError_Init_NotSupportedWithCompositor: return "The requested interface is incompatible with the compositor and the compositor is running (122)";
case VRInitError_Init_NotAvailableToUtilityApps: return "This interface is not available to utility applications (123)";
case VRInitError_Init_Internal: return "vrserver internal error (124)";
case VRInitError_Init_HmdDriverIdIsNone: return "Hmd DriverId is invalid (125)";
case VRInitError_Init_InstallationNotFound: return "Installation Not Found (100)";
case VRInitError_Init_InstallationCorrupt: return "Installation Corrupt (101)";
case VRInitError_Init_VRClientDLLNotFound: return "vrclient Shared Lib Not Found (102)";
case VRInitError_Init_FileNotFound: return "File Not Found (103)";
case VRInitError_Init_FactoryNotFound: return "Factory Function Not Found (104)";
case VRInitError_Init_InterfaceNotFound: return "Interface Not Found (105)";
case VRInitError_Init_InvalidInterface: return "Invalid Interface (106)";
case VRInitError_Init_UserConfigDirectoryInvalid: return "User Config Directory Invalid (107)";
case VRInitError_Init_HmdNotFound: return "Hmd Not Found (108)";
case VRInitError_Init_NotInitialized: return "Not Initialized (109)";
case VRInitError_Init_PathRegistryNotFound: return "Installation path could not be located (110)";
case VRInitError_Init_NoConfigPath: return "Config path could not be located (111)";
case VRInitError_Init_NoLogPath: return "Log path could not be located (112)";
case VRInitError_Init_PathRegistryNotWritable: return "Unable to write path registry (113)";
case VRInitError_Init_AppInfoInitFailed: return "App info manager init failed (114)";
case VRInitError_Init_Retry: return "Internal Retry (115)";
case VRInitError_Init_InitCanceledByUser: return "User Canceled Init (116)";
case VRInitError_Init_AnotherAppLaunching: return "Another app was already launching (117)";
case VRInitError_Init_SettingsInitFailed: return "Settings manager init failed (118)";
case VRInitError_Init_ShuttingDown: return "VR system shutting down (119)";
case VRInitError_Init_TooManyObjects: return "Too many tracked objects (120)";
case VRInitError_Init_NoServerForBackgroundApp: return "Not starting vrserver for background app (121)";
case VRInitError_Init_NotSupportedWithCompositor: return "The requested interface is incompatible with the compositor and the compositor is running (122)";
case VRInitError_Init_NotAvailableToUtilityApps: return "This interface is not available to utility applications (123)";
case VRInitError_Init_Internal: return "vrserver internal error (124)";
case VRInitError_Init_HmdDriverIdIsNone: return "Hmd DriverId is invalid (125)";
case VRInitError_Init_HmdNotFoundPresenceFailed: return "Hmd Not Found Presence Failed (126)";
case VRInitError_Init_VRMonitorNotFound: return "VR Monitor Not Found (127)";
case VRInitError_Init_VRMonitorStartupFailed: return "VR Monitor startup failed (128)";
case VRInitError_Init_VRMonitorNotFound: return "VR Monitor Not Found (127)";
case VRInitError_Init_VRMonitorStartupFailed: return "VR Monitor startup failed (128)";
case VRInitError_Init_LowPowerWatchdogNotSupported: return "Low Power Watchdog Not Supported (129)";
case VRInitError_Init_InvalidApplicationType: return "Invalid Application Type (130)";
case VRInitError_Init_NotAvailableToWatchdogApps: return "Not available to watchdog apps (131)";
case VRInitError_Init_WatchdogDisabledInSettings: return "Watchdog disabled in settings (132)";
case VRInitError_Init_VRDashboardNotFound: return "VR Dashboard Not Found (133)";
case VRInitError_Init_VRDashboardStartupFailed: return "VR Dashboard startup failed (134)";
case VRInitError_Init_VRHomeNotFound: return "VR Home Not Found (135)";
case VRInitError_Init_VRHomeStartupFailed: return "VR home startup failed (136)";
case VRInitError_Init_InvalidApplicationType: return "Invalid Application Type (130)";
case VRInitError_Init_NotAvailableToWatchdogApps: return "Not available to watchdog apps (131)";
case VRInitError_Init_WatchdogDisabledInSettings: return "Watchdog disabled in settings (132)";
case VRInitError_Init_VRDashboardNotFound: return "VR Dashboard Not Found (133)";
case VRInitError_Init_VRDashboardStartupFailed: return "VR Dashboard startup failed (134)";
case VRInitError_Init_VRHomeNotFound: return "VR Home Not Found (135)";
case VRInitError_Init_VRHomeStartupFailed: return "VR home startup failed (136)";
case VRInitError_Init_RebootingBusy: return "Rebooting In Progress (137)";
case VRInitError_Init_FirmwareUpdateBusy: return "Firmware Update In Progress (138)";
case VRInitError_Init_FirmwareRecoveryBusy: return "Firmware Recovery In Progress (139)";
case VRInitError_Init_USBServiceBusy: return "USB Service Busy (140)";
case VRInitError_Driver_Failed: return "Driver Failed (200)";
case VRInitError_Driver_Unknown: return "Driver Not Known (201)";
case VRInitError_Driver_HmdUnknown: return "HMD Not Known (202)";
case VRInitError_Driver_NotLoaded: return "Driver Not Loaded (203)";
case VRInitError_Driver_RuntimeOutOfDate: return "Driver runtime is out of date (204)";
case VRInitError_Driver_HmdInUse: return "HMD already in use by another application (205)";
case VRInitError_Driver_NotCalibrated: return "Device is not calibrated (206)";
case VRInitError_Driver_CalibrationInvalid: return "Device Calibration is invalid (207)";
case VRInitError_Driver_HmdDisplayNotFound: return "HMD detected over USB, but Monitor not found (208)";
case VRInitError_Driver_TrackedDeviceInterfaceUnknown: return "Driver Tracked Device Interface unknown (209)";
// case VRInitError_Driver_HmdDisplayNotFoundAfterFix: return "HMD detected over USB, but Monitor not found after attempt to fix (210)"; // taken out upon Ben's request: He thinks that there is no need to separate that error from 208
case VRInitError_Driver_HmdDriverIdOutOfBounds: return "Hmd DriverId is our of bounds (211)";
case VRInitError_Driver_HmdDisplayMirrored: return "HMD detected over USB, but Monitor may be mirrored instead of extended (212)";
case VRInitError_Driver_Failed: return "Driver Failed (200)";
case VRInitError_Driver_Unknown: return "Driver Not Known (201)";
case VRInitError_Driver_HmdUnknown: return "HMD Not Known (202)";
case VRInitError_Driver_NotLoaded: return "Driver Not Loaded (203)";
case VRInitError_Driver_RuntimeOutOfDate: return "Driver runtime is out of date (204)";
case VRInitError_Driver_HmdInUse: return "HMD already in use by another application (205)";
case VRInitError_Driver_NotCalibrated: return "Device is not calibrated (206)";
case VRInitError_Driver_CalibrationInvalid: return "Device Calibration is invalid (207)";
case VRInitError_Driver_HmdDisplayNotFound: return "HMD detected over USB, but Monitor not found (208)";
case VRInitError_Driver_TrackedDeviceInterfaceUnknown: return "Driver Tracked Device Interface unknown (209)";
// case VRInitError_Driver_HmdDisplayNotFoundAfterFix: return "HMD detected over USB, but Monitor not found after attempt to fix (210)"; // taken out upon Ben's request: He thinks that there is no need to separate that error from 208
case VRInitError_Driver_HmdDriverIdOutOfBounds: return "Hmd DriverId is our of bounds (211)";
case VRInitError_Driver_HmdDisplayMirrored: return "HMD detected over USB, but Monitor may be mirrored instead of extended (212)";
case VRInitError_IPC_ServerInitFailed: return "VR Server Init Failed (300)";
case VRInitError_IPC_ConnectFailed: return "Connect to VR Server Failed (301)";
case VRInitError_IPC_SharedStateInitFailed: return "Shared IPC State Init Failed (302)";
case VRInitError_IPC_CompositorInitFailed: return "Shared IPC Compositor Init Failed (303)";
case VRInitError_IPC_MutexInitFailed: return "Shared IPC Mutex Init Failed (304)";
case VRInitError_IPC_Failed: return "Shared IPC Failed (305)";
case VRInitError_IPC_ServerInitFailed: return "VR Server Init Failed (300)";
case VRInitError_IPC_ConnectFailed: return "Connect to VR Server Failed (301)";
case VRInitError_IPC_SharedStateInitFailed: return "Shared IPC State Init Failed (302)";
case VRInitError_IPC_CompositorInitFailed: return "Shared IPC Compositor Init Failed (303)";
case VRInitError_IPC_MutexInitFailed: return "Shared IPC Mutex Init Failed (304)";
case VRInitError_IPC_Failed: return "Shared IPC Failed (305)";
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_Compositor_Failed: return "Compositor failed to initialize (400)";
case VRInitError_Compositor_D3D11HardwareRequired: return "Compositor failed to find DX11 hardware (401)";
case VRInitError_Compositor_FirmwareRequiresUpdate: return "Compositor requires mandatory firmware update (402)";
case VRInitError_Compositor_OverlayInitFailed: return "Compositor initialization succeeded, but overlay init failed (403)";
case VRInitError_Compositor_ScreenshotsInitFailed: return "Compositor initialization succeeded, but screenshot init failed (404)";
case VRInitError_Compositor_UnableToCreateDevice: return "Compositor unable to create graphics device (405)";
case VRInitError_Compositor_Failed: return "Compositor failed to initialize (400)";
case VRInitError_Compositor_D3D11HardwareRequired: return "Compositor failed to find DX11 hardware (401)";
case VRInitError_Compositor_FirmwareRequiresUpdate: return "Compositor requires mandatory firmware update (402)";
case VRInitError_Compositor_OverlayInitFailed: return "Compositor initialization succeeded, but overlay init failed (403)";
case VRInitError_Compositor_ScreenshotsInitFailed: return "Compositor initialization succeeded, but screenshot init failed (404)";
case VRInitError_Compositor_UnableToCreateDevice: return "Compositor unable to create graphics device (405)";
// Oculus
case VRInitError_VendorSpecific_UnableToConnectToOculusRuntime: return "Unable to connect to Oculus Runtime (1000)";
@ -105,11 +109,7 @@ const char *GetEnglishStringForHmdError( vr::EVRInitError eError )
case VRInitError_Steam_SteamInstallationNotFound: return "Unable to find Steam installation (2000)";
default:
{
static char buf[128];
sprintf( buf, "Unknown error (%d)", eError );
return buf;
}
return GetIDForVRInitError( eError );
}
}
@ -147,6 +147,8 @@ const char *GetIDForVRInitError( vr::EVRInitError eError )
RETURN_ENUM_AS_STRING( VRInitError_Init_NotSupportedWithCompositor );
RETURN_ENUM_AS_STRING( VRInitError_Init_NotAvailableToUtilityApps );
RETURN_ENUM_AS_STRING( VRInitError_Init_Internal );
RETURN_ENUM_AS_STRING( VRInitError_Init_HmdDriverIdIsNone );
RETURN_ENUM_AS_STRING( VRInitError_Init_HmdNotFoundPresenceFailed );
RETURN_ENUM_AS_STRING( VRInitError_Init_VRMonitorNotFound );
RETURN_ENUM_AS_STRING( VRInitError_Init_VRMonitorStartupFailed );
RETURN_ENUM_AS_STRING( VRInitError_Init_LowPowerWatchdogNotSupported );
@ -157,9 +159,11 @@ const char *GetIDForVRInitError( vr::EVRInitError eError )
RETURN_ENUM_AS_STRING( VRInitError_Init_VRDashboardStartupFailed );
RETURN_ENUM_AS_STRING( VRInitError_Init_VRHomeNotFound );
RETURN_ENUM_AS_STRING( VRInitError_Init_VRHomeStartupFailed );
RETURN_ENUM_AS_STRING( VRInitError_Init_HmdDriverIdIsNone );
RETURN_ENUM_AS_STRING( VRInitError_Init_HmdNotFoundPresenceFailed );
RETURN_ENUM_AS_STRING( VRInitError_Init_RebootingBusy );
RETURN_ENUM_AS_STRING( VRInitError_Init_FirmwareUpdateBusy );
RETURN_ENUM_AS_STRING( VRInitError_Init_FirmwareRecoveryBusy );
RETURN_ENUM_AS_STRING( VRInitError_Init_USBServiceBusy );
RETURN_ENUM_AS_STRING( VRInitError_Init_VRWebHelperStartupFailed );
RETURN_ENUM_AS_STRING( VRInitError_Driver_Failed );
RETURN_ENUM_AS_STRING( VRInitError_Driver_Unknown );
@ -192,8 +196,9 @@ const char *GetIDForVRInitError( vr::EVRInitError eError )
RETURN_ENUM_AS_STRING( VRInitError_Compositor_ScreenshotsInitFailed );
RETURN_ENUM_AS_STRING( VRInitError_Compositor_UnableToCreateDevice );
// Oculus
// Vendor-specific errors
RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_UnableToConnectToOculusRuntime);
RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_WindowsNotInDevMode );
// Lighthouse
RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_CantOpenDevice);

View File

@ -7,6 +7,7 @@
#include "envvartools_public.h"
#include "hmderrors_public.h"
#include "vrpathregistry_public.h"
#include <mutex>
using vr::EVRInitError;
using vr::IVRSystem;
@ -18,6 +19,7 @@ namespace vr
static void *g_pVRModule = NULL;
static IVRClientCore *g_pHmdSystem = NULL;
static std::recursive_mutex g_mutexSystem;
typedef void* (*VRClientCoreFactoryFn)(const char *pInterfaceName, int *pReturnCode);
@ -33,50 +35,50 @@ EVRInitError VR_LoadHmdSystemInternal();
void CleanupInternalInterfaces();
uint32_t VR_InitInternal( EVRInitError *peError, vr::EVRApplicationType eApplicationType )
uint32_t VR_InitInternal2( EVRInitError *peError, vr::EVRApplicationType eApplicationType, const char *pStartupInfo )
{
std::lock_guard<std::recursive_mutex> lock( g_mutexSystem );
EVRInitError err = VR_LoadHmdSystemInternal();
if (err != vr::VRInitError_None)
if ( err == vr::VRInitError_None )
{
SharedLib_Unload(g_pVRModule);
err = g_pHmdSystem->Init( eApplicationType );
}
if ( peError )
*peError = err;
if ( err != VRInitError_None )
{
SharedLib_Unload( g_pVRModule );
g_pHmdSystem = NULL;
g_pVRModule = NULL;
if (peError)
*peError = err;
return 0;
}
err = g_pHmdSystem->Init(eApplicationType);
if (err != VRInitError_None)
{
SharedLib_Unload(g_pVRModule);
g_pHmdSystem = NULL;
g_pVRModule = NULL;
if (peError)
*peError = err;
return 0;
}
if (peError)
*peError = VRInitError_None;
return ++g_nVRToken;
}
VR_INTERFACE uint32_t VR_CALLTYPE VR_InitInternal( EVRInitError *peError, EVRApplicationType eApplicationType );
uint32_t VR_InitInternal( EVRInitError *peError, vr::EVRApplicationType eApplicationType )
{
return VR_InitInternal2( peError, eApplicationType, nullptr );
}
void VR_ShutdownInternal()
{
if (g_pHmdSystem)
std::lock_guard<std::recursive_mutex> lock( g_mutexSystem );
if ( g_pHmdSystem )
{
g_pHmdSystem->Cleanup();
g_pHmdSystem = NULL;
}
if (g_pVRModule)
if ( g_pVRModule )
{
SharedLib_Unload(g_pVRModule);
SharedLib_Unload( g_pVRModule );
g_pVRModule = NULL;
}
@ -152,6 +154,8 @@ EVRInitError VR_LoadHmdSystemInternal()
void *VR_GetGenericInterface(const char *pchInterfaceVersion, EVRInitError *peError)
{
std::lock_guard<std::recursive_mutex> lock( g_mutexSystem );
if (!g_pHmdSystem)
{
if (peError)
@ -164,6 +168,8 @@ void *VR_GetGenericInterface(const char *pchInterfaceVersion, EVRInitError *peEr
bool VR_IsInterfaceVersionValid(const char *pchInterfaceVersion)
{
std::lock_guard<std::recursive_mutex> lock( g_mutexSystem );
if (!g_pHmdSystem)
{
return false;
@ -174,6 +180,8 @@ bool VR_IsInterfaceVersionValid(const char *pchInterfaceVersion)
bool VR_IsHmdPresent()
{
std::lock_guard<std::recursive_mutex> lock( g_mutexSystem );
if( g_pHmdSystem )
{
// if we're already initialized, just call through
@ -199,6 +207,8 @@ bool VR_IsHmdPresent()
/** Returns true if the OpenVR runtime is installed. */
bool VR_IsRuntimeInstalled()
{
std::lock_guard<std::recursive_mutex> lock( g_mutexSystem );
if( g_pHmdSystem )
{
// if we're already initialized, OpenVR is obviously installed
@ -255,6 +265,8 @@ const char *VR_RuntimePath()
/** Returns the symbol version of an HMD error. */
const char *VR_GetVRInitErrorAsSymbol( EVRInitError error )
{
std::lock_guard<std::recursive_mutex> lock( g_mutexSystem );
if( g_pHmdSystem )
return g_pHmdSystem->GetIDForVRInitError( error );
else
@ -265,6 +277,8 @@ const char *VR_GetVRInitErrorAsSymbol( EVRInitError error )
/** Returns the english string version of an HMD error. */
const char *VR_GetVRInitErrorAsEnglishDescription( EVRInitError error )
{
std::lock_guard<std::recursive_mutex> lock( g_mutexSystem );
if ( g_pHmdSystem )
return g_pHmdSystem->GetEnglishStringForHmdError( error );
else

View File

@ -188,11 +188,8 @@ bool Path_IsAbsolute( const std::string & sPath )
/** Makes an absolute path from a relative path and a base path */
std::string Path_MakeAbsolute( const std::string & sRelativePath, const std::string & sBasePath, char slash )
std::string Path_MakeAbsolute( const std::string & sRelativePath, const std::string & sBasePath )
{
if( slash == 0 )
slash = Path_GetSlash();
if( Path_IsAbsolute( sRelativePath ) )
return sRelativePath;
else
@ -200,7 +197,7 @@ std::string Path_MakeAbsolute( const std::string & sRelativePath, const std::str
if( !Path_IsAbsolute( sBasePath ) )
return "";
std::string sCompacted = Path_Compact( Path_Join( sBasePath, sRelativePath, slash ), slash );
std::string sCompacted = Path_Compact( Path_Join( sBasePath, sRelativePath ) );
if( Path_IsAbsolute( sCompacted ) )
return sCompacted;
else
@ -464,10 +461,11 @@ bool Path_IsDirectory( const std::string & sPath )
bool Path_IsAppBundle( const std::string & sPath )
{
#if defined(OSX)
NSBundle *bundle = [ NSBundle bundleWithPath: [ NSString stringWithUTF8String:sPath.c_str() ] ];
bool bisAppBundle = ( nullptr != bundle );
[ bundle release ];
return bisAppBundle;
@autoreleasepool {
NSBundle *bundle = [ NSBundle bundleWithPath: [ NSString stringWithUTF8String:sPath.c_str() ] ];
bool bisAppBundle = ( nullptr != bundle );
return bisAppBundle;
}
#else
return false;
#endif
@ -655,7 +653,7 @@ bool Path_WriteBinaryFile(const std::string &strFilename, unsigned char *pData,
fclose(f);
}
return written = nSize ? true : false;
return written == nSize ? true : false;
}
std::string Path_ReadTextFile( const std::string &strFilename )

View File

@ -35,7 +35,7 @@ std::string Path_GetExtension( const std::string & sPath );
bool Path_IsAbsolute( const std::string & sPath );
/** Makes an absolute path from a relative path and a base path */
std::string Path_MakeAbsolute( const std::string & sRelativePath, const std::string & sBasePath, char slash = 0 );
std::string Path_MakeAbsolute( const std::string & sRelativePath, const std::string & sBasePath );
/** Fixes the directory separators for the current platform.
* If slash is unspecified the native path separator of the current platform

View File

@ -3,6 +3,8 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sstream>
#include <iostream>
//-----------------------------------------------------------------------------
// Purpose:
@ -142,8 +144,8 @@ std::wstring UTF8to16(const char * in)
void strcpy_safe( char *pchBuffer, size_t unBufferSizeBytes, const char *pchSource )
{
pchBuffer[ unBufferSizeBytes - 1 ] = '\0';
strncpy( pchBuffer, pchSource, unBufferSizeBytes - 1 );
pchBuffer[unBufferSizeBytes - 1] = '\0';
}
@ -197,13 +199,6 @@ uint32_t ReturnStdString( const std::string & sValue, char *pchBuffer, uint32_t
return unLen;
}
void BufferToStdString( std::string & sDest, const char *pchBuffer, uint32_t unBufferLen )
{
sDest.resize( unBufferLen + 1 );
memcpy( const_cast< char* >( sDest.c_str() ), pchBuffer, unBufferLen );
const_cast< char* >( sDest.c_str() )[ unBufferLen ] = '\0';
}
// Commented out by Mozilla, please see README.mozilla
/** Returns a std::string from a uint64_t */
/*
@ -437,3 +432,19 @@ void V_StripExtension( std::string &in )
}
}
//-----------------------------------------------------------------------------
// Purpose: Tokenizes a string into a vector of strings
//-----------------------------------------------------------------------------
std::vector<std::string> TokenizeString( const std::string & sString, char cToken )
{
std::vector<std::string> vecStrings;
std::istringstream stream( sString );
std::string s;
while ( std::getline( stream, s, cToken ) )
{
vecStrings.push_back( s );
}
return vecStrings;
}

View File

@ -4,6 +4,7 @@
#include <string>
#include <stdint.h>
#include <sys/types.h>
#include <vector>
/** returns true if the string has the prefix */
bool StringHasPrefix( const std::string & sString, const std::string & sPrefix );
@ -64,6 +65,7 @@ inline errno_t strncpy_s(char *strDest, size_t numberOfElements, const char *str
return strlcpy(strDest, strSource, numberOfElements);
}
*/
#endif
#if defined( LINUX )
@ -92,9 +94,6 @@ inline uint64_t strtoull(const char *str, char **endptr, int base) { return _str
/* Handles copying a std::string into a buffer as would be provided in an API */
uint32_t ReturnStdString( const std::string & sValue, char *pchBuffer, uint32_t unBufferLen );
/* Handles copying a buffer into an std::string and auto adds null terminator */
void BufferToStdString( std::string & sDest, const char *pchBuffer, uint32_t unBufferLen );
/** Returns a std::string from a uint64_t */
// std::string Uint64ToString( uint64_t ulValue );
// Commented out by Mozilla, please see README.mozilla
@ -127,3 +126,5 @@ size_t V_URLDecode( char *pchDecodeDest, int nDecodeDestLen, const char *pchEnco
void V_StripExtension( std::string &in );
/** Tokenizes a string into a vector of strings */
std::vector<std::string> TokenizeString( const std::string & sString, char cToken );

View File

@ -60,7 +60,7 @@ static std::string GetAppSettingsPath()
NSString *resolvedPath = [paths objectAtIndex:0];
resolvedPath = [resolvedPath stringByAppendingPathComponent: @"OpenVR"];
if ( ![[NSFileManager new] createDirectoryAtPath: resolvedPath withIntermediateDirectories:YES attributes:nil error:nil] )
if ( ![[NSFileManager defaultManager] createDirectoryAtPath: resolvedPath withIntermediateDirectories:YES attributes:nil error:nil] )
{
return "";
}