This commit is contained in:
Jake Rich 2024-08-12 21:30:05 -04:00
parent 6dd32eb5c4
commit 09db39d9e3
36 changed files with 37 additions and 57 deletions

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamAppList : SteamInterface internal unsafe partial class ISteamAppList : SteamInterface
{ {
internal ISteamAppList( bool IsGameServer ) internal ISteamAppList( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamApps : SteamInterface internal unsafe partial class ISteamApps : SteamInterface
{ {
internal ISteamApps( bool IsGameServer ) internal ISteamApps( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamClient : SteamInterface internal unsafe partial class ISteamClient : SteamInterface
{ {
internal ISteamClient( bool IsGameServer ) internal ISteamClient( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamController : SteamInterface internal unsafe partial class ISteamController : SteamInterface
{ {
internal ISteamController( bool IsGameServer ) internal ISteamController( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamFriends : SteamInterface internal unsafe partial class ISteamFriends : SteamInterface
{ {
internal ISteamFriends( bool IsGameServer ) internal ISteamFriends( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamGameSearch : SteamInterface internal unsafe partial class ISteamGameSearch : SteamInterface
{ {
internal ISteamGameSearch( bool IsGameServer ) internal ISteamGameSearch( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamGameServer : SteamInterface internal unsafe partial class ISteamGameServer : SteamInterface
{ {
internal ISteamGameServer( bool IsGameServer ) internal ISteamGameServer( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamGameServerStats : SteamInterface internal unsafe partial class ISteamGameServerStats : SteamInterface
{ {
internal ISteamGameServerStats( bool IsGameServer ) internal ISteamGameServerStats( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamHTMLSurface : SteamInterface internal unsafe partial class ISteamHTMLSurface : SteamInterface
{ {
internal ISteamHTMLSurface( bool IsGameServer ) internal ISteamHTMLSurface( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamHTTP : SteamInterface internal unsafe partial class ISteamHTTP : SteamInterface
{ {
internal ISteamHTTP( bool IsGameServer ) internal ISteamHTTP( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamInput : SteamInterface internal unsafe partial class ISteamInput : SteamInterface
{ {
internal ISteamInput( bool IsGameServer ) internal ISteamInput( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamInventory : SteamInterface internal unsafe partial class ISteamInventory : SteamInterface
{ {
internal ISteamInventory( bool IsGameServer ) internal ISteamInventory( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamMatchmaking : SteamInterface internal unsafe partial class ISteamMatchmaking : SteamInterface
{ {
internal ISteamMatchmaking( bool IsGameServer ) internal ISteamMatchmaking( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamMatchmakingPingResponse : SteamInterface internal unsafe partial class ISteamMatchmakingPingResponse : SteamInterface
{ {
internal ISteamMatchmakingPingResponse( bool IsGameServer ) internal ISteamMatchmakingPingResponse( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamMatchmakingPlayersResponse : SteamInterface internal unsafe partial class ISteamMatchmakingPlayersResponse : SteamInterface
{ {
internal ISteamMatchmakingPlayersResponse( bool IsGameServer ) internal ISteamMatchmakingPlayersResponse( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamMatchmakingRulesResponse : SteamInterface internal unsafe partial class ISteamMatchmakingRulesResponse : SteamInterface
{ {
internal ISteamMatchmakingRulesResponse( bool IsGameServer ) internal ISteamMatchmakingRulesResponse( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamMatchmakingServerListResponse : SteamInterface internal unsafe partial class ISteamMatchmakingServerListResponse : SteamInterface
{ {
internal ISteamMatchmakingServerListResponse( bool IsGameServer ) internal ISteamMatchmakingServerListResponse( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamMatchmakingServers : SteamInterface internal unsafe partial class ISteamMatchmakingServers : SteamInterface
{ {
internal ISteamMatchmakingServers( bool IsGameServer ) internal ISteamMatchmakingServers( bool IsGameServer )
@ -106,24 +106,7 @@ namespace Steamworks
var returnValue = _GetServerDetails( Self, hRequest, iServer ); var returnValue = _GetServerDetails( Self, hRequest, iServer );
return returnValue.ToType<gameserveritem_t>(); return returnValue.ToType<gameserveritem_t>();
} }
/// <summary>
/// Read gameserveritem_t.m_bHadSuccessfulResponse without allocating the struct on the heap
/// </summary>
/// <param name="hRequest"></param>
/// <param name="iServer"></param>
/// <returns></returns>
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;
}
#region FunctionMeta #region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamMatchmakingServers_CancelQuery", CallingConvention = Platform.CC)] [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamMatchmakingServers_CancelQuery", CallingConvention = Platform.CC)]
private static extern void _CancelQuery( IntPtr self, HServerListRequest hRequest ); private static extern void _CancelQuery( IntPtr self, HServerListRequest hRequest );

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamMusic : SteamInterface internal unsafe partial class ISteamMusic : SteamInterface
{ {
internal ISteamMusic( bool IsGameServer ) internal ISteamMusic( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamMusicRemote : SteamInterface internal unsafe partial class ISteamMusicRemote : SteamInterface
{ {
internal ISteamMusicRemote( bool IsGameServer ) internal ISteamMusicRemote( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamNetworking : SteamInterface internal unsafe partial class ISteamNetworking : SteamInterface
{ {
internal ISteamNetworking( bool IsGameServer ) internal ISteamNetworking( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamNetworkingFakeUDPPort : SteamInterface internal unsafe partial class ISteamNetworkingFakeUDPPort : SteamInterface
{ {
internal ISteamNetworkingFakeUDPPort( bool IsGameServer ) internal ISteamNetworkingFakeUDPPort( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamNetworkingMessages : SteamInterface internal unsafe partial class ISteamNetworkingMessages : SteamInterface
{ {
internal ISteamNetworkingMessages( bool IsGameServer ) internal ISteamNetworkingMessages( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamNetworkingSockets : SteamInterface internal unsafe partial class ISteamNetworkingSockets : SteamInterface
{ {
internal ISteamNetworkingSockets( bool IsGameServer ) internal ISteamNetworkingSockets( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamNetworkingUtils : SteamInterface internal unsafe partial class ISteamNetworkingUtils : SteamInterface
{ {
internal ISteamNetworkingUtils( bool IsGameServer ) internal ISteamNetworkingUtils( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamParentalSettings : SteamInterface internal unsafe partial class ISteamParentalSettings : SteamInterface
{ {
internal ISteamParentalSettings( bool IsGameServer ) internal ISteamParentalSettings( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamParties : SteamInterface internal unsafe partial class ISteamParties : SteamInterface
{ {
internal ISteamParties( bool IsGameServer ) internal ISteamParties( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamRemotePlay : SteamInterface internal unsafe partial class ISteamRemotePlay : SteamInterface
{ {
internal ISteamRemotePlay( bool IsGameServer ) internal ISteamRemotePlay( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamRemoteStorage : SteamInterface internal unsafe partial class ISteamRemoteStorage : SteamInterface
{ {
internal ISteamRemoteStorage( bool IsGameServer ) internal ISteamRemoteStorage( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamScreenshots : SteamInterface internal unsafe partial class ISteamScreenshots : SteamInterface
{ {
internal ISteamScreenshots( bool IsGameServer ) internal ISteamScreenshots( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamUGC : SteamInterface internal unsafe partial class ISteamUGC : SteamInterface
{ {
internal ISteamUGC( bool IsGameServer ) internal ISteamUGC( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamUser : SteamInterface internal unsafe partial class ISteamUser : SteamInterface
{ {
internal ISteamUser( bool IsGameServer ) internal ISteamUser( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamUserStats : SteamInterface internal unsafe partial class ISteamUserStats : SteamInterface
{ {
internal ISteamUserStats( bool IsGameServer ) internal ISteamUserStats( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamUtils : SteamInterface internal unsafe partial class ISteamUtils : SteamInterface
{ {
internal ISteamUtils( bool IsGameServer ) internal ISteamUtils( bool IsGameServer )

View File

@ -7,7 +7,7 @@ using Steamworks.Data;
namespace Steamworks namespace Steamworks
{ {
internal unsafe class ISteamVideo : SteamInterface internal unsafe partial class ISteamVideo : SteamInterface
{ {
internal ISteamVideo( bool IsGameServer ) internal ISteamVideo( bool IsGameServer )

View File

@ -25,17 +25,14 @@ namespace Steamworks.Data
internal uint IP; // m_unIP uint32 internal uint IP; // m_unIP uint32
} }
[StructLayout( LayoutKind.Sequential, Pack = Platform.StructPackSize )] [StructLayout( LayoutKind.Sequential, Pack = Platform.StructPackSize )]
internal partial struct gameserveritem_t internal partial struct gameserveritem_t
{ {
internal servernetadr_t NetAdr; // m_NetAdr servernetadr_t internal servernetadr_t NetAdr; // m_NetAdr servernetadr_t
internal int Ping; // m_nPing int internal int Ping; // m_nPing int
// NOTE: If you add fields above this you must change offset inISteamMatchmakingServers.HasServerResponded()
[MarshalAs(UnmanagedType.I1)] [MarshalAs(UnmanagedType.I1)]
internal bool HadSuccessfulResponse; // m_bHadSuccessfulResponse bool internal bool HadSuccessfulResponse; // m_bHadSuccessfulResponse bool
[MarshalAs(UnmanagedType.I1)] [MarshalAs(UnmanagedType.I1)]
internal bool DoNotRefresh; // m_bDoNotRefresh bool internal bool DoNotRefresh; // m_bDoNotRefresh bool
internal string GameDirUTF8() => System.Text.Encoding.UTF8.GetString( GameDir, 0, System.Array.IndexOf<byte>( GameDir, 0 ) ); internal string GameDirUTF8() => System.Text.Encoding.UTF8.GetString( GameDir, 0, System.Array.IndexOf<byte>( GameDir, 0 ) );