diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index 988b58c3..00000000
--- a/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "CodeGen/SteamworksParser"]
- path = CodeGen/SteamworksParser
- url = https://github.com/rlabrecque/SteamworksParser.git
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 00000000..030ae9e7
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,45 @@
+{
+ // 使用 IntelliSense 了解相关属性。
+ // 悬停以查看现有属性的描述。
+ // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+
+ {
+ "name": "Debug generator",
+ "type": "debugpy",
+ "request": "launch",
+ "program": "${workspaceFolder}/CodeGen/Steamworks.NET_CodeGen.py",
+ "cwd": "${workspaceFolder}/CodeGen/",
+ "console": "integratedTerminal",
+ "justMyCode": true
+ },
+ {
+ "name": "Debug comparer",
+ "type": "debugpy",
+ "request": "launch",
+ "program": "${workspaceFolder}/CodeGen/SteamworksParser/compare_with_official.py",
+ "cwd": "${workspaceFolder}/CodeGen/SteamworksParser/",
+ "console": "integratedTerminal",
+ "justMyCode": true
+ },
+ {
+ "name": "Test pack size",
+ "type": "debugpy",
+ "request": "launch",
+ "program": "${workspaceFolder}/CodeGen/SteamworksParser/test_pack_size.py",
+ "cwd": "${workspaceFolder}/CodeGen/SteamworksParser/",
+ "console": "integratedTerminal",
+ "justMyCode": true
+ },
+ {
+ "name": "Debug parser",
+ "type": "debugpy",
+ "request": "launch",
+ "program": "${workspaceFolder}/CodeGen/SteamworksParser/debug_entrypoint.py",
+ "console": "integratedTerminal",
+ "cwd": "${workspaceFolder}/CodeGen/SteamworksParser/",
+ "justMyCode": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/CodeGen/SteamworksParser b/CodeGen/SteamworksParser
deleted file mode 160000
index 6f70e9cb..00000000
--- a/CodeGen/SteamworksParser
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 6f70e9cb638b240f39a77063f6160673014e094b
diff --git a/CodeGen/SteamworksParser/.editorconfig b/CodeGen/SteamworksParser/.editorconfig
new file mode 100644
index 00000000..b3c5df63
--- /dev/null
+++ b/CodeGen/SteamworksParser/.editorconfig
@@ -0,0 +1,5 @@
+root = true
+charset = utf-8
+indent_size = 4
+indent_style = space
+tab_width = 4
\ No newline at end of file
diff --git a/CodeGen/SteamworksParser/.gitignore b/CodeGen/SteamworksParser/.gitignore
new file mode 100644
index 00000000..74cd7124
--- /dev/null
+++ b/CodeGen/SteamworksParser/.gitignore
@@ -0,0 +1,4 @@
+*.pyc
+__pycache__
+steamtest/
+bin
\ No newline at end of file
diff --git a/CodeGen/SteamworksParser/.vscode/launch.json b/CodeGen/SteamworksParser/.vscode/launch.json
new file mode 100644
index 00000000..80560674
--- /dev/null
+++ b/CodeGen/SteamworksParser/.vscode/launch.json
@@ -0,0 +1,14 @@
+{
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": "Debug parser",
+ "type": "debugpy",
+ "request": "launch",
+ "program": "${workspaceFolder}/debug_entrypoint.py",
+ "console": "integratedTerminal",
+ "cwd": "${workspaceFolder}",
+ "justMyCode": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/CodeGen/SteamworksParser/LICENSE.txt b/CodeGen/SteamworksParser/LICENSE.txt
new file mode 100644
index 00000000..338a2e47
--- /dev/null
+++ b/CodeGen/SteamworksParser/LICENSE.txt
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015-2021 Riley Labrecque
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/CodeGen/SteamworksParser/README.md b/CodeGen/SteamworksParser/README.md
new file mode 100644
index 00000000..563cc5ea
--- /dev/null
+++ b/CodeGen/SteamworksParser/README.md
@@ -0,0 +1,40 @@
+# SteamworksParser
+
+This is a simple parser for the [Steamworks](https://partner.steamgames.com/) header files.
+
+SteamworksParser is used to generate the [Steamworks.NET](https://github.com/rlabrecque/Steamworks.NET) bindings via [Steamworks.NET-CodeGen](https://github.com/rlabrecque/Steamworks.NET-CodeGen).
+
+You might be wondering why not just use something like libclang to parse the C++. The primary reason was that I wanted to retain comments and formating information.
+
+## Usage Example
+
+Pull this package into your project folder.
+
+```python
+ import sys
+ from SteamworksParser import steamworksparser
+
+ def main():
+ if len(sys.argv) != 2:
+ print('Usage: test.py ')
+ return
+
+ steamworksparser.Settings.warn_utf8bom = True
+ steamworksparser.Settings.warn_includeguardname = True
+ steamworksparser.Settings.warn_spacing = True
+ parser = steamworksparser.parse(sys.argv[1])
+
+ with open('test.json', 'w') as out:
+ out.write('{\n')
+
+ out.write(' "typedefs":[\n')
+ for typedef in parser.typedefs:
+ out.write(' {\n')
+ out.write(' "typedef":"' + typedef.name + '",\n')
+ out.write(' "type":"' + typedef.type + '"\n')
+ out.write(' },\n')
+
+
+ if __name__ == '__main__':
+ main()
+```
diff --git a/CodeGen/SteamworksParser/__init__.py b/CodeGen/SteamworksParser/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/CodeGen/SteamworksParser/compare_with_official.py b/CodeGen/SteamworksParser/compare_with_official.py
new file mode 100644
index 00000000..6bd4699d
--- /dev/null
+++ b/CodeGen/SteamworksParser/compare_with_official.py
@@ -0,0 +1,88 @@
+from types import SimpleNamespace
+from steamworksparser import Struct, StructField, parse, Settings
+import os
+import json
+import itertools
+# Settings.print_skippedtypedefs = True
+# Settings.print_unuseddefines = True
+# Settings.warn_spacing = True
+# Settings.print_debug = True
+
+parser = parse("./steamtest") # put steam headers inside
+
+os.makedirs("./bin/compare-official", exist_ok=True)
+os.makedirs("./bin/native", exist_ok=True)
+
+
+mismatchCallbackDiagnostics:list[tuple[int, str, str]] = [] # (callbackid, message, code)
+matchCallbackIds: list[int] = []
+redundantCallbackIds: list[int] = []
+
+fieldsMatchedStructs: list[Struct] = []
+
+with open("./steamtest/steam_api.json") as f:
+ official = json.load(f, object_hook=lambda d: SimpleNamespace(**d))
+ flattenedCallbacks = [callback for file in parser.files for callback in file.callbacks]
+ flattenedStructs = [struct for file in parser.files for struct in file.structs]
+
+
+ for cb in flattenedCallbacks:
+ idParts = cb.callbackid.strip().split(' ')
+ idConst = parser.resolveConstValue(idParts[0].strip())
+ identity = None
+ if len(idParts) == 3:
+ identity = int(idConst.value) + int(idParts[2])
+ else:
+ identity = int(idConst.value)
+
+ officialCBs: list = official.callback_structs
+ officialCB = next((o for o in officialCBs if o.callback_id == identity), None)
+ diag = None
+ if officialCB is None:
+ redundantCallbackIds.append(identity)
+ continue
+ if officialCB.struct != cb.name and identity != 1108: # 1108 is shared between CL and GS
+ diag = (identity, f"Name mismatch, ours is `{cb.name}`, official one is `{officialCB.struct}`", 'E1')
+ mismatchCallbackDiagnostics.append(diag)
+ continue
+
+ if len(officialCB.fields) != len(cb.fields):
+ diag = (identity, f"Callback `{cb.name}`'s field count({len(cb.fields)}) is not execpted({len(officialCB.fields)})", 'E4')
+ continue
+
+ for i, fld in enumerate(officialCB.fields):
+ official_field = officialCB.fields[i]
+ our_field = cb.fields[i]
+
+ # compare name
+ if official_field.fieldname != our_field.name:
+ diag = (identity, f"field[{i}]'s name mismatch, `{official_field.fieldname}` expected, got `{our_field.name}`", 'E2')
+ break
+
+ def our_type_to_official_format(ourFld: StructField):
+ if ourFld.arraysize:
+ return f"{ourFld.type} [{ourFld.arraysize}]"
+ else:
+ return ourFld.type
+
+ # compare type
+ typeGot = our_type_to_official_format(our_field)
+ if official_field.fieldtype != typeGot:
+ arrayDiag = our_field.arraysize or "None"
+ diag = (identity, f"Callback {officialCB.struct} field[{i}] ({official_field.fieldname})'s type mismatch, "\
+ f"`{official_field.fieldtype}` excepted, got `{our_field.name}: {typeGot}`", 'E3')
+ break
+
+ if diag is not None:
+ mismatchCallbackDiagnostics.append(diag)
+ continue
+
+with open("./bin/compare-official/result.txt", "w", encoding="utf-8") as compareF:
+ diagLines: list[str] = []
+ for diag in mismatchCallbackDiagnostics:
+ diagString = f"{diag[2]}: {diag[1]}.\n\tCallback id {diag[0]}."
+ diagLines.append(diagString)
+ print(diagString)
+
+ diagLines = [line + '\n' for line in diagLines]
+ compareF.writelines(diagLines)
diff --git a/CodeGen/SteamworksParser/debug_entrypoint.py b/CodeGen/SteamworksParser/debug_entrypoint.py
new file mode 100644
index 00000000..f34e2df9
--- /dev/null
+++ b/CodeGen/SteamworksParser/debug_entrypoint.py
@@ -0,0 +1,49 @@
+from steamworksparser import parse, Settings
+import os
+import json
+import itertools
+# Settings.print_skippedtypedefs = True
+# Settings.print_unuseddefines = True
+# Settings.warn_spacing = True
+Settings.print_debug = True
+
+parser = parse("./steamtest") # put steam headers inside
+
+os.makedirs("bin/compare-official", exist_ok=True)
+os.makedirs("bin/native", exist_ok=True)
+
+with open("bin/native/pack-size-test.cpp", "w", encoding="utf-8") as f:
+ f.write("#include \n")
+ f.write("#include \"steam_api.h\"\n")
+ f.write("#include \"steam_gameserver.h\"\n")
+ f.write("#include \"isteamgamecoordinator.h\"\n")
+ f.write("#include \"steamnetworkingfakeip.h\"\n")
+ f.write("#ifdef _MSC_VER\n")
+ f.write("#include \"fcntl.h\"\n")
+ f.write("#include \"io.h\"\n")
+ f.write("#endif\n")
+
+ f.write("int main() {\n")
+ f.write("#ifdef _MSC_VER\n")
+ f.write("fflush(stdout);\n")
+ f.write("_setmode(_fileno(stdout), _O_BINARY);\n")
+ f.write("#endif\n")
+ structInspectionTemplate = "std::cout << \"{0}\" << '\\t' << sizeof({0}) << '\\t' << alignof({0}) << '\\n';\n"
+ for interface in parser.files:
+ for s in interface.callbacks:
+ f.write(structInspectionTemplate.format(s.name))
+ for s in interface.structs:
+ if not s.should_not_generate():
+ f.write(structInspectionTemplate.format(s.name))
+
+ f.write('}')
+
+ # generated file still need some fix at 25/11/19
+
+with open("bin/pack-aware-structs.txt", "wb") as fp:
+ for structName in parser.packSizeAwareStructs:
+ fp.write(bytes(structName + "\n", "utf-8"))
+
+# if you want to generate a detailed diff file,
+# you can see parser.resolveTypeInfo() and parser.populate_struct_field_layout()
+# latter is used to calculate size by passing different platform default pack size
\ No newline at end of file
diff --git a/CodeGen/SteamworksParser/steamworksparser.py b/CodeGen/SteamworksParser/steamworksparser.py
new file mode 100644
index 00000000..f42a2b7c
--- /dev/null
+++ b/CodeGen/SteamworksParser/steamworksparser.py
@@ -0,0 +1,1662 @@
+import os
+import codecs
+import copy
+import re
+from typing import Literal, Optional
+from functools import reduce
+import operator
+
+g_SkippedFiles = (
+ "steam_api_flat.h", # Valve's C API
+
+ # PS3-only Headers not currently supported
+ "isteamps3overlayrenderer.h",
+ "steamps3params.h",
+
+ # Deprecated, moved to isteaminput.h
+ "isteamcontroller.h",
+
+ # Non-steam code
+ "isteamdualsense.h",
+)
+
+g_SkippedLines = (
+ # steamtypes.h
+ "STEAM_CLANG_ATTR",
+ "#define VALVE_BIG_ENDIAN",
+
+ # Multiple
+ "public:",
+ "private:",
+ "protected:",
+ "_STEAM_CALLBACK_",
+ "#define STEAM_CALLBACK_BEGIN",
+ "#define STEAM_CALLBACK_END",
+ "#define STEAM_CALLBACK_MEMBER",
+ "STEAM_DEFINE_INTERFACE_ACCESSOR",
+)
+
+g_SkippedStructs = (
+ # steamnetworkingtypes.h
+ "SteamNetworkingIPAddr",
+ "SteamNetworkingIdentity",
+ "SteamNetworkingMessage_t",
+ "SteamNetworkingConfigValue_t",
+
+ # steamdatagram_tickets.h
+ "SteamDatagramHostedAddress",
+ "SteamDatagramRelayAuthTicket",
+ "SteamIDComponent_t"
+
+ # steamclientpublic.h nested struct
+ "GameID_t"
+)
+
+g_FuncAttribs = (
+ "STEAM_METHOD_DESC",
+ "STEAM_IGNOREATTR",
+ "STEAM_CALL_RESULT",
+ "STEAM_CALL_BACK",
+ "STEAM_FLAT_NAME",
+)
+
+g_ArgAttribs = (
+ "STEAM_ARRAY_COUNT",
+ "STEAM_ARRAY_COUNT_D",
+ "STEAM_BUFFER_COUNT",
+ "STEAM_DESC",
+ "STEAM_OUT_ARRAY_CALL",
+ "STEAM_OUT_ARRAY_COUNT",
+ "STEAM_OUT_BUFFER_COUNT",
+ "STEAM_OUT_STRING",
+ "STEAM_OUT_STRING_COUNT",
+ "STEAM_OUT_STRUCT",
+)
+
+g_GameServerInterfaces = (
+ 'isteamclient.h',
+ #'isteamgameserver.h',
+ #'isteamgameserverstats.h',
+ 'isteamhttp.h',
+ 'isteaminventory.h',
+ 'isteamnetworking.h',
+ 'isteamnetworkingmessages.h',
+ 'isteamnetworkingsockets.h',
+ 'isteamnetworkingutils.h',
+ 'isteamugc.h',
+ 'isteamutils.h',
+)
+
+class ClassSpecialRBracket:
+ def __init__(self, lineZB: int, action: Literal['EndStruct'] | Literal['ContniueStruct']):
+ self.lineZeroBased = lineZB
+ self.action: Literal['EndStruct'] | Literal['ContniueStruct'] = action
+
+g_ClassSpecialRBracket = {
+ "CSteamID" : ClassSpecialRBracket(850, 'ContniueStruct')
+}
+
+class PrimitiveType:
+ def __init__(self, name: str, size: int, pack: int):
+ self.name = name
+ self.size = size
+ self.pack = pack
+
+g_PrimitiveTypesLayout: dict[str, PrimitiveType] = {
+ "char": PrimitiveType("char", 1, 1),
+ "bool": PrimitiveType("bool", 1, 1),
+ "unsigned char": PrimitiveType("unsigned char", 1, 1),
+ "signed char": PrimitiveType("signed char", 1, 1),
+ "short": PrimitiveType("short", 2, 2),
+ "unsigned short": PrimitiveType("unsigned short", 2, 2),
+ "int": PrimitiveType("int", 4, 4),
+ "unsigned int": PrimitiveType("unsigned int", 4, 4),
+ "long long": PrimitiveType("long long", 8, 8),
+ "unsigned long long": PrimitiveType("unsigned long long", 8, 8),
+ "float": PrimitiveType("float", 4, 4),
+ "double": PrimitiveType("double", 8, 8),
+
+ # Add them here since we don't use the definiation in steamtypes.h
+ "uint8": PrimitiveType("unsigned char", 1, 1),
+ "int8": PrimitiveType("signed char", 1, 1),
+ "int16": PrimitiveType("short", 2, 2),
+ "uint16": PrimitiveType("unsigned short", 2, 2),
+ "int32": PrimitiveType("int", 4, 4),
+ "uint32": PrimitiveType("unsigned int", 4, 4),
+ "int64": PrimitiveType("long long", 8, 8),
+ "uint64": PrimitiveType("unsigned long long", 8, 8),
+
+ "unsigned __int8": PrimitiveType("unsigned char", 1, 1),
+ "__sint8": PrimitiveType("signed char", 1, 1),
+ "__int16": PrimitiveType("short", 2, 2),
+ "unsigned __int16": PrimitiveType("unsigned short", 2, 2),
+ "__int32": PrimitiveType("int", 4, 4),
+ "unsigned __int32": PrimitiveType("unsigned int", 4, 4),
+ "__int64": PrimitiveType("long long", 8, 8),
+ "unsigned __int64": PrimitiveType("unsigned long long", 8, 8),
+
+ "uint8_t": PrimitiveType("unsigned char", 1, 1),
+ "sint8_t": PrimitiveType("signed char", 1, 1),
+ "int16_t": PrimitiveType("short", 2, 2),
+ "uint16_t": PrimitiveType("unsigned short", 2, 2),
+ "int32_t": PrimitiveType("int", 4, 4),
+ "uint32_t": PrimitiveType("unsigned int", 4, 4),
+ "int64_t": PrimitiveType("long long", 8, 8),
+ "uint64_t": PrimitiveType("unsigned long long", 8, 8),
+
+ "intptr": PrimitiveType("intptr", "intptr", "intptr"),
+ "intp": PrimitiveType("intp", "intptr", "intptr"),
+ "uintp": PrimitiveType("uintp", "intptr", "intptr"),
+ "void*": PrimitiveType("void*", "intptr", "intptr"),
+
+ "long int": PrimitiveType("long int", 8, 8),
+ "unsigned long int": PrimitiveType("unsigned long int", 8, 8),
+}
+
+g_SpecialStructs = {
+ "CSteamID": PrimitiveType("unsigned long long", 8, 8),
+ "CGameID": PrimitiveType("unsigned long long", 8, 8),
+ "SteamIPAddress_t": PrimitiveType("SteamIPAddress_t", 16 + 4, 1),
+ "SteamNetworkingIdentity ": PrimitiveType("SteamNetworkingIdentity", 4 + 128, 1),
+ # Contains bit fields that size can't be represented as bytes count
+ "SteamIDComponent_t": PrimitiveType("SteamIDComponent_t", 8, 8)
+}
+
+
+class Settings:
+ warn_utf8bom = False
+ warn_includeguardname = False
+ warn_spacing = False
+ print_unuseddefines = False
+ print_skippedtypedefs = False
+ fake_gameserver_interfaces = False
+ print_debug = False
+
+class BlankLine(object):
+ pass # linenum?
+
+class Comment:
+ def __init__(self, rawcomments, comments, rawlinecomment, linecomment):
+ self.rawprecomments = rawcomments
+ self.precomments = comments
+ self.rawlinecomment = rawlinecomment
+ self.linecomment = linecomment
+
+class ArgAttribute:
+ def __init__(self, name="", value=""):
+ self.name = name
+ self.value = value
+
+class Arg:
+ def __init__(self, name="", type_="", default=None, attribute=None):
+ self.name = name
+ self.type = type_
+ self.default = default
+ self.attribute = attribute # ArgAttribute
+
+class FunctionAttribute:
+ def __init__(self):
+ self.name = ""
+ self.value = ""
+
+class Function:
+ def __init__(self):
+ self.name = ""
+ self.returntype = ""
+ self.args: list[Arg] = [] # Arg
+ self.ifstatements = []
+ self.comments = []
+ self.linecomment = ""
+ self.attributes = [] # FunctionAttribute
+ self.private = False
+
+class Interface:
+ def __init__(self):
+ self.name = ""
+ self.functions: list[Function] = [] # Function
+ self.c = None # Comment
+
+class Define:
+ def __init__(self, name, value, spacing, comments):
+ self.name = name
+ self.value = value
+ self.spacing = spacing
+ self.c = comments
+
+class Constant:
+ def __init__(self, name, value, type_, comments):
+ self.name = name
+ self.value = value
+ self.type = type_
+ self.c = comments # Comment
+
+class EnumField:
+ def __init__(self):
+ self.name = ""
+ self.value = ""
+ self.prespacing = " "
+ self.postspacing = " "
+ self.c = None # Comment
+
+class Enum:
+ def __init__(self, name, comments):
+ self.name = name
+ self.fields = [] # EnumField
+ self.c = comments
+ self.endcomments = None # Comment
+ # enums' size is always 4(an int)
+ self.size = 4
+ self.pack = 4
+
+class Struct:
+ def __init__(self, name, packsize: int | Literal["PlatformABIDefault"] | None, comments, scopePath):
+ self.name = name
+ # keep it to remain compatibility
+ self.packsize = packsize
+ self.c = comments # Comment
+ self.fields: list[StructField] = [] # StructField
+ self.nested_struct: list[Struct] = [] # nested structs
+ self.outer_type: Struct | Union | None = None
+ self.scopeDepth: int = scopePath
+ self.callbackid: str | None = None
+ self.endcomments = None # Comment
+ self.pack = packsize
+ self.size: int | None = None
+ self.packsize_aware = False
+ self.is_skipped: bool = False
+ self.is_sequential = packsize == "PlatformABIDefault"
+
+ def calculate_offsets(self, defaultAlign: int):
+ def calcRealSize(sizelike: int | Literal['intptr']) -> int:
+ if sizelike == 'intptr':
+ return 8
+ else:
+ return sizelike
+
+ if not self.fields:
+ self.size = 1
+ return []
+
+ effective_struct_pack = self.packsize if self.packsize is not None else defaultAlign
+
+ result = []
+ current_offset = 0
+
+ for field in self.fields:
+ pack = field.pack or defaultAlign
+ effective_field_pack = calcRealSize(pack)
+ effective_field_pack = min(effective_field_pack, defaultAlign)
+ padding = 0
+ if effective_field_pack > 0:
+ padding = (effective_field_pack - (current_offset % effective_field_pack)) % effective_field_pack
+ current_offset += padding
+
+ if field.size is None: # For classes with typedef inside
+ return []
+
+ effective_struct_pack = max(effective_struct_pack, effective_field_pack)
+ field_total_size = calcRealSize(field.size) * (field.arraysize or 1)
+
+ # store offset and total size into layout info
+ result.append(FieldOffset(field.name, current_offset))
+
+ current_offset += field_total_size
+
+ total_size = current_offset
+ # if effective_struct_pack > 0:
+ # padding = (effective_struct_pack - (total_size % effective_struct_pack)) % effective_struct_pack
+ # total_size += padding
+
+ self.pack = min(
+ calcRealSize(max(self.fields, key=lambda x: calcRealSize(x.size)).size),
+ effective_struct_pack
+ )
+ self.size = total_size
+ return result
+
+ def should_not_generate(self):
+ return self.name in g_SkippedStructs or self.is_skipped or (self.outer_type is not None) or len(self.nested_struct) > 0
+
+class Union:
+ def __init__(self, name, isUnnamed, pack):
+ self.name: str = name
+ self.isUnnamed: bool = isUnnamed
+ self.pack: int = pack
+ self.size: int | None = None
+ self.fields: list[StructField] = []
+ self.outer_type: Struct | Union | None = None
+ self.endcomments = None # Comment
+ pass
+
+ def calculate_offsets(self, defaultAlign: int):
+ if not self.fields:
+ self.size = 1
+ return self.size
+
+ # find out the largest pack and it's size
+ max_field = max(self.fields, key=lambda f: f.size)
+ max_size = max_field.size
+ max_pack = max_field.pack if max_field.pack != None else defaultAlign
+
+ # align with largest field's packsize
+ if max_pack:
+ remainder = max_size % max_pack
+ if remainder != 0:
+ self.size = max_size + (max_pack - remainder)
+ else:
+ self.size = max_size
+ else:
+ self.size = max_size
+
+ return self.size
+
+'''Also used in Union'''
+class StructField:
+ def __init__(self, name, typee, arraysize: str | None, comments):
+ self.name: str = name
+ self.type = typee
+ self.arraysizeStr = arraysize
+ self.arraysize: int | None = None
+ self.c = comments # Comment
+ self.size: int | Literal['intptr'] = None # Popluated after parsed, before generate
+ self.pack: int | Literal['intptr'] = None # Also populated lazily
+
+class FieldOffset:
+ def __init__(self, name: str, offset: int):
+ self.name = name
+ self.offset = offset
+
+ def __eq__(self, value):
+ return self.name == value.name and self.offset == value.offset
+
+class Typedef:
+ def __init__(self, name, typee, filename, comments, size: int, pack: Optional[int] | None = None):
+ self.name = name
+ self.type = typee
+ self.filename = filename
+ self.c = comments
+ self.size: int | Literal['intptr'] = size
+ self.pack: int | Literal['intptr'] = pack
+
+class SteamFile:
+ def __init__(self, name):
+ self.name = name
+ self.header = []
+ self.includes = []
+ self.defines: list[Define] = [] # Define
+ self.constants: list[Constant] = [] # Constant
+ self.enums: list[Enum] = [] # Enum
+ self.structs: list[Struct] = [] # Struct
+ self.callbacks: list[Struct] = [] # Struct
+ self.interfaces: list[Interface] = [] # Interface
+ self.typedefs:list[Typedef] = [] # Typedef
+ self.unions: list[Union] = []
+
+class ParserState:
+ def __init__(self, file):
+ self.f: SteamFile = file # SteamFile
+ self.lines = []
+ self.line: str = ""
+ self.originalline = ""
+ self.linesplit: list[str] = []
+ """
+ linenum is Zero based
+ """
+ self.linenum = 0
+ self.rawcomments = []
+ self.comments = []
+ self.rawlinecomment = None
+ self.linecomment = None
+ self.ifstatements = []
+ # packsize stack
+ self.packsize = []
+ self.funcState = 0
+ self.scopeDepth = 0
+ self.complexTypeStack: list[Literal['union', 'struct', 'enum']] = []
+
+ self.interface: Interface | None = None
+ self.function: Function | None = None
+ self.enum: Enum | None = None
+ self.struct: Struct | None = None
+ self.union: Union | None = None
+ self.callbackmacro = None
+
+ self.bInHeader = True
+ self.bInMultilineComment = False
+ self.bInMultilineMacro = False
+ self.bInPrivate = False
+ self.isInlineMethodDeclared = False
+ self.callbackid: str | None = None
+ self.isClassLikeStruct: bool | None = None
+ self.functionAttributes: list[FunctionAttribute] = [] # FunctionAttribute
+
+ self.currentSpecialStruct: PrimitiveType = None
+
+ def beginUnion(self):
+ self.complexTypeStack.append('union')
+
+ def beginStruct(self):
+ self.complexTypeStack.append('struct')
+
+ def beginEnum(self):
+ self.complexTypeStack.append('enum')
+
+ def endComplexType(self):
+ self.complexTypeStack.pop()
+
+ def getCurrentPack(self) -> int | Literal['PlatformABIDefault'] | None:
+ # pack size is default value
+ # our parser can't evaluate #ifdefs, so in the situlation of
+ # using default pack, the self.packsize will be [4, 8]
+ if self.packsize == [4, 8]:
+ # default pack
+ return None
+ elif self.packsize == [4]:
+ # we can't eval #ifdefs, so all push will be recorded without
+ # checking if it is really sets pack value
+ # one of [4, 8] is not used by #ifdef, if code pops in this state
+ # it means platform ABI default pack is restored
+ return 'PlatformABIDefault'
+ else:
+ return self.packsize[-1] if len(self.packsize) > 0 else None
+
+ def getCurrentComplexType(self) -> Literal['struct', 'union', 'enum'] | None:
+ return self.complexTypeStack[-1] if len(self.complexTypeStack) > 0 else None
+
+class Parser:
+ files = None
+ typedefs = []
+ ignoredStructs: list[Struct] = []
+
+ def __init__(self, folder):
+ self.files: list[SteamFile] = [SteamFile(f) for f in os.listdir(folder)
+ if os.path.isfile(os.path.join(folder, f))
+ and f.endswith(".h")
+ and f not in g_SkippedFiles]
+ self.files
+ self.files.sort(key=lambda f: f.name)
+
+ self.typedefs:list[Typedef] = [
+ ]
+
+
+ for f in self.files:
+ s = ParserState(f)
+ filepath = os.path.join(folder, f.name)
+ with open(filepath, 'r', encoding="latin-1") as infile:
+ s.lines = infile.readlines()
+
+ if s.lines[0][:3] == codecs.BOM_UTF8:
+ # Reload file with UTF-8 encoding
+ infile.close()
+ infile = open(filepath, 'r', encoding="utf-8")
+ s.lines = infile.readlines()
+ s.lines[0] = s.lines[0][3:]
+
+ if Settings.warn_utf8bom:
+ printWarning("File contains a UTF8 BOM.", s)
+
+ self.parse(s)
+
+
+ self.populate_typedef_layouts()
+ # self.populate_struct_field_sizes()
+
+ # Hack to give us the GameServer interfaces.
+ # We want this for autogen but probably don't want it for anything else.
+ if Settings.fake_gameserver_interfaces:
+ for f in [f for f in self.files if f.name in g_GameServerInterfaces]:
+ gs_f = SteamFile(f.name.replace("isteam", "isteamgameserver", 1))
+ gs_f.interfaces = copy.deepcopy(f.interfaces)
+ for i in gs_f.interfaces:
+ i.name = i.name.replace("ISteam", "ISteamGameServer", 1)
+ self.files.append(gs_f)
+
+ self.findout_platform_aware_structs()
+
+ def parse(self, s: ParserState):
+ for linenum, line in enumerate(s.lines):
+ s.line = line
+ s.originalline = line
+ s.linenum = linenum
+
+ s.line = s.line.rstrip()
+ self.parse_comments(s)
+
+ # Comments get removed from the line, often leaving blank lines, thus we do this after parsing comments
+ if not s.line:
+ continue
+
+ s.linesplit = s.line.split()
+
+ if s.bInHeader:
+ self.parse_header(s)
+
+ if self.parse_skippedlines(s):
+ self.consume_comments(s)
+ continue
+
+ self.parse_preprocessor(s)
+ self.parse_typedefs(s)
+ self.parse_constants(s)
+ self.parse_enums(s)
+ self.visit_union(s)
+ self.parse_structs(s)
+ self.parse_callbackmacros(s)
+ self.parse_interfaces(s)
+ if not s.line:
+ continue
+
+ self.parse_classes(s)
+ self.parse_scope(s)
+
+ def parse_comments(self, s):
+ self.parse_comments_multiline(s)
+ self.parse_comments_singleline(s)
+ s.line = s.line.strip()
+
+ def parse_comments_multiline(self, s):
+ strComment = None
+ multilineOpenerPos = s.line.find("/*")
+ bHasOpening = (multilineOpenerPos != -1)
+ multilineCloserPos = s.line.find("*/")
+ bHasClosing = (multilineCloserPos != -1)
+
+ multipleQuoteblocks = False
+ if s.line.count("/*") > 1 or s.line.count("*/") > 1:
+ multipleQuoteblocks = True
+
+ # TODO - Ugly Code that works well
+ if bHasOpening:
+ if bHasClosing:
+ strComment = s.line[multilineOpenerPos+2:multilineCloserPos]
+ s.line = s.line[:multilineOpenerPos] + s.line[multilineCloserPos+2:]
+ s.bInMultilineComment = False
+ else:
+ strComment = s.line[multilineOpenerPos+2:]
+ s.line = s.line[:multilineOpenerPos]
+ s.bInMultilineComment = True
+ elif s.bInMultilineComment:
+ if bHasClosing:
+ strComment = s.line[:multilineCloserPos]
+ s.line = s.line[multilineCloserPos+2:]
+ s.bInMultilineComment = False
+ else:
+ strComment = s.line
+ s.line = ""
+
+ if strComment is not None:
+ s.comments.append(strComment.rstrip())
+
+ if multipleQuoteblocks:
+ self.parse_comments_multiline(s)
+
+ def parse_comments_singleline(self, s):
+ if s.linecomment is not None:
+ s.comments.append(s.linecomment)
+ s.rawcomments.append(s.rawlinecomment)
+ s.rawlinecomment = None
+ s.linecomment = None
+
+ if not s.line:
+ s.rawcomments.append(BlankLine())
+ return
+
+ commentPos = s.line.find("//")
+
+ if commentPos != -1:
+ s.linecomment = s.line[commentPos+2:]
+ s.line = s.line[:commentPos]
+
+ commentPos = s.originalline.index("//")
+ whitespace = len(s.originalline[:commentPos]) - len(s.originalline[:commentPos].rstrip())
+ startpos = commentPos - whitespace
+ s.rawlinecomment = s.originalline[startpos:].rstrip()
+
+ def parse_header(self, s):
+ if s.line:
+ s.f.header.extend(s.comments)
+ s.comments = []
+ s.bInHeader = False
+
+ def parse_skippedlines(self, s):
+ if "!defined(API_GEN)" in s.ifstatements:
+ if s.line.startswith("#if"):
+ s.ifstatements.append("ugh")
+ elif s.line.startswith("#endif"):
+ s.ifstatements.pop()
+ return True
+
+ if s.line.endswith("\\"):
+ s.bInMultilineMacro = True
+ return True
+
+ if s.bInMultilineMacro:
+ s.bInMultilineMacro = False
+ return True
+
+ for skip in g_SkippedLines:
+ if skip in s.line:
+ return True
+
+ if not s.interface and 'inline' in s.line:
+ return True
+
+ return False
+
+ def parse_preprocessor(self, s: ParserState):
+ if not s.line.startswith("#"):
+ return
+
+ elif s.line.startswith("#else"):
+ previf = s.ifstatements[-1]
+ s.ifstatements.pop()
+ s.ifstatements.append("!(" + previf + ") // #else")
+ elif s.line.startswith("#include"):
+ self.consume_comments(s)
+ includefile = s.linesplit[1]
+ includefile = includefile[1:-1] # Trim the "" or <>
+ s.f.includes.append(includefile)
+ elif s.line.startswith("#ifdef"):
+ token = s.linesplit[1]
+ s.ifstatements.append("defined(" + token + ")")
+ elif s.line.startswith("#ifndef"):
+ token = s.linesplit[1]
+ s.ifstatements.append("!defined(" + token + ")")
+ elif s.line.startswith("#if"):
+ s.ifstatements.append(s.line[3:].strip())
+ elif s.line.startswith("#endif"):
+ s.ifstatements.pop()
+ elif s.line.startswith("#define"):
+ comments = self.consume_comments(s)
+ if Settings.warn_includeguardname:
+ if not s.ifstatements:
+ if s.linesplit[1] != s.f.name.upper().replace(".", "_"):
+ printWarning("Include guard does not match the file name.", s)
+
+ if len(s.linesplit) > 2:
+ spacing = s.line[s.line.index(s.linesplit[1]) + len(s.linesplit[1]):s.line.index(s.linesplit[2])]
+ s.f.defines.append(Define(s.linesplit[1], s.linesplit[2], spacing, comments))
+ elif Settings.print_unuseddefines:
+ print("Unused Define: " + s.line)
+ elif s.line.startswith("#pragma pack"):
+ if "push" in s.line:
+ tmpline = s.line[s.line.index(",")+1:-1].strip()
+
+ packsize = None
+ try:
+ packsize = int(tmpline)
+ except ValueError:
+ pass
+
+ s.packsize.append(packsize)
+ elif "pop" in s.line:
+ s.packsize.pop()
+ elif s.line.startswith("#pragma"):
+ pass
+ elif s.line.startswith("#error"):
+ pass
+ elif s.line.startswith("#warning"):
+ pass
+ elif s.line.startswith("#elif"):
+ pass
+ elif s.line.startswith("#undef"):
+ pass
+ else:
+ printUnhandled("Preprocessor", s)
+
+
+ def parse_typedefs(self, s: ParserState):
+ if s.linesplit[0] != "typedef":
+ return
+
+ comments = self.consume_comments(s)
+
+ # Skips typedefs in the Callback/CallResult classes
+ if s.scopeDepth > 0:
+ if Settings.print_skippedtypedefs:
+ print("Skipped typedef because it's in a class or struct: " + s.line)
+ return
+
+ # Skips typedefs that we don't currently support, So far they are all function pointers.
+ if "(" in s.line or "[" in s.line:
+ if Settings.print_skippedtypedefs:
+ print("Skipped typedef because it contains '(' or '[': " + s.line)
+ return
+
+ # Currently skips typedef struct ValvePackingSentinel_t
+ if not s.line.endswith(";"):
+ if Settings.print_skippedtypedefs:
+ print("Skipped typedef because it does not end with ';': " + s.line)
+ return
+
+ name = s.linesplit[-1].rstrip(";")
+ typee = " ".join(s.linesplit[1:-1])
+ if name.startswith("*"):
+ typee += " *"
+ name = name[1:]
+
+ aliasedType = self.resolveTypeInfo(typee)
+ size = aliasedType.size
+ pack = aliasedType.pack
+
+ typedef = Typedef(name, typee, s.f.name, comments, size, pack)
+
+ self.typedefs.append(typedef)
+ s.f.typedefs.append(typedef)
+
+ def populate_typedef_layouts(self):
+ for typedef in self.typedefs:
+ typee = typedef.type
+
+ if typee in g_PrimitiveTypesLayout.keys():
+ primitive_def = g_PrimitiveTypesLayout[typee]
+ typedef.pack = primitive_def.pack
+ typedef.size = primitive_def.size
+ return
+
+ def resolveFinalType(typee):
+ underlying_type: PrimitiveType | Typedef | None = g_PrimitiveTypesLayout.get(typee)
+
+ if '*' in typee:
+ return g_PrimitiveTypesLayout["intptr"]
+
+ if underlying_type == None:
+ underlying_type = next((typedef for typedef in self.typedefs if typedef.name == typee), None)
+
+ if underlying_type == None:
+ # scan in steam interface files
+ underlying_type = next([typedef for file in self.files for typedef in file["typedefs"]], None)
+
+ if underlying_type.name not in g_PrimitiveTypesLayout.keys():
+ return resolveFinalType(underlying_type)
+ else:
+ return underlying_type
+
+ underlying_type = resolveFinalType(typee)
+
+ if underlying_type == None and '*' not in typee:
+ print(f"[WARNING] typedef \"{typedef.name}\"'s underlying type \"{typee}\" is not in primitive list")
+ # is pointer
+ elif '*' in typee:
+ size = 'intptr'
+ pack = 'intptr'
+ else:
+ size = underlying_type.size
+ pack = underlying_type.pack
+
+ typedef.size = size
+ typedef.pack = pack
+
+ def parse_constants(self, s):
+ if s.linesplit[0] != "const" and not s.line.startswith("static const"):
+ return
+
+ if s.scopeDepth > 1:
+ return
+
+ comments = self.consume_comments(s)
+
+ # Currently skips one unfortunate function definition where the first arg on the new line starts with const. Like so:
+ # void func(void arg1,
+ # const arg2) = 0;
+ if "=" not in s.linesplit:
+ return
+
+ result = re.match(".*const\s+(.*)\s+(\w+)\s+=\s+(.*);$", s.line)
+
+ if not result:
+ return
+
+ constant = Constant(result.group(2), result.group(3), result.group(1), comments);
+ s.f.constants.append(constant)
+
+ def parse_enums(self, s: ParserState):
+ if s.enum:
+ if s.line == "{":
+ return
+
+ if s.line.endswith("};"):
+ # Hack to get comments between the last field and }; :(
+ s.enum.endcomments = self.consume_comments(s)
+ # Don't append unnamed (constant) enums
+ if s.enum.name is not None:
+ s.f.enums.append(s.enum)
+
+ s.endComplexType()
+ s.enum = None
+ return
+
+ self.parse_enumfields(s)
+ return
+
+ if s.linesplit[0] != "enum":
+ return
+
+ comments = self.consume_comments(s)
+
+ # Actually a constant like: enum { k_name = value };
+ if "};" in s.linesplit:
+ # Skips lines like: "enum { k_name1 = value, k_name2 = value };"
+ # Currently only skips one enum in CCallbackBase
+ #
+ # Also steamnetworkingtypes.h has
+ # two different anon enum defined same named field,
+ # broke our project. Skip it.
+ if "," in s.line or s.f.name == 'steamnetworkingtypes.h':
+ return
+
+ # Skips lines in macros
+ # Currently only skips one enum in DEFINE_CALLBACK
+ if s.linesplit[-1] == "\\":
+ return
+
+ if s.struct:
+ # not to push complex type stack here, since it's single line only
+ result = re.match("^enum { (.*) = (.*) };", s.line)
+ name = result.group(1)
+
+ if name == "k_iCallback":
+ s.callbackid = result.group(2)
+ return
+
+ constant = Constant(s.linesplit[2], s.linesplit[4], "int", comments);
+ s.f.constants.append(constant)
+ return
+
+ if len(s.linesplit) == 1 or (len(s.linesplit) >= 2 and '{' == s.linesplit[1]):
+ s.beginEnum()
+ s.enum = Enum(None, comments)
+ # unnamed Constants like:
+ '''enum {
+ k_name1 = value,
+ k_name2 = value,
+ };'''
+ return
+
+ s.beginEnum()
+ s.enum = Enum(s.linesplit[1], comments)
+
+ def parse_enumfields(self, s):
+ result = re.match("^(\w+,?)([ \t]*)=?([ \t]*)(.*)$", s.line)
+ comments = self.consume_comments(s)
+
+ # HACK: This is a hack for multiline fields :(
+ if s.line.endswith("="):
+ value = "="
+ else:
+ value = result.group(4)
+
+ # Nameless Enums are actually just constants
+ if s.enum.name is None:
+ if s.enum.c:
+ comments.precomments = s.enum.c.precomments
+ s.enum.c = None
+ constant = Constant(result.group(1), value.rstrip(","), "int", comments)
+ s.f.constants.append(constant)
+ return
+
+ field = EnumField()
+ field.name = result.group(1)
+
+ if value:
+ field.prespacing = result.group(2)
+ field.postspacing = result.group(3)
+ field.value = value
+
+ field.c = comments
+ s.enum.fields.append(field)
+
+ def parse_structs(self, s: ParserState):
+ if s.enum:
+ return
+
+ if s.struct and s.linesplit[0] != "struct":
+ if s.line == "};":
+ if s.struct.name in g_ClassSpecialRBracket:
+ special = g_ClassSpecialRBracket[s.struct.name]
+ if special.lineZeroBased == s.line\
+ and special.action == 'ContniueStruct':
+ return
+
+
+ s.struct.endcomments = self.consume_comments(s)
+
+ if s.callbackid:
+ s.struct.callbackid = s.callbackid
+ s.f.callbacks.append(s.struct)
+ s.callbackid = None
+ else:
+ s.f.structs.append(s.struct)
+
+ s.isClassLikeStruct = None
+ s.endComplexType()
+
+ currentStruct: Struct = s.struct
+
+ # restore current struct in parser state to outer struct
+ if len(s.complexTypeStack) >= 2 and s.complexTypeStack[-2] == 'struct':
+ currentStruct.outer_type.nested_struct.append(currentStruct)
+
+ if s.struct.name in g_SpecialStructs:
+ s.struct.packsize_aware = False # HACK hope so
+
+ s.struct = currentStruct.outer_type
+ else:
+ self.parse_struct_fields(s)
+ else:
+ if s.linesplit[0] != "struct":
+ return
+
+ if len(s.linesplit) > 1 and s.linesplit[1].startswith("ISteam"):
+ return
+
+ # Skip Forward Declares
+ if s.linesplit[1].endswith(";"):
+ return
+
+ # special structs
+ typeNameCandidate = s.linesplit[1]
+ if (typeNameCandidate in ("CCallResult", "CCallback", "CCallbackBase", "CCallbackImpl", "CCallbackManual")):
+ self.ignoredStructs.append(Struct(typeNameCandidate, 8, None, ""))
+ return
+
+ if typeNameCandidate in g_SpecialStructs.keys():
+ if s.linesplit[0] == 'struct':
+ s.currentSpecialStruct = g_SpecialStructs[typeNameCandidate]
+
+ self.parse_scope(s)
+
+ if s.line.startswith('}'):
+ varNameMatchResult = re.match(r"^}\s*(\w*);$", s.line)
+ if varNameMatchResult != None:
+ s.struct.outer_type.fields.append(StructField(varNameMatchResult.group(1), typeNameCandidate, None, ""))
+ return
+
+ s.beginStruct()
+
+ if s.linesplit[0] == "class":
+ s.isClassLikeStruct = True
+ else:
+ s.isClassLikeStruct = False
+
+ comments = self.consume_comments(s)
+
+ outerTypeCandidate = s.struct
+ s.struct = Struct(s.linesplit[1].strip(), s.getCurrentPack(),\
+ comments, s.scopeDepth)
+ s.struct.outer_type = outerTypeCandidate
+ if s.linesplit[1].strip() in g_SkippedStructs:
+ s.struct.is_skipped = True
+
+ def visit_inline_method(self, s: ParserState):
+ if s.struct:
+ if s.function == None:
+ s.function = Function()
+ if len(s.ifstatements) > 1:
+ s.function.ifstatements = s.ifstatements[-1]
+ s.function.comments = s.comments
+ s.function.linecomment = s.linecomment
+ s.function.private = True
+ s.function.attributes = s.functionAttributes
+ s.functionAttributes = []
+ self.consume_comments(s)
+
+ linesplit_iter = iter(enumerate(s.linesplit))
+ for i, token in linesplit_iter:
+ if s.funcState == 0: # Return Value
+ if token == "virtual" or token == "inline":
+ continue
+
+ if token.startswith("*"):
+ s.function.returntype += "*"
+ token = token[1:]
+ s.funcState = 1
+ elif "(" in token:
+ s.function.returntype = s.function.returntype.strip()
+ s.funcState = 1
+ else:
+ s.function.returntype += token + " "
+ continue
+
+ if s.funcState == 1: # Method Name
+ s.function.name = token.split("(", 1)[0]
+
+ if token[-1] == ")":
+ s.funcState = 3
+ elif token[-1] == ";":
+ s.funcState = 0
+ s.interface.functions.append(s.function)
+ s.function = None
+ break
+ elif token[-1] != "(": # Like f(void arg )
+ if Settings.warn_spacing:
+ printWarning("Function is missing whitespace between the opening parentheses and first arg.", s)
+ token = token.split("(")[1]
+ s.funcState = 2
+ else:
+ s.funcState = 2
+ continue
+
+ if s.funcState == 2: # Args
+ # Strip clang attributes
+ bIsAttrib = False
+ for a in g_ArgAttribs:
+ if token.startswith(a):
+ attr = ArgAttribute()
+ bIsAttrib = True
+ break
+ if bIsAttrib:
+ openparen_index = token.index("(")
+ attr.name = token[:openparen_index]
+ if len(token) > openparen_index+1:
+ if token.endswith(")"):
+ attr.value = token[openparen_index+1:-1]
+ continue
+ else:
+ attr.value = token[openparen_index+1:]
+ s.funcState = 4
+ continue
+
+ if token.startswith("**"):
+ args += token[:2]
+ token = token[2:]
+ elif token.startswith("*") or token.startswith("&"):
+ args += token[0]
+ token = token[1:]
+
+ if len(token) == 0:
+ continue
+
+ if token.startswith(")"): # Like f( void arg ")"
+ if args:
+ TEST = 1
+ TEST2 = 0 # TODO: Cleanup, I don't even know what the fuck is going on here anymore.
+ if "**" in s.linesplit[i-1]:
+ TEST -= 2
+ TEST2 += 2
+ elif "*" in s.linesplit[i-1] or "&" in s.linesplit[i-1]:
+ TEST -= 1
+ TEST2 += 1
+
+ arg = Arg()
+ arg.type = args[:-len(s.linesplit[i-1]) - TEST].strip()
+ arg.name = s.linesplit[i-1][TEST2:]
+ arg.attribute = attr
+ s.function.args.append(arg)
+ args = ""
+ attr = None
+ s.funcState = 3
+ elif token.endswith(")"): # Like f( void "arg)"
+ if Settings.warn_spacing:
+ printWarning("Function is missing whitespace between the closing parentheses and first arg.", s)
+
+ arg = Arg()
+ arg.type = args.strip()
+ arg.name = token[:-1]
+ arg.attribute = attr
+ s.function.args.append(arg)
+ args = ""
+ attr = None
+ s.funcState = 3
+ elif token[-1] == ",": # Like f( void "arg," void arg2 )
+ TEST2 = 0
+ if "*" in token[:-1] or "&" in token[:-1]:
+ TEST2 += 1
+
+ arg = Arg()
+ arg.type = args.strip()
+ arg.name = token[:-1][TEST2:]
+ arg.attribute = attr
+ s.function.args.append(arg)
+ args = ""
+ attr = None
+ elif token == "=":
+ # Copied from ")" above
+ TEST = 1
+ TEST2 = 0 # TODO: Cleanup, I don't even know what the fuck is going on here anymore.
+ if "*" in s.linesplit[i-1] or "&" in s.linesplit[i-1]:
+ TEST -= 1
+ TEST2 += 1
+
+ arg = Arg()
+ arg.type = args[:-len(s.linesplit[i-1]) - TEST].strip()
+ arg.name = s.linesplit[i-1][TEST2:]
+ arg.default = s.linesplit[i+1].rstrip(",")
+ arg.attribute = attr
+ s.function.args.append(arg)
+ args = ""
+ attr = None
+ next(linesplit_iter, None)
+ else:
+ args += token + " "
+
+ continue
+
+ if s.funcState == 3: # = 0; or line
+ if token.endswith(";"):
+ s.funcState = 0
+ s.interface.functions.append(s.function)
+ s.function = None
+ break
+ continue
+
+ if s.funcState == 4: # ATTRIBS
+ if token.endswith(")"):
+ attr.value += token[:-1]
+ s.funcState = 2
+ else:
+ attr.value += token
+ continue
+
+ s.isInlineMethodDeclared = True
+ return
+
+
+ def parse_struct_fields(self, s):
+ comments = self.consume_comments(s)
+
+ if s.line.startswith("enum"):
+ return
+
+ if s.line.startswith('friend '): # in classes
+ return
+
+ if s.line == "{":
+ return
+
+ def try_match(line, s: ParserState):
+ if ':' in line:
+ # Contains bitfield that can't be represented
+ printWarning(f"{s.struct.name} contains bitfield, skipping", s)
+ self.parse_scope(s)
+ return
+
+ typeinfo = s.struct if s.struct else s.union
+
+ fieldarraysizeText = None
+
+ result = re.match(r"^([^=.]*\s\**)(\w+);$", line)
+ if result is None:
+ result = re.match(r"^([^=.]*\s\**)(\w+);$", line)
+ if result is None:
+ result = re.match(r"^(.*\s\*?)(\w+)\[\s*(\w+)?\s*\];$", line)
+ if result is not None:
+ fieldarraysizeText = result.group(3)
+ else:
+ return
+
+ fieldtype = result.group(1).rstrip()
+ fieldname = result.group(2)
+
+ # ignore wrongly parsed result
+ # for example {type 'void' name: '(int a0, int a1)'
+ if '(' in fieldname or '(' in fieldtype\
+ or ')' in fieldname or ')' in fieldtype\
+ or '*' in fieldname\
+ or '{' in fieldtype or '}' in fieldtype\
+ or '{' in fieldname or '}' in fieldname:
+ return
+
+
+ newField = StructField(fieldname, fieldtype, fieldarraysizeText, comments)
+ typeinfo.fields.append(newField)
+
+ if ',' in s.line:
+ result = re.match(r"^(\s*\w+)\s*([\w,\s\[$*\d]*);$", s.line)
+ if not result: return
+
+
+ mainType = result.group(1).strip()
+ varNames = result.group(2).split(',')
+
+ for varName in varNames:
+ try_match(f"{mainType} {varName};", s)
+ else:
+ try_match(s.line, s)
+
+ def visit_union(self, s: ParserState):
+ if s.enum:
+ return
+
+ if s.union and s.linesplit[0] != "union":
+ if s.line == "{":
+ # some unions put open brace at next line
+ return
+
+ if s.line == "};":
+ s.union.endcomments = self.consume_comments(s)
+ s.f.unions.append(s.union)
+ s.endComplexType()
+ s.union = None
+ else:
+ self.parse_struct_fields(s)
+ pass
+ elif s.union == None:
+ if s.linesplit[0] != "union":
+ return
+
+ # Skip Forward Declares
+ if len(s.linesplit) >= 2 and s.linesplit[1].endswith(";"):
+ return
+
+ s.beginUnion()
+ typeName = None
+ # varName = None
+ isUnnamed = True
+
+ if s.linesplit[0] == 'union':
+ if len(s.linesplit) > 2:
+ typeName = s.linesplit[1]
+ isUnnamed = False
+ else:
+ typeName = f"union__{s.f.name[:-2]}_{s.linenum + 1}"
+
+ s.union = Union(typeName, isUnnamed, s.packsize)
+ if s.union.outer_type:
+ # just ignore it's name, generate one for it
+ s.union.outer_type.fields.append(StructField(f"unnamed_field_{typeName}", typeName, 1, ""))
+
+
+ pass
+
+ def parse_callbackmacros(self, s: ParserState):
+ if s.callbackmacro:
+ comments = self.consume_comments(s)
+ if s.line.startswith("STEAM_CALLBACK_END("):
+ s.f.callbacks.append(s.callbackmacro)
+ s.callbackmacro = None
+ elif s.line.startswith("STEAM_CALLBACK_MEMBER_ARRAY"):
+ result = re.match("^STEAM_CALLBACK_MEMBER_ARRAY\(.*,\s+(.*?)\s*,\s*(\w*)\s*,\s*(\d*)\s*\)", s.line)
+
+ fieldtype = result.group(1)
+ fieldname = result.group(2)
+ fieldarraysize = result.group(3)
+
+ s.callbackmacro.fields.append(StructField(fieldname, fieldtype, fieldarraysize, comments))
+ elif s.line.startswith("STEAM_CALLBACK_MEMBER"):
+ result = re.match("^STEAM_CALLBACK_MEMBER\(.*,\s+(.*?)\s*,\s*(\w*)\[?(\d+)?\]?\s*\)", s.line)
+
+ fieldtype = result.group(1)
+ fieldname = result.group(2)
+ fieldarraysize = result.group(3)
+
+ s.callbackmacro.fields.append(StructField(fieldname, fieldtype, fieldarraysize, comments))
+
+ else:
+ printWarning("Unexpected line in Callback Macro")
+
+ return
+
+ if not s.line.startswith("STEAM_CALLBACK_BEGIN"):
+ return
+
+ comments = self.consume_comments(s)
+
+ result = re.match("^STEAM_CALLBACK_BEGIN\(\s?(\w+),\s?(.*?)\s*\)", s.line)
+
+ s.callbackmacro = Struct(result.group(1), s.getCurrentPack(), comments, s.scopeDepth)
+ s.callbackmacro.callbackid = result.group(2)
+
+ def parse_interfaces(self, s):
+ if s.line.startswith("class ISteam"):
+ comments = self.consume_comments(s)
+ if s.linesplit[1].endswith(';') or s.linesplit[1].endswith("Response"): # Ignore Forward Declares and Matchmaking Responses
+ return
+
+ s.interface = Interface()
+ s.interface.name = s.linesplit[1]
+ s.interface.c = comments
+
+ if s.interface:
+ self.parse_interface_functions(s)
+
+ def parse_interface_function_atrributes(self, s):
+ for a in g_FuncAttribs:
+ if s.line.startswith(a):
+ attr = FunctionAttribute()
+ attr.name = s.line[:s.line.index("(")]
+ attr.value = s.line[s.line.index("(")+1:s.line.rindex(")")].strip()
+ s.functionAttributes.append(attr)
+
+ def parse_interface_functions(self, s):
+ self.parse_interface_function_atrributes(s)
+
+ if s.line.startswith("STEAM_PRIVATE_API"):
+ s.bInPrivate = True
+ s.line = s.line[s.line.index("(")+1:].strip()
+ s.linesplit = s.linesplit[1:]
+
+ bInPrivate = s.bInPrivate
+ if s.bInPrivate:
+ if s.line.endswith(")"):
+ s.bInPrivate = False
+ s.line = s.line[:-1].strip()
+ s.linesplit = s.linesplit[:-1]
+
+
+ # Skip lines that don't start with virtual, except when we're currently parsing a function
+ if not s.function and not (s.line.startswith("virtual") or s.line.startswith("inline")):
+ return
+
+ if '~' in s.line: # Skip destructor
+ return
+
+ args = ""
+ attr = None
+ if s.function == None:
+ s.function = Function()
+ if len(s.ifstatements) > 1:
+ s.function.ifstatements = s.ifstatements[-1]
+ s.function.comments = s.comments
+ s.function.linecomment = s.linecomment
+ s.function.private = bInPrivate
+ s.function.attributes = s.functionAttributes
+ s.functionAttributes = []
+ self.consume_comments(s)
+
+ linesplit_iter = iter(enumerate(s.linesplit))
+ for i, token in linesplit_iter:
+ if s.funcState == 0: # Return Value
+ if token == "virtual" or token == "inline":
+ continue
+
+ if token.startswith("*"):
+ s.function.returntype += "*"
+ token = token[1:]
+ s.funcState = 1
+ elif "(" in token:
+ s.function.returntype = s.function.returntype.strip()
+ s.funcState = 1
+ else:
+ s.function.returntype += token + " "
+ continue
+
+ if s.funcState == 1: # Method Name
+ s.function.name = token.split("(", 1)[0]
+
+ if token[-1] == ")":
+ s.funcState = 3
+ elif token[-1] == ";":
+ s.funcState = 0
+ s.interface.functions.append(s.function)
+ s.function = None
+ break
+ elif token[-1] != "(": # Like f(void arg )
+ if Settings.warn_spacing:
+ printWarning("Function is missing whitespace between the opening parentheses and first arg.", s)
+ token = token.split("(")[1]
+ s.funcState = 2
+ else:
+ s.funcState = 2
+ continue
+
+ if s.funcState == 2: # Args
+ # Strip clang attributes
+ bIsAttrib = False
+ for a in g_ArgAttribs:
+ if token.startswith(a):
+ attr = ArgAttribute()
+ bIsAttrib = True
+ break
+ if bIsAttrib:
+ openparen_index = token.index("(")
+ attr.name = token[:openparen_index]
+ if len(token) > openparen_index+1:
+ if token.endswith(")"):
+ attr.value = token[openparen_index+1:-1]
+ continue
+ else:
+ attr.value = token[openparen_index+1:]
+ s.funcState = 4
+ continue
+
+ if token.startswith("**"):
+ args += token[:2]
+ token = token[2:]
+ elif token.startswith("*") or token.startswith("&"):
+ args += token[0]
+ token = token[1:]
+
+ if len(token) == 0:
+ continue
+
+ if token.startswith(")"): # Like f( void arg ")"
+ if args:
+ TEST = 1
+ TEST2 = 0 # TODO: Cleanup, I don't even know what the fuck is going on here anymore.
+ if "**" in s.linesplit[i-1]:
+ TEST -= 2
+ TEST2 += 2
+ elif "*" in s.linesplit[i-1] or "&" in s.linesplit[i-1]:
+ TEST -= 1
+ TEST2 += 1
+
+ arg = Arg()
+ arg.type = args[:-len(s.linesplit[i-1]) - TEST].strip()
+ arg.name = s.linesplit[i-1][TEST2:]
+ arg.attribute = attr
+ s.function.args.append(arg)
+ args = ""
+ attr = None
+ s.funcState = 3
+ elif token.endswith(")"): # Like f( void "arg)"
+ if Settings.warn_spacing:
+ printWarning("Function is missing whitespace between the closing parentheses and first arg.", s)
+
+ arg = Arg()
+ arg.type = args.strip()
+ arg.name = token[:-1]
+ arg.attribute = attr
+ s.function.args.append(arg)
+ args = ""
+ attr = None
+ s.funcState = 3
+ elif token[-1] == ",": # Like f( void "arg," void arg2 )
+ TEST2 = 0
+ if "*" in token[:-1] or "&" in token[:-1]:
+ TEST2 += 1
+
+ arg = Arg()
+ arg.type = args.strip()
+ arg.name = token[:-1][TEST2:]
+ arg.attribute = attr
+ s.function.args.append(arg)
+ args = ""
+ attr = None
+ elif token == "=":
+ # Copied from ")" above
+ TEST = 1
+ TEST2 = 0 # TODO: Cleanup, I don't even know what the fuck is going on here anymore.
+ if "*" in s.linesplit[i-1] or "&" in s.linesplit[i-1]:
+ TEST -= 1
+ TEST2 += 1
+
+ arg = Arg()
+ arg.type = args[:-len(s.linesplit[i-1]) - TEST].strip()
+ arg.name = s.linesplit[i-1][TEST2:]
+ arg.default = s.linesplit[i+1].rstrip(",")
+ arg.attribute = attr
+ s.function.args.append(arg)
+ args = ""
+ attr = None
+ next(linesplit_iter, None)
+ else:
+ args += token + " "
+
+ continue
+
+ if s.funcState == 3: # = 0; or line
+ if token.endswith(";"):
+ s.funcState = 0
+ s.interface.functions.append(s.function)
+ s.function = None
+ break
+ continue
+
+ if s.funcState == 4: # ATTRIBS
+ if token.endswith(")"):
+ attr.value += token[:-1]
+ s.funcState = 2
+ else:
+ attr.value += token
+ continue
+
+ def parse_classes(self, s: ParserState):
+ if s.linesplit[0] != "class":
+ return
+
+ if s.line.startswith("class ISteam"):
+ return
+
+ self.consume_comments(s)
+
+ def parse_scope(self, s):
+ if "{" in s.line:
+ s.scopeDepth += 1
+
+ if s.line.count("{") > 1:
+ printWarning("Multiple occurences of '{'", s)
+
+ if "}" in s.line:
+ s.scopeDepth -= 1
+
+ if s.interface and s.scopeDepth == 0:
+ s.f.interfaces.append(s.interface)
+ s.interface = None
+
+ if s.scopeDepth < 0:
+ printWarning("scopeDepth is less than 0!", s)
+
+ if s.line.count("}") > 1:
+ printWarning("Multiple occurences of '}'", s)
+
+ def consume_comments(self, s):
+ c = Comment(s.rawcomments, s.comments, s.rawlinecomment, s.linecomment)
+ s.rawcomments = []
+ s.comments = []
+ s.rawlinecomment = None
+ s.linecomment = None
+ return c
+
+ # I initially choose camel case by my habit, but keep this name here
+ # for hinting it this is an external available API is also useful
+ def resolveTypeInfo(self, typeName):
+ # search order: primitive, pointer, enum, typedef, struct. no callbacks
+ result = g_PrimitiveTypesLayout.get(typeName)
+
+ if not result and '*' in typeName:
+ return g_PrimitiveTypesLayout["intptr"]
+
+ if not result:
+ result = g_SpecialStructs.get(typeName)
+
+ if not result:
+ result = next((typedef for typedef in self.typedefs if typedef.name == typeName), None)
+
+ if not result:
+ # see enums
+ allEnums = reduce(operator.concat, [f.enums for f in self.files ])
+ result = next((enum for enum in allEnums if enum.name == typeName), None)
+ if not result:
+ # see structs or callback structs
+ allstructs = reduce(operator.concat, [f.structs for f in self.files ])
+ allcallbacks = reduce(operator.concat, [f.callbacks for f in self.files])
+
+ allstructs = allstructs + allcallbacks
+
+ result = next((struct for struct in allstructs if struct.name == typeName), None)
+
+ if not result:
+ print(f"[WARNING] typename {typeName} not found across primitive,\
+ struct and typedef, maybe it is a nested type.")
+
+ return result
+
+ def resolveConstValue(self, name) -> Constant:
+ for f in self.files:
+ result = next((constant for constant in f.constants if constant.name == name), None)
+ if result is not None:
+ return result
+
+ return None
+
+
+ def populate_union_sizes(self, defaultPack = 8):
+ for file in self.files:
+ unions = file.unions
+ for union in unions:
+ union.calculate_offsets(defaultPack)
+
+ def populate_struct_field_layout(self, struct: Struct, defaultPack = 8):
+ for field in struct.fields:
+ typeinfo = self.resolveTypeInfo(field.type)
+
+ if typeinfo is None:
+ # this usually means typedef is used inside a class,
+ # but reminder we treat classes as struct
+ self.ignoredStructs.append(struct)
+ return []
+
+ # check if we facing a struct which may not populated yet
+ if isinstance(typeinfo, Struct):
+ # we assume there will no circular references across structs
+ if not typeinfo.size:
+ self.populate_struct_field_layout(typeinfo, defaultPack)
+ typeinfo.calculate_offsets(defaultPack)
+
+ field.size = typeinfo.size
+ field.pack = typeinfo.pack or struct.pack or defaultPack
+ if (field.arraysizeStr is not None):
+ arrsize = field.arraysizeStr
+ field.arraysize = int(arrsize) if arrsize.isdigit() else eval(self.resolveConstValue(arrsize).value, {}, )
+
+ struct.calculate_offsets(defaultPack)
+
+
+ def findout_platform_aware_structs(self):
+ self.packSizeAwareStructs: list[str] = []
+ self.populate_typedef_layouts()
+
+ for file in self.files:
+ structs: list[Struct] = []
+ structs.extend(file.callbacks)
+ structs.extend(file.structs)
+
+ for struct in structs:
+ if struct.is_sequential:
+ print_debug(f"Struct {struct.name} is aligns by platform ABI default, means sequential")
+ continue
+
+ self.populate_struct_field_layout(struct, 8)
+ offsetsLargePack: list[FieldOffset] = struct.calculate_offsets(8)
+ offsetsLargePack.sort(key = lambda item: item.name)
+ sizeLarge = struct.size
+
+ self.populate_struct_field_layout(struct, 4)
+ offsetsSmallPack: list[FieldOffset] = struct.calculate_offsets(4)
+ offsetsSmallPack.sort(key = lambda item: item.name)
+ sizeSmall = struct.size
+
+ if offsetsLargePack != offsetsSmallPack or sizeLarge != sizeSmall:
+ print_debug(f"Found packsize aware struct '{struct.name}'")
+ struct.packsize_aware = True
+ self.packSizeAwareStructs.append(struct.name)
+
+ pass
+
+def print_debug(string: str):
+ if Settings.print_debug:
+ print(f"[DEBUG][PostParse] {string}")
+
+def printWarning(string, s):
+ print("[WARNING] " + string + " - In File: " + s.f.name + " - On Line " + str(s.linenum) + " - " + s.line)
+
+
+def printUnhandled(string, s):
+ print("[UNHANDLED] " + string + " - In File: " + s.f.name + " - On Line " + str(s.linenum) + " - " + s.line)
+
+
+def parse(folder):
+ """Parses the Steamworks headers contained in a folder"""
+ return Parser(folder)
diff --git a/CodeGen/SteamworksParser/test_pack_size.py b/CodeGen/SteamworksParser/test_pack_size.py
new file mode 100644
index 00000000..4c8955a1
--- /dev/null
+++ b/CodeGen/SteamworksParser/test_pack_size.py
@@ -0,0 +1,71 @@
+from types import SimpleNamespace
+from steamworksparser import Struct, StructField, parse, Settings
+import os
+import json
+import itertools
+# Settings.print_skippedtypedefs = True
+# Settings.print_unuseddefines = True
+# Settings.warn_spacing = True
+# Settings.print_debug = True
+
+filepath1 = "./bin/packsize-aware-list.aggressive.txt"
+filepath2 = "./bin/packsize-aware-list.conservative.txt"
+
+special_structs = []
+special_structs_conservative = []
+
+# read size-different based special struct
+with open(filepath1, 'r') as f:
+ special_structs = [line.strip() for line in f if line.strip()]
+
+# any differences in struct info will be a special struct, which called conservative
+with open(filepath2, 'r') as f:
+ special_structs_conservative = [line.strip() for line in f if line.strip()]
+
+parser = parse("./steamtest") # put steam headers inside
+
+mismatchCallbackDiagnostics:list[tuple[int, str, str, str]] = [] # (callbackid, name, message, code)
+matchStructs: list[str] = []
+mismatchStructs: list[str] = []
+
+
+for structName in parser.packSizeAwareStructs:
+ special = False
+ specialConservative = False
+ typeinfo: Struct = parser.resolveTypeInfo(structName)
+ if structName in special_structs:
+ special = True
+ special_structs.remove(structName)
+ if structName in special_structs_conservative:
+ specialConservative = True
+ special_structs_conservative.remove(structName)
+
+ if not special and not specialConservative:
+ mismatchStructs.append(structName)
+ diagRecord = (typeinfo.callbackid, structName, f"{structName} is absolutely not a special marshalling struct", "W1")
+ mismatchCallbackDiagnostics.append(diagRecord)
+ continue
+
+ if specialConservative and not special:
+ diagRecord = (typeinfo.callbackid, structName, f"{structName} might be a special marshalling struct by align issues", "W2")
+ mismatchCallbackDiagnostics.append(diagRecord)
+
+ if special:
+ matchStructs.append(structName)
+
+for missingCriticialStruct in special_structs:
+ typeinfo: Struct = parser.resolveTypeInfo(missingCriticialStruct)
+ diagRecord = (typeinfo.callbackid, missingCriticialStruct, f"Critical special marshalling struct {missingCriticialStruct} is missing", "E3")
+ mismatchCallbackDiagnostics.append(diagRecord)
+
+for missingOptionalStruct in special_structs:
+ typeinfo: Struct = parser.resolveTypeInfo(missingOptionalStruct)
+ diagRecord = (typeinfo.callbackid, missingOptionalStruct, f"{structName} might be a special marshalling struct by align issues", "W2")
+ mismatchCallbackDiagnostics.append(diagRecord)
+
+with open("./bin/struct_test_result.txt", "w") as f:
+ for diag in mismatchCallbackDiagnostics:
+ fallbackStr = "None"
+ formatted = f"{diag[3]}: {diag[2]}\n\tname: {diag[1]}, cbid(optional): {diag[0] or fallbackStr}\n"
+ print(formatted)
+ f.write(formatted)
diff --git a/CodeGen/src/interfaces.py b/CodeGen/src/interfaces.py
index a007b5d2..d4365962 100644
--- a/CodeGen/src/interfaces.py
+++ b/CodeGen/src/interfaces.py
@@ -1,7 +1,9 @@
import os
+import re
import sys
from collections import OrderedDict
from SteamworksParser import steamworksparser
+from SteamworksParser.steamworksparser import Arg, Function, FunctionAttribute, Interface, Parser, Struct, ArgAttribute
g_SkippedFiles = (
# We don't currently support the following interfaces because they don't provide a factory of their own.
@@ -532,38 +534,38 @@
g_FixedAttributeValues = {
"ISteamInventory_GetItemsWithPrices": {
- "pArrayItemDefs": steamworksparser.ArgAttribute("STEAM_OUT_ARRAY_COUNT", "unArrayLength"),
- "pCurrentPrices": steamworksparser.ArgAttribute("STEAM_OUT_ARRAY_COUNT", "unArrayLength"),
- "pBasePrices": steamworksparser.ArgAttribute("STEAM_OUT_ARRAY_COUNT", "unArrayLength"),
+ "pArrayItemDefs": ArgAttribute("STEAM_OUT_ARRAY_COUNT", "unArrayLength"),
+ "pCurrentPrices": ArgAttribute("STEAM_OUT_ARRAY_COUNT", "unArrayLength"),
+ "pBasePrices": ArgAttribute("STEAM_OUT_ARRAY_COUNT", "unArrayLength"),
},
"ISteamGameServerInventory_GetItemsWithPrices": {
- "pArrayItemDefs": steamworksparser.ArgAttribute("STEAM_OUT_ARRAY_COUNT", "unArrayLength"),
- "pCurrentPrices": steamworksparser.ArgAttribute("STEAM_OUT_ARRAY_COUNT", "unArrayLength"),
- "pBasePrices": steamworksparser.ArgAttribute("STEAM_OUT_ARRAY_COUNT", "unArrayLength"),
+ "pArrayItemDefs": ArgAttribute("STEAM_OUT_ARRAY_COUNT", "unArrayLength"),
+ "pCurrentPrices": ArgAttribute("STEAM_OUT_ARRAY_COUNT", "unArrayLength"),
+ "pBasePrices": ArgAttribute("STEAM_OUT_ARRAY_COUNT", "unArrayLength"),
},
"ISteamUGC_GetQueryUGCContentDescriptors": {
- "pvecDescriptors": steamworksparser.ArgAttribute("STEAM_OUT_ARRAY_COUNT", "cMaxEntries"),
+ "pvecDescriptors": ArgAttribute("STEAM_OUT_ARRAY_COUNT", "cMaxEntries"),
},
"ISteamGameServerUGC_GetQueryUGCContentDescriptors": {
- "pvecDescriptors": steamworksparser.ArgAttribute("STEAM_OUT_ARRAY_COUNT", "cMaxEntries"),
+ "pvecDescriptors": ArgAttribute("STEAM_OUT_ARRAY_COUNT", "cMaxEntries"),
},
"ISteamNetworkingMessages_ReceiveMessagesOnChannel": {
- "ppOutMessages": steamworksparser.ArgAttribute("STEAM_OUT_ARRAY_COUNT", "nMaxMessages"),
+ "ppOutMessages": ArgAttribute("STEAM_OUT_ARRAY_COUNT", "nMaxMessages"),
},
"ISteamGameServerNetworkingMessages_ReceiveMessagesOnChannel": {
- "ppOutMessages": steamworksparser.ArgAttribute("STEAM_OUT_ARRAY_COUNT", "nMaxMessages"),
+ "ppOutMessages": ArgAttribute("STEAM_OUT_ARRAY_COUNT", "nMaxMessages"),
},
"ISteamNetworkingSockets_ReceiveMessagesOnConnection": {
- "ppOutMessages": steamworksparser.ArgAttribute("STEAM_OUT_ARRAY_COUNT", "nMaxMessages"),
+ "ppOutMessages": ArgAttribute("STEAM_OUT_ARRAY_COUNT", "nMaxMessages"),
},
"ISteamGameServerNetworkingSockets_ReceiveMessagesOnConnection": {
- "ppOutMessages": steamworksparser.ArgAttribute("STEAM_OUT_ARRAY_COUNT", "nMaxMessages"),
+ "ppOutMessages": ArgAttribute("STEAM_OUT_ARRAY_COUNT", "nMaxMessages"),
},
"ISteamNetworkingSockets_ReceiveMessagesOnPollGroup": {
- "ppOutMessages": steamworksparser.ArgAttribute("STEAM_OUT_ARRAY_COUNT", "nMaxMessages"),
+ "ppOutMessages": ArgAttribute("STEAM_OUT_ARRAY_COUNT", "nMaxMessages"),
},
"ISteamGameServerNetworkingSockets_ReceiveMessagesOnPollGroup": {
- "ppOutMessages": steamworksparser.ArgAttribute("STEAM_OUT_ARRAY_COUNT", "nMaxMessages"),
+ "ppOutMessages": ArgAttribute("STEAM_OUT_ARRAY_COUNT", "nMaxMessages"),
},
}
@@ -597,7 +599,7 @@
g_Output = []
g_Typedefs = None
-def main(parser):
+def main(parser: Parser):
try:
os.makedirs("../com.rlabrecque.steamworks.net/Runtime/autogen/")
except OSError:
@@ -610,7 +612,7 @@ def main(parser):
global g_Typedefs
g_Typedefs = parser.typedefs
for f in parser.files:
- parse(f)
+ parse(f, parser)
with open("../com.rlabrecque.steamworks.net/Runtime/autogen/NativeMethods.cs", "wb") as out:
#out.write(bytes(HEADER, "utf-8"))
@@ -625,7 +627,7 @@ def main(parser):
def get_arg_attribute(strEntryPoint, arg):
return g_FixedAttributeValues.get(strEntryPoint, dict()).get(arg.name, arg.attribute)
-def parse(f):
+def parse(f, parser: Parser):
if f.name in g_SkippedFiles:
return
@@ -633,7 +635,7 @@ def parse(f):
del g_Output[:]
for interface in f.interfaces:
- parse_interface(f, interface)
+ parse_interface(f, interface, parser)
if g_Output:
with open('../com.rlabrecque.steamworks.net/Runtime/autogen/' + os.path.splitext(f.name)[0] + '.cs', 'wb') as out:
@@ -645,7 +647,7 @@ def parse(f):
out.write(bytes("#endif // !DISABLESTEAMWORKS\n", "utf-8"))
-def parse_interface(f, interface):
+def parse_interface(f, interface: Interface, parser: Parser):
if interface.name in g_SkippedInterfaces:
return
@@ -686,7 +688,18 @@ def parse_interface(f, interface):
if func.private:
continue
- parse_func(f, interface, func)
+ shouldGenerateLargePack = False
+ strEntryPoint = interface.name + '_' + func.name
+ for attr in func.attributes:
+ if attr.name == "STEAM_FLAT_NAME":
+ strEntryPoint = interface.name + '_' + attr.value
+ break
+
+ parsed_args = parse_args(strEntryPoint, func.args, None, parser)
+ parse_func_native(f, interface, func, strEntryPoint, parsed_args, False, bGameServerVersion, parser)
+
+ generate_wrapper_function(f, interface, func, parsed_args, strEntryPoint, bGameServerVersion, parser)
+
# Remove last whitespace
if not bGameServerVersion:
@@ -705,19 +718,7 @@ def parse_interface(f, interface):
g_Output.append("\t}")
-def parse_func(f, interface, func):
- strEntryPoint = interface.name + '_' + func.name
-
- for attr in func.attributes:
- if attr.name == "STEAM_FLAT_NAME":
- strEntryPoint = interface.name + '_' + attr.value
- break
-
- if "GameServer" in interface.name and interface.name != "ISteamGameServer" and interface.name != "ISteamGameServerStats":
- bGameServerVersion = True
- else:
- bGameServerVersion = False
-
+def parse_func_native(f, interface, func: Function, strEntryPoint: str, args, generatingLargePack: bool, bGameServerVersion: bool, parser: Parser):
wrapperreturntype = None
strCast = ""
returntype = func.returntype
@@ -735,15 +736,9 @@ def parse_func(f, interface, func):
if wrapperreturntype == None:
wrapperreturntype = returntype
- args = parse_args(strEntryPoint, func.args)
pinvokeargs = args[0] # TODO: NamedTuple
- wrapperargs = args[1]
- argnames = args[2]
- stringargs = args[3]
- outstringargs = args[4][0]
- outstringsize = args[4][1]
- args_with_explicit_count = args[5]
-
+ isPacksizeAware = args[6]
+ largePackPInvokeArgs = args[9]
if not bGameServerVersion:
g_NativeMethods.append("\t\t[DllImport(NativeLibraryName, EntryPoint = \"SteamAPI_{0}\", CallingConvention = CallingConvention.Cdecl)]".format(strEntryPoint))
@@ -753,6 +748,48 @@ def parse_func(f, interface, func):
g_NativeMethods.append("\t\tpublic static extern {0} {1}({2});".format(returntype, strEntryPoint, pinvokeargs))
g_NativeMethods.append("")
+ if isPacksizeAware:
+ g_NativeMethods.append("\t#if STEAMWORKS_ANYCPU")
+ g_NativeMethods.append("\t\t[DllImport(NativeLibraryName, EntryPoint = \"SteamAPI_{0}\", CallingConvention = CallingConvention.Cdecl)]".format(strEntryPoint))
+
+ if returntype == "bool":
+ g_NativeMethods.append("\t\t[return: MarshalAs(UnmanagedType.I1)]")
+
+ g_NativeMethods.append("\t\tpublic static extern {0} {1}({2});".format(returntype, strEntryPoint, largePackPInvokeArgs))
+ g_NativeMethods.append("\t#endif")
+ g_NativeMethods.append("")
+ pass
+
+def generate_wrapper_function(f, interface, func: Function,
+ args: tuple[str, str, str, list[str], tuple[list[str], list[Arg]], OrderedDict, str, bool, str],
+ strEntryPoint: str, bGameServerVersion: bool, _):
+ wrapperargs = args[1]
+ argnames = args[2]
+ stringargs = args[3]
+ outstringargs = args[4][0]
+ outstringsize = args[4][1]
+ args_with_explicit_count = args[5]
+ isPacksizeAware = args[6]
+ largePackNativeArgs: str = args[7]
+ largePackByrefArgs: list[(str, str, bool)] = args[8] # (typeName, argName, shouldAssignInput)
+
+ strCast = ""
+ wrapperreturntype = None
+ returntype = func.returntype
+ returntype = g_SpecialReturnTypeDict.get(strEntryPoint, returntype)
+ for t in g_Typedefs:
+ if t.name == returntype:
+ if t.name not in g_SkippedTypedefs:
+ wrapperreturntype = returntype
+ strCast = "(" + returntype + ")"
+ returntype = t.type
+ break
+ returntype = g_TypeDict.get(returntype, returntype)
+ returntype = g_TypeDict.get(func.returntype, returntype)
+ returntype = g_ReturnTypeDict.get(func.returntype, returntype)
+ if wrapperreturntype == None:
+ wrapperreturntype = returntype
+
functionBody = []
if 'GameServer' in interface.name:
@@ -786,36 +823,89 @@ def parse_func(f, interface, func):
if returntype != "void":
strReturnable = returntype + " ret = "
- for i, a in enumerate(outstringargs):
+ for i, argName in enumerate(outstringargs):
if not outstringsize:
- functionBody.append("\t\t\tIntPtr " + a + "2;")
+ functionBody.append("\t\t\tIntPtr " + argName + "2;")
continue
cast = ""
if outstringsize[i].type != "int":
cast = "(int)"
- functionBody.append("\t\t\tIntPtr " + a + "2 = Marshal.AllocHGlobal(" + cast + outstringsize[i].name + ");")
+ functionBody.append("\t\t\tIntPtr " + argName + "2 = Marshal.AllocHGlobal(" + cast + outstringsize[i].name + ");")
+ # TODO fix `ISteamGameServerClient_CreateSteamPipe`
indentlevel = "\t\t\t"
if stringargs:
indentlevel += "\t"
- for a in stringargs:
- functionBody.append("\t\t\tusing (var " + a + "2 = new InteropHelp.UTF8StringHandle(" + a + "))")
+ for argName in stringargs:
+ functionBody.append("\t\t\tusing (var " + argName + "2 = new InteropHelp.UTF8StringHandle(" + argName + "))")
functionBody[-1] += " {"
if bGameServerVersion:
- strEntryPoint2 = interface.name.replace("GameServer", "") + '_' + func.name
+ invokingNativeFunctionName = interface.name.replace("GameServer", "") + '_' + func.name
for attr in func.attributes:
if attr.name == "STEAM_FLAT_NAME":
- strEntryPoint2 = interface.name.replace("GameServer", "") + '_' + attr.value
+ invokingNativeFunctionName = interface.name.replace("GameServer", "") + '_' + attr.value
break
else:
- strEntryPoint2 = strEntryPoint
+ invokingNativeFunctionName = strEntryPoint
+
+ if not isPacksizeAware:
+ functionBody.append("{0}{1}{2}NativeMethods.{3}({4});".format(
+ indentlevel, strReturnable, strCast,
+ invokingNativeFunctionName, argnames))
+ else:
+ b:list[str] = []
+
+ b.append("#if STEAMWORKS_ANYCPU")
+ if returntype != "void":
+ b.append(f"{wrapperreturntype} ret;")
+
+ invocationTemplate = "{0}{1}{2}NativeMethods.{3}({4});"
+ prebuiltInvocationExpression = invocationTemplate.format(
+ "", "" if returntype == "void" else "ret = ", strCast,
+ invokingNativeFunctionName, argnames)
+
+ prebuiltInvocationExpressionLargePack = invocationTemplate.format(
+ "", "" if returntype == "void" else "ret = ", strCast,
+ invokingNativeFunctionName, largePackNativeArgs
+ )
+
+ # b.append(f"{returntype} anyCpuResult;")
+ b.append("if (!Packsize.IsLargePack) {")
+ b.append("\t" + prebuiltInvocationExpression)
+ b.append("} else {")
+
+ # generate large-pack byref intermediate struct variables
+ for lpArg in largePackByrefArgs:
+ if not lpArg[0].endswith("[]"):
+ assignByRefManaged = "" if not lpArg[2] else f" = {lpArg[1]}"
+ b.append(f"\t{lpArg[0]} {lpArg[1]}_lp{assignByRefManaged};")
+ else:
+ b.append(f"\t{lpArg[0][:-2]}_LargePack[] {lpArg[1]}_lp = new {lpArg[0][:-2]}_LargePack[{lpArg[1]}.Length];")
+ b.append(f"\tfor (int i = 0; i < {lpArg[1]}.Length; i++)")
+ b.append(f"\t\t{lpArg[1]}_lp[i] = {lpArg[1]}[i];")
+
+ b.append("\t" + prebuiltInvocationExpressionLargePack)
+ # convert large pack form to managed form
+ for lpArg in largePackByrefArgs:
+ if not lpArg[0].endswith('[]'):
+ b.append(f"\t{lpArg[1]} = {lpArg[1]}_lp;")
+ else:
+ b.append(f"\tfor (int i = 0; i < {lpArg[1]}.Length; i++)")
+ b.append(f"\t\t{lpArg[1]}[i] = {lpArg[1]}_lp[i];")
+ b.append("}")
- functionBody.append("{0}{1}{2}NativeMethods.{3}({4});".format(indentlevel, strReturnable, strCast, strEntryPoint2, argnames))
+ b.append("#else")
+ b.append("{0}{1}{2}NativeMethods.{3}({4});".format(
+ "", strReturnable, strCast,
+ invokingNativeFunctionName, argnames))
+ b.append("#endif")
+
+ functionBody.extend(map(lambda l: "\t\t\t" + l, b))
if outstringargs:
retcmp = "ret != 0"
@@ -824,21 +914,31 @@ def parse_func(f, interface, func):
elif returntype == "int":
retcmp = "ret != -1"
retcmp = g_SpecialOutStringRetCmp.get(strEntryPoint, retcmp)
- for a in outstringargs:
+ for argName in outstringargs:
if returntype == "void":
- functionBody.append(indentlevel + a + " = InteropHelp.PtrToStringUTF8(" + a + "2);")
+ functionBody.append(indentlevel + argName + " = InteropHelp.PtrToStringUTF8(" + argName + "2);")
else:
- functionBody.append(indentlevel + a + " = " + retcmp + " ? InteropHelp.PtrToStringUTF8(" + a + "2) : null;")
+ functionBody.append(indentlevel + argName + " = " + retcmp + " ? InteropHelp.PtrToStringUTF8(" + argName + "2) : null;")
if strEntryPoint != "ISteamRemoteStorage_GetUGCDetails":
- functionBody.append(indentlevel + "Marshal.FreeHGlobal(" + a + "2);")
+ functionBody.append(indentlevel + "Marshal.FreeHGlobal(" + argName + "2);")
+
+ if (returntype != "void" and (isPacksizeAware)):
+ if not outstringargs:
+ functionBody.append(indentlevel + "#if STEAMWORKS_ANYCPU")
+ functionBody.append(indentlevel + "return ret;")
+ if not outstringargs:
+ functionBody.append(indentlevel + "#endif")
+ elif returntype != 'void' and outstringargs:
+ functionBody.append(indentlevel + "return ret;")
+ elif returntype != "void" and not isPacksizeAware:
+ pass
- if returntype != "void":
- functionBody.append(indentlevel + "return ret;")
if stringargs:
functionBody.append("\t\t\t}")
+
comments = func.comments
if func.linecomment:
comments.append(func.linecomment)
@@ -857,37 +957,65 @@ def parse_func(f, interface, func):
g_Output.append("\t\t}")
g_Output.append("")
-def parse_args(strEntryPoint, args):
+def parse_args(strEntryPoint: str, args: list[Arg], _: bool, parser: Parser):
+ # Akarinnnnn: I think we should extract a result class
pinvokeargs = "IntPtr instancePtr, "
+ pinvokeargsLargePack = pinvokeargs
wrapperargs = ""
- argnames = ""
+ nativeFunctionArgs = ""
+ nativeFunctionArgsLargePack = ""
stringargs = []
outstringargs = []
outstringsize = []
+ isMethodPacksizeAware = False
args_with_explicit_count = OrderedDict()
+ largePackArgMarshalInfo: list[(str, str, bool)] = []
ifacename = strEntryPoint[1:strEntryPoint.index('_')]
+
+ #region init native function params string
if "GameServer" in ifacename:
if ifacename != "SteamGameServer" and ifacename != "SteamGameServerStats":
ifacename = ifacename.replace("GameServer", "")
- argnames = "CSteamGameServerAPIContext.Get" + ifacename + "(), "
+ nativeFunctionArgs = "CSteamGameServerAPIContext.Get" + ifacename + "(), "
+ nativeFunctionArgsLargePack = "CSteamGameServerAPIContext.Get" + ifacename + "(), "
else:
- argnames = "CSteamAPIContext.Get" + ifacename + "(), "
+ nativeFunctionArgs = "CSteamAPIContext.Get" + ifacename + "(), "
+ nativeFunctionArgsLargePack = "CSteamAPIContext.Get" + ifacename + "(), "
getNextArgAsStringSize = False
argNamesToAddAsStringSize = []
for arg in args:
+
+ #region populate PInvoke params list and wrapper args (both LP and SP)
potentialtype = arg.type.rstrip("*").lstrip("const ").rstrip()
- argtype = g_TypeDict.get(arg.type, arg.type)
- if argtype.endswith("*"):
- argtype = "out " + g_TypeDict.get(potentialtype, potentialtype)
- argtype = g_SpecialArgsDict.get(strEntryPoint, dict()).get(arg.name, argtype)
+ isThisArgPackAware = potentialtype in parser.packSizeAwareStructs
+
+ isMethodPacksizeAware = True if isThisArgPackAware else isMethodPacksizeAware
+
+ pInvokeArgType = g_TypeDict.get(arg.type, arg.type)
+
+ isParamArray = False
+ largePackArgMarshalRecord = None
+ if pInvokeArgType.endswith("*"):
+ wrapperParamType = g_TypeDict.get(potentialtype, potentialtype)
+ pInvokeArgType = "out " + wrapperParamType
+
+ if isThisArgPackAware:
+ # add this arg to marshal list
+ largePackArgMarshalRecord = (potentialtype, arg.name, True)
+
+
+ pInvokeArgType = g_SpecialArgsDict.get(strEntryPoint, dict()).get(arg.name, pInvokeArgType)
argattribute = get_arg_attribute(strEntryPoint, arg)
if argattribute:
- if argattribute.name == "STEAM_OUT_ARRAY" or argattribute.name == "STEAM_OUT_ARRAY_CALL" or argattribute.name == "STEAM_OUT_ARRAY_COUNT" or argattribute.name == "STEAM_ARRAY_COUNT" or argattribute.name == "STEAM_ARRAY_COUNT_D":
- argtype = g_TypeDict.get(potentialtype, potentialtype) + "[]"
+ if argattribute.name in ("STEAM_OUT_ARRAY", "STEAM_OUT_ARRAY_CALL", "STEAM_OUT_ARRAY_COUNT", "STEAM_ARRAY_COUNT","STEAM_ARRAY_COUNT_D"):
+ isParamArray = True
+ pInvokeArgType = g_TypeDict.get(potentialtype, potentialtype) + "[]"
+ if isMethodPacksizeAware:
+ pInvokeLargePackType = g_TypeDict.get(potentialtype, potentialtype) + "_LargePack[]"
if argattribute.name == "STEAM_OUT_ARRAY_COUNT":
commaindex = argattribute.value.find(',')
@@ -896,22 +1024,37 @@ def parse_args(strEntryPoint, args):
else:
args_with_explicit_count[arg.name] = argattribute.value
+ if isParamArray and isThisArgPackAware :
+ (t, n, byref) = largePackArgMarshalRecord
+ largePackArgMarshalRecord = (t + "[]", n, byref)
if arg.type == "MatchMakingKeyValuePair_t **": # TODO: Fixme - Small Hack... We do this because MatchMakingKeyValuePair's have ARRAY_COUNT() and two **'s, things get broken :(
- argtype = "IntPtr"
+ pInvokeArgType = "IntPtr"
# We skip byte[] because it is a primitive type that C# can essentially mmap and get a great perf increase while marshalling.
# We need to do this for other primitive types eventually but that will require more testing to make sure nothing breaks.
- if argtype.endswith("[]") and argtype != "byte[]":
- argtype = "[In, Out] " + argtype
- elif argtype == "bool":
- argtype = "[MarshalAs(UnmanagedType.I1)] " + argtype
+ if pInvokeArgType.endswith("[]") and pInvokeArgType != "byte[]":
+ pInvokeArgType = "[In, Out] " + pInvokeArgType
+ elif pInvokeArgType == "bool":
+ pInvokeArgType = "[MarshalAs(UnmanagedType.I1)] " + pInvokeArgType
+
+ pinvokeargs += pInvokeArgType + " " + arg.name + ", "
+ if isThisArgPackAware:
+ if pInvokeArgType.endswith('[]'):
+ pinvokeargsLargePack += f"{pInvokeArgType[:-2]}_LargePack[] {arg.name}_lp, "
+ if isThisArgPackAware:
+ (t, n, b) = largePackArgMarshalRecord
+ largePackArgMarshalRecord = (f"{t}[]", n, b)
+ else:
+ pinvokeargsLargePack += f"{pInvokeArgType}_LargePack {arg.name}_lp, "
- pinvokeargs += argtype + " " + arg.name + ", "
+ else:
+ pinvokeargsLargePack += pInvokeArgType + " " + arg.name + ", "
- argtype = argtype.replace("[In, Out] ", "").replace("[MarshalAs(UnmanagedType.I1)] ", "")
- wrapperargtype = g_WrapperArgsTypeDict.get(arg.type, argtype)
+ pInvokeArgType = pInvokeArgType.replace("[In, Out] ", "").replace("[MarshalAs(UnmanagedType.I1)] ", "")
+ wrapperargtype = g_WrapperArgsTypeDict.get(arg.type, pInvokeArgType)
wrapperargtype = g_SpecialWrapperArgsDict.get(strEntryPoint, dict()).get(arg.name, wrapperargtype)
+
if wrapperargtype == "InteropHelp.UTF8StringHandle":
wrapperargtype = "string"
elif arg.type == "char *" or arg.type == "char*":
@@ -922,28 +1065,45 @@ def parse_args(strEntryPoint, args):
if arg.default:
wrapperargs += " = " + g_ArgDefaultLookup.get(arg.default, arg.default)
wrapperargs += ", "
-
- if argtype.startswith("out"):
- argnames += "out "
+
+
+ if pInvokeArgType.startswith("out"):
+ nativeFunctionArgs += "out "
+ nativeFunctionArgsLargePack += "out "
+ if isThisArgPackAware:
+ (t, n, _) = largePackArgMarshalRecord
+ largePackArgMarshalRecord = (t, n, False)
elif wrapperargtype.startswith("ref"):
- argnames += "ref "
+ nativeFunctionArgs += "ref "
+ nativeFunctionArgsLargePack += "ref "
+ if isThisArgPackAware:
+ # make original value passing in
+ (t, n, _) = (largePackArgMarshalRecord)
+ largePackArgMarshalRecord = (t, n, True)
if wrapperargtype == "System.Collections.Generic.IList":
- argnames += "new InteropHelp.SteamParamStringArray(" + arg.name + ")"
+ nativeFunctionArgs += "new InteropHelp.SteamParamStringArray(" + arg.name + ")"
+ nativeFunctionArgsLargePack += "new InteropHelp.SteamParamStringArray(" + arg.name + ")"
elif wrapperargtype == "MatchMakingKeyValuePair_t[]":
- argnames += "new MMKVPMarshaller(" + arg.name + ")"
+ nativeFunctionArgs += "new MMKVPMarshaller(" + arg.name + ")"
+ nativeFunctionArgsLargePack += "new MMKVPMarshaller(" + arg.name + ")"
elif wrapperargtype.endswith("Response"):
- argnames += "(IntPtr)" + arg.name
+ nativeFunctionArgs += "(IntPtr)" + arg.name
+ nativeFunctionArgsLargePack += "(IntPtr)" + arg.name
elif arg.name.endswith("Deprecated"):
- if argtype == "IntPtr":
- argnames += "IntPtr.Zero"
- elif argtype == "bool":
- argnames += "false"
+ if pInvokeArgType == "IntPtr":
+ nativeFunctionArgs += "IntPtr.Zero"
+ nativeFunctionArgsLargePack += "IntPtr.Zero"
+ elif pInvokeArgType == "bool":
+ nativeFunctionArgs += "false"
+ nativeFunctionArgsLargePack += "false"
else:
- argnames += "0"
+ nativeFunctionArgs += "0"
+ nativeFunctionArgsLargePack += "0"
else:
- argnames += arg.name
-
+ nativeFunctionArgs += arg.name
+ nativeFunctionArgsLargePack += arg.name
+
if getNextArgAsStringSize:
getNextArgAsStringSize = False
outstringsize.append(arg)
@@ -954,10 +1114,12 @@ def parse_args(strEntryPoint, args):
if wrapperargtype == "string":
stringargs.append(arg.name)
- argnames += "2"
+ nativeFunctionArgs += "2"
+ nativeFunctionArgsLargePack += "2"
elif wrapperargtype == "out string":
outstringargs.append(arg.name)
- argnames += "2"
+ nativeFunctionArgs += "2"
+ nativeFunctionArgsLargePack += "2"
if argattribute:
if argattribute.name == "STEAM_OUT_STRING_COUNT":
argNamesToAddAsStringSize.append(argattribute.value)
@@ -965,13 +1127,26 @@ def parse_args(strEntryPoint, args):
pass
else:
getNextArgAsStringSize = True
+
+
+
+ if isThisArgPackAware:
+ nativeFunctionArgsLargePack += "_lp"
+ largePackArgMarshalInfo.append(largePackArgMarshalRecord)
+
+ nativeFunctionArgs += ", "
+ nativeFunctionArgsLargePack += ", "
- argnames += ", "
pinvokeargs = pinvokeargs.rstrip(", ")
+ pinvokeargsLargePack = pinvokeargsLargePack.rstrip(", ")
+ nativeFunctionArgsLargePack = nativeFunctionArgsLargePack.rstrip(", ")
wrapperargs = wrapperargs.rstrip(", ")
- argnames = argnames.rstrip(", ")
- return (pinvokeargs, wrapperargs, argnames, stringargs, (outstringargs, outstringsize), args_with_explicit_count)
+ nativeFunctionArgs = nativeFunctionArgs.rstrip(", ")
+ nativeFunctionArgsLargePack = nativeFunctionArgsLargePack.rstrip(", ")
+ return (pinvokeargs, wrapperargs, nativeFunctionArgs, stringargs, (outstringargs, outstringsize),
+ args_with_explicit_count, isMethodPacksizeAware, nativeFunctionArgsLargePack,
+ largePackArgMarshalInfo, pinvokeargsLargePack if isMethodPacksizeAware else None)
if __name__ == "__main__":
diff --git a/CodeGen/src/structs.py b/CodeGen/src/structs.py
index 0ab200d0..5653ec72 100644
--- a/CodeGen/src/structs.py
+++ b/CodeGen/src/structs.py
@@ -1,17 +1,23 @@
import os
import sys
from copy import deepcopy
-from SteamworksParser import steamworksparser
+from SteamworksParser.steamworksparser import BlankLine, FieldOffset, Parser, Settings, Struct, StructField
g_TypeConversionDict = {
"uint8": "byte",
"uint16": "ushort",
"uint32": "uint",
"uint64": "ulong",
+ "uint8_t": "byte",
+ "uint16_t": "ushort",
+ "uint32_t": "uint",
+ "uint64_t": "ulong",
"char": "string",
"int32": "int",
"int64": "long",
+ "int32_t": "int",
+ "int64_t": "long",
"uint8 *": "IntPtr",
"const char *": "string",
@@ -65,6 +71,7 @@
g_SequentialStructs = (
"MatchMakingKeyValuePair_t",
+ "SteamNetConnectionInfo_t"
)
g_SpecialFieldTypes = {
@@ -95,12 +102,14 @@
}
}
-def main(parser):
+def main(parser: Parser):
try:
os.makedirs("../com.rlabrecque.steamworks.net/Runtime/autogen/")
except OSError:
pass
+ packsizeAwareStructNames = parser.packSizeAwareStructs
+
lines = []
callbacklines = []
@@ -108,9 +117,9 @@ def main(parser):
for f in parser.files:
for struct in f.structs:
- lines.extend(parse(struct, True, anyCpuConditionalMarshallerLines))
+ lines.extend(parse(struct, True, anyCpuConditionalMarshallerLines, packsizeAwareStructNames, parser))
for callback in f.callbacks:
- callbacklines.extend(parse(callback, True, anyCpuConditionalMarshallerLines))
+ callbacklines.extend(parse(callback, True, anyCpuConditionalMarshallerLines, packsizeAwareStructNames, parser))
with open("../com.rlabrecque.steamworks.net/Runtime/autogen/SteamStructs.cs", "wb") as out:
with open("templates/header.txt", "r") as f:
@@ -145,105 +154,133 @@ def main(parser):
out.write(bytes("#endif // !DISABLESTEAMWORKS\n", "utf-8"))
-def parse(struct, isMainStruct, marshalTableLines: list[str]):
- if struct.name in g_SkippedStructs:
+def parse(struct: Struct, isMainStruct, marshalTableLines: list[str], packsizeAwareStructNames: list[str], parser: Parser) -> list[str]:
+ # ignore structs that manually defined by us
+ # ignore nested structs, they probably handled by hand
+ # ignore structs which has nested types, they probably interop by hand
+ if struct.name in g_SkippedStructs or struct.should_not_generate():
+ return []
+
+ if struct.is_sequential and not isMainStruct:
return []
lines = []
for comment in struct.c.rawprecomments:
- if type(comment) is steamworksparser.BlankLine:
+ if type(comment) is BlankLine:
continue
lines.append("\t" + comment)
structname: str = struct.name
-
+ # We have analyzed this struct and stored the value of its packsize,
+ # it's stored in Struct.pack, None for default packsize
+ # If the struct is packsize-aware, we generate large variants of it.
packsize = g_CustomPackSize.get(structname, "Packsize.value")
isExplicitStruct = False
if g_ExplicitStructs.get(structname, False):
lines.append("\t[StructLayout(LayoutKind.Explicit, Pack = " + packsize + ")]")
isExplicitStruct = True
- elif struct.packsize:
+ elif isMainStruct and not struct.is_sequential:
+
+ if struct.packsize != "Packsize.value" and structname not in g_SequentialStructs:
+ customsize = ""
+ if len(struct.fields) == 0:
+ customsize = ", Size = 1"
+ lines.append("\t[StructLayout(LayoutKind.Sequential, Pack = " + packsize + customsize + ")]")
+ elif not isMainStruct:
+ packsize = str(8)
customsize = ""
if len(struct.fields) == 0:
- customsize = ", Size = 1"
- lines.append("\t[StructLayout(LayoutKind.Sequential, Pack = " + packsize + customsize + ")]")
+ customsize = ", Size = 1"
+ lines.append("\t[StructLayout(LayoutKind.Sequential, Pack = 8" + customsize + ")]")
if struct.callbackid:
lines.append("\t[CallbackIdentity(Constants." + struct.callbackid + ")]")
- for name in g_SequentialStructs:
- if name == structname:
+ # use pack-size sematic for sequential
+ for name in g_SequentialStructs or struct.is_sequential:
+ if name == structname or struct.is_sequential:
lines.append("\t[StructLayout(LayoutKind.Sequential)]")
break
if isMainStruct:
- lines.append("\tpublic struct " + structname + " {")
+ if struct.callbackid:
+ lines.append("\tpublic struct " + structname )
+ lines.append("\t#if STEAMWORKS_ANYCPU")
+ lines.append("\t\t: ICallbackIdentity")
+ lines.append("\t#endif")
+ lines.append("\t{")
+ else:
+ lines.append("\tpublic struct " + structname + " {" )
else:
lines.append("\tinternal struct " + structname + " {")
lines.extend(insert_constructors(structname))
- if struct.callbackid:
+ if struct.callbackid and isMainStruct:
lines.append("\t\tpublic const int k_iCallback = Constants." + struct.callbackid + ";")
+ lines.append("\t\tpublic static int CallbackIdentity { get; } = Constants." + struct.callbackid + ";")
+ fieldHandlingStructName = structname
for field in struct.fields:
- fieldHandlingStructName = structname
-
- if "_LargePack" in structname or "_SmallPack" in structname:
+ if not isMainStruct:
fieldHandlingStructName = fieldHandlingStructName[:structname.rindex("_")]
- lines.extend(parse_field(field, fieldHandlingStructName))
+ lines.extend(parse_field(field, fieldHandlingStructName, isMainStruct, parser))
+
+ if fieldHandlingStructName in packsizeAwareStructNames and not isMainStruct:
+ mainStructName = structname[:structname.rindex("_")]
+ packKind = structname[structname.rindex("_") + 1:]
+
+ lines.append("")
+ lines.append(f"\t\tpublic static implicit operator {mainStructName}({mainStructName}_{packKind} value) {{")
+ lines.append(f"\t\t\t{mainStructName} result = default;")
+
+ for field in struct.fields:
+ gen_fieldcopycode(field, structname, lines)
+
+ lines.append(f"\t\t\treturn result;")
+ lines.append("\t\t}")
+
+ lines.append("")
+ lines.append(f"\t\tpublic static implicit operator {mainStructName}_{packKind}({mainStructName} value) {{")
+ lines.append(f"\t\t\t{mainStructName}_{packKind} result = default;")
+
+ for field in struct.fields:
+ gen_fieldcopycode(field, structname, lines)
+
+ lines.append(f"\t\t\treturn result;")
+ lines.append("\t\t}")
+ pass
if struct.endcomments:
for comment in struct.endcomments.rawprecomments:
- if type(comment) is steamworksparser.BlankLine:
+ if type(comment) is BlankLine:
lines.append("\t\t")
else:
lines.append("\t" + comment)
- # Generate Any CPU marshal helper
- if isMainStruct and packsize == "Packsize.value" and not isExplicitStruct:
- marshalTableLines.append(f"marshallers.Add(typeof({structname}), (unmanaged) => {{")
- marshalTableLines.append(f"\t{structname} result = default;")
+ # Generate Any CPU marshal helper
+ if isMainStruct and struct.name in packsizeAwareStructNames and not isExplicitStruct:
+ marshalTableLines.append(f"if (typeof(T) == typeof({structname}) && Packsize.IsLargePack)")
+ marshalTableLines.append(f"\tImpl<{structname}>.Marshaller = (unmanaged) =>")
+ marshalTableLines.append(f"\t\tSystem.Runtime.InteropServices.Marshal.PtrToStructure<{structname}_LargePack>(unmanaged);")
marshalTableLines.append("")
- marshalTableLines.append("\tif (Packsize.IsLargePack) {")
- marshalTableLines.append(f"\t\tvar value = System.Runtime.InteropServices.Marshal.PtrToStructure<{structname}_LargePack>(unmanaged);")
-
- for field in struct.fields:
- gen_fieldcopycode(field, structname, marshalTableLines)
-
- marshalTableLines.append("\t} else {")
- marshalTableLines.append(f"\t\tvar value = System.Runtime.InteropServices.Marshal.PtrToStructure<{structname}_SmallPack>(unmanaged);")
- for field in struct.fields:
- gen_fieldcopycode(field, structname, marshalTableLines)
-
- marshalTableLines.append("\t}")
- marshalTableLines.append("")
- marshalTableLines.append("\treturn result;")
- marshalTableLines.append("});")
- pass
+ # pass
lines.append("\t}")
lines.append("")
- # Generate Any CPU struct variant for default pack-sized structs
- if isMainStruct and packsize == "Packsize.value" and not isExplicitStruct:
+ # Generate Any CPU struct variant for default pack-sized structs
+ if isMainStruct and not isExplicitStruct and struct.name in packsizeAwareStructNames:
lines.append("\t#if STEAMWORKS_ANYCPU")
- largePackStruct = struct
+ largePackStruct = deepcopy(struct)
largePackStruct.name = structname + "_LargePack"
largePackStruct.packsize = 8
- lines.extend(parse(largePackStruct, False, marshalTableLines))
-
- lines.append("")
-
- smallPackStruct = struct
- smallPackStruct.name = structname + "_SmallPack"
- smallPackStruct.packsize = 4
- lines.extend(parse(smallPackStruct, False, marshalTableLines))
+ lines.extend(parse(largePackStruct, False, marshalTableLines, packsizeAwareStructNames, parser))
lines.append("\t#endif")
@@ -254,14 +291,14 @@ def gen_fieldcopycode(field, structname, marshalTableLines):
fieldtype = g_SpecialFieldTypes.get(structname, dict()).get(field.name, fieldtype)
if field.arraysize and fieldtype == "string":
- marshalTableLines.append(f"\t\tresult.{field.name}_ = value.{field.name}_;")
+ marshalTableLines.append(f"\t\t\tresult.{field.name}_ = value.{field.name}_;")
else:
- marshalTableLines.append(f"\t\tresult.{field.name} = value.{field.name};")
+ marshalTableLines.append(f"\t\t\tresult.{field.name} = value.{field.name};")
-def parse_field(field, structname):
+def parse_field(field: StructField, structname: str, isMainStruct: bool, parser: Parser):
lines = []
for comment in field.c.rawprecomments:
- if type(comment) is steamworksparser.BlankLine:
+ if type(comment) is BlankLine:
lines.append("\t\t")
else:
lines.append("\t" + comment)
@@ -277,30 +314,36 @@ def parse_field(field, structname):
if field.c.rawlinecomment:
comment = field.c.rawlinecomment
- if field.arraysize:
+ if field.arraysizeStr:
constantsstr = ""
- if not field.arraysize.isdigit():
+ if not field.arraysizeStr.isdigit():
constantsstr = "Constants."
if fieldtype == "byte[]":
- lines.append("\t\t[MarshalAs(UnmanagedType.ByValArray, SizeConst = " + constantsstr + field.arraysize + ")]")
+ lines.append("\t\t[MarshalAs(UnmanagedType.ByValArray, SizeConst = " + constantsstr + field.arraysizeStr + ")]")
if structname == "MatchMakingKeyValuePair_t":
- lines.append("\t\t[MarshalAs(UnmanagedType.ByValTStr, SizeConst = " + constantsstr + field.arraysize + ")]")
+ lines.append("\t\t[MarshalAs(UnmanagedType.ByValTStr, SizeConst = " + constantsstr + field.arraysizeStr + ")]")
else:
- lines.append("\t\t[MarshalAs(UnmanagedType.ByValArray, SizeConst = " + constantsstr + field.arraysize + ")]")
+ lines.append("\t\t[MarshalAs(UnmanagedType.ByValArray, SizeConst = " + constantsstr + field.arraysizeStr + ")]")
fieldtype += "[]"
if fieldtype == "bool":
lines.append("\t\t[MarshalAs(UnmanagedType.I1)]")
- if field.arraysize and fieldtype == "string[]":
+ # HACK real type is `string`, `[]` is added by `fieldtype += "[]"`
+ if field.arraysizeStr and fieldtype == "string[]":
lines.append("\t\tinternal byte[] " + field.name + "_;")
- lines.append("\t\tpublic string " + field.name + comment)
+ lines.append("\t\tpublic string " + field.name + comment)
lines.append("\t\t{")
lines.append("\t\t\tget { return InteropHelp.ByteArrayToStringUTF8(" + field.name + "_); }")
- lines.append("\t\t\tset { InteropHelp.StringToByteArrayUTF8(value, " + field.name + "_, " + constantsstr + field.arraysize + "); }")
+ lines.append("\t\t\tset { InteropHelp.StringToByteArrayUTF8(value, " + field.name + "_, " + constantsstr + field.arraysizeStr + "); }")
lines.append("\t\t}")
else:
+ if not isMainStruct:
+ typeInfo = parser.resolveTypeInfo(fieldtype)
+ if isinstance(typeInfo, Struct) and typeInfo.packsize_aware:
+ fieldtype = fieldtype + "_LargePack"
+
lines.append("\t\tpublic " + fieldtype + " " + field.name + ";" + comment)
return lines
@@ -321,5 +364,5 @@ def insert_constructors(name):
print("TODO: Usage Instructions")
exit()
- steamworksparser.Settings.fake_gameserver_interfaces = True
- main(steamworksparser.parse(sys.argv[1]))
\ No newline at end of file
+ Settings.fake_gameserver_interfaces = True
+ main(parse(sys.argv[1]))
\ No newline at end of file
diff --git a/CodeGen/templates/anycpu/ConditionalMarshallerTable.head.cs b/CodeGen/templates/anycpu/ConditionalMarshallerTable.head.cs
index 9688f02e..a2100581 100644
--- a/CodeGen/templates/anycpu/ConditionalMarshallerTable.head.cs
+++ b/CodeGen/templates/anycpu/ConditionalMarshallerTable.head.cs
@@ -14,6 +14,7 @@
namespace Steamworks {
internal static partial class ConditionalMarshallerTable {
- static ConditionalMarshallerTable() {
- Dictionary> marshallers = new();
+ private static partial class Impl {
+ static Impl() {
+
diff --git a/CodeGen/templates/anycpu/ConditionalMarshallerTable.tail.cs b/CodeGen/templates/anycpu/ConditionalMarshallerTable.tail.cs
index 702da47f..44036b84 100644
--- a/CodeGen/templates/anycpu/ConditionalMarshallerTable.tail.cs
+++ b/CodeGen/templates/anycpu/ConditionalMarshallerTable.tail.cs
@@ -1,4 +1,4 @@
- s_marshallerLookupTable = FrozenDictionary.ToFrozenDictionary(marshallers);
+ }
}
}
}
diff --git a/CodeGen/templates/custom_types/SteamNetworkingSockets/ISteamNetworkingConnectionSignaling.cs b/CodeGen/templates/custom_types/SteamNetworkingSockets/ISteamNetworkingConnectionSignaling.cs
index d3419904..84cb3326 100644
--- a/CodeGen/templates/custom_types/SteamNetworkingSockets/ISteamNetworkingConnectionSignaling.cs
+++ b/CodeGen/templates/custom_types/SteamNetworkingSockets/ISteamNetworkingConnectionSignaling.cs
@@ -27,7 +27,15 @@ public struct ISteamNetworkingConnectionSignaling
/// You can assume that the same value of hConn will be used
/// every time.
public bool SendSignal(HSteamNetConnection hConn, ref SteamNetConnectionInfo_t info, IntPtr pMsg, int cbMsg) {
- return NativeMethods.SteamAPI_ISteamNetworkingConnectionSignaling_SendSignal(ref this, hConn, ref info, pMsg, cbMsg);
+ bool ret;
+ if (!Packsize.IsLargePack) {
+ ret = NativeMethods.SteamAPI_ISteamNetworkingConnectionSignaling_SendSignal(ref this, hConn, ref info, pMsg, cbMsg);
+ } else {
+ SteamNetConnectionInfo_t info_lp = info;
+ ret = NativeMethods.SteamAPI_ISteamNetworkingConnectionSignaling_SendSignal(ref this, hConn, ref info_lp, pMsg, cbMsg);
+ info = info_lp;
+ }
+ return ret;
}
/// Called when the connection no longer needs to send signals.
diff --git a/CodeGen/templates/nativemethods.txt b/CodeGen/templates/nativemethods.txt
index 7274efd8..d20ee5e7 100644
--- a/CodeGen/templates/nativemethods.txt
+++ b/CodeGen/templates/nativemethods.txt
@@ -37,6 +37,42 @@ using IntPtr = System.IntPtr;
namespace Steamworks {
[System.Security.SuppressUnmanagedCodeSecurity()]
internal static class NativeMethods {
+ #if STEAMWORKS_ANYCPU
+ static NativeMethods() {
+ NativeLibrary.SetDllImportResolver(typeof(NativeMethods).Assembly, DllImportResolver);
+ }
+
+ private static IntPtr DllImportResolver(string libraryName, System.Reflection.Assembly assembly, DllImportSearchPath? searchPath) {
+ // check is requesting library name matches steam native
+ // we don't check requester here because we want to ensure we are the first loader of steam native
+ // otherwise other libraries may have already loaded steam native with wrong architecture
+ if ((libraryName == NativeLibraryName || libraryName == NativeLibrary_SDKEncryptedAppTicket)
+ // check are we on win64, the special case we are going to handle
+ && RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && System.Environment.Is64BitProcess) {
+ // check who is requesting steam native
+ if (assembly.GetName().Name != "Steamworks.NET") {
+ // Unmanaged libraries(steam native dll) will be cached(probably by name),
+ // we warn developers here the steam native will be cached for any later loads, this is a potentional pollution.
+ System.Diagnostics.Debug.WriteLine(
+ $"[Warning] Assembly {assembly.GetName().Name} is requesting Steam native by it's original name, " +
+ $"but Steamworks.NET.AnyCPU want to load x64 version of steam library \"{libraryName}\". The loaded Steam native will be cached " +
+ $"and may potentially break it.\n" +
+ $"Affected assembly's full name: {assembly.FullName}");
+
+ return 0;
+ }
+
+ // platform specific suffix is not needed, to reuse default unmanaged dependencies resolve logic
+ string x64LibName = $"{libraryName}64";
+ // we don't care failed load, let next handler manage it
+ NativeLibrary.TryLoad(x64LibName, assembly, searchPath, out nint lib);
+ return lib;
+ }
+
+ return 0;
+ }
+#endif
+
#if STEAMWORKS_WIN && STEAMWORKS_X64
internal const string NativeLibraryName = "steam_api64";
internal const string NativeLibrary_SDKEncryptedAppTicket = "sdkencryptedappticket64";
@@ -303,6 +339,10 @@ namespace Steamworks {
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool SteamAPI_ISteamNetworkingConnectionSignaling_SendSignal(ref ISteamNetworkingConnectionSignaling self, HSteamNetConnection hConn, ref SteamNetConnectionInfo_t info, IntPtr pMsg, int cbMsg);
+ [DllImport(NativeLibraryName, EntryPoint = "SteamAPI_ISteamNetworkingConnectionSignaling_SendSignal", CallingConvention = CallingConvention.Cdecl)]
+ [return: MarshalAs(UnmanagedType.I1)]
+ public static extern bool SteamAPI_ISteamNetworkingConnectionSignaling_SendSignal(ref ISteamNetworkingConnectionSignaling self, HSteamNetConnection hConn, ref SteamNetConnectionInfo_t_LargePack info_lp, IntPtr pMsg, int cbMsg);
+
[DllImport(NativeLibraryName, EntryPoint = "SteamAPI_ISteamNetworkingConnectionSignaling_Release", CallingConvention = CallingConvention.Cdecl)]
public static extern void SteamAPI_ISteamNetworkingConnectionSignaling_Release(ref ISteamNetworkingConnectionSignaling self);
#endregion
diff --git a/Standalone3.0/ConditionalMarshallerTable.cs b/Standalone3.0/ConditionalMarshallerTable.cs
index f0e31161..7a883a65 100644
--- a/Standalone3.0/ConditionalMarshallerTable.cs
+++ b/Standalone3.0/ConditionalMarshallerTable.cs
@@ -1,19 +1,24 @@
using System;
-using System.Collections.Frozen;
-using System.Collections.Generic;
+using System.Runtime.InteropServices;
namespace Steamworks
{
internal static partial class ConditionalMarshallerTable
{
- private static readonly FrozenDictionary> s_marshallerLookupTable;
+ // private static readonly FrozenDictionary> s_marshallerLookupTable;
+
+ private static partial class Impl
+ {
+ public static readonly Func Marshaller =
+ unmanaged => System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
+ }
// partial, in generated file
// static ConditionalMarshallerTable();
public static T Marshal(IntPtr unmanagetype)
{
- return (T)s_marshallerLookupTable[typeof(T)](unmanagetype);
- }
+ return Impl.Marshaller(unmanagetype);
+ }
}
}
diff --git a/Standalone3.0/ConditionalMarshallerTable.g.cs b/Standalone3.0/ConditionalMarshallerTable.g.cs
index 7871a183..91c08998 100644
--- a/Standalone3.0/ConditionalMarshallerTable.g.cs
+++ b/Standalone3.0/ConditionalMarshallerTable.g.cs
@@ -30,3695 +30,307 @@
namespace Steamworks {
internal static partial class ConditionalMarshallerTable {
- static ConditionalMarshallerTable() {
- Dictionary> marshallers = new();
+ private static partial class Impl {
+ static Impl() {
+
- marshallers.Add(typeof(DlcInstalled_t), (unmanaged) => {
- DlcInstalled_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_nAppID = value.m_nAppID;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_nAppID = value.m_nAppID;
- }
-
- return result;
- });
- marshallers.Add(typeof(NewUrlLaunchParameters_t), (unmanaged) => {
- NewUrlLaunchParameters_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- }
-
- return result;
- });
- marshallers.Add(typeof(AppProofOfPurchaseKeyResponse_t), (unmanaged) => {
- AppProofOfPurchaseKeyResponse_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.m_nAppID = value.m_nAppID;
- result.m_cchKeyLength = value.m_cchKeyLength;
- result.m_rgchKey_ = value.m_rgchKey_;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.m_nAppID = value.m_nAppID;
- result.m_cchKeyLength = value.m_cchKeyLength;
- result.m_rgchKey_ = value.m_rgchKey_;
- }
-
- return result;
- });
- marshallers.Add(typeof(FileDetailsResult_t), (unmanaged) => {
- FileDetailsResult_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.m_ulFileSize = value.m_ulFileSize;
- result.m_FileSHA = value.m_FileSHA;
- result.m_unFlags = value.m_unFlags;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.m_ulFileSize = value.m_ulFileSize;
- result.m_FileSHA = value.m_FileSHA;
- result.m_unFlags = value.m_unFlags;
- }
-
- return result;
- });
- marshallers.Add(typeof(TimedTrialStatus_t), (unmanaged) => {
- TimedTrialStatus_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_unAppID = value.m_unAppID;
- result.m_bIsOffline = value.m_bIsOffline;
- result.m_unSecondsAllowed = value.m_unSecondsAllowed;
- result.m_unSecondsPlayed = value.m_unSecondsPlayed;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_unAppID = value.m_unAppID;
- result.m_bIsOffline = value.m_bIsOffline;
- result.m_unSecondsAllowed = value.m_unSecondsAllowed;
- result.m_unSecondsPlayed = value.m_unSecondsPlayed;
- }
-
- return result;
- });
- marshallers.Add(typeof(FriendGameInfo_t), (unmanaged) => {
- FriendGameInfo_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_gameID = value.m_gameID;
- result.m_unGameIP = value.m_unGameIP;
- result.m_usGamePort = value.m_usGamePort;
- result.m_usQueryPort = value.m_usQueryPort;
- result.m_steamIDLobby = value.m_steamIDLobby;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_gameID = value.m_gameID;
- result.m_unGameIP = value.m_unGameIP;
- result.m_usGamePort = value.m_usGamePort;
- result.m_usQueryPort = value.m_usQueryPort;
- result.m_steamIDLobby = value.m_steamIDLobby;
- }
-
- return result;
- });
- marshallers.Add(typeof(PersonaStateChange_t), (unmanaged) => {
- PersonaStateChange_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ulSteamID = value.m_ulSteamID;
- result.m_nChangeFlags = value.m_nChangeFlags;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ulSteamID = value.m_ulSteamID;
- result.m_nChangeFlags = value.m_nChangeFlags;
- }
-
- return result;
- });
- marshallers.Add(typeof(GameOverlayActivated_t), (unmanaged) => {
- GameOverlayActivated_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_bActive = value.m_bActive;
- result.m_bUserInitiated = value.m_bUserInitiated;
- result.m_nAppID = value.m_nAppID;
- result.m_dwOverlayPID = value.m_dwOverlayPID;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_bActive = value.m_bActive;
- result.m_bUserInitiated = value.m_bUserInitiated;
- result.m_nAppID = value.m_nAppID;
- result.m_dwOverlayPID = value.m_dwOverlayPID;
- }
-
- return result;
- });
- marshallers.Add(typeof(GameServerChangeRequested_t), (unmanaged) => {
- GameServerChangeRequested_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_rgchServer_ = value.m_rgchServer_;
- result.m_rgchPassword_ = value.m_rgchPassword_;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_rgchServer_ = value.m_rgchServer_;
- result.m_rgchPassword_ = value.m_rgchPassword_;
- }
-
- return result;
- });
- marshallers.Add(typeof(GameLobbyJoinRequested_t), (unmanaged) => {
- GameLobbyJoinRequested_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_steamIDLobby = value.m_steamIDLobby;
- result.m_steamIDFriend = value.m_steamIDFriend;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_steamIDLobby = value.m_steamIDLobby;
- result.m_steamIDFriend = value.m_steamIDFriend;
- }
-
- return result;
- });
- marshallers.Add(typeof(ClanOfficerListResponse_t), (unmanaged) => {
- ClanOfficerListResponse_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_steamIDClan = value.m_steamIDClan;
- result.m_cOfficers = value.m_cOfficers;
- result.m_bSuccess = value.m_bSuccess;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_steamIDClan = value.m_steamIDClan;
- result.m_cOfficers = value.m_cOfficers;
- result.m_bSuccess = value.m_bSuccess;
- }
-
- return result;
- });
- marshallers.Add(typeof(GameRichPresenceJoinRequested_t), (unmanaged) => {
- GameRichPresenceJoinRequested_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_steamIDFriend = value.m_steamIDFriend;
- result.m_rgchConnect_ = value.m_rgchConnect_;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_steamIDFriend = value.m_steamIDFriend;
- result.m_rgchConnect_ = value.m_rgchConnect_;
- }
-
- return result;
- });
- marshallers.Add(typeof(GameConnectedChatJoin_t), (unmanaged) => {
- GameConnectedChatJoin_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_steamIDClanChat = value.m_steamIDClanChat;
- result.m_steamIDUser = value.m_steamIDUser;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_steamIDClanChat = value.m_steamIDClanChat;
- result.m_steamIDUser = value.m_steamIDUser;
- }
-
- return result;
- });
- marshallers.Add(typeof(DownloadClanActivityCountsResult_t), (unmanaged) => {
- DownloadClanActivityCountsResult_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_bSuccess = value.m_bSuccess;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_bSuccess = value.m_bSuccess;
- }
-
- return result;
- });
- marshallers.Add(typeof(UnreadChatMessagesChanged_t), (unmanaged) => {
- UnreadChatMessagesChanged_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- }
-
- return result;
- });
- marshallers.Add(typeof(OverlayBrowserProtocolNavigation_t), (unmanaged) => {
- OverlayBrowserProtocolNavigation_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.rgchURI_ = value.rgchURI_;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.rgchURI_ = value.rgchURI_;
- }
-
- return result;
- });
- marshallers.Add(typeof(EquippedProfileItemsChanged_t), (unmanaged) => {
- EquippedProfileItemsChanged_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_steamID = value.m_steamID;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_steamID = value.m_steamID;
- }
-
- return result;
- });
- marshallers.Add(typeof(EquippedProfileItems_t), (unmanaged) => {
- EquippedProfileItems_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.m_steamID = value.m_steamID;
- result.m_bHasAnimatedAvatar = value.m_bHasAnimatedAvatar;
- result.m_bHasAvatarFrame = value.m_bHasAvatarFrame;
- result.m_bHasProfileModifier = value.m_bHasProfileModifier;
- result.m_bHasProfileBackground = value.m_bHasProfileBackground;
- result.m_bHasMiniProfileBackground = value.m_bHasMiniProfileBackground;
- result.m_bFromCache = value.m_bFromCache;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.m_steamID = value.m_steamID;
- result.m_bHasAnimatedAvatar = value.m_bHasAnimatedAvatar;
- result.m_bHasAvatarFrame = value.m_bHasAvatarFrame;
- result.m_bHasProfileModifier = value.m_bHasProfileModifier;
- result.m_bHasProfileBackground = value.m_bHasProfileBackground;
- result.m_bHasMiniProfileBackground = value.m_bHasMiniProfileBackground;
- result.m_bFromCache = value.m_bFromCache;
- }
-
- return result;
- });
- marshallers.Add(typeof(GCMessageAvailable_t), (unmanaged) => {
- GCMessageAvailable_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_nMessageSize = value.m_nMessageSize;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_nMessageSize = value.m_nMessageSize;
- }
-
- return result;
- });
- marshallers.Add(typeof(GCMessageFailed_t), (unmanaged) => {
- GCMessageFailed_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- }
-
- return result;
- });
- marshallers.Add(typeof(GSClientApprove_t), (unmanaged) => {
- GSClientApprove_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_SteamID = value.m_SteamID;
- result.m_OwnerSteamID = value.m_OwnerSteamID;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_SteamID = value.m_SteamID;
- result.m_OwnerSteamID = value.m_OwnerSteamID;
- }
-
- return result;
- });
- marshallers.Add(typeof(GSClientAchievementStatus_t), (unmanaged) => {
- GSClientAchievementStatus_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_SteamID = value.m_SteamID;
- result.m_pchAchievement_ = value.m_pchAchievement_;
- result.m_bUnlocked = value.m_bUnlocked;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_SteamID = value.m_SteamID;
- result.m_pchAchievement_ = value.m_pchAchievement_;
- result.m_bUnlocked = value.m_bUnlocked;
- }
-
- return result;
- });
- marshallers.Add(typeof(GSPolicyResponse_t), (unmanaged) => {
- GSPolicyResponse_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_bSecure = value.m_bSecure;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_bSecure = value.m_bSecure;
- }
-
- return result;
- });
- marshallers.Add(typeof(GSGameplayStats_t), (unmanaged) => {
- GSGameplayStats_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.m_nRank = value.m_nRank;
- result.m_unTotalConnects = value.m_unTotalConnects;
- result.m_unTotalMinutesPlayed = value.m_unTotalMinutesPlayed;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.m_nRank = value.m_nRank;
- result.m_unTotalConnects = value.m_unTotalConnects;
- result.m_unTotalMinutesPlayed = value.m_unTotalMinutesPlayed;
- }
-
- return result;
- });
- marshallers.Add(typeof(GSReputation_t), (unmanaged) => {
- GSReputation_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.m_unReputationScore = value.m_unReputationScore;
- result.m_bBanned = value.m_bBanned;
- result.m_unBannedIP = value.m_unBannedIP;
- result.m_usBannedPort = value.m_usBannedPort;
- result.m_ulBannedGameID = value.m_ulBannedGameID;
- result.m_unBanExpires = value.m_unBanExpires;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.m_unReputationScore = value.m_unReputationScore;
- result.m_bBanned = value.m_bBanned;
- result.m_unBannedIP = value.m_unBannedIP;
- result.m_usBannedPort = value.m_usBannedPort;
- result.m_ulBannedGameID = value.m_ulBannedGameID;
- result.m_unBanExpires = value.m_unBanExpires;
- }
-
- return result;
- });
- marshallers.Add(typeof(AssociateWithClanResult_t), (unmanaged) => {
- AssociateWithClanResult_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- }
-
- return result;
- });
- marshallers.Add(typeof(ComputeNewPlayerCompatibilityResult_t), (unmanaged) => {
- ComputeNewPlayerCompatibilityResult_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.m_cPlayersThatDontLikeCandidate = value.m_cPlayersThatDontLikeCandidate;
- result.m_cPlayersThatCandidateDoesntLike = value.m_cPlayersThatCandidateDoesntLike;
- result.m_cClanPlayersThatDontLikeCandidate = value.m_cClanPlayersThatDontLikeCandidate;
- result.m_SteamIDCandidate = value.m_SteamIDCandidate;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.m_cPlayersThatDontLikeCandidate = value.m_cPlayersThatDontLikeCandidate;
- result.m_cPlayersThatCandidateDoesntLike = value.m_cPlayersThatCandidateDoesntLike;
- result.m_cClanPlayersThatDontLikeCandidate = value.m_cClanPlayersThatDontLikeCandidate;
- result.m_SteamIDCandidate = value.m_SteamIDCandidate;
- }
-
- return result;
- });
- marshallers.Add(typeof(GSStatsUnloaded_t), (unmanaged) => {
- GSStatsUnloaded_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_steamIDUser = value.m_steamIDUser;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_steamIDUser = value.m_steamIDUser;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTML_BrowserReady_t), (unmanaged) => {
- HTML_BrowserReady_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTML_NeedsPaint_t), (unmanaged) => {
- HTML_NeedsPaint_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pBGRA = value.pBGRA;
- result.unWide = value.unWide;
- result.unTall = value.unTall;
- result.unUpdateX = value.unUpdateX;
- result.unUpdateY = value.unUpdateY;
- result.unUpdateWide = value.unUpdateWide;
- result.unUpdateTall = value.unUpdateTall;
- result.unScrollX = value.unScrollX;
- result.unScrollY = value.unScrollY;
- result.flPageScale = value.flPageScale;
- result.unPageSerial = value.unPageSerial;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pBGRA = value.pBGRA;
- result.unWide = value.unWide;
- result.unTall = value.unTall;
- result.unUpdateX = value.unUpdateX;
- result.unUpdateY = value.unUpdateY;
- result.unUpdateWide = value.unUpdateWide;
- result.unUpdateTall = value.unUpdateTall;
- result.unScrollX = value.unScrollX;
- result.unScrollY = value.unScrollY;
- result.flPageScale = value.flPageScale;
- result.unPageSerial = value.unPageSerial;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTML_StartRequest_t), (unmanaged) => {
- HTML_StartRequest_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pchURL = value.pchURL;
- result.pchTarget = value.pchTarget;
- result.pchPostData = value.pchPostData;
- result.bIsRedirect = value.bIsRedirect;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pchURL = value.pchURL;
- result.pchTarget = value.pchTarget;
- result.pchPostData = value.pchPostData;
- result.bIsRedirect = value.bIsRedirect;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTML_CloseBrowser_t), (unmanaged) => {
- HTML_CloseBrowser_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTML_URLChanged_t), (unmanaged) => {
- HTML_URLChanged_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pchURL = value.pchURL;
- result.pchPostData = value.pchPostData;
- result.bIsRedirect = value.bIsRedirect;
- result.pchPageTitle = value.pchPageTitle;
- result.bNewNavigation = value.bNewNavigation;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pchURL = value.pchURL;
- result.pchPostData = value.pchPostData;
- result.bIsRedirect = value.bIsRedirect;
- result.pchPageTitle = value.pchPageTitle;
- result.bNewNavigation = value.bNewNavigation;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTML_FinishedRequest_t), (unmanaged) => {
- HTML_FinishedRequest_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pchURL = value.pchURL;
- result.pchPageTitle = value.pchPageTitle;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pchURL = value.pchURL;
- result.pchPageTitle = value.pchPageTitle;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTML_OpenLinkInNewTab_t), (unmanaged) => {
- HTML_OpenLinkInNewTab_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pchURL = value.pchURL;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pchURL = value.pchURL;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTML_ChangedTitle_t), (unmanaged) => {
- HTML_ChangedTitle_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pchTitle = value.pchTitle;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pchTitle = value.pchTitle;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTML_SearchResults_t), (unmanaged) => {
- HTML_SearchResults_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.unResults = value.unResults;
- result.unCurrentMatch = value.unCurrentMatch;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.unResults = value.unResults;
- result.unCurrentMatch = value.unCurrentMatch;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTML_CanGoBackAndForward_t), (unmanaged) => {
- HTML_CanGoBackAndForward_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.bCanGoBack = value.bCanGoBack;
- result.bCanGoForward = value.bCanGoForward;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.bCanGoBack = value.bCanGoBack;
- result.bCanGoForward = value.bCanGoForward;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTML_HorizontalScroll_t), (unmanaged) => {
- HTML_HorizontalScroll_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.unScrollMax = value.unScrollMax;
- result.unScrollCurrent = value.unScrollCurrent;
- result.flPageScale = value.flPageScale;
- result.bVisible = value.bVisible;
- result.unPageSize = value.unPageSize;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.unScrollMax = value.unScrollMax;
- result.unScrollCurrent = value.unScrollCurrent;
- result.flPageScale = value.flPageScale;
- result.bVisible = value.bVisible;
- result.unPageSize = value.unPageSize;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTML_VerticalScroll_t), (unmanaged) => {
- HTML_VerticalScroll_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.unScrollMax = value.unScrollMax;
- result.unScrollCurrent = value.unScrollCurrent;
- result.flPageScale = value.flPageScale;
- result.bVisible = value.bVisible;
- result.unPageSize = value.unPageSize;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.unScrollMax = value.unScrollMax;
- result.unScrollCurrent = value.unScrollCurrent;
- result.flPageScale = value.flPageScale;
- result.bVisible = value.bVisible;
- result.unPageSize = value.unPageSize;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTML_LinkAtPosition_t), (unmanaged) => {
- HTML_LinkAtPosition_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.x = value.x;
- result.y = value.y;
- result.pchURL = value.pchURL;
- result.bInput = value.bInput;
- result.bLiveLink = value.bLiveLink;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.x = value.x;
- result.y = value.y;
- result.pchURL = value.pchURL;
- result.bInput = value.bInput;
- result.bLiveLink = value.bLiveLink;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTML_JSAlert_t), (unmanaged) => {
- HTML_JSAlert_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pchMessage = value.pchMessage;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pchMessage = value.pchMessage;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTML_JSConfirm_t), (unmanaged) => {
- HTML_JSConfirm_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pchMessage = value.pchMessage;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pchMessage = value.pchMessage;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTML_FileOpenDialog_t), (unmanaged) => {
- HTML_FileOpenDialog_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pchTitle = value.pchTitle;
- result.pchInitialFile = value.pchInitialFile;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pchTitle = value.pchTitle;
- result.pchInitialFile = value.pchInitialFile;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTML_NewWindow_t), (unmanaged) => {
- HTML_NewWindow_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pchURL = value.pchURL;
- result.unX = value.unX;
- result.unY = value.unY;
- result.unWide = value.unWide;
- result.unTall = value.unTall;
- result.unNewWindow_BrowserHandle_IGNORE = value.unNewWindow_BrowserHandle_IGNORE;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pchURL = value.pchURL;
- result.unX = value.unX;
- result.unY = value.unY;
- result.unWide = value.unWide;
- result.unTall = value.unTall;
- result.unNewWindow_BrowserHandle_IGNORE = value.unNewWindow_BrowserHandle_IGNORE;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTML_SetCursor_t), (unmanaged) => {
- HTML_SetCursor_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.eMouseCursor = value.eMouseCursor;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.eMouseCursor = value.eMouseCursor;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTML_StatusText_t), (unmanaged) => {
- HTML_StatusText_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pchMsg = value.pchMsg;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pchMsg = value.pchMsg;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTML_ShowToolTip_t), (unmanaged) => {
- HTML_ShowToolTip_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pchMsg = value.pchMsg;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pchMsg = value.pchMsg;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTML_UpdateToolTip_t), (unmanaged) => {
- HTML_UpdateToolTip_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pchMsg = value.pchMsg;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.pchMsg = value.pchMsg;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTML_HideToolTip_t), (unmanaged) => {
- HTML_HideToolTip_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTML_BrowserRestarted_t), (unmanaged) => {
- HTML_BrowserRestarted_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.unOldBrowserHandle = value.unOldBrowserHandle;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.unBrowserHandle = value.unBrowserHandle;
- result.unOldBrowserHandle = value.unOldBrowserHandle;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTTPRequestCompleted_t), (unmanaged) => {
- HTTPRequestCompleted_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_hRequest = value.m_hRequest;
- result.m_ulContextValue = value.m_ulContextValue;
- result.m_bRequestSuccessful = value.m_bRequestSuccessful;
- result.m_eStatusCode = value.m_eStatusCode;
- result.m_unBodySize = value.m_unBodySize;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_hRequest = value.m_hRequest;
- result.m_ulContextValue = value.m_ulContextValue;
- result.m_bRequestSuccessful = value.m_bRequestSuccessful;
- result.m_eStatusCode = value.m_eStatusCode;
- result.m_unBodySize = value.m_unBodySize;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTTPRequestHeadersReceived_t), (unmanaged) => {
- HTTPRequestHeadersReceived_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_hRequest = value.m_hRequest;
- result.m_ulContextValue = value.m_ulContextValue;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_hRequest = value.m_hRequest;
- result.m_ulContextValue = value.m_ulContextValue;
- }
-
- return result;
- });
- marshallers.Add(typeof(HTTPRequestDataReceived_t), (unmanaged) => {
- HTTPRequestDataReceived_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_hRequest = value.m_hRequest;
- result.m_ulContextValue = value.m_ulContextValue;
- result.m_cOffset = value.m_cOffset;
- result.m_cBytesReceived = value.m_cBytesReceived;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_hRequest = value.m_hRequest;
- result.m_ulContextValue = value.m_ulContextValue;
- result.m_cOffset = value.m_cOffset;
- result.m_cBytesReceived = value.m_cBytesReceived;
- }
-
- return result;
- });
- marshallers.Add(typeof(InputMotionData_t), (unmanaged) => {
- InputMotionData_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.rotQuatX = value.rotQuatX;
- result.rotQuatY = value.rotQuatY;
- result.rotQuatZ = value.rotQuatZ;
- result.rotQuatW = value.rotQuatW;
- result.posAccelX = value.posAccelX;
- result.posAccelY = value.posAccelY;
- result.posAccelZ = value.posAccelZ;
- result.rotVelX = value.rotVelX;
- result.rotVelY = value.rotVelY;
- result.rotVelZ = value.rotVelZ;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.rotQuatX = value.rotQuatX;
- result.rotQuatY = value.rotQuatY;
- result.rotQuatZ = value.rotQuatZ;
- result.rotQuatW = value.rotQuatW;
- result.posAccelX = value.posAccelX;
- result.posAccelY = value.posAccelY;
- result.posAccelZ = value.posAccelZ;
- result.rotVelX = value.rotVelX;
- result.rotVelY = value.rotVelY;
- result.rotVelZ = value.rotVelZ;
- }
-
- return result;
- });
- marshallers.Add(typeof(SteamInputDeviceConnected_t), (unmanaged) => {
- SteamInputDeviceConnected_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ulConnectedDeviceHandle = value.m_ulConnectedDeviceHandle;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ulConnectedDeviceHandle = value.m_ulConnectedDeviceHandle;
- }
-
- return result;
- });
- marshallers.Add(typeof(SteamInputDeviceDisconnected_t), (unmanaged) => {
- SteamInputDeviceDisconnected_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ulDisconnectedDeviceHandle = value.m_ulDisconnectedDeviceHandle;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ulDisconnectedDeviceHandle = value.m_ulDisconnectedDeviceHandle;
- }
-
- return result;
- });
- marshallers.Add(typeof(SteamInputConfigurationLoaded_t), (unmanaged) => {
- SteamInputConfigurationLoaded_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_unAppID = value.m_unAppID;
- result.m_ulDeviceHandle = value.m_ulDeviceHandle;
- result.m_ulMappingCreator = value.m_ulMappingCreator;
- result.m_unMajorRevision = value.m_unMajorRevision;
- result.m_unMinorRevision = value.m_unMinorRevision;
- result.m_bUsesSteamInputAPI = value.m_bUsesSteamInputAPI;
- result.m_bUsesGamepadAPI = value.m_bUsesGamepadAPI;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_unAppID = value.m_unAppID;
- result.m_ulDeviceHandle = value.m_ulDeviceHandle;
- result.m_ulMappingCreator = value.m_ulMappingCreator;
- result.m_unMajorRevision = value.m_unMajorRevision;
- result.m_unMinorRevision = value.m_unMinorRevision;
- result.m_bUsesSteamInputAPI = value.m_bUsesSteamInputAPI;
- result.m_bUsesGamepadAPI = value.m_bUsesGamepadAPI;
- }
-
- return result;
- });
- marshallers.Add(typeof(SteamInputGamepadSlotChange_t), (unmanaged) => {
- SteamInputGamepadSlotChange_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_unAppID = value.m_unAppID;
- result.m_ulDeviceHandle = value.m_ulDeviceHandle;
- result.m_eDeviceType = value.m_eDeviceType;
- result.m_nOldGamepadSlot = value.m_nOldGamepadSlot;
- result.m_nNewGamepadSlot = value.m_nNewGamepadSlot;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_unAppID = value.m_unAppID;
- result.m_ulDeviceHandle = value.m_ulDeviceHandle;
- result.m_eDeviceType = value.m_eDeviceType;
- result.m_nOldGamepadSlot = value.m_nOldGamepadSlot;
- result.m_nNewGamepadSlot = value.m_nNewGamepadSlot;
- }
-
- return result;
- });
- marshallers.Add(typeof(SteamItemDetails_t), (unmanaged) => {
- SteamItemDetails_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_itemId = value.m_itemId;
- result.m_iDefinition = value.m_iDefinition;
- result.m_unQuantity = value.m_unQuantity;
- result.m_unFlags = value.m_unFlags;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_itemId = value.m_itemId;
- result.m_iDefinition = value.m_iDefinition;
- result.m_unQuantity = value.m_unQuantity;
- result.m_unFlags = value.m_unFlags;
- }
-
- return result;
- });
- marshallers.Add(typeof(SteamInventoryResultReady_t), (unmanaged) => {
- SteamInventoryResultReady_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_handle = value.m_handle;
- result.m_result = value.m_result;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_handle = value.m_handle;
- result.m_result = value.m_result;
- }
-
- return result;
- });
- marshallers.Add(typeof(SteamInventoryFullUpdate_t), (unmanaged) => {
- SteamInventoryFullUpdate_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_handle = value.m_handle;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_handle = value.m_handle;
- }
-
- return result;
- });
- marshallers.Add(typeof(SteamInventoryDefinitionUpdate_t), (unmanaged) => {
- SteamInventoryDefinitionUpdate_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- }
-
- return result;
- });
- marshallers.Add(typeof(SteamInventoryEligiblePromoItemDefIDs_t), (unmanaged) => {
- SteamInventoryEligiblePromoItemDefIDs_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_result = value.m_result;
- result.m_steamID = value.m_steamID;
- result.m_numEligiblePromoItemDefs = value.m_numEligiblePromoItemDefs;
- result.m_bCachedData = value.m_bCachedData;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_result = value.m_result;
- result.m_steamID = value.m_steamID;
- result.m_numEligiblePromoItemDefs = value.m_numEligiblePromoItemDefs;
- result.m_bCachedData = value.m_bCachedData;
- }
-
- return result;
- });
- marshallers.Add(typeof(SteamInventoryStartPurchaseResult_t), (unmanaged) => {
- SteamInventoryStartPurchaseResult_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_result = value.m_result;
- result.m_ulOrderID = value.m_ulOrderID;
- result.m_ulTransID = value.m_ulTransID;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_result = value.m_result;
- result.m_ulOrderID = value.m_ulOrderID;
- result.m_ulTransID = value.m_ulTransID;
- }
-
- return result;
- });
- marshallers.Add(typeof(SteamInventoryRequestPricesResult_t), (unmanaged) => {
- SteamInventoryRequestPricesResult_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_result = value.m_result;
- result.m_rgchCurrency_ = value.m_rgchCurrency_;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_result = value.m_result;
- result.m_rgchCurrency_ = value.m_rgchCurrency_;
- }
-
- return result;
- });
- marshallers.Add(typeof(SteamPartyBeaconLocation_t), (unmanaged) => {
- SteamPartyBeaconLocation_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eType = value.m_eType;
- result.m_ulLocationID = value.m_ulLocationID;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eType = value.m_eType;
- result.m_ulLocationID = value.m_ulLocationID;
- }
-
- return result;
- });
- marshallers.Add(typeof(FavoritesListChanged_t), (unmanaged) => {
- FavoritesListChanged_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_nIP = value.m_nIP;
- result.m_nQueryPort = value.m_nQueryPort;
- result.m_nConnPort = value.m_nConnPort;
- result.m_nAppID = value.m_nAppID;
- result.m_nFlags = value.m_nFlags;
- result.m_bAdd = value.m_bAdd;
- result.m_unAccountId = value.m_unAccountId;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_nIP = value.m_nIP;
- result.m_nQueryPort = value.m_nQueryPort;
- result.m_nConnPort = value.m_nConnPort;
- result.m_nAppID = value.m_nAppID;
- result.m_nFlags = value.m_nFlags;
- result.m_bAdd = value.m_bAdd;
- result.m_unAccountId = value.m_unAccountId;
- }
-
- return result;
- });
- marshallers.Add(typeof(LobbyInvite_t), (unmanaged) => {
- LobbyInvite_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ulSteamIDUser = value.m_ulSteamIDUser;
- result.m_ulSteamIDLobby = value.m_ulSteamIDLobby;
- result.m_ulGameID = value.m_ulGameID;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ulSteamIDUser = value.m_ulSteamIDUser;
- result.m_ulSteamIDLobby = value.m_ulSteamIDLobby;
- result.m_ulGameID = value.m_ulGameID;
- }
-
- return result;
- });
- marshallers.Add(typeof(LobbyEnter_t), (unmanaged) => {
- LobbyEnter_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ulSteamIDLobby = value.m_ulSteamIDLobby;
- result.m_rgfChatPermissions = value.m_rgfChatPermissions;
- result.m_bLocked = value.m_bLocked;
- result.m_EChatRoomEnterResponse = value.m_EChatRoomEnterResponse;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ulSteamIDLobby = value.m_ulSteamIDLobby;
- result.m_rgfChatPermissions = value.m_rgfChatPermissions;
- result.m_bLocked = value.m_bLocked;
- result.m_EChatRoomEnterResponse = value.m_EChatRoomEnterResponse;
- }
-
- return result;
- });
- marshallers.Add(typeof(LobbyDataUpdate_t), (unmanaged) => {
- LobbyDataUpdate_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ulSteamIDLobby = value.m_ulSteamIDLobby;
- result.m_ulSteamIDMember = value.m_ulSteamIDMember;
- result.m_bSuccess = value.m_bSuccess;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ulSteamIDLobby = value.m_ulSteamIDLobby;
- result.m_ulSteamIDMember = value.m_ulSteamIDMember;
- result.m_bSuccess = value.m_bSuccess;
- }
-
- return result;
- });
- marshallers.Add(typeof(LobbyChatUpdate_t), (unmanaged) => {
- LobbyChatUpdate_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ulSteamIDLobby = value.m_ulSteamIDLobby;
- result.m_ulSteamIDUserChanged = value.m_ulSteamIDUserChanged;
- result.m_ulSteamIDMakingChange = value.m_ulSteamIDMakingChange;
- result.m_rgfChatMemberStateChange = value.m_rgfChatMemberStateChange;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ulSteamIDLobby = value.m_ulSteamIDLobby;
- result.m_ulSteamIDUserChanged = value.m_ulSteamIDUserChanged;
- result.m_ulSteamIDMakingChange = value.m_ulSteamIDMakingChange;
- result.m_rgfChatMemberStateChange = value.m_rgfChatMemberStateChange;
- }
-
- return result;
- });
- marshallers.Add(typeof(LobbyChatMsg_t), (unmanaged) => {
- LobbyChatMsg_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ulSteamIDLobby = value.m_ulSteamIDLobby;
- result.m_ulSteamIDUser = value.m_ulSteamIDUser;
- result.m_eChatEntryType = value.m_eChatEntryType;
- result.m_iChatID = value.m_iChatID;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ulSteamIDLobby = value.m_ulSteamIDLobby;
- result.m_ulSteamIDUser = value.m_ulSteamIDUser;
- result.m_eChatEntryType = value.m_eChatEntryType;
- result.m_iChatID = value.m_iChatID;
- }
-
- return result;
- });
- marshallers.Add(typeof(LobbyGameCreated_t), (unmanaged) => {
- LobbyGameCreated_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ulSteamIDLobby = value.m_ulSteamIDLobby;
- result.m_ulSteamIDGameServer = value.m_ulSteamIDGameServer;
- result.m_unIP = value.m_unIP;
- result.m_usPort = value.m_usPort;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ulSteamIDLobby = value.m_ulSteamIDLobby;
- result.m_ulSteamIDGameServer = value.m_ulSteamIDGameServer;
- result.m_unIP = value.m_unIP;
- result.m_usPort = value.m_usPort;
- }
-
- return result;
- });
- marshallers.Add(typeof(LobbyMatchList_t), (unmanaged) => {
- LobbyMatchList_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_nLobbiesMatching = value.m_nLobbiesMatching;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_nLobbiesMatching = value.m_nLobbiesMatching;
- }
-
- return result;
- });
- marshallers.Add(typeof(LobbyKicked_t), (unmanaged) => {
- LobbyKicked_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ulSteamIDLobby = value.m_ulSteamIDLobby;
- result.m_ulSteamIDAdmin = value.m_ulSteamIDAdmin;
- result.m_bKickedDueToDisconnect = value.m_bKickedDueToDisconnect;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ulSteamIDLobby = value.m_ulSteamIDLobby;
- result.m_ulSteamIDAdmin = value.m_ulSteamIDAdmin;
- result.m_bKickedDueToDisconnect = value.m_bKickedDueToDisconnect;
- }
-
- return result;
- });
- marshallers.Add(typeof(LobbyCreated_t), (unmanaged) => {
- LobbyCreated_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.m_ulSteamIDLobby = value.m_ulSteamIDLobby;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.m_ulSteamIDLobby = value.m_ulSteamIDLobby;
- }
-
- return result;
- });
- marshallers.Add(typeof(FavoritesListAccountsUpdated_t), (unmanaged) => {
- FavoritesListAccountsUpdated_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- }
-
- return result;
- });
- marshallers.Add(typeof(SearchForGameProgressCallback_t), (unmanaged) => {
- SearchForGameProgressCallback_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ullSearchID = value.m_ullSearchID;
- result.m_eResult = value.m_eResult;
- result.m_lobbyID = value.m_lobbyID;
- result.m_steamIDEndedSearch = value.m_steamIDEndedSearch;
- result.m_nSecondsRemainingEstimate = value.m_nSecondsRemainingEstimate;
- result.m_cPlayersSearching = value.m_cPlayersSearching;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ullSearchID = value.m_ullSearchID;
- result.m_eResult = value.m_eResult;
- result.m_lobbyID = value.m_lobbyID;
- result.m_steamIDEndedSearch = value.m_steamIDEndedSearch;
- result.m_nSecondsRemainingEstimate = value.m_nSecondsRemainingEstimate;
- result.m_cPlayersSearching = value.m_cPlayersSearching;
- }
-
- return result;
- });
- marshallers.Add(typeof(SearchForGameResultCallback_t), (unmanaged) => {
- SearchForGameResultCallback_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ullSearchID = value.m_ullSearchID;
- result.m_eResult = value.m_eResult;
- result.m_nCountPlayersInGame = value.m_nCountPlayersInGame;
- result.m_nCountAcceptedGame = value.m_nCountAcceptedGame;
- result.m_steamIDHost = value.m_steamIDHost;
- result.m_bFinalCallback = value.m_bFinalCallback;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ullSearchID = value.m_ullSearchID;
- result.m_eResult = value.m_eResult;
- result.m_nCountPlayersInGame = value.m_nCountPlayersInGame;
- result.m_nCountAcceptedGame = value.m_nCountAcceptedGame;
- result.m_steamIDHost = value.m_steamIDHost;
- result.m_bFinalCallback = value.m_bFinalCallback;
- }
-
- return result;
- });
- marshallers.Add(typeof(RequestPlayersForGameProgressCallback_t), (unmanaged) => {
- RequestPlayersForGameProgressCallback_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.m_ullSearchID = value.m_ullSearchID;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.m_ullSearchID = value.m_ullSearchID;
- }
-
- return result;
- });
- marshallers.Add(typeof(RequestPlayersForGameResultCallback_t), (unmanaged) => {
- RequestPlayersForGameResultCallback_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.m_ullSearchID = value.m_ullSearchID;
- result.m_SteamIDPlayerFound = value.m_SteamIDPlayerFound;
- result.m_SteamIDLobby = value.m_SteamIDLobby;
- result.m_ePlayerAcceptState = value.m_ePlayerAcceptState;
- result.m_nPlayerIndex = value.m_nPlayerIndex;
- result.m_nTotalPlayersFound = value.m_nTotalPlayersFound;
- result.m_nTotalPlayersAcceptedGame = value.m_nTotalPlayersAcceptedGame;
- result.m_nSuggestedTeamIndex = value.m_nSuggestedTeamIndex;
- result.m_ullUniqueGameID = value.m_ullUniqueGameID;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.m_ullSearchID = value.m_ullSearchID;
- result.m_SteamIDPlayerFound = value.m_SteamIDPlayerFound;
- result.m_SteamIDLobby = value.m_SteamIDLobby;
- result.m_ePlayerAcceptState = value.m_ePlayerAcceptState;
- result.m_nPlayerIndex = value.m_nPlayerIndex;
- result.m_nTotalPlayersFound = value.m_nTotalPlayersFound;
- result.m_nTotalPlayersAcceptedGame = value.m_nTotalPlayersAcceptedGame;
- result.m_nSuggestedTeamIndex = value.m_nSuggestedTeamIndex;
- result.m_ullUniqueGameID = value.m_ullUniqueGameID;
- }
-
- return result;
- });
- marshallers.Add(typeof(RequestPlayersForGameFinalResultCallback_t), (unmanaged) => {
- RequestPlayersForGameFinalResultCallback_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.m_ullSearchID = value.m_ullSearchID;
- result.m_ullUniqueGameID = value.m_ullUniqueGameID;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.m_ullSearchID = value.m_ullSearchID;
- result.m_ullUniqueGameID = value.m_ullUniqueGameID;
- }
-
- return result;
- });
- marshallers.Add(typeof(SubmitPlayerResultResultCallback_t), (unmanaged) => {
- SubmitPlayerResultResultCallback_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.ullUniqueGameID = value.ullUniqueGameID;
- result.steamIDPlayer = value.steamIDPlayer;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.ullUniqueGameID = value.ullUniqueGameID;
- result.steamIDPlayer = value.steamIDPlayer;
- }
-
- return result;
- });
- marshallers.Add(typeof(EndGameResultCallback_t), (unmanaged) => {
- EndGameResultCallback_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.ullUniqueGameID = value.ullUniqueGameID;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.ullUniqueGameID = value.ullUniqueGameID;
- }
-
- return result;
- });
- marshallers.Add(typeof(JoinPartyCallback_t), (unmanaged) => {
- JoinPartyCallback_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.m_ulBeaconID = value.m_ulBeaconID;
- result.m_SteamIDBeaconOwner = value.m_SteamIDBeaconOwner;
- result.m_rgchConnectString_ = value.m_rgchConnectString_;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.m_ulBeaconID = value.m_ulBeaconID;
- result.m_SteamIDBeaconOwner = value.m_SteamIDBeaconOwner;
- result.m_rgchConnectString_ = value.m_rgchConnectString_;
- }
-
- return result;
- });
- marshallers.Add(typeof(CreateBeaconCallback_t), (unmanaged) => {
- CreateBeaconCallback_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.m_ulBeaconID = value.m_ulBeaconID;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- result.m_ulBeaconID = value.m_ulBeaconID;
- }
-
- return result;
- });
- marshallers.Add(typeof(ReservationNotificationCallback_t), (unmanaged) => {
- ReservationNotificationCallback_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ulBeaconID = value.m_ulBeaconID;
- result.m_steamIDJoiner = value.m_steamIDJoiner;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_ulBeaconID = value.m_ulBeaconID;
- result.m_steamIDJoiner = value.m_steamIDJoiner;
- }
-
- return result;
- });
- marshallers.Add(typeof(ChangeNumOpenSlotsCallback_t), (unmanaged) => {
- ChangeNumOpenSlotsCallback_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eResult = value.m_eResult;
- }
-
- return result;
- });
- marshallers.Add(typeof(AvailableBeaconLocationsUpdated_t), (unmanaged) => {
- AvailableBeaconLocationsUpdated_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- }
-
- return result;
- });
- marshallers.Add(typeof(ActiveBeaconsUpdated_t), (unmanaged) => {
- ActiveBeaconsUpdated_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- }
-
- return result;
- });
- marshallers.Add(typeof(PlaybackStatusHasChanged_t), (unmanaged) => {
- PlaybackStatusHasChanged_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- }
-
- return result;
- });
- marshallers.Add(typeof(VolumeHasChanged_t), (unmanaged) => {
- VolumeHasChanged_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_flNewVolume = value.m_flNewVolume;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_flNewVolume = value.m_flNewVolume;
- }
-
- return result;
- });
- marshallers.Add(typeof(MusicPlayerRemoteWillActivate_t), (unmanaged) => {
- MusicPlayerRemoteWillActivate_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- }
-
- return result;
- });
- marshallers.Add(typeof(MusicPlayerRemoteWillDeactivate_t), (unmanaged) => {
- MusicPlayerRemoteWillDeactivate_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- }
-
- return result;
- });
- marshallers.Add(typeof(MusicPlayerRemoteToFront_t), (unmanaged) => {
- MusicPlayerRemoteToFront_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- }
-
- return result;
- });
- marshallers.Add(typeof(MusicPlayerWillQuit_t), (unmanaged) => {
- MusicPlayerWillQuit_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- }
-
- return result;
- });
- marshallers.Add(typeof(MusicPlayerWantsPlay_t), (unmanaged) => {
- MusicPlayerWantsPlay_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- }
-
- return result;
- });
- marshallers.Add(typeof(MusicPlayerWantsPause_t), (unmanaged) => {
- MusicPlayerWantsPause_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- }
-
- return result;
- });
- marshallers.Add(typeof(MusicPlayerWantsPlayPrevious_t), (unmanaged) => {
- MusicPlayerWantsPlayPrevious_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- }
-
- return result;
- });
- marshallers.Add(typeof(MusicPlayerWantsPlayNext_t), (unmanaged) => {
- MusicPlayerWantsPlayNext_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- }
-
- return result;
- });
- marshallers.Add(typeof(MusicPlayerWantsShuffled_t), (unmanaged) => {
- MusicPlayerWantsShuffled_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_bShuffled = value.m_bShuffled;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_bShuffled = value.m_bShuffled;
- }
-
- return result;
- });
- marshallers.Add(typeof(MusicPlayerWantsLooped_t), (unmanaged) => {
- MusicPlayerWantsLooped_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_bLooped = value.m_bLooped;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_bLooped = value.m_bLooped;
- }
-
- return result;
- });
- marshallers.Add(typeof(MusicPlayerWantsVolume_t), (unmanaged) => {
- MusicPlayerWantsVolume_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_flNewVolume = value.m_flNewVolume;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_flNewVolume = value.m_flNewVolume;
- }
-
- return result;
- });
- marshallers.Add(typeof(MusicPlayerSelectsQueueEntry_t), (unmanaged) => {
- MusicPlayerSelectsQueueEntry_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.nID = value.nID;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.nID = value.nID;
- }
-
- return result;
- });
- marshallers.Add(typeof(MusicPlayerSelectsPlaylistEntry_t), (unmanaged) => {
- MusicPlayerSelectsPlaylistEntry_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.nID = value.nID;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.nID = value.nID;
- }
-
- return result;
- });
- marshallers.Add(typeof(MusicPlayerWantsPlayingRepeatStatus_t), (unmanaged) => {
- MusicPlayerWantsPlayingRepeatStatus_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_nPlayingRepeatStatus = value.m_nPlayingRepeatStatus;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_nPlayingRepeatStatus = value.m_nPlayingRepeatStatus;
- }
-
- return result;
- });
- marshallers.Add(typeof(P2PSessionState_t), (unmanaged) => {
- P2PSessionState_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_bConnectionActive = value.m_bConnectionActive;
- result.m_bConnecting = value.m_bConnecting;
- result.m_eP2PSessionError = value.m_eP2PSessionError;
- result.m_bUsingRelay = value.m_bUsingRelay;
- result.m_nBytesQueuedForSend = value.m_nBytesQueuedForSend;
- result.m_nPacketsQueuedForSend = value.m_nPacketsQueuedForSend;
- result.m_nRemoteIP = value.m_nRemoteIP;
- result.m_nRemotePort = value.m_nRemotePort;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_bConnectionActive = value.m_bConnectionActive;
- result.m_bConnecting = value.m_bConnecting;
- result.m_eP2PSessionError = value.m_eP2PSessionError;
- result.m_bUsingRelay = value.m_bUsingRelay;
- result.m_nBytesQueuedForSend = value.m_nBytesQueuedForSend;
- result.m_nPacketsQueuedForSend = value.m_nPacketsQueuedForSend;
- result.m_nRemoteIP = value.m_nRemoteIP;
- result.m_nRemotePort = value.m_nRemotePort;
- }
-
- return result;
- });
- marshallers.Add(typeof(P2PSessionRequest_t), (unmanaged) => {
- P2PSessionRequest_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_steamIDRemote = value.m_steamIDRemote;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_steamIDRemote = value.m_steamIDRemote;
- }
-
- return result;
- });
- marshallers.Add(typeof(SteamNetworkingMessagesSessionRequest_t), (unmanaged) => {
- SteamNetworkingMessagesSessionRequest_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_identityRemote = value.m_identityRemote;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_identityRemote = value.m_identityRemote;
- }
-
- return result;
- });
- marshallers.Add(typeof(SteamNetworkingMessagesSessionFailed_t), (unmanaged) => {
- SteamNetworkingMessagesSessionFailed_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_info = value.m_info;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_info = value.m_info;
- }
-
- return result;
- });
- marshallers.Add(typeof(SteamNetConnectionStatusChangedCallback_t), (unmanaged) => {
- SteamNetConnectionStatusChangedCallback_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_hConn = value.m_hConn;
- result.m_info = value.m_info;
- result.m_eOldState = value.m_eOldState;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_hConn = value.m_hConn;
- result.m_info = value.m_info;
- result.m_eOldState = value.m_eOldState;
- }
-
- return result;
- });
- marshallers.Add(typeof(SteamNetAuthenticationStatus_t), (unmanaged) => {
- SteamNetAuthenticationStatus_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eAvail = value.m_eAvail;
- result.m_debugMsg_ = value.m_debugMsg_;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eAvail = value.m_eAvail;
- result.m_debugMsg_ = value.m_debugMsg_;
- }
-
- return result;
- });
- marshallers.Add(typeof(SteamRelayNetworkStatus_t), (unmanaged) => {
- SteamRelayNetworkStatus_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eAvail = value.m_eAvail;
- result.m_bPingMeasurementInProgress = value.m_bPingMeasurementInProgress;
- result.m_eAvailNetworkConfig = value.m_eAvailNetworkConfig;
- result.m_eAvailAnyRelay = value.m_eAvailAnyRelay;
- result.m_debugMsg_ = value.m_debugMsg_;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eAvail = value.m_eAvail;
- result.m_bPingMeasurementInProgress = value.m_bPingMeasurementInProgress;
- result.m_eAvailNetworkConfig = value.m_eAvailNetworkConfig;
- result.m_eAvailAnyRelay = value.m_eAvailAnyRelay;
- result.m_debugMsg_ = value.m_debugMsg_;
- }
-
- return result;
- });
- marshallers.Add(typeof(SteamParentalSettingsChanged_t), (unmanaged) => {
- SteamParentalSettingsChanged_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- }
-
- return result;
- });
- marshallers.Add(typeof(RemotePlayInputMouseMotion_t), (unmanaged) => {
- RemotePlayInputMouseMotion_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_bAbsolute = value.m_bAbsolute;
- result.m_flNormalizedX = value.m_flNormalizedX;
- result.m_flNormalizedY = value.m_flNormalizedY;
- result.m_nDeltaX = value.m_nDeltaX;
- result.m_nDeltaY = value.m_nDeltaY;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_bAbsolute = value.m_bAbsolute;
- result.m_flNormalizedX = value.m_flNormalizedX;
- result.m_flNormalizedY = value.m_flNormalizedY;
- result.m_nDeltaX = value.m_nDeltaX;
- result.m_nDeltaY = value.m_nDeltaY;
- }
-
- return result;
- });
- marshallers.Add(typeof(RemotePlayInputMouseWheel_t), (unmanaged) => {
- RemotePlayInputMouseWheel_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eDirection = value.m_eDirection;
- result.m_flAmount = value.m_flAmount;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eDirection = value.m_eDirection;
- result.m_flAmount = value.m_flAmount;
- }
-
- return result;
- });
- marshallers.Add(typeof(RemotePlayInputKey_t), (unmanaged) => {
- RemotePlayInputKey_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eScancode = value.m_eScancode;
- result.m_unModifiers = value.m_unModifiers;
- result.m_unKeycode = value.m_unKeycode;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_eScancode = value.m_eScancode;
- result.m_unModifiers = value.m_unModifiers;
- result.m_unKeycode = value.m_unKeycode;
- }
-
- return result;
- });
- marshallers.Add(typeof(SteamRemotePlaySessionConnected_t), (unmanaged) => {
- SteamRemotePlaySessionConnected_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_unSessionID = value.m_unSessionID;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_unSessionID = value.m_unSessionID;
- }
-
- return result;
- });
- marshallers.Add(typeof(SteamRemotePlaySessionDisconnected_t), (unmanaged) => {
- SteamRemotePlaySessionDisconnected_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_unSessionID = value.m_unSessionID;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_unSessionID = value.m_unSessionID;
- }
-
- return result;
- });
- marshallers.Add(typeof(SteamRemotePlayTogetherGuestInvite_t), (unmanaged) => {
- SteamRemotePlayTogetherGuestInvite_t result = default;
-
- if (Packsize.IsLargePack) {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure(unmanaged);
- result.m_szConnectURL_ = value.m_szConnectURL_;
- } else {
- var value = System.Runtime.InteropServices.Marshal.PtrToStructure