|
@@ -39,6 +39,12 @@ namespace BepInEx.Preloader.Core
|
|
public Dictionary<string, AssemblyDefinition> AssembliesToPatch { get; } = new Dictionary<string, AssemblyDefinition>();
|
|
public Dictionary<string, AssemblyDefinition> AssembliesToPatch { get; } = new Dictionary<string, AssemblyDefinition>();
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
|
+ /// <para>Contains a dictionary of assemblies that have been loaded as part of executing this assembly patcher..</para>
|
|
|
|
+ /// <para>The key is the same key as used in <see cref="LoadedAssemblies"/>, while the value is the actual assembly itself.</para>
|
|
|
|
+ /// </summary>
|
|
|
|
+ public Dictionary<string, Assembly> LoadedAssemblies { get; } = new Dictionary<string, Assembly>();
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
/// The directory location as to where patched assemblies will be saved to and loaded from disk, for debugging purposes. Defaults to BepInEx/DumpedAssemblies
|
|
/// The directory location as to where patched assemblies will be saved to and loaded from disk, for debugging purposes. Defaults to BepInEx/DumpedAssemblies
|
|
/// </summary>
|
|
/// </summary>
|
|
public string DumpedAssembliesPath { get; set; } = Path.Combine(Paths.BepInExRootPath, "DumpedAssemblies");
|
|
public string DumpedAssembliesPath { get; set; } = Path.Combine(Paths.BepInExRootPath, "DumpedAssemblies");
|
|
@@ -335,17 +341,21 @@ namespace BepInEx.Preloader.Core
|
|
// but because some games *rely* on that because of messed up internal dependencies.
|
|
// but because some games *rely* on that because of messed up internal dependencies.
|
|
if (patchedAssemblies.Contains(filename))
|
|
if (patchedAssemblies.Contains(filename))
|
|
{
|
|
{
|
|
|
|
+ Assembly loadedAssembly;
|
|
|
|
+
|
|
if (ConfigLoadDumpedAssemblies.Value)
|
|
if (ConfigLoadDumpedAssemblies.Value)
|
|
- Assembly.LoadFile(Path.Combine(DumpedAssembliesPath, filename));
|
|
|
|
|
|
+ loadedAssembly = Assembly.LoadFile(Path.Combine(DumpedAssembliesPath, filename));
|
|
else
|
|
else
|
|
{
|
|
{
|
|
using (var assemblyStream = new MemoryStream())
|
|
using (var assemblyStream = new MemoryStream())
|
|
{
|
|
{
|
|
assembly.Write(assemblyStream);
|
|
assembly.Write(assemblyStream);
|
|
- Assembly.Load(assemblyStream.ToArray());
|
|
|
|
|
|
+ loadedAssembly =Assembly.Load(assemblyStream.ToArray());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ LoadedAssemblies.Add(filename, loadedAssembly);
|
|
|
|
+
|
|
Logger.LogDebug($"Loaded '{assembly.FullName}' into memory");
|
|
Logger.LogDebug($"Loaded '{assembly.FullName}' into memory");
|
|
}
|
|
}
|
|
|
|
|