mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-26 14:45:51 +03:00
Networking Cleanup
This commit is contained in:
parent
4871c634fb
commit
e7a6a00675
@ -38,7 +38,7 @@ public async Task LocalPingLocation()
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void PingLocationParse()
|
public void PingLocationParse()
|
||||||
{
|
{
|
||||||
var pl = Data.PingLocation.TryParseFromString( GarrysLocation );
|
var pl = Data.NetPingLocation.TryParseFromString( GarrysLocation );
|
||||||
|
|
||||||
Assert.IsTrue( pl.HasValue );
|
Assert.IsTrue( pl.HasValue );
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ public async Task GetEstimatedPing()
|
|||||||
{
|
{
|
||||||
await SteamNetworkingUtils.WaitForPingDataAsync();
|
await SteamNetworkingUtils.WaitForPingDataAsync();
|
||||||
|
|
||||||
var garrysping = Data.PingLocation.TryParseFromString( GarrysLocation );
|
var garrysping = Data.NetPingLocation.TryParseFromString( GarrysLocation );
|
||||||
Assert.IsTrue( garrysping.HasValue );
|
Assert.IsTrue( garrysping.HasValue );
|
||||||
|
|
||||||
var ping = SteamNetworkingUtils.EstimatePingTo( garrysping.Value );
|
var ping = SteamNetworkingUtils.EstimatePingTo( garrysping.Value );
|
||||||
|
@ -448,10 +448,10 @@ internal bool ReceivedP2PCustomSignal( IntPtr pMsg, int cbMsg, IntPtr pContext )
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_GetCertificateRequest", CallingConvention = Platform.CC)]
|
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_GetCertificateRequest", CallingConvention = Platform.CC)]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
private static extern bool _GetCertificateRequest( IntPtr self, ref int pcbBlob, IntPtr pBlob, ref SteamNetworkingErrMsg errMsg );
|
private static extern bool _GetCertificateRequest( IntPtr self, ref int pcbBlob, IntPtr pBlob, ref NetErrorMessage errMsg );
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
internal bool GetCertificateRequest( ref int pcbBlob, IntPtr pBlob, ref SteamNetworkingErrMsg errMsg )
|
internal bool GetCertificateRequest( ref int pcbBlob, IntPtr pBlob, ref NetErrorMessage errMsg )
|
||||||
{
|
{
|
||||||
var returnValue = _GetCertificateRequest( Self, ref pcbBlob, pBlob, ref errMsg );
|
var returnValue = _GetCertificateRequest( Self, ref pcbBlob, pBlob, ref errMsg );
|
||||||
return returnValue;
|
return returnValue;
|
||||||
@ -460,10 +460,10 @@ internal bool GetCertificateRequest( ref int pcbBlob, IntPtr pBlob, ref SteamNet
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_SetCertificate", CallingConvention = Platform.CC)]
|
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingSockets_SetCertificate", CallingConvention = Platform.CC)]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
private static extern bool _SetCertificate( IntPtr self, IntPtr pCertificate, int cbCertificate, ref SteamNetworkingErrMsg errMsg );
|
private static extern bool _SetCertificate( IntPtr self, IntPtr pCertificate, int cbCertificate, ref NetErrorMessage errMsg );
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
internal bool SetCertificate( IntPtr pCertificate, int cbCertificate, ref SteamNetworkingErrMsg errMsg )
|
internal bool SetCertificate( IntPtr pCertificate, int cbCertificate, ref NetErrorMessage errMsg )
|
||||||
{
|
{
|
||||||
var returnValue = _SetCertificate( Self, pCertificate, cbCertificate, ref errMsg );
|
var returnValue = _SetCertificate( Self, pCertificate, cbCertificate, ref errMsg );
|
||||||
return returnValue;
|
return returnValue;
|
||||||
|
@ -54,10 +54,10 @@ internal SteamNetworkingAvailability GetRelayNetworkStatus( ref SteamRelayNetwor
|
|||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_GetLocalPingLocation", CallingConvention = Platform.CC)]
|
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_GetLocalPingLocation", CallingConvention = Platform.CC)]
|
||||||
private static extern float _GetLocalPingLocation( IntPtr self, ref PingLocation result );
|
private static extern float _GetLocalPingLocation( IntPtr self, ref NetPingLocation result );
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
internal float GetLocalPingLocation( ref PingLocation result )
|
internal float GetLocalPingLocation( ref NetPingLocation result )
|
||||||
{
|
{
|
||||||
var returnValue = _GetLocalPingLocation( Self, ref result );
|
var returnValue = _GetLocalPingLocation( Self, ref result );
|
||||||
return returnValue;
|
return returnValue;
|
||||||
@ -65,10 +65,10 @@ internal float GetLocalPingLocation( ref PingLocation result )
|
|||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_EstimatePingTimeBetweenTwoLocations", CallingConvention = Platform.CC)]
|
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_EstimatePingTimeBetweenTwoLocations", CallingConvention = Platform.CC)]
|
||||||
private static extern int _EstimatePingTimeBetweenTwoLocations( IntPtr self, ref PingLocation location1, ref PingLocation location2 );
|
private static extern int _EstimatePingTimeBetweenTwoLocations( IntPtr self, ref NetPingLocation location1, ref NetPingLocation location2 );
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
internal int EstimatePingTimeBetweenTwoLocations( ref PingLocation location1, ref PingLocation location2 )
|
internal int EstimatePingTimeBetweenTwoLocations( ref NetPingLocation location1, ref NetPingLocation location2 )
|
||||||
{
|
{
|
||||||
var returnValue = _EstimatePingTimeBetweenTwoLocations( Self, ref location1, ref location2 );
|
var returnValue = _EstimatePingTimeBetweenTwoLocations( Self, ref location1, ref location2 );
|
||||||
return returnValue;
|
return returnValue;
|
||||||
@ -76,10 +76,10 @@ internal int EstimatePingTimeBetweenTwoLocations( ref PingLocation location1, re
|
|||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_EstimatePingTimeFromLocalHost", CallingConvention = Platform.CC)]
|
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_EstimatePingTimeFromLocalHost", CallingConvention = Platform.CC)]
|
||||||
private static extern int _EstimatePingTimeFromLocalHost( IntPtr self, ref PingLocation remoteLocation );
|
private static extern int _EstimatePingTimeFromLocalHost( IntPtr self, ref NetPingLocation remoteLocation );
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
internal int EstimatePingTimeFromLocalHost( ref PingLocation remoteLocation )
|
internal int EstimatePingTimeFromLocalHost( ref NetPingLocation remoteLocation )
|
||||||
{
|
{
|
||||||
var returnValue = _EstimatePingTimeFromLocalHost( Self, ref remoteLocation );
|
var returnValue = _EstimatePingTimeFromLocalHost( Self, ref remoteLocation );
|
||||||
return returnValue;
|
return returnValue;
|
||||||
@ -87,10 +87,10 @@ internal int EstimatePingTimeFromLocalHost( ref PingLocation remoteLocation )
|
|||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_ConvertPingLocationToString", CallingConvention = Platform.CC)]
|
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_ConvertPingLocationToString", CallingConvention = Platform.CC)]
|
||||||
private static extern void _ConvertPingLocationToString( IntPtr self, ref PingLocation location, IntPtr pszBuf, int cchBufSize );
|
private static extern void _ConvertPingLocationToString( IntPtr self, ref NetPingLocation location, IntPtr pszBuf, int cchBufSize );
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
internal void ConvertPingLocationToString( ref PingLocation location, out string pszBuf )
|
internal void ConvertPingLocationToString( ref NetPingLocation location, out string pszBuf )
|
||||||
{
|
{
|
||||||
IntPtr mempszBuf = Helpers.TakeMemory();
|
IntPtr mempszBuf = Helpers.TakeMemory();
|
||||||
_ConvertPingLocationToString( Self, ref location, mempszBuf, (1024 * 32) );
|
_ConvertPingLocationToString( Self, ref location, mempszBuf, (1024 * 32) );
|
||||||
@ -100,10 +100,10 @@ internal void ConvertPingLocationToString( ref PingLocation location, out string
|
|||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_ParsePingLocationString", CallingConvention = Platform.CC)]
|
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_ParsePingLocationString", CallingConvention = Platform.CC)]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[return: MarshalAs( UnmanagedType.I1 )]
|
||||||
private static extern bool _ParsePingLocationString( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszString, ref PingLocation result );
|
private static extern bool _ParsePingLocationString( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszString, ref NetPingLocation result );
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
internal bool ParsePingLocationString( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszString, ref PingLocation result )
|
internal bool ParsePingLocationString( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszString, ref NetPingLocation result )
|
||||||
{
|
{
|
||||||
var returnValue = _ParsePingLocationString( Self, pszString, ref result );
|
var returnValue = _ParsePingLocationString( Self, pszString, ref result );
|
||||||
return returnValue;
|
return returnValue;
|
||||||
@ -178,10 +178,10 @@ internal long GetLocalTimestamp()
|
|||||||
|
|
||||||
#region FunctionMeta
|
#region FunctionMeta
|
||||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_SetDebugOutputFunction", CallingConvention = Platform.CC)]
|
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamNetworkingUtils_SetDebugOutputFunction", CallingConvention = Platform.CC)]
|
||||||
private static extern void _SetDebugOutputFunction( IntPtr self, DebugOutputType eDetailLevel, FSteamNetworkingSocketsDebugOutput pfnFunc );
|
private static extern void _SetDebugOutputFunction( IntPtr self, DebugOutputType eDetailLevel, NetDebugFunc pfnFunc );
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
internal void SetDebugOutputFunction( DebugOutputType eDetailLevel, FSteamNetworkingSocketsDebugOutput pfnFunc )
|
internal void SetDebugOutputFunction( DebugOutputType eDetailLevel, NetDebugFunc pfnFunc )
|
||||||
{
|
{
|
||||||
_SetDebugOutputFunction( Self, eDetailLevel, pfnFunc );
|
_SetDebugOutputFunction( Self, eDetailLevel, pfnFunc );
|
||||||
}
|
}
|
||||||
|
@ -526,7 +526,7 @@ internal enum MarketNotAllowedReasonFlags : int
|
|||||||
//
|
//
|
||||||
// EDurationControlProgress
|
// EDurationControlProgress
|
||||||
//
|
//
|
||||||
internal enum DurationControlProgress : int
|
public enum DurationControlProgress : int
|
||||||
{
|
{
|
||||||
Progress_Full = 0,
|
Progress_Full = 0,
|
||||||
Progress_Half = 1,
|
Progress_Half = 1,
|
||||||
@ -1988,7 +1988,7 @@ public enum ConnectionState : int
|
|||||||
//
|
//
|
||||||
// ESteamNetConnectionEnd
|
// ESteamNetConnectionEnd
|
||||||
//
|
//
|
||||||
internal enum SteamNetConnectionEnd : int
|
public enum NetConnectionEnd : int
|
||||||
{
|
{
|
||||||
Invalid = 0,
|
Invalid = 0,
|
||||||
App_Min = 1000,
|
App_Min = 1000,
|
||||||
|
@ -178,6 +178,27 @@ internal struct SteamTVRegion_t
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
|
||||||
|
internal struct SteamNetworkingQuickConnectionStatus
|
||||||
|
{
|
||||||
|
internal ConnectionState State; // m_eState ESteamNetworkingConnectionState
|
||||||
|
internal int Ping; // m_nPing int
|
||||||
|
internal float ConnectionQualityLocal; // m_flConnectionQualityLocal float
|
||||||
|
internal float ConnectionQualityRemote; // m_flConnectionQualityRemote float
|
||||||
|
internal float OutPacketsPerSec; // m_flOutPacketsPerSec float
|
||||||
|
internal float OutBytesPerSec; // m_flOutBytesPerSec float
|
||||||
|
internal float InPacketsPerSec; // m_flInPacketsPerSec float
|
||||||
|
internal float InBytesPerSec; // m_flInBytesPerSec float
|
||||||
|
internal int SendRateBytesPerSecond; // m_nSendRateBytesPerSecond int
|
||||||
|
internal int CbPendingUnreliable; // m_cbPendingUnreliable int
|
||||||
|
internal int CbPendingReliable; // m_cbPendingReliable int
|
||||||
|
internal int CbSentUnackedReliable; // m_cbSentUnackedReliable int
|
||||||
|
internal long EcQueueTime; // m_usecQueueTime SteamNetworkingMicroseconds
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.U4)]
|
||||||
|
internal uint[] Reserved; // reserved uint32 [16]
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
|
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPlatformPackSize )]
|
||||||
internal struct SteamDatagramHostedAddress
|
internal struct SteamDatagramHostedAddress
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,14 @@
|
|||||||
|
|
||||||
namespace Steamworks.Data
|
namespace Steamworks.Data
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used as a base to create your client connection. This creates a socket
|
||||||
|
/// to a single connection.
|
||||||
|
///
|
||||||
|
/// You can override all the virtual functions to turn it into what you
|
||||||
|
/// want it to do.
|
||||||
|
/// </summary>
|
||||||
public struct Connection
|
public struct Connection
|
||||||
{
|
{
|
||||||
public uint Id { get; set; }
|
public uint Id { get; set; }
|
||||||
@ -83,10 +91,16 @@ public unsafe Result SendMessage( string str, SendType sendType = SendType.Relia
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Flush any messages waiting on the Nagle timer and send them at the next transmission opportunity (often that means right now).
|
/// Flush any messages waiting on the Nagle timer and send them at the next transmission
|
||||||
|
/// opportunity (often that means right now).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Result Flush() => SteamNetworkingSockets.Internal.FlushMessagesOnConnection( this );
|
public Result Flush() => SteamNetworkingSockets.Internal.FlushMessagesOnConnection( this );
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns detailed connection stats in text format. Useful
|
||||||
|
/// for dumping to a log, etc.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Plain text connection info</returns>
|
||||||
public string DetailedStatus()
|
public string DetailedStatus()
|
||||||
{
|
{
|
||||||
if ( SteamNetworkingSockets.Internal.GetDetailedConnectionStatus( this, out var strVal ) != 0 )
|
if ( SteamNetworkingSockets.Internal.GetDetailedConnectionStatus( this, out var strVal ) != 0 )
|
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
namespace Steamworks.Data
|
namespace Steamworks.Data
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Describe the state of a connection
|
||||||
|
/// </summary>
|
||||||
[StructLayout( LayoutKind.Sequential, Size = 696 )]
|
[StructLayout( LayoutKind.Sequential, Size = 696 )]
|
||||||
public struct ConnectionInfo
|
public struct ConnectionInfo
|
||||||
{
|
{
|
||||||
@ -19,8 +22,19 @@ public struct ConnectionInfo
|
|||||||
[MarshalAs( UnmanagedType.ByValTStr, SizeConst = 128 )]
|
[MarshalAs( UnmanagedType.ByValTStr, SizeConst = 128 )]
|
||||||
internal string connectionDescription;
|
internal string connectionDescription;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// High level state of the connection
|
||||||
|
/// </summary>
|
||||||
public ConnectionState State => state;
|
public ConnectionState State => state;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Who is on the other end? Depending on the connection type and phase of the connection, we might not know
|
||||||
|
/// </summary>
|
||||||
public SteamId SteamId => identity.steamID;
|
public SteamId SteamId => identity.steamID;
|
||||||
public int EndReason => endReason;
|
|
||||||
|
/// <summary>
|
||||||
|
/// Basic cause of the connection termination or problem.
|
||||||
|
/// </summary>
|
||||||
|
public NetConnectionEnd EndReason => (NetConnectionEnd)endReason;
|
||||||
}
|
}
|
||||||
}
|
}
|
8
Facepunch.Steamworks/Networking/NetDebugFunc.cs
Normal file
8
Facepunch.Steamworks/Networking/NetDebugFunc.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
using Steamworks.Data;
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Steamworks.Data
|
||||||
|
{
|
||||||
|
delegate void NetDebugFunc( DebugOutputType nType, string pszMsg );
|
||||||
|
}
|
@ -3,8 +3,7 @@
|
|||||||
|
|
||||||
namespace Steamworks.Data
|
namespace Steamworks.Data
|
||||||
{
|
{
|
||||||
|
internal unsafe struct NetErrorMessage
|
||||||
internal unsafe struct SteamNetworkingErrMsg
|
|
||||||
{
|
{
|
||||||
public fixed char Value[1024];
|
public fixed char Value[1024];
|
||||||
}
|
}
|
@ -20,11 +20,11 @@ namespace Steamworks.Data
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[StructLayout( LayoutKind.Explicit, Size = 512 )]
|
[StructLayout( LayoutKind.Explicit, Size = 512 )]
|
||||||
public struct PingLocation
|
public struct NetPingLocation
|
||||||
{
|
{
|
||||||
public static PingLocation? TryParseFromString( string str )
|
public static NetPingLocation? TryParseFromString( string str )
|
||||||
{
|
{
|
||||||
var result = default( PingLocation );
|
var result = default( NetPingLocation );
|
||||||
if ( !SteamNetworkingUtils.Internal.ParsePingLocationString( str, ref result ) )
|
if ( !SteamNetworkingUtils.Internal.ParsePingLocationString( str, ref result ) )
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ public override string ToString()
|
|||||||
///
|
///
|
||||||
/// Do you need to be able to do this from a backend/matchmaking server?
|
/// Do you need to be able to do this from a backend/matchmaking server?
|
||||||
/// You are looking for the "ticketgen" library.
|
/// You are looking for the "ticketgen" library.
|
||||||
public int EstimatePingTo( PingLocation target )
|
public int EstimatePingTo( NetPingLocation target )
|
||||||
{
|
{
|
||||||
return SteamNetworkingUtils.Internal.EstimatePingTimeBetweenTwoLocations( ref this, ref target );
|
return SteamNetworkingUtils.Internal.EstimatePingTimeBetweenTwoLocations( ref this, ref target );
|
||||||
}
|
}
|
@ -5,6 +5,13 @@
|
|||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Used as a base to create your networking server. This creates a socket
|
||||||
|
/// and listens/communicates with multiple queries.
|
||||||
|
///
|
||||||
|
/// You can override all the virtual functions to turn it into what you
|
||||||
|
/// want it to do.
|
||||||
|
/// </summary>
|
||||||
public class SocketInterface
|
public class SocketInterface
|
||||||
{
|
{
|
||||||
public List<Connection> Connecting = new List<Connection>();
|
public List<Connection> Connecting = new List<Connection>();
|
||||||
@ -87,7 +94,6 @@ public void Receive( int bufferSize = 32 )
|
|||||||
int processed = 0;
|
int processed = 0;
|
||||||
IntPtr messageBuffer = Marshal.AllocHGlobal( IntPtr.Size * bufferSize );
|
IntPtr messageBuffer = Marshal.AllocHGlobal( IntPtr.Size * bufferSize );
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
processed = SteamNetworkingSockets.Internal.ReceiveMessagesOnPollGroup( pollGroup, messageBuffer, bufferSize );
|
processed = SteamNetworkingSockets.Internal.ReceiveMessagesOnPollGroup( pollGroup, messageBuffer, bufferSize );
|
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Steamworks.Data
|
||||||
|
{
|
||||||
|
struct SteamDatagramRelayAuthTicket
|
||||||
|
{
|
||||||
|
// Not implemented, not used
|
||||||
|
};
|
||||||
|
}
|
@ -66,11 +66,11 @@ public static void InitRelayNetworkAccess()
|
|||||||
/// This always return the most up-to-date information we have available
|
/// This always return the most up-to-date information we have available
|
||||||
/// right now, even if we are in the middle of re-calculating ping times.
|
/// right now, even if we are in the middle of re-calculating ping times.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static PingLocation? LocalPingLocation
|
public static NetPingLocation? LocalPingLocation
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
PingLocation location = default;
|
NetPingLocation location = default;
|
||||||
var age = Internal.GetLocalPingLocation( ref location );
|
var age = Internal.GetLocalPingLocation( ref location );
|
||||||
if ( age < 0 )
|
if ( age < 0 )
|
||||||
return null;
|
return null;
|
||||||
@ -84,7 +84,7 @@ public static PingLocation? LocalPingLocation
|
|||||||
/// This is a bit faster, especially if you need to calculate a bunch of
|
/// This is a bit faster, especially if you need to calculate a bunch of
|
||||||
/// these in a loop to find the fastest one.
|
/// these in a loop to find the fastest one.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int EstimatePingTo( PingLocation target )
|
public static int EstimatePingTo( NetPingLocation target )
|
||||||
{
|
{
|
||||||
return Internal.EstimatePingTimeFromLocalHost( ref target );
|
return Internal.EstimatePingTimeFromLocalHost( ref target );
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,12 @@
|
|||||||
|
|
||||||
namespace Steamworks
|
namespace Steamworks
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This API can be used to selectively advertise your multiplayer game session in a Steam chat room group.
|
||||||
|
/// Tell Steam the number of player spots that are available for your party, and a join-game string, and it
|
||||||
|
/// will show a beacon in the selected group and allow that many users to “follow” the beacon to your party.
|
||||||
|
/// Adjust the number of open slots if other players join through alternate matchmaking methods.
|
||||||
|
/// </summary>
|
||||||
public class SteamParties : SteamClientClass<SteamParties>
|
public class SteamParties : SteamClientClass<SteamParties>
|
||||||
{
|
{
|
||||||
internal static ISteamParties Internal => Interface as ISteamParties;
|
internal static ISteamParties Internal => Interface as ISteamParties;
|
||||||
@ -17,7 +23,7 @@ internal override void InitializeInterface( bool server )
|
|||||||
InstallEvents( server );
|
InstallEvents( server );
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void InstallEvents( bool server )
|
internal void InstallEvents( bool server )
|
||||||
{
|
{
|
||||||
Dispatch.Install<AvailableBeaconLocationsUpdated_t>( x => OnBeaconLocationsUpdated?.Invoke(), server );
|
Dispatch.Install<AvailableBeaconLocationsUpdated_t>( x => OnBeaconLocationsUpdated?.Invoke(), server );
|
||||||
Dispatch.Install<ActiveBeaconsUpdated_t>( x => OnActiveBeaconsUpdated?.Invoke(), server );
|
Dispatch.Install<ActiveBeaconsUpdated_t>( x => OnActiveBeaconsUpdated?.Invoke(), server );
|
||||||
@ -49,18 +55,5 @@ public static IEnumerable<PartyBeacon> ActiveBeacons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Create a new party beacon and activate it in the selected location.
|
|
||||||
/// When people begin responding to your beacon, Steam will send you
|
|
||||||
/// OnPartyReservation callbacks to let you know who is on the way.
|
|
||||||
/// </summary>
|
|
||||||
//public async Task<PartyBeacon?> CreateBeacon( int slots, string connectString, string meta )
|
|
||||||
//{
|
|
||||||
// var result = await Internal.CreateBeacon( (uint)slots, null, connectString, meta );
|
|
||||||
// if ( !result.HasValue ) return null;
|
|
||||||
//}
|
|
||||||
|
|
||||||
// TODO - is this useful to anyone, or is it a load of shit?
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,35 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Steamworks.Data
|
|
||||||
{
|
|
||||||
delegate void FSteamNetworkingSocketsDebugOutput (DebugOutputType nType, string pszMsg );
|
|
||||||
|
|
||||||
[StructLayout( LayoutKind.Sequential )]
|
|
||||||
public struct SteamNetworkingQuickConnectionStatus
|
|
||||||
{
|
|
||||||
public ConnectionState state;
|
|
||||||
public int ping;
|
|
||||||
public float connectionQualityLocal;
|
|
||||||
public float connectionQualityRemote;
|
|
||||||
public float outPacketsPerSecond;
|
|
||||||
public float outBytesPerSecond;
|
|
||||||
public float inPacketsPerSecond;
|
|
||||||
public float inBytesPerSecond;
|
|
||||||
public int sendRateBytesPerSecond;
|
|
||||||
public int pendingUnreliable;
|
|
||||||
public int pendingReliable;
|
|
||||||
public int sentUnackedReliable;
|
|
||||||
public long queueTime;
|
|
||||||
|
|
||||||
[MarshalAs( UnmanagedType.ByValArray, SizeConst = 16 )]
|
|
||||||
uint[] reserved;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct SteamDatagramRelayAuthTicket
|
|
||||||
{
|
|
||||||
// Not implemented
|
|
||||||
};
|
|
||||||
}
|
|
@ -1,5 +1,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
#pragma warning disable 649
|
||||||
|
|
||||||
namespace Steamworks.Data
|
namespace Steamworks.Data
|
||||||
{
|
{
|
||||||
public struct Ugc
|
public struct Ugc
|
||||||
@ -7,3 +9,5 @@ public struct Ugc
|
|||||||
internal UGCHandle_t Handle;
|
internal UGCHandle_t Handle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma warning restore 649
|
||||||
|
@ -44,7 +44,9 @@ public IntPtr MarshalManagedToNative(object managedObj)
|
|||||||
|
|
||||||
internal struct Utf8StringPointer
|
internal struct Utf8StringPointer
|
||||||
{
|
{
|
||||||
|
#pragma warning disable 649
|
||||||
internal IntPtr ptr;
|
internal IntPtr ptr;
|
||||||
|
#pragma warning restore 649
|
||||||
|
|
||||||
public unsafe static implicit operator string( Utf8StringPointer p )
|
public unsafe static implicit operator string( Utf8StringPointer p )
|
||||||
{
|
{
|
||||||
|
@ -32,11 +32,14 @@ public static string ConvertType( string type )
|
|||||||
type = type.Replace( "SteamItemInstanceID_t", "InventoryItemId" );
|
type = type.Replace( "SteamItemInstanceID_t", "InventoryItemId" );
|
||||||
type = type.Replace( "SteamItemDef_t", "InventoryDefId" );
|
type = type.Replace( "SteamItemDef_t", "InventoryDefId" );
|
||||||
type = type.Replace( "ChatRoomEnterResponse", "RoomEnter" );
|
type = type.Replace( "ChatRoomEnterResponse", "RoomEnter" );
|
||||||
type = type.Replace( "SteamNetworkPingLocation_t", "PingLocation" );
|
type = type.Replace( "SteamNetworkPingLocation_t", "NetPingLocation" );
|
||||||
type = type.Replace( "SteamNetworkingConfigValue_t", "NetKeyValue" );
|
type = type.Replace( "SteamNetworkingConfigValue_t", "NetKeyValue" );
|
||||||
type = type.Replace( "SteamNetworkingConfigValue", "NetConfig" );
|
type = type.Replace( "SteamNetworkingConfigValue", "NetConfig" );
|
||||||
type = type.Replace( "SteamNetworkingConfigScope", "NetConfigScope" );
|
type = type.Replace( "SteamNetworkingConfigScope", "NetConfigScope" );
|
||||||
type = type.Replace( "SteamNetworkingConfigDataType", "NetConfigType" );
|
type = type.Replace( "SteamNetworkingConfigDataType", "NetConfigType" );
|
||||||
|
type = type.Replace( "FSteamNetworkingSocketsDebugOutput", "NetDebugFunc" );
|
||||||
|
type = type.Replace( "SteamNetworkingErrMsg", "NetErrorMessage" );
|
||||||
|
type = type.Replace( "SteamNetConnectionEnd", "NetConnectionEnd" );
|
||||||
type = type.Replace( "HSteamNetConnection", "Connection" );
|
type = type.Replace( "HSteamNetConnection", "Connection" );
|
||||||
type = type.Replace( "HSteamListenSocket", "Socket" );
|
type = type.Replace( "HSteamListenSocket", "Socket" );
|
||||||
type = type.Replace( "SteamNetworkingIPAddr", "NetAddress" );
|
type = type.Replace( "SteamNetworkingIPAddr", "NetAddress" );
|
||||||
@ -77,18 +80,17 @@ public static bool ShouldCreate( string type )
|
|||||||
if ( type == "Connection" ) return false;
|
if ( type == "Connection" ) return false;
|
||||||
if ( type == "Socket" ) return false;
|
if ( type == "Socket" ) return false;
|
||||||
if ( type == "SteamNetworkingMicroseconds" ) return false;
|
if ( type == "SteamNetworkingMicroseconds" ) return false;
|
||||||
if ( type == "FSteamNetworkingSocketsDebugOutput" ) return false;
|
if ( type == "NetDebugFunc" ) return false;
|
||||||
if ( type == "NetMsg" ) return false;
|
if ( type == "NetMsg" ) return false;
|
||||||
if ( type == "SteamDatagramErrMsg" ) return false;
|
if ( type == "SteamDatagramErrMsg" ) return false;
|
||||||
if ( type == "ConnectionInfo" ) return false;
|
if ( type == "ConnectionInfo" ) return false;
|
||||||
if ( type == "SteamNetworkingIPAddr" ) return false;
|
if ( type == "SteamNetworkingIPAddr" ) return false;
|
||||||
if ( type == "NetAddress" ) return false;
|
if ( type == "NetAddress" ) return false;
|
||||||
if ( type == "NetIdentity" ) return false;
|
if ( type == "NetIdentity" ) return false;
|
||||||
if ( type == "SteamNetworkingQuickConnectionStatus" ) return false;
|
|
||||||
if ( type == "SteamNetworkingErrMsg" ) return false;
|
if ( type == "SteamNetworkingErrMsg" ) return false;
|
||||||
if ( type == "NetKeyValue" ) return false;
|
if ( type == "NetKeyValue" ) return false;
|
||||||
if ( type == "SteamIPAddress" ) return false;
|
if ( type == "SteamIPAddress" ) return false;
|
||||||
if ( type == "PingLocation" ) return false;
|
if ( type == "NetPingLocation" ) return false;
|
||||||
if ( type == "CSteamID" ) return false;
|
if ( type == "CSteamID" ) return false;
|
||||||
if ( type == "CSteamAPIContext" ) return false;
|
if ( type == "CSteamAPIContext" ) return false;
|
||||||
if ( type == "CCallResult" ) return false;
|
if ( type == "CCallResult" ) return false;
|
||||||
@ -126,11 +128,12 @@ internal static string Expose( string name )
|
|||||||
if ( name == "InputType" ) return "public";
|
if ( name == "InputType" ) return "public";
|
||||||
if ( name == "InputSourceMode" ) return "public";
|
if ( name == "InputSourceMode" ) return "public";
|
||||||
if ( name == "UserHasLicenseForAppResult" ) return "public";
|
if ( name == "UserHasLicenseForAppResult" ) return "public";
|
||||||
if ( name == "PingLocation" ) return "public";
|
if ( name == "NetPingLocation" ) return "public";
|
||||||
if ( name == "ConnectionState" ) return "public";
|
if ( name == "ConnectionState" ) return "public";
|
||||||
if ( name == "SteamNetworkingAvailability" ) return "public";
|
if ( name == "SteamNetworkingAvailability" ) return "public";
|
||||||
if ( name == "SteamDeviceFormFactor" ) return "public";
|
if ( name == "SteamDeviceFormFactor" ) return "public";
|
||||||
if ( name == "DurationControlProgress" ) return "public";
|
if ( name == "DurationControlProgress" ) return "public";
|
||||||
|
if ( name == "NetConnectionEnd" ) return "public";
|
||||||
|
|
||||||
return "internal";
|
return "internal";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user