From 77b7dea7bc93494e85502d7ab0708bdd4141cd56 Mon Sep 17 00:00:00 2001 From: walon Date: Wed, 26 Oct 2022 11:28:49 +0800 Subject: [PATCH] =?UTF-8?q?[new]=20=20=E8=A1=A5=E5=85=85=E5=85=83=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=94=AF=E6=8C=81=E4=BD=BF=E7=94=A8=E8=B6=85=E9=9B=86?= =?UTF-8?q?aot=20dll=EF=BC=8C=E4=B9=9F=E5=B0=B1=E6=98=AF=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=8E=9F=E5=A7=8Baot=20dll=E8=80=8C=E4=B8=8D?= =?UTF-8?q?=E5=86=8D=E9=99=90=E5=AE=9A=E6=98=AF=E8=A3=81=E5=87=8F=E5=90=8E?= =?UTF-8?q?=E7=9A=84aot=20dll?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Editor/Installer/InstallerController.cs | 4 ---- Runtime/HomologousImageMode.cs | 10 ++++++++++ Runtime/HomologousImageMode.cs.meta | 11 +++++++++++ Runtime/LoadImageErrorCode.cs | 3 ++- Runtime/RuntimeApi.cs | 6 +++--- package.json | 2 +- 6 files changed, 27 insertions(+), 9 deletions(-) create mode 100644 Runtime/HomologousImageMode.cs create mode 100644 Runtime/HomologousImageMode.cs.meta diff --git a/Editor/Installer/InstallerController.cs b/Editor/Installer/InstallerController.cs index 84d641e..84c895e 100644 --- a/Editor/Installer/InstallerController.cs +++ b/Editor/Installer/InstallerController.cs @@ -68,10 +68,6 @@ namespace HybridCLR.Editor.Installer public string Il2CppBranch => GetIl2CppPlusBranchByUnityVersion(Application.unityVersion); - public string InitLocalIl2CppBatFile => Application.dataPath + "/../HybridCLRData/init_local_il2cpp_data.bat"; - - public string InitLocalIl2CppBashFile => Application.dataPath + "/../HybridCLRData/init_local_il2cpp_data.sh"; - public InstallerController() { PrepareIl2CppInstallPath(); diff --git a/Runtime/HomologousImageMode.cs b/Runtime/HomologousImageMode.cs new file mode 100644 index 0000000..dd839ca --- /dev/null +++ b/Runtime/HomologousImageMode.cs @@ -0,0 +1,10 @@ + +namespace HybridCLR +{ + public enum HomologousImageMode + { + Consistent, // AOT dll需要跟主工程精确一致,即为裁剪后的AO dll + SuperSet, // AOT dll不需要跟主工程精确一致,但必须包含裁剪后的AOT dll的所有元数据,即为裁剪后dll的超集。推荐使用原始aot dll + } +} + diff --git a/Runtime/HomologousImageMode.cs.meta b/Runtime/HomologousImageMode.cs.meta new file mode 100644 index 0000000..dde78bf --- /dev/null +++ b/Runtime/HomologousImageMode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0f0351553ad90e74aa586746b5965ded +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/LoadImageErrorCode.cs b/Runtime/LoadImageErrorCode.cs index 24e0ee6..195122a 100644 --- a/Runtime/LoadImageErrorCode.cs +++ b/Runtime/LoadImageErrorCode.cs @@ -1,7 +1,7 @@  namespace HybridCLR { - public enum LoadImageErrorCode + public enum LoadImageErrorCode { OK = 0, BAD_IMAGE, // dll 不合法 @@ -9,6 +9,7 @@ namespace HybridCLR AOT_ASSEMBLY_NOT_FIND, // 对应的AOT assembly未找到 HOMOLOGOUS_ONLY_SUPPORT_AOT_ASSEMBLY, // 不能给解释器assembly补充元数据 HOMOLOGOUS_ASSEMBLY_HAS_LOADED, // 已经补充过了,不能再次补充 + INVALID_HOMOLOGOUS_MODE, // 非法HomologousImageMode }; } diff --git a/Runtime/RuntimeApi.cs b/Runtime/RuntimeApi.cs index 2c0bc0b..e8fb681 100644 --- a/Runtime/RuntimeApi.cs +++ b/Runtime/RuntimeApi.cs @@ -24,14 +24,14 @@ namespace HybridCLR /// /// /// - public static unsafe LoadImageErrorCode LoadMetadataForAOTAssembly(byte[] dllBytes) + public static unsafe LoadImageErrorCode LoadMetadataForAOTAssembly(byte[] dllBytes, HomologousImageMode mode) { #if UNITY_EDITOR return LoadImageErrorCode.OK; #else fixed(byte* data = dllBytes) { - return (LoadImageErrorCode)LoadMetadataForAOTAssembly((IntPtr)data, dllBytes.Length); + return (LoadImageErrorCode)LoadMetadataForAOTAssembly((IntPtr)data, dllBytes.Length, (int)mode); } #endif } @@ -43,7 +43,7 @@ namespace HybridCLR /// /// [DllImport(dllName, EntryPoint = "RuntimeApi_LoadMetadataForAOTAssembly")] - public static extern int LoadMetadataForAOTAssembly(IntPtr dllBytes, int dllSize); + public static extern int LoadMetadataForAOTAssembly(IntPtr dllBytes, int dllSize, int mode); /// /// 获取解释器线程栈的最大StackObject个数(size*8 为最终占用的内存大小) diff --git a/package.json b/package.json index 256817b..4d1a0b0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.focus-creative-games.hybridclr_unity", - "version": "0.8.0", + "version": "0.9.0", "displayName": "HybridCLR", "description": "Unity package for HybridCLR. It includes editor and runtime scripts and assets for HybridCLR", "category": "Runtime",