From 0f3747f4c3ae2344ef662433d4b232f8e3e0f4b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fa=E9=B8=BD?= <43724908+Akarinnnnn@users.noreply.github.com> Date: Tue, 15 Jul 2025 17:41:34 +0800 Subject: [PATCH] Generate callback info on async interface methods --- CodeGen/src/interfaces.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CodeGen/src/interfaces.py b/CodeGen/src/interfaces.py index a007b5d2..f6c2a440 100644 --- a/CodeGen/src/interfaces.py +++ b/CodeGen/src/interfaces.py @@ -850,6 +850,23 @@ def parse_func(f, interface, func): if c: g_Output.append("\t\t/// " + c + "") g_Output.append("\t\t/// ") + + strAsyncType: str = None + strAsyncStruct: str = None + + for attr in func.attributes: + if attr.name in ("STEAM_CALL_RESULT", "STEAM_CALL_BACK"): + if attr.name == "STEAM_CALL_RESULT": + strAsyncType = "CallResult" + elif attr.name == "STEAM_CALL_BACK": + strAsyncType = "Callback" + strAsyncStruct = attr.value + + + if strAsyncType is not None: + g_Output.append(f"\t\t[SteamHasAsync{strAsyncType}(typeof({strAsyncStruct}))]") + + g_Output.append("\t\tpublic static " + wrapperreturntype + " " + func.name.rstrip("0") + "(" + wrapperargs + ") {") g_Output.extend(functionBody)