Parse newer style STEAM_CALLBACK_BEGIN

This commit is contained in:
Garry Newman 2019-04-11 17:00:44 +01:00
parent 21ff07288d
commit 9d086dbcf6
2 changed files with 4119 additions and 7 deletions

File diff suppressed because it is too large Load Diff

View File

@ -28,6 +28,8 @@ internal void ExtendDefinition( SteamApiDefinition def )
// Get a list of CallbackIds // Get a list of CallbackIds
// //
def.CallbackIds = new Dictionary<string, int>(); def.CallbackIds = new Dictionary<string, int>();
//v1
{ {
var r = new Regex( @"enum { (k_[i|I](?:.+)) = ([0-9]+) };" ); var r = new Regex( @"enum { (k_[i|I](?:.+)) = ([0-9]+) };" );
var ma = r.Matches( Content ); var ma = r.Matches( Content );
@ -38,12 +40,10 @@ internal void ExtendDefinition( SteamApiDefinition def )
} }
} }
//
// Associate callbackIds with structs
// //
// Associate callbackIds with structs foreach ( var t in def.structs )
//
foreach ( var t in def.structs )
{ {
if ( !string.IsNullOrEmpty( t.CallbackId ) ) continue; if ( !string.IsNullOrEmpty( t.CallbackId ) ) continue;
@ -83,7 +83,23 @@ internal void ExtendDefinition( SteamApiDefinition def )
t.CallbackId = $"{kName} + {num}"; t.CallbackId = $"{kName} + {num}";
} }
} }
}
// Even Newer Style
{
var r = new Regex( @"STEAM_CALLBACK_BEGIN\( " + t.Name + @", (.+) \+ ([0-9]+) \)" );
var m = r.Match( Content );
if ( m.Success )
{
var kName = m.Groups[1].Value;
var num = m.Groups[2].Value;
//kName = kName.Replace( "k_i", "CallbackIdentifiers." ).Replace( "Callbacks", "" );
kName = "CallbackIdentifiers." + kName.Substring( 3 ).Replace( "Callbacks", "" );
t.CallbackId = $"{kName} + {num}";
}
}
}
// //
// Find defines // Find defines