From 4a00e944a6a91f3014916611a7ca97e00a0558cf Mon Sep 17 00:00:00 2001 From: walon Date: Fri, 14 Oct 2022 16:15:18 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E4=BF=AE=E5=A4=8DReversePInvokeWrapper?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Data~/Templates/ReversePInvokeMethodStub.cpp.txt | 5 +++-- Editor/ReversePInvokeWrap/Generator.cs | 9 --------- package.json | 2 +- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Data~/Templates/ReversePInvokeMethodStub.cpp.txt b/Data~/Templates/ReversePInvokeMethodStub.cpp.txt index 1f298b9..736aebe 100644 --- a/Data~/Templates/ReversePInvokeMethodStub.cpp.txt +++ b/Data~/Templates/ReversePInvokeMethodStub.cpp.txt @@ -5,15 +5,16 @@ namespace hybridclr { namespace metadata { - //!!!{{REVERSE_PINVOKE_METHOD_STUB void CallLuaFunction(void* xState, int32_t wrapperIndex) { const MethodInfo* method = MetadataModule::GetMethodInfoByReversePInvokeWrapperIndex(wrapperIndex); typedef void (*Callback)(void* xState, const MethodInfo* method); - ((Callback)GetInterpreterDirectlyCallMethodPointer(method))(xState, method); + ((Callback)(method->methodPointerCallByInterp))(xState, method); } + //!!!{{REVERSE_PINVOKE_METHOD_STUB + void __ReversePInvokeMethod_0(void* xState) { CallLuaFunction(xState, 0); diff --git a/Editor/ReversePInvokeWrap/Generator.cs b/Editor/ReversePInvokeWrap/Generator.cs index f765b9f..78de478 100644 --- a/Editor/ReversePInvokeWrap/Generator.cs +++ b/Editor/ReversePInvokeWrap/Generator.cs @@ -15,15 +15,6 @@ namespace HybridCLR.Editor.ReversePInvokeWrap var frr = new FileRegionReplace(template); var codes = new List(); - codes.Add(@" - void CallLuaFunction(void* xState, int32_t wrapperIndex) - { - const MethodInfo* method = MetadataModule::GetMethodInfoByReversePInvokeWrapperIndex(wrapperIndex); - typedef void (*Callback)(void* xState, const MethodInfo* method); - ((Callback)GetInterpreterDirectlyCallMethodPointer(method))(xState, method); - } -"); - for(int i = 0; i < wrapperCount; i++) { codes.Add($@" diff --git a/package.json b/package.json index cadce58..3ca0f00 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.focus-creative-games.hybridclr_unity", - "version": "0.4.1", + "version": "0.4.2", "displayName": "HybridCLR", "description": "Unity package for HybridCLR. It includes editor and runtime scripts and assets for HybridCLR", "category": "Runtime",