diff --git a/Facepunch.Steamworks/Callbacks/Events.cs b/Facepunch.Steamworks/Callbacks/Event.cs
similarity index 100%
rename from Facepunch.Steamworks/Callbacks/Events.cs
rename to Facepunch.Steamworks/Callbacks/Event.cs
diff --git a/Facepunch.Steamworks/Callbacks/ISteamCallback.cs b/Facepunch.Steamworks/Callbacks/ISteamCallback.cs
deleted file mode 100644
index 33e296a..0000000
--- a/Facepunch.Steamworks/Callbacks/ISteamCallback.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System;
-
-namespace Steamworks
-{
- public interface ISteamCallback
- {
- int GetCallbackId();
- int GetStructSize();
- ISteamCallback Fill( IntPtr ptr );
- }
-}
\ No newline at end of file
diff --git a/Facepunch.Steamworks/Callbacks/Result.cs b/Facepunch.Steamworks/Callbacks/Result.cs
deleted file mode 100644
index e25f8a3..0000000
--- a/Facepunch.Steamworks/Callbacks/Result.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Steamworks
-{
- ///
- /// Results are Steam Callbacks that are direct responses to function calls
- ///
- public struct Result where T : struct, ISteamCallback
- {
- public ulong CallHandle;
-
- public Result( ulong callbackHandle )
- {
- CallHandle = callbackHandle;
- }
-
- public bool IsComplete( out bool failed )
- {
- return SteamUtils.IsCallComplete( CallHandle, out failed );
- }
-
- public async Task GetResult()
- {
- bool failed = false;
-
- while ( !IsComplete( out failed ) )
- {
- await Task.Delay( 1 );
- }
-
- if ( failed )
- return null;
-
- return SteamUtils.GetResult( CallHandle );
- }
- }
-}
\ No newline at end of file
diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamApps.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamApps.cs
index cc553cf..73f8171 100644
--- a/Facepunch.Steamworks/Generated/Interfaces/ISteamApps.cs
+++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamApps.cs
@@ -352,7 +352,7 @@ internal void RequestAllProofOfPurchaseKeys()
#endregion
internal async Task GetFileDetails( string pszFileName )
{
- return await (new Result( _GetFileDetails( Self, pszFileName ) )).GetResult();
+ return await FileDetailsResult_t.GetResultAsync( _GetFileDetails( Self, pszFileName ) );
}
#region FunctionMeta
diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamFriends.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamFriends.cs
index cae65e0..1ec2f66 100644
--- a/Facepunch.Steamworks/Generated/Interfaces/ISteamFriends.cs
+++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamFriends.cs
@@ -118,7 +118,7 @@ internal string GetPersonaName()
#endregion
internal async Task SetPersonaName( string pchPersonaName )
{
- return await (new Result( _SetPersonaName( Self, pchPersonaName ) )).GetResult();
+ return await SetPersonaNameResponse_t.GetResultAsync( _SetPersonaName( Self, pchPersonaName ) );
}
#region FunctionMeta
@@ -381,7 +381,7 @@ internal bool GetClanActivityCounts( SteamId steamIDClan, ref int pnOnline, ref
#endregion
internal async Task DownloadClanActivityCounts( [In,Out] SteamId[] psteamIDClans, int cClansToRequest )
{
- return await (new Result( _DownloadClanActivityCounts( Self, psteamIDClans, cClansToRequest ) )).GetResult();
+ return await DownloadClanActivityCountsResult_t.GetResultAsync( _DownloadClanActivityCounts( Self, psteamIDClans, cClansToRequest ) );
}
#region FunctionMeta
@@ -557,7 +557,7 @@ internal bool RequestUserInformation( SteamId steamIDUser, [MarshalAs( Unmanaged
#endregion
internal async Task RequestClanOfficerList( SteamId steamIDClan )
{
- return await (new Result( _RequestClanOfficerList( Self, steamIDClan ) )).GetResult();
+ return await ClanOfficerListResponse_t.GetResultAsync( _RequestClanOfficerList( Self, steamIDClan ) );
}
#region FunctionMeta
@@ -762,7 +762,7 @@ internal AppId GetFriendCoplayGame( SteamId steamIDFriend )
#endregion
internal async Task JoinClanChatRoom( SteamId steamIDClan )
{
- return await (new Result( _JoinClanChatRoom( Self, steamIDClan ) )).GetResult();
+ return await JoinClanChatRoomCompletionResult_t.GetResultAsync( _JoinClanChatRoom( Self, steamIDClan ) );
}
#region FunctionMeta
@@ -922,7 +922,7 @@ internal int GetFriendMessage( SteamId steamIDFriend, int iMessageID, IntPtr pvD
#endregion
internal async Task GetFollowerCount( SteamId steamID )
{
- return await (new Result( _GetFollowerCount( Self, steamID ) )).GetResult();
+ return await FriendsGetFollowerCount_t.GetResultAsync( _GetFollowerCount( Self, steamID ) );
}
#region FunctionMeta
@@ -933,7 +933,7 @@ internal int GetFriendMessage( SteamId steamIDFriend, int iMessageID, IntPtr pvD
#endregion
internal async Task IsFollowing( SteamId steamID )
{
- return await (new Result( _IsFollowing( Self, steamID ) )).GetResult();
+ return await FriendsIsFollowing_t.GetResultAsync( _IsFollowing( Self, steamID ) );
}
#region FunctionMeta
@@ -944,7 +944,7 @@ internal int GetFriendMessage( SteamId steamIDFriend, int iMessageID, IntPtr pvD
#endregion
internal async Task EnumerateFollowingList( uint unStartIndex )
{
- return await (new Result( _EnumerateFollowingList( Self, unStartIndex ) )).GetResult();
+ return await FriendsEnumerateFollowingList_t.GetResultAsync( _EnumerateFollowingList( Self, unStartIndex ) );
}
#region FunctionMeta
diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamGameServer.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamGameServer.cs
index 1df0c81..3833745 100644
--- a/Facepunch.Steamworks/Generated/Interfaces/ISteamGameServer.cs
+++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamGameServer.cs
@@ -483,7 +483,7 @@ internal void GetGameplayStats()
#endregion
internal async Task GetServerReputation()
{
- return await (new Result( _GetServerReputation( Self ) )).GetResult();
+ return await GSReputation_t.GetResultAsync( _GetServerReputation( Self ) );
}
#region FunctionMeta
@@ -561,7 +561,7 @@ internal void ForceHeartbeat()
#endregion
internal async Task AssociateWithClan( SteamId steamIDClan )
{
- return await (new Result( _AssociateWithClan( Self, steamIDClan ) )).GetResult();
+ return await AssociateWithClanResult_t.GetResultAsync( _AssociateWithClan( Self, steamIDClan ) );
}
#region FunctionMeta
@@ -572,7 +572,7 @@ internal void ForceHeartbeat()
#endregion
internal async Task ComputeNewPlayerCompatibility( SteamId steamIDNewPlayer )
{
- return await (new Result( _ComputeNewPlayerCompatibility( Self, steamIDNewPlayer ) )).GetResult();
+ return await ComputeNewPlayerCompatibilityResult_t.GetResultAsync( _ComputeNewPlayerCompatibility( Self, steamIDNewPlayer ) );
}
}
diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamInventory.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamInventory.cs
index f1551ae..a465e07 100644
--- a/Facepunch.Steamworks/Generated/Interfaces/ISteamInventory.cs
+++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamInventory.cs
@@ -336,7 +336,7 @@ internal bool GetItemDefinitionProperty( InventoryDefId iDefinition, string pchP
#endregion
internal async Task RequestEligiblePromoItemDefinitionsIDs( SteamId steamID )
{
- return await (new Result( _RequestEligiblePromoItemDefinitionsIDs( Self, steamID ) )).GetResult();
+ return await SteamInventoryEligiblePromoItemDefIDs_t.GetResultAsync( _RequestEligiblePromoItemDefinitionsIDs( Self, steamID ) );
}
#region FunctionMeta
@@ -359,7 +359,7 @@ internal bool GetEligiblePromoItemDefinitionIDs( SteamId steamID, [In,Out] Inven
#endregion
internal async Task StartPurchase( [In,Out] InventoryDefId[] pArrayItemDefs, [In,Out] uint[] punArrayQuantity, uint unArrayLength )
{
- return await (new Result( _StartPurchase( Self, pArrayItemDefs, punArrayQuantity, unArrayLength ) )).GetResult();
+ return await SteamInventoryStartPurchaseResult_t.GetResultAsync( _StartPurchase( Self, pArrayItemDefs, punArrayQuantity, unArrayLength ) );
}
#region FunctionMeta
@@ -370,7 +370,7 @@ internal bool GetEligiblePromoItemDefinitionIDs( SteamId steamID, [In,Out] Inven
#endregion
internal async Task RequestPrices()
{
- return await (new Result( _RequestPrices( Self ) )).GetResult();
+ return await SteamInventoryRequestPricesResult_t.GetResultAsync( _RequestPrices( Self ) );
}
#region FunctionMeta
diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamMatchmakingServers.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamMatchmakingServers.cs
index 4d89041..58a65d5 100644
--- a/Facepunch.Steamworks/Generated/Interfaces/ISteamMatchmakingServers.cs
+++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamMatchmakingServers.cs
@@ -121,7 +121,7 @@ internal void ReleaseRequest( HServerListRequest hServerListRequest )
#endregion
internal gameserveritem_t GetServerDetails( HServerListRequest hRequest, int iServer )
{
- return new gameserveritem_t().Fill( _GetServerDetails( Self, hRequest, iServer ) );
+ return gameserveritem_t.Fill( _GetServerDetails( Self, hRequest, iServer ) );
}
#region FunctionMeta
diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamRemoteStorage.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamRemoteStorage.cs
index 606a230..c48783f 100644
--- a/Facepunch.Steamworks/Generated/Interfaces/ISteamRemoteStorage.cs
+++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamRemoteStorage.cs
@@ -104,7 +104,7 @@ internal int FileRead( string pchFile, IntPtr pvData, int cubDataToRead )
#endregion
internal async Task FileWriteAsync( string pchFile, IntPtr pvData, uint cubData )
{
- return await (new Result( _FileWriteAsync( Self, pchFile, pvData, cubData ) )).GetResult();
+ return await RemoteStorageFileWriteAsyncComplete_t.GetResultAsync( _FileWriteAsync( Self, pchFile, pvData, cubData ) );
}
#region FunctionMeta
@@ -115,7 +115,7 @@ internal int FileRead( string pchFile, IntPtr pvData, int cubDataToRead )
#endregion
internal async Task FileReadAsync( string pchFile, uint nOffset, uint cubToRead )
{
- return await (new Result( _FileReadAsync( Self, pchFile, nOffset, cubToRead ) )).GetResult();
+ return await RemoteStorageFileReadAsyncComplete_t.GetResultAsync( _FileReadAsync( Self, pchFile, nOffset, cubToRead ) );
}
#region FunctionMeta
@@ -162,7 +162,7 @@ internal bool FileDelete( string pchFile )
#endregion
internal async Task FileShare( string pchFile )
{
- return await (new Result( _FileShare( Self, pchFile ) )).GetResult();
+ return await RemoteStorageFileShareResult_t.GetResultAsync( _FileShare( Self, pchFile ) );
}
#region FunctionMeta
@@ -358,7 +358,7 @@ internal void SetCloudEnabledForApp( [MarshalAs( UnmanagedType.U1 )] bool bEnabl
#endregion
internal async Task UGCDownload( UGCHandle_t hContent, uint unPriority )
{
- return await (new Result( _UGCDownload( Self, hContent, unPriority ) )).GetResult();
+ return await RemoteStorageDownloadUGCResult_t.GetResultAsync( _UGCDownload( Self, hContent, unPriority ) );
}
#region FunctionMeta
@@ -415,7 +415,7 @@ internal int GetCachedUGCCount()
#endregion
internal async Task UGCDownloadToLocation( UGCHandle_t hContent, string pchLocation, uint unPriority )
{
- return await (new Result( _UGCDownloadToLocation( Self, hContent, pchLocation, unPriority ) )).GetResult();
+ return await RemoteStorageDownloadUGCResult_t.GetResultAsync( _UGCDownloadToLocation( Self, hContent, pchLocation, unPriority ) );
}
}
diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamUGC.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamUGC.cs
index 15ea52a..7c6cef3 100644
--- a/Facepunch.Steamworks/Generated/Interfaces/ISteamUGC.cs
+++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamUGC.cs
@@ -147,7 +147,7 @@ internal UGCQueryHandle_t CreateQueryUGCDetailsRequest( [In,Out] PublishedFileId
#endregion
internal async Task SendQueryUGCRequest( UGCQueryHandle_t handle )
{
- return await (new Result( _SendQueryUGCRequest( Self, handle ) )).GetResult();
+ return await SteamUGCQueryCompleted_t.GetResultAsync( _SendQueryUGCRequest( Self, handle ) );
}
#region FunctionMeta
@@ -480,7 +480,7 @@ internal bool AddRequiredKeyValueTag( UGCQueryHandle_t handle, string pKey, stri
#endregion
internal async Task RequestUGCDetails( PublishedFileId nPublishedFileID, uint unMaxAgeSeconds )
{
- return await (new Result( _RequestUGCDetails( Self, nPublishedFileID, unMaxAgeSeconds ) )).GetResult();
+ return await SteamUGCRequestUGCDetailsResult_t.GetResultAsync( _RequestUGCDetails( Self, nPublishedFileID, unMaxAgeSeconds ) );
}
#region FunctionMeta
@@ -491,7 +491,7 @@ internal bool AddRequiredKeyValueTag( UGCQueryHandle_t handle, string pKey, stri
#endregion
internal async Task CreateItem( AppId nConsumerAppId, WorkshopFileType eFileType )
{
- return await (new Result( _CreateItem( Self, nConsumerAppId, eFileType ) )).GetResult();
+ return await CreateItemResult_t.GetResultAsync( _CreateItem( Self, nConsumerAppId, eFileType ) );
}
#region FunctionMeta
@@ -705,7 +705,7 @@ internal bool RemoveItemPreview( UGCUpdateHandle_t handle, uint index )
#endregion
internal async Task SubmitItemUpdate( UGCUpdateHandle_t handle, string pchChangeNote )
{
- return await (new Result( _SubmitItemUpdate( Self, handle, pchChangeNote ) )).GetResult();
+ return await SubmitItemUpdateResult_t.GetResultAsync( _SubmitItemUpdate( Self, handle, pchChangeNote ) );
}
#region FunctionMeta
@@ -727,7 +727,7 @@ internal ItemUpdateStatus GetItemUpdateProgress( UGCUpdateHandle_t handle, ref u
#endregion
internal async Task SetUserItemVote( PublishedFileId nPublishedFileID, [MarshalAs( UnmanagedType.U1 )] bool bVoteUp )
{
- return await (new Result( _SetUserItemVote( Self, nPublishedFileID, bVoteUp ) )).GetResult();
+ return await SetUserItemVoteResult_t.GetResultAsync( _SetUserItemVote( Self, nPublishedFileID, bVoteUp ) );
}
#region FunctionMeta
@@ -738,7 +738,7 @@ internal ItemUpdateStatus GetItemUpdateProgress( UGCUpdateHandle_t handle, ref u
#endregion
internal async Task GetUserItemVote( PublishedFileId nPublishedFileID )
{
- return await (new Result( _GetUserItemVote( Self, nPublishedFileID ) )).GetResult();
+ return await GetUserItemVoteResult_t.GetResultAsync( _GetUserItemVote( Self, nPublishedFileID ) );
}
#region FunctionMeta
@@ -749,7 +749,7 @@ internal ItemUpdateStatus GetItemUpdateProgress( UGCUpdateHandle_t handle, ref u
#endregion
internal async Task AddItemToFavorites( AppId nAppId, PublishedFileId nPublishedFileID )
{
- return await (new Result( _AddItemToFavorites( Self, nAppId, nPublishedFileID ) )).GetResult();
+ return await UserFavoriteItemsListChanged_t.GetResultAsync( _AddItemToFavorites( Self, nAppId, nPublishedFileID ) );
}
#region FunctionMeta
@@ -760,7 +760,7 @@ internal ItemUpdateStatus GetItemUpdateProgress( UGCUpdateHandle_t handle, ref u
#endregion
internal async Task RemoveItemFromFavorites( AppId nAppId, PublishedFileId nPublishedFileID )
{
- return await (new Result( _RemoveItemFromFavorites( Self, nAppId, nPublishedFileID ) )).GetResult();
+ return await UserFavoriteItemsListChanged_t.GetResultAsync( _RemoveItemFromFavorites( Self, nAppId, nPublishedFileID ) );
}
#region FunctionMeta
@@ -771,7 +771,7 @@ internal ItemUpdateStatus GetItemUpdateProgress( UGCUpdateHandle_t handle, ref u
#endregion
internal async Task SubscribeItem( PublishedFileId nPublishedFileID )
{
- return await (new Result( _SubscribeItem( Self, nPublishedFileID ) )).GetResult();
+ return await RemoteStorageSubscribePublishedFileResult_t.GetResultAsync( _SubscribeItem( Self, nPublishedFileID ) );
}
#region FunctionMeta
@@ -782,7 +782,7 @@ internal ItemUpdateStatus GetItemUpdateProgress( UGCUpdateHandle_t handle, ref u
#endregion
internal async Task UnsubscribeItem( PublishedFileId nPublishedFileID )
{
- return await (new Result( _UnsubscribeItem( Self, nPublishedFileID ) )).GetResult();
+ return await RemoteStorageUnsubscribePublishedFileResult_t.GetResultAsync( _UnsubscribeItem( Self, nPublishedFileID ) );
}
#region FunctionMeta
@@ -885,7 +885,7 @@ internal void SuspendDownloads( [MarshalAs( UnmanagedType.U1 )] bool bSuspend )
#endregion
internal async Task StartPlaytimeTracking( [In,Out] PublishedFileId[] pvecPublishedFileID, uint unNumPublishedFileIDs )
{
- return await (new Result( _StartPlaytimeTracking( Self, pvecPublishedFileID, unNumPublishedFileIDs ) )).GetResult();
+ return await StartPlaytimeTrackingResult_t.GetResultAsync( _StartPlaytimeTracking( Self, pvecPublishedFileID, unNumPublishedFileIDs ) );
}
#region FunctionMeta
@@ -896,7 +896,7 @@ internal void SuspendDownloads( [MarshalAs( UnmanagedType.U1 )] bool bSuspend )
#endregion
internal async Task StopPlaytimeTracking( [In,Out] PublishedFileId[] pvecPublishedFileID, uint unNumPublishedFileIDs )
{
- return await (new Result( _StopPlaytimeTracking( Self, pvecPublishedFileID, unNumPublishedFileIDs ) )).GetResult();
+ return await StopPlaytimeTrackingResult_t.GetResultAsync( _StopPlaytimeTracking( Self, pvecPublishedFileID, unNumPublishedFileIDs ) );
}
#region FunctionMeta
@@ -907,7 +907,7 @@ internal void SuspendDownloads( [MarshalAs( UnmanagedType.U1 )] bool bSuspend )
#endregion
internal async Task StopPlaytimeTrackingForAllItems()
{
- return await (new Result( _StopPlaytimeTrackingForAllItems( Self ) )).GetResult();
+ return await StopPlaytimeTrackingResult_t.GetResultAsync( _StopPlaytimeTrackingForAllItems( Self ) );
}
#region FunctionMeta
@@ -918,7 +918,7 @@ internal void SuspendDownloads( [MarshalAs( UnmanagedType.U1 )] bool bSuspend )
#endregion
internal async Task AddDependency( PublishedFileId nParentPublishedFileID, PublishedFileId nChildPublishedFileID )
{
- return await (new Result( _AddDependency( Self, nParentPublishedFileID, nChildPublishedFileID ) )).GetResult();
+ return await AddUGCDependencyResult_t.GetResultAsync( _AddDependency( Self, nParentPublishedFileID, nChildPublishedFileID ) );
}
#region FunctionMeta
@@ -929,7 +929,7 @@ internal void SuspendDownloads( [MarshalAs( UnmanagedType.U1 )] bool bSuspend )
#endregion
internal async Task RemoveDependency( PublishedFileId nParentPublishedFileID, PublishedFileId nChildPublishedFileID )
{
- return await (new Result( _RemoveDependency( Self, nParentPublishedFileID, nChildPublishedFileID ) )).GetResult();
+ return await RemoveUGCDependencyResult_t.GetResultAsync( _RemoveDependency( Self, nParentPublishedFileID, nChildPublishedFileID ) );
}
#region FunctionMeta
@@ -940,7 +940,7 @@ internal void SuspendDownloads( [MarshalAs( UnmanagedType.U1 )] bool bSuspend )
#endregion
internal async Task AddAppDependency( PublishedFileId nPublishedFileID, AppId nAppID )
{
- return await (new Result( _AddAppDependency( Self, nPublishedFileID, nAppID ) )).GetResult();
+ return await AddAppDependencyResult_t.GetResultAsync( _AddAppDependency( Self, nPublishedFileID, nAppID ) );
}
#region FunctionMeta
@@ -951,7 +951,7 @@ internal void SuspendDownloads( [MarshalAs( UnmanagedType.U1 )] bool bSuspend )
#endregion
internal async Task RemoveAppDependency( PublishedFileId nPublishedFileID, AppId nAppID )
{
- return await (new Result( _RemoveAppDependency( Self, nPublishedFileID, nAppID ) )).GetResult();
+ return await RemoveAppDependencyResult_t.GetResultAsync( _RemoveAppDependency( Self, nPublishedFileID, nAppID ) );
}
#region FunctionMeta
@@ -962,7 +962,7 @@ internal void SuspendDownloads( [MarshalAs( UnmanagedType.U1 )] bool bSuspend )
#endregion
internal async Task GetAppDependencies( PublishedFileId nPublishedFileID )
{
- return await (new Result( _GetAppDependencies( Self, nPublishedFileID ) )).GetResult();
+ return await GetAppDependenciesResult_t.GetResultAsync( _GetAppDependencies( Self, nPublishedFileID ) );
}
#region FunctionMeta
@@ -973,7 +973,7 @@ internal void SuspendDownloads( [MarshalAs( UnmanagedType.U1 )] bool bSuspend )
#endregion
internal async Task DeleteItem( PublishedFileId nPublishedFileID )
{
- return await (new Result( _DeleteItem( Self, nPublishedFileID ) )).GetResult();
+ return await DeleteItemResult_t.GetResultAsync( _DeleteItem( Self, nPublishedFileID ) );
}
}
diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamUser.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamUser.cs
index affd6eb..231a131 100644
--- a/Facepunch.Steamworks/Generated/Interfaces/ISteamUser.cs
+++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamUser.cs
@@ -290,7 +290,7 @@ internal void AdvertiseGame( SteamId steamIDGameServer, uint unIPServer, ushort
#endregion
internal async Task RequestEncryptedAppTicket( IntPtr pDataToInclude, int cbDataToInclude )
{
- return await (new Result( _RequestEncryptedAppTicket( Self, pDataToInclude, cbDataToInclude ) )).GetResult();
+ return await EncryptedAppTicketResponse_t.GetResultAsync( _RequestEncryptedAppTicket( Self, pDataToInclude, cbDataToInclude ) );
}
#region FunctionMeta
@@ -335,7 +335,7 @@ internal int GetPlayerSteamLevel()
#endregion
internal async Task RequestStoreAuthURL( string pchRedirectURL )
{
- return await (new Result( _RequestStoreAuthURL( Self, pchRedirectURL ) )).GetResult();
+ return await StoreAuthURLResponse_t.GetResultAsync( _RequestStoreAuthURL( Self, pchRedirectURL ) );
}
#region FunctionMeta
@@ -394,7 +394,7 @@ internal bool BIsPhoneRequiringVerification()
#endregion
internal async Task GetMarketEligibility()
{
- return await (new Result( _GetMarketEligibility( Self ) )).GetResult();
+ return await MarketEligibilityResponse_t.GetResultAsync( _GetMarketEligibility( Self ) );
}
}
diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamUserStats.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamUserStats.cs
index 9cc996f..33b9d77 100644
--- a/Facepunch.Steamworks/Generated/Interfaces/ISteamUserStats.cs
+++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamUserStats.cs
@@ -258,7 +258,7 @@ internal string GetAchievementName( uint iAchievement )
#endregion
internal async Task RequestUserStats( SteamId steamIDUser )
{
- return await (new Result( _RequestUserStats( Self, steamIDUser ) )).GetResult();
+ return await UserStatsReceived_t.GetResultAsync( _RequestUserStats( Self, steamIDUser ) );
}
#region FunctionMeta
@@ -329,7 +329,7 @@ internal bool ResetAllStats( [MarshalAs( UnmanagedType.U1 )] bool bAchievementsT
#endregion
internal async Task FindOrCreateLeaderboard( string pchLeaderboardName, LeaderboardSort eLeaderboardSortMethod, LeaderboardDisplay eLeaderboardDisplayType )
{
- return await (new Result( _FindOrCreateLeaderboard( Self, pchLeaderboardName, eLeaderboardSortMethod, eLeaderboardDisplayType ) )).GetResult();
+ return await LeaderboardFindResult_t.GetResultAsync( _FindOrCreateLeaderboard( Self, pchLeaderboardName, eLeaderboardSortMethod, eLeaderboardDisplayType ) );
}
#region FunctionMeta
@@ -340,7 +340,7 @@ internal bool ResetAllStats( [MarshalAs( UnmanagedType.U1 )] bool bAchievementsT
#endregion
internal async Task FindLeaderboard( string pchLeaderboardName )
{
- return await (new Result( _FindLeaderboard( Self, pchLeaderboardName ) )).GetResult();
+ return await LeaderboardFindResult_t.GetResultAsync( _FindLeaderboard( Self, pchLeaderboardName ) );
}
#region FunctionMeta
@@ -395,7 +395,7 @@ internal LeaderboardDisplay GetLeaderboardDisplayType( SteamLeaderboard_t hSteam
#endregion
internal async Task DownloadLeaderboardEntries( SteamLeaderboard_t hSteamLeaderboard, LeaderboardDataRequest eLeaderboardDataRequest, int nRangeStart, int nRangeEnd )
{
- return await (new Result( _DownloadLeaderboardEntries( Self, hSteamLeaderboard, eLeaderboardDataRequest, nRangeStart, nRangeEnd ) )).GetResult();
+ return await LeaderboardScoresDownloaded_t.GetResultAsync( _DownloadLeaderboardEntries( Self, hSteamLeaderboard, eLeaderboardDataRequest, nRangeStart, nRangeEnd ) );
}
#region FunctionMeta
@@ -406,7 +406,7 @@ internal LeaderboardDisplay GetLeaderboardDisplayType( SteamLeaderboard_t hSteam
#endregion
internal async Task DownloadLeaderboardEntriesForUsers( SteamLeaderboard_t hSteamLeaderboard, [In,Out] SteamId[] prgUsers, int cUsers )
{
- return await (new Result( _DownloadLeaderboardEntriesForUsers( Self, hSteamLeaderboard, prgUsers, cUsers ) )).GetResult();
+ return await LeaderboardScoresDownloaded_t.GetResultAsync( _DownloadLeaderboardEntriesForUsers( Self, hSteamLeaderboard, prgUsers, cUsers ) );
}
#region FunctionMeta
@@ -429,7 +429,7 @@ internal bool GetDownloadedLeaderboardEntry( SteamLeaderboardEntries_t hSteamLea
#endregion
internal async Task UploadLeaderboardScore( SteamLeaderboard_t hSteamLeaderboard, LeaderboardUploadScoreMethod eLeaderboardUploadScoreMethod, int nScore, [In,Out] int[] pScoreDetails, int cScoreDetailsCount )
{
- return await (new Result( _UploadLeaderboardScore( Self, hSteamLeaderboard, eLeaderboardUploadScoreMethod, nScore, pScoreDetails, cScoreDetailsCount ) )).GetResult();
+ return await LeaderboardScoreUploaded_t.GetResultAsync( _UploadLeaderboardScore( Self, hSteamLeaderboard, eLeaderboardUploadScoreMethod, nScore, pScoreDetails, cScoreDetailsCount ) );
}
#region FunctionMeta
@@ -440,7 +440,7 @@ internal bool GetDownloadedLeaderboardEntry( SteamLeaderboardEntries_t hSteamLea
#endregion
internal async Task AttachLeaderboardUGC( SteamLeaderboard_t hSteamLeaderboard, UGCHandle_t hUGC )
{
- return await (new Result( _AttachLeaderboardUGC( Self, hSteamLeaderboard, hUGC ) )).GetResult();
+ return await LeaderboardUGCSet_t.GetResultAsync( _AttachLeaderboardUGC( Self, hSteamLeaderboard, hUGC ) );
}
#region FunctionMeta
@@ -451,7 +451,7 @@ internal bool GetDownloadedLeaderboardEntry( SteamLeaderboardEntries_t hSteamLea
#endregion
internal async Task GetNumberOfCurrentPlayers()
{
- return await (new Result( _GetNumberOfCurrentPlayers( Self ) )).GetResult();
+ return await NumberOfCurrentPlayers_t.GetResultAsync( _GetNumberOfCurrentPlayers( Self ) );
}
#region FunctionMeta
@@ -462,7 +462,7 @@ internal bool GetDownloadedLeaderboardEntry( SteamLeaderboardEntries_t hSteamLea
#endregion
internal async Task RequestGlobalAchievementPercentages()
{
- return await (new Result( _RequestGlobalAchievementPercentages( Self ) )).GetResult();
+ return await GlobalAchievementPercentagesReady_t.GetResultAsync( _RequestGlobalAchievementPercentages( Self ) );
}
#region FunctionMeta
@@ -507,7 +507,7 @@ internal bool GetAchievementAchievedPercent( string pchName, ref float pflPercen
#endregion
internal async Task RequestGlobalStats( int nHistoryDays )
{
- return await (new Result( _RequestGlobalStats( Self, nHistoryDays ) )).GetResult();
+ return await GlobalStatsReceived_t.GetResultAsync( _RequestGlobalStats( Self, nHistoryDays ) );
}
#region FunctionMeta
diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamUtils.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamUtils.cs
index 56a3bc2..005d0de 100644
--- a/Facepunch.Steamworks/Generated/Interfaces/ISteamUtils.cs
+++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamUtils.cs
@@ -273,7 +273,7 @@ internal bool BOverlayNeedsPresent()
#endregion
internal async Task CheckFileSignature( string szFileName )
{
- return await (new Result( _CheckFileSignature( Self, szFileName ) )).GetResult();
+ return await CheckFileSignature_t.GetResultAsync( _CheckFileSignature( Self, szFileName ) );
}
#region FunctionMeta
diff --git a/Facepunch.Steamworks/Generated/SteamConstants.cs b/Facepunch.Steamworks/Generated/SteamConstants.cs
index 7042556..35c3b45 100644
--- a/Facepunch.Steamworks/Generated/SteamConstants.cs
+++ b/Facepunch.Steamworks/Generated/SteamConstants.cs
@@ -2,6 +2,7 @@
using System.Runtime.InteropServices;
using System.Linq;
using Steamworks.Data;
+using System.Threading.Tasks;
namespace Steamworks.Data
{
diff --git a/Facepunch.Steamworks/Generated/SteamEnums.cs b/Facepunch.Steamworks/Generated/SteamEnums.cs
index 4383f57..69b336e 100644
--- a/Facepunch.Steamworks/Generated/SteamEnums.cs
+++ b/Facepunch.Steamworks/Generated/SteamEnums.cs
@@ -2,6 +2,7 @@
using System.Runtime.InteropServices;
using System.Linq;
using Steamworks.Data;
+using System.Threading.Tasks;
namespace Steamworks
{
diff --git a/Facepunch.Steamworks/Generated/SteamStructs.cs b/Facepunch.Steamworks/Generated/SteamStructs.cs
index 724899b..2801a14 100644
--- a/Facepunch.Steamworks/Generated/SteamStructs.cs
+++ b/Facepunch.Steamworks/Generated/SteamStructs.cs
@@ -2,6 +2,7 @@
using System.Runtime.InteropServices;
using System.Linq;
using Steamworks.Data;
+using System.Threading.Tasks;
namespace Steamworks.Data
{
@@ -14,8 +15,7 @@ internal struct CallbackMsg_t
internal int ParamCount; // m_cubParam int
#region Marshalling
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(CallbackMsg_t) : typeof(Pack8) );
- public CallbackMsg_t Fill( IntPtr p ) => Config.PackSmall ? ((CallbackMsg_t)(CallbackMsg_t) Marshal.PtrToStructure( p, typeof(CallbackMsg_t) )) : ((CallbackMsg_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ internal static CallbackMsg_t Fill( IntPtr p ) => Config.PackSmall ? ((CallbackMsg_t)(CallbackMsg_t) Marshal.PtrToStructure( p, typeof(CallbackMsg_t) )) : ((CallbackMsg_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
#endregion
#region Packed Versions
@@ -33,33 +33,57 @@ public struct Pack8
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct SteamServerConnectFailure_t : Steamworks.ISteamCallback
+ internal struct SteamServerConnectFailure_t
{
internal Result Result; // m_eResult enum EResult
[MarshalAs(UnmanagedType.I1)]
internal bool StillRetrying; // m_bStillRetrying _Bool
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamUser + 2;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(SteamServerConnectFailure_t) : typeof(Pack8) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => Config.PackSmall ? ((SteamServerConnectFailure_t)(SteamServerConnectFailure_t) Marshal.PtrToStructure( p, typeof(SteamServerConnectFailure_t) )) : ((SteamServerConnectFailure_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(SteamServerConnectFailure_t) : typeof(Pack8) );
+ internal static SteamServerConnectFailure_t Fill( IntPtr p ) => Config.PackSmall ? ((SteamServerConnectFailure_t)(SteamServerConnectFailure_t) Marshal.PtrToStructure( p, typeof(SteamServerConnectFailure_t) )) : ((SteamServerConnectFailure_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (SteamServerConnectFailure_t)default(SteamServerConnectFailure_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (SteamServerConnectFailure_t)default(SteamServerConnectFailure_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(SteamServerConnectFailure_t).GetStructSize(), CallbackIdentifiers.SteamUser + 2, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamUser + 2, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(SteamServerConnectFailure_t).GetStructSize(), CallbackIdentifiers.SteamUser + 2, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamUser + 2, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamUser + 2, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
#region Packed Versions
@@ -76,31 +100,55 @@ public struct Pack8
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct SteamServersDisconnected_t : Steamworks.ISteamCallback
+ internal struct SteamServersDisconnected_t
{
internal Result Result; // m_eResult enum EResult
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamUser + 3;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(SteamServersDisconnected_t) : typeof(Pack8) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => Config.PackSmall ? ((SteamServersDisconnected_t)(SteamServersDisconnected_t) Marshal.PtrToStructure( p, typeof(SteamServersDisconnected_t) )) : ((SteamServersDisconnected_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(SteamServersDisconnected_t) : typeof(Pack8) );
+ internal static SteamServersDisconnected_t Fill( IntPtr p ) => Config.PackSmall ? ((SteamServersDisconnected_t)(SteamServersDisconnected_t) Marshal.PtrToStructure( p, typeof(SteamServersDisconnected_t) )) : ((SteamServersDisconnected_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (SteamServersDisconnected_t)default(SteamServersDisconnected_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (SteamServersDisconnected_t)default(SteamServersDisconnected_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(SteamServersDisconnected_t).GetStructSize(), CallbackIdentifiers.SteamUser + 3, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamUser + 3, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(SteamServersDisconnected_t).GetStructSize(), CallbackIdentifiers.SteamUser + 3, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamUser + 3, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamUser + 3, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
#region Packed Versions
@@ -115,7 +163,7 @@ public struct Pack8
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct ClientGameServerDeny_t : Steamworks.ISteamCallback
+ internal struct ClientGameServerDeny_t
{
internal uint AppID; // m_uAppID uint32
internal uint GameServerIP; // m_unGameServerIP uint32
@@ -123,27 +171,51 @@ internal struct ClientGameServerDeny_t : Steamworks.ISteamCallback
internal ushort Secure; // m_bSecure uint16
internal uint Reason; // m_uReason uint32
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamUser + 13;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(ClientGameServerDeny_t) : typeof(Pack8) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => Config.PackSmall ? ((ClientGameServerDeny_t)(ClientGameServerDeny_t) Marshal.PtrToStructure( p, typeof(ClientGameServerDeny_t) )) : ((ClientGameServerDeny_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(ClientGameServerDeny_t) : typeof(Pack8) );
+ internal static ClientGameServerDeny_t Fill( IntPtr p ) => Config.PackSmall ? ((ClientGameServerDeny_t)(ClientGameServerDeny_t) Marshal.PtrToStructure( p, typeof(ClientGameServerDeny_t) )) : ((ClientGameServerDeny_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (ClientGameServerDeny_t)default(ClientGameServerDeny_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (ClientGameServerDeny_t)default(ClientGameServerDeny_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(ClientGameServerDeny_t).GetStructSize(), CallbackIdentifiers.SteamUser + 13, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamUser + 13, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(ClientGameServerDeny_t).GetStructSize(), CallbackIdentifiers.SteamUser + 13, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamUser + 13, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamUser + 13, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
#region Packed Versions
@@ -162,64 +234,112 @@ public struct Pack8
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct ValidateAuthTicketResponse_t : Steamworks.ISteamCallback
+ internal struct ValidateAuthTicketResponse_t
{
internal ulong SteamID; // m_SteamID class CSteamID
internal AuthResponse AuthSessionResponse; // m_eAuthSessionResponse enum EAuthSessionResponse
internal ulong OwnerSteamID; // m_OwnerSteamID class CSteamID
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamUser + 43;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( typeof(ValidateAuthTicketResponse_t) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => ((ValidateAuthTicketResponse_t)(ValidateAuthTicketResponse_t) Marshal.PtrToStructure( p, typeof(ValidateAuthTicketResponse_t) ) );
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(ValidateAuthTicketResponse_t) );
+ internal static ValidateAuthTicketResponse_t Fill( IntPtr p ) => ((ValidateAuthTicketResponse_t)(ValidateAuthTicketResponse_t) Marshal.PtrToStructure( p, typeof(ValidateAuthTicketResponse_t) ) );
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (ValidateAuthTicketResponse_t)default(ValidateAuthTicketResponse_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (ValidateAuthTicketResponse_t)default(ValidateAuthTicketResponse_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(ValidateAuthTicketResponse_t).GetStructSize(), CallbackIdentifiers.SteamUser + 43, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamUser + 43, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(ValidateAuthTicketResponse_t).GetStructSize(), CallbackIdentifiers.SteamUser + 43, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamUser + 43, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamUser + 43, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct MicroTxnAuthorizationResponse_t : Steamworks.ISteamCallback
+ internal struct MicroTxnAuthorizationResponse_t
{
internal uint AppID; // m_unAppID uint32
internal ulong OrderID; // m_ulOrderID uint64
internal byte Authorized; // m_bAuthorized uint8
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamUser + 52;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(MicroTxnAuthorizationResponse_t) : typeof(Pack8) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => Config.PackSmall ? ((MicroTxnAuthorizationResponse_t)(MicroTxnAuthorizationResponse_t) Marshal.PtrToStructure( p, typeof(MicroTxnAuthorizationResponse_t) )) : ((MicroTxnAuthorizationResponse_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(MicroTxnAuthorizationResponse_t) : typeof(Pack8) );
+ internal static MicroTxnAuthorizationResponse_t Fill( IntPtr p ) => Config.PackSmall ? ((MicroTxnAuthorizationResponse_t)(MicroTxnAuthorizationResponse_t) Marshal.PtrToStructure( p, typeof(MicroTxnAuthorizationResponse_t) )) : ((MicroTxnAuthorizationResponse_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (MicroTxnAuthorizationResponse_t)default(MicroTxnAuthorizationResponse_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (MicroTxnAuthorizationResponse_t)default(MicroTxnAuthorizationResponse_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(MicroTxnAuthorizationResponse_t).GetStructSize(), CallbackIdentifiers.SteamUser + 52, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamUser + 52, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(MicroTxnAuthorizationResponse_t).GetStructSize(), CallbackIdentifiers.SteamUser + 52, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamUser + 52, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamUser + 52, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
#region Packed Versions
@@ -236,31 +356,55 @@ public struct Pack8
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct EncryptedAppTicketResponse_t : Steamworks.ISteamCallback
+ internal struct EncryptedAppTicketResponse_t
{
internal Result Result; // m_eResult enum EResult
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamUser + 54;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(EncryptedAppTicketResponse_t) : typeof(Pack8) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => Config.PackSmall ? ((EncryptedAppTicketResponse_t)(EncryptedAppTicketResponse_t) Marshal.PtrToStructure( p, typeof(EncryptedAppTicketResponse_t) )) : ((EncryptedAppTicketResponse_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(EncryptedAppTicketResponse_t) : typeof(Pack8) );
+ internal static EncryptedAppTicketResponse_t Fill( IntPtr p ) => Config.PackSmall ? ((EncryptedAppTicketResponse_t)(EncryptedAppTicketResponse_t) Marshal.PtrToStructure( p, typeof(EncryptedAppTicketResponse_t) )) : ((EncryptedAppTicketResponse_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (EncryptedAppTicketResponse_t)default(EncryptedAppTicketResponse_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (EncryptedAppTicketResponse_t)default(EncryptedAppTicketResponse_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(EncryptedAppTicketResponse_t).GetStructSize(), CallbackIdentifiers.SteamUser + 54, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamUser + 54, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(EncryptedAppTicketResponse_t).GetStructSize(), CallbackIdentifiers.SteamUser + 54, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamUser + 54, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamUser + 54, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
#region Packed Versions
@@ -275,32 +419,56 @@ public struct Pack8
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct GetAuthSessionTicketResponse_t : Steamworks.ISteamCallback
+ internal struct GetAuthSessionTicketResponse_t
{
internal uint AuthTicket; // m_hAuthTicket HAuthTicket
internal Result Result; // m_eResult enum EResult
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamUser + 63;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(GetAuthSessionTicketResponse_t) : typeof(Pack8) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => Config.PackSmall ? ((GetAuthSessionTicketResponse_t)(GetAuthSessionTicketResponse_t) Marshal.PtrToStructure( p, typeof(GetAuthSessionTicketResponse_t) )) : ((GetAuthSessionTicketResponse_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(GetAuthSessionTicketResponse_t) : typeof(Pack8) );
+ internal static GetAuthSessionTicketResponse_t Fill( IntPtr p ) => Config.PackSmall ? ((GetAuthSessionTicketResponse_t)(GetAuthSessionTicketResponse_t) Marshal.PtrToStructure( p, typeof(GetAuthSessionTicketResponse_t) )) : ((GetAuthSessionTicketResponse_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (GetAuthSessionTicketResponse_t)default(GetAuthSessionTicketResponse_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (GetAuthSessionTicketResponse_t)default(GetAuthSessionTicketResponse_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(GetAuthSessionTicketResponse_t).GetStructSize(), CallbackIdentifiers.SteamUser + 63, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamUser + 63, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(GetAuthSessionTicketResponse_t).GetStructSize(), CallbackIdentifiers.SteamUser + 63, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamUser + 63, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamUser + 63, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
#region Packed Versions
@@ -316,32 +484,56 @@ public struct Pack8
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct GameWebCallback_t : Steamworks.ISteamCallback
+ internal struct GameWebCallback_t
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
internal string URL; // m_szURL char [256]
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamUser + 64;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(GameWebCallback_t) : typeof(Pack8) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => Config.PackSmall ? ((GameWebCallback_t)(GameWebCallback_t) Marshal.PtrToStructure( p, typeof(GameWebCallback_t) )) : ((GameWebCallback_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(GameWebCallback_t) : typeof(Pack8) );
+ internal static GameWebCallback_t Fill( IntPtr p ) => Config.PackSmall ? ((GameWebCallback_t)(GameWebCallback_t) Marshal.PtrToStructure( p, typeof(GameWebCallback_t) )) : ((GameWebCallback_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (GameWebCallback_t)default(GameWebCallback_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (GameWebCallback_t)default(GameWebCallback_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(GameWebCallback_t).GetStructSize(), CallbackIdentifiers.SteamUser + 64, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamUser + 64, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(GameWebCallback_t).GetStructSize(), CallbackIdentifiers.SteamUser + 64, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamUser + 64, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamUser + 64, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
#region Packed Versions
@@ -357,32 +549,56 @@ public struct Pack8
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct StoreAuthURLResponse_t : Steamworks.ISteamCallback
+ internal struct StoreAuthURLResponse_t
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 512)]
internal string URL; // m_szURL char [512]
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamUser + 65;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(StoreAuthURLResponse_t) : typeof(Pack8) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => Config.PackSmall ? ((StoreAuthURLResponse_t)(StoreAuthURLResponse_t) Marshal.PtrToStructure( p, typeof(StoreAuthURLResponse_t) )) : ((StoreAuthURLResponse_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(StoreAuthURLResponse_t) : typeof(Pack8) );
+ internal static StoreAuthURLResponse_t Fill( IntPtr p ) => Config.PackSmall ? ((StoreAuthURLResponse_t)(StoreAuthURLResponse_t) Marshal.PtrToStructure( p, typeof(StoreAuthURLResponse_t) )) : ((StoreAuthURLResponse_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (StoreAuthURLResponse_t)default(StoreAuthURLResponse_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (StoreAuthURLResponse_t)default(StoreAuthURLResponse_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(StoreAuthURLResponse_t).GetStructSize(), CallbackIdentifiers.SteamUser + 65, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamUser + 65, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(StoreAuthURLResponse_t).GetStructSize(), CallbackIdentifiers.SteamUser + 65, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamUser + 65, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamUser + 65, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
#region Packed Versions
@@ -398,7 +614,7 @@ public struct Pack8
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct MarketEligibilityResponse_t : Steamworks.ISteamCallback
+ internal struct MarketEligibilityResponse_t
{
[MarshalAs(UnmanagedType.I1)]
internal bool Allowed; // m_bAllowed _Bool
@@ -407,27 +623,51 @@ internal struct MarketEligibilityResponse_t : Steamworks.ISteamCallback
internal int CdaySteamGuardRequiredDays; // m_cdaySteamGuardRequiredDays int
internal int CdayNewDeviceCooldown; // m_cdayNewDeviceCooldown int
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamUser + 66;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(MarketEligibilityResponse_t) : typeof(Pack8) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => Config.PackSmall ? ((MarketEligibilityResponse_t)(MarketEligibilityResponse_t) Marshal.PtrToStructure( p, typeof(MarketEligibilityResponse_t) )) : ((MarketEligibilityResponse_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(MarketEligibilityResponse_t) : typeof(Pack8) );
+ internal static MarketEligibilityResponse_t Fill( IntPtr p ) => Config.PackSmall ? ((MarketEligibilityResponse_t)(MarketEligibilityResponse_t) Marshal.PtrToStructure( p, typeof(MarketEligibilityResponse_t) )) : ((MarketEligibilityResponse_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (MarketEligibilityResponse_t)default(MarketEligibilityResponse_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (MarketEligibilityResponse_t)default(MarketEligibilityResponse_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(MarketEligibilityResponse_t).GetStructSize(), CallbackIdentifiers.SteamUser + 66, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamUser + 66, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(MarketEligibilityResponse_t).GetStructSize(), CallbackIdentifiers.SteamUser + 66, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamUser + 66, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamUser + 66, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
#region Packed Versions
@@ -456,8 +696,7 @@ internal struct FriendGameInfo_t
internal ulong SteamIDLobby; // m_steamIDLobby class CSteamID
#region Marshalling
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( typeof(FriendGameInfo_t) );
- public FriendGameInfo_t Fill( IntPtr p ) => ((FriendGameInfo_t)(FriendGameInfo_t) Marshal.PtrToStructure( p, typeof(FriendGameInfo_t) ) );
+ internal static FriendGameInfo_t Fill( IntPtr p ) => ((FriendGameInfo_t)(FriendGameInfo_t) Marshal.PtrToStructure( p, typeof(FriendGameInfo_t) ) );
#endregion
}
@@ -468,8 +707,7 @@ internal struct FriendSessionStateInfo_t
internal byte IPublishedToFriendsSessionInstance; // m_uiPublishedToFriendsSessionInstance uint8
#region Marshalling
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(FriendSessionStateInfo_t) : typeof(Pack8) );
- public FriendSessionStateInfo_t Fill( IntPtr p ) => Config.PackSmall ? ((FriendSessionStateInfo_t)(FriendSessionStateInfo_t) Marshal.PtrToStructure( p, typeof(FriendSessionStateInfo_t) )) : ((FriendSessionStateInfo_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ internal static FriendSessionStateInfo_t Fill( IntPtr p ) => Config.PackSmall ? ((FriendSessionStateInfo_t)(FriendSessionStateInfo_t) Marshal.PtrToStructure( p, typeof(FriendSessionStateInfo_t) )) : ((FriendSessionStateInfo_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
#endregion
#region Packed Versions
@@ -485,32 +723,56 @@ public struct Pack8
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct FriendStateChange_t : Steamworks.ISteamCallback
+ internal struct FriendStateChange_t
{
internal ulong SteamID; // m_ulSteamID uint64
internal int ChangeFlags; // m_nChangeFlags int
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamFriends + 4;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(FriendStateChange_t) : typeof(Pack8) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => Config.PackSmall ? ((FriendStateChange_t)(FriendStateChange_t) Marshal.PtrToStructure( p, typeof(FriendStateChange_t) )) : ((FriendStateChange_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(FriendStateChange_t) : typeof(Pack8) );
+ internal static FriendStateChange_t Fill( IntPtr p ) => Config.PackSmall ? ((FriendStateChange_t)(FriendStateChange_t) Marshal.PtrToStructure( p, typeof(FriendStateChange_t) )) : ((FriendStateChange_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (FriendStateChange_t)default(FriendStateChange_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (FriendStateChange_t)default(FriendStateChange_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(FriendStateChange_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 4, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamFriends + 4, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(FriendStateChange_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 4, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamFriends + 4, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamFriends + 4, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
#region Packed Versions
@@ -526,31 +788,55 @@ public struct Pack8
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct GameOverlayActivated_t : Steamworks.ISteamCallback
+ internal struct GameOverlayActivated_t
{
internal byte Active; // m_bActive uint8
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamFriends + 31;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(GameOverlayActivated_t) : typeof(Pack8) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => Config.PackSmall ? ((GameOverlayActivated_t)(GameOverlayActivated_t) Marshal.PtrToStructure( p, typeof(GameOverlayActivated_t) )) : ((GameOverlayActivated_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(GameOverlayActivated_t) : typeof(Pack8) );
+ internal static GameOverlayActivated_t Fill( IntPtr p ) => Config.PackSmall ? ((GameOverlayActivated_t)(GameOverlayActivated_t) Marshal.PtrToStructure( p, typeof(GameOverlayActivated_t) )) : ((GameOverlayActivated_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (GameOverlayActivated_t)default(GameOverlayActivated_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (GameOverlayActivated_t)default(GameOverlayActivated_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(GameOverlayActivated_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 31, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamFriends + 31, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(GameOverlayActivated_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 31, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamFriends + 31, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamFriends + 31, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
#region Packed Versions
@@ -565,34 +851,58 @@ public struct Pack8
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct GameServerChangeRequested_t : Steamworks.ISteamCallback
+ internal struct GameServerChangeRequested_t
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
internal string Server; // m_rgchServer char [64]
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
internal string Password; // m_rgchPassword char [64]
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamFriends + 32;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(GameServerChangeRequested_t) : typeof(Pack8) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => Config.PackSmall ? ((GameServerChangeRequested_t)(GameServerChangeRequested_t) Marshal.PtrToStructure( p, typeof(GameServerChangeRequested_t) )) : ((GameServerChangeRequested_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(GameServerChangeRequested_t) : typeof(Pack8) );
+ internal static GameServerChangeRequested_t Fill( IntPtr p ) => Config.PackSmall ? ((GameServerChangeRequested_t)(GameServerChangeRequested_t) Marshal.PtrToStructure( p, typeof(GameServerChangeRequested_t) )) : ((GameServerChangeRequested_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (GameServerChangeRequested_t)default(GameServerChangeRequested_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (GameServerChangeRequested_t)default(GameServerChangeRequested_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(GameServerChangeRequested_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 32, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamFriends + 32, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(GameServerChangeRequested_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 32, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamFriends + 32, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamFriends + 32, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
#region Packed Versions
@@ -610,222 +920,390 @@ public struct Pack8
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct GameLobbyJoinRequested_t : Steamworks.ISteamCallback
+ internal struct GameLobbyJoinRequested_t
{
internal ulong SteamIDLobby; // m_steamIDLobby class CSteamID
internal ulong SteamIDFriend; // m_steamIDFriend class CSteamID
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamFriends + 33;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( typeof(GameLobbyJoinRequested_t) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => ((GameLobbyJoinRequested_t)(GameLobbyJoinRequested_t) Marshal.PtrToStructure( p, typeof(GameLobbyJoinRequested_t) ) );
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(GameLobbyJoinRequested_t) );
+ internal static GameLobbyJoinRequested_t Fill( IntPtr p ) => ((GameLobbyJoinRequested_t)(GameLobbyJoinRequested_t) Marshal.PtrToStructure( p, typeof(GameLobbyJoinRequested_t) ) );
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (GameLobbyJoinRequested_t)default(GameLobbyJoinRequested_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (GameLobbyJoinRequested_t)default(GameLobbyJoinRequested_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(GameLobbyJoinRequested_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 33, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamFriends + 33, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(GameLobbyJoinRequested_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 33, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamFriends + 33, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamFriends + 33, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct AvatarImageLoaded_t : Steamworks.ISteamCallback
+ internal struct AvatarImageLoaded_t
{
internal ulong SteamID; // m_steamID class CSteamID
internal int Image; // m_iImage int
internal int Wide; // m_iWide int
internal int Tall; // m_iTall int
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamFriends + 34;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( typeof(AvatarImageLoaded_t) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => ((AvatarImageLoaded_t)(AvatarImageLoaded_t) Marshal.PtrToStructure( p, typeof(AvatarImageLoaded_t) ) );
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(AvatarImageLoaded_t) );
+ internal static AvatarImageLoaded_t Fill( IntPtr p ) => ((AvatarImageLoaded_t)(AvatarImageLoaded_t) Marshal.PtrToStructure( p, typeof(AvatarImageLoaded_t) ) );
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (AvatarImageLoaded_t)default(AvatarImageLoaded_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (AvatarImageLoaded_t)default(AvatarImageLoaded_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(AvatarImageLoaded_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 34, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamFriends + 34, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(AvatarImageLoaded_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 34, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamFriends + 34, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamFriends + 34, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct ClanOfficerListResponse_t : Steamworks.ISteamCallback
+ internal struct ClanOfficerListResponse_t
{
internal ulong SteamIDClan; // m_steamIDClan class CSteamID
internal int COfficers; // m_cOfficers int
internal byte Success; // m_bSuccess uint8
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamFriends + 35;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( typeof(ClanOfficerListResponse_t) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => ((ClanOfficerListResponse_t)(ClanOfficerListResponse_t) Marshal.PtrToStructure( p, typeof(ClanOfficerListResponse_t) ) );
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(ClanOfficerListResponse_t) );
+ internal static ClanOfficerListResponse_t Fill( IntPtr p ) => ((ClanOfficerListResponse_t)(ClanOfficerListResponse_t) Marshal.PtrToStructure( p, typeof(ClanOfficerListResponse_t) ) );
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (ClanOfficerListResponse_t)default(ClanOfficerListResponse_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (ClanOfficerListResponse_t)default(ClanOfficerListResponse_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(ClanOfficerListResponse_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 35, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamFriends + 35, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(ClanOfficerListResponse_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 35, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamFriends + 35, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamFriends + 35, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct FriendRichPresenceUpdate_t : Steamworks.ISteamCallback
+ internal struct FriendRichPresenceUpdate_t
{
internal ulong SteamIDFriend; // m_steamIDFriend class CSteamID
internal AppId AppID; // m_nAppID AppId_t
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamFriends + 36;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( typeof(FriendRichPresenceUpdate_t) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => ((FriendRichPresenceUpdate_t)(FriendRichPresenceUpdate_t) Marshal.PtrToStructure( p, typeof(FriendRichPresenceUpdate_t) ) );
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(FriendRichPresenceUpdate_t) );
+ internal static FriendRichPresenceUpdate_t Fill( IntPtr p ) => ((FriendRichPresenceUpdate_t)(FriendRichPresenceUpdate_t) Marshal.PtrToStructure( p, typeof(FriendRichPresenceUpdate_t) ) );
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (FriendRichPresenceUpdate_t)default(FriendRichPresenceUpdate_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (FriendRichPresenceUpdate_t)default(FriendRichPresenceUpdate_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(FriendRichPresenceUpdate_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 36, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamFriends + 36, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(FriendRichPresenceUpdate_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 36, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamFriends + 36, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamFriends + 36, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct GameRichPresenceJoinRequested_t : Steamworks.ISteamCallback
+ internal struct GameRichPresenceJoinRequested_t
{
internal ulong SteamIDFriend; // m_steamIDFriend class CSteamID
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
internal string Connect; // m_rgchConnect char [256]
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamFriends + 37;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( typeof(GameRichPresenceJoinRequested_t) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => ((GameRichPresenceJoinRequested_t)(GameRichPresenceJoinRequested_t) Marshal.PtrToStructure( p, typeof(GameRichPresenceJoinRequested_t) ) );
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(GameRichPresenceJoinRequested_t) );
+ internal static GameRichPresenceJoinRequested_t Fill( IntPtr p ) => ((GameRichPresenceJoinRequested_t)(GameRichPresenceJoinRequested_t) Marshal.PtrToStructure( p, typeof(GameRichPresenceJoinRequested_t) ) );
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (GameRichPresenceJoinRequested_t)default(GameRichPresenceJoinRequested_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (GameRichPresenceJoinRequested_t)default(GameRichPresenceJoinRequested_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(GameRichPresenceJoinRequested_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 37, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamFriends + 37, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(GameRichPresenceJoinRequested_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 37, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamFriends + 37, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamFriends + 37, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct GameConnectedClanChatMsg_t : Steamworks.ISteamCallback
+ internal struct GameConnectedClanChatMsg_t
{
internal ulong SteamIDClanChat; // m_steamIDClanChat class CSteamID
internal ulong SteamIDUser; // m_steamIDUser class CSteamID
internal int MessageID; // m_iMessageID int
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamFriends + 38;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( typeof(GameConnectedClanChatMsg_t) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => ((GameConnectedClanChatMsg_t)(GameConnectedClanChatMsg_t) Marshal.PtrToStructure( p, typeof(GameConnectedClanChatMsg_t) ) );
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(GameConnectedClanChatMsg_t) );
+ internal static GameConnectedClanChatMsg_t Fill( IntPtr p ) => ((GameConnectedClanChatMsg_t)(GameConnectedClanChatMsg_t) Marshal.PtrToStructure( p, typeof(GameConnectedClanChatMsg_t) ) );
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (GameConnectedClanChatMsg_t)default(GameConnectedClanChatMsg_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (GameConnectedClanChatMsg_t)default(GameConnectedClanChatMsg_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(GameConnectedClanChatMsg_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 38, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamFriends + 38, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(GameConnectedClanChatMsg_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 38, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamFriends + 38, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamFriends + 38, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct GameConnectedChatJoin_t : Steamworks.ISteamCallback
+ internal struct GameConnectedChatJoin_t
{
internal ulong SteamIDClanChat; // m_steamIDClanChat class CSteamID
internal ulong SteamIDUser; // m_steamIDUser class CSteamID
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamFriends + 39;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( typeof(GameConnectedChatJoin_t) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => ((GameConnectedChatJoin_t)(GameConnectedChatJoin_t) Marshal.PtrToStructure( p, typeof(GameConnectedChatJoin_t) ) );
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(GameConnectedChatJoin_t) );
+ internal static GameConnectedChatJoin_t Fill( IntPtr p ) => ((GameConnectedChatJoin_t)(GameConnectedChatJoin_t) Marshal.PtrToStructure( p, typeof(GameConnectedChatJoin_t) ) );
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (GameConnectedChatJoin_t)default(GameConnectedChatJoin_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (GameConnectedChatJoin_t)default(GameConnectedChatJoin_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(GameConnectedChatJoin_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 39, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamFriends + 39, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(GameConnectedChatJoin_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 39, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamFriends + 39, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamFriends + 39, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct GameConnectedChatLeave_t : Steamworks.ISteamCallback
+ internal struct GameConnectedChatLeave_t
{
internal ulong SteamIDClanChat; // m_steamIDClanChat class CSteamID
internal ulong SteamIDUser; // m_steamIDUser class CSteamID
@@ -834,57 +1312,105 @@ internal struct GameConnectedChatLeave_t : Steamworks.ISteamCallback
[MarshalAs(UnmanagedType.I1)]
internal bool Dropped; // m_bDropped _Bool
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamFriends + 40;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( typeof(GameConnectedChatLeave_t) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => ((GameConnectedChatLeave_t)(GameConnectedChatLeave_t) Marshal.PtrToStructure( p, typeof(GameConnectedChatLeave_t) ) );
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(GameConnectedChatLeave_t) );
+ internal static GameConnectedChatLeave_t Fill( IntPtr p ) => ((GameConnectedChatLeave_t)(GameConnectedChatLeave_t) Marshal.PtrToStructure( p, typeof(GameConnectedChatLeave_t) ) );
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (GameConnectedChatLeave_t)default(GameConnectedChatLeave_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (GameConnectedChatLeave_t)default(GameConnectedChatLeave_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(GameConnectedChatLeave_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 40, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamFriends + 40, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(GameConnectedChatLeave_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 40, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamFriends + 40, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamFriends + 40, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct DownloadClanActivityCountsResult_t : Steamworks.ISteamCallback
+ internal struct DownloadClanActivityCountsResult_t
{
[MarshalAs(UnmanagedType.I1)]
internal bool Success; // m_bSuccess _Bool
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamFriends + 41;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(DownloadClanActivityCountsResult_t) : typeof(Pack8) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => Config.PackSmall ? ((DownloadClanActivityCountsResult_t)(DownloadClanActivityCountsResult_t) Marshal.PtrToStructure( p, typeof(DownloadClanActivityCountsResult_t) )) : ((DownloadClanActivityCountsResult_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(DownloadClanActivityCountsResult_t) : typeof(Pack8) );
+ internal static DownloadClanActivityCountsResult_t Fill( IntPtr p ) => Config.PackSmall ? ((DownloadClanActivityCountsResult_t)(DownloadClanActivityCountsResult_t) Marshal.PtrToStructure( p, typeof(DownloadClanActivityCountsResult_t) )) : ((DownloadClanActivityCountsResult_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (DownloadClanActivityCountsResult_t)default(DownloadClanActivityCountsResult_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (DownloadClanActivityCountsResult_t)default(DownloadClanActivityCountsResult_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(DownloadClanActivityCountsResult_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 41, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamFriends + 41, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(DownloadClanActivityCountsResult_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 41, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamFriends + 41, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamFriends + 41, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
#region Packed Versions
@@ -900,130 +1426,226 @@ public struct Pack8
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct JoinClanChatRoomCompletionResult_t : Steamworks.ISteamCallback
+ internal struct JoinClanChatRoomCompletionResult_t
{
internal ulong SteamIDClanChat; // m_steamIDClanChat class CSteamID
internal ChatRoomEnterResponse ChatRoomEnterResponse; // m_eChatRoomEnterResponse enum EChatRoomEnterResponse
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamFriends + 42;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( typeof(JoinClanChatRoomCompletionResult_t) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => ((JoinClanChatRoomCompletionResult_t)(JoinClanChatRoomCompletionResult_t) Marshal.PtrToStructure( p, typeof(JoinClanChatRoomCompletionResult_t) ) );
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(JoinClanChatRoomCompletionResult_t) );
+ internal static JoinClanChatRoomCompletionResult_t Fill( IntPtr p ) => ((JoinClanChatRoomCompletionResult_t)(JoinClanChatRoomCompletionResult_t) Marshal.PtrToStructure( p, typeof(JoinClanChatRoomCompletionResult_t) ) );
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (JoinClanChatRoomCompletionResult_t)default(JoinClanChatRoomCompletionResult_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (JoinClanChatRoomCompletionResult_t)default(JoinClanChatRoomCompletionResult_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(JoinClanChatRoomCompletionResult_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 42, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamFriends + 42, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(JoinClanChatRoomCompletionResult_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 42, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamFriends + 42, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamFriends + 42, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct GameConnectedFriendChatMsg_t : Steamworks.ISteamCallback
+ internal struct GameConnectedFriendChatMsg_t
{
internal ulong SteamIDUser; // m_steamIDUser class CSteamID
internal int MessageID; // m_iMessageID int
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamFriends + 43;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( typeof(GameConnectedFriendChatMsg_t) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => ((GameConnectedFriendChatMsg_t)(GameConnectedFriendChatMsg_t) Marshal.PtrToStructure( p, typeof(GameConnectedFriendChatMsg_t) ) );
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(GameConnectedFriendChatMsg_t) );
+ internal static GameConnectedFriendChatMsg_t Fill( IntPtr p ) => ((GameConnectedFriendChatMsg_t)(GameConnectedFriendChatMsg_t) Marshal.PtrToStructure( p, typeof(GameConnectedFriendChatMsg_t) ) );
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (GameConnectedFriendChatMsg_t)default(GameConnectedFriendChatMsg_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (GameConnectedFriendChatMsg_t)default(GameConnectedFriendChatMsg_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(GameConnectedFriendChatMsg_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 43, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamFriends + 43, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(GameConnectedFriendChatMsg_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 43, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamFriends + 43, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamFriends + 43, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct FriendsGetFollowerCount_t : Steamworks.ISteamCallback
+ internal struct FriendsGetFollowerCount_t
{
internal Result Result; // m_eResult enum EResult
internal ulong SteamID; // m_steamID class CSteamID
internal int Count; // m_nCount int
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamFriends + 44;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( typeof(FriendsGetFollowerCount_t) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => ((FriendsGetFollowerCount_t)(FriendsGetFollowerCount_t) Marshal.PtrToStructure( p, typeof(FriendsGetFollowerCount_t) ) );
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(FriendsGetFollowerCount_t) );
+ internal static FriendsGetFollowerCount_t Fill( IntPtr p ) => ((FriendsGetFollowerCount_t)(FriendsGetFollowerCount_t) Marshal.PtrToStructure( p, typeof(FriendsGetFollowerCount_t) ) );
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (FriendsGetFollowerCount_t)default(FriendsGetFollowerCount_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (FriendsGetFollowerCount_t)default(FriendsGetFollowerCount_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(FriendsGetFollowerCount_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 44, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamFriends + 44, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(FriendsGetFollowerCount_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 44, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamFriends + 44, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamFriends + 44, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct FriendsIsFollowing_t : Steamworks.ISteamCallback
+ internal struct FriendsIsFollowing_t
{
internal Result Result; // m_eResult enum EResult
internal ulong SteamID; // m_steamID class CSteamID
[MarshalAs(UnmanagedType.I1)]
internal bool IsFollowing; // m_bIsFollowing _Bool
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamFriends + 45;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( typeof(FriendsIsFollowing_t) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => ((FriendsIsFollowing_t)(FriendsIsFollowing_t) Marshal.PtrToStructure( p, typeof(FriendsIsFollowing_t) ) );
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(FriendsIsFollowing_t) );
+ internal static FriendsIsFollowing_t Fill( IntPtr p ) => ((FriendsIsFollowing_t)(FriendsIsFollowing_t) Marshal.PtrToStructure( p, typeof(FriendsIsFollowing_t) ) );
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (FriendsIsFollowing_t)default(FriendsIsFollowing_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (FriendsIsFollowing_t)default(FriendsIsFollowing_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(FriendsIsFollowing_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 45, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamFriends + 45, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(FriendsIsFollowing_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 45, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamFriends + 45, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamFriends + 45, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct FriendsEnumerateFollowingList_t : Steamworks.ISteamCallback
+ internal struct FriendsEnumerateFollowingList_t
{
internal Result Result; // m_eResult enum EResult
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.U8)]
@@ -1031,32 +1653,56 @@ internal struct FriendsEnumerateFollowingList_t : Steamworks.ISteamCallback
internal int ResultsReturned; // m_nResultsReturned int32
internal int TotalResultCount; // m_nTotalResultCount int32
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamFriends + 46;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( typeof(FriendsEnumerateFollowingList_t) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => ((FriendsEnumerateFollowingList_t)(FriendsEnumerateFollowingList_t) Marshal.PtrToStructure( p, typeof(FriendsEnumerateFollowingList_t) ) );
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( typeof(FriendsEnumerateFollowingList_t) );
+ internal static FriendsEnumerateFollowingList_t Fill( IntPtr p ) => ((FriendsEnumerateFollowingList_t)(FriendsEnumerateFollowingList_t) Marshal.PtrToStructure( p, typeof(FriendsEnumerateFollowingList_t) ) );
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (FriendsEnumerateFollowingList_t)default(FriendsEnumerateFollowingList_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (FriendsEnumerateFollowingList_t)default(FriendsEnumerateFollowingList_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(FriendsEnumerateFollowingList_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 46, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamFriends + 46, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(FriendsEnumerateFollowingList_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 46, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamFriends + 46, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamFriends + 46, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct SetPersonaNameResponse_t : Steamworks.ISteamCallback
+ internal struct SetPersonaNameResponse_t
{
[MarshalAs(UnmanagedType.I1)]
internal bool Success; // m_bSuccess _Bool
@@ -1064,27 +1710,51 @@ internal struct SetPersonaNameResponse_t : Steamworks.ISteamCallback
internal bool LocalSuccess; // m_bLocalSuccess _Bool
internal Result Result; // m_result enum EResult
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamFriends + 47;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(SetPersonaNameResponse_t) : typeof(Pack8) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => Config.PackSmall ? ((SetPersonaNameResponse_t)(SetPersonaNameResponse_t) Marshal.PtrToStructure( p, typeof(SetPersonaNameResponse_t) )) : ((SetPersonaNameResponse_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(SetPersonaNameResponse_t) : typeof(Pack8) );
+ internal static SetPersonaNameResponse_t Fill( IntPtr p ) => Config.PackSmall ? ((SetPersonaNameResponse_t)(SetPersonaNameResponse_t) Marshal.PtrToStructure( p, typeof(SetPersonaNameResponse_t) )) : ((SetPersonaNameResponse_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (SetPersonaNameResponse_t)default(SetPersonaNameResponse_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (SetPersonaNameResponse_t)default(SetPersonaNameResponse_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(SetPersonaNameResponse_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 47, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamFriends + 47, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(SetPersonaNameResponse_t).GetStructSize(), CallbackIdentifiers.SteamFriends + 47, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamFriends + 47, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamFriends + 47, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
#region Packed Versions
@@ -1103,31 +1773,55 @@ public struct Pack8
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct LowBatteryPower_t : Steamworks.ISteamCallback
+ internal struct LowBatteryPower_t
{
internal byte MinutesBatteryLeft; // m_nMinutesBatteryLeft uint8
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamUtils + 2;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(LowBatteryPower_t) : typeof(Pack8) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => Config.PackSmall ? ((LowBatteryPower_t)(LowBatteryPower_t) Marshal.PtrToStructure( p, typeof(LowBatteryPower_t) )) : ((LowBatteryPower_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(LowBatteryPower_t) : typeof(Pack8) );
+ internal static LowBatteryPower_t Fill( IntPtr p ) => Config.PackSmall ? ((LowBatteryPower_t)(LowBatteryPower_t) Marshal.PtrToStructure( p, typeof(LowBatteryPower_t) )) : ((LowBatteryPower_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (LowBatteryPower_t)default(LowBatteryPower_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (LowBatteryPower_t)default(LowBatteryPower_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(LowBatteryPower_t).GetStructSize(), CallbackIdentifiers.SteamUtils + 2, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamUtils + 2, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(LowBatteryPower_t).GetStructSize(), CallbackIdentifiers.SteamUtils + 2, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamUtils + 2, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamUtils + 2, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
#region Packed Versions
@@ -1142,33 +1836,57 @@ public struct Pack8
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct SteamAPICallCompleted_t : Steamworks.ISteamCallback
+ internal struct SteamAPICallCompleted_t
{
internal ulong AsyncCall; // m_hAsyncCall SteamAPICall_t
internal int Callback; // m_iCallback int
internal uint ParamCount; // m_cubParam uint32
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamUtils + 3;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(SteamAPICallCompleted_t) : typeof(Pack8) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => Config.PackSmall ? ((SteamAPICallCompleted_t)(SteamAPICallCompleted_t) Marshal.PtrToStructure( p, typeof(SteamAPICallCompleted_t) )) : ((SteamAPICallCompleted_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(SteamAPICallCompleted_t) : typeof(Pack8) );
+ internal static SteamAPICallCompleted_t Fill( IntPtr p ) => Config.PackSmall ? ((SteamAPICallCompleted_t)(SteamAPICallCompleted_t) Marshal.PtrToStructure( p, typeof(SteamAPICallCompleted_t) )) : ((SteamAPICallCompleted_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (SteamAPICallCompleted_t)default(SteamAPICallCompleted_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (SteamAPICallCompleted_t)default(SteamAPICallCompleted_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(SteamAPICallCompleted_t).GetStructSize(), CallbackIdentifiers.SteamUtils + 3, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamUtils + 3, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(SteamAPICallCompleted_t).GetStructSize(), CallbackIdentifiers.SteamUtils + 3, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamUtils + 3, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamUtils + 3, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
#region Packed Versions
@@ -1185,31 +1903,55 @@ public struct Pack8
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct CheckFileSignature_t : Steamworks.ISteamCallback
+ internal struct CheckFileSignature_t
{
internal CheckFileSignature CheckFileSignature; // m_eCheckFileSignature enum ECheckFileSignature
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamUtils + 5;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(CheckFileSignature_t) : typeof(Pack8) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => Config.PackSmall ? ((CheckFileSignature_t)(CheckFileSignature_t) Marshal.PtrToStructure( p, typeof(CheckFileSignature_t) )) : ((CheckFileSignature_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(CheckFileSignature_t) : typeof(Pack8) );
+ internal static CheckFileSignature_t Fill( IntPtr p ) => Config.PackSmall ? ((CheckFileSignature_t)(CheckFileSignature_t) Marshal.PtrToStructure( p, typeof(CheckFileSignature_t) )) : ((CheckFileSignature_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (CheckFileSignature_t)default(CheckFileSignature_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (CheckFileSignature_t)default(CheckFileSignature_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(CheckFileSignature_t).GetStructSize(), CallbackIdentifiers.SteamUtils + 5, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamUtils + 5, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(CheckFileSignature_t).GetStructSize(), CallbackIdentifiers.SteamUtils + 5, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamUtils + 5, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamUtils + 5, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
#region Packed Versions
@@ -1224,33 +1966,57 @@ public struct Pack8
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct GamepadTextInputDismissed_t : Steamworks.ISteamCallback
+ internal struct GamepadTextInputDismissed_t
{
[MarshalAs(UnmanagedType.I1)]
internal bool Submitted; // m_bSubmitted _Bool
internal uint SubmittedText; // m_unSubmittedText uint32
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamUtils + 14;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(GamepadTextInputDismissed_t) : typeof(Pack8) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => Config.PackSmall ? ((GamepadTextInputDismissed_t)(GamepadTextInputDismissed_t) Marshal.PtrToStructure( p, typeof(GamepadTextInputDismissed_t) )) : ((GamepadTextInputDismissed_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(GamepadTextInputDismissed_t) : typeof(Pack8) );
+ internal static GamepadTextInputDismissed_t Fill( IntPtr p ) => Config.PackSmall ? ((GamepadTextInputDismissed_t)(GamepadTextInputDismissed_t) Marshal.PtrToStructure( p, typeof(GamepadTextInputDismissed_t) )) : ((GamepadTextInputDismissed_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (GamepadTextInputDismissed_t)default(GamepadTextInputDismissed_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (GamepadTextInputDismissed_t)default(GamepadTextInputDismissed_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(GamepadTextInputDismissed_t).GetStructSize(), CallbackIdentifiers.SteamUtils + 14, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamUtils + 14, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(GamepadTextInputDismissed_t).GetStructSize(), CallbackIdentifiers.SteamUtils + 14, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamUtils + 14, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamUtils + 14, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
#region Packed Versions
@@ -1275,8 +2041,7 @@ internal struct MatchMakingKeyValuePair_t
internal string Value; // m_szValue char [256]
#region Marshalling
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(MatchMakingKeyValuePair_t) : typeof(Pack8) );
- public MatchMakingKeyValuePair_t Fill( IntPtr p ) => Config.PackSmall ? ((MatchMakingKeyValuePair_t)(MatchMakingKeyValuePair_t) Marshal.PtrToStructure( p, typeof(MatchMakingKeyValuePair_t) )) : ((MatchMakingKeyValuePair_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ internal static MatchMakingKeyValuePair_t Fill( IntPtr p ) => Config.PackSmall ? ((MatchMakingKeyValuePair_t)(MatchMakingKeyValuePair_t) Marshal.PtrToStructure( p, typeof(MatchMakingKeyValuePair_t) )) : ((MatchMakingKeyValuePair_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
#endregion
#region Packed Versions
@@ -1301,8 +2066,7 @@ internal struct servernetadr_t
internal uint IP; // m_unIP uint32
#region Marshalling
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(servernetadr_t) : typeof(Pack8) );
- public servernetadr_t Fill( IntPtr p ) => Config.PackSmall ? ((servernetadr_t)(servernetadr_t) Marshal.PtrToStructure( p, typeof(servernetadr_t) )) : ((servernetadr_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ internal static servernetadr_t Fill( IntPtr p ) => Config.PackSmall ? ((servernetadr_t)(servernetadr_t) Marshal.PtrToStructure( p, typeof(servernetadr_t) )) : ((servernetadr_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
#endregion
#region Packed Versions
@@ -1350,8 +2114,7 @@ internal struct gameserveritem_t
internal ulong SteamID; // m_steamID class CSteamID
#region Marshalling
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( typeof(gameserveritem_t) );
- public gameserveritem_t Fill( IntPtr p ) => ((gameserveritem_t)(gameserveritem_t) Marshal.PtrToStructure( p, typeof(gameserveritem_t) ) );
+ internal static gameserveritem_t Fill( IntPtr p ) => ((gameserveritem_t)(gameserveritem_t) Marshal.PtrToStructure( p, typeof(gameserveritem_t) ) );
#endregion
}
@@ -1362,8 +2125,7 @@ internal struct SteamPartyBeaconLocation_t
internal ulong LocationID; // m_ulLocationID uint64
#region Marshalling
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(SteamPartyBeaconLocation_t) : typeof(Pack8) );
- public SteamPartyBeaconLocation_t Fill( IntPtr p ) => Config.PackSmall ? ((SteamPartyBeaconLocation_t)(SteamPartyBeaconLocation_t) Marshal.PtrToStructure( p, typeof(SteamPartyBeaconLocation_t) )) : ((SteamPartyBeaconLocation_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ internal static SteamPartyBeaconLocation_t Fill( IntPtr p ) => Config.PackSmall ? ((SteamPartyBeaconLocation_t)(SteamPartyBeaconLocation_t) Marshal.PtrToStructure( p, typeof(SteamPartyBeaconLocation_t) )) : ((SteamPartyBeaconLocation_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
#endregion
#region Packed Versions
@@ -1379,7 +2141,7 @@ public struct Pack8
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct FavoritesListChanged_t : Steamworks.ISteamCallback
+ internal struct FavoritesListChanged_t
{
internal uint IP; // m_nIP uint32
internal uint QueryPort; // m_nQueryPort uint32
@@ -1390,27 +2152,51 @@ internal struct FavoritesListChanged_t : Steamworks.ISteamCallback
internal bool Add; // m_bAdd _Bool
internal uint AccountId; // m_unAccountId AccountID_t
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamMatchmaking + 2;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(FavoritesListChanged_t) : typeof(Pack8) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => Config.PackSmall ? ((FavoritesListChanged_t)(FavoritesListChanged_t) Marshal.PtrToStructure( p, typeof(FavoritesListChanged_t) )) : ((FavoritesListChanged_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(FavoritesListChanged_t) : typeof(Pack8) );
+ internal static FavoritesListChanged_t Fill( IntPtr p ) => Config.PackSmall ? ((FavoritesListChanged_t)(FavoritesListChanged_t) Marshal.PtrToStructure( p, typeof(FavoritesListChanged_t) )) : ((FavoritesListChanged_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (FavoritesListChanged_t)default(FavoritesListChanged_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (FavoritesListChanged_t)default(FavoritesListChanged_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(FavoritesListChanged_t).GetStructSize(), CallbackIdentifiers.SteamMatchmaking + 2, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamMatchmaking + 2, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(FavoritesListChanged_t).GetStructSize(), CallbackIdentifiers.SteamMatchmaking + 2, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamMatchmaking + 2, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamMatchmaking + 2, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
#region Packed Versions
@@ -1432,33 +2218,57 @@ public struct Pack8
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct LobbyInvite_t : Steamworks.ISteamCallback
+ internal struct LobbyInvite_t
{
internal ulong SteamIDUser; // m_ulSteamIDUser uint64
internal ulong SteamIDLobby; // m_ulSteamIDLobby uint64
internal ulong GameID; // m_ulGameID uint64
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamMatchmaking + 3;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(LobbyInvite_t) : typeof(Pack8) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => Config.PackSmall ? ((LobbyInvite_t)(LobbyInvite_t) Marshal.PtrToStructure( p, typeof(LobbyInvite_t) )) : ((LobbyInvite_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(LobbyInvite_t) : typeof(Pack8) );
+ internal static LobbyInvite_t Fill( IntPtr p ) => Config.PackSmall ? ((LobbyInvite_t)(LobbyInvite_t) Marshal.PtrToStructure( p, typeof(LobbyInvite_t) )) : ((LobbyInvite_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (LobbyInvite_t)default(LobbyInvite_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (LobbyInvite_t)default(LobbyInvite_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(LobbyInvite_t).GetStructSize(), CallbackIdentifiers.SteamMatchmaking + 3, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamMatchmaking + 3, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(LobbyInvite_t).GetStructSize(), CallbackIdentifiers.SteamMatchmaking + 3, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamMatchmaking + 3, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamMatchmaking + 3, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
#region Packed Versions
@@ -1475,7 +2285,7 @@ public struct Pack8
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct LobbyEnter_t : Steamworks.ISteamCallback
+ internal struct LobbyEnter_t
{
internal ulong SteamIDLobby; // m_ulSteamIDLobby uint64
internal uint GfChatPermissions; // m_rgfChatPermissions uint32
@@ -1483,27 +2293,51 @@ internal struct LobbyEnter_t : Steamworks.ISteamCallback
internal bool Locked; // m_bLocked _Bool
internal uint EChatRoomEnterResponse; // m_EChatRoomEnterResponse uint32
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamMatchmaking + 4;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(LobbyEnter_t) : typeof(Pack8) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => Config.PackSmall ? ((LobbyEnter_t)(LobbyEnter_t) Marshal.PtrToStructure( p, typeof(LobbyEnter_t) )) : ((LobbyEnter_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(LobbyEnter_t) : typeof(Pack8) );
+ internal static LobbyEnter_t Fill( IntPtr p ) => Config.PackSmall ? ((LobbyEnter_t)(LobbyEnter_t) Marshal.PtrToStructure( p, typeof(LobbyEnter_t) )) : ((LobbyEnter_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (LobbyEnter_t)default(LobbyEnter_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (LobbyEnter_t)default(LobbyEnter_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(LobbyEnter_t).GetStructSize(), CallbackIdentifiers.SteamMatchmaking + 4, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamMatchmaking + 4, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(LobbyEnter_t).GetStructSize(), CallbackIdentifiers.SteamMatchmaking + 4, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamMatchmaking + 4, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamMatchmaking + 4, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
#region Packed Versions
@@ -1522,33 +2356,57 @@ public struct Pack8
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct LobbyDataUpdate_t : Steamworks.ISteamCallback
+ internal struct LobbyDataUpdate_t
{
internal ulong SteamIDLobby; // m_ulSteamIDLobby uint64
internal ulong SteamIDMember; // m_ulSteamIDMember uint64
internal byte Success; // m_bSuccess uint8
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamMatchmaking + 5;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(LobbyDataUpdate_t) : typeof(Pack8) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => Config.PackSmall ? ((LobbyDataUpdate_t)(LobbyDataUpdate_t) Marshal.PtrToStructure( p, typeof(LobbyDataUpdate_t) )) : ((LobbyDataUpdate_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(LobbyDataUpdate_t) : typeof(Pack8) );
+ internal static LobbyDataUpdate_t Fill( IntPtr p ) => Config.PackSmall ? ((LobbyDataUpdate_t)(LobbyDataUpdate_t) Marshal.PtrToStructure( p, typeof(LobbyDataUpdate_t) )) : ((LobbyDataUpdate_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (LobbyDataUpdate_t)default(LobbyDataUpdate_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (LobbyDataUpdate_t)default(LobbyDataUpdate_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(LobbyDataUpdate_t).GetStructSize(), CallbackIdentifiers.SteamMatchmaking + 5, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamMatchmaking + 5, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(LobbyDataUpdate_t).GetStructSize(), CallbackIdentifiers.SteamMatchmaking + 5, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamMatchmaking + 5, false );
actionClient = action;
}
}
+ public static async Task GetResultAsync( SteamAPICall_t handle )
+ {
+ bool failed = false;
+
+ while ( !SteamUtils.IsCallComplete( handle, out failed ) )
+ {
+ await Task.Delay( 1 );
+ }
+ if ( failed ) return null;
+
+ var ptr = Marshal.AllocHGlobal( StructSize );
+
+ try
+ {
+ if ( !SteamUtils.Internal.GetAPICallResult( handle, ptr, StructSize, CallbackIdentifiers.SteamMatchmaking + 5, ref failed ) || failed )
+ return null;
+
+ return Fill( ptr );
+ }
+ finally
+ {
+ Marshal.FreeHGlobal( ptr );
+ }
+ }
#endregion
#region Packed Versions
@@ -1565,34 +2423,58 @@ public struct Pack8
}
[StructLayout( LayoutKind.Sequential, Pack = 4 )]
- internal struct LobbyChatUpdate_t : Steamworks.ISteamCallback
+ internal struct LobbyChatUpdate_t
{
internal ulong SteamIDLobby; // m_ulSteamIDLobby uint64
internal ulong SteamIDUserChanged; // m_ulSteamIDUserChanged uint64
internal ulong SteamIDMakingChange; // m_ulSteamIDMakingChange uint64
internal uint GfChatMemberStateChange; // m_rgfChatMemberStateChange uint32
- #region ISteamCallback
- public int GetCallbackId() => CallbackIdentifiers.SteamMatchmaking + 6;
- public int GetStructSize() => System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(LobbyChatUpdate_t) : typeof(Pack8) );
- public Steamworks.ISteamCallback Fill( IntPtr p ) => Config.PackSmall ? ((LobbyChatUpdate_t)(LobbyChatUpdate_t) Marshal.PtrToStructure( p, typeof(LobbyChatUpdate_t) )) : ((LobbyChatUpdate_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+ #region SteamCallback
+ internal static readonly int StructSize = System.Runtime.InteropServices.Marshal.SizeOf( Config.PackSmall ? typeof(LobbyChatUpdate_t) : typeof(Pack8) );
+ internal static LobbyChatUpdate_t Fill( IntPtr p ) => Config.PackSmall ? ((LobbyChatUpdate_t)(LobbyChatUpdate_t) Marshal.PtrToStructure( p, typeof(LobbyChatUpdate_t) )) : ((LobbyChatUpdate_t)(Pack8) Marshal.PtrToStructure( p, typeof(Pack8) ));
+
static Action actionClient;
- [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( (LobbyChatUpdate_t)default(LobbyChatUpdate_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnClient( IntPtr thisptr, IntPtr pvParam ) => actionClient?.Invoke( Fill( pvParam ) );
static Action actionServer;
- [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( (LobbyChatUpdate_t)default(LobbyChatUpdate_t).Fill( pvParam ) );
+ [MonoPInvokeCallback] static void OnServer( IntPtr thisptr, IntPtr pvParam ) => actionServer?.Invoke( Fill( pvParam ) );
public static void Install( Action action, bool server = false )
{
if ( server )
{
- Event.Register( OnServer, default(LobbyChatUpdate_t).GetStructSize(), CallbackIdentifiers.SteamMatchmaking + 6, true );
+ Event.Register( OnServer, StructSize, CallbackIdentifiers.SteamMatchmaking + 6, true );
actionServer = action;
}
else
{
- Event.Register( OnClient, default(LobbyChatUpdate_t).GetStructSize(), CallbackIdentifiers.SteamMatchmaking + 6, false );
+ Event.Register( OnClient, StructSize, CallbackIdentifiers.SteamMatchmaking + 6, false );
actionClient = action;
}
}
+ public static async Task