mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-24 13:45:37 +03:00
Parser fixes
This commit is contained in:
parent
ebc1336da3
commit
79ed6a299a
@ -46,22 +46,20 @@ public override void InitInternals()
|
||||
GetLeaderboardSortMethodDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetLeaderboardSortMethodDelegate>( Marshal.ReadIntPtr( VTable, 208) );
|
||||
GetLeaderboardDisplayTypeDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetLeaderboardDisplayTypeDelegate>( Marshal.ReadIntPtr( VTable, 216) );
|
||||
DownloadLeaderboardEntriesDelegatePointer = Marshal.GetDelegateForFunctionPointer<DownloadLeaderboardEntriesDelegate>( Marshal.ReadIntPtr( VTable, 224) );
|
||||
GetDownloadedLeaderboardEntryDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetDownloadedLeaderboardEntryDelegate>( Marshal.ReadIntPtr( VTable, 232) );
|
||||
UploadLeaderboardScoreDelegatePointer = Marshal.GetDelegateForFunctionPointer<UploadLeaderboardScoreDelegate>( Marshal.ReadIntPtr( VTable, 240) );
|
||||
AttachLeaderboardUGCDelegatePointer = Marshal.GetDelegateForFunctionPointer<AttachLeaderboardUGCDelegate>( Marshal.ReadIntPtr( VTable, 248) );
|
||||
GetNumberOfCurrentPlayersDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetNumberOfCurrentPlayersDelegate>( Marshal.ReadIntPtr( VTable, 256) );
|
||||
RequestGlobalAchievementPercentagesDelegatePointer = Marshal.GetDelegateForFunctionPointer<RequestGlobalAchievementPercentagesDelegate>( Marshal.ReadIntPtr( VTable, 264) );
|
||||
GetMostAchievedAchievementInfoDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetMostAchievedAchievementInfoDelegate>( Marshal.ReadIntPtr( VTable, 272) );
|
||||
GetNextMostAchievedAchievementInfoDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetNextMostAchievedAchievementInfoDelegate>( Marshal.ReadIntPtr( VTable, 280) );
|
||||
GetAchievementAchievedPercentDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetAchievementAchievedPercentDelegate>( Marshal.ReadIntPtr( VTable, 288) );
|
||||
RequestGlobalStatsDelegatePointer = Marshal.GetDelegateForFunctionPointer<RequestGlobalStatsDelegate>( Marshal.ReadIntPtr( VTable, 296) );
|
||||
GetGlobalStatDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetGlobalStatDelegate>( Marshal.ReadIntPtr( VTable, 304) );
|
||||
GetGlobalStat2DelegatePointer = Marshal.GetDelegateForFunctionPointer<GetGlobalStat2Delegate>( Marshal.ReadIntPtr( VTable, 312) );
|
||||
GetGlobalStatHistoryDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetGlobalStatHistoryDelegate>( Marshal.ReadIntPtr( VTable, 320) );
|
||||
GetGlobalStatHistory2DelegatePointer = Marshal.GetDelegateForFunctionPointer<GetGlobalStatHistory2Delegate>( Marshal.ReadIntPtr( VTable, 328) );
|
||||
GetTrophySpaceRequiredBeforeInstallDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetTrophySpaceRequiredBeforeInstallDelegate>( Marshal.ReadIntPtr( VTable, 336) );
|
||||
SetUserStatsDataDelegatePointer = Marshal.GetDelegateForFunctionPointer<SetUserStatsDataDelegate>( Marshal.ReadIntPtr( VTable, 344) );
|
||||
GetUserStatsDataDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetUserStatsDataDelegate>( Marshal.ReadIntPtr( VTable, 352) );
|
||||
DownloadLeaderboardEntriesForUsersDelegatePointer = Marshal.GetDelegateForFunctionPointer<DownloadLeaderboardEntriesForUsersDelegate>( Marshal.ReadIntPtr( VTable, 232) );
|
||||
GetDownloadedLeaderboardEntryDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetDownloadedLeaderboardEntryDelegate>( Marshal.ReadIntPtr( VTable, 240) );
|
||||
UploadLeaderboardScoreDelegatePointer = Marshal.GetDelegateForFunctionPointer<UploadLeaderboardScoreDelegate>( Marshal.ReadIntPtr( VTable, 248) );
|
||||
AttachLeaderboardUGCDelegatePointer = Marshal.GetDelegateForFunctionPointer<AttachLeaderboardUGCDelegate>( Marshal.ReadIntPtr( VTable, 256) );
|
||||
GetNumberOfCurrentPlayersDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetNumberOfCurrentPlayersDelegate>( Marshal.ReadIntPtr( VTable, 264) );
|
||||
RequestGlobalAchievementPercentagesDelegatePointer = Marshal.GetDelegateForFunctionPointer<RequestGlobalAchievementPercentagesDelegate>( Marshal.ReadIntPtr( VTable, 272) );
|
||||
GetMostAchievedAchievementInfoDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetMostAchievedAchievementInfoDelegate>( Marshal.ReadIntPtr( VTable, 280) );
|
||||
GetNextMostAchievedAchievementInfoDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetNextMostAchievedAchievementInfoDelegate>( Marshal.ReadIntPtr( VTable, 288) );
|
||||
GetAchievementAchievedPercentDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetAchievementAchievedPercentDelegate>( Marshal.ReadIntPtr( VTable, 296) );
|
||||
RequestGlobalStatsDelegatePointer = Marshal.GetDelegateForFunctionPointer<RequestGlobalStatsDelegate>( Marshal.ReadIntPtr( VTable, 304) );
|
||||
GetGlobalStatDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetGlobalStatDelegate>( Marshal.ReadIntPtr( VTable, 312) );
|
||||
GetGlobalStat2DelegatePointer = Marshal.GetDelegateForFunctionPointer<GetGlobalStat2Delegate>( Marshal.ReadIntPtr( VTable, 320) );
|
||||
GetGlobalStatHistoryDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetGlobalStatHistoryDelegate>( Marshal.ReadIntPtr( VTable, 328) );
|
||||
GetGlobalStatHistory2DelegatePointer = Marshal.GetDelegateForFunctionPointer<GetGlobalStatHistory2Delegate>( Marshal.ReadIntPtr( VTable, 336) );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
@ -400,6 +398,17 @@ internal LeaderboardDisplayType GetLeaderboardDisplayType( SteamLeaderboard_t hS
|
||||
return await (new Result<LeaderboardScoresDownloaded_t>( DownloadLeaderboardEntriesDelegatePointer( Self, hSteamLeaderboard, eLeaderboardDataRequest, nRangeStart, nRangeEnd ) )).GetResult();
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||
private delegate SteamAPICall_t DownloadLeaderboardEntriesForUsersDelegate( IntPtr self, SteamLeaderboard_t hSteamLeaderboard, [In,Out] SteamId[] prgUsers, int cUsers );
|
||||
private DownloadLeaderboardEntriesForUsersDelegate DownloadLeaderboardEntriesForUsersDelegatePointer;
|
||||
|
||||
#endregion
|
||||
internal async Task<LeaderboardScoresDownloaded_t?> DownloadLeaderboardEntriesForUsers( SteamLeaderboard_t hSteamLeaderboard, [In,Out] SteamId[] prgUsers, int cUsers )
|
||||
{
|
||||
return await (new Result<LeaderboardScoresDownloaded_t>( DownloadLeaderboardEntriesForUsersDelegatePointer( Self, hSteamLeaderboard, prgUsers, cUsers ) )).GetResult();
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
@ -547,40 +556,5 @@ internal int GetGlobalStatHistory2( string pchStatName, ref double pData, uint c
|
||||
return GetGlobalStatHistory2DelegatePointer( Self, pchStatName, ref pData, cubData );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||
private delegate ulong GetTrophySpaceRequiredBeforeInstallDelegate( IntPtr self );
|
||||
private GetTrophySpaceRequiredBeforeInstallDelegate GetTrophySpaceRequiredBeforeInstallDelegatePointer;
|
||||
|
||||
#endregion
|
||||
internal ulong GetTrophySpaceRequiredBeforeInstall()
|
||||
{
|
||||
return GetTrophySpaceRequiredBeforeInstallDelegatePointer( Self );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool SetUserStatsDataDelegate( IntPtr self, IntPtr pvData, uint cubData );
|
||||
private SetUserStatsDataDelegate SetUserStatsDataDelegatePointer;
|
||||
|
||||
#endregion
|
||||
internal bool SetUserStatsData( IntPtr pvData, uint cubData )
|
||||
{
|
||||
return SetUserStatsDataDelegatePointer( Self, pvData, cubData );
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||
[return: MarshalAs( UnmanagedType.I1 )]
|
||||
private delegate bool GetUserStatsDataDelegate( IntPtr self, IntPtr pvData, uint cubData, ref uint pcubWritten );
|
||||
private GetUserStatsDataDelegate GetUserStatsDataDelegatePointer;
|
||||
|
||||
#endregion
|
||||
internal bool GetUserStatsData( IntPtr pvData, uint cubData, ref uint pcubWritten )
|
||||
{
|
||||
return GetUserStatsDataDelegatePointer( Self, pvData, cubData, ref pcubWritten );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,8 @@ internal Function AddFunction( string funcName, string returnType, string args )
|
||||
ReturnType = returnType
|
||||
};
|
||||
|
||||
args = Regex.Replace( args, "", "" );
|
||||
|
||||
foreach ( var arg in args.Split( new[] { ',' }, StringSplitOptions.RemoveEmptyEntries ) )
|
||||
{
|
||||
var m = Regex.Match( arg.Trim(), @"(.+?[ |\*])?([a-zA-Z0-9_]+?)( = (.+?))?$" );
|
||||
|
@ -48,25 +48,52 @@ public void ProcessClass( string fulldef, string classname, string inner )
|
||||
|
||||
var lastCallResult = "";
|
||||
|
||||
foreach ( var line in lines )
|
||||
var partialLine = "";
|
||||
|
||||
var needsEndIf = false;
|
||||
|
||||
foreach ( var linestr in lines )
|
||||
{
|
||||
var line = linestr;
|
||||
|
||||
if ( line.Trim().Length < 4 ) continue;
|
||||
if ( line.Trim().StartsWith( "public:" ) ) continue;
|
||||
if ( line.Trim().StartsWith( "//" ) ) continue;
|
||||
|
||||
if ( line.Trim().StartsWith( "#ifdef _PS3" ) )
|
||||
{
|
||||
needsEndIf = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( needsEndIf )
|
||||
{
|
||||
needsEndIf = !line.Trim().StartsWith( "#endif" );
|
||||
continue;
|
||||
}
|
||||
|
||||
var callresult = Regex.Match( line, @"STEAM_CALL_RESULT\((.+?)\)" );
|
||||
if ( callresult.Success )
|
||||
{
|
||||
partialLine = "";
|
||||
lastCallResult = callresult.Groups[1].Value.Trim();
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !string.IsNullOrEmpty( partialLine ) )
|
||||
{
|
||||
partialLine += " " + line.Trim();
|
||||
|
||||
if ( !partialLine.Trim().EndsWith( ";" ) )
|
||||
continue;
|
||||
|
||||
line = partialLine;
|
||||
partialLine = "";
|
||||
}
|
||||
|
||||
var f = func.Match( line );
|
||||
if ( f.Success )
|
||||
{
|
||||
|
||||
|
||||
|
||||
var returnType = f.Groups[1].Value.Trim();
|
||||
var funcName = f.Groups[2].Value.Trim();
|
||||
var args = f.Groups[3].Value.Trim();
|
||||
@ -82,9 +109,15 @@ public void ProcessClass( string fulldef, string classname, string inner )
|
||||
|
||||
fnc.CallResult = lastCallResult;
|
||||
lastCallResult = null;
|
||||
partialLine = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( line.Trim().StartsWith( "virtual " ) )
|
||||
{
|
||||
partialLine = line;
|
||||
}
|
||||
|
||||
Console.WriteLine( $"Unknown Line: {line}" );
|
||||
}
|
||||
}
|
||||
@ -101,6 +134,8 @@ public string RemoveAnnotations( string str )
|
||||
str = Regex.Replace( str, @"STEAM_ARRAY_COUNT\((.+?)\) ", "" );
|
||||
str = Regex.Replace( str, @"STEAM_OUT_STRUCT\(\) ", "" );
|
||||
str = Regex.Replace( str, @"STEAM_OUT_STRUCT\((.+?)\) ", "" );
|
||||
str = Regex.Replace( str, @"STEAM_OUT_ARRAY_COUNT\((.+?)\)", "" );
|
||||
str = Regex.Replace( str, @"STEAM_ARRAY_COUNT_D\((.+?)\)", "" );
|
||||
|
||||
|
||||
|
||||
|
@ -61,6 +61,7 @@ public virtual bool IsVector
|
||||
|
||||
if ( VarName == "psteamIDClans" ) return true;
|
||||
if ( VarName == "pScoreDetails" ) return true;
|
||||
if ( VarName == "prgUsers" ) return true;
|
||||
if ( NativeType.EndsWith( "**" ) ) return true;
|
||||
|
||||
if ( NativeType.EndsWith( "*" ) )
|
||||
|
Loading…
Reference in New Issue
Block a user