mirror of
https://github.com/focus-creative-games/hybridclr_unity.git
synced 2026-11-20 07:22:39 +08:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d205f00a1b | |||
| 2894701063 | |||
| 1045538b40 | |||
| 8fd9b2ec82 | |||
| 0ccdd424ab | |||
| c083e4ada4 | |||
| 4c6dd1249a | |||
| b8b990bfc1 | |||
| 252e6add67 | |||
| 6e76b96f97 | |||
| dd18ecdba5 | |||
| 2ff3e276d2 | |||
| 1d5f2a953c | |||
| 75cb53cb19 | |||
| c84f575a2e | |||
| 3beb788baa | |||
| 6909c32a0c | |||
| bbb43c3185 |
+3
-1
@@ -1,5 +1,7 @@
|
||||
# change logs
|
||||
|
||||
- 2022.8.30 创建
|
||||
- 2023.04.29 Installer支持从本地目录复制改造后的libil2cpp
|
||||
- 2023.03.28 `HybridCLR/Generate/Il2CppDef`生成的代码位置移到`hybridclr/generated`下
|
||||
- 2022.08.30 创建
|
||||
|
||||
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
"versions": [
|
||||
{
|
||||
"unity_version":"2019",
|
||||
"hybridclr" : { "branch":"v2.0.2"},
|
||||
"il2cpp_plus": { "branch":"v2019-2.0.1"}
|
||||
"hybridclr" : { "branch":"v2.1.0"},
|
||||
"il2cpp_plus": { "branch":"v2019-2.1.0"}
|
||||
},
|
||||
{
|
||||
"unity_version":"2020",
|
||||
"hybridclr" : { "branch":"v2.0.2"},
|
||||
"il2cpp_plus": { "branch":"v2020-2.0.2"}
|
||||
"hybridclr" : { "branch":"v2.2.0"},
|
||||
"il2cpp_plus": { "branch":"v2020-2.2.0"}
|
||||
},
|
||||
{
|
||||
"unity_version":"2021",
|
||||
"hybridclr" : { "branch":"v2.0.2"},
|
||||
"il2cpp_plus": { "branch":"v2021-2.0.2"}
|
||||
"hybridclr" : { "branch":"v2.2.0"},
|
||||
"il2cpp_plus": { "branch":"v2021-2.2.0"}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -42,11 +42,11 @@ namespace HybridCLR.Editor.UnityBinFileReader
|
||||
writer.Write(new EndianBinaryWriter(output));
|
||||
Debug.Log($"patch file:{dataunity3dFile} size:{output.Length}");
|
||||
|
||||
string bakFile = dataunity3dFile + ".bak";
|
||||
if (!File.Exists(bakFile))
|
||||
{
|
||||
File.Copy(dataunity3dFile, bakFile);
|
||||
}
|
||||
//string bakFile = dataunity3dFile + ".bak";
|
||||
//if (!File.Exists(bakFile))
|
||||
//{
|
||||
// File.Copy(dataunity3dFile, bakFile);
|
||||
//}
|
||||
File.WriteAllBytes(dataunity3dFile, output.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Runtime.CompilerServices;
|
||||
using MonoHook;
|
||||
using HybridCLR.Editor.BuildProcessors;
|
||||
using System.IO;
|
||||
|
||||
namespace HybridCLR.MonoHook
|
||||
{
|
||||
#if UNITY_2021_1_OR_NEWER && UNITY_WEBGL
|
||||
[InitializeOnLoad]
|
||||
public class PatchScriptingAssembliesJsonHook
|
||||
{
|
||||
private static MethodHook _hook;
|
||||
|
||||
static PatchScriptingAssembliesJsonHook()
|
||||
{
|
||||
if (_hook == null)
|
||||
{
|
||||
Type type = typeof(UnityEditor.EditorApplication);
|
||||
MethodInfo miTarget = type.GetMethod("BuildMainWindowTitle", BindingFlags.Static | BindingFlags.NonPublic);
|
||||
|
||||
MethodInfo miReplacement = new Func<string>(BuildMainWindowTitle).Method;
|
||||
MethodInfo miProxy = new Func<string>(BuildMainWindowTitleProxy).Method;
|
||||
|
||||
_hook = new MethodHook(miTarget, miReplacement, miProxy);
|
||||
_hook.Install();
|
||||
}
|
||||
}
|
||||
|
||||
private static string BuildMainWindowTitle()
|
||||
{
|
||||
string tempJsonPath = $"{Application.dataPath}/../Library/PlayerDataCache/WebGL/Data/ScriptingAssemblies.json";
|
||||
if (File.Exists(tempJsonPath))
|
||||
{
|
||||
var patcher = new PatchScriptingAssemblyList();
|
||||
patcher.PathScriptingAssembilesFile(Path.GetDirectoryName(tempJsonPath));
|
||||
}
|
||||
string newTitle = BuildMainWindowTitleProxy();
|
||||
return newTitle;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.NoOptimization)]
|
||||
private static string BuildMainWindowTitleProxy()
|
||||
{
|
||||
// 为满足MonoHook要求的最小代码长度而特地加入的无用填充代码,
|
||||
UnityEngine.Debug.Log(12345.ToString());
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc89a9041ab48ac41975fbd1e00b9b98
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
Desc: 一个可以运行时 Hook Mono 方法的工具,让你可以无需修改 UnityEditor.dll 等文件就可以重写其函数功能
|
||||
Author: Misaka Mikoto
|
||||
Github: https://github.com/Misaka-Mikoto-Tech/MonoHook
|
||||
@@ -85,7 +85,7 @@ namespace MonoHook
|
||||
|
||||
private CodePatcher _codePatcher;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
#if UNITY_EDITOR && !UNITY_2020_3_OR_NEWER
|
||||
/// <summary>
|
||||
/// call `MethodInfo.MethodHandle.GetFunctionPointer()`
|
||||
/// will visit static class `UnityEditor.IMGUI.Controls.TreeViewGUI.Styles` and invoke its static constructor,
|
||||
@@ -97,7 +97,7 @@ namespace MonoHook
|
||||
|
||||
static MethodHook()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
#if UNITY_EDITOR && !UNITY_2020_3_OR_NEWER
|
||||
s_fi_GUISkin_current = typeof(GUISkin).GetField("current", BindingFlags.Static | BindingFlags.NonPublic);
|
||||
#endif
|
||||
}
|
||||
@@ -126,7 +126,7 @@ namespace MonoHook
|
||||
if (isHooked)
|
||||
return;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
#if UNITY_EDITOR && !UNITY_2020_3_OR_NEWER
|
||||
if (s_fi_GUISkin_current.GetValue(null) != null)
|
||||
DoInstall();
|
||||
else
|
||||
@@ -191,7 +191,7 @@ namespace MonoHook
|
||||
if (targetMethod.IsAbstract)
|
||||
throw new Exception($"WRANING: you can not hook abstract method [{methodName}]");
|
||||
|
||||
#if UNITY_EDITOR
|
||||
#if UNITY_EDITOR && !UNITY_2020_3_OR_NEWER
|
||||
int minMethodBodySize = 10;
|
||||
|
||||
{
|
||||
@@ -358,7 +358,7 @@ namespace MonoHook
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
#if UNITY_EDITOR && !UNITY_2020_3_OR_NEWER
|
||||
private void OnEditorUpdate()
|
||||
{
|
||||
if (s_fi_GUISkin_current.GetValue(null) != null)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 82346623158bae349a8347ae74662b12
|
||||
guid: 16b9dc031f67b4fe5ad79c230f75768c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
||||
@@ -261,7 +261,15 @@ namespace HybridCLR.Editor.ABI
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return fields.All(f => f.IsStatic);
|
||||
if (fields.All(f => f.IsStatic))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (typeDef.IsExplicitLayout && fields.Count(f => !f.IsStatic) > 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected static TypeInfo CreateGeneralValueType(TypeSig type, int size, int aligment)
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -11,6 +12,52 @@ namespace HybridCLR.Editor.AOT
|
||||
{
|
||||
public class GenericReferenceWriter
|
||||
{
|
||||
private static readonly Dictionary<Type, string> _typeNameMapping = new Dictionary<Type, string>
|
||||
{
|
||||
{typeof(bool), "bool" },
|
||||
{typeof(byte), "byte" },
|
||||
{typeof(sbyte), "sbyte" },
|
||||
{typeof(short), "short" },
|
||||
{typeof(ushort), "ushort" },
|
||||
{typeof(int), "int" },
|
||||
{typeof(uint), "uint" },
|
||||
{typeof(long), "long" },
|
||||
{typeof(ulong), "ulong" },
|
||||
{typeof(float), "float" },
|
||||
{typeof(double), "double" },
|
||||
{typeof(object), "object" },
|
||||
{typeof(string), "string" },
|
||||
};
|
||||
|
||||
private readonly Dictionary<string, string> _typeSimpleNameMapping = new Dictionary<string, string>();
|
||||
private readonly Regex _systemTypePattern;
|
||||
private readonly Regex _genericPattern = new Regex(@"`\d+");
|
||||
|
||||
public GenericReferenceWriter()
|
||||
{
|
||||
foreach (var e in _typeNameMapping)
|
||||
{
|
||||
_typeSimpleNameMapping.Add(e.Key.FullName, e.Value);
|
||||
}
|
||||
_systemTypePattern = new Regex(string.Join("|", _typeSimpleNameMapping.Keys.Select (k => $@"\b{k}\b")));
|
||||
}
|
||||
|
||||
public string PrettifyTypeSig(string typeSig)
|
||||
{
|
||||
string s = _genericPattern.Replace(typeSig, "").Replace('/', '.');
|
||||
return _systemTypePattern.Replace(s, m => _typeSimpleNameMapping[m.Groups[0].Value]);
|
||||
}
|
||||
|
||||
public string PrettifyMethodSig(string methodSig)
|
||||
{
|
||||
string s = PrettifyTypeSig(methodSig).Replace("::", ".");
|
||||
if (s.Contains(".ctor("))
|
||||
{
|
||||
s = "new " + s.Replace(".ctor(", "(");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
public void Write(List<GenericClass> types, List<GenericMethod> methods, string outputFile)
|
||||
{
|
||||
string parentDir = Directory.GetParent(outputFile).FullName;
|
||||
@@ -20,18 +67,30 @@ namespace HybridCLR.Editor.AOT
|
||||
codes.Add("public class AOTGenericReferences : UnityEngine.MonoBehaviour");
|
||||
codes.Add("{");
|
||||
|
||||
codes.Add("");
|
||||
codes.Add("\t// {{ AOT assemblies");
|
||||
List<dnlib.DotNet.ModuleDef> modules = new HashSet<dnlib.DotNet.ModuleDef>(
|
||||
types.Select(t => t.Type.Module).Concat(methods.Select(m => m.Method.Module))).ToList();
|
||||
modules.Sort((a, b) => a.Name.CompareTo(b.Name));
|
||||
foreach (dnlib.DotNet.ModuleDef module in modules)
|
||||
{
|
||||
codes.Add($"\t// {module.Name}");
|
||||
}
|
||||
codes.Add("\t// }}");
|
||||
|
||||
|
||||
codes.Add("");
|
||||
codes.Add("\t// {{ constraint implement type");
|
||||
|
||||
codes.Add("\t// }} ");
|
||||
|
||||
codes.Add("");
|
||||
codes.Add("\t// {{ AOT generic type");
|
||||
codes.Add("\t// {{ AOT generic types");
|
||||
|
||||
types.Sort((a, b) => a.Type.FullName.CompareTo(b.Type.FullName));
|
||||
foreach(var type in types)
|
||||
{
|
||||
codes.Add($"\t//{type.ToTypeSig()}");
|
||||
codes.Add($"\t// {PrettifyTypeSig(type.ToTypeSig().ToString())}");
|
||||
}
|
||||
|
||||
codes.Add("\t// }}");
|
||||
@@ -51,7 +110,7 @@ namespace HybridCLR.Editor.AOT
|
||||
});
|
||||
foreach(var method in methods)
|
||||
{
|
||||
codes.Add($"\t\t// {method.ToMethodSpec()}");
|
||||
codes.Add($"\t\t// {PrettifyMethodSig(method.ToMethodSpec().ToString())}");
|
||||
}
|
||||
codes.Add("\t}");
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace HybridCLR.Editor.BuildProcessors
|
||||
#endif
|
||||
}
|
||||
|
||||
private void PathScriptingAssembilesFile(string path)
|
||||
public void PathScriptingAssembilesFile(string path)
|
||||
{
|
||||
if (!SettingsUtil.Enable)
|
||||
{
|
||||
|
||||
@@ -19,8 +19,8 @@ namespace HybridCLR.Editor.Commands
|
||||
{
|
||||
UnityVersion = Application.unityVersion,
|
||||
HotUpdateAssemblies = SettingsUtil.HotUpdateAssemblyNamesIncludePreserved,
|
||||
OutputFile = $"{SettingsUtil.LocalIl2CppDir}/libil2cpp/il2cpp-config.h",
|
||||
OutputFile2 = $"{SettingsUtil.LocalIl2CppDir}/libil2cpp/hybridclr/Il2CppCompatibleDef.cpp",
|
||||
OutputFile = $"{SettingsUtil.LocalIl2CppDir}/libil2cpp/hybridclr/generated/UnityVersion.h",
|
||||
OutputFile2 = $"{SettingsUtil.LocalIl2CppDir}/libil2cpp/hybridclr/generated/AssemblyManifest.cpp",
|
||||
};
|
||||
|
||||
var g = new Il2CppDef.Il2CppDefGenerator(options);
|
||||
|
||||
@@ -38,6 +38,9 @@ namespace HybridCLR.Editor.Commands
|
||||
BashUtil.RemoveDir(outputPath);
|
||||
|
||||
var buildOptions = BuildOptions.BuildScriptsOnly;
|
||||
#if UNITY_2021_1_OR_NEWER
|
||||
buildOptions |= BuildOptions.CleanBuildCache;
|
||||
#endif
|
||||
|
||||
bool oldExportAndroidProj = EditorUserBuildSettings.exportAsGoogleAndroidProject;
|
||||
#if UNITY_EDITOR_OSX
|
||||
@@ -110,8 +113,7 @@ namespace HybridCLR.Editor.Commands
|
||||
|
||||
if (report.summary.result != UnityEditor.Build.Reporting.BuildResult.Succeeded)
|
||||
{
|
||||
Debug.LogError("GenerateStripedAOTDlls 失败");
|
||||
return;
|
||||
throw new Exception("GenerateStripedAOTDlls 失败");
|
||||
}
|
||||
Debug.Log($"GenerateStripedAOTDlls target:{target} group:{group} path:{outputPath}");
|
||||
}
|
||||
|
||||
@@ -88,6 +88,21 @@ namespace HybridCLR.Editor.Installer
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
|
||||
private static void CopyWithCheckLongFile(string srcFile, string dstFile)
|
||||
{
|
||||
if (srcFile.Length > 255)
|
||||
{
|
||||
UnityEngine.Debug.LogError($"srcFile:{srcFile} path is too long. copy ignore!");
|
||||
return;
|
||||
}
|
||||
if (dstFile.Length > 255)
|
||||
{
|
||||
UnityEngine.Debug.LogError($"dstFile:{dstFile} path is too long. copy ignore!");
|
||||
return;
|
||||
}
|
||||
File.Copy(srcFile, dstFile);
|
||||
}
|
||||
|
||||
public static void CopyDir(string src, string dst, bool log = false)
|
||||
{
|
||||
if (log)
|
||||
@@ -98,7 +113,7 @@ namespace HybridCLR.Editor.Installer
|
||||
Directory.CreateDirectory(dst);
|
||||
foreach(var file in Directory.GetFiles(src))
|
||||
{
|
||||
File.Copy(file, $"{dst}/{Path.GetFileName(file)}");
|
||||
CopyWithCheckLongFile(file, $"{dst}/{Path.GetFileName(file)}");
|
||||
}
|
||||
foreach(var subDir in Directory.GetDirectories(src))
|
||||
{
|
||||
|
||||
@@ -166,10 +166,11 @@ namespace HybridCLR.Editor.Installer
|
||||
return $"{contentPath}/il2cpp";
|
||||
}
|
||||
|
||||
public string ApplicationIl2cppPath => GetIl2CppPathByContentPath(EditorApplication.applicationContentsPath);
|
||||
|
||||
public void InstallDefaultHybridCLR()
|
||||
{
|
||||
RunInitLocalIl2CppData(GetIl2CppPathByContentPath(EditorApplication.applicationContentsPath), _curVersion);
|
||||
InstallFromLocal(PrepareLibil2cppWithHybridclrFromGitRepo());
|
||||
}
|
||||
|
||||
public bool HasInstalledHybridCLR()
|
||||
@@ -202,7 +203,42 @@ namespace HybridCLR.Editor.Installer
|
||||
BashUtil.RunCommand(workDir, "git", new string[] {"clone", "-b", branch, "--depth", "1", repoUrl, repoDir});
|
||||
}
|
||||
|
||||
private void RunInitLocalIl2CppData(string editorIl2cppPath, UnityVersion version)
|
||||
private string PrepareLibil2cppWithHybridclrFromGitRepo()
|
||||
{
|
||||
string workDir = SettingsUtil.HybridCLRDataDir;
|
||||
Directory.CreateDirectory(workDir);
|
||||
//BashUtil.RecreateDir(workDir);
|
||||
|
||||
// clone hybridclr
|
||||
string hybridclrRepoURL = HybridCLRSettings.Instance.hybridclrRepoURL;
|
||||
string hybridclrRepoDir = $"{workDir}/{hybridclr_repo_path}";
|
||||
CloneBranch(workDir, hybridclrRepoURL, _curDefaultVersion.hybridclr.branch, hybridclrRepoDir);
|
||||
|
||||
if (!Directory.Exists(hybridclrRepoDir))
|
||||
{
|
||||
throw new Exception($"clone hybridclr fail. url: {hybridclrRepoURL}");
|
||||
}
|
||||
|
||||
// clone il2cpp_plus
|
||||
string il2cppPlusRepoURL = HybridCLRSettings.Instance.il2cppPlusRepoURL;
|
||||
string il2cppPlusRepoDir = $"{workDir}/{il2cpp_plus_repo_path}";
|
||||
CloneBranch(workDir, il2cppPlusRepoURL, _curDefaultVersion.il2cpp_plus.branch, il2cppPlusRepoDir);
|
||||
|
||||
if (!Directory.Exists(il2cppPlusRepoDir))
|
||||
{
|
||||
throw new Exception($"clone il2cpp_plus fail. url: {il2cppPlusRepoDir}");
|
||||
}
|
||||
|
||||
Directory.Move($"{hybridclrRepoDir}/hybridclr", $"{il2cppPlusRepoDir}/libil2cpp/hybridclr");
|
||||
return $"{il2cppPlusRepoDir}/libil2cpp";
|
||||
}
|
||||
|
||||
public void InstallFromLocal(string libil2cppWithHybridclrSourceDir)
|
||||
{
|
||||
RunInitLocalIl2CppData(ApplicationIl2cppPath, libil2cppWithHybridclrSourceDir, _curVersion);
|
||||
}
|
||||
|
||||
private void RunInitLocalIl2CppData(string editorIl2cppPath, string libil2cppWithHybridclrSourceDir, UnityVersion version)
|
||||
{
|
||||
if (!IsComaptibleVersion())
|
||||
{
|
||||
@@ -217,15 +253,6 @@ namespace HybridCLR.Editor.Installer
|
||||
BashUtil.RemoveDir(buildiOSDir);
|
||||
BashUtil.CopyDir($"{SettingsUtil.HybridCLRDataPathInPackage}/iOSBuild", buildiOSDir, true);
|
||||
|
||||
// clone hybridclr
|
||||
string hybridclrRepoURL = HybridCLRSettings.Instance.hybridclrRepoURL;
|
||||
string hybridclrRepoDir = $"{workDir}/{hybridclr_repo_path}";
|
||||
CloneBranch(workDir, hybridclrRepoURL, _curDefaultVersion.hybridclr.branch, hybridclrRepoDir);
|
||||
|
||||
// clone il2cpp_plus
|
||||
string il2cppPlusRepoURL = HybridCLRSettings.Instance.il2cppPlusRepoURL;
|
||||
string il2cppPlusRepoDir = $"{workDir}/{il2cpp_plus_repo_path}";
|
||||
CloneBranch(workDir, il2cppPlusRepoURL, _curDefaultVersion.il2cpp_plus.branch, il2cppPlusRepoDir);
|
||||
|
||||
// create LocalIl2Cpp
|
||||
string localUnityDataDir = SettingsUtil.LocalUnityDataDir;
|
||||
@@ -239,8 +266,7 @@ namespace HybridCLR.Editor.Installer
|
||||
|
||||
// replace libil2cpp
|
||||
string dstLibil2cppDir = $"{SettingsUtil.LocalIl2CppDir}/libil2cpp";
|
||||
BashUtil.CopyDir($"{il2cppPlusRepoDir}/libil2cpp", dstLibil2cppDir, true);
|
||||
BashUtil.CopyDir($"{hybridclrRepoDir}/hybridclr", $"{dstLibil2cppDir}/hybridclr", true);
|
||||
BashUtil.CopyDir($"{libil2cppWithHybridclrSourceDir}", dstLibil2cppDir, true);
|
||||
|
||||
// clean Il2cppBuildCache
|
||||
BashUtil.RemoveDir($"{SettingsUtil.ProjectDir}/Library/Il2cppBuildCache", true);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
@@ -10,6 +11,10 @@ namespace HybridCLR.Editor.Installer
|
||||
{
|
||||
private InstallerController _controller;
|
||||
|
||||
private bool _installFromDir;
|
||||
|
||||
private string _installLibil2cppWithHybridclrSourceDir;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
_controller = new InstallerController();
|
||||
@@ -66,6 +71,17 @@ namespace HybridCLR.Editor.Installer
|
||||
|
||||
private void GUIInstallButton(string content, string button)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
_installFromDir = EditorGUILayout.Toggle("从本地复制libil2cpp", _installFromDir);
|
||||
EditorGUI.BeginDisabledGroup(!_installFromDir);
|
||||
EditorGUILayout.TextField(_installLibil2cppWithHybridclrSourceDir, GUILayout.Width(400));
|
||||
if (GUILayout.Button("选择目录", GUILayout.Width(100)))
|
||||
{
|
||||
_installLibil2cppWithHybridclrSourceDir = EditorUtility.OpenFolderPanel("选择libil2cpp目录", Application.dataPath, "libil2cpp");
|
||||
}
|
||||
EditorGUI.EndDisabledGroup();
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
EditorGUILayout.LabelField(content);
|
||||
if (GUILayout.Button(button, GUILayout.Width(100)))
|
||||
@@ -79,6 +95,20 @@ namespace HybridCLR.Editor.Installer
|
||||
|
||||
private void InstallLocalHybridCLR()
|
||||
{
|
||||
if (_installFromDir)
|
||||
{
|
||||
if (!Directory.Exists(_installLibil2cppWithHybridclrSourceDir))
|
||||
{
|
||||
Debug.LogError($"本地libil2cpp复制目录不存在. '{_installLibil2cppWithHybridclrSourceDir}'");
|
||||
return;
|
||||
}
|
||||
if (!File.Exists($"{_installLibil2cppWithHybridclrSourceDir}/il2cpp-config.h") || !File.Exists($"{_installLibil2cppWithHybridclrSourceDir}/hybridclr/RuntimeApi.cpp"))
|
||||
{
|
||||
Debug.LogError($"本地libil2cpp不是合法有效的源码目录. '{_installLibil2cppWithHybridclrSourceDir}'");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
_controller.InstallDefaultHybridCLR();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,11 +16,14 @@ namespace HybridCLR.Editor.Meta
|
||||
}
|
||||
if (throwExIfNotFind)
|
||||
{
|
||||
#if UNITY_2021_1_OR_NEWER && UNITY_IOS
|
||||
throw new Exception($"resolve assembly:{assemblyName} 失败! 请按照Install文档正确替换了UnityEditor.CoreModule.dll或者升级hybridclr_unity到2.0.1及更高版本");
|
||||
#else
|
||||
throw new Exception($"resolve assembly:{assemblyName} 失败! 请参阅常见错误文档");
|
||||
#endif
|
||||
if (SettingsUtil.HotUpdateAssemblyNamesIncludePreserved.Contains(assemblyName))
|
||||
{
|
||||
throw new Exception($"resolve 热更新 dll:{assemblyName} 失败!请确保已经编译了热更新dll或者外部热更新路径中配置了正确的值。更多请参阅常见错误文档");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception($"resolve AOT dll:{assemblyName} 失败! 请确保主工程已经引用了该dll并且正确生成了裁剪后的AOT dll。更多请参阅常见错误文档");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ Unity Package for HybridCLR
|
||||
|
||||
## 改动日志
|
||||
|
||||
- v2.3.0 支持从本地目录直接复制hybridclr源码。轻微修复2019版本某些情况下路径过长导致安装失败的问题。
|
||||
- v2.2.0 支持2020.3.47及2021.3.23
|
||||
- v2.0.5 Installer使用tag而不是commit id,安装时不必拉取整个branch,大幅缩短安装时间
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "com.focus-creative-games.hybridclr_unity",
|
||||
"version": "2.0.7",
|
||||
"version": "2.3.0",
|
||||
"displayName": "HybridCLR",
|
||||
"description": "Unity package for HybridCLR. It includes editor and runtime scripts and assets for HybridCLR",
|
||||
"category": "Runtime",
|
||||
|
||||
Reference in New Issue
Block a user