From afb2e286f47fc26ee76278f6cf5fc6c07a88ba1a Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Fri, 12 Apr 2019 22:52:55 +0100 Subject: [PATCH] Interface string --- Facepunch.Steamworks/Generated/Interfaces/ISteamApps.cs | 2 ++ Facepunch.Steamworks/Utility/BaseSteamInterface.cs | 2 +- Generator/CodeParser/CodeParser.Class.cs | 3 ++- Generator/CodeParser/ParseClasses.cs | 6 ++++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Facepunch.Steamworks/Generated/Interfaces/ISteamApps.cs b/Facepunch.Steamworks/Generated/Interfaces/ISteamApps.cs index 1172d76..dccbb76 100644 --- a/Facepunch.Steamworks/Generated/Interfaces/ISteamApps.cs +++ b/Facepunch.Steamworks/Generated/Interfaces/ISteamApps.cs @@ -8,6 +8,8 @@ namespace Steamworks.Internal { public class ISteamApps : BaseSteamInterface { + public override string InterfaceName => "STEAMAPPS_INTERFACE_VERSION008"; + public override void InitInternals() { BIsSubscribedDelegatePointer = Marshal.GetDelegateForFunctionPointer( Marshal.ReadIntPtr( VTable, 0) ); diff --git a/Facepunch.Steamworks/Utility/BaseSteamInterface.cs b/Facepunch.Steamworks/Utility/BaseSteamInterface.cs index f8bcc96..ccf2b18 100644 --- a/Facepunch.Steamworks/Utility/BaseSteamInterface.cs +++ b/Facepunch.Steamworks/Utility/BaseSteamInterface.cs @@ -14,7 +14,7 @@ namespace Steamworks.Internal public IntPtr Self; public IntPtr VTable; - public virtual string InterfaceName => "STEAMAPPS_INTERFACE_VERSION008"; + public virtual string InterfaceName => null; public BaseSteamInterface() { diff --git a/Generator/CodeParser/CodeParser.Class.cs b/Generator/CodeParser/CodeParser.Class.cs index 1923545..e2f0964 100644 --- a/Generator/CodeParser/CodeParser.Class.cs +++ b/Generator/CodeParser/CodeParser.Class.cs @@ -9,6 +9,7 @@ namespace Generator public class Class { public string Name; + public string InterfaceString; public class Function { @@ -19,7 +20,7 @@ namespace Generator public string CallResult; } - public List Functions = new List(); + public List Functions = new List(); internal Function AddFunction( string funcName, string returnType, string args ) { diff --git a/Generator/CodeParser/ParseClasses.cs b/Generator/CodeParser/ParseClasses.cs index 17fe3e8..6684cc3 100644 --- a/Generator/CodeParser/ParseClasses.cs +++ b/Generator/CodeParser/ParseClasses.cs @@ -40,6 +40,12 @@ namespace Generator var c = new Class(); c.Name = classname; + var interfaceMatch = Regex.Match( Content, $"#define {classname.ToUpper().Substring( 1 )}_INTERFACE_VERSION \"(.+?)\"" ); + if ( interfaceMatch.Success ) + { + c.InterfaceString = interfaceMatch.Groups[1].Value; + } + foreach ( var line in lines ) { if ( line.Trim().Length < 4 ) continue;