Skip to content

Commit

Permalink
Rearranged type declarations in the headers so they're in the right o…
Browse files Browse the repository at this point in the history
…rder.

[git-p4: depot-paths = "//vr/steamvr/sdk_release/": change = 2879780]
  • Loading branch information
JoeLudwig committed Jul 15, 2015
1 parent 1daef60 commit 59db933
Show file tree
Hide file tree
Showing 5 changed files with 259 additions and 231 deletions.
56 changes: 28 additions & 28 deletions headers/openvr.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,34 @@ struct Compositor_OverlaySettings
HmdMatrix44_t transform;
};

/** used to refer to a single VR overlay */
typedef uint64_t VROverlayHandle_t;

static const VROverlayHandle_t k_ulOverlayHandleInvalid = 0;

/** Errors that can occur around VR overlays */
enum VROverlayError
{
VROverlayError_None = 0,

VROverlayError_UnknownOverlay = 10,
VROverlayError_InvalidHandle = 11,
VROverlayError_PermissionDenied = 12,
VROverlayError_OverlayLimitExceeded = 13, // No more overlays could be created because the maximum number already exist
VROverlayError_WrongVisibilityType = 14,
VROverlayError_KeyTooLong = 15,
VROverlayError_NameTooLong = 16,
VROverlayError_KeyInUse = 17,
VROverlayError_WrongTransformType = 18,
VROverlayError_InvalidTrackedDevice = 19,
VROverlayError_InvalidParameter = 20,
VROverlayError_ThumbnailCantBeDestroyed = 21,
VROverlayError_ArrayTooSmall = 22,
VROverlayError_RequestFailed = 23,
VROverlayError_InvalidTexture = 24,
VROverlayError_UnableToLoadFile = 25,
};


/** error codes returned by Vr_Init */
enum HmdError
Expand Down Expand Up @@ -1091,11 +1119,6 @@ static const char * const IVRNotifications_Version = "IVRNotifications_001";
namespace vr
{

/** used to refer to a single VR overlay */
typedef uint64_t VROverlayHandle_t;

static const VROverlayHandle_t k_ulOverlayHandleInvalid = 0;

/** The maximum length of an overlay key in bytes, counting the terminating null character. */
static const uint32_t k_unVROverlayMaxKeyLength = 128;

Expand All @@ -1105,29 +1128,6 @@ namespace vr
/** The maximum number of overlays that can exist in the system at one time. */
static const uint32_t k_unMaxOverlayCount = 32;

/** Errors that can occur around VR overlays */
enum VROverlayError
{
VROverlayError_None = 0,

VROverlayError_UnknownOverlay = 10,
VROverlayError_InvalidHandle = 11,
VROverlayError_PermissionDenied = 12,
VROverlayError_OverlayLimitExceeded = 13, // No more overlays could be created because the maximum number already exist
VROverlayError_WrongVisibilityType = 14,
VROverlayError_KeyTooLong = 15,
VROverlayError_NameTooLong = 16,
VROverlayError_KeyInUse = 17,
VROverlayError_WrongTransformType = 18,
VROverlayError_InvalidTrackedDevice = 19,
VROverlayError_InvalidParameter = 20,
VROverlayError_ThumbnailCantBeDestroyed = 21,
VROverlayError_ArrayTooSmall = 22,
VROverlayError_RequestFailed = 23,
VROverlayError_InvalidTexture = 24,
VROverlayError_UnableToLoadFile = 25,
};

/** Types of input supported by VR Overlays */
enum VROverlayInputMethod
{
Expand Down
186 changes: 93 additions & 93 deletions headers/openvr_api.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ class VRNativeEntrypoints
internal static extern IntPtr VR_IVRControlPanel_GetCurrentCompositorInterface(IntPtr instancePtr, string pchInterfaceVersion);
[DllImportAttribute("openvr_api", EntryPoint = "VR_IVRControlPanel_QuitProcess")]
internal static extern bool VR_IVRControlPanel_QuitProcess(IntPtr instancePtr, uint pidProcessToQuit);
[DllImportAttribute("openvr_api", EntryPoint = "VR_IVRNotifications_GetErrorString")]
internal static extern uint VR_IVRNotifications_GetErrorString(IntPtr instancePtr, NotificationError_t error, System.Text.StringBuilder pchBuffer, uint unBufferSize);
[DllImportAttribute("openvr_api", EntryPoint = "VR_IVRNotifications_CreateNotification")]
internal static extern NotificationError_t VR_IVRNotifications_CreateNotification(IntPtr instancePtr, ulong ulOverlayHandle, ulong ulUserValue, string strType, string strText, string strCategory, ref NotificationBitmap photo, ref uint notificationId);
[DllImportAttribute("openvr_api", EntryPoint = "VR_IVRNotifications_DismissNotification")]
internal static extern NotificationError_t VR_IVRNotifications_DismissNotification(IntPtr instancePtr, uint notificationId);
[DllImportAttribute("openvr_api", EntryPoint = "VR_IVRCameraAccess_GetCameraCount")]
internal static extern uint VR_IVRCameraAccess_GetCameraCount(IntPtr instancePtr);
[DllImportAttribute("openvr_api", EntryPoint = "VR_IVRCameraAccess_GetCameraId")]
Expand Down Expand Up @@ -307,12 +313,6 @@ class VRNativeEntrypoints
internal static extern void VR_IVRChaperoneSetup_RemoveAllWorkingTagPoses(IntPtr instancePtr);
[DllImportAttribute("openvr_api", EntryPoint = "VR_IVRChaperoneSetup_ReloadFromDisk")]
internal static extern void VR_IVRChaperoneSetup_ReloadFromDisk(IntPtr instancePtr);
[DllImportAttribute("openvr_api", EntryPoint = "VR_IVRNotifications_GetErrorString")]
internal static extern uint VR_IVRNotifications_GetErrorString(IntPtr instancePtr, NotificationError_t error, System.Text.StringBuilder pchBuffer, uint unBufferSize);
[DllImportAttribute("openvr_api", EntryPoint = "VR_IVRNotifications_CreateNotification")]
internal static extern NotificationError_t VR_IVRNotifications_CreateNotification(IntPtr instancePtr, ulong ulOverlayHandle, ulong ulUserValue, string strType, string strText, string strCategory, ref NotificationBitmap photo, ref uint notificationId);
[DllImportAttribute("openvr_api", EntryPoint = "VR_IVRNotifications_DismissNotification")]
internal static extern NotificationError_t VR_IVRNotifications_DismissNotification(IntPtr instancePtr, uint notificationId);

}

Expand Down Expand Up @@ -479,6 +479,15 @@ public abstract class IVRControlPanel
}


public abstract class IVRNotifications
{
public abstract IntPtr GetIntPtr();
public abstract uint GetErrorString(NotificationError_t error,System.Text.StringBuilder pchBuffer,uint unBufferSize);
public abstract NotificationError_t CreateNotification(ulong ulOverlayHandle,ulong ulUserValue,string strType,string strText,string strCategory,ref NotificationBitmap photo,ref uint notificationId);
public abstract NotificationError_t DismissNotification(uint notificationId);
}


public abstract class IVRCameraAccess
{
public abstract IntPtr GetIntPtr();
Expand Down Expand Up @@ -514,15 +523,6 @@ public abstract class IVRChaperoneSetup
}


public abstract class IVRNotifications
{
public abstract IntPtr GetIntPtr();
public abstract uint GetErrorString(NotificationError_t error,System.Text.StringBuilder pchBuffer,uint unBufferSize);
public abstract NotificationError_t CreateNotification(ulong ulOverlayHandle,ulong ulUserValue,string strType,string strText,string strCategory,ref NotificationBitmap photo,ref uint notificationId);
public abstract NotificationError_t DismissNotification(uint notificationId);
}


public class CVRSystem : IVRSystem
{
public CVRSystem(IntPtr VRSystem)
Expand Down Expand Up @@ -1389,6 +1389,45 @@ public override bool QuitProcess(uint pidProcessToQuit)
}


public class CVRNotifications : IVRNotifications
{
public CVRNotifications(IntPtr VRNotifications)
{
m_pVRNotifications = VRNotifications;
}
IntPtr m_pVRNotifications;

public override IntPtr GetIntPtr() { return m_pVRNotifications; }

private void CheckIfUsable()
{
if (m_pVRNotifications == IntPtr.Zero)
{
throw new Exception("Steam Pointer not configured");
}
}
public override uint GetErrorString(NotificationError_t error,System.Text.StringBuilder pchBuffer,uint unBufferSize)
{
CheckIfUsable();
uint result = VRNativeEntrypoints.VR_IVRNotifications_GetErrorString(m_pVRNotifications,error,pchBuffer,unBufferSize);
return result;
}
public override NotificationError_t CreateNotification(ulong ulOverlayHandle,ulong ulUserValue,string strType,string strText,string strCategory,ref NotificationBitmap photo,ref uint notificationId)
{
CheckIfUsable();
notificationId = 0;
NotificationError_t result = VRNativeEntrypoints.VR_IVRNotifications_CreateNotification(m_pVRNotifications,ulOverlayHandle,ulUserValue,strType,strText,strCategory,ref photo,ref notificationId);
return result;
}
public override NotificationError_t DismissNotification(uint notificationId)
{
CheckIfUsable();
NotificationError_t result = VRNativeEntrypoints.VR_IVRNotifications_DismissNotification(m_pVRNotifications,notificationId);
return result;
}
}


public class CVRCameraAccess : IVRCameraAccess
{
public CVRCameraAccess(IntPtr VRCameraAccess)
Expand Down Expand Up @@ -1568,45 +1607,6 @@ public override void ReloadFromDisk()
}


public class CVRNotifications : IVRNotifications
{
public CVRNotifications(IntPtr VRNotifications)
{
m_pVRNotifications = VRNotifications;
}
IntPtr m_pVRNotifications;

public override IntPtr GetIntPtr() { return m_pVRNotifications; }

private void CheckIfUsable()
{
if (m_pVRNotifications == IntPtr.Zero)
{
throw new Exception("Steam Pointer not configured");
}
}
public override uint GetErrorString(NotificationError_t error,System.Text.StringBuilder pchBuffer,uint unBufferSize)
{
CheckIfUsable();
uint result = VRNativeEntrypoints.VR_IVRNotifications_GetErrorString(m_pVRNotifications,error,pchBuffer,unBufferSize);
return result;
}
public override NotificationError_t CreateNotification(ulong ulOverlayHandle,ulong ulUserValue,string strType,string strText,string strCategory,ref NotificationBitmap photo,ref uint notificationId)
{
CheckIfUsable();
notificationId = 0;
NotificationError_t result = VRNativeEntrypoints.VR_IVRNotifications_CreateNotification(m_pVRNotifications,ulOverlayHandle,ulUserValue,strType,strText,strCategory,ref photo,ref notificationId);
return result;
}
public override NotificationError_t DismissNotification(uint notificationId)
{
CheckIfUsable();
NotificationError_t result = VRNativeEntrypoints.VR_IVRNotifications_DismissNotification(m_pVRNotifications,notificationId);
return result;
}
}


public class OpenVRInterop
{
[DllImportAttribute("openvr_api", EntryPoint = "VR_Init")]
Expand Down Expand Up @@ -1769,6 +1769,26 @@ public enum EVRControllerEventOutputType
ControllerEventOutput_OSEvents = 0,
ControllerEventOutput_VREvents = 1,
}
public enum VROverlayError
{
None = 0,
UnknownOverlay = 10,
InvalidHandle = 11,
PermissionDenied = 12,
OverlayLimitExceeded = 13,
WrongVisibilityType = 14,
KeyTooLong = 15,
NameTooLong = 16,
KeyInUse = 17,
WrongTransformType = 18,
InvalidTrackedDevice = 19,
InvalidParameter = 20,
ThumbnailCantBeDestroyed = 21,
ArrayTooSmall = 22,
RequestFailed = 23,
InvalidTexture = 24,
UnableToLoadFile = 25,
}
public enum HmdError
{
None = 0,
Expand Down Expand Up @@ -1824,26 +1844,6 @@ public enum ChaperoneCalibrationState
Error_SoftBoundsInvalid = 203,
Error_HardBoundsInvalid = 204,
}
public enum VROverlayError
{
None = 0,
UnknownOverlay = 10,
InvalidHandle = 11,
PermissionDenied = 12,
OverlayLimitExceeded = 13,
WrongVisibilityType = 14,
KeyTooLong = 15,
NameTooLong = 16,
KeyInUse = 17,
WrongTransformType = 18,
InvalidTrackedDevice = 19,
InvalidParameter = 20,
ThumbnailCantBeDestroyed = 21,
ArrayTooSmall = 22,
RequestFailed = 23,
InvalidTexture = 24,
UnableToLoadFile = 25,
}
public enum VROverlayInputMethod
{
None = 0,
Expand All @@ -1861,18 +1861,18 @@ public enum VROverlayFlags
Curved = 1,
RGSS4X = 2,
}
public enum NotificationError_t
{
k_ENotificationError_OK = 0,
k_ENotificationError_Fail = 1,
}
public enum CameraImageResult
{
OK = 0,
Uninitalized = 1,
NotReady = 2,
SameFrame = 3,
}
public enum NotificationError_t
{
k_ENotificationError_OK = 0,
k_ENotificationError_Fail = 1,
}

[StructLayout(LayoutKind.Explicit)] public struct VREvent_Data_t
{
Expand Down Expand Up @@ -2080,6 +2080,17 @@ public enum NotificationError_t
public HmdVector2_t vUVs;
public float fDistance;
}
[StructLayout(LayoutKind.Sequential)] public struct NotificationBitmap
{
public IntPtr bytes; // char *
public int width;
public int height;
public int depth;
}
[StructLayout(LayoutKind.Sequential)] public struct NotificationItem
{
public uint notificationId;
}
[StructLayout(LayoutKind.Sequential)] public struct CameraInfo_t
{
public uint width;
Expand All @@ -2098,17 +2109,6 @@ public enum NotificationError_t
public uint unBufferLen;
public CameraImageResult result;
}
[StructLayout(LayoutKind.Sequential)] public struct NotificationBitmap
{
public IntPtr bytes; // char *
public int width;
public int height;
public int depth;
}
[StructLayout(LayoutKind.Sequential)] public struct NotificationItem
{
public uint notificationId;
}

public class OpenVR
{
Expand Down Expand Up @@ -2144,21 +2144,21 @@ public static string GetStringForHmdError(HmdError error)
public const uint k_unTrackedDeviceIndexInvalid = 4294967295;
public const uint k_unMaxPropertyStringSize = 32768;
public const uint k_unControllerStateAxisCount = 5;
public const ulong k_ulOverlayHandleInvalid = 0;
public const string IVRSystem_Version = "IVRSystem_005";
public const string IVRCompositor_Version = "IVRCompositor_007";
public const string IVRChaperone_Version = "IVRChaperone_002";
public const ulong k_ulOverlayHandleInvalid = 0;
public const uint k_unVROverlayMaxKeyLength = 128;
public const uint k_unVROverlayMaxNameLength = 128;
public const uint k_unMaxOverlayCount = 32;
public const string IVROverlay_Version = "IVROverlay_003";
public const string IVRRenderModels_Version = "IVRRenderModels_001";
public const string IVRControlPanel_Version = "IVRControlPanel_001";
public const string IVRCameraAccess_Version = "IVRCameraAccess_001";
public const string IVRChaperoneSetup_Version = "IVRChaperoneSetup_001";
public const uint k_unNotificationTypeMaxSize = 16;
public const uint k_unNotificationTextMaxSize = 128;
public const string IVRNotifications_Version = "IVRNotifications_001";
public const string IVRCameraAccess_Version = "IVRCameraAccess_001";
public const string IVRChaperoneSetup_Version = "IVRChaperoneSetup_001";
}


Expand Down
Loading

0 comments on commit 59db933

Please sign in to comment.