Compare commits

...

36 Commits

Author SHA1 Message Date
walon 4d0fef095b [version] Release v7.2.0 2024-12-09 09:36:12 +08:00
walon 642d2cd644 [version] Release v7.1.0 2024-12-04 18:15:52 +08:00
walon e54ce36b0e [fix] fix the bug that CopyStrippedAOTAssemblies didn't work on UWP platform of 6000.0.x 2024-12-01 12:53:38 +08:00
walon ac8b649d50 [fix] fix the issue that CopyStrippedAOTAssemblies didn't support HMIAndroid in tuanjie engine 2024-11-25 12:46:13 +08:00
walon 9ca9cd5aa7 [new] support prejit interpreter class and method 2024-11-20 14:05:34 +08:00
walon 37dafd7b3c [change] change the attributes on fields of HybridCLRSettings from [Header] to [ToolTip] 2024-11-20 11:27:02 +08:00
walon f58d12c2cb [change] refactor code comments and translate them to English 2024-11-20 11:25:31 +08:00
walon d5eaa350c5 [change] add RuntimeOptionId::MaxInlineableMethodBodySize 2024-11-20 09:15:28 +08:00
walon 1f0053a3c9 [version] Release v7.0.0 2024-11-15 20:59:11 +08:00
walon 15dccc7427 [change] add RuntimeOptionId::MaxMethodBodyCacheSize and RuntimeOptionId::MaxMethodInlineDepth 2024-11-15 20:51:10 +08:00
walon 7d287a2293 [fix] fix the bug in MissingMetadataChecker where it did not check for missing fields. 2024-11-06 12:09:06 +08:00
walon f19ba3eb30 [fix] fix the bug in GenericReferenceWriter where _systemTypePattern did not properly escape the '.' in type names. This caused issues when compiler-generated anonymous types and functions contained string sequences like 'System-Int', incorrectly matching them to 'System.Int', resulting in runtime exceptions. 2024-11-05 18:19:13 +08:00
walon 4e172129d8 [version] Release v6.11.0 2024-10-31 09:44:33 +08:00
walon 2414e77fef [version] Release v6.10.1 2024-10-24 15:44:37 +08:00
walon 77517a9814 [fix] Fixs HookUtils compile errors in Unity 2019 and 2020 2024-10-24 15:43:35 +08:00
walon 162f21f6a5 [change] remove README_zh.md.meta, add README_EN.md.meta 2024-10-23 20:48:15 +08:00
walon bd7c3293bc [version] Release v6.10.0 2024-10-23 12:05:33 +08:00
walon e25be945c7 [change] update README.md 2024-10-23 12:02:02 +08:00
walon 925921c27c [fix] 修复MonoHook判定processorType时没有正确处理某些CPU上processorType为全大写的情况(如有些机器上返回INTEL而不是Intel) 2024-09-30 12:13:37 +08:00
walon 64a6d26fa3 [version] 发布v6.9.0版本 2024-09-27 19:37:24 +08:00
walon c24617d864 [version] 发布v6.8.0版本 2024-09-14 12:10:06 +08:00
walon 59bc259cc8 [version] 发布v6.7.1版本 2024-08-26 12:29:07 +08:00
walon c413cd6143 [version] 发布v6.7.0版本 2024-08-25 14:28:35 +08:00
walon c614cdcf4e [fix] 修复PatchScriptingAssembliesJsonHook中的断言在从WebGL平台切换到其他平台时断言失败的问题 2024-08-22 22:19:14 +08:00
walon 08f493ab3e [new] HybridCLRSettings新增enableProfilerInReleaseBuild和enableStraceTraceInWebGLReleaseBuild两个选项 2024-08-22 21:57:40 +08:00
walon 3705ca6e1f [version] 发布v6.6.0版本 2024-08-10 20:47:35 +08:00
walon 34df279943 [version] 发布v6.5.0版本 2024-08-02 15:14:05 +08:00
walon b85ed1aa92 [change] 新增LoadImageErrorCode::PDB_BAD_FILE错误码 2024-08-02 14:31:31 +08:00
walon faf4a328af [fix] 修复RELEASELOG未包含6.3和6.4版本标题的问题 2024-07-31 10:20:03 +08:00
walon 53f4f33bf0 [version] 发布v6.4.0版本 2024-07-25 10:10:16 +08:00
walon 48c91f497b [fix] 修复MethodBridge/Generator GetOrCalculateTypeInfoSignature计算等价类时未考虑到ClassLayout、Layout和FieldOffset因素的bug 2024-07-18 14:12:23 +08:00
walon 9afbe3bd84 [fix] 修复Library/PlayerDataCache目录不存在时,PatchScriptingAssembliesJsonHook运行异常的bug 2024-07-18 13:37:20 +08:00
walon 2d5f71f6b7 [version] 发布v6.3.0版本 2024-07-15 10:26:26 +08:00
walon 5747458bf2 [fix] 修复微信小游戏平台当TextureCompression非默认值时临时目录名为WinxinMiniGame{xxx},导致没有成功修改scriptingassemblies.json文件的bug 2024-07-12 17:54:59 +08:00
walon 0b455eb882 [fix] 修复 Unity 2022导出的xcode工程包含多个ShellScript片段时错误地删除了非重复片断的bug 2024-07-12 09:47:57 +08:00
walon e086228d90 [fix] 修复团结引擎微信小游戏平台由于同时定义了UNITY_WEIXINMINIGAME和UNITY_WEBGL宏,导致从错误路径查找scriptingassemblies.json文件失败,运行时出现脚本missing的bug 2024-07-02 17:00:05 +08:00
24 changed files with 804 additions and 496 deletions
+12 -12
View File
@@ -2,28 +2,28 @@
"versions": [
{
"unity_version":"2019",
"hybridclr" : { "branch":"v6.2.0"},
"il2cpp_plus": { "branch":"v2019-6.1.0"}
"hybridclr" : { "branch":"v7.2.0"},
"il2cpp_plus": { "branch":"v2019-7.0.0"}
},
{
"unity_version":"2020",
"hybridclr" : { "branch":"v6.2.0"},
"il2cpp_plus": { "branch":"v2020-6.1.0"}
"hybridclr" : { "branch":"v7.2.0"},
"il2cpp_plus": { "branch":"v2020-7.0.0"}
},
{
"unity_version":"2021",
"hybridclr" : { "branch":"v6.2.0"},
"il2cpp_plus": { "branch":"v2021-6.2.0"}
"hybridclr" : { "branch":"v7.2.0"},
"il2cpp_plus": { "branch":"v2021-7.0.0"}
},
{
"unity_version":"2022",
"hybridclr" : { "branch":"v6.2.0"},
"il2cpp_plus": { "branch":"v2022-6.1.0"}
"hybridclr" : { "branch":"v7.2.0"},
"il2cpp_plus": { "branch":"v2022-7.2.0"}
},
{
"unity_version":"2022-tuanjie",
"hybridclr" : { "branch":"v6.2.0"},
"il2cpp_plus": { "branch":"v2022-tuanjie-6.1.0"}
"hybridclr" : { "branch":"v7.2.0"},
"il2cpp_plus": { "branch":"v2022-tuanjie-7.1.0"}
},
{
"unity_version":"2023",
@@ -32,8 +32,8 @@
},
{
"unity_version":"6000",
"hybridclr" : { "branch":"v6.2.0"},
"il2cpp_plus": { "branch":"v6000-6.1.0"}
"hybridclr" : { "branch":"v7.2.0"},
"il2cpp_plus": { "branch":"v6000-7.2.0"}
}
]
}
+2 -2
View File
@@ -116,8 +116,8 @@ namespace MonoHook
static void SetupFlushICacheFunc()
{
string processorType = SystemInfo.processorType;
if (processorType.Contains("Intel") || processorType.Contains("AMD"))
string processorType = SystemInfo.processorType.ToLowerInvariant();
if (processorType.Contains("intel") || processorType.Contains("amd"))
return;
if (IntPtr.Size == 4)
@@ -35,16 +35,29 @@ namespace HybridCLR.MonoHook
private static string BuildMainWindowTitle()
{
#if UNITY_WEBGL
string tempJsonPath = $"{Application.dataPath}/../Library/PlayerDataCache/WebGL/Data/ScriptingAssemblies.json";
#elif UNITY_WEIXINMINIGAME
string tempJsonPath = $"{Application.dataPath}/../Library/PlayerDataCache/WeixinMiniGame/Data/ScriptingAssemblies.json";
#endif
if (File.Exists(tempJsonPath))
var cacheDir = $"{Application.dataPath}/../Library/PlayerDataCache";
if (Directory.Exists(cacheDir))
{
var patcher = new PatchScriptingAssemblyList();
patcher.PathScriptingAssembilesFile(Path.GetDirectoryName(tempJsonPath));
foreach (var tempJsonPath in Directory.GetDirectories(cacheDir, "*", SearchOption.TopDirectoryOnly))
{
string dirName = Path.GetFileName(tempJsonPath);
#if UNITY_WEIXINMINIGAME
if (!dirName.Contains("WeixinMiniGame"))
{
continue;
}
#else
if (!dirName.Contains("WebGL"))
{
continue;
}
#endif
var patcher = new PatchScriptingAssemblyList();
patcher.PathScriptingAssembilesFile(tempJsonPath);
}
}
string newTitle = BuildMainWindowTitleProxy();
return newTitle;
}
+1 -1
View File
@@ -39,7 +39,7 @@ namespace HybridCLR.Editor.AOT
{
_typeSimpleNameMapping.Add(e.Key.FullName, e.Value);
}
_systemTypePattern = new Regex(string.Join("|", _typeSimpleNameMapping.Keys.Select (k => $@"\b{k}\b")));
_systemTypePattern = new Regex(string.Join("|", _typeSimpleNameMapping.Keys.Select (k => $@"\b{Regex.Escape(k)}\b")));
}
public string PrettifyTypeSig(string typeSig)
@@ -2,6 +2,7 @@ using HybridCLR.Editor.Installer;
using HybridCLR.Editor.Settings;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Callbacks;
@@ -24,6 +25,31 @@ namespace HybridCLR.Editor.BuildProcessors
CopyLibil2cppToXcodeProj(pathToBuiltProject);
}
private static string TryRemoveDunplicateShellScriptSegment(string pbxprojFile, string pbxprojContent)
{
// will appear duplicated Shell Script segment when append to existed xcode project.
// This is unity bug.
// we remove duplicated Shell Script to avoid build error.
string copyFileComment = @"/\* CopyFiles \*/,\s+([A-Z0-9]{24}) /\* ShellScript \*/,\s+([A-Z0-9]{24}) /\* ShellScript \*/,";
var m = Regex.Match(pbxprojContent, copyFileComment, RegexOptions.Multiline);
if (!m.Success)
{
return pbxprojContent;
}
if (m.Groups[1].Value != m.Groups[2].Value)
{
throw new BuildFailedException($"find invalid /* ShellScript */ segment");
}
int startIndexOfDupShellScript = m.Groups[2].Index;
int endIndexOfDupShellScript = pbxprojContent.IndexOf(",", startIndexOfDupShellScript);
pbxprojContent = pbxprojContent.Remove(startIndexOfDupShellScript, endIndexOfDupShellScript + 1 - startIndexOfDupShellScript);
Debug.LogWarning($"[AddLil2cppSourceCodeToXcodeproj] remove duplicated '/* ShellScript */' from file '{pbxprojFile}'");
return pbxprojContent;
}
private static void RemoveExternalLibil2cppOption(string pbxprojFile)
{
string pbxprojContent = File.ReadAllText(pbxprojFile, Encoding.UTF8);
@@ -38,13 +64,8 @@ namespace HybridCLR.Editor.BuildProcessors
Debug.LogWarning($"[AddLil2cppSourceCodeToXcodeproj] project.pbxproj remove building option:'{removeBuildOption}' fail. This may occur when 'Append' to existing xcode project in building");
}
int strShellScriptIndex1 = pbxprojContent.IndexOf("/* ShellScript */,");
int strShellScriptIndex2 = pbxprojContent.IndexOf("/* ShellScript */,", strShellScriptIndex1 + 10);
if (strShellScriptIndex2 >= 0)
{
pbxprojContent = pbxprojContent.Remove(strShellScriptIndex1, strShellScriptIndex2 - strShellScriptIndex1);
Debug.LogWarning($"[AddLil2cppSourceCodeToXcodeproj] remove duplicated '/* ShellScript */' from file '{pbxprojFile}'");
}
pbxprojContent = TryRemoveDunplicateShellScriptSegment(pbxprojFile, pbxprojContent);
File.WriteAllText(pbxprojFile, pbxprojContent, Encoding.UTF8);
}
@@ -35,8 +35,14 @@ namespace HybridCLR.Editor.BuildProcessors
return $"{projectDir}/Library/Bee/artifacts/WinPlayerBuildProgram/ManagedStripped";
case BuildTarget.StandaloneLinux64:
return $"{projectDir}/Library/Bee/artifacts/LinuxPlayerBuildProgram/ManagedStripped";
case BuildTarget.WSAPlayer:
return $"{projectDir}/Library/Bee/artifacts/UWPPlayerBuildProgram/ManagedStripped";
case BuildTarget.Android:
return $"{projectDir}/Library/Bee/artifacts/Android/ManagedStripped";
#if TUANJIE_2022_3_OR_NEWER
case BuildTarget.HMIAndroid:
return $"{projectDir}/Library/Bee/artifacts/HMIAndroid/ManagedStripped";
#endif
case BuildTarget.iOS:
#if UNITY_TVOS
case BuildTarget.tvOS:
@@ -44,7 +50,7 @@ namespace HybridCLR.Editor.BuildProcessors
#if UNITY_VISIONOS
case BuildTarget.VisionOS:
#endif
return $"{projectDir}/Library/Bee/artifacts/iOS/ManagedStripped";
return $"{projectDir}/Library/Bee/artifacts/iOS/ManagedStripped";
case BuildTarget.WebGL:
return $"{projectDir}/Library/Bee/artifacts/WebGL/ManagedStripped";
case BuildTarget.StandaloneOSX:
@@ -75,7 +81,6 @@ namespace HybridCLR.Editor.BuildProcessors
public void OnBeforeConvertRun(BuildReport report, Il2CppBuildPipelineData data)
{
// 此回调只在 2020中调用
BuildTarget target = report.summary.platform;
CopyStripDlls(GetStripAssembliesDir2020(target), target);
}
@@ -1,4 +1,5 @@
using HybridCLR.Editor.Link;
using HybridCLR.Editor.Settings;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -21,6 +22,8 @@ namespace HybridCLR.Editor.Commands
HotUpdateAssemblies = SettingsUtil.HotUpdateAssemblyNamesIncludePreserved,
OutputFile = $"{SettingsUtil.LocalIl2CppDir}/libil2cpp/hybridclr/generated/UnityVersion.h",
OutputFile2 = $"{SettingsUtil.LocalIl2CppDir}/libil2cpp/hybridclr/generated/AssemblyManifest.cpp",
EnableProfilerInReleaseBuild = HybridCLRSettings.Instance.enableProfilerInReleaseBuild,
EnableStraceTraceInWebGLReleaseBuild = HybridCLRSettings.Instance.enableStraceTraceInWebGLReleaseBuild,
};
var g = new Il2CppDef.Il2CppDefGenerator(options);
+14 -9
View File
@@ -61,31 +61,36 @@ namespace HybridCLR.Editor.HotUpdate
}
}
foreach (IMethodDefOrRef methodRef in mod.GetMemberRefs())
foreach (IMethodDefOrRef memberRef in mod.GetMemberRefs())
{
if (methodRef.DeclaringType.DefinitionAssembly == null)
if (memberRef.DeclaringType.DefinitionAssembly == null)
{
continue;
}
string defAssName = methodRef.DeclaringType.DefinitionAssembly.Name;
string defAssName = memberRef.DeclaringType.DefinitionAssembly.Name;
if (!_aotAssNames.Contains(defAssName))
{
continue;
}
if (methodRef.IsField)
if (memberRef.IsField)
{
IField field = (IField)memberRef;
if (field.ResolveFieldDef() == null)
{
UnityEngine.Debug.LogError($"Missing Field: {memberRef.FullName}");
anyMissing = true;
}
}
else if (methodRef.IsMethod)
else if (memberRef.IsMethod)
{
TypeSig declaringTypeSig = methodRef.DeclaringType.ToTypeSig();
if (methodRef.ResolveMethodDef() == null)
TypeSig declaringTypeSig = memberRef.DeclaringType.ToTypeSig();
if (memberRef.ResolveMethodDef() == null)
{
if (declaringTypeSig.ElementType == ElementType.Array || declaringTypeSig.ElementType == ElementType.SZArray)
{
continue;
}
UnityEngine.Debug.LogError($"Missing Method: {methodRef.FullName}");
UnityEngine.Debug.LogError($"Missing Method: {memberRef.FullName}");
anyMissing = true;
}
}
+14
View File
@@ -22,6 +22,10 @@ namespace HybridCLR.Editor.Il2CppDef
public string OutputFile2 { get; set; }
public string UnityVersion { get; set; }
public bool EnableProfilerInReleaseBuild { get; set; }
public bool EnableStraceTraceInWebGLReleaseBuild { get; set; }
}
private readonly Options _options;
@@ -77,6 +81,16 @@ namespace HybridCLR.Editor.Il2CppDef
lines.Add($"#define HYBRIDCLR_TUANJIE_VERSION 10000");
#endif
if (_options.EnableProfilerInReleaseBuild)
{
lines.Add("#define HYBRIDCLR_ENABLE_PROFILER_IN_RELEASE_BUILD 1");
}
if (_options.EnableStraceTraceInWebGLReleaseBuild)
{
lines.Add("#define HYBRIDCLR_ENABLE_STRACE_TRACE_IN_WEBGL_RELEASE_BUILD 1");
}
frr.Replace("UNITY_VERSION", string.Join("\n", lines));
frr.Commit(_options.OutputFile);
+29 -5
View File
@@ -16,6 +16,7 @@ using UnityEngine;
using TypeInfo = HybridCLR.Editor.ABI.TypeInfo;
using CallingConvention = System.Runtime.InteropServices.CallingConvention;
using System.Security.Cryptography;
using TypeAttributes = dnlib.DotNet.TypeAttributes;
namespace HybridCLR.Editor.MethodBridge
{
@@ -246,11 +247,20 @@ namespace HybridCLR.Editor.MethodBridge
_managed2NativeMethodList0.Count, _native2ManagedMethodList0.Count, _adjustThunkMethodList0.Count, _structTypes0.Count);
}
private class AnalyzeFieldInfo
{
public FieldDef field;
public TypeInfo type;
}
private class AnalyzeTypeInfo
{
public TypeInfo toSharedType;
public List<TypeInfo> fields;
public List<AnalyzeFieldInfo> fields;
public string signature;
public ClassLayout classLayout;
public TypeAttributes layout;
}
private readonly Dictionary<TypeInfo, AnalyzeTypeInfo> _analyzeTypeInfos = new Dictionary<TypeInfo, AnalyzeTypeInfo>();
@@ -266,7 +276,11 @@ namespace HybridCLR.Editor.MethodBridge
GenericArgumentContext ctx = klassInst != null ? new GenericArgumentContext(klassInst, null) : null;
ClassLayout sa = typeDef.ClassLayout;
var analyzeTypeInfo = new AnalyzeTypeInfo();
var analyzeTypeInfo = new AnalyzeTypeInfo()
{
classLayout = sa,
layout = typeDef.Layout,
};
// don't share type with explicit layout
if (sa != null)
@@ -277,7 +291,7 @@ namespace HybridCLR.Editor.MethodBridge
return analyzeTypeInfo;
}
var fields = analyzeTypeInfo.fields = new List<TypeInfo>();
var fields = analyzeTypeInfo.fields = new List<AnalyzeFieldInfo>();
foreach (FieldDef field in typeDef.Fields)
{
@@ -286,7 +300,7 @@ namespace HybridCLR.Editor.MethodBridge
continue;
}
TypeSig fieldType = ctx != null ? MetaUtil.Inflate(field.FieldType, ctx) : field.FieldType;
fields.Add(GetSharedTypeInfo(fieldType));
fields.Add(new AnalyzeFieldInfo { field = field, type = GetSharedTypeInfo(fieldType) });
}
return analyzeTypeInfo;
}
@@ -312,9 +326,19 @@ namespace HybridCLR.Editor.MethodBridge
}
var sigBuf = new StringBuilder();
if (ati.classLayout != null)
{
sigBuf.Append($"[{ati.classLayout.ClassSize}|{ati.classLayout.PackingSize}|{ati.classLayout}]");
}
if (ati.layout != 0)
{
sigBuf.Append($"[{(int)ati.layout}]");
}
foreach (var field in ati.fields)
{
sigBuf.Append("{" + GetOrCalculateTypeInfoSignature(ToIsomorphicType(field)) + "}");
string fieldOffset = field.field.FieldOffset != null ? field.field.FieldOffset.ToString() + "|" : "";
sigBuf.Append("{" + fieldOffset + GetOrCalculateTypeInfoSignature(ToIsomorphicType(field.type)) + "}");
}
return ati.signature = sigBuf.ToString();
}
-3
View File
@@ -6,9 +6,6 @@ using UnityEditorInternal;
namespace HybridCLR.Editor.Settings
{
/// <summary>
/// 监听编辑器状态,当编辑器重新 focus 时,重新加载实例,避免某些情景下 svn 、git 等外部修改了数据却无法同步的异常。
/// </summary>
[InitializeOnLoad]
public static class EditorStatusWatcher
{
+7 -1
View File
@@ -25,6 +25,9 @@ namespace HybridCLR.Editor.Settings
private SerializedProperty _outputAOTGenericReferenceFile;
private SerializedProperty _maxGenericReferenceIteration;
private SerializedProperty _maxMethodBridgeGenericIteration;
private SerializedProperty _enableProfilerInReleaseBuild;
private SerializedProperty enableStraceTraceInWebGLReleaseBuild;
private GUIStyle buttonStyle;
public HybridCLRSettingsProvider() : base("Project/HybridCLR Settings", SettingsScope.Project) { }
public override void OnActivate(string searchContext, VisualElement rootElement)
@@ -52,6 +55,8 @@ namespace HybridCLR.Editor.Settings
_outputAOTGenericReferenceFile = _serializedObject.FindProperty("outputAOTGenericReferenceFile");
_maxGenericReferenceIteration = _serializedObject.FindProperty("maxGenericReferenceIteration");
_maxMethodBridgeGenericIteration = _serializedObject.FindProperty("maxMethodBridgeGenericIteration");
_enableProfilerInReleaseBuild = _serializedObject.FindProperty("enableProfilerInReleaseBuild");
enableStraceTraceInWebGLReleaseBuild = _serializedObject.FindProperty("enableStraceTraceInWebGLReleaseBuild");
}
private void OnEditorFocused()
{
@@ -118,7 +123,6 @@ namespace HybridCLR.Editor.Settings
{
using (CreateSettingsWindowGUIScope())
{
//解决编辑器打包时出现的 _serializedObject.targetObject 意外销毁的情况
if (_serializedObject == null||!_serializedObject.targetObject)
{
InitGUI();
@@ -140,6 +144,8 @@ namespace HybridCLR.Editor.Settings
EditorGUILayout.PropertyField(_outputAOTGenericReferenceFile);
EditorGUILayout.PropertyField(_maxGenericReferenceIteration);
EditorGUILayout.PropertyField(_maxMethodBridgeGenericIteration);
EditorGUILayout.PropertyField(_enableProfilerInReleaseBuild);
EditorGUILayout.PropertyField(enableStraceTraceInWebGLReleaseBuild);
if (EditorGUI.EndChangeCheck())
{
_serializedObject.ApplyModifiedProperties();
+21 -15
View File
@@ -6,49 +6,55 @@ namespace HybridCLR.Editor.Settings
[FilePath("ProjectSettings/HybridCLRSettings.asset")]
public class HybridCLRSettings : ScriptableSingleton<HybridCLRSettings>
{
[Header("开启HybridCLR插件")]
[Tooltip("enable HybridCLR")]
public bool enable = true;
[Header("使用全局安装的il2cpp")]
[Tooltip("use il2cpp in unity editor installation location")]
public bool useGlobalIl2cpp;
[Header("hybridclr 仓库 URL")]
[Tooltip("hybridclr repo URL")]
public string hybridclrRepoURL = "https://gitee.com/focus-creative-games/hybridclr";
[Header("il2cpp_plus 仓库 URL")]
[Tooltip("il2cpp_plus repo URL")]
public string il2cppPlusRepoURL = "https://gitee.com/focus-creative-games/il2cpp_plus";
[Header("热更新Assembly Definitions")]
[Tooltip("hot update assembly definitions(asd)")]
public AssemblyDefinitionAsset[] hotUpdateAssemblyDefinitions;
[Header("热更新dlls")]
[Tooltip("hot update assembly names(without .dll suffix)")]
public string[] hotUpdateAssemblies;
[Header("预留的热更新dlls")]
[Tooltip("preserved hot update assembly names(without .dll suffix)")]
public string[] preserveHotUpdateAssemblies;
[Header("热更新dll编译输出根目录")]
[Tooltip("output directory of compiling hot update assemblies")]
public string hotUpdateDllCompileOutputRootDir = "HybridCLRData/HotUpdateDlls";
[Header("外部热更新dll搜索路径")]
[Tooltip("searching paths of external hot update assemblies")]
public string[] externalHotUpdateAssembliyDirs;
[Header("裁减后AOT dll输出根目录")]
[Tooltip("output directory of stripped AOT assemblies")]
public string strippedAOTDllOutputRootDir = "HybridCLRData/AssembliesPostIl2CppStrip";
[Header("补充元数据AOT dlls")]
[Tooltip("supplementary metadata assembly names(without .dll suffix)")]
public string[] patchAOTAssemblies;
[Header("生成的link.xml路径")]
[Tooltip("output file of automatic generated link.xml by scanning hot update assemblies")]
public string outputLinkFile = "HybridCLRGenerate/link.xml";
[Header("自动扫描生成的AOTGenericReferences.cs路径")]
[Tooltip("output file of automatic generated AOTGenericReferences.cs")]
public string outputAOTGenericReferenceFile = "HybridCLRGenerate/AOTGenericReferences.cs";
[Header("AOT泛型实例化搜索迭代次数")]
[Tooltip("max iteration count of searching generic methods in hot update assemblies")]
public int maxGenericReferenceIteration = 10;
[Header("MethodBridge泛型搜索迭代次数")]
[Tooltip("max iteration count of searching method bridge generic methods in AOT assemblies")]
public int maxMethodBridgeGenericIteration = 10;
[Tooltip("enable profiler support when publishing in release mode")]
public bool enableProfilerInReleaseBuild = false;
[Tooltip("enable StraceTrace support when publishing to the WebGL platform in release mode")]
public bool enableStraceTraceInWebGLReleaseBuild = false;
}
}
-3
View File
@@ -65,9 +65,6 @@ namespace HybridCLR.Editor
public string name;
}
/// <summary>
/// 热更新dll列表。不包含 preserveHotUpdateAssemblies。
/// </summary>
public static List<string> HotUpdateAssemblyNamesExcludePreserved
{
get
+50 -52
View File
@@ -1,6 +1,5 @@
- [README 中文](./README_zh.md)
- [README English](./README.md)
- [README 中文](./README.md)
- [README English](./README_EN.md)
# HybridCLR
@@ -11,79 +10,78 @@
<br/>
<br/>
HybridCLR is a nearly perfect Unity full-platform native c# hot update solution with complete features, zero cost, high performance, and low memory.
HybridCLR是一个**特性完整、零成本、高性能、低内存**的**近乎完美**的Unity全平台原生c#热更新解决方案。
HybridCLR expands the il2cpp runtime code, changing it from a pure [AOT](https://en.wikipedia.org/wiki/Ahead-of-time_compilation) runtime to an AOT+Interpreter hybrid runtime, and then natively supports dynamic loading of assemblies. Hot updates are fully supported from the bottom up. Games using HybridCLR technology can run efficiently not only on the Android platform, but also on IOS, Consoles, WebGL and other platforms supported by il2cpp.
HybridCLR扩充了il2cpp运行时代码,使它由纯[AOT](https://en.wikipedia.org/wiki/Ahead-of-time_compilation) runtime变成AOT+Interpreter 混合runtime,进而原生支持动态加载assembly,从底层彻底支持了热更新。使用HybridCLR技术的游戏不仅能在Android平台,也能在IOS、Consoles、WebGL等所有il2cpp支持的平台上高效运行。
Due to HybridCLR's good support for the ECMA-335 specification and its high compatibility with the Unity development workflow, the Unity project can almost seamlessly obtain the ability to hot update C# code after accessing HybridCLR. Developers do not need to change their daily development habits and Require. For the first time, HybridCLR has reduced the engineering difficulty of the Unity platform's full-platform code hot update solution to almost zero.
由于HybridCLR对ECMA-335规范 的良好支持以及对Unity开发工作流的高度兼容,Unity项目在接入HybridCLR后,可以几乎无缝地获得C#代码热更新的能力,开发者不需要改变日常开发习惯和要求。HybridCLR首次实现了将Unity平台的全平台代码热更新方案的工程难度降到几乎为零的水平。
Welcome to embrace modern native C# hot update technology! ! !
欢迎拥抱现代原生C#热更新技术 !!!
## Documentation
## 文档
- [Official Documentation](https://hybridclr.doc.code-philosophy.com/en/docs/intro)
- [Quickstart](https://hybridclr.doc.code-philosophy.com/en/docs/beginner/quickstart)
- [Release Log](./RELEASELOG.md)
- [官方文档](https://hybridclr.doc.code-philosophy.com/docs/intro)
- [快速上手](https://hybridclr.doc.code-philosophy.com/docs/beginner/quickstart)
- [商业项目案例](https://hybridclr.doc.code-philosophy.com/docs/other/businesscase)
## Features
## 特性
- A nearly complete implementation of the [ECMA-335 specification](https://www.ecma-international.org/publications-and-standards/standards/ecma-335/), with only a very small number of [unsupported features](https ://hybridclr.doc.code-philosophy.com/docs/basic/notsupportedfeatures).
- Zero learning and usage costs. For most developers, there are almost no limits to writing code. Hot update code works seamlessly with AOT code, and you can write code such as inheritance, **generics**, and **reflection** at will. No need to write any additional special code, no code generation
- Fully supports multi-threading, including but not limited to volatile, ThreadStatic, async Task and other related functions and features. This is not supported by any other hot update solution
- Almost fully compatible with Unity workflow. Including but not limited to supporting hot update **MonoBehaviour**, ScriptableObject, **DOTS** technology, the hot update script mounted on the resource can be instantiated correctly, which is not supported by all other hot update solutions.
- Efficient execution. An extremely efficient register interpreter is implemented, and all indicators are significantly better than other hot update schemes. [Performance test report](https://hybridclr.doc.code-philosophy.com/docs/basic/performance)
- Memory efficient. The classes defined in the hot update script occupy the same memory space as ordinary C# classes, which is far superior to other hot update solutions. [Memory Usage Report](https://hybridclr.doc.code-philosophy.com/docs/basic/memory)
- Supports MonoPInvokeCallback, which can interact well with native code or other languages such as lua, javascript, and python
- Supports some features not supported by il2cpp, such as __makeref, __reftype, and __refvalue instructions
- Supports the original **Differential Hybrid Execution (DHE)** differential hybrid execution technology, that is, the AOT dll can be added, deleted or modified at will, and the unmodified functions will be intelligently run in AOT mode, and the changed or added functions will be run in interpreter mode. Run, so that the running performance of the hot updated game logic can basically reach the level of native AOT.
- Supports **Hot Reload** technology, which can 100% uninstall the assembly
- Supports modern dll encryption technology to effectively ensure code security
- 近乎完整实现了[ECMA-335规范](https://www.ecma-international.org/publications-and-standards/standards/ecma-335/),只有极少量的[不支持的特性](https://hybridclr.doc.code-philosophy.com/docs/basic/notsupportedfeatures)。
- 零学习和使用成本。对绝大多数开发者来说写代码近乎没有限制。 热更新代码与AOT代码无缝工作,可以随意写继承、**泛型**、**反射**之类的代码。不需要额外写任何特殊代码、没有代码生成
- 完全支持多线程,包含但不限于 volatile、ThreadStatic、async Task等相关功能和特性。这是其他所有热更新方案都不支持的
- 几乎完全兼容Unity的工作流。包括且不限于支持热更新**MonoBehaviour**、ScriptableObject、**DOTS**技术,资源上挂载的热更新脚本可以正确实例化,这是其他所有热更新方案都不支持的
- 执行高效。实现了一个极其高效的寄存器解释器,所有指标都大幅优于其他热更新方案。[性能测试报告](https://hybridclr.doc.code-philosophy.com/docs/basic/performance)
- 内存高效。 热更新脚本中定义的类跟普通c#类占用一样的内存空间,远优于其他热更新方案。[内存占用报告](https://hybridclr.doc.code-philosophy.com/docs/basic/memory)
- 支持MonoPInvokeCallback,可以与native代码或者其他语言如lua、javascript、python良好交互
- 支持一些il2cpp不支持的特性,如__makeref、 __reftype、__refvalue指令
- 支持独创的 **Differential Hybrid Execution(DHE)** 差分混合执行技术,即可以对AOT dll任意增删改,会智能地让未改动的函数以AOT方式运行,变化或者新增的函数以interpreter模式运行,让热更新的游戏逻辑的运行性能基本达到原生AOT的水平
- 支持 **热重载** 技术,可以100%卸载程序集
- 支持现代的dll加密技术,有效保障代码安全
## Supported Unity Versions And Platforms
## 支持的版本与平台
- Supports 2019.4.x, 2020.3.x, 2021.3.x, 2022.3.x, 2023.2.x、**6000.x.y** versions
- Supports all il2cpp supported platforms
- Supports Tuanjie Engine and Harmony Platform
- 支持2019.4.x、2020.3.x、2021.3.x、2022.3.x、2023.2.x、6000.0.x全系列LTS版本
- 支持所有il2cpp支持的平台
- 支持团结引擎和鸿蒙平台
## Working Principle
## 工作原理
HybridCLR is inspired by mono's [mixed mode execution](https://www.mono-project.com/news/2017/11/13/mono-interpreter/) technology and provides additional AOT runtimes such as unity's il2cpp Interpreter modules are provided to transform them from pure AOT runtime to "AOT + Interpreter" hybrid runtime.
HybridCLR从mono的 [mixed mode execution](https://www.mono-project.com/news/2017/11/13/mono-interpreter/) 技术中得到启发,为unity的il2cpp之类的AOT runtime额外提供了interpreter模块,将它们由纯AOT运行时改造为"AOT + Interpreter"混合运行方式。
![icon](https://github.com/focus-creative-games/hybridclr/raw/main/docs/images/architecture.png)
More specifically, HybridCLR does the following:
更具体地说,HybridCLR做了以下几点工作:
- Implemented an efficient metadata (dll) parsing library
- The metadata management module has been transformed to realize dynamic registration of metadata.
- Implemented a compiler from IL instruction set to custom register instruction set
- Implemented an efficient register interpreter
- Provides a large number of additional instinct functions to improve interpreter performance
- 实现了一个高效的元数据(dll)解析库
- 改造了元数据管理模块,实现了元数据的动态注册
- 实现了一个IL指令集到自定义的寄存器指令集的compiler
- 实现了一个高效的寄存器解释器
- 额外提供大量的instinct函数,提升解释器性能
## Stability Status
## 稳定性状况
HybridCLR has been widely proven to be a very efficient and stable Unity hot update solution.
HybridCLR已经被广泛验证是非常高效、稳定的Unity热更新解决方案,良好满足大中型商业项目的稳定和性能要求。
Currently, the **extremely stable** official versions of 1.x-5.x have been released, which are sufficient to meet the stability requirements of large and medium-sized commercial projects.
Currently, thousands of commercial game projects have been connected, and hundreds of them have been launched on both ends. The online projects include MMORPG, heavy card, heavy tower defense and other games. **The vast majority of leading game companies** (such as Tencent and NetEase) are already using HybridCLR.
目前已经有数千个商业游戏项目接入了HybridCLR,其中有超过千个已经在App Store和Google Player上线,仅仅iOS免费榜前500名中就有近百款使用了HybridCLR。上线的项目中包括MMORPG、重度卡牌、重度塔防之类的游戏。国内绝大多数**Top游戏公司**都已经在使用HybridCLR。
You can view the [list of projects] (https://hybridclr.doc.code-philosophy.com/docs/other/businesscase) that use HybridCLR and have been launched in leading companies we know.
可查看我们已知的头部公司中使用HybridCLR并且已经上线的[项目列表](https://hybridclr.doc.code-philosophy.com/docs/other/businesscase)。
## Support & Contact
## 支持与联系
- Official group 1: 651188171 (full)
- Novice group 1: 428404198 (full)
- Newbie Group 2: **680274677 (recommended)**
- discord channel https://discord.gg/BATfNfJnm2
- Business cooperation email: business#code-philosophy.com
- [Business support](https://hybridclr.doc.code-philosophy.com/docs/business/intro)
- 官方1群:651188171(满)
- 新手1群:428404198(满)
- 新手2群:**680274677(推荐)**
- discord频道 https://discord.gg/BATfNfJnm2
- 商业合作邮箱: business#code-philosophy.com
- [商业化支持](https://hybridclr.doc.code-philosophy.com/docs/business/intro)
## About Author
## 关于作者
**walon**: **Code Philosophy** founder
**walon** :**Code Philosophy(代码哲学)** 创始人
Graduated from the Physics Department of Tsinghua University, won the CMO gold medal in 2006, was a member of the National Mathematical Olympiad training team, and was recommended to Tsinghua Basic Science Class. Focus on game technology, good at developing architecture and basic technical facilities.
毕业于清华大学物理系,2006年CMO金牌,奥数国家集训队成员,保送清华基科班。专注于游戏技术,擅长开发架构和基础技术设施。
## License
## license
HybridCLR is licensed under the [MIT](https://github.com/focus-creative-games/hybridclr/blob/main/LICENSE) license
HybridCLR is licensed under the [MIT](https://github.com/focus-creative-games/hybridclr/blob/main/LICENSE) license
+87
View File
@@ -0,0 +1,87 @@
- [README Chinese](./README.md)
- [README English](./README_EN.md)
# HybridCLR
[![license](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/focus-creative-games/hybridclr/blob/main/LICENSE)
![logo](https://github.com/focus-creative-games/hybridclr/raw/main/docs/images/logo.jpg)
<br/>
<br/>
HybridCLR is a **feature-complete, zero-cost, high-performance, low-memory** **near-perfect** Unity cross-platform native C# hot update solution.
HybridCLR extends the il2cpp runtime code, transforming it from a pure [AOT](https://en.wikipedia.org/wiki/Ahead-of-time_compilation) runtime to an AOT+Interpreter hybrid runtime, thereby natively supporting the dynamic loading of assemblies and fundamentally supporting hot updates from the bottom layer. Games using HybridCLR technology can not only run efficiently on the Android platform but also on all platforms supported by il2cpp, including iOS, Consoles, WebGL, etc.
Thanks to HybridCLR's good support for the ECMA-335 specification and its high compatibility with the Unity development workflow, Unity projects can almost seamlessly gain the ability to hot update C# code after integrating HybridCLR. Developers do not need to change their daily development habits and requirements. HybridCLR is the first to achieve the engineering difficulty of a full-platform code hot update solution for the Unity platform to almost zero.
Welcome to embrace modern native C# hot update technology!
## Documentation
- [Official Documentation](https://hybridclr.doc.code-philosophy.com/en/docs/intro)
- [Quick Start](https://hybridclr.doc.code-philosophy.com/en/docs/beginner/quickstart)
- [Business Project Cases](https://hybridclr.doc.code-philosophy.com/en/docs/other/businesscase)
## Features
- Nearly complete implementation of the [ECMA-335 specification](https://www.ecma-international.org/publications-and-standards/standards/ecma-335/), with only a very small number of [unsupported features](https://hybridclr.doc.code-philosophy.com/en/docs/basic/notsupportedfeatures).
- Zero learning and usage costs. For most developers, writing code is almost unrestricted. Hot update code works seamlessly with AOT code, allowing for inheritance, **generics**, **reflection**, and other code without additional special code or code generation.
- Full support for multithreading, including but not limited to volatile, ThreadStatic, async Task, and related features and characteristics. This is not supported by any other hot update solution.
- Almost complete compatibility with Unity's workflow. This includes support for hot updating **MonoBehaviour**, ScriptableObject, **DOTS** technology, and correctly instantiating hot update scripts mounted on resources, which is not supported by any other hot update solution.
- Efficient execution. A highly efficient register interpreter has been implemented, with all indicators significantly better than other hot update solutions. [Performance Test Report](https://hybridclr.doc.code-philosophy.com/en/docs/basic/performance)
- Efficient memory usage. Classes defined in hot update scripts occupy the same memory space as ordinary C# classes, far superior to other hot update solutions. [Memory Usage Report](https://hybridclr.doc.code-philosophy.com/en/docs/basic/memory)
- Supports MonoPInvokeCallback, enabling good interaction with native code or other languages such as Lua, JavaScript, Python.
- Supports some features not supported by il2cpp, such as __makeref, __reftype, __refvalue instructions.
- Supports the unique **Differential Hybrid Execution (DHE)** technology, which allows for arbitrary additions, deletions, and modifications to AOT DLLs. It intelligently runs unchanged functions in AOT mode and changed or newly added functions in interpreter mode, bringing the performance of hot-updated game logic close to that of native AOT.
- Supports **hot reload** technology, allowing 100% unloading of assemblies.
- Supports modern DLL encryption technology to effectively protect code security.
## Supported Versions and Platforms
- Supports all LTS versions including 2019.4.x, 2020.3.x, 2021.3.x, 2022.3.x, 2023.2.x, 6000.0.x.
- Supports all platforms supported by il2cpp.
- Supports Tuanjie(China) Engine and HarmonyOS platform.
## Working Principle
HybridCLR draws inspiration from Mono's [mixed mode execution](https://www.mono-project.com/news/2017/11/13/mono-interpreter/) technology, providing an interpreter module for AOT runtimes like Unity's il2cpp, transforming them from pure AOT runtimes to "AOT + Interpreter" hybrid operation modes.
![icon](https://github.com/focus-creative-games/hybridclr/raw/main/docs/images/architecture.png)
More specifically, HybridCLR has done the following:
- Implemented an efficient metadata (dll) parsing library.
- Modified the metadata management module to achieve dynamic registration of metadata.
- Implemented a compiler that converts IL instructions to a custom register instruction set.
- Implemented an efficient register interpreter.
- Provided a large number of instinct functions to enhance interpreter performance.
## Stability Status
HybridCLR has been widely verified as an efficient and stable Unity hot update solution, meeting the stability and performance requirements of medium and large commercial projects.
Currently, thousands of commercial game projects have integrated HybridCLR, with over a thousand already launched on the App Store and Google Play. Nearly a hundred of the top 500 free iOS games use HybridCLR, including MMORPGs, heavy card games, and heavy tower defense games. Most of the **Top Game Companies** in China are already using HybridCLR.
You can view the [list of known top companies using HybridCLR and their launched projects](https://hybridclr.doc.code-philosophy.com/en/docs/other/businesscase).
## Support and Contact
- Official Group 1: 651188171 (Full)
- Beginner Group 1: 428404198 (Full)
- Beginner Group 2: **680274677 (Recommended)**
- Discord channel https://discord.gg/BATfNfJnm2
- Business cooperation email: business#code-philosophy.com
- [Commercial Support](https://hybridclr.doc.code-philosophy.com/en/docs/business/intro)
## About the Author
**walon**: Founder of **Code Philosophy (代码哲学)**
Graduated from the Department of Physics at Tsinghua University, gold medalist of the 2006 CMO, member of the National Mathematical Olympiad Training Team, and sent to the Basic Science Class of Tsinghua. Focused on game technology, proficient in development architecture and basic technical infrastructure.
## License
HybridCLR is licensed under the [MIT](https://github.com/focus-creative-games/hybridclr/blob/main/LICENSE) license.
+1 -1
View File
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 52688f4469ff9454e8c3d8aaf045d9f4
guid: c9e34f237251ef44193538977db6b15f
TextScriptImporter:
externalObjects: {}
userData:
-88
View File
@@ -1,88 +0,0 @@
- [README 中文](./README_zh.md)
- [README English](./README.md)
# HybridCLR
[![license](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/focus-creative-games/hybridclr/blob/main/LICENSE)
![logo](https://github.com/focus-creative-games/hybridclr/raw/main/docs/images/logo.jpg)
<br/>
<br/>
HybridCLR是一个**特性完整、零成本、高性能、低内存**的**近乎完美**的Unity全平台原生c#热更新解决方案。
HybridCLR扩充了il2cpp运行时代码,使它由纯[AOT](https://en.wikipedia.org/wiki/Ahead-of-time_compilation) runtime变成AOT+Interpreter 混合runtime,进而原生支持动态加载assembly,从底层彻底支持了热更新。使用HybridCLR技术的游戏不仅能在Android平台,也能在IOS、Consoles、WebGL等所有il2cpp支持的平台上高效运行。
由于HybridCLR对ECMA-335规范 的良好支持以及对Unity开发工作流的高度兼容,Unity项目在接入HybridCLR后,可以几乎无缝地获得C#代码热更新的能力,开发者不需要改变日常开发习惯和要求。HybridCLR首次实现了将Unity平台的全平台代码热更新方案的工程难度降到几乎为零的水平。
欢迎拥抱现代原生C#热更新技术 !!!
## 文档
- [官方文档](https://hybridclr.doc.code-philosophy.com/docs/intro)
- [快速上手](https://hybridclr.doc.code-philosophy.com/docs/beginner/quickstart)
- [商业项目案例](https://hybridclr.doc.code-philosophy.com/docs/other/businesscase)
## 特性
- 近乎完整实现了[ECMA-335规范](https://www.ecma-international.org/publications-and-standards/standards/ecma-335/),只有极少量的[不支持的特性](https://hybridclr.doc.code-philosophy.com/docs/basic/notsupportedfeatures)。
- 零学习和使用成本。对绝大多数开发者来说写代码近乎没有限制。 热更新代码与AOT代码无缝工作,可以随意写继承、**泛型**、**反射**之类的代码。不需要额外写任何特殊代码、没有代码生成
- 完全支持多线程,包含但不限于 volatile、ThreadStatic、async Task等相关功能和特性。这是其他所有热更新方案都不支持的
- 几乎完全兼容Unity的工作流。包括且不限于支持热更新**MonoBehaviour**、ScriptableObject、**DOTS**技术,资源上挂载的热更新脚本可以正确实例化,这是其他所有热更新方案都不支持的
- 执行高效。实现了一个极其高效的寄存器解释器,所有指标都大幅优于其他热更新方案。[性能测试报告](https://hybridclr.doc.code-philosophy.com/docs/basic/performance)
- 内存高效。 热更新脚本中定义的类跟普通c#类占用一样的内存空间,远优于其他热更新方案。[内存占用报告](https://hybridclr.doc.code-philosophy.com/docs/basic/memory)
- 支持MonoPInvokeCallback,可以与native代码或者其他语言如lua、javascript、python良好交互
- 支持一些il2cpp不支持的特性,如__makeref、 __reftype、__refvalue指令
- 支持独创的 **Differential Hybrid Execution(DHE)** 差分混合执行技术,即可以对AOT dll任意增删改,会智能地让未改动的函数以AOT方式运行,变化或者新增的函数以interpreter模式运行,让热更新的游戏逻辑的运行性能基本达到原生AOT的水平
- 支持 **热重载** 技术,可以100%卸载程序集
- 支持现代的dll加密技术,有效保障代码安全
## 支持的版本与平台
- 支持2019.4.x、2020.3.x、2021.3.x、2022.3.x、2023.2.x、**6000.x.y**全系列LTS版本
- 支持所有il2cpp支持的平台
- 支持团结引擎和鸿蒙平台
## 工作原理
HybridCLR从mono的 [mixed mode execution](https://www.mono-project.com/news/2017/11/13/mono-interpreter/) 技术中得到启发,为unity的il2cpp之类的AOT runtime额外提供了interpreter模块,将它们由纯AOT运行时改造为"AOT + Interpreter"混合运行方式。
![icon](https://github.com/focus-creative-games/hybridclr/raw/main/docs/images/architecture.png)
更具体地说,HybridCLR做了以下几点工作:
- 实现了一个高效的元数据(dll)解析库
- 改造了元数据管理模块,实现了元数据的动态注册
- 实现了一个IL指令集到自定义的寄存器指令集的compiler
- 实现了一个高效的寄存器解释器
- 额外提供大量的instinct函数,提升解释器性能
## 稳定性状况
HybridCLR已经被广泛验证是非常高效、稳定的Unity热更新解决方案。
当前发布了**极其稳定**的1.x-5.x正式版本,足以满足大中型商业项目的稳定性要求。
目前有数千个商业游戏项目完成接入,其中有几百款已经双端上线,上线的项目中包括MMORPG、重度卡牌、重度塔防之类的游戏。**绝大多数头部游戏公司**(如腾讯、网易)都已经在使用HybridCLR。
可查看我们已知的头部公司中使用HybridCLR并且已经上线的[项目列表](https://hybridclr.doc.code-philosophy.com/docs/other/businesscase)。
## 支持与联系
- 官方1群:651188171(满)
- 新手1群:428404198(满)
- 新手2群:**680274677(推荐)**
- discord频道 https://discord.gg/BATfNfJnm2
- 商业合作邮箱: business#code-philosophy.com
- [商业化支持](https://hybridclr.doc.code-philosophy.com/docs/business/intro)
## 关于作者
**walon** :**Code Philosophy(代码哲学)** 创始人
毕业于清华大学物理系,2006年CMO金牌,奥数国家集训队成员,保送清华基科班。专注于游戏技术,擅长开发架构和基础技术设施。
## license
HybridCLR is licensed under the [MIT](https://github.com/focus-creative-games/hybridclr/blob/main/LICENSE) license
+445 -271
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -3,8 +3,8 @@ namespace HybridCLR
{
public enum HomologousImageMode
{
Consistent, // AOT dll需要跟主工程精确一致,即为裁剪后的AO dll
SuperSet, // AOT dll不需要跟主工程精确一致,但必须包含裁剪后的AOT dll的所有元数据,即为裁剪后dll的超集。推荐使用原始aot dll
Consistent,
SuperSet,
}
}
+8 -7
View File
@@ -4,12 +4,13 @@ namespace HybridCLR
public enum LoadImageErrorCode
{
OK = 0,
BAD_IMAGE, // dll 不合法
NOT_IMPLEMENT, // 不支持的元数据特性
AOT_ASSEMBLY_NOT_FIND, // 对应的AOT assembly未找到
HOMOLOGOUS_ONLY_SUPPORT_AOT_ASSEMBLY, // 不能给解释器assembly补充元数据
HOMOLOGOUS_ASSEMBLY_HAS_LOADED, // 已经补充过了,不能再次补充
INVALID_HOMOLOGOUS_MODE, // 非法HomologousImageMode
};
BAD_IMAGE, // invalid dll file
NOT_IMPLEMENT, // not implement feature
AOT_ASSEMBLY_NOT_FIND, // AOT assembly not found
HOMOLOGOUS_ONLY_SUPPORT_AOT_ASSEMBLY, // can not load supplementary metadata assembly for non-AOT assembly
HOMOLOGOUS_ASSEMBLY_HAS_LOADED, // can not load supplementary metadata assembly for the same assembly
INVALID_HOMOLOGOUS_MODE, // invalid homologous image mode
PDB_BAD_FILE, // invalid pdb file
};
}
+48 -6
View File
@@ -6,6 +6,7 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using UnityEditor;
using UnityEngine.Scripting;
namespace HybridCLR
@@ -14,7 +15,7 @@ namespace HybridCLR
public static class RuntimeApi
{
/// <summary>
/// 加载补充元数据assembly
/// load supplementary metadata assembly
/// </summary>
/// <param name="dllBytes"></param>
/// <returns></returns>
@@ -30,7 +31,38 @@ namespace HybridCLR
#endif
/// <summary>
/// 获取解释器线程栈的最大StackObject个数(size*8 为最终占用的内存大小)
/// prejit method to avoid the jit cost of first time running
/// </summary>
/// <param name="method"></param>
/// <returns>return true if method is jited, return false if method can't be jited </returns>
///
#if UNITY_EDITOR
public static bool PreJitMethod(MethodInfo method)
{
return false;
}
#else
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern bool PreJitMethod(MethodInfo method);
#endif
/// <summary>
/// prejit all methods of class to avoid the jit cost of first time running
/// </summary>
/// <param name="type"></param>
/// <returns>return true if class is jited, return false if class can't be jited </returns>
#if UNITY_EDITOR
public static bool PreJitClass(Type type)
{
return false;
}
#else
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern bool PreJitClass(Type type);
#endif
/// <summary>
/// get the maximum number of StackObjects in the interpreter thread stack (size*8 represents the final memory size occupied
/// </summary>
/// <returns></returns>
public static int GetInterpreterThreadObjectStackSize()
@@ -39,17 +71,17 @@ namespace HybridCLR
}
/// <summary>
/// 设置解释器线程栈的最大StackObject个数(size*8 为最终占用的内存大小)
/// set the maximum number of StackObjects for the interpreter thread stack (size*8 represents the final memory size occupied)
/// </summary>
/// <param name="size"></param>
public static void SetInterpreterThreadObjectStackSize(int size)
{
SetRuntimeOption(RuntimeOptionId.InterpreterThreadObjectStackSize, size);
}
/// <summary>
/// 获取解释器线程函数帧数量(sizeof(InterpreterFrame)*size 为最终占用的内存大小)
/// get the number of interpreter thread function frames (sizeof(InterpreterFrame)*size represents the final memory size occupied)
/// </summary>
/// <returns></returns>
public static int GetInterpreterThreadFrameStackSize()
@@ -58,7 +90,7 @@ namespace HybridCLR
}
/// <summary>
/// 设置解释器线程函数帧数量(sizeof(InterpreterFrame)*size 为最终占用的内存大小)
/// set the number of interpreter thread function frames (sizeof(InterpreterFrame)*size represents the final memory size occupied)
/// </summary>
/// <param name="size"></param>
public static void SetInterpreterThreadFrameStackSize(int size)
@@ -71,6 +103,11 @@ namespace HybridCLR
private static readonly Dictionary<RuntimeOptionId, int> s_runtimeOptions = new Dictionary<RuntimeOptionId, int>();
/// <summary>
/// set runtime option value
/// </summary>
/// <param name="optionId"></param>
/// <param name="value"></param>
public static void SetRuntimeOption(RuntimeOptionId optionId, int value)
{
s_runtimeOptions[optionId] = value;
@@ -80,6 +117,11 @@ namespace HybridCLR
public static extern void SetRuntimeOption(RuntimeOptionId optionId, int value);
#endif
/// <summary>
/// get runtime option value
/// </summary>
/// <param name="optionId"></param>
/// <returns></returns>
#if UNITY_EDITOR
public static int GetRuntimeOption(RuntimeOptionId optionId)
{
+3
View File
@@ -5,5 +5,8 @@
InterpreterThreadObjectStackSize = 1,
InterpreterThreadFrameStackSize = 2,
ThreadExceptionFlowSize = 3,
MaxMethodBodyCacheSize = 4,
MaxMethodInlineDepth = 5,
MaxInlineableMethodBodySize = 6,
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "com.code-philosophy.hybridclr",
"version": "6.2.0",
"version": "7.2.0",
"displayName": "HybridCLR",
"description": "HybridCLR is a fully featured, zero-cost, high-performance, low-memory solution for Unity's all-platform native c# hotupdate.",
"category": "Runtime",