mirror of
https://github.com/BepInEx/BepInEx.git
synced 2026-10-20 01:46:13 +00:00
Use copy of patcher plugin list to allow for better loader support
This commit is contained in:
1 parent
9ff80ca1a2
commit
897f37d241
1 file changed
+7
-3
@@ -32,6 +32,10 @@ namespace BepInEx.Preloader.Patching
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static List<PatcherPlugin> PatcherPlugins { get; } = new List<PatcherPlugin>();
|
public static List<PatcherPlugin> PatcherPlugins { get; } = new List<PatcherPlugin>();
|
||||||
|
|
||||||
|
// We make use the safe version for possible cases where a mod loader wants to modify the original patcher
|
||||||
|
// plugins list
|
||||||
|
private static IEnumerable<PatcherPlugin> PatcherPluginsSafe => PatcherPlugins.ToList();
|
||||||
|
|
||||||
private static readonly string DumpedAssembliesPath = Path.Combine(Paths.BepInExRootPath, "DumpedAssemblies");
|
private static readonly string DumpedAssembliesPath = Path.Combine(Paths.BepInExRootPath, "DumpedAssemblies");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -154,7 +158,7 @@ namespace BepInEx.Preloader.Patching
|
|||||||
|
|
||||||
private static void InitializePatchers()
|
private static void InitializePatchers()
|
||||||
{
|
{
|
||||||
foreach (var assemblyPatcher in PatcherPlugins)
|
foreach (var assemblyPatcher in PatcherPluginsSafe)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -169,7 +173,7 @@ namespace BepInEx.Preloader.Patching
|
|||||||
|
|
||||||
private static void FinalizePatching()
|
private static void FinalizePatching()
|
||||||
{
|
{
|
||||||
foreach (var assemblyPatcher in PatcherPlugins)
|
foreach (var assemblyPatcher in PatcherPluginsSafe)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -255,7 +259,7 @@ namespace BepInEx.Preloader.Patching
|
|||||||
var resolvedAssemblies = new Dictionary<string, string>();
|
var resolvedAssemblies = new Dictionary<string, string>();
|
||||||
// TODO: Maybe instead reload the assembly and repatch with other valid patchers?
|
// TODO: Maybe instead reload the assembly and repatch with other valid patchers?
|
||||||
var invalidAssemblies = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
|
var invalidAssemblies = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
|
||||||
foreach (var assemblyPatcher in PatcherPlugins)
|
foreach (var assemblyPatcher in PatcherPluginsSafe)
|
||||||
foreach (string targetDll in assemblyPatcher.TargetDLLs())
|
foreach (string targetDll in assemblyPatcher.TargetDLLs())
|
||||||
if (assemblies.TryGetValue(targetDll, out var assembly) && !invalidAssemblies.Contains(targetDll))
|
if (assemblies.TryGetValue(targetDll, out var assembly) && !invalidAssemblies.Contains(targetDll))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user