diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamUGC.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamUGC.cs index eb02ee5..15ea52a 100644 --- a/Facepunch.Steamworks/Generated/Interfaces/ISteamUGC.cs +++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamUGC.cs @@ -18,8 +18,8 @@ namespace Steamworks public override void InitInternals() { _CreateQueryUserUGCRequest = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 0) ); - _CreateQueryAllUGCRequest1 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 16) ); - _CreateQueryAllUGCRequest2 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 8) ); + _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) ); diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamUserStats.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamUserStats.cs index 90b1618..9cc996f 100644 --- a/Facepunch.Steamworks/Generated/Interfaces/ISteamUserStats.cs +++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamUserStats.cs @@ -18,10 +18,10 @@ namespace Steamworks public override void InitInternals() { _RequestCurrentStats = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 0) ); - _GetStat1 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 16) ); - _GetStat2 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 8) ); - _SetStat1 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 32) ); - _SetStat2 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 24) ); + _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) ); @@ -34,8 +34,8 @@ namespace Steamworks _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, 144) ); - _GetUserStat2 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 136) ); + _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) ); @@ -56,10 +56,10 @@ namespace Steamworks _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, 320) ); - _GetGlobalStat2 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 312) ); - _GetGlobalStatHistory1 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 336) ); - _GetGlobalStatHistory2 = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 328) ); + _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 ) ); } #region FunctionMeta diff --git a/Generator/CodeWriter/ClassVTable.cs b/Generator/CodeWriter/ClassVTable.cs index 90aa9c0..4f575b1 100644 --- a/Generator/CodeWriter/ClassVTable.cs +++ b/Generator/CodeWriter/ClassVTable.cs @@ -96,6 +96,7 @@ namespace Generator { var func = clss.Functions[i]; var returnType = BaseType.Parse( func.ReturnType ); + var regularpos = i * 8; if ( Cleanup.IsDeprecated( $"{clss.Name}.{func.Name}" ) ) { @@ -103,11 +104,21 @@ namespace Generator } else { - WriteLine( $"_{func.Name} = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, {locations[i]}) );" ); - - if ( returnType.IsReturnedWeird ) + if ( regularpos != locations[i] ) { - WriteLine( $"_{func.Name}_Windows = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, {locations[i]}) );" ); + WriteLine( $"_{func.Name} = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, Config.Os == OsType.Windows ? {locations[i]} : {regularpos} ) );" ); + if ( returnType.IsReturnedWeird ) + throw new System.NotImplementedException(); + } + else + { + + WriteLine( $"_{func.Name} = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, {locations[i]}) );" ); + + if ( returnType.IsReturnedWeird ) + { + WriteLine( $"_{func.Name}_Windows = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, {locations[i]}) );" ); + } } } }