|
@@ -184,20 +184,27 @@ namespace BepInEx.Bootstrap
|
|
|
|
|
|
AddPatcher(new [] { "UnityEngine.dll" }, PatchEntrypoint);
|
|
AddPatcher(new [] { "UnityEngine.dll" }, PatchEntrypoint);
|
|
|
|
|
|
- if (Directory.Exists(PatcherPluginPath))
|
|
|
|
- foreach (string assemblyPath in Directory.GetFiles(PatcherPluginPath, "*.dll"))
|
|
|
|
|
|
+ if (Directory.Exists(PatcherPluginPath))
|
|
|
|
+ {
|
|
|
|
+ SortedDictionary<string, KeyValuePair<AssemblyPatcherDelegate, IEnumerable<string>>> sortedPatchers = new SortedDictionary<string, KeyValuePair<AssemblyPatcherDelegate, IEnumerable<string>>>();
|
|
|
|
+
|
|
|
|
+ foreach (string assemblyPath in Directory.GetFiles(PatcherPluginPath, "*.dll"))
|
|
{
|
|
{
|
|
try
|
|
try
|
|
{
|
|
{
|
|
var assembly = Assembly.LoadFrom(assemblyPath);
|
|
var assembly = Assembly.LoadFrom(assemblyPath);
|
|
|
|
|
|
- foreach (var kv in GetPatcherMethods(assembly))
|
|
|
|
- AddPatcher(kv.Value, kv.Key);
|
|
|
|
|
|
+ foreach (var kv in GetPatcherMethods(assembly))
|
|
|
|
+ sortedPatchers.Add(assembly.GetName().Name, kv);
|
|
}
|
|
}
|
|
catch (BadImageFormatException) { } //unmanaged DLL
|
|
catch (BadImageFormatException) { } //unmanaged DLL
|
|
catch (ReflectionTypeLoadException) { } //invalid references
|
|
catch (ReflectionTypeLoadException) { } //invalid references
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ foreach (var kv in sortedPatchers)
|
|
|
|
+ AddPatcher(kv.Value.Value, kv.Value.Key);
|
|
|
|
+ }
|
|
|
|
+
|
|
AssemblyPatcher.PatchAll(ManagedPath, PatcherDictionary, Initializers, Finalizers);
|
|
AssemblyPatcher.PatchAll(ManagedPath, PatcherDictionary, Initializers, Finalizers);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|