From e6b9f89d5fa705361f89897fdabfcb3cebf66524 Mon Sep 17 00:00:00 2001 From: fraser Date: Tue, 17 Sep 2024 16:48:25 +0100 Subject: [PATCH 1/2] #1873 bug fix, exposing the existing CVRResources API in the same manner as the others. --- headers/openvr_api.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/headers/openvr_api.cs b/headers/openvr_api.cs index 9b459972..02b7c338 100644 --- a/headers/openvr_api.cs +++ b/headers/openvr_api.cs @@ -8214,6 +8214,19 @@ public CVRRenderModels VRRenderModels() return m_pVRRenderModels; } + public CVRResources VRResources() + { + CheckClear(); + if (m_pVRResources == null) + { + var eError = EVRInitError.None; + var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRResources_Version, ref eError); + if (pInterface != IntPtr.Zero && eError == EVRInitError.None) + m_pVRResources = new CVRResources(pInterface); + } + return m_pVRResources; + } + public CVRExtendedDisplay VRExtendedDisplay() { CheckClear(); @@ -8352,6 +8365,7 @@ public CVRNotifications VRNotifications() private CVROverlay m_pVROverlay; private CVROverlayView m_pVROverlayView; private CVRRenderModels m_pVRRenderModels; + private CVRResources m_pVRResources; private CVRExtendedDisplay m_pVRExtendedDisplay; private CVRSettings m_pVRSettings; private CVRApplications m_pVRApplications; @@ -8383,6 +8397,7 @@ static COpenVRContext OpenVRInternal_ModuleContext public static CVROverlay Overlay { get { return OpenVRInternal_ModuleContext.VROverlay(); } } public static CVROverlayView OverlayView { get { return OpenVRInternal_ModuleContext.VROverlayView(); } } public static CVRRenderModels RenderModels { get { return OpenVRInternal_ModuleContext.VRRenderModels(); } } + public static CVRResources Resources { get { return OpenVRInternal_ModuleContext.VRResources(); } } public static CVRExtendedDisplay ExtendedDisplay { get { return OpenVRInternal_ModuleContext.VRExtendedDisplay(); } } public static CVRSettings Settings { get { return OpenVRInternal_ModuleContext.VRSettings(); } } public static CVRApplications Applications { get { return OpenVRInternal_ModuleContext.VRApplications(); } } From b2682b285428f0686cbb52f10eccfe6127b43ff2 Mon Sep 17 00:00:00 2001 From: fraser Date: Tue, 17 Sep 2024 16:50:46 +0100 Subject: [PATCH 2/2] #1874 bug fix, addressing the incorrect return type for CVRResources.LoadSharedResource --- headers/openvr_api.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/headers/openvr_api.cs b/headers/openvr_api.cs index 02b7c338..6d66cb8b 100644 --- a/headers/openvr_api.cs +++ b/headers/openvr_api.cs @@ -1676,7 +1676,7 @@ public struct IVRScreenshots public struct IVRResources { [UnmanagedFunctionPointer(CallingConvention.StdCall)] - internal delegate uint _LoadSharedResource(IntPtr pchResourceName, string pchBuffer, uint unBufferLen); + internal delegate uint _LoadSharedResource(IntPtr pchResourceName, System.Text.StringBuilder pchBuffer, uint unBufferLen); [MarshalAs(UnmanagedType.FunctionPtr)] internal _LoadSharedResource LoadSharedResource; @@ -4075,7 +4075,7 @@ internal CVRResources(IntPtr pInterface) { FnTable = (IVRResources)Marshal.PtrToStructure(pInterface, typeof(IVRResources)); } - public uint LoadSharedResource(string pchResourceName,string pchBuffer,uint unBufferLen) + public uint LoadSharedResource(string pchResourceName,System.Text.StringBuilder pchBuffer,uint unBufferLen) { IntPtr pchResourceNameUtf8 = Utils.ToUtf8(pchResourceName); uint result = FnTable.LoadSharedResource(pchResourceNameUtf8,pchBuffer,unBufferLen);