修复默认混淆了DOTS生成的Unity.Entities.CodeGeneratedRegistry.AssemblyTypeRegistry类名,导致DOTS类型注册失败的Bug
parent
1b3c1c4958
commit
8f0a5bc0f2
|
@ -132,6 +132,18 @@ namespace Obfuz.ObfusPasses.SymbolObfus.Policies
|
|||
{
|
||||
return true;
|
||||
}
|
||||
if (typeDef.FullName == "Unity.Entities.CodeGeneratedRegistry.AssemblyTypeRegistry")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (typeDef.Name.StartsWith("__JobReflectionRegistrationOutput"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (typeDef.CustomAttributes.Find("Unity.Jobs.DOTSCompilerGeneratedAttribute") != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (typeDef.DeclaringType != null)
|
||||
{
|
||||
return IsUnitySourceGeneratedAssemblyType(typeDef.DeclaringType);
|
||||
|
@ -145,6 +157,10 @@ namespace Obfuz.ObfusPasses.SymbolObfus.Policies
|
|||
{
|
||||
return false;
|
||||
}
|
||||
if (MetaUtil.IsInheritFromDOTSTypes(typeDef))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (typeDef.Methods.Any(m => MetaUtil.HasRuntimeInitializeOnLoadMethodAttribute(m)))
|
||||
{
|
||||
return false;
|
||||
|
@ -167,6 +183,10 @@ namespace Obfuz.ObfusPasses.SymbolObfus.Policies
|
|||
{
|
||||
return false;
|
||||
}
|
||||
if (MetaUtil.IsInheritFromDOTSTypes(typeDef))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (MetaUtil.HasRuntimeInitializeOnLoadMethodAttribute(methodDef))
|
||||
{
|
||||
return false;
|
||||
|
@ -185,6 +205,10 @@ namespace Obfuz.ObfusPasses.SymbolObfus.Policies
|
|||
{
|
||||
return !MetaUtil.IsSerializableField(fieldDef);
|
||||
}
|
||||
if (MetaUtil.IsInheritFromDOTSTypes(typeDef))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (typeDef.IsEnum && MetaUtil.HasBlackboardEnumAttribute(typeDef))
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -116,6 +116,36 @@ namespace Obfuz.Utils
|
|||
return null;
|
||||
}
|
||||
|
||||
public static bool IsInheritFromDOTSTypes(TypeDef typeDef)
|
||||
{
|
||||
TypeDef cur = typeDef;
|
||||
while (true)
|
||||
{
|
||||
if (cur.Namespace.StartsWith("Unity.Entities") ||
|
||||
//cur.Namespace.StartsWith("Unity.Jobs") ||
|
||||
cur.Namespace.StartsWith("Unity.Burst"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
foreach (var interfaceType in cur.Interfaces)
|
||||
{
|
||||
TypeDef interfaceTypeDef = interfaceType.Interface.ResolveTypeDef();
|
||||
if (interfaceTypeDef != null && (interfaceTypeDef.Namespace.StartsWith("Unity.Entities") ||
|
||||
//interfaceTypeDef.Namespace.StartsWith("Unity.Jobs") ||
|
||||
interfaceTypeDef.Namespace.StartsWith("Unity.Burst")))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
cur = GetBaseTypeDef(cur);
|
||||
if (cur == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsInheritFromMonoBehaviour(TypeDef typeDef)
|
||||
{
|
||||
TypeDef cur = typeDef;
|
||||
|
|
Loading…
Reference in New Issue