Special path for Windows call convention when returning a SteamId

This commit is contained in:
Garry Newman 2019-04-29 15:47:56 +01:00
parent 74ef28b9fc
commit b39ee80ecd
6 changed files with 159 additions and 56 deletions

View File

@ -38,6 +38,7 @@ namespace Steamworks
_GetAppInstallDir = Marshal.GetDelegateForFunctionPointer<FGetAppInstallDir>( Marshal.ReadIntPtr( VTable, 144) ); _GetAppInstallDir = Marshal.GetDelegateForFunctionPointer<FGetAppInstallDir>( Marshal.ReadIntPtr( VTable, 144) );
_BIsAppInstalled = Marshal.GetDelegateForFunctionPointer<FBIsAppInstalled>( Marshal.ReadIntPtr( VTable, 152) ); _BIsAppInstalled = Marshal.GetDelegateForFunctionPointer<FBIsAppInstalled>( Marshal.ReadIntPtr( VTable, 152) );
_GetAppOwner = Marshal.GetDelegateForFunctionPointer<FGetAppOwner>( Marshal.ReadIntPtr( VTable, 160) ); _GetAppOwner = Marshal.GetDelegateForFunctionPointer<FGetAppOwner>( Marshal.ReadIntPtr( VTable, 160) );
_GetAppOwner_Windows = Marshal.GetDelegateForFunctionPointer<FGetAppOwner_Windows>( Marshal.ReadIntPtr( VTable, 160) );
_GetLaunchQueryParam = Marshal.GetDelegateForFunctionPointer<FGetLaunchQueryParam>( Marshal.ReadIntPtr( VTable, 168) ); _GetLaunchQueryParam = Marshal.GetDelegateForFunctionPointer<FGetLaunchQueryParam>( Marshal.ReadIntPtr( VTable, 168) );
_GetDlcDownloadProgress = Marshal.GetDelegateForFunctionPointer<FGetDlcDownloadProgress>( Marshal.ReadIntPtr( VTable, 176) ); _GetDlcDownloadProgress = Marshal.GetDelegateForFunctionPointer<FGetDlcDownloadProgress>( Marshal.ReadIntPtr( VTable, 176) );
_GetAppBuildId = Marshal.GetDelegateForFunctionPointer<FGetAppBuildId>( Marshal.ReadIntPtr( VTable, 184) ); _GetAppBuildId = Marshal.GetDelegateForFunctionPointer<FGetAppBuildId>( Marshal.ReadIntPtr( VTable, 184) );
@ -280,15 +281,22 @@ namespace Steamworks
#region FunctionMeta #region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )] [UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetAppOwner( IntPtr self, ref SteamId retVal ); private delegate SteamId FGetAppOwner( IntPtr self );
private FGetAppOwner _GetAppOwner; private FGetAppOwner _GetAppOwner;
private delegate void FGetAppOwner_Windows( IntPtr self, ref SteamId retVal );
private FGetAppOwner_Windows _GetAppOwner_Windows;
#endregion #endregion
internal SteamId GetAppOwner() internal SteamId GetAppOwner()
{ {
var retVal = default( SteamId ); if ( Config.Os == OsType.Windows )
_GetAppOwner( Self, ref retVal ); {
return retVal; var retVal = default( SteamId );
_GetAppOwner_Windows( Self, ref retVal );
return retVal;
}
return _GetAppOwner( Self );
} }
#region FunctionMeta #region FunctionMeta

View File

@ -22,6 +22,7 @@ namespace Steamworks
_GetPersonaState = Marshal.GetDelegateForFunctionPointer<FGetPersonaState>( Marshal.ReadIntPtr( VTable, 16) ); _GetPersonaState = Marshal.GetDelegateForFunctionPointer<FGetPersonaState>( Marshal.ReadIntPtr( VTable, 16) );
_GetFriendCount = Marshal.GetDelegateForFunctionPointer<FGetFriendCount>( Marshal.ReadIntPtr( VTable, 24) ); _GetFriendCount = Marshal.GetDelegateForFunctionPointer<FGetFriendCount>( Marshal.ReadIntPtr( VTable, 24) );
_GetFriendByIndex = Marshal.GetDelegateForFunctionPointer<FGetFriendByIndex>( Marshal.ReadIntPtr( VTable, 32) ); _GetFriendByIndex = Marshal.GetDelegateForFunctionPointer<FGetFriendByIndex>( Marshal.ReadIntPtr( VTable, 32) );
_GetFriendByIndex_Windows = Marshal.GetDelegateForFunctionPointer<FGetFriendByIndex_Windows>( Marshal.ReadIntPtr( VTable, 32) );
_GetFriendRelationship = Marshal.GetDelegateForFunctionPointer<FGetFriendRelationship>( Marshal.ReadIntPtr( VTable, 40) ); _GetFriendRelationship = Marshal.GetDelegateForFunctionPointer<FGetFriendRelationship>( Marshal.ReadIntPtr( VTable, 40) );
_GetFriendPersonaState = Marshal.GetDelegateForFunctionPointer<FGetFriendPersonaState>( Marshal.ReadIntPtr( VTable, 48) ); _GetFriendPersonaState = Marshal.GetDelegateForFunctionPointer<FGetFriendPersonaState>( Marshal.ReadIntPtr( VTable, 48) );
_GetFriendPersonaName = Marshal.GetDelegateForFunctionPointer<FGetFriendPersonaName>( Marshal.ReadIntPtr( VTable, 56) ); _GetFriendPersonaName = Marshal.GetDelegateForFunctionPointer<FGetFriendPersonaName>( Marshal.ReadIntPtr( VTable, 56) );
@ -37,12 +38,14 @@ namespace Steamworks
_HasFriend = Marshal.GetDelegateForFunctionPointer<FHasFriend>( Marshal.ReadIntPtr( VTable, 136) ); _HasFriend = Marshal.GetDelegateForFunctionPointer<FHasFriend>( Marshal.ReadIntPtr( VTable, 136) );
_GetClanCount = Marshal.GetDelegateForFunctionPointer<FGetClanCount>( Marshal.ReadIntPtr( VTable, 144) ); _GetClanCount = Marshal.GetDelegateForFunctionPointer<FGetClanCount>( Marshal.ReadIntPtr( VTable, 144) );
_GetClanByIndex = Marshal.GetDelegateForFunctionPointer<FGetClanByIndex>( Marshal.ReadIntPtr( VTable, 152) ); _GetClanByIndex = Marshal.GetDelegateForFunctionPointer<FGetClanByIndex>( Marshal.ReadIntPtr( VTable, 152) );
_GetClanByIndex_Windows = Marshal.GetDelegateForFunctionPointer<FGetClanByIndex_Windows>( Marshal.ReadIntPtr( VTable, 152) );
_GetClanName = Marshal.GetDelegateForFunctionPointer<FGetClanName>( Marshal.ReadIntPtr( VTable, 160) ); _GetClanName = Marshal.GetDelegateForFunctionPointer<FGetClanName>( Marshal.ReadIntPtr( VTable, 160) );
_GetClanTag = Marshal.GetDelegateForFunctionPointer<FGetClanTag>( Marshal.ReadIntPtr( VTable, 168) ); _GetClanTag = Marshal.GetDelegateForFunctionPointer<FGetClanTag>( Marshal.ReadIntPtr( VTable, 168) );
_GetClanActivityCounts = Marshal.GetDelegateForFunctionPointer<FGetClanActivityCounts>( Marshal.ReadIntPtr( VTable, 176) ); _GetClanActivityCounts = Marshal.GetDelegateForFunctionPointer<FGetClanActivityCounts>( Marshal.ReadIntPtr( VTable, 176) );
_DownloadClanActivityCounts = Marshal.GetDelegateForFunctionPointer<FDownloadClanActivityCounts>( Marshal.ReadIntPtr( VTable, 184) ); _DownloadClanActivityCounts = Marshal.GetDelegateForFunctionPointer<FDownloadClanActivityCounts>( Marshal.ReadIntPtr( VTable, 184) );
_GetFriendCountFromSource = Marshal.GetDelegateForFunctionPointer<FGetFriendCountFromSource>( Marshal.ReadIntPtr( VTable, 192) ); _GetFriendCountFromSource = Marshal.GetDelegateForFunctionPointer<FGetFriendCountFromSource>( Marshal.ReadIntPtr( VTable, 192) );
_GetFriendFromSourceByIndex = Marshal.GetDelegateForFunctionPointer<FGetFriendFromSourceByIndex>( Marshal.ReadIntPtr( VTable, 200) ); _GetFriendFromSourceByIndex = Marshal.GetDelegateForFunctionPointer<FGetFriendFromSourceByIndex>( Marshal.ReadIntPtr( VTable, 200) );
_GetFriendFromSourceByIndex_Windows = Marshal.GetDelegateForFunctionPointer<FGetFriendFromSourceByIndex_Windows>( Marshal.ReadIntPtr( VTable, 200) );
_IsUserInSource = Marshal.GetDelegateForFunctionPointer<FIsUserInSource>( Marshal.ReadIntPtr( VTable, 208) ); _IsUserInSource = Marshal.GetDelegateForFunctionPointer<FIsUserInSource>( Marshal.ReadIntPtr( VTable, 208) );
_SetInGameVoiceSpeaking = Marshal.GetDelegateForFunctionPointer<FSetInGameVoiceSpeaking>( Marshal.ReadIntPtr( VTable, 216) ); _SetInGameVoiceSpeaking = Marshal.GetDelegateForFunctionPointer<FSetInGameVoiceSpeaking>( Marshal.ReadIntPtr( VTable, 216) );
_ActivateGameOverlay = Marshal.GetDelegateForFunctionPointer<FActivateGameOverlay>( Marshal.ReadIntPtr( VTable, 224) ); _ActivateGameOverlay = Marshal.GetDelegateForFunctionPointer<FActivateGameOverlay>( Marshal.ReadIntPtr( VTable, 224) );
@ -57,8 +60,10 @@ namespace Steamworks
_RequestUserInformation = Marshal.GetDelegateForFunctionPointer<FRequestUserInformation>( Marshal.ReadIntPtr( VTable, 296) ); _RequestUserInformation = Marshal.GetDelegateForFunctionPointer<FRequestUserInformation>( Marshal.ReadIntPtr( VTable, 296) );
_RequestClanOfficerList = Marshal.GetDelegateForFunctionPointer<FRequestClanOfficerList>( Marshal.ReadIntPtr( VTable, 304) ); _RequestClanOfficerList = Marshal.GetDelegateForFunctionPointer<FRequestClanOfficerList>( Marshal.ReadIntPtr( VTable, 304) );
_GetClanOwner = Marshal.GetDelegateForFunctionPointer<FGetClanOwner>( Marshal.ReadIntPtr( VTable, 312) ); _GetClanOwner = Marshal.GetDelegateForFunctionPointer<FGetClanOwner>( Marshal.ReadIntPtr( VTable, 312) );
_GetClanOwner_Windows = Marshal.GetDelegateForFunctionPointer<FGetClanOwner_Windows>( Marshal.ReadIntPtr( VTable, 312) );
_GetClanOfficerCount = Marshal.GetDelegateForFunctionPointer<FGetClanOfficerCount>( Marshal.ReadIntPtr( VTable, 320) ); _GetClanOfficerCount = Marshal.GetDelegateForFunctionPointer<FGetClanOfficerCount>( Marshal.ReadIntPtr( VTable, 320) );
_GetClanOfficerByIndex = Marshal.GetDelegateForFunctionPointer<FGetClanOfficerByIndex>( Marshal.ReadIntPtr( VTable, 328) ); _GetClanOfficerByIndex = Marshal.GetDelegateForFunctionPointer<FGetClanOfficerByIndex>( Marshal.ReadIntPtr( VTable, 328) );
_GetClanOfficerByIndex_Windows = Marshal.GetDelegateForFunctionPointer<FGetClanOfficerByIndex_Windows>( Marshal.ReadIntPtr( VTable, 328) );
_GetUserRestrictions = Marshal.GetDelegateForFunctionPointer<FGetUserRestrictions>( Marshal.ReadIntPtr( VTable, 336) ); _GetUserRestrictions = Marshal.GetDelegateForFunctionPointer<FGetUserRestrictions>( Marshal.ReadIntPtr( VTable, 336) );
_SetRichPresence = Marshal.GetDelegateForFunctionPointer<FSetRichPresence>( Marshal.ReadIntPtr( VTable, 344) ); _SetRichPresence = Marshal.GetDelegateForFunctionPointer<FSetRichPresence>( Marshal.ReadIntPtr( VTable, 344) );
_ClearRichPresence = Marshal.GetDelegateForFunctionPointer<FClearRichPresence>( Marshal.ReadIntPtr( VTable, 352) ); _ClearRichPresence = Marshal.GetDelegateForFunctionPointer<FClearRichPresence>( Marshal.ReadIntPtr( VTable, 352) );
@ -69,12 +74,14 @@ namespace Steamworks
_InviteUserToGame = Marshal.GetDelegateForFunctionPointer<FInviteUserToGame>( Marshal.ReadIntPtr( VTable, 392) ); _InviteUserToGame = Marshal.GetDelegateForFunctionPointer<FInviteUserToGame>( Marshal.ReadIntPtr( VTable, 392) );
_GetCoplayFriendCount = Marshal.GetDelegateForFunctionPointer<FGetCoplayFriendCount>( Marshal.ReadIntPtr( VTable, 400) ); _GetCoplayFriendCount = Marshal.GetDelegateForFunctionPointer<FGetCoplayFriendCount>( Marshal.ReadIntPtr( VTable, 400) );
_GetCoplayFriend = Marshal.GetDelegateForFunctionPointer<FGetCoplayFriend>( Marshal.ReadIntPtr( VTable, 408) ); _GetCoplayFriend = Marshal.GetDelegateForFunctionPointer<FGetCoplayFriend>( Marshal.ReadIntPtr( VTable, 408) );
_GetCoplayFriend_Windows = Marshal.GetDelegateForFunctionPointer<FGetCoplayFriend_Windows>( Marshal.ReadIntPtr( VTable, 408) );
_GetFriendCoplayTime = Marshal.GetDelegateForFunctionPointer<FGetFriendCoplayTime>( Marshal.ReadIntPtr( VTable, 416) ); _GetFriendCoplayTime = Marshal.GetDelegateForFunctionPointer<FGetFriendCoplayTime>( Marshal.ReadIntPtr( VTable, 416) );
_GetFriendCoplayGame = Marshal.GetDelegateForFunctionPointer<FGetFriendCoplayGame>( Marshal.ReadIntPtr( VTable, 424) ); _GetFriendCoplayGame = Marshal.GetDelegateForFunctionPointer<FGetFriendCoplayGame>( Marshal.ReadIntPtr( VTable, 424) );
_JoinClanChatRoom = Marshal.GetDelegateForFunctionPointer<FJoinClanChatRoom>( Marshal.ReadIntPtr( VTable, 432) ); _JoinClanChatRoom = Marshal.GetDelegateForFunctionPointer<FJoinClanChatRoom>( Marshal.ReadIntPtr( VTable, 432) );
_LeaveClanChatRoom = Marshal.GetDelegateForFunctionPointer<FLeaveClanChatRoom>( Marshal.ReadIntPtr( VTable, 440) ); _LeaveClanChatRoom = Marshal.GetDelegateForFunctionPointer<FLeaveClanChatRoom>( Marshal.ReadIntPtr( VTable, 440) );
_GetClanChatMemberCount = Marshal.GetDelegateForFunctionPointer<FGetClanChatMemberCount>( Marshal.ReadIntPtr( VTable, 448) ); _GetClanChatMemberCount = Marshal.GetDelegateForFunctionPointer<FGetClanChatMemberCount>( Marshal.ReadIntPtr( VTable, 448) );
_GetChatMemberByIndex = Marshal.GetDelegateForFunctionPointer<FGetChatMemberByIndex>( Marshal.ReadIntPtr( VTable, 456) ); _GetChatMemberByIndex = Marshal.GetDelegateForFunctionPointer<FGetChatMemberByIndex>( Marshal.ReadIntPtr( VTable, 456) );
_GetChatMemberByIndex_Windows = Marshal.GetDelegateForFunctionPointer<FGetChatMemberByIndex_Windows>( Marshal.ReadIntPtr( VTable, 456) );
_SendClanChatMessage = Marshal.GetDelegateForFunctionPointer<FSendClanChatMessage>( Marshal.ReadIntPtr( VTable, 464) ); _SendClanChatMessage = Marshal.GetDelegateForFunctionPointer<FSendClanChatMessage>( Marshal.ReadIntPtr( VTable, 464) );
_GetClanChatMessage = Marshal.GetDelegateForFunctionPointer<FGetClanChatMessage>( Marshal.ReadIntPtr( VTable, 472) ); _GetClanChatMessage = Marshal.GetDelegateForFunctionPointer<FGetClanChatMessage>( Marshal.ReadIntPtr( VTable, 472) );
_IsClanChatAdmin = Marshal.GetDelegateForFunctionPointer<FIsClanChatAdmin>( Marshal.ReadIntPtr( VTable, 480) ); _IsClanChatAdmin = Marshal.GetDelegateForFunctionPointer<FIsClanChatAdmin>( Marshal.ReadIntPtr( VTable, 480) );
@ -138,15 +145,22 @@ namespace Steamworks
#region FunctionMeta #region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )] [UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetFriendByIndex( IntPtr self, ref SteamId retVal, int iFriend, int iFriendFlags ); private delegate SteamId FGetFriendByIndex( IntPtr self, int iFriend, int iFriendFlags );
private FGetFriendByIndex _GetFriendByIndex; private FGetFriendByIndex _GetFriendByIndex;
private delegate void FGetFriendByIndex_Windows( IntPtr self, ref SteamId retVal, int iFriend, int iFriendFlags );
private FGetFriendByIndex_Windows _GetFriendByIndex_Windows;
#endregion #endregion
internal SteamId GetFriendByIndex( int iFriend, int iFriendFlags ) internal SteamId GetFriendByIndex( int iFriend, int iFriendFlags )
{ {
var retVal = default( SteamId ); if ( Config.Os == OsType.Windows )
_GetFriendByIndex( Self, ref retVal, iFriend, iFriendFlags ); {
return retVal; var retVal = default( SteamId );
_GetFriendByIndex_Windows( Self, ref retVal, iFriend, iFriendFlags );
return retVal;
}
return _GetFriendByIndex( Self, iFriend, iFriendFlags );
} }
#region FunctionMeta #region FunctionMeta
@ -307,15 +321,22 @@ namespace Steamworks
#region FunctionMeta #region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )] [UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetClanByIndex( IntPtr self, ref SteamId retVal, int iClan ); private delegate SteamId FGetClanByIndex( IntPtr self, int iClan );
private FGetClanByIndex _GetClanByIndex; private FGetClanByIndex _GetClanByIndex;
private delegate void FGetClanByIndex_Windows( IntPtr self, ref SteamId retVal, int iClan );
private FGetClanByIndex_Windows _GetClanByIndex_Windows;
#endregion #endregion
internal SteamId GetClanByIndex( int iClan ) internal SteamId GetClanByIndex( int iClan )
{ {
var retVal = default( SteamId ); if ( Config.Os == OsType.Windows )
_GetClanByIndex( Self, ref retVal, iClan ); {
return retVal; var retVal = default( SteamId );
_GetClanByIndex_Windows( Self, ref retVal, iClan );
return retVal;
}
return _GetClanByIndex( Self, iClan );
} }
#region FunctionMeta #region FunctionMeta
@ -376,15 +397,22 @@ namespace Steamworks
#region FunctionMeta #region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )] [UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetFriendFromSourceByIndex( IntPtr self, ref SteamId retVal, SteamId steamIDSource, int iFriend ); private delegate SteamId FGetFriendFromSourceByIndex( IntPtr self, SteamId steamIDSource, int iFriend );
private FGetFriendFromSourceByIndex _GetFriendFromSourceByIndex; private FGetFriendFromSourceByIndex _GetFriendFromSourceByIndex;
private delegate void FGetFriendFromSourceByIndex_Windows( IntPtr self, ref SteamId retVal, SteamId steamIDSource, int iFriend );
private FGetFriendFromSourceByIndex_Windows _GetFriendFromSourceByIndex_Windows;
#endregion #endregion
internal SteamId GetFriendFromSourceByIndex( SteamId steamIDSource, int iFriend ) internal SteamId GetFriendFromSourceByIndex( SteamId steamIDSource, int iFriend )
{ {
var retVal = default( SteamId ); if ( Config.Os == OsType.Windows )
_GetFriendFromSourceByIndex( Self, ref retVal, steamIDSource, iFriend ); {
return retVal; var retVal = default( SteamId );
_GetFriendFromSourceByIndex_Windows( Self, ref retVal, steamIDSource, iFriend );
return retVal;
}
return _GetFriendFromSourceByIndex( Self, steamIDSource, iFriend );
} }
#region FunctionMeta #region FunctionMeta
@ -534,15 +562,22 @@ namespace Steamworks
#region FunctionMeta #region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )] [UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetClanOwner( IntPtr self, ref SteamId retVal, SteamId steamIDClan ); private delegate SteamId FGetClanOwner( IntPtr self, SteamId steamIDClan );
private FGetClanOwner _GetClanOwner; private FGetClanOwner _GetClanOwner;
private delegate void FGetClanOwner_Windows( IntPtr self, ref SteamId retVal, SteamId steamIDClan );
private FGetClanOwner_Windows _GetClanOwner_Windows;
#endregion #endregion
internal SteamId GetClanOwner( SteamId steamIDClan ) internal SteamId GetClanOwner( SteamId steamIDClan )
{ {
var retVal = default( SteamId ); if ( Config.Os == OsType.Windows )
_GetClanOwner( Self, ref retVal, steamIDClan ); {
return retVal; var retVal = default( SteamId );
_GetClanOwner_Windows( Self, ref retVal, steamIDClan );
return retVal;
}
return _GetClanOwner( Self, steamIDClan );
} }
#region FunctionMeta #region FunctionMeta
@ -558,15 +593,22 @@ namespace Steamworks
#region FunctionMeta #region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )] [UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetClanOfficerByIndex( IntPtr self, ref SteamId retVal, SteamId steamIDClan, int iOfficer ); private delegate SteamId FGetClanOfficerByIndex( IntPtr self, SteamId steamIDClan, int iOfficer );
private FGetClanOfficerByIndex _GetClanOfficerByIndex; private FGetClanOfficerByIndex _GetClanOfficerByIndex;
private delegate void FGetClanOfficerByIndex_Windows( IntPtr self, ref SteamId retVal, SteamId steamIDClan, int iOfficer );
private FGetClanOfficerByIndex_Windows _GetClanOfficerByIndex_Windows;
#endregion #endregion
internal SteamId GetClanOfficerByIndex( SteamId steamIDClan, int iOfficer ) internal SteamId GetClanOfficerByIndex( SteamId steamIDClan, int iOfficer )
{ {
var retVal = default( SteamId ); if ( Config.Os == OsType.Windows )
_GetClanOfficerByIndex( Self, ref retVal, steamIDClan, iOfficer ); {
return retVal; var retVal = default( SteamId );
_GetClanOfficerByIndex_Windows( Self, ref retVal, steamIDClan, iOfficer );
return retVal;
}
return _GetClanOfficerByIndex( Self, steamIDClan, iOfficer );
} }
#region FunctionMeta #region FunctionMeta
@ -672,15 +714,22 @@ namespace Steamworks
#region FunctionMeta #region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )] [UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetCoplayFriend( IntPtr self, ref SteamId retVal, int iCoplayFriend ); private delegate SteamId FGetCoplayFriend( IntPtr self, int iCoplayFriend );
private FGetCoplayFriend _GetCoplayFriend; private FGetCoplayFriend _GetCoplayFriend;
private delegate void FGetCoplayFriend_Windows( IntPtr self, ref SteamId retVal, int iCoplayFriend );
private FGetCoplayFriend_Windows _GetCoplayFriend_Windows;
#endregion #endregion
internal SteamId GetCoplayFriend( int iCoplayFriend ) internal SteamId GetCoplayFriend( int iCoplayFriend )
{ {
var retVal = default( SteamId ); if ( Config.Os == OsType.Windows )
_GetCoplayFriend( Self, ref retVal, iCoplayFriend ); {
return retVal; var retVal = default( SteamId );
_GetCoplayFriend_Windows( Self, ref retVal, iCoplayFriend );
return retVal;
}
return _GetCoplayFriend( Self, iCoplayFriend );
} }
#region FunctionMeta #region FunctionMeta
@ -741,15 +790,22 @@ namespace Steamworks
#region FunctionMeta #region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )] [UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetChatMemberByIndex( IntPtr self, ref SteamId retVal, SteamId steamIDClan, int iUser ); private delegate SteamId FGetChatMemberByIndex( IntPtr self, SteamId steamIDClan, int iUser );
private FGetChatMemberByIndex _GetChatMemberByIndex; private FGetChatMemberByIndex _GetChatMemberByIndex;
private delegate void FGetChatMemberByIndex_Windows( IntPtr self, ref SteamId retVal, SteamId steamIDClan, int iUser );
private FGetChatMemberByIndex_Windows _GetChatMemberByIndex_Windows;
#endregion #endregion
internal SteamId GetChatMemberByIndex( SteamId steamIDClan, int iUser ) internal SteamId GetChatMemberByIndex( SteamId steamIDClan, int iUser )
{ {
var retVal = default( SteamId ); if ( Config.Os == OsType.Windows )
_GetChatMemberByIndex( Self, ref retVal, steamIDClan, iUser ); {
return retVal; var retVal = default( SteamId );
_GetChatMemberByIndex_Windows( Self, ref retVal, steamIDClan, iUser );
return retVal;
}
return _GetChatMemberByIndex( Self, steamIDClan, iUser );
} }
#region FunctionMeta #region FunctionMeta

View File

@ -28,6 +28,7 @@ namespace Steamworks
_BLoggedOn = Marshal.GetDelegateForFunctionPointer<FBLoggedOn>( Marshal.ReadIntPtr( VTable, 64) ); _BLoggedOn = Marshal.GetDelegateForFunctionPointer<FBLoggedOn>( Marshal.ReadIntPtr( VTable, 64) );
_BSecure = Marshal.GetDelegateForFunctionPointer<FBSecure>( Marshal.ReadIntPtr( VTable, 72) ); _BSecure = Marshal.GetDelegateForFunctionPointer<FBSecure>( Marshal.ReadIntPtr( VTable, 72) );
_GetSteamID = Marshal.GetDelegateForFunctionPointer<FGetSteamID>( Marshal.ReadIntPtr( VTable, 80) ); _GetSteamID = Marshal.GetDelegateForFunctionPointer<FGetSteamID>( Marshal.ReadIntPtr( VTable, 80) );
_GetSteamID_Windows = Marshal.GetDelegateForFunctionPointer<FGetSteamID_Windows>( Marshal.ReadIntPtr( VTable, 80) );
_WasRestartRequested = Marshal.GetDelegateForFunctionPointer<FWasRestartRequested>( Marshal.ReadIntPtr( VTable, 88) ); _WasRestartRequested = Marshal.GetDelegateForFunctionPointer<FWasRestartRequested>( Marshal.ReadIntPtr( VTable, 88) );
_SetMaxPlayerCount = Marshal.GetDelegateForFunctionPointer<FSetMaxPlayerCount>( Marshal.ReadIntPtr( VTable, 96) ); _SetMaxPlayerCount = Marshal.GetDelegateForFunctionPointer<FSetMaxPlayerCount>( Marshal.ReadIntPtr( VTable, 96) );
_SetBotPlayerCount = Marshal.GetDelegateForFunctionPointer<FSetBotPlayerCount>( Marshal.ReadIntPtr( VTable, 104) ); _SetBotPlayerCount = Marshal.GetDelegateForFunctionPointer<FSetBotPlayerCount>( Marshal.ReadIntPtr( VTable, 104) );
@ -43,6 +44,7 @@ namespace Steamworks
_SetRegion = Marshal.GetDelegateForFunctionPointer<FSetRegion>( Marshal.ReadIntPtr( VTable, 184) ); _SetRegion = Marshal.GetDelegateForFunctionPointer<FSetRegion>( Marshal.ReadIntPtr( VTable, 184) );
_SendUserConnectAndAuthenticate = Marshal.GetDelegateForFunctionPointer<FSendUserConnectAndAuthenticate>( Marshal.ReadIntPtr( VTable, 192) ); _SendUserConnectAndAuthenticate = Marshal.GetDelegateForFunctionPointer<FSendUserConnectAndAuthenticate>( Marshal.ReadIntPtr( VTable, 192) );
_CreateUnauthenticatedUserConnection = Marshal.GetDelegateForFunctionPointer<FCreateUnauthenticatedUserConnection>( Marshal.ReadIntPtr( VTable, 200) ); _CreateUnauthenticatedUserConnection = Marshal.GetDelegateForFunctionPointer<FCreateUnauthenticatedUserConnection>( Marshal.ReadIntPtr( VTable, 200) );
_CreateUnauthenticatedUserConnection_Windows = Marshal.GetDelegateForFunctionPointer<FCreateUnauthenticatedUserConnection_Windows>( Marshal.ReadIntPtr( VTable, 200) );
_SendUserDisconnect = Marshal.GetDelegateForFunctionPointer<FSendUserDisconnect>( Marshal.ReadIntPtr( VTable, 208) ); _SendUserDisconnect = Marshal.GetDelegateForFunctionPointer<FSendUserDisconnect>( Marshal.ReadIntPtr( VTable, 208) );
_BUpdateUserData = Marshal.GetDelegateForFunctionPointer<FBUpdateUserData>( Marshal.ReadIntPtr( VTable, 216) ); _BUpdateUserData = Marshal.GetDelegateForFunctionPointer<FBUpdateUserData>( Marshal.ReadIntPtr( VTable, 216) );
_GetAuthSessionTicket = Marshal.GetDelegateForFunctionPointer<FGetAuthSessionTicket>( Marshal.ReadIntPtr( VTable, 224) ); _GetAuthSessionTicket = Marshal.GetDelegateForFunctionPointer<FGetAuthSessionTicket>( Marshal.ReadIntPtr( VTable, 224) );
@ -178,15 +180,22 @@ namespace Steamworks
#region FunctionMeta #region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )] [UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetSteamID( IntPtr self, ref SteamId retVal ); private delegate SteamId FGetSteamID( IntPtr self );
private FGetSteamID _GetSteamID; private FGetSteamID _GetSteamID;
private delegate void FGetSteamID_Windows( IntPtr self, ref SteamId retVal );
private FGetSteamID_Windows _GetSteamID_Windows;
#endregion #endregion
internal SteamId GetSteamID() internal SteamId GetSteamID()
{ {
var retVal = default( SteamId ); if ( Config.Os == OsType.Windows )
_GetSteamID( Self, ref retVal ); {
return retVal; var retVal = default( SteamId );
_GetSteamID_Windows( Self, ref retVal );
return retVal;
}
return _GetSteamID( Self );
} }
#region FunctionMeta #region FunctionMeta
@ -347,15 +356,22 @@ namespace Steamworks
#region FunctionMeta #region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )] [UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FCreateUnauthenticatedUserConnection( IntPtr self, ref SteamId retVal ); private delegate SteamId FCreateUnauthenticatedUserConnection( IntPtr self );
private FCreateUnauthenticatedUserConnection _CreateUnauthenticatedUserConnection; private FCreateUnauthenticatedUserConnection _CreateUnauthenticatedUserConnection;
private delegate void FCreateUnauthenticatedUserConnection_Windows( IntPtr self, ref SteamId retVal );
private FCreateUnauthenticatedUserConnection_Windows _CreateUnauthenticatedUserConnection_Windows;
#endregion #endregion
internal SteamId CreateUnauthenticatedUserConnection() internal SteamId CreateUnauthenticatedUserConnection()
{ {
var retVal = default( SteamId ); if ( Config.Os == OsType.Windows )
_CreateUnauthenticatedUserConnection( Self, ref retVal ); {
return retVal; var retVal = default( SteamId );
_CreateUnauthenticatedUserConnection_Windows( Self, ref retVal );
return retVal;
}
return _CreateUnauthenticatedUserConnection( Self );
} }
#region FunctionMeta #region FunctionMeta

View File

@ -20,6 +20,7 @@ namespace Steamworks
_GetHSteamUser = Marshal.GetDelegateForFunctionPointer<FGetHSteamUser>( Marshal.ReadIntPtr( VTable, 0) ); _GetHSteamUser = Marshal.GetDelegateForFunctionPointer<FGetHSteamUser>( Marshal.ReadIntPtr( VTable, 0) );
_BLoggedOn = Marshal.GetDelegateForFunctionPointer<FBLoggedOn>( Marshal.ReadIntPtr( VTable, 8) ); _BLoggedOn = Marshal.GetDelegateForFunctionPointer<FBLoggedOn>( Marshal.ReadIntPtr( VTable, 8) );
_GetSteamID = Marshal.GetDelegateForFunctionPointer<FGetSteamID>( Marshal.ReadIntPtr( VTable, 16) ); _GetSteamID = Marshal.GetDelegateForFunctionPointer<FGetSteamID>( Marshal.ReadIntPtr( VTable, 16) );
_GetSteamID_Windows = Marshal.GetDelegateForFunctionPointer<FGetSteamID_Windows>( Marshal.ReadIntPtr( VTable, 16) );
_InitiateGameConnection = Marshal.GetDelegateForFunctionPointer<FInitiateGameConnection>( Marshal.ReadIntPtr( VTable, 24) ); _InitiateGameConnection = Marshal.GetDelegateForFunctionPointer<FInitiateGameConnection>( Marshal.ReadIntPtr( VTable, 24) );
_TerminateGameConnection = Marshal.GetDelegateForFunctionPointer<FTerminateGameConnection>( Marshal.ReadIntPtr( VTable, 32) ); _TerminateGameConnection = Marshal.GetDelegateForFunctionPointer<FTerminateGameConnection>( Marshal.ReadIntPtr( VTable, 32) );
_TrackAppUsageEvent = Marshal.GetDelegateForFunctionPointer<FTrackAppUsageEvent>( Marshal.ReadIntPtr( VTable, 40) ); _TrackAppUsageEvent = Marshal.GetDelegateForFunctionPointer<FTrackAppUsageEvent>( Marshal.ReadIntPtr( VTable, 40) );
@ -74,15 +75,22 @@ namespace Steamworks
#region FunctionMeta #region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )] [UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetSteamID( IntPtr self, ref SteamId retVal ); private delegate SteamId FGetSteamID( IntPtr self );
private FGetSteamID _GetSteamID; private FGetSteamID _GetSteamID;
private delegate void FGetSteamID_Windows( IntPtr self, ref SteamId retVal );
private FGetSteamID_Windows _GetSteamID_Windows;
#endregion #endregion
internal SteamId GetSteamID() internal SteamId GetSteamID()
{ {
var retVal = default( SteamId ); if ( Config.Os == OsType.Windows )
_GetSteamID( Self, ref retVal ); {
return retVal; var retVal = default( SteamId );
_GetSteamID_Windows( Self, ref retVal );
return retVal;
}
return _GetSteamID( Self );
} }
#region FunctionMeta #region FunctionMeta

View File

@ -361,7 +361,7 @@ namespace Steamworks
/// <summary> /// <summary>
/// We have received a server query on our game port. Pass it to Steam to handle. /// We have received a server query on our game port. Pass it to Steam to handle.
/// </summary> /// </summary>
public static unsafe void HandleIncomingPacket( byte[] data, int size, uint address, ushort port ) public static unsafe void HandleIncomingPacket( byte[] data, int size, uint address, ushort port )
{ {
fixed ( byte* ptr = data ) fixed ( byte* ptr = data )
{ {

View File

@ -95,6 +95,7 @@ namespace Generator
for (int i=0; i< clss.Functions.Count; i++ ) for (int i=0; i< clss.Functions.Count; i++ )
{ {
var func = clss.Functions[i]; var func = clss.Functions[i];
var returnType = BaseType.Parse( func.ReturnType );
if ( Cleanup.IsDeprecated( $"{clss.Name}.{func.Name}" ) ) if ( Cleanup.IsDeprecated( $"{clss.Name}.{func.Name}" ) )
{ {
@ -103,6 +104,11 @@ namespace Generator
else else
{ {
WriteLine( $"_{func.Name} = Marshal.GetDelegateForFunctionPointer<F{func.Name}>( Marshal.ReadIntPtr( VTable, {locations[i]}) );" ); WriteLine( $"_{func.Name} = Marshal.GetDelegateForFunctionPointer<F{func.Name}>( Marshal.ReadIntPtr( VTable, {locations[i]}) );" );
if ( returnType.IsReturnedWeird )
{
WriteLine( $"_{func.Name}_Windows = Marshal.GetDelegateForFunctionPointer<F{func.Name}_Windows>( Marshal.ReadIntPtr( VTable, {locations[i]}) );" );
}
} }
} }
} }
@ -134,12 +140,6 @@ namespace Generator
var argstr = string.Join( ", ", args.Select( x => x.AsArgument() ) ); var argstr = string.Join( ", ", args.Select( x => x.AsArgument() ) );
var delegateargstr = string.Join( ", ", args.Select( x => x.AsArgument() ) ); var delegateargstr = string.Join( ", ", args.Select( x => x.AsArgument() ) );
if ( returnType.IsReturnedWeird )
{
delegateargstr = $"ref {returnType.TypeName} retVal, {delegateargstr}";
delegateargstr = delegateargstr.Trim( ',', ' ' );
}
if ( returnType is SteamApiCallType sap ) if ( returnType is SteamApiCallType sap )
{ {
sap.CallResult = func.CallResult; sap.CallResult = func.CallResult;
@ -152,8 +152,17 @@ namespace Generator
if ( returnType.ReturnAttribute != null) if ( returnType.ReturnAttribute != null)
WriteLine( returnType.ReturnAttribute ); WriteLine( returnType.ReturnAttribute );
WriteLine( $"private delegate {(returnType.IsReturnedWeird?"void":returnType.TypeNameFrom)} F{func.Name}( IntPtr self, {delegateargstr} );".Replace( "( IntPtr self, )", "( IntPtr self )" ) ); WriteLine( $"private delegate {returnType.TypeNameFrom} F{func.Name}( IntPtr self, {delegateargstr} );".Replace( "( IntPtr self, )", "( IntPtr self )" ) );
WriteLine( $"private F{func.Name} _{func.Name};" ); WriteLine( $"private F{func.Name} _{func.Name};" );
if ( returnType.IsReturnedWeird )
{
var windelargs = $"ref {returnType.TypeName} retVal, {delegateargstr}".Trim( ',', ' ' );
WriteLine( $"private delegate void F{func.Name}_Windows( IntPtr self, {windelargs} );".Replace( "( IntPtr self, )", "( IntPtr self )" ) );
WriteLine( $"private F{func.Name}_Windows _{func.Name}_Windows;" );
}
WriteLine(); WriteLine();
WriteLine( $"#endregion" ); WriteLine( $"#endregion" );
@ -163,11 +172,17 @@ namespace Generator
if ( returnType.IsReturnedWeird ) if ( returnType.IsReturnedWeird )
{ {
WriteLine( $"var retVal = default( {returnType.TypeName} );" ); StartBlock( "if ( Config.Os == OsType.Windows )" );
WriteLine( $"_{func.Name}( Self, ref retVal, {callargs} );".Replace( ", );", " );" ) ); {
WriteLine( $"{returnType.Return( "retVal" )}" ); WriteLine( $"var retVal = default( {returnType.TypeName} );" );
WriteLine( $"_{func.Name}_Windows( Self, ref retVal, {callargs} );".Replace( ", );", " );" ) );
WriteLine( $"{returnType.Return( "retVal" )}" );
}
EndBlock();
WriteLine();
} }
else if ( returnType.IsVoid )
if ( returnType.IsVoid )
{ {
WriteLine( $"_{func.Name}( Self, {callargs} );".Replace( "( Self, )", "( Self )" ) ); WriteLine( $"_{func.Name}( Self, {callargs} );".Replace( "( Self, )", "( Self )" ) );
} }