Skip to content

Commit

Permalink
Upgrade to Steamworks 1.61
Browse files Browse the repository at this point in the history
WIP due to server list crashing for some reason
  • Loading branch information
Rohansi committed Dec 13, 2024
1 parent de10d5c commit 3b58a3d
Show file tree
Hide file tree
Showing 98 changed files with 1,868 additions and 827 deletions.
Binary file modified Facepunch.Steamworks.Test/steam_api.dll
Binary file not shown.
Binary file modified Facepunch.Steamworks.Test/steam_api64.dll
Binary file not shown.
13 changes: 8 additions & 5 deletions Facepunch.Steamworks/Classes/SteamApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ internal static class SteamAPI
{
internal static class Native
{
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_Init", CallingConvention = CallingConvention.Cdecl )]
[return: MarshalAs( UnmanagedType.I1 )]
public static extern bool SteamAPI_Init();
[DllImport( Platform.LibraryName, EntryPoint = "SteamInternal_SteamAPI_Init", CallingConvention = CallingConvention.Cdecl )]
public static extern SteamAPIInitResult SteamInternal_SteamAPI_Init( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszInternalCheckInterfaceVersions, IntPtr pOutErrMsg );

[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_Shutdown", CallingConvention = CallingConvention.Cdecl )]
public static extern void SteamAPI_Shutdown();
Expand All @@ -26,9 +25,13 @@ internal static class Native
public static extern bool SteamAPI_RestartAppIfNecessary( uint unOwnAppID );

}
static internal bool Init()

static internal SteamAPIInitResult Init( string pszInternalCheckInterfaceVersions, out string pOutErrMsg )
{
return Native.SteamAPI_Init();
using var buffer = Helpers.Memory.Take();
var result = Native.SteamInternal_SteamAPI_Init( pszInternalCheckInterfaceVersions, buffer.Ptr );
pOutErrMsg = Helpers.MemoryToString( buffer.Ptr );
return result;
}

static internal void Shutdown()
Expand Down
12 changes: 7 additions & 5 deletions Facepunch.Steamworks/Classes/SteamInternal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ internal static class SteamInternal
{
internal static class Native
{
[DllImport( Platform.LibraryName, EntryPoint = "SteamInternal_GameServer_Init", CallingConvention = CallingConvention.Cdecl )]
[return: MarshalAs( UnmanagedType.I1 )]
public static extern bool SteamInternal_GameServer_Init( uint unIP, ushort usPort, ushort usGamePort, ushort usQueryPort, int eServerMode, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchVersionString );
[DllImport( Platform.LibraryName, EntryPoint = "SteamInternal_GameServer_Init_V2", CallingConvention = CallingConvention.Cdecl )]
public static extern SteamAPIInitResult SteamInternal_GameServer_Init_V2( uint unIP, ushort usGamePort, ushort usQueryPort, int eServerMode, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchVersionString, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszInternalCheckInterfaceVersions, IntPtr pOutErrMsg );
}

static internal bool GameServer_Init( uint unIP, ushort usPort, ushort usGamePort, ushort usQueryPort, int eServerMode, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchVersionString )
static internal SteamAPIInitResult GameServer_Init( uint unIP, ushort usGamePort, ushort usQueryPort, int eServerMode, string pchVersionString, string pszInternalCheckInterfaceVersions, out string pOutErrMsg )
{
return Native.SteamInternal_GameServer_Init( unIP, usPort, usGamePort, usQueryPort, eServerMode, pchVersionString );
using var buffer = Helpers.Memory.Take();
var result = Native.SteamInternal_GameServer_Init_V2( unIP, usGamePort, usQueryPort, eServerMode, pchVersionString, pszInternalCheckInterfaceVersions, buffer.Ptr );
pOutErrMsg = Helpers.MemoryToString( buffer.Ptr );
return result;
}
}
}
12 changes: 8 additions & 4 deletions Facepunch.Steamworks/Generated/CustomEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ public enum CallbackType
DeleteItemResult = 3417,
UserSubscribedItemsListChanged = 3418,
WorkshopEULAStatus = 3420,
SteamAppInstalled = 3901,
SteamAppUninstalled = 3902,
PlaybackStatusHasChanged = 4001,
VolumeHasChanged = 4002,
MusicPlayerWantsVolume = 4011,
Expand Down Expand Up @@ -200,6 +198,8 @@ public enum CallbackType
HTML_UpdateToolTip = 4525,
HTML_HideToolTip = 4526,
HTML_BrowserRestarted = 4527,
BroadcastUploadStart = 4604,
BroadcastUploadStop = 4605,
GetVideoURLResult = 4611,
GetOPFSettingsResult = 4624,
SteamInventoryResultReady = 4700,
Expand All @@ -225,6 +225,8 @@ public enum CallbackType
SteamRemotePlaySessionConnected = 5701,
SteamRemotePlaySessionDisconnected = 5702,
SteamRemotePlayTogetherGuestInvite = 5703,
SteamTimelineGamePhaseRecordingExists = 6001,
SteamTimelineEventRecordingExists = 6002,
}
internal static partial class CallbackTypeFactory
{
Expand Down Expand Up @@ -379,8 +381,6 @@ internal static partial class CallbackTypeFactory
{ CallbackType.DeleteItemResult, typeof( DeleteItemResult_t )},
{ CallbackType.UserSubscribedItemsListChanged, typeof( UserSubscribedItemsListChanged_t )},
{ CallbackType.WorkshopEULAStatus, typeof( WorkshopEULAStatus_t )},
{ CallbackType.SteamAppInstalled, typeof( SteamAppInstalled_t )},
{ CallbackType.SteamAppUninstalled, typeof( SteamAppUninstalled_t )},
{ CallbackType.PlaybackStatusHasChanged, typeof( PlaybackStatusHasChanged_t )},
{ CallbackType.VolumeHasChanged, typeof( VolumeHasChanged_t )},
{ CallbackType.MusicPlayerWantsVolume, typeof( MusicPlayerWantsVolume_t )},
Expand Down Expand Up @@ -420,6 +420,8 @@ internal static partial class CallbackTypeFactory
{ CallbackType.HTML_UpdateToolTip, typeof( HTML_UpdateToolTip_t )},
{ CallbackType.HTML_HideToolTip, typeof( HTML_HideToolTip_t )},
{ CallbackType.HTML_BrowserRestarted, typeof( HTML_BrowserRestarted_t )},
{ CallbackType.BroadcastUploadStart, typeof( BroadcastUploadStart_t )},
{ CallbackType.BroadcastUploadStop, typeof( BroadcastUploadStop_t )},
{ CallbackType.GetVideoURLResult, typeof( GetVideoURLResult_t )},
{ CallbackType.GetOPFSettingsResult, typeof( GetOPFSettingsResult_t )},
{ CallbackType.SteamInventoryResultReady, typeof( SteamInventoryResultReady_t )},
Expand All @@ -445,6 +447,8 @@ internal static partial class CallbackTypeFactory
{ CallbackType.SteamRemotePlaySessionConnected, typeof( SteamRemotePlaySessionConnected_t )},
{ CallbackType.SteamRemotePlaySessionDisconnected, typeof( SteamRemotePlaySessionDisconnected_t )},
{ CallbackType.SteamRemotePlayTogetherGuestInvite, typeof( SteamRemotePlayTogetherGuestInvite_t )},
{ CallbackType.SteamTimelineGamePhaseRecordingExists, typeof( SteamTimelineGamePhaseRecordingExists_t )},
{ CallbackType.SteamTimelineEventRecordingExists, typeof( SteamTimelineEventRecordingExists_t )},
};
}
}
40 changes: 40 additions & 0 deletions Facepunch.Steamworks/Generated/Interfaces/ISteamApps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Steamworks
{
internal unsafe partial class ISteamApps : SteamInterface
{
public const string Version = "STEAMAPPS_INTERFACE_VERSION008";

internal ISteamApps( bool IsGameServer )
{
Expand Down Expand Up @@ -369,5 +370,44 @@ internal bool SetDlcContext( AppId nAppID )
return returnValue;
}

#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamApps_GetNumBetas", CallingConvention = Platform.CC)]
private static extern int _GetNumBetas( IntPtr self, ref int pnAvailable, ref int pnPrivate );

#endregion
internal int GetNumBetas( ref int pnAvailable, ref int pnPrivate )
{
var returnValue = _GetNumBetas( Self, ref pnAvailable, ref pnPrivate );
return returnValue;
}

#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamApps_GetBetaInfo", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _GetBetaInfo( IntPtr self, int iBetaIndex, ref uint punFlags, ref uint punBuildID, IntPtr pchBetaName, int cchBetaName, IntPtr pchDescription, int cchDescription );

#endregion
internal bool GetBetaInfo( int iBetaIndex, ref uint punFlags, ref uint punBuildID, out string pchBetaName, out string pchDescription )
{
using var mempchBetaName = Helpers.TakeMemory();
using var mempchDescription = Helpers.TakeMemory();
var returnValue = _GetBetaInfo( Self, iBetaIndex, ref punFlags, ref punBuildID, mempchBetaName, (1024 * 32), mempchDescription, (1024 * 32) );
pchBetaName = Helpers.MemoryToString( mempchBetaName );
pchDescription = Helpers.MemoryToString( mempchDescription );
return returnValue;
}

#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamApps_SetActiveBeta", CallingConvention = Platform.CC)]
[return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _SetActiveBeta( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchBetaName );

#endregion
internal bool SetActiveBeta( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchBetaName )
{
var returnValue = _SetActiveBeta( Self, pchBetaName );
return returnValue;
}

}
}
12 changes: 0 additions & 12 deletions Facepunch.Steamworks/Generated/Interfaces/ISteamClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace Steamworks
{
internal unsafe partial class ISteamClient : SteamInterface
{

internal ISteamClient( bool IsGameServer )
{
SetupInterface( IsGameServer );
Expand Down Expand Up @@ -300,17 +299,6 @@ internal IntPtr GetISteamUGC( HSteamUser hSteamUser, HSteamPipe hSteamPipe, [Mar
return returnValue;
}

#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamClient_GetISteamAppList", CallingConvention = Platform.CC)]
private static extern IntPtr _GetISteamAppList( IntPtr self, HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchVersion );

#endregion
internal IntPtr GetISteamAppList( HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchVersion )
{
var returnValue = _GetISteamAppList( Self, hSteamUser, hSteamPipe, pchVersion );
return returnValue;
}

#region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamClient_GetISteamMusic", CallingConvention = Platform.CC)]
private static extern IntPtr _GetISteamMusic( IntPtr self, HSteamUser hSteamuser, HSteamPipe hSteamPipe, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchVersion );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Steamworks
{
internal unsafe partial class ISteamController : SteamInterface
{
public const string Version = "SteamController008";

internal ISteamController( bool IsGameServer )
{
Expand Down
1 change: 1 addition & 0 deletions Facepunch.Steamworks/Generated/Interfaces/ISteamFriends.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Steamworks
{
internal unsafe partial class ISteamFriends : SteamInterface
{
public const string Version = "SteamFriends017";

internal ISteamFriends( bool IsGameServer )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Steamworks
{
internal unsafe partial class ISteamGameSearch : SteamInterface
{
public const string Version = "SteamMatchGameSearch001";

internal ISteamGameSearch( bool IsGameServer )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Steamworks
{
internal unsafe partial class ISteamGameServer : SteamInterface
{
public const string Version = "SteamGameServer015";

internal ISteamGameServer( bool IsGameServer )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Steamworks
{
internal unsafe partial class ISteamGameServerStats : SteamInterface
{
public const string Version = "SteamGameServerStats001";

internal ISteamGameServerStats( bool IsGameServer )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Steamworks
{
internal unsafe partial class ISteamHTMLSurface : SteamInterface
{
public const string Version = "STEAMHTMLSURFACE_INTERFACE_VERSION_005";

internal ISteamHTMLSurface( bool IsGameServer )
{
Expand Down
1 change: 1 addition & 0 deletions Facepunch.Steamworks/Generated/Interfaces/ISteamHTTP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Steamworks
{
internal unsafe partial class ISteamHTTP : SteamInterface
{
public const string Version = "STEAMHTTP_INTERFACE_VERSION003";

internal ISteamHTTP( bool IsGameServer )
{
Expand Down
1 change: 1 addition & 0 deletions Facepunch.Steamworks/Generated/Interfaces/ISteamInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Steamworks
{
internal unsafe partial class ISteamInput : SteamInterface
{
public const string Version = "SteamInput006";

internal ISteamInput( bool IsGameServer )
{
Expand Down
11 changes: 7 additions & 4 deletions Facepunch.Steamworks/Generated/Interfaces/ISteamInventory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Steamworks
{
internal unsafe partial class ISteamInventory : SteamInterface
{
public const string Version = "STEAMINVENTORY_INTERFACE_V003";

internal ISteamInventory( bool IsGameServer )
{
Expand Down Expand Up @@ -52,10 +53,11 @@ internal bool GetResultItems( SteamInventoryResult_t resultHandle, [In,Out] Stea
private static extern bool _GetResultItemProperty( IntPtr self, SteamInventoryResult_t resultHandle, uint unItemIndex, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPropertyName, IntPtr pchValueBuffer, ref uint punValueBufferSizeOut );

#endregion
internal bool GetResultItemProperty( SteamInventoryResult_t resultHandle, uint unItemIndex, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPropertyName, out string pchValueBuffer, ref uint punValueBufferSizeOut )
internal bool GetResultItemProperty( SteamInventoryResult_t resultHandle, uint unItemIndex, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPropertyName, out string pchValueBuffer )
{
using var mempchValueBuffer = Helpers.TakeMemory();
var returnValue = _GetResultItemProperty( Self, resultHandle, unItemIndex, pchPropertyName, mempchValueBuffer, ref punValueBufferSizeOut );
uint szpunValueBufferSizeOut = (1024 * 32);
var returnValue = _GetResultItemProperty( Self, resultHandle, unItemIndex, pchPropertyName, mempchValueBuffer, ref szpunValueBufferSizeOut );
pchValueBuffer = Helpers.MemoryToString( mempchValueBuffer );
return returnValue;
}
Expand Down Expand Up @@ -289,10 +291,11 @@ internal bool GetItemDefinitionIDs( [In,Out] InventoryDefId[] pItemDefIDs, ref
private static extern bool _GetItemDefinitionProperty( IntPtr self, InventoryDefId iDefinition, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPropertyName, IntPtr pchValueBuffer, ref uint punValueBufferSizeOut );

#endregion
internal bool GetItemDefinitionProperty( InventoryDefId iDefinition, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPropertyName, out string pchValueBuffer, ref uint punValueBufferSizeOut )
internal bool GetItemDefinitionProperty( InventoryDefId iDefinition, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPropertyName, out string pchValueBuffer )
{
using var mempchValueBuffer = Helpers.TakeMemory();
var returnValue = _GetItemDefinitionProperty( Self, iDefinition, pchPropertyName, mempchValueBuffer, ref punValueBufferSizeOut );
uint szpunValueBufferSizeOut = (1024 * 32);
var returnValue = _GetItemDefinitionProperty( Self, iDefinition, pchPropertyName, mempchValueBuffer, ref szpunValueBufferSizeOut );
pchValueBuffer = Helpers.MemoryToString( mempchValueBuffer );
return returnValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Steamworks
{
internal unsafe partial class ISteamMatchmaking : SteamInterface
{
public const string Version = "SteamMatchMaking009";

internal ISteamMatchmaking( bool IsGameServer )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace Steamworks
{
internal unsafe partial class ISteamMatchmakingPingResponse : SteamInterface
{

internal ISteamMatchmakingPingResponse( bool IsGameServer )
{
SetupInterface( IsGameServer );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace Steamworks
{
internal unsafe partial class ISteamMatchmakingPlayersResponse : SteamInterface
{

internal ISteamMatchmakingPlayersResponse( bool IsGameServer )
{
SetupInterface( IsGameServer );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace Steamworks
{
internal unsafe partial class ISteamMatchmakingRulesResponse : SteamInterface
{

internal ISteamMatchmakingRulesResponse( bool IsGameServer )
{
SetupInterface( IsGameServer );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace Steamworks
{
internal unsafe partial class ISteamMatchmakingServerListResponse : SteamInterface
{

internal ISteamMatchmakingServerListResponse( bool IsGameServer )
{
SetupInterface( IsGameServer );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Steamworks
{
internal unsafe partial class ISteamMatchmakingServers : SteamInterface
{
public const string Version = "SteamMatchMakingServers002";

internal ISteamMatchmakingServers( bool IsGameServer )
{
Expand Down
1 change: 1 addition & 0 deletions Facepunch.Steamworks/Generated/Interfaces/ISteamMusic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Steamworks
{
internal unsafe partial class ISteamMusic : SteamInterface
{
public const string Version = "STEAMMUSIC_INTERFACE_VERSION001";

internal ISteamMusic( bool IsGameServer )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Steamworks
{
internal unsafe partial class ISteamMusicRemote : SteamInterface
{
public const string Version = "STEAMMUSICREMOTE_INTERFACE_VERSION001";

internal ISteamMusicRemote( bool IsGameServer )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Steamworks
{
internal unsafe partial class ISteamNetworking : SteamInterface
{
public const string Version = "SteamNetworking006";

internal ISteamNetworking( bool IsGameServer )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace Steamworks
{
internal unsafe partial class ISteamNetworkingFakeUDPPort : SteamInterface
{

internal ISteamNetworkingFakeUDPPort( bool IsGameServer )
{
SetupInterface( IsGameServer );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Steamworks
{
internal unsafe partial class ISteamNetworkingMessages : SteamInterface
{
public const string Version = "SteamNetworkingMessages002";

internal ISteamNetworkingMessages( bool IsGameServer )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Steamworks
{
internal unsafe partial class ISteamNetworkingSockets : SteamInterface
{
public const string Version = "SteamNetworkingSockets012";

internal ISteamNetworkingSockets( bool IsGameServer )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Steamworks
{
internal unsafe partial class ISteamNetworkingUtils : SteamInterface
{
public const string Version = "SteamNetworkingUtils004";

internal ISteamNetworkingUtils( bool IsGameServer )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Steamworks
{
internal unsafe partial class ISteamParentalSettings : SteamInterface
{
public const string Version = "STEAMPARENTALSETTINGS_INTERFACE_VERSION001";

internal ISteamParentalSettings( bool IsGameServer )
{
Expand Down
Loading

0 comments on commit 3b58a3d

Please sign in to comment.