Various changes.

This commit is contained in:
Eusth 2017-01-20 18:16:54 +01:00
parent 68a45d1fab
commit e8873c191e
5 changed files with 18 additions and 14 deletions

View file

@ -89,7 +89,7 @@
<Launcher Include="$(SolutionDir)Launcher\$(OutDir)Launcher.exe" /> <Launcher Include="$(SolutionDir)Launcher\$(OutDir)Launcher.exe" />
<Dlls Include="$(SolutionDir)IllusionInjector\$(OutDir)**\*" /> <Dlls Include="$(SolutionDir)IllusionInjector\$(OutDir)**\*" />
</ItemGroup> </ItemGroup>
<Copy SourceFiles="@(Dlls)" DestinationFolder="$(OutputPath)IPA\Managed" /> <Copy SourceFiles="@(Dlls)" DestinationFolder="$(OutputPath)IPA\Data\Managed" />
<Copy SourceFiles="@(Launcher)" DestinationFolder="$(OutputPath)IPA" /> <Copy SourceFiles="@(Launcher)" DestinationFolder="$(OutputPath)IPA" />
</Target> </Target>
</Project> </Project>

View file

@ -17,26 +17,27 @@ namespace IPA
} }
string launcherSrc = Path.Combine("IPA", "Launcher.exe"); string launcherSrc = Path.Combine("IPA", "Launcher.exe");
string managedFolder = Path.Combine("IPA", "Managed"); string dataSrcPath = Path.Combine("IPA", "Data");
string pluginsFolder = "Plugins"; string pluginsFolder = "Plugins";
string projectName = Path.GetFileNameWithoutExtension(args[0]); string projectName = Path.GetFileNameWithoutExtension(args[0]);
string dataPath = Path.Combine(Path.Combine(Path.GetDirectoryName(args[0]), projectName + "_Data"), "Managed"); string dataDstPath = Path.Combine(Path.GetDirectoryName(args[0]), projectName + "_Data");
string engineFile = Path.Combine(dataPath, "UnityEngine.dll"); string managedPath = Path.Combine(dataDstPath, "Managed");
string assemblyFile = Path.Combine(dataPath, "Assembly-Csharp.dll"); string engineFile = Path.Combine(managedPath, "UnityEngine.dll");
string assemblyFile = Path.Combine(managedPath, "Assembly-Csharp.dll");
// Sanitizing // Sanitizing
if (!File.Exists(launcherSrc)) Fail("Couldn't find DLLs! Make sure you extracted all contents of the release archive."); if (!File.Exists(launcherSrc)) Fail("Couldn't find DLLs! Make sure you extracted all contents of the release archive.");
if(!Directory.Exists(dataPath) || !File.Exists(engineFile) || !File.Exists(assemblyFile)) if(!Directory.Exists(dataDstPath) || !File.Exists(engineFile) || !File.Exists(assemblyFile))
{ {
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. ");
} }
try try
{ {
// Copying // Copying
Console.Write("Updating files... "); Console.Write("Updating files... ");
CopyAll(new DirectoryInfo(managedFolder), new DirectoryInfo(dataPath)); CopyAll(new DirectoryInfo(dataSrcPath), new DirectoryInfo(dataDstPath));
Console.WriteLine("Successfully updated files!"); Console.WriteLine("Successfully updated files!");
if (!Directory.Exists(pluginsFolder)) if (!Directory.Exists(pluginsFolder))

View file

@ -9,6 +9,14 @@ namespace IllusionInjector
class Bootstrapper : MonoBehaviour class Bootstrapper : MonoBehaviour
{ {
public event Action Destroyed = delegate {}; public event Action Destroyed = delegate {};
void Awake()
{
if (Environment.CommandLine.Contains("--verbose") && !Screen.fullScreen)
{
Windows.GuiConsole.CreateConsole();
}
}
void Start() void Start()
{ {

View file

@ -1,4 +1,5 @@
using System; using System;
using System.IO;
using UnityEngine; using UnityEngine;
namespace IllusionInjector namespace IllusionInjector
@ -11,7 +12,6 @@ namespace IllusionInjector
if (!injected) if (!injected)
{ {
injected = true; injected = true;
var bootstrapper = new GameObject("Bootstrapper").AddComponent<Bootstrapper>(); var bootstrapper = new GameObject("Bootstrapper").AddComponent<Bootstrapper>();
bootstrapper.Destroyed += Bootstrapper_Destroyed; bootstrapper.Destroyed += Bootstrapper_Destroyed;
} }

View file

@ -14,11 +14,6 @@ namespace IllusionInjector
{ {
DontDestroyOnLoad(gameObject); DontDestroyOnLoad(gameObject);
if (Environment.CommandLine.Contains("--verbose") && !Screen.fullScreen)
{
Windows.GuiConsole.CreateConsole();
}
plugins = new CompositePlugin(PluginManager.Plugins); plugins = new CompositePlugin(PluginManager.Plugins);
plugins.OnApplicationStart(); plugins.OnApplicationStart();
} }