Skip to content

Commit

Permalink
Improve shutdown handling and disable virtualizing when no Assembly i…
Browse files Browse the repository at this point in the history
…s available.
  • Loading branch information
Eusth committed Apr 22, 2017
1 parent ffd2590 commit 0df8b1e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
17 changes: 10 additions & 7 deletions IPA/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static void Main(string[] args)
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 (!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.");
}
Expand Down Expand Up @@ -86,13 +86,16 @@ private static void Install(PatchContext context)
}

// Virtualizing
var virtualizedModule = VirtualizedModule.Load(context.AssemblyFile);
if (!virtualizedModule.IsVirtualized)
if (File.Exists(context.AssemblyFile))
{
Console.Write("Virtualizing Assembly-Csharp.dll... ");
backup.Add(context.AssemblyFile);
virtualizedModule.Virtualize();
Console.WriteLine("Done!");
var virtualizedModule = VirtualizedModule.Load(context.AssemblyFile);
if (!virtualizedModule.IsVirtualized)
{
Console.Write("Virtualizing Assembly-Csharp.dll... ");
backup.Add(context.AssemblyFile);
virtualizedModule.Virtualize();
Console.WriteLine("Done!");
}
}

// Creating shortcut
Expand Down
11 changes: 10 additions & 1 deletion IllusionInjector/PluginComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class PluginComponent : MonoBehaviour
{
private CompositePlugin plugins;
private bool freshlyLoaded = false;
private bool quitting = false;

public static PluginComponent Create()
{
Expand Down Expand Up @@ -49,10 +50,18 @@ void FixedUpdate()
}

void OnDestroy()
{
if (!quitting)
{
Create();
}
}

void OnApplicationQuit()
{
plugins.OnApplicationQuit();

Create();
quitting = true;
}

void OnLevelWasLoaded(int level)
Expand Down

0 comments on commit 0df8b1e

Please sign in to comment.