[opt] 当Installer中il2cpp路径不包含版本号时,给出提示
[opt] 新增 LoadMetadataForAOTAssembly(byte[])函数,简化使用。同时在Editor下被意外调用时给出更清晰的信息main
parent
a56f940890
commit
f810ac53ba
|
@ -18,6 +18,7 @@ namespace HybridCLR.Editor.Installer
|
|||
public enum InstallErrorCode
|
||||
{
|
||||
Ok,
|
||||
InvalidUnityInstallPath,
|
||||
Il2CppInstallPathNotMatchIl2CppBranch,
|
||||
Il2CppInstallPathNotExists,
|
||||
NotIl2CppPath,
|
||||
|
@ -233,7 +234,9 @@ namespace HybridCLR.Editor.Installer
|
|||
|
||||
if (!IsComaptibleWithIl2CppPlusBranch(il2cppBranch, installDir))
|
||||
{
|
||||
return InstallErrorCode.Il2CppInstallPathNotMatchIl2CppBranch;
|
||||
return TryParseMinorVersion(installDir, out _) ?
|
||||
InstallErrorCode.Il2CppInstallPathNotMatchIl2CppBranch
|
||||
: InstallErrorCode.InvalidUnityInstallPath;
|
||||
}
|
||||
|
||||
if (!installDir.EndsWith("/il2cpp"))
|
||||
|
|
|
@ -79,24 +79,29 @@ namespace HybridCLR.Editor.Installer
|
|||
switch (err)
|
||||
{
|
||||
case InstallErrorCode.Ok:
|
||||
{
|
||||
break;
|
||||
}
|
||||
{
|
||||
break;
|
||||
}
|
||||
case InstallErrorCode.Il2CppInstallPathNotExists:
|
||||
{
|
||||
EditorGUILayout.HelpBox("li2cpp 路径不存在", MessageType.Error);
|
||||
break;
|
||||
}
|
||||
{
|
||||
EditorGUILayout.HelpBox("li2cpp 路径不存在", MessageType.Error);
|
||||
break;
|
||||
}
|
||||
case InstallErrorCode.InvalidUnityInstallPath:
|
||||
{
|
||||
EditorGUILayout.HelpBox($"Unity安装目录必须包含版本号,否则无法识别版本", MessageType.Error);
|
||||
break;
|
||||
}
|
||||
case InstallErrorCode.Il2CppInstallPathNotMatchIl2CppBranch:
|
||||
{
|
||||
EditorGUILayout.HelpBox($"il2cpp 版本不兼容,最小版本为 {m_Controller.GetMinCompatibleVersion(m_Controller.Il2CppBranch)}", MessageType.Error);
|
||||
break;
|
||||
}
|
||||
{
|
||||
EditorGUILayout.HelpBox($"il2cpp 版本不兼容,最小版本为 {m_Controller.GetMinCompatibleVersion(m_Controller.Il2CppBranch)}", MessageType.Error);
|
||||
break;
|
||||
}
|
||||
case InstallErrorCode.NotIl2CppPath:
|
||||
{
|
||||
EditorGUILayout.HelpBox($"当前选择的路径不是il2cpp目录(必须类似 xxx/il2cpp)", MessageType.Error);
|
||||
break;
|
||||
}
|
||||
{
|
||||
EditorGUILayout.HelpBox($"当前选择的路径不是il2cpp目录(必须类似 xxx/il2cpp)", MessageType.Error);
|
||||
break;
|
||||
}
|
||||
default: throw new Exception($"not support {err}");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,18 @@ namespace HybridCLR
|
|||
private const string dllName = "il2cpp";
|
||||
#endif
|
||||
|
||||
public static unsafe LoadImageErrorCode LoadMetadataForAOTAssembly(byte[] dllBytes)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
throw new NotSupportedException("LoadMetadataForAOTAssembly can only be invoked in il2cpp");
|
||||
#else
|
||||
fixed(byte* data = dllBytes)
|
||||
{
|
||||
return (LoadImageErrorCode)LoadMetadataForAOTAssembly((IntPtr)data, dllBytes.Length);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
[DllImport(dllName, EntryPoint = "RuntimeApi_LoadMetadataForAOTAssembly")]
|
||||
public static extern int LoadMetadataForAOTAssembly(IntPtr dllBytes, int dllSize);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "com.focus-creative-games.hybridclr_unity",
|
||||
"version": "0.3.3",
|
||||
"version": "0.3.4",
|
||||
"displayName": "HybridCLR",
|
||||
"description": "Unity package for HybridCLR. It includes editor and runtime scripts and assets for HybridCLR",
|
||||
"category": "Runtime",
|
||||
|
|
Loading…
Reference in New Issue