Skip to content

Commit 568567d

Browse files
authored
Merge branch 'focus-creative-games:main' into main
2 parents f5b835b + 3fe41a8 commit 568567d

12 files changed

Lines changed: 110 additions & 53 deletions

Data~/hybridclr_version.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,38 @@
22
"versions": [
33
{
44
"unity_version":"2019",
5-
"hybridclr" : { "branch":"v7.6.0"},
6-
"il2cpp_plus": { "branch":"v2019-7.6.0"}
5+
"hybridclr" : { "branch":"v7.8.1"},
6+
"il2cpp_plus": { "branch":"v2019-7.8.0"}
77
},
88
{
99
"unity_version":"2020",
10-
"hybridclr" : { "branch":"v7.6.0"},
11-
"il2cpp_plus": { "branch":"v2020-7.6.0"}
10+
"hybridclr" : { "branch":"v7.8.1"},
11+
"il2cpp_plus": { "branch":"v2020-7.8.0"}
1212
},
1313
{
1414
"unity_version":"2021",
15-
"hybridclr" : { "branch":"v7.6.0"},
16-
"il2cpp_plus": { "branch":"v2021-7.6.0"}
15+
"hybridclr" : { "branch":"v7.8.1"},
16+
"il2cpp_plus": { "branch":"v2021-7.8.0"}
1717
},
1818
{
1919
"unity_version":"2022",
20-
"hybridclr" : { "branch":"v7.6.0"},
21-
"il2cpp_plus": { "branch":"v2022-7.4.0"}
20+
"hybridclr" : { "branch":"v7.8.1"},
21+
"il2cpp_plus": { "branch":"v2022-7.8.0"}
2222
},
2323
{
2424
"unity_version":"2022-tuanjie",
25-
"hybridclr" : { "branch":"v7.6.0"},
26-
"il2cpp_plus": { "branch":"v2022-tuanjie-7.4.0"}
25+
"hybridclr" : { "branch":"v7.8.1"},
26+
"il2cpp_plus": { "branch":"v2022-tuanjie-7.8.0"}
2727
},
2828
{
2929
"unity_version":"2023",
30-
"hybridclr" : { "branch":"v7.6.0"},
31-
"il2cpp_plus": { "branch":"v2023-7.4.0"}
30+
"hybridclr" : { "branch":"v7.8.1"},
31+
"il2cpp_plus": { "branch":"v2023-7.8.0"}
3232
},
3333
{
3434
"unity_version":"6000",
35-
"hybridclr" : { "branch":"v7.6.0"},
36-
"il2cpp_plus": { "branch":"v6000-7.4.0"}
35+
"hybridclr" : { "branch":"v7.8.1"},
36+
"il2cpp_plus": { "branch":"v6000-7.9.0"}
3737
}
3838
]
3939
}

Editor/3rds/UnityHook/HookUtils_OSX.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ public static unsafe class HookUtils
1616

1717
static HookUtils()
1818
{
19-
jit_write_protect_supported = pthread_jit_write_protect_supported_np() != 0;
19+
try
20+
{
21+
jit_write_protect_supported = pthread_jit_write_protect_supported_np() != 0;
22+
}
23+
catch { }
2024

2125
PropertyInfo p_SystemPageSize = typeof(Environment).GetProperty("SystemPageSize");
2226
if (p_SystemPageSize == null)
@@ -35,6 +39,16 @@ public static void MemCpy(void* pDst, void* pSrc, int len)
3539

3640
public static void MemCpy_Jit(void* pDst, byte[] src)
3741
{
42+
if (!jit_write_protect_supported)
43+
{
44+
fixed(void * pSrc = &src[0])
45+
{
46+
MemCpy(pDst, pSrc, src.Length);
47+
}
48+
49+
return;
50+
}
51+
3852
fixed(void * p = &src[0])
3953
{
4054
memcpy_jit(new IntPtr(pDst), new IntPtr(p), src.Length);

Editor/AOT/AOTAssemblyMetadataStripper.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@ public class AOTAssemblyMetadataStripper
1313
{
1414
public static byte[] Strip(byte[] assemblyBytes)
1515
{
16-
var mod = ModuleDefMD.Load(assemblyBytes);
16+
var context = ModuleDef.CreateModuleContext();
17+
var readerOption = new ModuleCreationOptions(context)
18+
{
19+
Runtime = CLRRuntimeReaderKind.Mono
20+
};
21+
var mod = ModuleDefMD.Load(assemblyBytes, readerOption);
22+
// remove all resources
23+
mod.Resources.Clear();
1724
foreach (var type in mod.GetTypes())
1825
{
1926
if (type.HasGenericParameters)

Editor/Commands/CompileDllCommand.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,32 @@ public static void CompileDll(string buildDir, BuildTarget target, bool developm
2525
#if UNITY_2022
2626
UnityEditor.EditorUtility.ClearProgressBar();
2727
#endif
28-
Debug.Log("compile finish!!!");
28+
Debug.Log($"compile finish!!! buildDir:{buildDir} target:{target} development:{developmentBuild}");
2929
}
3030

31-
public static void CompileDll(BuildTarget target, bool developmentBuild = false)
31+
public static void CompileDll(BuildTarget target)
32+
{
33+
CompileDll(EditorUserBuildSettings.activeBuildTarget, EditorUserBuildSettings.development);
34+
}
35+
36+
public static void CompileDll(BuildTarget target, bool developmentBuild)
3237
{
3338
CompileDll(SettingsUtil.GetHotUpdateDllsOutputDirByTarget(target), target, developmentBuild);
3439
}
3540

3641
[MenuItem("HybridCLR/CompileDll/ActiveBuildTarget", priority = 100)]
3742
public static void CompileDllActiveBuildTarget()
3843
{
39-
CompileDll(EditorUserBuildSettings.activeBuildTarget);
44+
CompileDll(EditorUserBuildSettings.activeBuildTarget, EditorUserBuildSettings.development);
45+
}
46+
47+
[MenuItem("HybridCLR/CompileDll/ActiveBuildTarget_Release", priority = 102)]
48+
public static void CompileDllActiveBuildTargetRelease()
49+
{
50+
CompileDll(EditorUserBuildSettings.activeBuildTarget, false);
4051
}
4152

42-
[MenuItem("HybridCLR/CompileDll/ActiveBuildTarget_Development", priority = 101)]
53+
[MenuItem("HybridCLR/CompileDll/ActiveBuildTarget_Development", priority = 104)]
4354
public static void CompileDllActiveBuildTargetDevelopment()
4455
{
4556
CompileDll(EditorUserBuildSettings.activeBuildTarget, true);

Editor/Commands/Il2CppDefGeneratorCommand.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ public static void GenerateIl2CppDef()
2424
UnityVersionOutputFile = $"{SettingsUtil.LocalIl2CppDir}/libil2cpp/hybridclr/generated/UnityVersion.h",
2525
AssemblyManifestTemplateFile = $"{SettingsUtil.TemplatePathInPackage}/AssemblyManifest.cpp.tpl",
2626
AssemblyManifestOutputFile = $"{SettingsUtil.LocalIl2CppDir}/libil2cpp/hybridclr/generated/AssemblyManifest.cpp",
27-
EnableProfilerInReleaseBuild = HybridCLRSettings.Instance.enableProfilerInReleaseBuild,
28-
EnableStraceTraceInWebGLReleaseBuild = HybridCLRSettings.Instance.enableStraceTraceInWebGLReleaseBuild,
2927
};
3028

3129
var g = new Il2CppDef.Il2CppDefGenerator(options);

Editor/Commands/PrebuildCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static void GenerateAll()
2222
throw new BuildFailedException($"You have not initialized HybridCLR, please install it via menu 'HybridCLR/Installer'");
2323
}
2424
BuildTarget target = EditorUserBuildSettings.activeBuildTarget;
25-
CompileDllCommand.CompileDll(target);
25+
CompileDllCommand.CompileDll(target, EditorUserBuildSettings.development);
2626
Il2CppDefGeneratorCommand.GenerateIl2CppDef();
2727

2828
// 这几个生成依赖HotUpdateDlls

Editor/Il2CppDef/Il2CppDefGenerator.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ public class Options
2626
public string AssemblyManifestOutputFile { get; set; }
2727

2828
public string UnityVersion { get; set; }
29-
30-
public bool EnableProfilerInReleaseBuild { get; set; }
31-
32-
public bool EnableStraceTraceInWebGLReleaseBuild { get; set; }
3329
}
3430

3531
private readonly Options _options;
@@ -85,16 +81,6 @@ private void GenerateIl2CppConfig()
8581
lines.Add($"#define HYBRIDCLR_TUANJIE_VERSION 10000");
8682
#endif
8783

88-
if (_options.EnableProfilerInReleaseBuild)
89-
{
90-
lines.Add("#define HYBRIDCLR_ENABLE_PROFILER_IN_RELEASE_BUILD 1");
91-
}
92-
93-
if (_options.EnableStraceTraceInWebGLReleaseBuild)
94-
{
95-
lines.Add("#define HYBRIDCLR_ENABLE_STRACE_TRACE_IN_WEBGL_RELEASE_BUILD 1");
96-
}
97-
9884
frr.Replace("UNITY_VERSION", string.Join("\n", lines));
9985

10086
frr.Commit(_options.UnityVersionOutputFile);

Editor/Installer/BashUtil.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public static void RemoveDir(string dir, bool log = false)
8383
{
8484
RemoveDir(subDir);
8585
}
86-
Directory.Delete(dir);
86+
Directory.Delete(dir, true);
8787
break;
8888
}
8989
catch (Exception e)
@@ -111,12 +111,12 @@ private static void CopyWithCheckLongFile(string srcFile, string dstFile)
111111
#endif
112112
if (srcFile.Length > maxPathLength)
113113
{
114-
UnityEngine.Debug.LogError($"srcFile:{srcFile} path is too long. copy ignore!");
114+
UnityEngine.Debug.LogError($"srcFile:{srcFile} path is too long. skip copy!");
115115
return;
116116
}
117117
if (dstFile.Length > maxPathLength)
118118
{
119-
UnityEngine.Debug.LogError($"dstFile:{dstFile} path is too long. copy ignore!");
119+
UnityEngine.Debug.LogError($"dstFile:{dstFile} path is too long. skip copy!");
120120
return;
121121
}
122122
File.Copy(srcFile, dstFile);

Editor/Settings/HybridCLRSettingProvider.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ public class HybridCLRSettingsProvider : SettingsProvider
2525
private SerializedProperty _outputAOTGenericReferenceFile;
2626
private SerializedProperty _maxGenericReferenceIteration;
2727
private SerializedProperty _maxMethodBridgeGenericIteration;
28-
private SerializedProperty _enableProfilerInReleaseBuild;
29-
private SerializedProperty enableStraceTraceInWebGLReleaseBuild;
3028

3129
private GUIStyle buttonStyle;
3230
public HybridCLRSettingsProvider() : base("Project/HybridCLR Settings", SettingsScope.Project) { }
@@ -55,8 +53,6 @@ private void InitGUI()
5553
_outputAOTGenericReferenceFile = _serializedObject.FindProperty("outputAOTGenericReferenceFile");
5654
_maxGenericReferenceIteration = _serializedObject.FindProperty("maxGenericReferenceIteration");
5755
_maxMethodBridgeGenericIteration = _serializedObject.FindProperty("maxMethodBridgeGenericIteration");
58-
_enableProfilerInReleaseBuild = _serializedObject.FindProperty("enableProfilerInReleaseBuild");
59-
enableStraceTraceInWebGLReleaseBuild = _serializedObject.FindProperty("enableStraceTraceInWebGLReleaseBuild");
6056
}
6157
private void OnEditorFocused()
6258
{
@@ -144,8 +140,6 @@ public override void OnGUI(string searchContext)
144140
EditorGUILayout.PropertyField(_outputAOTGenericReferenceFile);
145141
EditorGUILayout.PropertyField(_maxGenericReferenceIteration);
146142
EditorGUILayout.PropertyField(_maxMethodBridgeGenericIteration);
147-
EditorGUILayout.PropertyField(_enableProfilerInReleaseBuild);
148-
EditorGUILayout.PropertyField(enableStraceTraceInWebGLReleaseBuild);
149143
if (EditorGUI.EndChangeCheck())
150144
{
151145
_serializedObject.ApplyModifiedProperties();

Editor/Settings/HybridCLRSettings.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,5 @@ public class HybridCLRSettings : ScriptableSingleton<HybridCLRSettings>
5050

5151
[Tooltip("max iteration count of searching method bridge generic methods in AOT assemblies")]
5252
public int maxMethodBridgeGenericIteration = 10;
53-
54-
[Tooltip("enable profiler support when publishing in release mode")]
55-
public bool enableProfilerInReleaseBuild;
56-
57-
[Tooltip("enable StraceTrace support when publishing to the WebGL platform in release mode")]
58-
public bool enableStraceTraceInWebGLReleaseBuild;
5953
}
6054
}

0 commit comments

Comments
 (0)