Improve shutdown handling and disable virtualizing when no Assembly is available.

This commit is contained in:
Eusth 2017-04-22 21:15:36 +02:00
parent ffd259040f
commit 0df8b1ecb8
2 changed files with 20 additions and 8 deletions

View file

@ -48,7 +48,7 @@ namespace IPA
private static void Validate(PatchContext c) private static void Validate(PatchContext c)
{ {
if (!File.Exists(c.LauncherPathSrc)) Fail("Couldn't find DLLs! Make sure you extracted all contents of the release archive."); if (!File.Exists(c.LauncherPathSrc)) Fail("Couldn't find DLLs! Make sure you extracted all contents of the release archive.");
if (!Directory.Exists(c.DataPathDst) || !File.Exists(c.EngineFile) || !File.Exists(c.AssemblyFile)) if (!Directory.Exists(c.DataPathDst) || !File.Exists(c.EngineFile))
{ {
Fail("Game does not seem to be a Unity project. Could not find the libraries to patch."); Fail("Game does not seem to be a Unity project. Could not find the libraries to patch.");
} }
@ -86,6 +86,8 @@ namespace IPA
} }
// Virtualizing // Virtualizing
if (File.Exists(context.AssemblyFile))
{
var virtualizedModule = VirtualizedModule.Load(context.AssemblyFile); var virtualizedModule = VirtualizedModule.Load(context.AssemblyFile);
if (!virtualizedModule.IsVirtualized) if (!virtualizedModule.IsVirtualized)
{ {
@ -94,6 +96,7 @@ namespace IPA
virtualizedModule.Virtualize(); virtualizedModule.Virtualize();
Console.WriteLine("Done!"); Console.WriteLine("Done!");
} }
}
// Creating shortcut // Creating shortcut
if(!File.Exists(context.ShortcutPath)) if(!File.Exists(context.ShortcutPath))

View file

@ -9,6 +9,7 @@ namespace IllusionInjector
{ {
private CompositePlugin plugins; private CompositePlugin plugins;
private bool freshlyLoaded = false; private bool freshlyLoaded = false;
private bool quitting = false;
public static PluginComponent Create() public static PluginComponent Create()
{ {
@ -49,10 +50,18 @@ namespace IllusionInjector
} }
void OnDestroy() void OnDestroy()
{
if (!quitting)
{
Create();
}
}
void OnApplicationQuit()
{ {
plugins.OnApplicationQuit(); plugins.OnApplicationQuit();
Create(); quitting = true;
} }
void OnLevelWasLoaded(int level) void OnLevelWasLoaded(int level)