diff --git a/Facepunch.Steamworks/Interfaces/ISteamMatchmakingServers.cs b/Facepunch.Steamworks/Interfaces/ISteamMatchmakingServers.cs new file mode 100644 index 0000000..3f555e7 --- /dev/null +++ b/Facepunch.Steamworks/Interfaces/ISteamMatchmakingServers.cs @@ -0,0 +1,28 @@ +using Steamworks.Data; +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Text; + +namespace Steamworks +{ + internal partial class ISteamMatchmakingServers + { + /// + /// Read gameserveritem_t.m_bHadSuccessfulResponse without allocating the struct on the heap + /// + /// + /// + /// + internal bool HasServerResponded( HServerListRequest hRequest, int iServer ) + { + IntPtr returnValue = _GetServerDetails( Self, hRequest, iServer ); + + // Return false if steam returned null + if ( returnValue == IntPtr.Zero ) return false; + + // first 8 bytes is IPAddress, next 4 bytes is ping, next 1 byte is m_bHadSuccessfulResponse + return Marshal.ReadByte( IntPtr.Add( returnValue, 12 ) ) == 1; + } + } +}