diff --git a/Facepunch.Steamworks/Callbacks/CallResult.cs b/Facepunch.Steamworks/Callbacks/CallResult.cs index 4a4dbe7..2850366 100644 --- a/Facepunch.Steamworks/Callbacks/CallResult.cs +++ b/Facepunch.Steamworks/Callbacks/CallResult.cs @@ -14,10 +14,16 @@ namespace Steamworks internal struct CallResult : INotifyCompletion where T : struct, ICallbackData { SteamAPICall_t call; + ISteamUtils utils; - public CallResult( SteamAPICall_t call ) + public CallResult( SteamAPICall_t call, bool server ) { this.call = call; + + utils = (server ? SteamUtils.InterfaceServer : SteamUtils.InterfaceClient) as ISteamUtils; + + if ( utils == null ) + utils = SteamUtils.Interface as ISteamUtils; } /// @@ -35,7 +41,8 @@ public void OnCompleted( Action continuation ) /// public T? GetResult() { - if ( !SteamUtils.IsCallComplete( call, out var failed ) || failed ) + bool failed = false; + if ( !utils.IsAPICallCompleted( call, ref failed ) || failed ) return null; var t = default( T ); @@ -44,8 +51,11 @@ public void OnCompleted( Action continuation ) try { - if ( !SteamUtils.Internal.GetAPICallResult( call, ptr, size, (int) t.CallbackType, ref failed ) || failed ) + if ( !utils.GetAPICallResult( call, ptr, size, (int)t.CallbackType, ref failed ) || failed ) + { + Console.WriteLine( $"Api Call result returned false or {failed}" ); return null; + } return ((T)Marshal.PtrToStructure( ptr, typeof( T ) )); } @@ -62,7 +72,8 @@ public bool IsCompleted { get { - if ( SteamUtils.IsCallComplete( call, out var failed ) || failed ) + bool failed = false; + if ( utils.IsAPICallCompleted( call, ref failed ) || failed ) return true; return false; diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamApps.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamApps.cs index 5eb52fd..8c39620 100644 --- a/Facepunch.Steamworks/Generated/Interfaces/ISteamApps.cs +++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamApps.cs @@ -320,7 +320,7 @@ internal void RequestAllProofOfPurchaseKeys() internal CallResult GetFileDetails( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pszFileName ) { var returnValue = _GetFileDetails( Self, pszFileName ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamFriends.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamFriends.cs index 922d570..d70f37c 100644 --- a/Facepunch.Steamworks/Generated/Interfaces/ISteamFriends.cs +++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamFriends.cs @@ -39,7 +39,7 @@ internal string GetPersonaName() internal CallResult SetPersonaName( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchPersonaName ) { var returnValue = _SetPersonaName( Self, pchPersonaName ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -283,7 +283,7 @@ internal bool GetClanActivityCounts( SteamId steamIDClan, ref int pnOnline, ref internal CallResult DownloadClanActivityCounts( [In,Out] SteamId[] psteamIDClans, int cClansToRequest ) { var returnValue = _DownloadClanActivityCounts( Self, psteamIDClans, cClansToRequest ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -443,7 +443,7 @@ internal bool RequestUserInformation( SteamId steamIDUser, [MarshalAs( Unmanaged internal CallResult RequestClanOfficerList( SteamId steamIDClan ) { var returnValue = _RequestClanOfficerList( Self, steamIDClan ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -619,7 +619,7 @@ internal AppId GetFriendCoplayGame( SteamId steamIDFriend ) internal CallResult JoinClanChatRoom( SteamId steamIDClan ) { var returnValue = _JoinClanChatRoom( Self, steamIDClan ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -770,7 +770,7 @@ internal int GetFriendMessage( SteamId steamIDFriend, int iMessageID, IntPtr pvD internal CallResult GetFollowerCount( SteamId steamID ) { var returnValue = _GetFollowerCount( Self, steamID ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -781,7 +781,7 @@ internal CallResult GetFollowerCount( SteamId steamID internal CallResult IsFollowing( SteamId steamID ) { var returnValue = _IsFollowing( Self, steamID ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -792,7 +792,7 @@ internal CallResult IsFollowing( SteamId steamID ) internal CallResult EnumerateFollowingList( uint unStartIndex ) { var returnValue = _EnumerateFollowingList( Self, unStartIndex ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamGameServer.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamGameServer.cs index 0edcb33..719af09 100644 --- a/Facepunch.Steamworks/Generated/Interfaces/ISteamGameServer.cs +++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamGameServer.cs @@ -385,7 +385,7 @@ internal void GetGameplayStats() internal CallResult GetServerReputation() { var returnValue = _GetServerReputation( Self ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -460,7 +460,7 @@ internal void ForceHeartbeat() internal CallResult AssociateWithClan( SteamId steamIDClan ) { var returnValue = _AssociateWithClan( Self, steamIDClan ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -471,7 +471,7 @@ internal CallResult AssociateWithClan( SteamId steamI internal CallResult ComputeNewPlayerCompatibility( SteamId steamIDNewPlayer ) { var returnValue = _ComputeNewPlayerCompatibility( Self, steamIDNewPlayer ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } } diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamGameServerStats.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamGameServerStats.cs index cf2243b..fee8757 100644 --- a/Facepunch.Steamworks/Generated/Interfaces/ISteamGameServerStats.cs +++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamGameServerStats.cs @@ -28,7 +28,7 @@ internal ISteamGameServerStats( bool IsGameServer ) internal CallResult RequestUserStats( SteamId steamIDUser ) { var returnValue = _RequestUserStats( Self, steamIDUser ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -135,7 +135,7 @@ internal bool ClearUserAchievement( SteamId steamIDUser, [MarshalAs( UnmanagedTy internal CallResult StoreUserStats( SteamId steamIDUser ) { var returnValue = _StoreUserStats( Self, steamIDUser ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } } diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamHTMLSurface.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamHTMLSurface.cs index 69aef3a..e9bc08d 100644 --- a/Facepunch.Steamworks/Generated/Interfaces/ISteamHTMLSurface.cs +++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamHTMLSurface.cs @@ -52,7 +52,7 @@ internal bool Shutdown() internal CallResult CreateBrowser( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchUserAgent, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchUserCSS ) { var returnValue = _CreateBrowser( Self, pchUserAgent, pchUserCSS ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamInventory.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamInventory.cs index 76245ee..4cba050 100644 --- a/Facepunch.Steamworks/Generated/Interfaces/ISteamInventory.cs +++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamInventory.cs @@ -341,7 +341,7 @@ internal bool GetItemDefinitionProperty( InventoryDefId iDefinition, [MarshalAs( internal CallResult RequestEligiblePromoItemDefinitionsIDs( SteamId steamID ) { var returnValue = _RequestEligiblePromoItemDefinitionsIDs( Self, steamID ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -364,7 +364,7 @@ internal bool GetEligiblePromoItemDefinitionIDs( SteamId steamID, [In,Out] Inven internal CallResult StartPurchase( [In,Out] InventoryDefId[] pArrayItemDefs, [In,Out] uint[] punArrayQuantity, uint unArrayLength ) { var returnValue = _StartPurchase( Self, pArrayItemDefs, punArrayQuantity, unArrayLength ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -375,7 +375,7 @@ internal CallResult StartPurchase( [In,Out] internal CallResult RequestPrices() { var returnValue = _RequestPrices( Self ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamMatchmaking.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamMatchmaking.cs index 89e66ee..f5f61f3 100644 --- a/Facepunch.Steamworks/Generated/Interfaces/ISteamMatchmaking.cs +++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamMatchmaking.cs @@ -74,7 +74,7 @@ internal bool RemoveFavoriteGame( AppId nAppID, uint nIP, ushort nConnPort, usho internal CallResult RequestLobbyList() { var returnValue = _RequestLobbyList( Self ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -166,7 +166,7 @@ internal SteamId GetLobbyByIndex( int iLobby ) internal CallResult CreateLobby( LobbyType eLobbyType, int cMaxMembers ) { var returnValue = _CreateLobby( Self, eLobbyType, cMaxMembers ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -177,7 +177,7 @@ internal CallResult CreateLobby( LobbyType eLobbyType, int cMaxM internal CallResult JoinLobby( SteamId steamIDLobby ) { var returnValue = _JoinLobby( Self, steamIDLobby ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamParties.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamParties.cs index f69024e..3740561 100644 --- a/Facepunch.Steamworks/Generated/Interfaces/ISteamParties.cs +++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamParties.cs @@ -64,7 +64,7 @@ internal bool GetBeaconDetails( PartyBeaconID_t ulBeaconID, ref SteamId pSteamID internal CallResult JoinParty( PartyBeaconID_t ulBeaconID ) { var returnValue = _JoinParty( Self, ulBeaconID ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -99,7 +99,7 @@ internal bool GetAvailableBeaconLocations( ref SteamPartyBeaconLocation_t pLocat internal CallResult CreateBeacon( uint unOpenSlots, /* ref */ SteamPartyBeaconLocation_t pBeaconLocation, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchConnectString, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchMetadata ) { var returnValue = _CreateBeacon( Self, unOpenSlots, ref pBeaconLocation, pchConnectString, pchMetadata ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -130,7 +130,7 @@ internal void CancelReservation( PartyBeaconID_t ulBeacon, SteamId steamIDUser ) internal CallResult ChangeNumOpenSlots( PartyBeaconID_t ulBeacon, uint unOpenSlots ) { var returnValue = _ChangeNumOpenSlots( Self, ulBeacon, unOpenSlots ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamRemoteStorage.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamRemoteStorage.cs index 825a9fb..cc2ee6b 100644 --- a/Facepunch.Steamworks/Generated/Interfaces/ISteamRemoteStorage.cs +++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamRemoteStorage.cs @@ -51,7 +51,7 @@ internal int FileRead( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef internal CallResult FileWriteAsync( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile, IntPtr pvData, uint cubData ) { var returnValue = _FileWriteAsync( Self, pchFile, pvData, cubData ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -62,7 +62,7 @@ internal CallResult FileWriteAsync( [Mars internal CallResult FileReadAsync( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile, uint nOffset, uint cubToRead ) { var returnValue = _FileReadAsync( Self, pchFile, nOffset, cubToRead ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -109,7 +109,7 @@ internal bool FileDelete( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalType internal CallResult FileShare( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchFile ) { var returnValue = _FileShare( Self, pchFile ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -304,7 +304,7 @@ internal void SetCloudEnabledForApp( [MarshalAs( UnmanagedType.U1 )] bool bEnabl internal CallResult UGCDownload( UGCHandle_t hContent, uint unPriority ) { var returnValue = _UGCDownload( Self, hContent, unPriority ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -372,7 +372,7 @@ internal UGCHandle_t GetCachedUGCHandle( int iCachedContent ) internal CallResult UGCDownloadToLocation( UGCHandle_t hContent, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchLocation, uint unPriority ) { var returnValue = _UGCDownloadToLocation( Self, hContent, pchLocation, unPriority ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } } diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamUGC.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamUGC.cs index 9e4958b..37640a1 100644 --- a/Facepunch.Steamworks/Generated/Interfaces/ISteamUGC.cs +++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamUGC.cs @@ -75,7 +75,7 @@ internal UGCQueryHandle_t CreateQueryUGCDetailsRequest( [In,Out] PublishedFileId internal CallResult SendQueryUGCRequest( UGCQueryHandle_t handle ) { var returnValue = _SendQueryUGCRequest( Self, handle ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -446,7 +446,7 @@ internal bool AddRequiredKeyValueTag( UGCQueryHandle_t handle, [MarshalAs( Unman internal CallResult RequestUGCDetails( PublishedFileId nPublishedFileID, uint unMaxAgeSeconds ) { var returnValue = _RequestUGCDetails( Self, nPublishedFileID, unMaxAgeSeconds ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -457,7 +457,7 @@ internal CallResult RequestUGCDetails( Publis internal CallResult CreateItem( AppId nConsumerAppId, WorkshopFileType eFileType ) { var returnValue = _CreateItem( Self, nConsumerAppId, eFileType ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -683,7 +683,7 @@ internal bool RemoveItemPreview( UGCUpdateHandle_t handle, uint index ) internal CallResult SubmitItemUpdate( UGCUpdateHandle_t handle, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchChangeNote ) { var returnValue = _SubmitItemUpdate( Self, handle, pchChangeNote ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -705,7 +705,7 @@ internal ItemUpdateStatus GetItemUpdateProgress( UGCUpdateHandle_t handle, ref u internal CallResult SetUserItemVote( PublishedFileId nPublishedFileID, [MarshalAs( UnmanagedType.U1 )] bool bVoteUp ) { var returnValue = _SetUserItemVote( Self, nPublishedFileID, bVoteUp ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -716,7 +716,7 @@ internal CallResult SetUserItemVote( PublishedFileId nP internal CallResult GetUserItemVote( PublishedFileId nPublishedFileID ) { var returnValue = _GetUserItemVote( Self, nPublishedFileID ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -727,7 +727,7 @@ internal CallResult GetUserItemVote( PublishedFileId nP internal CallResult AddItemToFavorites( AppId nAppId, PublishedFileId nPublishedFileID ) { var returnValue = _AddItemToFavorites( Self, nAppId, nPublishedFileID ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -738,7 +738,7 @@ internal CallResult AddItemToFavorites( AppId nA internal CallResult RemoveItemFromFavorites( AppId nAppId, PublishedFileId nPublishedFileID ) { var returnValue = _RemoveItemFromFavorites( Self, nAppId, nPublishedFileID ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -749,7 +749,7 @@ internal CallResult RemoveItemFromFavorites( App internal CallResult SubscribeItem( PublishedFileId nPublishedFileID ) { var returnValue = _SubscribeItem( Self, nPublishedFileID ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -760,7 +760,7 @@ internal CallResult SubscribeItem( internal CallResult UnsubscribeItem( PublishedFileId nPublishedFileID ) { var returnValue = _UnsubscribeItem( Self, nPublishedFileID ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -864,7 +864,7 @@ internal void SuspendDownloads( [MarshalAs( UnmanagedType.U1 )] bool bSuspend ) internal CallResult StartPlaytimeTracking( [In,Out] PublishedFileId[] pvecPublishedFileID, uint unNumPublishedFileIDs ) { var returnValue = _StartPlaytimeTracking( Self, pvecPublishedFileID, unNumPublishedFileIDs ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -875,7 +875,7 @@ internal CallResult StartPlaytimeTracking( [In,Ou internal CallResult StopPlaytimeTracking( [In,Out] PublishedFileId[] pvecPublishedFileID, uint unNumPublishedFileIDs ) { var returnValue = _StopPlaytimeTracking( Self, pvecPublishedFileID, unNumPublishedFileIDs ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -886,7 +886,7 @@ internal CallResult StopPlaytimeTracking( [In,Out] internal CallResult StopPlaytimeTrackingForAllItems() { var returnValue = _StopPlaytimeTrackingForAllItems( Self ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -897,7 +897,7 @@ internal CallResult StopPlaytimeTrackingForAllItem internal CallResult AddDependency( PublishedFileId nParentPublishedFileID, PublishedFileId nChildPublishedFileID ) { var returnValue = _AddDependency( Self, nParentPublishedFileID, nChildPublishedFileID ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -908,7 +908,7 @@ internal CallResult AddDependency( PublishedFileId nPa internal CallResult RemoveDependency( PublishedFileId nParentPublishedFileID, PublishedFileId nChildPublishedFileID ) { var returnValue = _RemoveDependency( Self, nParentPublishedFileID, nChildPublishedFileID ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -919,7 +919,7 @@ internal CallResult RemoveDependency( PublishedFile internal CallResult AddAppDependency( PublishedFileId nPublishedFileID, AppId nAppID ) { var returnValue = _AddAppDependency( Self, nPublishedFileID, nAppID ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -930,7 +930,7 @@ internal CallResult AddAppDependency( PublishedFileId internal CallResult RemoveAppDependency( PublishedFileId nPublishedFileID, AppId nAppID ) { var returnValue = _RemoveAppDependency( Self, nPublishedFileID, nAppID ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -941,7 +941,7 @@ internal CallResult RemoveAppDependency( PublishedF internal CallResult GetAppDependencies( PublishedFileId nPublishedFileID ) { var returnValue = _GetAppDependencies( Self, nPublishedFileID ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -952,7 +952,7 @@ internal CallResult GetAppDependencies( PublishedFil internal CallResult DeleteItem( PublishedFileId nPublishedFileID ) { var returnValue = _DeleteItem( Self, nPublishedFileID ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } } diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamUser.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamUser.cs index fde25cf..4702391 100644 --- a/Facepunch.Steamworks/Generated/Interfaces/ISteamUser.cs +++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamUser.cs @@ -246,7 +246,7 @@ internal void AdvertiseGame( SteamId steamIDGameServer, uint unIPServer, ushort internal CallResult RequestEncryptedAppTicket( IntPtr pDataToInclude, int cbDataToInclude ) { var returnValue = _RequestEncryptedAppTicket( Self, pDataToInclude, cbDataToInclude ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -291,7 +291,7 @@ internal int GetPlayerSteamLevel() internal CallResult RequestStoreAuthURL( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchRedirectURL ) { var returnValue = _RequestStoreAuthURL( Self, pchRedirectURL ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -350,7 +350,7 @@ internal bool BIsPhoneRequiringVerification() internal CallResult GetMarketEligibility() { var returnValue = _GetMarketEligibility( Self ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -361,7 +361,7 @@ internal CallResult GetMarketEligibility() internal CallResult GetDurationControl() { var returnValue = _GetDurationControl( Self ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } } diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamUserStats.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamUserStats.cs index b19279b..707ad76 100644 --- a/Facepunch.Steamworks/Generated/Interfaces/ISteamUserStats.cs +++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamUserStats.cs @@ -216,7 +216,7 @@ internal string GetAchievementName( uint iAchievement ) internal CallResult RequestUserStats( SteamId steamIDUser ) { var returnValue = _RequestUserStats( Self, steamIDUser ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -287,7 +287,7 @@ internal bool ResetAllStats( [MarshalAs( UnmanagedType.U1 )] bool bAchievementsT internal CallResult FindOrCreateLeaderboard( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchLeaderboardName, LeaderboardSort eLeaderboardSortMethod, LeaderboardDisplay eLeaderboardDisplayType ) { var returnValue = _FindOrCreateLeaderboard( Self, pchLeaderboardName, eLeaderboardSortMethod, eLeaderboardDisplayType ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -298,7 +298,7 @@ internal CallResult FindOrCreateLeaderboard( [MarshalAs internal CallResult FindLeaderboard( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchLeaderboardName ) { var returnValue = _FindLeaderboard( Self, pchLeaderboardName ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -353,7 +353,7 @@ internal LeaderboardDisplay GetLeaderboardDisplayType( SteamLeaderboard_t hSteam internal CallResult DownloadLeaderboardEntries( SteamLeaderboard_t hSteamLeaderboard, LeaderboardDataRequest eLeaderboardDataRequest, int nRangeStart, int nRangeEnd ) { var returnValue = _DownloadLeaderboardEntries( Self, hSteamLeaderboard, eLeaderboardDataRequest, nRangeStart, nRangeEnd ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -367,7 +367,7 @@ internal CallResult DownloadLeaderboardEntries( S internal CallResult DownloadLeaderboardEntriesForUsers( SteamLeaderboard_t hSteamLeaderboard, [In,Out] SteamId[] prgUsers, int cUsers ) { var returnValue = _DownloadLeaderboardEntriesForUsers( Self, hSteamLeaderboard, prgUsers, cUsers ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -390,7 +390,7 @@ internal bool GetDownloadedLeaderboardEntry( SteamLeaderboardEntries_t hSteamLea internal CallResult UploadLeaderboardScore( SteamLeaderboard_t hSteamLeaderboard, LeaderboardUploadScoreMethod eLeaderboardUploadScoreMethod, int nScore, [In,Out] int[] pScoreDetails, int cScoreDetailsCount ) { var returnValue = _UploadLeaderboardScore( Self, hSteamLeaderboard, eLeaderboardUploadScoreMethod, nScore, pScoreDetails, cScoreDetailsCount ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -401,7 +401,7 @@ internal CallResult UploadLeaderboardScore( SteamLea internal CallResult AttachLeaderboardUGC( SteamLeaderboard_t hSteamLeaderboard, UGCHandle_t hUGC ) { var returnValue = _AttachLeaderboardUGC( Self, hSteamLeaderboard, hUGC ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -412,7 +412,7 @@ internal CallResult AttachLeaderboardUGC( SteamLeaderboard_ internal CallResult GetNumberOfCurrentPlayers() { var returnValue = _GetNumberOfCurrentPlayers( Self ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -423,7 +423,7 @@ internal CallResult GetNumberOfCurrentPlayers() internal CallResult RequestGlobalAchievementPercentages() { var returnValue = _RequestGlobalAchievementPercentages( Self ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta @@ -472,7 +472,7 @@ internal bool GetAchievementAchievedPercent( [MarshalAs( UnmanagedType.CustomMar internal CallResult RequestGlobalStats( int nHistoryDays ) { var returnValue = _RequestGlobalStats( Self, nHistoryDays ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamUtils.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamUtils.cs index 65ea947..f091960 100644 --- a/Facepunch.Steamworks/Generated/Interfaces/ISteamUtils.cs +++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamUtils.cs @@ -234,7 +234,7 @@ internal bool BOverlayNeedsPresent() internal CallResult CheckFileSignature( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string szFileName ) { var returnValue = _CheckFileSignature( Self, szFileName ); - return new CallResult( returnValue ); + return new CallResult( returnValue, IsServer ); } #region FunctionMeta diff --git a/Facepunch.Steamworks/Utility/SteamInterface.cs b/Facepunch.Steamworks/Utility/SteamInterface.cs index 10e1cb9..2c5511f 100644 --- a/Facepunch.Steamworks/Utility/SteamInterface.cs +++ b/Facepunch.Steamworks/Utility/SteamInterface.cs @@ -21,12 +21,14 @@ internal abstract class SteamInterface public IntPtr SelfClient; public bool IsValid => Self != IntPtr.Zero; + public bool IsServer { get; private set; } internal void SetupInterface( bool gameServer ) { if ( Self != IntPtr.Zero ) return; + IsServer = gameServer; SelfGlobal = GetGlobalInterfacePointer(); Self = SelfGlobal; diff --git a/Generator/Types/SteamApiCallType.cs b/Generator/Types/SteamApiCallType.cs index c9bcf8b..e34677d 100644 --- a/Generator/Types/SteamApiCallType.cs +++ b/Generator/Types/SteamApiCallType.cs @@ -15,10 +15,7 @@ internal class SteamApiCallType : BaseType public override string TypeName => "SteamAPICall_t"; public override string Return( string varname ) { - if ( !string.IsNullOrEmpty( CallResult ) ) - return $"return new CallResult<{CallResult}>( {varname} );"; - - return $"return new CallResult( {varname} );"; + return $"return new CallResult<{CallResult}>( {varname}, IsServer );"; } public override string ReturnType