mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-25 06:05:46 +03:00
Parse newer style STEAM_CALLBACK_BEGIN
This commit is contained in:
parent
21ff07288d
commit
9d086dbcf6
File diff suppressed because it is too large
Load Diff
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user