From 1df586305d8563328e0863b9b4d92d8d1cecbd52 Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Tue, 25 Jun 2019 12:00:04 +0100 Subject: [PATCH] No need to use Config.Os for vtable address swapping --- Facepunch.Steamworks/Config.cs | 2 - .../Interfaces/ISteamGameServerStats.cs | 26 +-- .../Interfaces/ISteamRemoteStorage.cs | 48 +++--- .../Generated/Interfaces/ISteamUGC.cs | 158 +++++++++--------- .../Generated/Interfaces/ISteamUserStats.cs | 92 +++++----- Generator/CodeWriter/ClassVTable.cs | 69 ++++---- 6 files changed, 212 insertions(+), 183 deletions(-) diff --git a/Facepunch.Steamworks/Config.cs b/Facepunch.Steamworks/Config.cs index 203a473..0a4be5e 100644 --- a/Facepunch.Steamworks/Config.cs +++ b/Facepunch.Steamworks/Config.cs @@ -36,8 +36,6 @@ public static OsType Os set => _os = value; } - - public static bool PackSmall => Os != OsType.Windows; } public enum OsType diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamGameServerStats.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamGameServerStats.cs index bc96887..d8453fe 100644 --- a/Facepunch.Steamworks/Generated/Interfaces/ISteamGameServerStats.cs +++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamGameServerStats.cs @@ -13,16 +13,22 @@ internal class ISteamGameServerStats : SteamInterface public override void InitInternals() { - _RequestUserStats = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 0) ); - _GetUserStat1 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, Config.Os == OsType.Windows ? 16 : 8 ) ); - _GetUserStat2 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, Config.Os == OsType.Windows ? 8 : 16 ) ); - _GetUserAchievement = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 24) ); - _SetUserStat1 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, Config.Os == OsType.Windows ? 40 : 32 ) ); - _SetUserStat2 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, Config.Os == OsType.Windows ? 32 : 40 ) ); - _UpdateUserAvgRateStat = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 48) ); - _SetUserAchievement = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 56) ); - _ClearUserAchievement = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 64) ); - _StoreUserStats = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 72) ); + #if PLATFORM_WIN64 + int[] loc = new[] { 0, 16, 8, 24, 40, 32, 48, 56, 64, 72 }; + #else + int[] loc = new[] { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72 }; + #endif + + _RequestUserStats = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[0]) ); + _GetUserStat1 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[1]) ); + _GetUserStat2 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[2]) ); + _GetUserAchievement = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[3]) ); + _SetUserStat1 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[4]) ); + _SetUserStat2 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[5]) ); + _UpdateUserAvgRateStat = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[6]) ); + _SetUserAchievement = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[7]) ); + _ClearUserAchievement = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[8]) ); + _StoreUserStats = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[9]) ); } internal override void Shutdown() { diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamRemoteStorage.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamRemoteStorage.cs index ea356c2..115f59f 100644 --- a/Facepunch.Steamworks/Generated/Interfaces/ISteamRemoteStorage.cs +++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamRemoteStorage.cs @@ -42,30 +42,30 @@ public override void InitInternals() _GetUGCDetails = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 208) ); _UGCRead = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 216) ); _GetCachedUGCCount = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 224) ); - // PublishWorkshopFile is deprecated - 232 - // CreatePublishedFileUpdateRequest is deprecated - 240 - // UpdatePublishedFileFile is deprecated - 248 - // UpdatePublishedFilePreviewFile is deprecated - 256 - // UpdatePublishedFileTitle is deprecated - 264 - // UpdatePublishedFileDescription is deprecated - 272 - // UpdatePublishedFileVisibility is deprecated - 280 - // UpdatePublishedFileTags is deprecated - 288 - // CommitPublishedFileUpdate is deprecated - 296 - // GetPublishedFileDetails is deprecated - 304 - // DeletePublishedFile is deprecated - 312 - // EnumerateUserPublishedFiles is deprecated - 320 - // SubscribePublishedFile is deprecated - 328 - // EnumerateUserSubscribedFiles is deprecated - 336 - // UnsubscribePublishedFile is deprecated - 344 - // UpdatePublishedFileSetChangeDescription is deprecated - 352 - // GetPublishedItemVoteDetails is deprecated - 360 - // UpdateUserPublishedItemVote is deprecated - 368 - // GetUserPublishedItemVoteDetails is deprecated - 376 - // EnumerateUserSharedWorkshopFiles is deprecated - 384 - // PublishVideo is deprecated - 392 - // SetUserPublishedFileAction is deprecated - 400 - // EnumeratePublishedFilesByUserAction is deprecated - 408 - // EnumeratePublishedWorkshopFiles is deprecated - 416 + // PublishWorkshopFile is deprecated + // CreatePublishedFileUpdateRequest is deprecated + // UpdatePublishedFileFile is deprecated + // UpdatePublishedFilePreviewFile is deprecated + // UpdatePublishedFileTitle is deprecated + // UpdatePublishedFileDescription is deprecated + // UpdatePublishedFileVisibility is deprecated + // UpdatePublishedFileTags is deprecated + // CommitPublishedFileUpdate is deprecated + // GetPublishedFileDetails is deprecated + // DeletePublishedFile is deprecated + // EnumerateUserPublishedFiles is deprecated + // SubscribePublishedFile is deprecated + // EnumerateUserSubscribedFiles is deprecated + // UnsubscribePublishedFile is deprecated + // UpdatePublishedFileSetChangeDescription is deprecated + // GetPublishedItemVoteDetails is deprecated + // UpdateUserPublishedItemVote is deprecated + // GetUserPublishedItemVoteDetails is deprecated + // EnumerateUserSharedWorkshopFiles is deprecated + // PublishVideo is deprecated + // SetUserPublishedFileAction is deprecated + // EnumeratePublishedFilesByUserAction is deprecated + // EnumeratePublishedWorkshopFiles is deprecated _UGCDownloadToLocation = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 424) ); } internal override void Shutdown() diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamUGC.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamUGC.cs index 9ffa5d9..5713c2c 100644 --- a/Facepunch.Steamworks/Generated/Interfaces/ISteamUGC.cs +++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamUGC.cs @@ -13,82 +13,88 @@ internal class ISteamUGC : SteamInterface public override void InitInternals() { - _CreateQueryUserUGCRequest = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 0) ); - _CreateQueryAllUGCRequest1 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, Config.Os == OsType.Windows ? 16 : 8 ) ); - _CreateQueryAllUGCRequest2 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, Config.Os == OsType.Windows ? 8 : 16 ) ); - _CreateQueryUGCDetailsRequest = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 24) ); - _SendQueryUGCRequest = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 32) ); - _GetQueryUGCResult = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 40) ); - _GetQueryUGCPreviewURL = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 48) ); - _GetQueryUGCMetadata = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 56) ); - _GetQueryUGCChildren = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 64) ); - _GetQueryUGCStatistic = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 72) ); - _GetQueryUGCNumAdditionalPreviews = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 80) ); - _GetQueryUGCAdditionalPreview = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 88) ); - _GetQueryUGCNumKeyValueTags = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 96) ); - _GetQueryUGCKeyValueTag = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 104) ); - _ReleaseQueryUGCRequest = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 112) ); - _AddRequiredTag = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 120) ); - _AddExcludedTag = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 128) ); - _SetReturnOnlyIDs = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 136) ); - _SetReturnKeyValueTags = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 144) ); - _SetReturnLongDescription = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 152) ); - _SetReturnMetadata = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 160) ); - _SetReturnChildren = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 168) ); - _SetReturnAdditionalPreviews = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 176) ); - _SetReturnTotalOnly = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 184) ); - _SetReturnPlaytimeStats = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 192) ); - _SetLanguage = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 200) ); - _SetAllowCachedResponse = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 208) ); - _SetCloudFileNameFilter = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 216) ); - _SetMatchAnyTag = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 224) ); - _SetSearchText = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 232) ); - _SetRankedByTrendDays = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 240) ); - _AddRequiredKeyValueTag = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 248) ); - _RequestUGCDetails = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 256) ); - _CreateItem = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 264) ); - _StartItemUpdate = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 272) ); - _SetItemTitle = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 280) ); - _SetItemDescription = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 288) ); - _SetItemUpdateLanguage = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 296) ); - _SetItemMetadata = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 304) ); - _SetItemVisibility = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 312) ); - _SetItemTags = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 320) ); - _SetItemContent = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 328) ); - _SetItemPreview = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 336) ); - _SetAllowLegacyUpload = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 344) ); - _RemoveItemKeyValueTags = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 352) ); - _AddItemKeyValueTag = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 360) ); - _AddItemPreviewFile = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 368) ); - _AddItemPreviewVideo = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 376) ); - _UpdateItemPreviewFile = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 384) ); - _UpdateItemPreviewVideo = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 392) ); - _RemoveItemPreview = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 400) ); - _SubmitItemUpdate = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 408) ); - _GetItemUpdateProgress = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 416) ); - _SetUserItemVote = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 424) ); - _GetUserItemVote = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 432) ); - _AddItemToFavorites = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 440) ); - _RemoveItemFromFavorites = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 448) ); - _SubscribeItem = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 456) ); - _UnsubscribeItem = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 464) ); - _GetNumSubscribedItems = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 472) ); - _GetSubscribedItems = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 480) ); - _GetItemState = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 488) ); - _GetItemInstallInfo = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 496) ); - _GetItemDownloadInfo = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 504) ); - _DownloadItem = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 512) ); - _BInitWorkshopForGameServer = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 520) ); - _SuspendDownloads = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 528) ); - _StartPlaytimeTracking = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 536) ); - _StopPlaytimeTracking = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 544) ); - _StopPlaytimeTrackingForAllItems = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 552) ); - _AddDependency = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 560) ); - _RemoveDependency = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 568) ); - _AddAppDependency = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 576) ); - _RemoveAppDependency = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 584) ); - _GetAppDependencies = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 592) ); - _DeleteItem = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 600) ); + #if PLATFORM_WIN64 + int[] loc = new[] { 0, 16, 8, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 264, 272, 280, 288, 296, 304, 312, 320, 328, 336, 344, 352, 360, 368, 376, 384, 392, 400, 408, 416, 424, 432, 440, 448, 456, 464, 472, 480, 488, 496, 504, 512, 520, 528, 536, 544, 552, 560, 568, 576, 584, 592, 600 }; + #else + int[] loc = new[] { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 264, 272, 280, 288, 296, 304, 312, 320, 328, 336, 344, 352, 360, 368, 376, 384, 392, 400, 408, 416, 424, 432, 440, 448, 456, 464, 472, 480, 488, 496, 504, 512, 520, 528, 536, 544, 552, 560, 568, 576, 584, 592, 600 }; + #endif + + _CreateQueryUserUGCRequest = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[0]) ); + _CreateQueryAllUGCRequest1 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[1]) ); + _CreateQueryAllUGCRequest2 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[2]) ); + _CreateQueryUGCDetailsRequest = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[3]) ); + _SendQueryUGCRequest = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[4]) ); + _GetQueryUGCResult = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[5]) ); + _GetQueryUGCPreviewURL = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[6]) ); + _GetQueryUGCMetadata = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[7]) ); + _GetQueryUGCChildren = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[8]) ); + _GetQueryUGCStatistic = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[9]) ); + _GetQueryUGCNumAdditionalPreviews = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[10]) ); + _GetQueryUGCAdditionalPreview = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[11]) ); + _GetQueryUGCNumKeyValueTags = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[12]) ); + _GetQueryUGCKeyValueTag = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[13]) ); + _ReleaseQueryUGCRequest = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[14]) ); + _AddRequiredTag = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[15]) ); + _AddExcludedTag = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[16]) ); + _SetReturnOnlyIDs = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[17]) ); + _SetReturnKeyValueTags = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[18]) ); + _SetReturnLongDescription = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[19]) ); + _SetReturnMetadata = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[20]) ); + _SetReturnChildren = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[21]) ); + _SetReturnAdditionalPreviews = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[22]) ); + _SetReturnTotalOnly = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[23]) ); + _SetReturnPlaytimeStats = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[24]) ); + _SetLanguage = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[25]) ); + _SetAllowCachedResponse = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[26]) ); + _SetCloudFileNameFilter = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[27]) ); + _SetMatchAnyTag = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[28]) ); + _SetSearchText = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[29]) ); + _SetRankedByTrendDays = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[30]) ); + _AddRequiredKeyValueTag = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[31]) ); + _RequestUGCDetails = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[32]) ); + _CreateItem = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[33]) ); + _StartItemUpdate = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[34]) ); + _SetItemTitle = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[35]) ); + _SetItemDescription = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[36]) ); + _SetItemUpdateLanguage = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[37]) ); + _SetItemMetadata = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[38]) ); + _SetItemVisibility = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[39]) ); + _SetItemTags = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[40]) ); + _SetItemContent = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[41]) ); + _SetItemPreview = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[42]) ); + _SetAllowLegacyUpload = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[43]) ); + _RemoveItemKeyValueTags = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[44]) ); + _AddItemKeyValueTag = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[45]) ); + _AddItemPreviewFile = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[46]) ); + _AddItemPreviewVideo = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[47]) ); + _UpdateItemPreviewFile = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[48]) ); + _UpdateItemPreviewVideo = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[49]) ); + _RemoveItemPreview = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[50]) ); + _SubmitItemUpdate = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[51]) ); + _GetItemUpdateProgress = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[52]) ); + _SetUserItemVote = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[53]) ); + _GetUserItemVote = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[54]) ); + _AddItemToFavorites = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[55]) ); + _RemoveItemFromFavorites = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[56]) ); + _SubscribeItem = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[57]) ); + _UnsubscribeItem = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[58]) ); + _GetNumSubscribedItems = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[59]) ); + _GetSubscribedItems = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[60]) ); + _GetItemState = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[61]) ); + _GetItemInstallInfo = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[62]) ); + _GetItemDownloadInfo = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[63]) ); + _DownloadItem = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[64]) ); + _BInitWorkshopForGameServer = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[65]) ); + _SuspendDownloads = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[66]) ); + _StartPlaytimeTracking = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[67]) ); + _StopPlaytimeTracking = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[68]) ); + _StopPlaytimeTrackingForAllItems = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[69]) ); + _AddDependency = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[70]) ); + _RemoveDependency = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[71]) ); + _AddAppDependency = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[72]) ); + _RemoveAppDependency = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[73]) ); + _GetAppDependencies = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[74]) ); + _DeleteItem = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[75]) ); } internal override void Shutdown() { diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamUserStats.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamUserStats.cs index 0641a3f..3a77355 100644 --- a/Facepunch.Steamworks/Generated/Interfaces/ISteamUserStats.cs +++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamUserStats.cs @@ -13,49 +13,55 @@ internal class ISteamUserStats : SteamInterface public override void InitInternals() { - _RequestCurrentStats = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 0) ); - _GetStat1 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, Config.Os == OsType.Windows ? 16 : 8 ) ); - _GetStat2 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, Config.Os == OsType.Windows ? 8 : 16 ) ); - _SetStat1 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, Config.Os == OsType.Windows ? 32 : 24 ) ); - _SetStat2 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, Config.Os == OsType.Windows ? 24 : 32 ) ); - _UpdateAvgRateStat = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 40) ); - _GetAchievement = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 48) ); - _SetAchievement = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 56) ); - _ClearAchievement = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 64) ); - _GetAchievementAndUnlockTime = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 72) ); - _StoreStats = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 80) ); - _GetAchievementIcon = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 88) ); - _GetAchievementDisplayAttribute = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 96) ); - _IndicateAchievementProgress = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 104) ); - _GetNumAchievements = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 112) ); - _GetAchievementName = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 120) ); - _RequestUserStats = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 128) ); - _GetUserStat1 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, Config.Os == OsType.Windows ? 144 : 136 ) ); - _GetUserStat2 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, Config.Os == OsType.Windows ? 136 : 144 ) ); - _GetUserAchievement = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 152) ); - _GetUserAchievementAndUnlockTime = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 160) ); - _ResetAllStats = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 168) ); - _FindOrCreateLeaderboard = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 176) ); - _FindLeaderboard = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 184) ); - _GetLeaderboardName = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 192) ); - _GetLeaderboardEntryCount = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 200) ); - _GetLeaderboardSortMethod = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 208) ); - _GetLeaderboardDisplayType = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 216) ); - _DownloadLeaderboardEntries = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 224) ); - _DownloadLeaderboardEntriesForUsers = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 232) ); - _GetDownloadedLeaderboardEntry = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 240) ); - _UploadLeaderboardScore = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 248) ); - _AttachLeaderboardUGC = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 256) ); - _GetNumberOfCurrentPlayers = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 264) ); - _RequestGlobalAchievementPercentages = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 272) ); - _GetMostAchievedAchievementInfo = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 280) ); - _GetNextMostAchievedAchievementInfo = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 288) ); - _GetAchievementAchievedPercent = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 296) ); - _RequestGlobalStats = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 304) ); - _GetGlobalStat1 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, Config.Os == OsType.Windows ? 320 : 312 ) ); - _GetGlobalStat2 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, Config.Os == OsType.Windows ? 312 : 320 ) ); - _GetGlobalStatHistory1 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, Config.Os == OsType.Windows ? 336 : 328 ) ); - _GetGlobalStatHistory2 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, Config.Os == OsType.Windows ? 328 : 336 ) ); + #if PLATFORM_WIN64 + int[] loc = new[] { 0, 16, 8, 32, 24, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 144, 136, 152, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 264, 272, 280, 288, 296, 304, 320, 312, 336, 328 }; + #else + int[] loc = new[] { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 264, 272, 280, 288, 296, 304, 312, 320, 328, 336 }; + #endif + + _RequestCurrentStats = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[0]) ); + _GetStat1 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[1]) ); + _GetStat2 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[2]) ); + _SetStat1 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[3]) ); + _SetStat2 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[4]) ); + _UpdateAvgRateStat = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[5]) ); + _GetAchievement = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[6]) ); + _SetAchievement = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[7]) ); + _ClearAchievement = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[8]) ); + _GetAchievementAndUnlockTime = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[9]) ); + _StoreStats = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[10]) ); + _GetAchievementIcon = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[11]) ); + _GetAchievementDisplayAttribute = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[12]) ); + _IndicateAchievementProgress = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[13]) ); + _GetNumAchievements = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[14]) ); + _GetAchievementName = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[15]) ); + _RequestUserStats = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[16]) ); + _GetUserStat1 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[17]) ); + _GetUserStat2 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[18]) ); + _GetUserAchievement = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[19]) ); + _GetUserAchievementAndUnlockTime = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[20]) ); + _ResetAllStats = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[21]) ); + _FindOrCreateLeaderboard = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[22]) ); + _FindLeaderboard = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[23]) ); + _GetLeaderboardName = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[24]) ); + _GetLeaderboardEntryCount = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[25]) ); + _GetLeaderboardSortMethod = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[26]) ); + _GetLeaderboardDisplayType = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[27]) ); + _DownloadLeaderboardEntries = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[28]) ); + _DownloadLeaderboardEntriesForUsers = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[29]) ); + _GetDownloadedLeaderboardEntry = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[30]) ); + _UploadLeaderboardScore = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[31]) ); + _AttachLeaderboardUGC = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[32]) ); + _GetNumberOfCurrentPlayers = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[33]) ); + _RequestGlobalAchievementPercentages = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[34]) ); + _GetMostAchievedAchievementInfo = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[35]) ); + _GetNextMostAchievedAchievementInfo = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[36]) ); + _GetAchievementAchievedPercent = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[37]) ); + _RequestGlobalStats = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[38]) ); + _GetGlobalStat1 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[39]) ); + _GetGlobalStat2 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[40]) ); + _GetGlobalStatHistory1 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[41]) ); + _GetGlobalStatHistory2 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[42]) ); } internal override void Shutdown() { diff --git a/Generator/CodeWriter/ClassVTable.cs b/Generator/CodeWriter/ClassVTable.cs index df345e4..28a0d09 100644 --- a/Generator/CodeWriter/ClassVTable.cs +++ b/Generator/CodeWriter/ClassVTable.cs @@ -56,11 +56,13 @@ void WriteFunctionPointerReader( CodeParser.Class clss ) { // TODO - we'll probably have to do this PER platform - int[] locations = new int[clss.Functions.Count]; + int[] standardLocations = new int[clss.Functions.Count]; + int[] windowsLocations = new int[clss.Functions.Count]; for ( int i = 0; i < clss.Functions.Count; i++ ) { - locations[i] = i * 8; + windowsLocations[i] = i * 8; + standardLocations[i] = i * 8; } // @@ -70,50 +72,61 @@ void WriteFunctionPointerReader( CodeParser.Class clss ) // if ( clss.Name == "ISteamUserStats" ) { - Swap( clss, "GetStat1", "GetStat2", locations ); - Swap( clss, "SetStat1", "SetStat2", locations ); - Swap( clss, "GetUserStat1", "GetUserStat2", locations ); - Swap( clss, "GetGlobalStat1", "GetGlobalStat2", locations ); - Swap( clss, "GetGlobalStatHistory1", "GetGlobalStatHistory2", locations ); + Swap( clss, "GetStat1", "GetStat2", windowsLocations ); + Swap( clss, "SetStat1", "SetStat2", windowsLocations ); + Swap( clss, "GetUserStat1", "GetUserStat2", windowsLocations ); + Swap( clss, "GetGlobalStat1", "GetGlobalStat2", windowsLocations ); + Swap( clss, "GetGlobalStatHistory1", "GetGlobalStatHistory2", windowsLocations ); } if ( clss.Name == "ISteamGameServerStats" ) { - Swap( clss, "GetUserStat1", "GetUserStat2", locations ); - Swap( clss, "SetUserStat1", "SetUserStat2", locations ); + Swap( clss, "GetUserStat1", "GetUserStat2", windowsLocations ); + Swap( clss, "SetUserStat1", "SetUserStat2", windowsLocations ); } if ( clss.Name == "ISteamUGC" ) { - Swap( clss, "CreateQueryAllUGCRequest1", "CreateQueryAllUGCRequest2", locations ); + Swap( clss, "CreateQueryAllUGCRequest1", "CreateQueryAllUGCRequest2", windowsLocations ); } StartBlock( $"public override void InitInternals()" ); { - for (int i=0; i< clss.Functions.Count; i++ ) + + if ( standardLocations.SequenceEqual( windowsLocations ) ) { - var func = clss.Functions[i]; - var returnType = BaseType.Parse( func.ReturnType ); - var args = func.Arguments.Select( x => BaseType.Parse( x.Value, x.Key ) ).ToArray(); - var regularpos = i * 8; - var windowsSpecific = NeedsWindowsSpecificFunction( func, returnType, args ); - - if ( Cleanup.IsDeprecated( $"{clss.Name}.{func.Name}" ) ) + for ( int i = 0; i < clss.Functions.Count; i++ ) { - WriteLine( $" // {func.Name} is deprecated - {locations[i]}" ); - } - else - { - var pos = $"Config.Os == OsType.Windows ? {locations[i]} : {regularpos} "; + var func = clss.Functions[i]; - if ( regularpos == locations[i] ) - pos = regularpos.ToString(); - - WriteLine( $"_{func.Name} = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, {pos}) );" ); - + if ( Cleanup.IsDeprecated( $"{clss.Name}.{func.Name}" ) ) + WriteLine( $" // {func.Name} is deprecated" ); + else + WriteLine( $"_{func.Name} = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, {standardLocations[i]}) );" ); } } + else + { + WriteLine( "#if PLATFORM_WIN64" ); + WriteLine( $"int[] loc = new[] {{ {string.Join( ", ", windowsLocations )} }};" ); + WriteLine( "#else" ); + WriteLine( $"int[] loc = new[] {{ {string.Join( ", ", standardLocations )} }};" ); + WriteLine( "#endif" ); + WriteLine(); + + for ( int i = 0; i < clss.Functions.Count; i++ ) + { + var func = clss.Functions[i]; + + if ( Cleanup.IsDeprecated( $"{clss.Name}.{func.Name}" ) ) + WriteLine( $" // {func.Name} is deprecated" ); + else + WriteLine( $"_{func.Name} = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, loc[{i}]) );" ); + } + } + + } EndBlock();