From 05c3fd24bf53a8773c0096c203e543d93d898085 Mon Sep 17 00:00:00 2001 From: walon Date: Fri, 23 May 2025 09:25:44 +0800 Subject: [PATCH] =?UTF-8?q?change:=20ObfuscationMethodWhitelist::IsInWhite?= =?UTF-8?q?List(MethodDef)=E5=AF=B9=E4=BA=8E=E5=B8=A6=E6=9C=89`[RuntimeIni?= =?UTF-8?q?tializeOnLoadMethod]`=E7=9A=84=E5=87=BD=E6=95=B0=EF=BC=8C?= =?UTF-8?q?=E5=A6=82=E6=9E=9CLoadType=E7=AD=89=E4=BA=8E=E6=88=96=E8=80=85?= =?UTF-8?q?=E6=97=A9=E4=BA=8EAfterAssembliesLoaded=EF=BC=8C=E5=B0=B1?= =?UTF-8?q?=E4=B8=8D=E5=AF=B9=E5=87=BD=E6=95=B0=E8=BF=9B=E8=A1=8C=E6=B7=B7?= =?UTF-8?q?=E6=B7=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Editor/ObfuscationMethodWhitelist.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/com.code-philosophy.obfuz/Editor/ObfuscationMethodWhitelist.cs b/com.code-philosophy.obfuz/Editor/ObfuscationMethodWhitelist.cs index 771221e..2edb3ef 100644 --- a/com.code-philosophy.obfuz/Editor/ObfuscationMethodWhitelist.cs +++ b/com.code-philosophy.obfuz/Editor/ObfuscationMethodWhitelist.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using UnityEngine; namespace Obfuz { @@ -15,7 +16,7 @@ namespace Obfuz public bool IsInWhiteList(ModuleDef module) { string modName = module.Assembly.Name; - if (modName == "Obfuz.Runtime") + if (modName == ConstValues.ObfuzRuntimeAssemblyName) { return true; } @@ -40,6 +41,15 @@ namespace Obfuz { return true; } + CustomAttribute ca = method.CustomAttributes.Find("UnityEngine.RuntimeInitializeOnLoadMethodAttribute"); + if (ca != null && ca.ConstructorArguments.Count > 0) + { + RuntimeInitializeLoadType loadType = (RuntimeInitializeLoadType)ca.ConstructorArguments[0].Value; + if (loadType >= RuntimeInitializeLoadType.AfterAssembliesLoaded) + { + return true; + } + } return false; }