No need for _Windows function alternatives

This commit is contained in:
Garry Newman 2019-06-25 11:39:17 +01:00
parent 6dbed6a91d
commit 690db722eb
16 changed files with 197 additions and 446 deletions

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<AssemblyName>Facepunch.Steamworks.Posix64</AssemblyName>
<DefineConstants>PLATFORM_POSIX64;PLATFORM_POSIX</DefineConstants>
<DefineConstants>$(DefineConstants);PLATFORM_POSIX64;PLATFORM_POSIX</DefineConstants>
<TargetFrameworks>netstandard2.0;net46</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>7.1</LangVersion>

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<AssemblyName>Facepunch.Steamworks.Win32</AssemblyName>
<DefineConstants>PLATFORM_WIN32;PLATFORM_WIN</DefineConstants>
<DefineConstants>$(DefineConstants);PLATFORM_WIN32;PLATFORM_WIN</DefineConstants>
<TargetFrameworks>netstandard2.0;net46</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>7.1</LangVersion>

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<AssemblyName>Facepunch.Steamworks.Win64</AssemblyName>
<DefineConstants>PLATFORM_WIN64;PLATFORM_WIN</DefineConstants>
<DefineConstants>$(DefineConstants);PLATFORM_WIN64;PLATFORM_WIN</DefineConstants>
<TargetFrameworks>netstandard2.0;net46</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>7.1</LangVersion>

View File

@ -6,12 +6,12 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DefineConstants>$(DefineConstants);TRACE;DEBUG</DefineConstants>
<NoWarn>1701;1702;1705;618;1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineConstants>TRACE;RELEASE</DefineConstants>
<DefineConstants>$(DefineConstants);TRACE;RELEASE</DefineConstants>
<NoWarn>1701;1702;1705;618;1591</NoWarn>
</PropertyGroup>

View File

@ -34,7 +34,6 @@ public override void InitInternals()
_GetAppInstallDir = Marshal.GetDelegateForFunctionPointer<FGetAppInstallDir>( Marshal.ReadIntPtr( VTable, 144) );
_BIsAppInstalled = Marshal.GetDelegateForFunctionPointer<FBIsAppInstalled>( Marshal.ReadIntPtr( VTable, 152) );
_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) );
_GetDlcDownloadProgress = Marshal.GetDelegateForFunctionPointer<FGetDlcDownloadProgress>( Marshal.ReadIntPtr( VTable, 176) );
_GetAppBuildId = Marshal.GetDelegateForFunctionPointer<FGetAppBuildId>( Marshal.ReadIntPtr( VTable, 184) );
@ -68,7 +67,6 @@ internal override void Shutdown()
_GetAppInstallDir = null;
_BIsAppInstalled = null;
_GetAppOwner = null;
_GetAppOwner_Windows = null;
_GetLaunchQueryParam = null;
_GetDlcDownloadProgress = null;
_GetAppBuildId = null;
@ -313,23 +311,23 @@ internal bool BIsAppInstalled( AppId appID )
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
#if PLATFORM_WIN64
private delegate void FGetAppOwner( IntPtr self, ref SteamId retVal );
#else
private delegate SteamId FGetAppOwner( IntPtr self );
#endif
private FGetAppOwner _GetAppOwner;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetAppOwner_Windows( IntPtr self, ref SteamId retVal );
private FGetAppOwner_Windows _GetAppOwner_Windows;
#endregion
internal SteamId GetAppOwner()
{
if ( Config.Os == OsType.Windows )
{
var retVal = default( SteamId );
_GetAppOwner_Windows( Self, ref retVal );
return retVal;
}
#if PLATFORM_WIN64
var retVal = default( SteamId );
_GetAppOwner( Self, ref retVal );
return retVal;
#else
return _GetAppOwner( Self );
#endif
}
#region FunctionMeta

View File

@ -18,7 +18,6 @@ public override void InitInternals()
_GetPersonaState = Marshal.GetDelegateForFunctionPointer<FGetPersonaState>( Marshal.ReadIntPtr( VTable, 16) );
_GetFriendCount = Marshal.GetDelegateForFunctionPointer<FGetFriendCount>( Marshal.ReadIntPtr( VTable, 24) );
_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) );
_GetFriendPersonaState = Marshal.GetDelegateForFunctionPointer<FGetFriendPersonaState>( Marshal.ReadIntPtr( VTable, 48) );
_GetFriendPersonaName = Marshal.GetDelegateForFunctionPointer<FGetFriendPersonaName>( Marshal.ReadIntPtr( VTable, 56) );
@ -34,14 +33,12 @@ public override void InitInternals()
_HasFriend = Marshal.GetDelegateForFunctionPointer<FHasFriend>( Marshal.ReadIntPtr( VTable, 136) );
_GetClanCount = Marshal.GetDelegateForFunctionPointer<FGetClanCount>( Marshal.ReadIntPtr( VTable, 144) );
_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) );
_GetClanTag = Marshal.GetDelegateForFunctionPointer<FGetClanTag>( Marshal.ReadIntPtr( VTable, 168) );
_GetClanActivityCounts = Marshal.GetDelegateForFunctionPointer<FGetClanActivityCounts>( Marshal.ReadIntPtr( VTable, 176) );
_DownloadClanActivityCounts = Marshal.GetDelegateForFunctionPointer<FDownloadClanActivityCounts>( Marshal.ReadIntPtr( VTable, 184) );
_GetFriendCountFromSource = Marshal.GetDelegateForFunctionPointer<FGetFriendCountFromSource>( Marshal.ReadIntPtr( VTable, 192) );
_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) );
_SetInGameVoiceSpeaking = Marshal.GetDelegateForFunctionPointer<FSetInGameVoiceSpeaking>( Marshal.ReadIntPtr( VTable, 216) );
_ActivateGameOverlay = Marshal.GetDelegateForFunctionPointer<FActivateGameOverlay>( Marshal.ReadIntPtr( VTable, 224) );
@ -56,10 +53,8 @@ public override void InitInternals()
_RequestUserInformation = Marshal.GetDelegateForFunctionPointer<FRequestUserInformation>( Marshal.ReadIntPtr( VTable, 296) );
_RequestClanOfficerList = Marshal.GetDelegateForFunctionPointer<FRequestClanOfficerList>( Marshal.ReadIntPtr( VTable, 304) );
_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) );
_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) );
_SetRichPresence = Marshal.GetDelegateForFunctionPointer<FSetRichPresence>( Marshal.ReadIntPtr( VTable, 344) );
_ClearRichPresence = Marshal.GetDelegateForFunctionPointer<FClearRichPresence>( Marshal.ReadIntPtr( VTable, 352) );
@ -70,14 +65,12 @@ public override void InitInternals()
_InviteUserToGame = Marshal.GetDelegateForFunctionPointer<FInviteUserToGame>( Marshal.ReadIntPtr( VTable, 392) );
_GetCoplayFriendCount = Marshal.GetDelegateForFunctionPointer<FGetCoplayFriendCount>( Marshal.ReadIntPtr( VTable, 400) );
_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) );
_GetFriendCoplayGame = Marshal.GetDelegateForFunctionPointer<FGetFriendCoplayGame>( Marshal.ReadIntPtr( VTable, 424) );
_JoinClanChatRoom = Marshal.GetDelegateForFunctionPointer<FJoinClanChatRoom>( Marshal.ReadIntPtr( VTable, 432) );
_LeaveClanChatRoom = Marshal.GetDelegateForFunctionPointer<FLeaveClanChatRoom>( Marshal.ReadIntPtr( VTable, 440) );
_GetClanChatMemberCount = Marshal.GetDelegateForFunctionPointer<FGetClanChatMemberCount>( Marshal.ReadIntPtr( VTable, 448) );
_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) );
_GetClanChatMessage = Marshal.GetDelegateForFunctionPointer<FGetClanChatMessage>( Marshal.ReadIntPtr( VTable, 472) );
_IsClanChatAdmin = Marshal.GetDelegateForFunctionPointer<FIsClanChatAdmin>( Marshal.ReadIntPtr( VTable, 480) );
@ -103,7 +96,6 @@ internal override void Shutdown()
_GetPersonaState = null;
_GetFriendCount = null;
_GetFriendByIndex = null;
_GetFriendByIndex_Windows = null;
_GetFriendRelationship = null;
_GetFriendPersonaState = null;
_GetFriendPersonaName = null;
@ -119,14 +111,12 @@ internal override void Shutdown()
_HasFriend = null;
_GetClanCount = null;
_GetClanByIndex = null;
_GetClanByIndex_Windows = null;
_GetClanName = null;
_GetClanTag = null;
_GetClanActivityCounts = null;
_DownloadClanActivityCounts = null;
_GetFriendCountFromSource = null;
_GetFriendFromSourceByIndex = null;
_GetFriendFromSourceByIndex_Windows = null;
_IsUserInSource = null;
_SetInGameVoiceSpeaking = null;
_ActivateGameOverlay = null;
@ -141,10 +131,8 @@ internal override void Shutdown()
_RequestUserInformation = null;
_RequestClanOfficerList = null;
_GetClanOwner = null;
_GetClanOwner_Windows = null;
_GetClanOfficerCount = null;
_GetClanOfficerByIndex = null;
_GetClanOfficerByIndex_Windows = null;
_GetUserRestrictions = null;
_SetRichPresence = null;
_ClearRichPresence = null;
@ -155,14 +143,12 @@ internal override void Shutdown()
_InviteUserToGame = null;
_GetCoplayFriendCount = null;
_GetCoplayFriend = null;
_GetCoplayFriend_Windows = null;
_GetFriendCoplayTime = null;
_GetFriendCoplayGame = null;
_JoinClanChatRoom = null;
_LeaveClanChatRoom = null;
_GetClanChatMemberCount = null;
_GetChatMemberByIndex = null;
_GetChatMemberByIndex_Windows = null;
_SendClanChatMessage = null;
_GetClanChatMessage = null;
_IsClanChatAdmin = null;
@ -227,23 +213,23 @@ internal int GetFriendCount( int iFriendFlags )
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
#if PLATFORM_WIN64
private delegate void FGetFriendByIndex( IntPtr self, ref SteamId retVal, int iFriend, int iFriendFlags );
#else
private delegate SteamId FGetFriendByIndex( IntPtr self, int iFriend, int iFriendFlags );
#endif
private FGetFriendByIndex _GetFriendByIndex;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetFriendByIndex_Windows( IntPtr self, ref SteamId retVal, int iFriend, int iFriendFlags );
private FGetFriendByIndex_Windows _GetFriendByIndex_Windows;
#endregion
internal SteamId GetFriendByIndex( int iFriend, int iFriendFlags )
{
if ( Config.Os == OsType.Windows )
{
var retVal = default( SteamId );
_GetFriendByIndex_Windows( Self, ref retVal, iFriend, iFriendFlags );
return retVal;
}
#if PLATFORM_WIN64
var retVal = default( SteamId );
_GetFriendByIndex( Self, ref retVal, iFriend, iFriendFlags );
return retVal;
#else
return _GetFriendByIndex( Self, iFriend, iFriendFlags );
#endif
}
#region FunctionMeta
@ -408,23 +394,23 @@ internal int GetClanCount()
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
#if PLATFORM_WIN64
private delegate void FGetClanByIndex( IntPtr self, ref SteamId retVal, int iClan );
#else
private delegate SteamId FGetClanByIndex( IntPtr self, int iClan );
#endif
private FGetClanByIndex _GetClanByIndex;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetClanByIndex_Windows( IntPtr self, ref SteamId retVal, int iClan );
private FGetClanByIndex_Windows _GetClanByIndex_Windows;
#endregion
internal SteamId GetClanByIndex( int iClan )
{
if ( Config.Os == OsType.Windows )
{
var retVal = default( SteamId );
_GetClanByIndex_Windows( Self, ref retVal, iClan );
return retVal;
}
#if PLATFORM_WIN64
var retVal = default( SteamId );
_GetClanByIndex( Self, ref retVal, iClan );
return retVal;
#else
return _GetClanByIndex( Self, iClan );
#endif
}
#region FunctionMeta
@ -487,23 +473,23 @@ internal int GetFriendCountFromSource( SteamId steamIDSource )
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
#if PLATFORM_WIN64
private delegate void FGetFriendFromSourceByIndex( IntPtr self, ref SteamId retVal, SteamId steamIDSource, int iFriend );
#else
private delegate SteamId FGetFriendFromSourceByIndex( IntPtr self, SteamId steamIDSource, int iFriend );
#endif
private FGetFriendFromSourceByIndex _GetFriendFromSourceByIndex;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetFriendFromSourceByIndex_Windows( IntPtr self, ref SteamId retVal, SteamId steamIDSource, int iFriend );
private FGetFriendFromSourceByIndex_Windows _GetFriendFromSourceByIndex_Windows;
#endregion
internal SteamId GetFriendFromSourceByIndex( SteamId steamIDSource, int iFriend )
{
if ( Config.Os == OsType.Windows )
{
var retVal = default( SteamId );
_GetFriendFromSourceByIndex_Windows( Self, ref retVal, steamIDSource, iFriend );
return retVal;
}
#if PLATFORM_WIN64
var retVal = default( SteamId );
_GetFriendFromSourceByIndex( Self, ref retVal, steamIDSource, iFriend );
return retVal;
#else
return _GetFriendFromSourceByIndex( Self, steamIDSource, iFriend );
#endif
}
#region FunctionMeta
@ -653,23 +639,23 @@ internal bool RequestUserInformation( SteamId steamIDUser, [MarshalAs( Unmanaged
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
#if PLATFORM_WIN64
private delegate void FGetClanOwner( IntPtr self, ref SteamId retVal, SteamId steamIDClan );
#else
private delegate SteamId FGetClanOwner( IntPtr self, SteamId steamIDClan );
#endif
private FGetClanOwner _GetClanOwner;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetClanOwner_Windows( IntPtr self, ref SteamId retVal, SteamId steamIDClan );
private FGetClanOwner_Windows _GetClanOwner_Windows;
#endregion
internal SteamId GetClanOwner( SteamId steamIDClan )
{
if ( Config.Os == OsType.Windows )
{
var retVal = default( SteamId );
_GetClanOwner_Windows( Self, ref retVal, steamIDClan );
return retVal;
}
#if PLATFORM_WIN64
var retVal = default( SteamId );
_GetClanOwner( Self, ref retVal, steamIDClan );
return retVal;
#else
return _GetClanOwner( Self, steamIDClan );
#endif
}
#region FunctionMeta
@ -685,23 +671,23 @@ internal int GetClanOfficerCount( SteamId steamIDClan )
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
#if PLATFORM_WIN64
private delegate void FGetClanOfficerByIndex( IntPtr self, ref SteamId retVal, SteamId steamIDClan, int iOfficer );
#else
private delegate SteamId FGetClanOfficerByIndex( IntPtr self, SteamId steamIDClan, int iOfficer );
#endif
private FGetClanOfficerByIndex _GetClanOfficerByIndex;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetClanOfficerByIndex_Windows( IntPtr self, ref SteamId retVal, SteamId steamIDClan, int iOfficer );
private FGetClanOfficerByIndex_Windows _GetClanOfficerByIndex_Windows;
#endregion
internal SteamId GetClanOfficerByIndex( SteamId steamIDClan, int iOfficer )
{
if ( Config.Os == OsType.Windows )
{
var retVal = default( SteamId );
_GetClanOfficerByIndex_Windows( Self, ref retVal, steamIDClan, iOfficer );
return retVal;
}
#if PLATFORM_WIN64
var retVal = default( SteamId );
_GetClanOfficerByIndex( Self, ref retVal, steamIDClan, iOfficer );
return retVal;
#else
return _GetClanOfficerByIndex( Self, steamIDClan, iOfficer );
#endif
}
#region FunctionMeta
@ -809,23 +795,23 @@ internal int GetCoplayFriendCount()
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
#if PLATFORM_WIN64
private delegate void FGetCoplayFriend( IntPtr self, ref SteamId retVal, int iCoplayFriend );
#else
private delegate SteamId FGetCoplayFriend( IntPtr self, int iCoplayFriend );
#endif
private FGetCoplayFriend _GetCoplayFriend;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetCoplayFriend_Windows( IntPtr self, ref SteamId retVal, int iCoplayFriend );
private FGetCoplayFriend_Windows _GetCoplayFriend_Windows;
#endregion
internal SteamId GetCoplayFriend( int iCoplayFriend )
{
if ( Config.Os == OsType.Windows )
{
var retVal = default( SteamId );
_GetCoplayFriend_Windows( Self, ref retVal, iCoplayFriend );
return retVal;
}
#if PLATFORM_WIN64
var retVal = default( SteamId );
_GetCoplayFriend( Self, ref retVal, iCoplayFriend );
return retVal;
#else
return _GetCoplayFriend( Self, iCoplayFriend );
#endif
}
#region FunctionMeta
@ -886,23 +872,23 @@ internal int GetClanChatMemberCount( SteamId steamIDClan )
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
#if PLATFORM_WIN64
private delegate void FGetChatMemberByIndex( IntPtr self, ref SteamId retVal, SteamId steamIDClan, int iUser );
#else
private delegate SteamId FGetChatMemberByIndex( IntPtr self, SteamId steamIDClan, int iUser );
#endif
private FGetChatMemberByIndex _GetChatMemberByIndex;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetChatMemberByIndex_Windows( IntPtr self, ref SteamId retVal, SteamId steamIDClan, int iUser );
private FGetChatMemberByIndex_Windows _GetChatMemberByIndex_Windows;
#endregion
internal SteamId GetChatMemberByIndex( SteamId steamIDClan, int iUser )
{
if ( Config.Os == OsType.Windows )
{
var retVal = default( SteamId );
_GetChatMemberByIndex_Windows( Self, ref retVal, steamIDClan, iUser );
return retVal;
}
#if PLATFORM_WIN64
var retVal = default( SteamId );
_GetChatMemberByIndex( Self, ref retVal, steamIDClan, iUser );
return retVal;
#else
return _GetChatMemberByIndex( Self, steamIDClan, iUser );
#endif
}
#region FunctionMeta

View File

@ -24,7 +24,6 @@ public override void InitInternals()
_BLoggedOn = Marshal.GetDelegateForFunctionPointer<FBLoggedOn>( Marshal.ReadIntPtr( VTable, 64) );
_BSecure = Marshal.GetDelegateForFunctionPointer<FBSecure>( Marshal.ReadIntPtr( VTable, 72) );
_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) );
_SetMaxPlayerCount = Marshal.GetDelegateForFunctionPointer<FSetMaxPlayerCount>( Marshal.ReadIntPtr( VTable, 96) );
_SetBotPlayerCount = Marshal.GetDelegateForFunctionPointer<FSetBotPlayerCount>( Marshal.ReadIntPtr( VTable, 104) );
@ -40,7 +39,6 @@ public override void InitInternals()
_SetRegion = Marshal.GetDelegateForFunctionPointer<FSetRegion>( Marshal.ReadIntPtr( VTable, 184) );
_SendUserConnectAndAuthenticate = Marshal.GetDelegateForFunctionPointer<FSendUserConnectAndAuthenticate>( Marshal.ReadIntPtr( VTable, 192) );
_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) );
_BUpdateUserData = Marshal.GetDelegateForFunctionPointer<FBUpdateUserData>( Marshal.ReadIntPtr( VTable, 216) );
_GetAuthSessionTicket = Marshal.GetDelegateForFunctionPointer<FGetAuthSessionTicket>( Marshal.ReadIntPtr( VTable, 224) );
@ -75,7 +73,6 @@ internal override void Shutdown()
_BLoggedOn = null;
_BSecure = null;
_GetSteamID = null;
_GetSteamID_Windows = null;
_WasRestartRequested = null;
_SetMaxPlayerCount = null;
_SetBotPlayerCount = null;
@ -91,7 +88,6 @@ internal override void Shutdown()
_SetRegion = null;
_SendUserConnectAndAuthenticate = null;
_CreateUnauthenticatedUserConnection = null;
_CreateUnauthenticatedUserConnection_Windows = null;
_SendUserDisconnect = null;
_BUpdateUserData = null;
_GetAuthSessionTicket = null;
@ -227,23 +223,23 @@ internal bool BSecure()
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
#if PLATFORM_WIN64
private delegate void FGetSteamID( IntPtr self, ref SteamId retVal );
#else
private delegate SteamId FGetSteamID( IntPtr self );
#endif
private FGetSteamID _GetSteamID;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetSteamID_Windows( IntPtr self, ref SteamId retVal );
private FGetSteamID_Windows _GetSteamID_Windows;
#endregion
internal SteamId GetSteamID()
{
if ( Config.Os == OsType.Windows )
{
var retVal = default( SteamId );
_GetSteamID_Windows( Self, ref retVal );
return retVal;
}
#if PLATFORM_WIN64
var retVal = default( SteamId );
_GetSteamID( Self, ref retVal );
return retVal;
#else
return _GetSteamID( Self );
#endif
}
#region FunctionMeta
@ -404,23 +400,23 @@ internal bool SendUserConnectAndAuthenticate( uint unIPClient, IntPtr pvAuthBlob
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
#if PLATFORM_WIN64
private delegate void FCreateUnauthenticatedUserConnection( IntPtr self, ref SteamId retVal );
#else
private delegate SteamId FCreateUnauthenticatedUserConnection( IntPtr self );
#endif
private FCreateUnauthenticatedUserConnection _CreateUnauthenticatedUserConnection;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FCreateUnauthenticatedUserConnection_Windows( IntPtr self, ref SteamId retVal );
private FCreateUnauthenticatedUserConnection_Windows _CreateUnauthenticatedUserConnection_Windows;
#endregion
internal SteamId CreateUnauthenticatedUserConnection()
{
if ( Config.Os == OsType.Windows )
{
var retVal = default( SteamId );
_CreateUnauthenticatedUserConnection_Windows( Self, ref retVal );
return retVal;
}
#if PLATFORM_WIN64
var retVal = default( SteamId );
_CreateUnauthenticatedUserConnection( Self, ref retVal );
return retVal;
#else
return _CreateUnauthenticatedUserConnection( Self );
#endif
}
#region FunctionMeta

View File

@ -26,17 +26,14 @@ public override void InitInternals()
_GetActiveActionSetLayers = Marshal.GetDelegateForFunctionPointer<FGetActiveActionSetLayers>( Marshal.ReadIntPtr( VTable, 80) );
_GetDigitalActionHandle = Marshal.GetDelegateForFunctionPointer<FGetDigitalActionHandle>( Marshal.ReadIntPtr( VTable, 88) );
_GetDigitalActionData = Marshal.GetDelegateForFunctionPointer<FGetDigitalActionData>( Marshal.ReadIntPtr( VTable, 96) );
_GetDigitalActionData_Windows = Marshal.GetDelegateForFunctionPointer<FGetDigitalActionData_Windows>( Marshal.ReadIntPtr( VTable, 96) );
_GetDigitalActionOrigins = Marshal.GetDelegateForFunctionPointer<FGetDigitalActionOrigins>( Marshal.ReadIntPtr( VTable, 104) );
_GetAnalogActionHandle = Marshal.GetDelegateForFunctionPointer<FGetAnalogActionHandle>( Marshal.ReadIntPtr( VTable, 112) );
_GetAnalogActionData = Marshal.GetDelegateForFunctionPointer<FGetAnalogActionData>( Marshal.ReadIntPtr( VTable, 120) );
_GetAnalogActionData_Windows = Marshal.GetDelegateForFunctionPointer<FGetAnalogActionData_Windows>( Marshal.ReadIntPtr( VTable, 120) );
_GetAnalogActionOrigins = Marshal.GetDelegateForFunctionPointer<FGetAnalogActionOrigins>( Marshal.ReadIntPtr( VTable, 128) );
_GetGlyphForActionOrigin = Marshal.GetDelegateForFunctionPointer<FGetGlyphForActionOrigin>( Marshal.ReadIntPtr( VTable, 136) );
_GetStringForActionOrigin = Marshal.GetDelegateForFunctionPointer<FGetStringForActionOrigin>( Marshal.ReadIntPtr( VTable, 144) );
_StopAnalogActionMomentum = Marshal.GetDelegateForFunctionPointer<FStopAnalogActionMomentum>( Marshal.ReadIntPtr( VTable, 152) );
_GetMotionData = Marshal.GetDelegateForFunctionPointer<FGetMotionData>( Marshal.ReadIntPtr( VTable, 160) );
_GetMotionData_Windows = Marshal.GetDelegateForFunctionPointer<FGetMotionData_Windows>( Marshal.ReadIntPtr( VTable, 160) );
_TriggerVibration = Marshal.GetDelegateForFunctionPointer<FTriggerVibration>( Marshal.ReadIntPtr( VTable, 168) );
_SetLEDColor = Marshal.GetDelegateForFunctionPointer<FSetLEDColor>( Marshal.ReadIntPtr( VTable, 176) );
_TriggerHapticPulse = Marshal.GetDelegateForFunctionPointer<FTriggerHapticPulse>( Marshal.ReadIntPtr( VTable, 184) );
@ -67,17 +64,14 @@ internal override void Shutdown()
_GetActiveActionSetLayers = null;
_GetDigitalActionHandle = null;
_GetDigitalActionData = null;
_GetDigitalActionData_Windows = null;
_GetDigitalActionOrigins = null;
_GetAnalogActionHandle = null;
_GetAnalogActionData = null;
_GetAnalogActionData_Windows = null;
_GetAnalogActionOrigins = null;
_GetGlyphForActionOrigin = null;
_GetStringForActionOrigin = null;
_StopAnalogActionMomentum = null;
_GetMotionData = null;
_GetMotionData_Windows = null;
_TriggerVibration = null;
_SetLEDColor = null;
_TriggerHapticPulse = null;
@ -228,23 +222,23 @@ internal InputDigitalActionHandle_t GetDigitalActionHandle( [MarshalAs( Unmanage
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
#if PLATFORM_WIN64
private delegate void FGetDigitalActionData( IntPtr self, ref DigitalState retVal, InputHandle_t inputHandle, InputDigitalActionHandle_t digitalActionHandle );
#else
private delegate DigitalState FGetDigitalActionData( IntPtr self, InputHandle_t inputHandle, InputDigitalActionHandle_t digitalActionHandle );
#endif
private FGetDigitalActionData _GetDigitalActionData;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetDigitalActionData_Windows( IntPtr self, ref DigitalState retVal, InputHandle_t inputHandle, InputDigitalActionHandle_t digitalActionHandle );
private FGetDigitalActionData_Windows _GetDigitalActionData_Windows;
#endregion
internal DigitalState GetDigitalActionData( InputHandle_t inputHandle, InputDigitalActionHandle_t digitalActionHandle )
{
if ( Config.Os == OsType.Windows )
{
var retVal = default( DigitalState );
_GetDigitalActionData_Windows( Self, ref retVal, inputHandle, digitalActionHandle );
return retVal;
}
#if PLATFORM_WIN64
var retVal = default( DigitalState );
_GetDigitalActionData( Self, ref retVal, inputHandle, digitalActionHandle );
return retVal;
#else
return _GetDigitalActionData( Self, inputHandle, digitalActionHandle );
#endif
}
#region FunctionMeta
@ -271,23 +265,23 @@ internal InputAnalogActionHandle_t GetAnalogActionHandle( [MarshalAs( UnmanagedT
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
#if PLATFORM_WIN64
private delegate void FGetAnalogActionData( IntPtr self, ref AnalogState retVal, InputHandle_t inputHandle, InputAnalogActionHandle_t analogActionHandle );
#else
private delegate AnalogState FGetAnalogActionData( IntPtr self, InputHandle_t inputHandle, InputAnalogActionHandle_t analogActionHandle );
#endif
private FGetAnalogActionData _GetAnalogActionData;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetAnalogActionData_Windows( IntPtr self, ref AnalogState retVal, InputHandle_t inputHandle, InputAnalogActionHandle_t analogActionHandle );
private FGetAnalogActionData_Windows _GetAnalogActionData_Windows;
#endregion
internal AnalogState GetAnalogActionData( InputHandle_t inputHandle, InputAnalogActionHandle_t analogActionHandle )
{
if ( Config.Os == OsType.Windows )
{
var retVal = default( AnalogState );
_GetAnalogActionData_Windows( Self, ref retVal, inputHandle, analogActionHandle );
return retVal;
}
#if PLATFORM_WIN64
var retVal = default( AnalogState );
_GetAnalogActionData( Self, ref retVal, inputHandle, analogActionHandle );
return retVal;
#else
return _GetAnalogActionData( Self, inputHandle, analogActionHandle );
#endif
}
#region FunctionMeta
@ -338,23 +332,23 @@ internal void StopAnalogActionMomentum( InputHandle_t inputHandle, InputAnalogAc
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
#if PLATFORM_WIN64
private delegate void FGetMotionData( IntPtr self, ref MotionState retVal, InputHandle_t inputHandle );
#else
private delegate MotionState FGetMotionData( IntPtr self, InputHandle_t inputHandle );
#endif
private FGetMotionData _GetMotionData;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetMotionData_Windows( IntPtr self, ref MotionState retVal, InputHandle_t inputHandle );
private FGetMotionData_Windows _GetMotionData_Windows;
#endregion
internal MotionState GetMotionData( InputHandle_t inputHandle )
{
if ( Config.Os == OsType.Windows )
{
var retVal = default( MotionState );
_GetMotionData_Windows( Self, ref retVal, inputHandle );
return retVal;
}
#if PLATFORM_WIN64
var retVal = default( MotionState );
_GetMotionData( Self, ref retVal, inputHandle );
return retVal;
#else
return _GetMotionData( Self, inputHandle );
#endif
}
#region FunctionMeta

View File

@ -15,7 +15,6 @@ public override void InitInternals()
{
_GetResultStatus = Marshal.GetDelegateForFunctionPointer<FGetResultStatus>( Marshal.ReadIntPtr( VTable, 0) );
_GetResultItems = Marshal.GetDelegateForFunctionPointer<FGetResultItems>( Marshal.ReadIntPtr( VTable, 8) );
_GetResultItems_Windows = Marshal.GetDelegateForFunctionPointer<FGetResultItems_Windows>( Marshal.ReadIntPtr( VTable, 8) );
_GetResultItemProperty = Marshal.GetDelegateForFunctionPointer<FGetResultItemProperty>( Marshal.ReadIntPtr( VTable, 16) );
_GetResultTimestamp = Marshal.GetDelegateForFunctionPointer<FGetResultTimestamp>( Marshal.ReadIntPtr( VTable, 24) );
_CheckResultSteamID = Marshal.GetDelegateForFunctionPointer<FCheckResultSteamID>( Marshal.ReadIntPtr( VTable, 32) );
@ -58,7 +57,6 @@ internal override void Shutdown()
_GetResultStatus = null;
_GetResultItems = null;
_GetResultItems_Windows = null;
_GetResultItemProperty = null;
_GetResultTimestamp = null;
_CheckResultSteamID = null;
@ -112,35 +110,10 @@ internal Result GetResultStatus( SteamInventoryResult_t resultHandle )
[return: MarshalAs( UnmanagedType.I1 )]
private delegate bool FGetResultItems( IntPtr self, SteamInventoryResult_t resultHandle, [In,Out] SteamItemDetails_t[] pOutItemsArray, ref uint punOutItemsArraySize );
private FGetResultItems _GetResultItems;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
[return: MarshalAs( UnmanagedType.I1 )]
private delegate bool FGetResultItems_Windows( IntPtr self, SteamInventoryResult_t resultHandle, [In,Out] SteamItemDetails_t.Pack8[] pOutItemsArray, ref uint punOutItemsArraySize );
private FGetResultItems_Windows _GetResultItems_Windows;
#endregion
internal bool GetResultItems( SteamInventoryResult_t resultHandle, [In,Out] SteamItemDetails_t[] pOutItemsArray, ref uint punOutItemsArraySize )
{
if ( Config.Os == OsType.Windows )
{
SteamItemDetails_t.Pack8[] pOutItemsArray_windows = pOutItemsArray == null ? null : new SteamItemDetails_t.Pack8[ pOutItemsArray.Length ];
if ( pOutItemsArray_windows != null )
{
for ( int i=0; i<pOutItemsArray.Length; i++ )
{
pOutItemsArray_windows[i] = pOutItemsArray[i];
}
}
var retVal = _GetResultItems_Windows( Self, resultHandle, pOutItemsArray_windows, ref punOutItemsArraySize );
if ( pOutItemsArray_windows != null )
{
for ( int i=0; i<pOutItemsArray.Length; i++ )
{
pOutItemsArray[i] = pOutItemsArray_windows[i];
}
}
return retVal;
}
return _GetResultItems( Self, resultHandle, pOutItemsArray, ref punOutItemsArraySize );
}

View File

@ -26,14 +26,12 @@ public override void InitInternals()
_AddRequestLobbyListResultCountFilter = Marshal.GetDelegateForFunctionPointer<FAddRequestLobbyListResultCountFilter>( Marshal.ReadIntPtr( VTable, 80) );
_AddRequestLobbyListCompatibleMembersFilter = Marshal.GetDelegateForFunctionPointer<FAddRequestLobbyListCompatibleMembersFilter>( Marshal.ReadIntPtr( VTable, 88) );
_GetLobbyByIndex = Marshal.GetDelegateForFunctionPointer<FGetLobbyByIndex>( Marshal.ReadIntPtr( VTable, 96) );
_GetLobbyByIndex_Windows = Marshal.GetDelegateForFunctionPointer<FGetLobbyByIndex_Windows>( Marshal.ReadIntPtr( VTable, 96) );
_CreateLobby = Marshal.GetDelegateForFunctionPointer<FCreateLobby>( Marshal.ReadIntPtr( VTable, 104) );
_JoinLobby = Marshal.GetDelegateForFunctionPointer<FJoinLobby>( Marshal.ReadIntPtr( VTable, 112) );
_LeaveLobby = Marshal.GetDelegateForFunctionPointer<FLeaveLobby>( Marshal.ReadIntPtr( VTable, 120) );
_InviteUserToLobby = Marshal.GetDelegateForFunctionPointer<FInviteUserToLobby>( Marshal.ReadIntPtr( VTable, 128) );
_GetNumLobbyMembers = Marshal.GetDelegateForFunctionPointer<FGetNumLobbyMembers>( Marshal.ReadIntPtr( VTable, 136) );
_GetLobbyMemberByIndex = Marshal.GetDelegateForFunctionPointer<FGetLobbyMemberByIndex>( Marshal.ReadIntPtr( VTable, 144) );
_GetLobbyMemberByIndex_Windows = Marshal.GetDelegateForFunctionPointer<FGetLobbyMemberByIndex_Windows>( Marshal.ReadIntPtr( VTable, 144) );
_GetLobbyData = Marshal.GetDelegateForFunctionPointer<FGetLobbyData>( Marshal.ReadIntPtr( VTable, 152) );
_SetLobbyData = Marshal.GetDelegateForFunctionPointer<FSetLobbyData>( Marshal.ReadIntPtr( VTable, 160) );
_GetLobbyDataCount = Marshal.GetDelegateForFunctionPointer<FGetLobbyDataCount>( Marshal.ReadIntPtr( VTable, 168) );
@ -51,7 +49,6 @@ public override void InitInternals()
_SetLobbyType = Marshal.GetDelegateForFunctionPointer<FSetLobbyType>( Marshal.ReadIntPtr( VTable, 264) );
_SetLobbyJoinable = Marshal.GetDelegateForFunctionPointer<FSetLobbyJoinable>( Marshal.ReadIntPtr( VTable, 272) );
_GetLobbyOwner = Marshal.GetDelegateForFunctionPointer<FGetLobbyOwner>( Marshal.ReadIntPtr( VTable, 280) );
_GetLobbyOwner_Windows = Marshal.GetDelegateForFunctionPointer<FGetLobbyOwner_Windows>( Marshal.ReadIntPtr( VTable, 280) );
_SetLobbyOwner = Marshal.GetDelegateForFunctionPointer<FSetLobbyOwner>( Marshal.ReadIntPtr( VTable, 288) );
_SetLinkedLobby = Marshal.GetDelegateForFunctionPointer<FSetLinkedLobby>( Marshal.ReadIntPtr( VTable, 296) );
}
@ -72,14 +69,12 @@ internal override void Shutdown()
_AddRequestLobbyListResultCountFilter = null;
_AddRequestLobbyListCompatibleMembersFilter = null;
_GetLobbyByIndex = null;
_GetLobbyByIndex_Windows = null;
_CreateLobby = null;
_JoinLobby = null;
_LeaveLobby = null;
_InviteUserToLobby = null;
_GetNumLobbyMembers = null;
_GetLobbyMemberByIndex = null;
_GetLobbyMemberByIndex_Windows = null;
_GetLobbyData = null;
_SetLobbyData = null;
_GetLobbyDataCount = null;
@ -97,7 +92,6 @@ internal override void Shutdown()
_SetLobbyType = null;
_SetLobbyJoinable = null;
_GetLobbyOwner = null;
_GetLobbyOwner_Windows = null;
_SetLobbyOwner = null;
_SetLinkedLobby = null;
}
@ -238,23 +232,23 @@ internal void AddRequestLobbyListCompatibleMembersFilter( SteamId steamIDLobby )
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
#if PLATFORM_WIN64
private delegate void FGetLobbyByIndex( IntPtr self, ref SteamId retVal, int iLobby );
#else
private delegate SteamId FGetLobbyByIndex( IntPtr self, int iLobby );
#endif
private FGetLobbyByIndex _GetLobbyByIndex;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetLobbyByIndex_Windows( IntPtr self, ref SteamId retVal, int iLobby );
private FGetLobbyByIndex_Windows _GetLobbyByIndex_Windows;
#endregion
internal SteamId GetLobbyByIndex( int iLobby )
{
if ( Config.Os == OsType.Windows )
{
var retVal = default( SteamId );
_GetLobbyByIndex_Windows( Self, ref retVal, iLobby );
return retVal;
}
#if PLATFORM_WIN64
var retVal = default( SteamId );
_GetLobbyByIndex( Self, ref retVal, iLobby );
return retVal;
#else
return _GetLobbyByIndex( Self, iLobby );
#endif
}
#region FunctionMeta
@ -315,23 +309,23 @@ internal int GetNumLobbyMembers( SteamId steamIDLobby )
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
#if PLATFORM_WIN64
private delegate void FGetLobbyMemberByIndex( IntPtr self, ref SteamId retVal, SteamId steamIDLobby, int iMember );
#else
private delegate SteamId FGetLobbyMemberByIndex( IntPtr self, SteamId steamIDLobby, int iMember );
#endif
private FGetLobbyMemberByIndex _GetLobbyMemberByIndex;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetLobbyMemberByIndex_Windows( IntPtr self, ref SteamId retVal, SteamId steamIDLobby, int iMember );
private FGetLobbyMemberByIndex_Windows _GetLobbyMemberByIndex_Windows;
#endregion
internal SteamId GetLobbyMemberByIndex( SteamId steamIDLobby, int iMember )
{
if ( Config.Os == OsType.Windows )
{
var retVal = default( SteamId );
_GetLobbyMemberByIndex_Windows( Self, ref retVal, steamIDLobby, iMember );
return retVal;
}
#if PLATFORM_WIN64
var retVal = default( SteamId );
_GetLobbyMemberByIndex( Self, ref retVal, steamIDLobby, iMember );
return retVal;
#else
return _GetLobbyMemberByIndex( Self, steamIDLobby, iMember );
#endif
}
#region FunctionMeta
@ -523,23 +517,23 @@ internal bool SetLobbyJoinable( SteamId steamIDLobby, [MarshalAs( UnmanagedType.
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
#if PLATFORM_WIN64
private delegate void FGetLobbyOwner( IntPtr self, ref SteamId retVal, SteamId steamIDLobby );
#else
private delegate SteamId FGetLobbyOwner( IntPtr self, SteamId steamIDLobby );
#endif
private FGetLobbyOwner _GetLobbyOwner;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetLobbyOwner_Windows( IntPtr self, ref SteamId retVal, SteamId steamIDLobby );
private FGetLobbyOwner_Windows _GetLobbyOwner_Windows;
#endregion
internal SteamId GetLobbyOwner( SteamId steamIDLobby )
{
if ( Config.Os == OsType.Windows )
{
var retVal = default( SteamId );
_GetLobbyOwner_Windows( Self, ref retVal, steamIDLobby );
return retVal;
}
#if PLATFORM_WIN64
var retVal = default( SteamId );
_GetLobbyOwner( Self, ref retVal, steamIDLobby );
return retVal;
#else
return _GetLobbyOwner( Self, steamIDLobby );
#endif
}
#region FunctionMeta

View File

@ -20,7 +20,6 @@ public override void InitInternals()
_CloseP2PSessionWithUser = Marshal.GetDelegateForFunctionPointer<FCloseP2PSessionWithUser>( Marshal.ReadIntPtr( VTable, 32) );
_CloseP2PChannelWithUser = Marshal.GetDelegateForFunctionPointer<FCloseP2PChannelWithUser>( Marshal.ReadIntPtr( VTable, 40) );
_GetP2PSessionState = Marshal.GetDelegateForFunctionPointer<FGetP2PSessionState>( Marshal.ReadIntPtr( VTable, 48) );
_GetP2PSessionState_Windows = Marshal.GetDelegateForFunctionPointer<FGetP2PSessionState_Windows>( Marshal.ReadIntPtr( VTable, 48) );
_AllowP2PPacketRelay = Marshal.GetDelegateForFunctionPointer<FAllowP2PPacketRelay>( Marshal.ReadIntPtr( VTable, 56) );
_CreateListenSocket = Marshal.GetDelegateForFunctionPointer<FCreateListenSocket>( Marshal.ReadIntPtr( VTable, 64) );
_CreateP2PConnectionSocket = Marshal.GetDelegateForFunctionPointer<FCreateP2PConnectionSocket>( Marshal.ReadIntPtr( VTable, 72) );
@ -48,7 +47,6 @@ internal override void Shutdown()
_CloseP2PSessionWithUser = null;
_CloseP2PChannelWithUser = null;
_GetP2PSessionState = null;
_GetP2PSessionState_Windows = null;
_AllowP2PPacketRelay = null;
_CreateListenSocket = null;
_CreateP2PConnectionSocket = null;
@ -143,22 +141,10 @@ internal bool CloseP2PChannelWithUser( SteamId steamIDRemote, int nChannel )
[return: MarshalAs( UnmanagedType.I1 )]
private delegate bool FGetP2PSessionState( IntPtr self, SteamId steamIDRemote, ref P2PSessionState_t pConnectionState );
private FGetP2PSessionState _GetP2PSessionState;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
[return: MarshalAs( UnmanagedType.I1 )]
private delegate bool FGetP2PSessionState_Windows( IntPtr self, SteamId steamIDRemote, ref P2PSessionState_t.Pack8 pConnectionState );
private FGetP2PSessionState_Windows _GetP2PSessionState_Windows;
#endregion
internal bool GetP2PSessionState( SteamId steamIDRemote, ref P2PSessionState_t pConnectionState )
{
if ( Config.Os == OsType.Windows )
{
P2PSessionState_t.Pack8 pConnectionState_windows = pConnectionState;
var retVal = _GetP2PSessionState_Windows( Self, steamIDRemote, ref pConnectionState_windows );
pConnectionState = pConnectionState_windows;
return retVal;
}
return _GetP2PSessionState( Self, steamIDRemote, ref pConnectionState );
}

View File

@ -16,19 +16,15 @@ public override void InitInternals()
_GetNumActiveBeacons = Marshal.GetDelegateForFunctionPointer<FGetNumActiveBeacons>( Marshal.ReadIntPtr( VTable, 0) );
_GetBeaconByIndex = Marshal.GetDelegateForFunctionPointer<FGetBeaconByIndex>( Marshal.ReadIntPtr( VTable, 8) );
_GetBeaconDetails = Marshal.GetDelegateForFunctionPointer<FGetBeaconDetails>( Marshal.ReadIntPtr( VTable, 16) );
_GetBeaconDetails_Windows = Marshal.GetDelegateForFunctionPointer<FGetBeaconDetails_Windows>( Marshal.ReadIntPtr( VTable, 16) );
_JoinParty = Marshal.GetDelegateForFunctionPointer<FJoinParty>( Marshal.ReadIntPtr( VTable, 24) );
_GetNumAvailableBeaconLocations = Marshal.GetDelegateForFunctionPointer<FGetNumAvailableBeaconLocations>( Marshal.ReadIntPtr( VTable, 32) );
_GetAvailableBeaconLocations = Marshal.GetDelegateForFunctionPointer<FGetAvailableBeaconLocations>( Marshal.ReadIntPtr( VTable, 40) );
_GetAvailableBeaconLocations_Windows = Marshal.GetDelegateForFunctionPointer<FGetAvailableBeaconLocations_Windows>( Marshal.ReadIntPtr( VTable, 40) );
_CreateBeacon = Marshal.GetDelegateForFunctionPointer<FCreateBeacon>( Marshal.ReadIntPtr( VTable, 48) );
_CreateBeacon_Windows = Marshal.GetDelegateForFunctionPointer<FCreateBeacon_Windows>( Marshal.ReadIntPtr( VTable, 48) );
_OnReservationCompleted = Marshal.GetDelegateForFunctionPointer<FOnReservationCompleted>( Marshal.ReadIntPtr( VTable, 56) );
_CancelReservation = Marshal.GetDelegateForFunctionPointer<FCancelReservation>( Marshal.ReadIntPtr( VTable, 64) );
_ChangeNumOpenSlots = Marshal.GetDelegateForFunctionPointer<FChangeNumOpenSlots>( Marshal.ReadIntPtr( VTable, 72) );
_DestroyBeacon = Marshal.GetDelegateForFunctionPointer<FDestroyBeacon>( Marshal.ReadIntPtr( VTable, 80) );
_GetBeaconLocationData = Marshal.GetDelegateForFunctionPointer<FGetBeaconLocationData>( Marshal.ReadIntPtr( VTable, 88) );
_GetBeaconLocationData_Windows = Marshal.GetDelegateForFunctionPointer<FGetBeaconLocationData_Windows>( Marshal.ReadIntPtr( VTable, 88) );
}
internal override void Shutdown()
{
@ -37,19 +33,15 @@ internal override void Shutdown()
_GetNumActiveBeacons = null;
_GetBeaconByIndex = null;
_GetBeaconDetails = null;
_GetBeaconDetails_Windows = null;
_JoinParty = null;
_GetNumAvailableBeaconLocations = null;
_GetAvailableBeaconLocations = null;
_GetAvailableBeaconLocations_Windows = null;
_CreateBeacon = null;
_CreateBeacon_Windows = null;
_OnReservationCompleted = null;
_CancelReservation = null;
_ChangeNumOpenSlots = null;
_DestroyBeacon = null;
_GetBeaconLocationData = null;
_GetBeaconLocationData_Windows = null;
}
#region FunctionMeta
@ -79,22 +71,10 @@ internal PartyBeaconID_t GetBeaconByIndex( uint unIndex )
[return: MarshalAs( UnmanagedType.I1 )]
private delegate bool FGetBeaconDetails( IntPtr self, PartyBeaconID_t ulBeaconID, ref SteamId pSteamIDBeaconOwner, ref SteamPartyBeaconLocation_t pLocation, StringBuilder pchMetadata, int cchMetadata );
private FGetBeaconDetails _GetBeaconDetails;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
[return: MarshalAs( UnmanagedType.I1 )]
private delegate bool FGetBeaconDetails_Windows( IntPtr self, PartyBeaconID_t ulBeaconID, ref SteamId pSteamIDBeaconOwner, ref SteamPartyBeaconLocation_t.Pack8 pLocation, StringBuilder pchMetadata, int cchMetadata );
private FGetBeaconDetails_Windows _GetBeaconDetails_Windows;
#endregion
internal bool GetBeaconDetails( PartyBeaconID_t ulBeaconID, ref SteamId pSteamIDBeaconOwner, ref SteamPartyBeaconLocation_t pLocation, StringBuilder pchMetadata, int cchMetadata )
{
if ( Config.Os == OsType.Windows )
{
SteamPartyBeaconLocation_t.Pack8 pLocation_windows = pLocation;
var retVal = _GetBeaconDetails_Windows( Self, ulBeaconID, ref pSteamIDBeaconOwner, ref pLocation_windows, pchMetadata, cchMetadata );
pLocation = pLocation_windows;
return retVal;
}
return _GetBeaconDetails( Self, ulBeaconID, ref pSteamIDBeaconOwner, ref pLocation, pchMetadata, cchMetadata );
}
@ -126,22 +106,10 @@ internal bool GetNumAvailableBeaconLocations( ref uint puNumLocations )
[return: MarshalAs( UnmanagedType.I1 )]
private delegate bool FGetAvailableBeaconLocations( IntPtr self, ref SteamPartyBeaconLocation_t pLocationList, uint uMaxNumLocations );
private FGetAvailableBeaconLocations _GetAvailableBeaconLocations;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
[return: MarshalAs( UnmanagedType.I1 )]
private delegate bool FGetAvailableBeaconLocations_Windows( IntPtr self, ref SteamPartyBeaconLocation_t.Pack8 pLocationList, uint uMaxNumLocations );
private FGetAvailableBeaconLocations_Windows _GetAvailableBeaconLocations_Windows;
#endregion
internal bool GetAvailableBeaconLocations( ref SteamPartyBeaconLocation_t pLocationList, uint uMaxNumLocations )
{
if ( Config.Os == OsType.Windows )
{
SteamPartyBeaconLocation_t.Pack8 pLocationList_windows = pLocationList;
var retVal = _GetAvailableBeaconLocations_Windows( Self, ref pLocationList_windows, uMaxNumLocations );
pLocationList = pLocationList_windows;
return retVal;
}
return _GetAvailableBeaconLocations( Self, ref pLocationList, uMaxNumLocations );
}
@ -149,21 +117,10 @@ internal bool GetAvailableBeaconLocations( ref SteamPartyBeaconLocation_t pLocat
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate SteamAPICall_t FCreateBeacon( IntPtr self, uint unOpenSlots, ref SteamPartyBeaconLocation_t pBeaconLocation, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchConnectString, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchMetadata );
private FCreateBeacon _CreateBeacon;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate SteamAPICall_t FCreateBeacon_Windows( IntPtr self, uint unOpenSlots, ref SteamPartyBeaconLocation_t.Pack8 pBeaconLocation, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchConnectString, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchMetadata );
private FCreateBeacon_Windows _CreateBeacon_Windows;
#endregion
internal async Task<CreateBeaconCallback_t?> CreateBeacon( uint unOpenSlots, /* ref */ SteamPartyBeaconLocation_t pBeaconLocation, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchConnectString, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchMetadata )
{
if ( Config.Os == OsType.Windows )
{
SteamPartyBeaconLocation_t.Pack8 pBeaconLocation_windows = pBeaconLocation;
var retVal = _CreateBeacon_Windows( Self, unOpenSlots, ref pBeaconLocation_windows, pchConnectString, pchMetadata );
pBeaconLocation = pBeaconLocation_windows;
return await CreateBeaconCallback_t.GetResultAsync( retVal );
}
return await CreateBeaconCallback_t.GetResultAsync( _CreateBeacon( Self, unOpenSlots, ref pBeaconLocation, pchConnectString, pchMetadata ) );
}
@ -217,22 +174,10 @@ internal bool DestroyBeacon( PartyBeaconID_t ulBeacon )
[return: MarshalAs( UnmanagedType.I1 )]
private delegate bool FGetBeaconLocationData( IntPtr self, SteamPartyBeaconLocation_t BeaconLocation, SteamPartyBeaconLocationData eData, StringBuilder pchDataStringOut, int cchDataStringOut );
private FGetBeaconLocationData _GetBeaconLocationData;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
[return: MarshalAs( UnmanagedType.I1 )]
private delegate bool FGetBeaconLocationData_Windows( IntPtr self, SteamPartyBeaconLocation_t.Pack8 BeaconLocation, SteamPartyBeaconLocationData eData, StringBuilder pchDataStringOut, int cchDataStringOut );
private FGetBeaconLocationData_Windows _GetBeaconLocationData_Windows;
#endregion
internal bool GetBeaconLocationData( SteamPartyBeaconLocation_t BeaconLocation, SteamPartyBeaconLocationData eData, StringBuilder pchDataStringOut, int cchDataStringOut )
{
if ( Config.Os == OsType.Windows )
{
SteamPartyBeaconLocation_t.Pack8 BeaconLocation_windows = BeaconLocation;
var retVal = _GetBeaconLocationData_Windows( Self, BeaconLocation, eData, pchDataStringOut, cchDataStringOut );
BeaconLocation = BeaconLocation_windows;
return retVal;
}
return _GetBeaconLocationData( Self, BeaconLocation, eData, pchDataStringOut, cchDataStringOut );
}

View File

@ -19,7 +19,6 @@ public override void InitInternals()
_CreateQueryUGCDetailsRequest = Marshal.GetDelegateForFunctionPointer<FCreateQueryUGCDetailsRequest>( Marshal.ReadIntPtr( VTable, 24) );
_SendQueryUGCRequest = Marshal.GetDelegateForFunctionPointer<FSendQueryUGCRequest>( Marshal.ReadIntPtr( VTable, 32) );
_GetQueryUGCResult = Marshal.GetDelegateForFunctionPointer<FGetQueryUGCResult>( Marshal.ReadIntPtr( VTable, 40) );
_GetQueryUGCResult_Windows = Marshal.GetDelegateForFunctionPointer<FGetQueryUGCResult_Windows>( Marshal.ReadIntPtr( VTable, 40) );
_GetQueryUGCPreviewURL = Marshal.GetDelegateForFunctionPointer<FGetQueryUGCPreviewURL>( Marshal.ReadIntPtr( VTable, 48) );
_GetQueryUGCMetadata = Marshal.GetDelegateForFunctionPointer<FGetQueryUGCMetadata>( Marshal.ReadIntPtr( VTable, 56) );
_GetQueryUGCChildren = Marshal.GetDelegateForFunctionPointer<FGetQueryUGCChildren>( Marshal.ReadIntPtr( VTable, 64) );
@ -55,7 +54,6 @@ public override void InitInternals()
_SetItemMetadata = Marshal.GetDelegateForFunctionPointer<FSetItemMetadata>( Marshal.ReadIntPtr( VTable, 304) );
_SetItemVisibility = Marshal.GetDelegateForFunctionPointer<FSetItemVisibility>( Marshal.ReadIntPtr( VTable, 312) );
_SetItemTags = Marshal.GetDelegateForFunctionPointer<FSetItemTags>( Marshal.ReadIntPtr( VTable, 320) );
_SetItemTags_Windows = Marshal.GetDelegateForFunctionPointer<FSetItemTags_Windows>( Marshal.ReadIntPtr( VTable, 320) );
_SetItemContent = Marshal.GetDelegateForFunctionPointer<FSetItemContent>( Marshal.ReadIntPtr( VTable, 328) );
_SetItemPreview = Marshal.GetDelegateForFunctionPointer<FSetItemPreview>( Marshal.ReadIntPtr( VTable, 336) );
_SetAllowLegacyUpload = Marshal.GetDelegateForFunctionPointer<FSetAllowLegacyUpload>( Marshal.ReadIntPtr( VTable, 344) );
@ -102,7 +100,6 @@ internal override void Shutdown()
_CreateQueryUGCDetailsRequest = null;
_SendQueryUGCRequest = null;
_GetQueryUGCResult = null;
_GetQueryUGCResult_Windows = null;
_GetQueryUGCPreviewURL = null;
_GetQueryUGCMetadata = null;
_GetQueryUGCChildren = null;
@ -138,7 +135,6 @@ internal override void Shutdown()
_SetItemMetadata = null;
_SetItemVisibility = null;
_SetItemTags = null;
_SetItemTags_Windows = null;
_SetItemContent = null;
_SetItemPreview = null;
_SetAllowLegacyUpload = null;
@ -236,22 +232,10 @@ internal UGCQueryHandle_t CreateQueryUGCDetailsRequest( [In,Out] PublishedFileId
[return: MarshalAs( UnmanagedType.I1 )]
private delegate bool FGetQueryUGCResult( IntPtr self, UGCQueryHandle_t handle, uint index, ref SteamUGCDetails_t pDetails );
private FGetQueryUGCResult _GetQueryUGCResult;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
[return: MarshalAs( UnmanagedType.I1 )]
private delegate bool FGetQueryUGCResult_Windows( IntPtr self, UGCQueryHandle_t handle, uint index, ref SteamUGCDetails_t.Pack8 pDetails );
private FGetQueryUGCResult_Windows _GetQueryUGCResult_Windows;
#endregion
internal bool GetQueryUGCResult( UGCQueryHandle_t handle, uint index, ref SteamUGCDetails_t pDetails )
{
if ( Config.Os == OsType.Windows )
{
SteamUGCDetails_t.Pack8 pDetails_windows = pDetails;
var retVal = _GetQueryUGCResult_Windows( Self, handle, index, ref pDetails_windows );
pDetails = pDetails_windows;
return retVal;
}
return _GetQueryUGCResult( Self, handle, index, ref pDetails );
}
@ -663,22 +647,10 @@ internal bool SetItemVisibility( UGCUpdateHandle_t handle, RemoteStoragePublishe
[return: MarshalAs( UnmanagedType.I1 )]
private delegate bool FSetItemTags( IntPtr self, UGCUpdateHandle_t updateHandle, ref SteamParamStringArray_t pTags );
private FSetItemTags _SetItemTags;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
[return: MarshalAs( UnmanagedType.I1 )]
private delegate bool FSetItemTags_Windows( IntPtr self, UGCUpdateHandle_t updateHandle, ref SteamParamStringArray_t.Pack8 pTags );
private FSetItemTags_Windows _SetItemTags_Windows;
#endregion
internal bool SetItemTags( UGCUpdateHandle_t updateHandle, ref SteamParamStringArray_t pTags )
{
if ( Config.Os == OsType.Windows )
{
SteamParamStringArray_t.Pack8 pTags_windows = pTags;
var retVal = _SetItemTags_Windows( Self, updateHandle, ref pTags_windows );
pTags = pTags_windows;
return retVal;
}
return _SetItemTags( Self, updateHandle, ref pTags );
}

View File

@ -16,7 +16,6 @@ public override void InitInternals()
_GetHSteamUser = Marshal.GetDelegateForFunctionPointer<FGetHSteamUser>( Marshal.ReadIntPtr( VTable, 0) );
_BLoggedOn = Marshal.GetDelegateForFunctionPointer<FBLoggedOn>( Marshal.ReadIntPtr( VTable, 8) );
_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) );
_TerminateGameConnection = Marshal.GetDelegateForFunctionPointer<FTerminateGameConnection>( Marshal.ReadIntPtr( VTable, 32) );
_TrackAppUsageEvent = Marshal.GetDelegateForFunctionPointer<FTrackAppUsageEvent>( Marshal.ReadIntPtr( VTable, 40) );
@ -52,7 +51,6 @@ internal override void Shutdown()
_GetHSteamUser = null;
_BLoggedOn = null;
_GetSteamID = null;
_GetSteamID_Windows = null;
_InitiateGameConnection = null;
_TerminateGameConnection = null;
_TrackAppUsageEvent = null;
@ -107,23 +105,23 @@ internal bool BLoggedOn()
#region FunctionMeta
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
#if PLATFORM_WIN64
private delegate void FGetSteamID( IntPtr self, ref SteamId retVal );
#else
private delegate SteamId FGetSteamID( IntPtr self );
#endif
private FGetSteamID _GetSteamID;
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
private delegate void FGetSteamID_Windows( IntPtr self, ref SteamId retVal );
private FGetSteamID_Windows _GetSteamID_Windows;
#endregion
internal SteamId GetSteamID()
{
if ( Config.Os == OsType.Windows )
{
var retVal = default( SteamId );
_GetSteamID_Windows( Self, ref retVal );
return retVal;
}
#if PLATFORM_WIN64
var retVal = default( SteamId );
_GetSteamID( Self, ref retVal );
return retVal;
#else
return _GetSteamID( Self );
#endif
}
#region FunctionMeta

View File

@ -111,11 +111,6 @@ void WriteFunctionPointerReader( CodeParser.Class clss )
pos = regularpos.ToString();
WriteLine( $"_{func.Name} = Marshal.GetDelegateForFunctionPointer<F{func.Name}>( Marshal.ReadIntPtr( VTable, {pos}) );" );
if ( windowsSpecific )
{
WriteLine( $"_{func.Name}_Windows = Marshal.GetDelegateForFunctionPointer<F{func.Name}_Windows>( Marshal.ReadIntPtr( VTable, {pos}) );" );
}
}
}
@ -137,14 +132,7 @@ void WriteFunctionPointerReader( CodeParser.Class clss )
if ( Cleanup.IsDeprecated( $"{clss.Name}.{func.Name}" ) )
continue;
WriteLine( $"_{func.Name} = null;" );
if ( windowsSpecific )
{
WriteLine( $"_{func.Name}_Windows = null;" );
}
WriteLine( $"_{func.Name} = null;" );
}
}
EndBlock();
@ -200,31 +188,22 @@ private void WriteFunction( CodeParser.Class clss, CodeParser.Class.Function fun
if ( returnType.ReturnAttribute != null)
WriteLine( returnType.ReturnAttribute );
WriteLine( $"private delegate {returnType.TypeNameFrom} F{func.Name}( IntPtr self, {delegateargstr} );".Replace( "( IntPtr self, )", "( IntPtr self )" ) );
WriteLine( $"private F{func.Name} _{func.Name};" );
if ( windowsSpecific )
if ( returnType.IsReturnedWeird )
{
var delegateargstrw = string.Join( ", ", args.Select( x => x.AsWinArgument() ) );
WriteLine( $"[UnmanagedFunctionPointer( CallingConvention.ThisCall )]" );
if ( returnType.IsReturnedWeird )
{
var windelargs = $"ref {returnType.TypeName} retVal, {delegateargstrw}".Trim( ',', ' ' );
WriteLine( $"private delegate void F{func.Name}_Windows( IntPtr self, {windelargs} );".Replace( "( IntPtr self, )", "( IntPtr self )" ) );
}
else
{
if ( returnType.ReturnAttribute != null )
WriteLine( returnType.ReturnAttribute );
WriteLine( $"private delegate {returnType.TypeNameFrom} F{func.Name}_Windows( IntPtr self, {delegateargstrw} );".Replace( "( IntPtr self, )", "( IntPtr self )" ) );
}
WriteLine( $"private F{func.Name}_Windows _{func.Name}_Windows;" );
WriteLine( "#if PLATFORM_WIN64" );
WriteLine( $"private delegate void F{func.Name}( IntPtr self, ref {returnType.TypeName} retVal, {delegateargstr} );".Replace( " retVal, )", " retVal )" ) );
WriteLine( "#else" );
}
WriteLine( $"private delegate {returnType.TypeNameFrom} F{func.Name}( IntPtr self, {delegateargstr} );".Replace( "( IntPtr self, )", "( IntPtr self )" ) );
if ( returnType.IsReturnedWeird )
{
WriteLine( "#endif" );
}
WriteLine( $"private F{func.Name} _{func.Name};" );
WriteLine();
WriteLine( $"#endregion" );
@ -234,80 +213,13 @@ private void WriteFunction( CodeParser.Class clss, CodeParser.Class.Function fun
if ( returnType.IsReturnedWeird )
{
StartBlock( "if ( Config.Os == OsType.Windows )" );
WriteLine( "#if PLATFORM_WIN64" );
{
WriteLine( $"var retVal = default( {returnType.TypeName} );" );
WriteLine( $"_{func.Name}_Windows( Self, ref retVal, {callargs} );".Replace( ", );", " );" ) );
WriteLine( $"_{func.Name}( Self, ref retVal, {callargs} );".Replace( ", );", " );" ) );
WriteLine( $"{returnType.Return( "retVal" )}" );
}
EndBlock();
WriteLine();
}
else if ( windowsSpecific )
{
StartBlock( "if ( Config.Os == OsType.Windows )" );
{
var wincallargs = callargs;
foreach ( var arg in args )
{
if ( !arg.WindowsSpecific ) continue;
if ( arg.IsVector )
{
WriteLine( $"{arg.TypeName}.Pack8[] {arg.VarName}_windows = {arg.VarName} == null ? null : new {arg.TypeName}.Pack8[ {arg.VarName}.Length ];" );
StartBlock( $"if ( {arg.VarName}_windows != null )" );
{
StartBlock( $"for ( int i=0; i<{arg.VarName}.Length; i++ )" );
{
WriteLine( $"{arg.VarName}_windows[i] = {arg.VarName}[i];" );
}
EndBlock();
}
EndBlock();
}
else
{
WriteLine( $"{arg.TypeName}.Pack8 {arg.VarName}_windows = {arg.VarName};" );
}
wincallargs = wincallargs.Replace( $" {arg.VarName}", $" {arg.VarName}_windows" );
}
if ( !returnType.IsVoid )
Write( "var retVal = " );
WriteLine( $"_{func.Name}_Windows( Self, {wincallargs} );".Replace( "( Self, )", "( Self )" ) );
foreach ( var arg in args )
{
if ( !arg.WindowsSpecific ) continue;
if ( arg.IsVector )
{
StartBlock( $"if ( {arg.VarName}_windows != null )" );
{
StartBlock( $"for ( int i=0; i<{arg.VarName}.Length; i++ )" );
{
WriteLine( $"{arg.VarName}[i] = {arg.VarName}_windows[i];" );
}
EndBlock();
}
EndBlock();
}
else
{
WriteLine( $"{arg.VarName} = {arg.VarName}_windows;" );
}
}
if ( !returnType.IsVoid )
{
WriteLine( returnType.Return( "retVal" ) );
}
}
EndBlock();
WriteLine();
WriteLine( "#else" );
}
if ( returnType.IsVoid )
@ -320,6 +232,11 @@ private void WriteFunction( CodeParser.Class clss, CodeParser.Class.Function fun
WriteLine( returnType.Return( v ) );
}
if ( returnType.IsReturnedWeird )
{
WriteLine( "#endif" );
}
}
EndBlock();
}

View File

@ -66,7 +66,6 @@ public static BaseType Parse( string type, string varname = null )
}
public virtual string AsArgument() => IsVector ? $"[In,Out] {Ref}{TypeName.Trim( '*', ' ' )}[] {VarName}" : $"{Ref}{TypeName.Trim( '*', ' ' )} {VarName}";
public virtual string AsWinArgument() => AsArgument();
public virtual string AsCallArgument() => $"{Ref}{VarName}";
public virtual string Return( string varname ) => $"return {varname};";
@ -155,13 +154,6 @@ public override bool WindowsSpecific
}
}
public override string AsWinArgument()
{
if ( WindowsSpecific )
return IsVector ? $"[In,Out] {Ref}{TypeName.Trim( '*', ' ' )}.Pack8[] {VarName}" : $"{Ref}{TypeName.Trim( '*', ' ' )}.Pack8 {VarName}";
return AsArgument();
}
static string[] SpecialTypes = new string[]
{