diff --git a/Dependencies/Il2CppAssemblyGenerator/Core.cs b/Dependencies/Il2CppAssemblyGenerator/Core.cs index 88e940aee..c608b062c 100644 --- a/Dependencies/Il2CppAssemblyGenerator/Core.cs +++ b/Dependencies/Il2CppAssemblyGenerator/Core.cs @@ -109,14 +109,14 @@ private static int Run() if (!cpp2il.Execute()) { cpp2il.Cleanup(); - return 1; + return TryContinueWithExistingAssemblies(); } if (!il2cppinterop.Execute()) { cpp2il.Cleanup(); il2cppinterop.Cleanup(); - return 1; + return TryContinueWithExistingAssemblies(); } OldFiles_Cleanup(); @@ -133,6 +133,20 @@ private static int Run() return 0; } + private static int TryContinueWithExistingAssemblies() + { + if (LoaderConfig.Current.UnityEngine.ForceRegeneration) + return 1; + + if (!Directory.Exists(MelonEnvironment.Il2CppAssembliesDirectory) + || Directory.GetFiles(MelonEnvironment.Il2CppAssembliesDirectory, "*.dll").Length <= 0) + return 1; + + Logger.Warning("Assembly Generation failed, but existing Il2Cpp assemblies were found."); + Logger.Warning("Continuing with the existing assemblies. Mods may be incompatible until generation succeeds."); + return 0; + } + private static void OldFiles_Cleanup() { if (Config.Values.OldFiles.Count <= 0) @@ -169,4 +183,4 @@ private static void OldFiles_LAM() Config.Save(); } } -} \ No newline at end of file +}