Skip to content

Commit 761b416

Browse files
authored
Merge branch 'focus-creative-games:main' into main
2 parents 98da7dc + 73654e7 commit 761b416

11 files changed

Lines changed: 106 additions & 25 deletions

File tree

Data~/hybridclr_version.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,37 @@
22
"versions": [
33
{
44
"unity_version":"2019",
5-
"hybridclr" : { "branch":"v8.0.0"},
5+
"hybridclr" : { "branch":"v8.4.0"},
66
"il2cpp_plus": { "branch":"v2019-8.1.0"}
77
},
88
{
99
"unity_version":"2020",
10-
"hybridclr" : { "branch":"v8.0.0"},
10+
"hybridclr" : { "branch":"v8.4.0"},
1111
"il2cpp_plus": { "branch":"v2020-8.1.0"}
1212
},
1313
{
1414
"unity_version":"2021",
15-
"hybridclr" : { "branch":"v8.0.0"},
15+
"hybridclr" : { "branch":"v8.4.0"},
1616
"il2cpp_plus": { "branch":"v2021-8.1.0"}
1717
},
1818
{
1919
"unity_version":"2022",
20-
"hybridclr" : { "branch":"v8.0.0"},
21-
"il2cpp_plus": { "branch":"v2022-8.1.0"}
20+
"hybridclr" : { "branch":"v8.4.0"},
21+
"il2cpp_plus": { "branch":"v2022-8.2.0"}
2222
},
2323
{
2424
"unity_version":"2022-tuanjie",
25-
"hybridclr" : { "branch":"v8.0.0"},
26-
"il2cpp_plus": { "branch":"v2022-tuanjie-8.1.0"}
25+
"hybridclr" : { "branch":"v8.4.0"},
26+
"il2cpp_plus": { "branch":"v2022-tuanjie-8.3.0"}
2727
},
2828
{
2929
"unity_version":"2023",
30-
"hybridclr" : { "branch":"v8.0.0"},
30+
"hybridclr" : { "branch":"v8.4.0"},
3131
"il2cpp_plus": { "branch":"v2023-8.1.0"}
3232
},
3333
{
3434
"unity_version":"6000",
35-
"hybridclr" : { "branch":"v8.0.0"},
35+
"hybridclr" : { "branch":"v8.4.0"},
3636
"il2cpp_plus": { "branch":"v6000-8.1.0"}
3737
}
3838
]

Editor/Commands/StripAOTDllCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ public static void GenerateStripedAOTDlls(BuildTarget target)
136136
options = buildOptions,
137137
target = target,
138138
targetGroup = BuildPipeline.GetBuildTargetGroup(target),
139-
#if UNITY_2021_1_OR_NEWER
140-
subtarget = (int)EditorUserBuildSettings.standaloneBuildSubtarget,
139+
#if UNITY_SERVER
140+
subtarget = (int)StandaloneBuildSubtarget.Server,
141141
#endif
142142
};
143143

Editor/Meta/GenericMethod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public static GenericMethod ResolveMethod(IMethod method, GenericArgumentContext
9494
methodDef = method.ResolveMethodDef();
9595
if (methodDef == null)
9696
{
97-
Debug.LogWarning($"method:{method} ResolveMethodDef() == null");
97+
//Debug.LogWarning($"method:{method} ResolveMethodDef() == null");
9898
return null;
9999
}
100100
if (method is MethodSpec methodSpec)

Editor/MethodBridge/Generator.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ private void CollectTypesAndMethods()
287287
CollectStructDefs(_managed2NativeMethodList0, structTypeSet);
288288
CollectStructDefs(_native2ManagedMethodList0, structTypeSet);
289289
CollectStructDefs(_adjustThunkMethodList0, structTypeSet);
290+
CollectStructDefs(_originalCalliMethodSignatures.Select(m => m.MethodSig).ToList(), structTypeSet);
290291
_structTypes0 = structTypeSet.ToList();
291292
_structTypes0.Sort((a, b) => a.TypeId - b.TypeId);
292293

@@ -829,6 +830,38 @@ private void CollectStructDefs(List<MethodDesc> methods, HashSet<TypeInfo> struc
829830

830831
}
831832

833+
private void CollectStructDefs(List<MethodSig> methods, HashSet<TypeInfo> structTypes)
834+
{
835+
ICorLibTypes corLibTypes = _genericMethods[0].Method.Module.CorLibTypes;
836+
837+
foreach (var method in methods)
838+
{
839+
foreach (var paramInfo in method.Params)
840+
{
841+
var paramType = GetSharedTypeInfo(MetaUtil.ToShareTypeSig(corLibTypes, paramInfo));
842+
if (paramType.IsStruct)
843+
{
844+
structTypes.Add(paramType);
845+
if (paramType.Klass.ContainsGenericParameter)
846+
{
847+
throw new Exception($"[CollectStructDefs] method:{method} type:{paramType.Klass} contains generic parameter");
848+
}
849+
}
850+
851+
}
852+
var returnType = GetSharedTypeInfo(MetaUtil.ToShareTypeSig(corLibTypes, method.RetType));
853+
if (returnType.IsStruct)
854+
{
855+
structTypes.Add(returnType);
856+
if (returnType.Klass.ContainsGenericParameter)
857+
{
858+
throw new Exception($"[CollectStructDefs] method:{method} type:{returnType.Klass} contains generic parameter");
859+
}
860+
}
861+
}
862+
863+
}
864+
832865
class FieldInfo
833866
{
834867
public FieldDef field;

Editor/MethodBridge/MonoPInvokeCallbackAnalyzer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ private void CollectReversePInvokeMethods()
5555
}
5656
if (!MetaUtil.IsSupportedPInvokeMethodSignature(method.MethodSig))
5757
{
58-
throw new Exception($"MonoPInvokeCallback method {method.FullName} has unsupported parameter or return type. Please check the method signature.");
58+
Debug.LogError($"MonoPInvokeCallback method {method.FullName} has unsupported parameter or return type. Please check the method signature.");
5959
}
6060
//foreach (var ca in method.CustomAttributes)
6161
//{

Editor/MethodBridge/PInvokeAnalyzer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public void Run()
3838
{
3939
if (!MetaUtil.IsSupportedPInvokeMethodSignature(method.MethodSig))
4040
{
41-
throw new Exception($"PInvoke method {method.FullName} has unsupported parameter or return type. Please check the method signature.");
41+
Debug.LogError($"PInvoke method {method.FullName} has unsupported parameter or return type. Please check the method signature.");
4242
}
4343
_pinvokeMethodSignatures.Add(new CallNativeMethodSignatureInfo { MethodSig = method.MethodSig });
4444
}

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Code Philosophy Technology Ltd.
3+
Copyright (c) 2025 Code Philosophy Technology Ltd.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
- [README 中文](./README.md)
2-
- [README English](./README_EN.md)
3-
41
# HybridCLR
52

63
[![license](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/focus-creative-games/hybridclr/blob/main/LICENSE)
@@ -10,6 +7,10 @@
107
<br/>
118
<br/>
129

10+
[README 中文](./README.md) | [README English](./README_EN.md)
11+
12+
[Github](https://github.com/focus-creative-games/hybridclr) | [Gitee](https://gitee.com/focus-creative-games/hybridclr)
13+
1314
HybridCLR是一个**特性完整、零成本、高性能、低内存****近乎完美**的Unity全平台原生c#热更新解决方案。
1415

1516
HybridCLR扩充了il2cpp运行时代码,使它由纯[AOT](https://en.wikipedia.org/wiki/Ahead-of-time_compilation) runtime变成AOT+Interpreter 混合runtime,进而原生支持动态加载assembly,从底层彻底支持了热更新。使用HybridCLR技术的游戏不仅能在Android平台,也能在IOS、Consoles、WebGL等所有il2cpp支持的平台上高效运行。
@@ -24,7 +25,6 @@ HybridCLR扩充了il2cpp运行时代码,使它由纯[AOT](https://en.wikipedia
2425
- [快速上手](https://hybridclr.doc.code-philosophy.com/docs/beginner/quickstart)
2526
- [商业项目案例](https://hybridclr.doc.code-philosophy.com/docs/other/businesscase)
2627

27-
2828
## 特性
2929

3030
- 近乎完整实现了[ECMA-335规范](https://www.ecma-international.org/publications-and-standards/standards/ecma-335/),只有极少量的[不支持的特性](https://hybridclr.doc.code-philosophy.com/docs/basic/notsupportedfeatures)
@@ -34,14 +34,16 @@ HybridCLR扩充了il2cpp运行时代码,使它由纯[AOT](https://en.wikipedia
3434
- 执行高效。实现了一个极其高效的寄存器解释器,所有指标都大幅优于其他热更新方案。[性能测试报告](https://hybridclr.doc.code-philosophy.com/docs/basic/performance)
3535
- 内存高效。 热更新脚本中定义的类跟普通c#类占用一样的内存空间,远优于其他热更新方案。[内存占用报告](https://hybridclr.doc.code-philosophy.com/docs/basic/memory)
3636
- 支持MonoPInvokeCallback,可以与native代码或者其他语言如lua、javascript、python良好交互
37-
- 支持一些il2cpp不支持的特性,如__makeref、 __reftype、__refvalue指令
37+
- 支持PInvoke
38+
- 支持一些il2cpp不支持的特性,如\_\_makeref、 \_\_reftype、\_\_refvalue指令
3839
- 支持独创的 **Differential Hybrid Execution(DHE)** 差分混合执行技术,即可以对AOT dll任意增删改,会智能地让未改动的函数以AOT方式运行,变化或者新增的函数以interpreter模式运行,让热更新的游戏逻辑的运行性能基本达到原生AOT的水平
39-
- 支持 **热重载** 技术,可以100%卸载程序集
40+
- 支持**热重载**技术,可以100%卸载程序集
41+
- 支持动态**Hotfix**技术,可以运行过程中无感修复代码bug
4042
- 支持现代的dll加密技术,有效保障代码安全
4143

4244
## 支持的版本与平台
4345

44-
- 支持2019.4.x、2020.3.x、2021.3.x、2022.3.x、2023.2.x、6000.x.y全系列LTS版本
46+
- 支持2019.4.x、2020.3.x、2021.3.x、2022.3.x、2023.2.x、6000.x.y 所有LTS版本
4547
- 支持所有il2cpp支持的平台
4648
- 支持团结引擎和鸿蒙平台
4749

@@ -73,7 +75,7 @@ HybridCLR已经被广泛验证是非常高效、稳定的Unity热更新解决方
7375
- 新手1群(3000人):428404198(满)
7476
- 新手2群(2000人):680274677(满)
7577
- 新手3群(2000人):**920714552(推荐)**
76-
- discord频道 https://discord.gg/BATfNfJnm2
78+
- discord频道 `https://discord.gg/BATfNfJnm2`
7779
- 商业合作邮箱: business#code-philosophy.com
7880
- [商业化支持](https://hybridclr.doc.code-philosophy.com/docs/business/intro)
7981

RELEASELOG.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,48 @@
11
# ReleaseLog
22

3+
## 8.4.0
4+
5+
Release Date: 2025-07-26.
6+
7+
### Runtime
8+
9+
- **[new] IMPORTANT! support custom image format**
10+
- [change] the type of field `offset` of ldsfld, stfld, ldthreadlocalfld、stthreadlocalfld changed from uint16_t to uint32_t so that supports class with huge static fields.
11+
- [opt] optimize to use NewValueTypeVar_Ctor_0 for new zero-argument value type and System.Activator.CreateInstance&lt;T&gt;()
12+
- [opt] optimize new ValueType with zero arguments.
13+
14+
### Editor
15+
16+
- [fix] fix the issue that `Texture Compression` option in Build Settings was changed after running `HybridCLR/Generate/All` on Android platform
17+
18+
## 8.3.0
19+
20+
Release Date: 2025-07-04.
21+
22+
### Runtime
23+
24+
- [fix] fix the bug where RuntimeInitClassCCtor was executed during InterpreterModule::GetInterpMethodInfo. This caused the type static constructor to be incorrectly executed prematurely during PrejitMethod.
25+
- [fix] fix bug that JitMethod jit method of generic class incorrectly.
26+
- [merge] merge il2cpp of tuanjie changes from 1.5.0-1.6.0
27+
28+
### Editor
29+
30+
- [fix] fix the bug that not collect struct in calli and extern method signature in generating MethodBridge.
31+
32+
## 8.2.0
33+
34+
Release Date: 2025-06-12.
35+
36+
### Runtime
37+
38+
- [fix] fix line number mistake in stacktrace
39+
- [fix] Fixed bug that PDBImage::SetupStackFrameInfo didn't set ilOffset and sourceCodeLineNumber of stackFrame when SequencePoint not found
40+
- [merge] merge il2cpp changes from 2022.3.54-2022.3.63
41+
42+
### Editor
43+
44+
- [change] changed from throw exception to logError when not supported pinvoke or reverse pinvoke method parameter type was found
45+
346
## 8.1.0
447

548
Release Date: 2025-05-29.

Runtime/LoadImageErrorCode.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ public enum LoadImageErrorCode
1111
HOMOLOGOUS_ASSEMBLY_HAS_LOADED, // can not load supplementary metadata assembly for the same assembly
1212
INVALID_HOMOLOGOUS_MODE, // invalid homologous image mode
1313
PDB_BAD_FILE, // invalid pdb file
14+
UNKNOWN_IMAGE_FORMAT,
15+
UNSUPPORT_FORMAT_VERSION,
16+
UNMATCH_FORMAT_VARIANT,
1417
};
1518
}
1619

0 commit comments

Comments
 (0)