diff --git a/Generator/Program.cs b/Generator/Program.cs index e402aa8..06e5d19 100644 --- a/Generator/Program.cs +++ b/Generator/Program.cs @@ -14,7 +14,7 @@ namespace Generator var content = System.IO.File.ReadAllText( "steam_sdk/steam_api.json" ); var def = Newtonsoft.Json.JsonConvert.DeserializeObject( content ); - AddExtras( def ); + AddMissing( def ); var parser = new CodeParser( @"steam_sdk" ); @@ -25,235 +25,13 @@ namespace Generator generator.ToFolder( "../Facepunch.Steamworks/SteamNative/" ); } - private static void AddExtras( SteamApiDefinition def ) + private static void AddMissing( SteamApiDefinition output ) { - def.structs.Add( new SteamApiDefinition.StructDef() - { - Name = "ItemInstalled_t", - Fields = new SteamApiDefinition.StructDef.StructFields[] - { - new SteamApiDefinition.StructDef.StructFields() - { - Name = "m_unAppID", - Type = "AppId_t" - }, - new SteamApiDefinition.StructDef.StructFields() - { - Name = "m_nPublishedFileId", - Type = "PublishedFileId_t" - } - } - - } ); - - def.methods.Add( new SteamApiDefinition.MethodDef() - { - ClassName = "SteamApi", - Name = "SteamAPI_Init", - ReturnType = "bool", - NeedsSelfPointer = false - } ); - - def.methods.Add( new SteamApiDefinition.MethodDef() - { - ClassName = "SteamApi", - Name = "SteamAPI_RunCallbacks", - ReturnType = "void", - NeedsSelfPointer = false - } ); - - def.methods.Add( new SteamApiDefinition.MethodDef() - { - ClassName = "SteamApi", - Name = "SteamGameServer_RunCallbacks", - ReturnType = "void", - NeedsSelfPointer = false - } ); - - def.methods.Add( new SteamApiDefinition.MethodDef() - { - ClassName = "SteamApi", - Name = "SteamAPI_RegisterCallback", - ReturnType = "void", - NeedsSelfPointer = false, - Params = new SteamApiDefinition.MethodDef.ParamType[] - { - new SteamApiDefinition.MethodDef.ParamType() - { - Name = "pCallback", - Type = "void *" - }, - new SteamApiDefinition.MethodDef.ParamType() - { - Name = "callback", - Type = "int" - }, - } - } ); - - def.methods.Add( new SteamApiDefinition.MethodDef() - { - ClassName = "SteamApi", - Name = "SteamAPI_UnregisterCallback", - ReturnType = "void", - NeedsSelfPointer = false, - Params = new SteamApiDefinition.MethodDef.ParamType[] - { - new SteamApiDefinition.MethodDef.ParamType() - { - Name = "pCallback", - Type = "void *" - } - } - } ); - - def.methods.Add( new SteamApiDefinition.MethodDef() - { - ClassName = "SteamApi", - Name = "SteamAPI_RegisterCallResult", - ReturnType = "void", - NeedsSelfPointer = false, - Params = new SteamApiDefinition.MethodDef.ParamType[] - { - new SteamApiDefinition.MethodDef.ParamType() - { - Name = "pCallback", - Type = "void *" - }, - new SteamApiDefinition.MethodDef.ParamType() - { - Name = "callback", - Type = "SteamAPICall_t" - }, - } - } ); - - def.methods.Add( new SteamApiDefinition.MethodDef() - { - ClassName = "SteamApi", - Name = "SteamAPI_UnregisterCallResult", - ReturnType = "void", - NeedsSelfPointer = false, - Params = new SteamApiDefinition.MethodDef.ParamType[] - { - new SteamApiDefinition.MethodDef.ParamType() - { - Name = "pCallback", - Type = "void *" - }, - new SteamApiDefinition.MethodDef.ParamType() - { - Name = "callback", - Type = "SteamAPICall_t" - }, - } - } ); - - def.methods.Add( new SteamApiDefinition.MethodDef() - { - ClassName = "SteamApi", - Name = "SteamInternal_GameServer_Init", - ReturnType = "bool", - NeedsSelfPointer = false, - Params = new SteamApiDefinition.MethodDef.ParamType[] - { - new SteamApiDefinition.MethodDef.ParamType() - { - Name = "unIP", - Type = "uint32" - }, - new SteamApiDefinition.MethodDef.ParamType() - { - Name = "usPort", - Type = "uint16" - }, - new SteamApiDefinition.MethodDef.ParamType() - { - Name = "usGamePort", - Type = "uint16" - }, - new SteamApiDefinition.MethodDef.ParamType() - { - Name = "usQueryPort", - Type = "uint16" - }, - new SteamApiDefinition.MethodDef.ParamType() - { - Name = "eServerMode", - Type = "int" - }, - new SteamApiDefinition.MethodDef.ParamType() - { - Name = "pchVersionString", - Type = "const char *" - } - }, - } ); - - def.methods.Add( new SteamApiDefinition.MethodDef() - { - ClassName = "SteamApi", - Name = "SteamAPI_Shutdown", - ReturnType = "void", - NeedsSelfPointer = false - } ); - - def.methods.Add( new SteamApiDefinition.MethodDef() - { - ClassName = "SteamApi", - Name = "SteamGameServer_Shutdown", - ReturnType = "void", - NeedsSelfPointer = false - } ); - - def.methods.Add( new SteamApiDefinition.MethodDef() - { - ClassName = "SteamApi", - Name = "SteamAPI_GetHSteamUser", - ReturnType = "HSteamUser", - NeedsSelfPointer = false - } ); - - def.methods.Add( new SteamApiDefinition.MethodDef() - { - ClassName = "SteamApi", - Name = "SteamAPI_GetHSteamPipe", - ReturnType = "HSteamPipe", - NeedsSelfPointer = false - } ); - - def.methods.Add( new SteamApiDefinition.MethodDef() - { - ClassName = "SteamApi", - Name = "SteamGameServer_GetHSteamUser", - ReturnType = "HSteamUser", - NeedsSelfPointer = false - } ); - - def.methods.Add( new SteamApiDefinition.MethodDef() - { - ClassName = "SteamApi", - Name = "SteamGameServer_GetHSteamPipe", - ReturnType = "HSteamPipe", - NeedsSelfPointer = false - } ); - - def.methods.Add( new SteamApiDefinition.MethodDef() - { - ClassName = "SteamApi", - Name = "SteamInternal_CreateInterface", - ReturnType = "void *", - Params = new SteamApiDefinition.MethodDef.ParamType[] - { - new SteamApiDefinition.MethodDef.ParamType() - { - Name = "version", - Type = "const char *" - } - }, - NeedsSelfPointer = false - } ); + var content = System.IO.File.ReadAllText( "steam_api_missing.json" ); + var missing = Newtonsoft.Json.JsonConvert.DeserializeObject( content ); + output.structs.AddRange( missing.structs ); + output.methods.AddRange( missing.methods ); } } } diff --git a/Generator/steam_api_missing.json b/Generator/steam_api_missing.json new file mode 100644 index 0000000..28b55b4 --- /dev/null +++ b/Generator/steam_api_missing.json @@ -0,0 +1,215 @@ +{ + structs: + [ + { + struct: "ItemInstalled_t", + fields: + [ + { + fieldname: "m_unAppID", + fieldtype: "AppId_t" + }, + { + fieldname: "m_nPublishedFileId", + fieldtype: "PublishedFileId_t" + } + ] + } + ], + + methods: + [ + { + classname: "SteamApi", + methodname: "SteamAPI_Init", + returntype: "bool", + NeedsSelfPointer: false + }, + + { + classname: "SteamApi", + methodname: "SteamAPI_RunCallbacks", + returntype: "void", + NeedsSelfPointer: false + }, + + + { + classname: "SteamApi", + methodname: "SteamGameServer_RunCallbacks", + returntype: "void", + NeedsSelfPointer: false + }, + + + { + classname: "SteamApi", + methodname: "SteamAPI_RegisterCallback", + returntype: "void", + NeedsSelfPointer: false, + params: + [ + { + paramname: "pCallback", + paramtype: "void *" + }, + + { + paramname: "callback", + paramtype: "int" + }, + ] + }, + + + { + classname: "SteamApi", + methodname: "SteamAPI_UnregisterCallback", + returntype: "void", + NeedsSelfPointer: false, + params: + [ + { + paramname: "pCallback", + paramtype: "void *" + } + ] + }, + + + { + NeedsSelfPointer: false, + classname: "SteamApi", + methodname: "SteamAPI_RegisterCallResult", + returntype: "void", + params: + [ + { + paramname: "pCallback", + paramtype: "void *" + }, + { + paramname: "callback", + paramtype: "SteamAPICall_t" + } + ], + }, + + + { + NeedsSelfPointer: false, + classname: "SteamApi", + methodname: "SteamAPI_UnregisterCallResult", + returntype: "void", + params: + [ + { + paramname: "pCallback", + paramtype: "void *" + }, + { + paramname: "callback", + paramtype: "SteamAPICall_t" + } + ] + }, + + + { + NeedsSelfPointer: false, + classname: "SteamApi", + methodname: "SteamInternal_GameServer_Init", + returntype: "bool", + params: + [ + { + paramname: "unIP", + paramtype: "uint32" + }, + { + paramname: "usPort", + paramtype: "uint16" + }, + { + paramname: "usGamePort", + paramtype: "uint16" + }, + { + paramname: "usQueryPort", + paramtype: "uint16" + }, + { + paramname: "eServerMode", + paramtype: "int" + }, + { + paramname: "pchVersionString", + paramtype: "const char *" + } + ], + }, + + + { + NeedsSelfPointer: false, + classname: "SteamApi", + methodname: "SteamAPI_Shutdown", + returntype: "void", + }, + + + { + NeedsSelfPointer: false, + classname: "SteamApi", + methodname: "SteamGameServer_Shutdown", + returntype: "void", + }, + + + { + NeedsSelfPointer: false, + classname: "SteamApi", + methodname: "SteamAPI_GetHSteamUser", + returntype: "HSteamUser", + }, + + + { + NeedsSelfPointer: false, + classname: "SteamApi", + methodname: "SteamAPI_GetHSteamPipe", + returntype: "HSteamPipe", + }, + + + { + NeedsSelfPointer: false, + classname: "SteamApi", + methodname: "SteamGameServer_GetHSteamUser", + returntype: "HSteamUser", + }, + + + { + NeedsSelfPointer: false, + classname: "SteamApi", + methodname: "SteamGameServer_GetHSteamPipe", + returntype: "HSteamPipe", + }, + + + { + NeedsSelfPointer: false, + classname: "SteamApi", + methodname: "SteamInternal_CreateInterface", + returntype: "void *", + params: + [ + { + paramname: "version", + paramtype: "const char *" + } + ], + } + ] +} \ No newline at end of file