@@ -20,6 +20,15 @@ namespace BepInEx.IL2CPP
20
20
{
21
21
internal static class ProxyAssemblyGenerator
22
22
{
23
+ private static readonly ConfigEntry < bool > ConfigUpdateUnhollowedAssemblies =
24
+ ConfigFile . CoreConfig . Bind ( "IL2CPP" ,
25
+ "UpdateUnhollowedAssemblies" ,
26
+ true ,
27
+ new StringBuilder ( )
28
+ . AppendLine ( "Whether to run Il2CppAssemblyUnhollower automatically to generate Il2Cpp support assemblies when they are outdated." )
29
+ . AppendLine ( "If disabled assemblies in `BepInEx/unhollowed` won't be updated between game or BepInEx updates!" )
30
+ . ToString ( ) ) ;
31
+
23
32
private static readonly ConfigEntry < string > ConfigUnityBaseLibrariesSource = ConfigFile . CoreConfig . Bind (
24
33
"IL2CPP" , "UnityBaseLibrariesSource" ,
25
34
"http://unity.bepinex.dev/libraries/{VERSION}.zip" ,
@@ -94,13 +103,26 @@ static void HashString(ICryptoTransform hash, string str)
94
103
95
104
public static bool CheckIfGenerationRequired ( )
96
105
{
106
+ static bool NeedGenerationOrSkip ( )
107
+ {
108
+ if ( ! ConfigUpdateUnhollowedAssemblies . Value )
109
+ {
110
+ var hash = ComputeHash ( ) ;
111
+ Preloader . Log
112
+ . LogWarning ( $ "Unhollowed assemblies are possibly out of date. To disable this message, create file { HashPath } with the following contents: { hash } ") ;
113
+ return false ;
114
+ }
115
+
116
+ return true ;
117
+ }
118
+
97
119
if ( ! Directory . Exists ( Preloader . IL2CPPUnhollowedPath ) )
98
120
return true ;
99
121
100
122
if ( ! File . Exists ( HashPath ) )
101
- return true ;
123
+ return NeedGenerationOrSkip ( ) ;
102
124
103
- if ( ComputeHash ( ) != File . ReadAllText ( HashPath ) )
125
+ if ( ComputeHash ( ) != File . ReadAllText ( HashPath ) && NeedGenerationOrSkip ( ) )
104
126
{
105
127
Preloader . Log . LogInfo ( "Detected outdated proxy assemblies, will regenerate them now" ) ;
106
128
return true ;
0 commit comments