Browse Source

Added a level of indirection in the injector for safety loading shipped libraries

4.0.0-beta
Anairkoen Schno 5 years ago
parent
commit
d8d68ce4c2
3 changed files with 10 additions and 5 deletions
  1. +7
    -1
      IPA.Injector/Injector.cs
  2. +3
    -3
      IPA.Loader/Loader/LibLoader.cs
  3. +0
    -1
      IPA/obj/Debug/IPA.csproj.CoreCompileInputs.cache

+ 7
- 1
IPA.Injector/Injector.cs View File

@ -96,7 +96,7 @@ namespace IPA.Injector
GameVersionEarly.Load();
HarmonyProtector><span class="p">.Protect();
InstallHarmonyProtections();
pluginAsyncLoadTask = PluginLoader.LoadTask();
permissionFixTask = PermissionFix.FixPermissions(new DirectoryInfo(Environment.CurrentDirectory));
@ -104,6 +104,7 @@ namespace IPA.Injector
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
}
@ -123,6 +124,11 @@ namespace IPA.Injector
LibLoader.Configure();
}
private static void InstallHarmonyProtections()
{ // proxy function to delay resolution
HarmonyProtector.Protect();
}
private static void InstallBootstrapPatch()
{
var cAsmName = Assembly.GetExecutingAssembly().GetName();


+ 3
- 3
IPA.Loader/Loader/LibLoader.cs View File

@ -47,9 +47,9 @@ namespace IPA.Loader
internal static void Configure()
{
SetupAssemblyFilenames(true);
AppDomain.CurrentDomain.AssemblyResolve -= AssemblyLibLoader;
AppDomain.CurrentDomain.AssemblyResolve += AssemblyLibLoader;
SetupAssemblyFilenames(true);
}
internal static void SetupAssemblyFilenames(bool force = false)
@ -93,8 +93,8 @@ namespace IPA.Loader
}).All(f => true); // force it to iterate all
}
var unityData = Directory.EnumerateDirectories(Environment.CurrentDirectory, "*_Data").First();
AddDir(Path.Combine(unityData, "Plugins"));
//var unityData = Directory.EnumerateDirectories(Environment.CurrentDirectory, "*_Data").First();
//AddDir(Path.Combine(unityData, "Plugins"));
foreach (var dir in Environment.GetEnvironmentVariable("path").Split(Path.PathSeparator))
AddDir(dir);


+ 0
- 1
IPA/obj/Debug/IPA.csproj.CoreCompileInputs.cache View File

@ -1 +0,0 @@
cc86aa342ebce00fb3a7de08cdd743019e060632

Loading…
Cancel
Save