mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-25 14:15:47 +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) );
|
GetLeaderboardSortMethodDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetLeaderboardSortMethodDelegate>( Marshal.ReadIntPtr( VTable, 208) );
|
||||||
GetLeaderboardDisplayTypeDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetLeaderboardDisplayTypeDelegate>( Marshal.ReadIntPtr( VTable, 216) );
|
GetLeaderboardDisplayTypeDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetLeaderboardDisplayTypeDelegate>( Marshal.ReadIntPtr( VTable, 216) );
|
||||||
DownloadLeaderboardEntriesDelegatePointer = Marshal.GetDelegateForFunctionPointer<DownloadLeaderboardEntriesDelegate>( Marshal.ReadIntPtr( VTable, 224) );
|
DownloadLeaderboardEntriesDelegatePointer = Marshal.GetDelegateForFunctionPointer<DownloadLeaderboardEntriesDelegate>( Marshal.ReadIntPtr( VTable, 224) );
|
||||||
GetDownloadedLeaderboardEntryDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetDownloadedLeaderboardEntryDelegate>( Marshal.ReadIntPtr( VTable, 232) );
|
DownloadLeaderboardEntriesForUsersDelegatePointer = Marshal.GetDelegateForFunctionPointer<DownloadLeaderboardEntriesForUsersDelegate>( Marshal.ReadIntPtr( VTable, 232) );
|
||||||
UploadLeaderboardScoreDelegatePointer = Marshal.GetDelegateForFunctionPointer<UploadLeaderboardScoreDelegate>( Marshal.ReadIntPtr( VTable, 240) );
|
GetDownloadedLeaderboardEntryDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetDownloadedLeaderboardEntryDelegate>( Marshal.ReadIntPtr( VTable, 240) );
|
||||||
AttachLeaderboardUGCDelegatePointer = Marshal.GetDelegateForFunctionPointer<AttachLeaderboardUGCDelegate>( Marshal.ReadIntPtr( VTable, 248) );
|
UploadLeaderboardScoreDelegatePointer = Marshal.GetDelegateForFunctionPointer<UploadLeaderboardScoreDelegate>( Marshal.ReadIntPtr( VTable, 248) );
|
||||||
GetNumberOfCurrentPlayersDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetNumberOfCurrentPlayersDelegate>( Marshal.ReadIntPtr( VTable, 256) );
|
AttachLeaderboardUGCDelegatePointer = Marshal.GetDelegateForFunctionPointer<AttachLeaderboardUGCDelegate>( Marshal.ReadIntPtr( VTable, 256) );
|
||||||
RequestGlobalAchievementPercentagesDelegatePointer = Marshal.GetDelegateForFunctionPointer<RequestGlobalAchievementPercentagesDelegate>( Marshal.ReadIntPtr( VTable, 264) );
|
GetNumberOfCurrentPlayersDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetNumberOfCurrentPlayersDelegate>( Marshal.ReadIntPtr( VTable, 264) );
|
||||||
GetMostAchievedAchievementInfoDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetMostAchievedAchievementInfoDelegate>( Marshal.ReadIntPtr( VTable, 272) );
|
RequestGlobalAchievementPercentagesDelegatePointer = Marshal.GetDelegateForFunctionPointer<RequestGlobalAchievementPercentagesDelegate>( Marshal.ReadIntPtr( VTable, 272) );
|
||||||
GetNextMostAchievedAchievementInfoDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetNextMostAchievedAchievementInfoDelegate>( Marshal.ReadIntPtr( VTable, 280) );
|
GetMostAchievedAchievementInfoDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetMostAchievedAchievementInfoDelegate>( Marshal.ReadIntPtr( VTable, 280) );
|
||||||
GetAchievementAchievedPercentDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetAchievementAchievedPercentDelegate>( Marshal.ReadIntPtr( VTable, 288) );
|
GetNextMostAchievedAchievementInfoDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetNextMostAchievedAchievementInfoDelegate>( Marshal.ReadIntPtr( VTable, 288) );
|
||||||
RequestGlobalStatsDelegatePointer = Marshal.GetDelegateForFunctionPointer<RequestGlobalStatsDelegate>( Marshal.ReadIntPtr( VTable, 296) );
|
GetAchievementAchievedPercentDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetAchievementAchievedPercentDelegate>( Marshal.ReadIntPtr( VTable, 296) );
|
||||||
GetGlobalStatDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetGlobalStatDelegate>( Marshal.ReadIntPtr( VTable, 304) );
|
RequestGlobalStatsDelegatePointer = Marshal.GetDelegateForFunctionPointer<RequestGlobalStatsDelegate>( Marshal.ReadIntPtr( VTable, 304) );
|
||||||
GetGlobalStat2DelegatePointer = Marshal.GetDelegateForFunctionPointer<GetGlobalStat2Delegate>( Marshal.ReadIntPtr( VTable, 312) );
|
GetGlobalStatDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetGlobalStatDelegate>( Marshal.ReadIntPtr( VTable, 312) );
|
||||||
GetGlobalStatHistoryDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetGlobalStatHistoryDelegate>( Marshal.ReadIntPtr( VTable, 320) );
|
GetGlobalStat2DelegatePointer = Marshal.GetDelegateForFunctionPointer<GetGlobalStat2Delegate>( Marshal.ReadIntPtr( VTable, 320) );
|
||||||
GetGlobalStatHistory2DelegatePointer = Marshal.GetDelegateForFunctionPointer<GetGlobalStatHistory2Delegate>( Marshal.ReadIntPtr( VTable, 328) );
|
GetGlobalStatHistoryDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetGlobalStatHistoryDelegate>( Marshal.ReadIntPtr( VTable, 328) );
|
||||||
GetTrophySpaceRequiredBeforeInstallDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetTrophySpaceRequiredBeforeInstallDelegate>( Marshal.ReadIntPtr( VTable, 336) );
|
GetGlobalStatHistory2DelegatePointer = Marshal.GetDelegateForFunctionPointer<GetGlobalStatHistory2Delegate>( Marshal.ReadIntPtr( VTable, 336) );
|
||||||
SetUserStatsDataDelegatePointer = Marshal.GetDelegateForFunctionPointer<SetUserStatsDataDelegate>( Marshal.ReadIntPtr( VTable, 344) );
|
|
||||||
GetUserStatsDataDelegatePointer = Marshal.GetDelegateForFunctionPointer<GetUserStatsDataDelegate>( Marshal.ReadIntPtr( VTable, 352) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region FunctionMeta
|
#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();
|
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
|
#region FunctionMeta
|
||||||
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
[UnmanagedFunctionPointer( CallingConvention.ThisCall )]
|
||||||
[return: MarshalAs( UnmanagedType.I1 )]
|
[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 );
|
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
|
ReturnType = returnType
|
||||||
};
|
};
|
||||||
|
|
||||||
|
args = Regex.Replace( args, "", "" );
|
||||||
|
|
||||||
foreach ( var arg in args.Split( new[] { ',' }, StringSplitOptions.RemoveEmptyEntries ) )
|
foreach ( var arg in args.Split( new[] { ',' }, StringSplitOptions.RemoveEmptyEntries ) )
|
||||||
{
|
{
|
||||||
var m = Regex.Match( arg.Trim(), @"(.+?[ |\*])?([a-zA-Z0-9_]+?)( = (.+?))?$" );
|
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 = "";
|
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().Length < 4 ) continue;
|
||||||
if ( line.Trim().StartsWith( "public:" ) ) continue;
|
if ( line.Trim().StartsWith( "public:" ) ) continue;
|
||||||
if ( line.Trim().StartsWith( "//" ) ) 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\((.+?)\)" );
|
var callresult = Regex.Match( line, @"STEAM_CALL_RESULT\((.+?)\)" );
|
||||||
if ( callresult.Success )
|
if ( callresult.Success )
|
||||||
{
|
{
|
||||||
|
partialLine = "";
|
||||||
lastCallResult = callresult.Groups[1].Value.Trim();
|
lastCallResult = callresult.Groups[1].Value.Trim();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !string.IsNullOrEmpty( partialLine ) )
|
||||||
|
{
|
||||||
|
partialLine += " " + line.Trim();
|
||||||
|
|
||||||
|
if ( !partialLine.Trim().EndsWith( ";" ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
line = partialLine;
|
||||||
|
partialLine = "";
|
||||||
|
}
|
||||||
|
|
||||||
var f = func.Match( line );
|
var f = func.Match( line );
|
||||||
if ( f.Success )
|
if ( f.Success )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var returnType = f.Groups[1].Value.Trim();
|
var returnType = f.Groups[1].Value.Trim();
|
||||||
var funcName = f.Groups[2].Value.Trim();
|
var funcName = f.Groups[2].Value.Trim();
|
||||||
var args = f.Groups[3].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;
|
fnc.CallResult = lastCallResult;
|
||||||
lastCallResult = null;
|
lastCallResult = null;
|
||||||
|
partialLine = "";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if ( line.Trim().StartsWith( "virtual " ) )
|
||||||
|
{
|
||||||
|
partialLine = line;
|
||||||
|
}
|
||||||
|
|
||||||
Console.WriteLine( $"Unknown Line: {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_ARRAY_COUNT\((.+?)\) ", "" );
|
||||||
str = Regex.Replace( str, @"STEAM_OUT_STRUCT\(\) ", "" );
|
str = Regex.Replace( str, @"STEAM_OUT_STRUCT\(\) ", "" );
|
||||||
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 == "psteamIDClans" ) return true;
|
||||||
if ( VarName == "pScoreDetails" ) return true;
|
if ( VarName == "pScoreDetails" ) return true;
|
||||||
|
if ( VarName == "prgUsers" ) return true;
|
||||||
if ( NativeType.EndsWith( "**" ) ) return true;
|
if ( NativeType.EndsWith( "**" ) ) return true;
|
||||||
|
|
||||||
if ( NativeType.EndsWith( "*" ) )
|
if ( NativeType.EndsWith( "*" ) )
|
||||||
|
Loading…
Reference in New Issue
Block a user