mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-27 23:25:55 +03:00
NetMsg with Release
This commit is contained in:
parent
12ab3f1248
commit
14d947c7ba
35
Facepunch.Steamworks/Structs/NetMsg.cs
Normal file
35
Facepunch.Steamworks/Structs/NetMsg.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using Steamworks.Data;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Steamworks.Data
|
||||
{
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
internal struct NetMsg
|
||||
{
|
||||
// #32bit
|
||||
internal IntPtr DataPtr;
|
||||
internal int DataSize;
|
||||
internal NetConnection Connection;
|
||||
internal NetworkIdentity Identity;
|
||||
internal long ConnectionUserData;
|
||||
internal SteamNetworkingMicroseconds TimeRecv;
|
||||
internal long MessageNumber;
|
||||
internal IntPtr FreeDataPtr;
|
||||
internal IntPtr ReleasePtr;
|
||||
internal int Channel;
|
||||
|
||||
|
||||
internal delegate void ReleaseDelegate( IntPtr msg );
|
||||
|
||||
public void Release( IntPtr data )
|
||||
{
|
||||
//
|
||||
// I think this function might be a static global, so we could probably
|
||||
// cache this release call.
|
||||
//
|
||||
var d = Marshal.GetDelegateForFunctionPointer<ReleaseDelegate>( ReleasePtr );
|
||||
d( data );
|
||||
}
|
||||
}
|
||||
}
|
@ -41,37 +41,6 @@ public static implicit operator uint( SteamNetworkingPOPID value )
|
||||
public override string ToString() => Value.ToString();
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public struct SteamNetworkingMessage_t
|
||||
{
|
||||
public IntPtr data;
|
||||
public int length;
|
||||
public NetConnection connection;
|
||||
public NetworkIdentity identity;
|
||||
public long userData;
|
||||
public SteamNetworkingMicroseconds timeReceived;
|
||||
public long messageNumber;
|
||||
internal IntPtr release;
|
||||
public int channel;
|
||||
private int pad;
|
||||
/*
|
||||
public void CopyTo( byte[] destination )
|
||||
{
|
||||
if ( destination == null )
|
||||
throw new ArgumentNullException( "destination" );
|
||||
|
||||
Marshal.Copy( data, destination, 0, length );
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
if ( release == IntPtr.Zero )
|
||||
throw new InvalidOperationException( "Message not created" );
|
||||
|
||||
Native.SteamAPI_SteamNetworkingMessage_t_Release( release );
|
||||
}*/
|
||||
}
|
||||
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
public struct SteamNetworkingQuickConnectionStatus
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user