diff --git a/CodeGen/CustomTypes/SteamNetworkingTypes/SteamNetworkingMessage_t.cs b/CodeGen/CustomTypes/SteamNetworkingTypes/SteamNetworkingMessage_t.cs index 4fff04cc..7bebdbb1 100644 --- a/CodeGen/CustomTypes/SteamNetworkingTypes/SteamNetworkingMessage_t.cs +++ b/CodeGen/CustomTypes/SteamNetworkingTypes/SteamNetworkingMessage_t.cs @@ -53,7 +53,7 @@ public struct SteamNetworkingMessage_t /// usually be something like: /// /// free( pMsg->m_pData ); - internal IntPtr m_pfnFreeData; + public IntPtr m_pfnFreeData; /// Function to used to decrement the internal reference count and, if /// it's zero, release the message. You should not set this function pointer, @@ -79,7 +79,20 @@ public struct SteamNetworkingMessage_t /// You MUST call this when you're done with the object, /// to free up memory, etc. public void Release() { - NativeMethods.SteamAPI_SteamNetworkingMessage_t_Release(m_pfnRelease); + throw new System.NotImplementedException("Please use the static Release function instead which takes an IntPtr."); + } + + /// You MUST call this when you're done with the object, + /// to free up memory, etc. + /// This is a Steamworks.NET extension. + public static void Release(IntPtr pointer) { + NativeMethods.SteamAPI_SteamNetworkingMessage_t_Release(pointer); + } + + /// Convert an IntPtr received from ISteamNetworkingSockets.ReceiveMessagesOnPollGroup into our structure. + /// This is a Steamworks.NET extension. + public static SteamNetworkingMessage_t FromIntPtr(IntPtr pointer) { + return (SteamNetworkingMessage_t)Marshal.PtrToStructure(pointer, typeof(SteamNetworkingMessage_t)); } } } diff --git a/com.rlabrecque.steamworks.net/Runtime/types/SteamNetworkingTypes/SteamNetworkingMessage_t.cs b/com.rlabrecque.steamworks.net/Runtime/types/SteamNetworkingTypes/SteamNetworkingMessage_t.cs index 7335075f..31b5f843 100644 --- a/com.rlabrecque.steamworks.net/Runtime/types/SteamNetworkingTypes/SteamNetworkingMessage_t.cs +++ b/com.rlabrecque.steamworks.net/Runtime/types/SteamNetworkingTypes/SteamNetworkingMessage_t.cs @@ -69,7 +69,7 @@ public struct SteamNetworkingMessage_t /// usually be something like: /// /// free( pMsg->m_pData ); - internal IntPtr m_pfnFreeData; + public IntPtr m_pfnFreeData; /// Function to used to decrement the internal reference count and, if /// it's zero, release the message. You should not set this function pointer, @@ -95,7 +95,20 @@ public struct SteamNetworkingMessage_t /// You MUST call this when you're done with the object, /// to free up memory, etc. public void Release() { - NativeMethods.SteamAPI_SteamNetworkingMessage_t_Release(m_pfnRelease); + throw new System.NotImplementedException("Please use the static Release function instead which takes an IntPtr."); + } + + /// You MUST call this when you're done with the object, + /// to free up memory, etc. + /// This is a Steamworks.NET extension. + public static void Release(IntPtr pointer) { + NativeMethods.SteamAPI_SteamNetworkingMessage_t_Release(pointer); + } + + /// Convert an IntPtr received from ISteamNetworkingSockets.ReceiveMessagesOnPollGroup into our structure. + /// This is a Steamworks.NET extension. + public static SteamNetworkingMessage_t FromIntPtr(IntPtr pointer) { + return (SteamNetworkingMessage_t)Marshal.PtrToStructure(pointer, typeof(SteamNetworkingMessage_t)); } } }