-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
31 changed files
with
2,200 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 14 | ||
VisualStudioVersion = 14.0.25123.0 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IPA", "IPA\IPA.csproj", "{14092533-98BB-40A4-9AFC-27BB75672A70}" | ||
ProjectSection(ProjectDependencies) = postProject | ||
{D1390268-F68B-4A55-B50D-EAD25756C8EF} = {D1390268-F68B-4A55-B50D-EAD25756C8EF} | ||
{D1C61AF5-0D2D-4752-8203-1C6929025F7C} = {D1C61AF5-0D2D-4752-8203-1C6929025F7C} | ||
{E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71} = {E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71} | ||
EndProjectSection | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Launcher", "Launcher\Launcher.csproj", "{D1390268-F68B-4A55-B50D-EAD25756C8EF}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IllusionPlugin", "IllusionPlugin\IllusionPlugin.csproj", "{E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IllusionInjector", "IllusionInjector\IllusionInjector.csproj", "{D1C61AF5-0D2D-4752-8203-1C6929025F7C}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{14092533-98BB-40A4-9AFC-27BB75672A70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{14092533-98BB-40A4-9AFC-27BB75672A70}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{14092533-98BB-40A4-9AFC-27BB75672A70}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{14092533-98BB-40A4-9AFC-27BB75672A70}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{D1390268-F68B-4A55-B50D-EAD25756C8EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{D1390268-F68B-4A55-B50D-EAD25756C8EF}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{D1390268-F68B-4A55-B50D-EAD25756C8EF}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{D1390268-F68B-4A55-B50D-EAD25756C8EF}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{E2848BFB-5432-42F4-8AE0-D2EC0CDF2F71}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{D1C61AF5-0D2D-4752-8203-1C6929025F7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{D1C61AF5-0D2D-4752-8203-1C6929025F7C}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{D1C61AF5-0D2D-4752-8203-1C6929025F7C}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{D1C61AF5-0D2D-4752-8203-1C6929025F7C}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{14092533-98BB-40A4-9AFC-27BB75672A70}</ProjectGuid> | ||
<OutputType>Exe</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>IPA</RootNamespace> | ||
<AssemblyName>IPA</AssemblyName> | ||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<TargetFrameworkProfile>Client</TargetFrameworkProfile> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>none</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Program.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
<Target Name="AfterBuild"> | ||
<Message Text="Packing..." Importance="normal" /> | ||
<ItemGroup> | ||
<LauncherDlls Include="$(SolutionDir)Launcher\$(OutDir)*.dll" /> | ||
<Launcher Include="$(SolutionDir)Launcher\$(OutDir)Launcher.exe" /> | ||
<Dlls Include="$(SolutionDir)IllusionInjector\$(OutDir)**\*" /> | ||
</ItemGroup> | ||
<Copy SourceFiles="@(Dlls)" DestinationFolder="$(OutputPath)IPA\Managed" /> | ||
<Copy SourceFiles="@(Launcher)" DestinationFolder="$(OutputPath)IPA" /> | ||
<Copy SourceFiles="@(LauncherDlls)" DestinationFolder="$(OutputPath)" /> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace IPA | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
if(args.Length < 1 || !args[0].EndsWith(".exe")) | ||
{ | ||
Fail("Drag an (executable) file on the exe!"); | ||
} | ||
|
||
string launcherSrc = Path.Combine("IPA", "Launcher.exe"); | ||
string managedFolder = Path.Combine("IPA", "Managed"); | ||
|
||
// Sanitizing | ||
if (!File.Exists(launcherSrc)) Fail("Couldn't find launcher! 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."); | ||
|
||
// Copying | ||
try | ||
{ | ||
string projectName = Path.GetFileNameWithoutExtension(args[0]); | ||
string launcherPath = Path.Combine(Environment.CurrentDirectory, projectName + "_Patched.exe"); | ||
string dataPath = Path.Combine(Path.Combine(Environment.CurrentDirectory, projectName + "_Data"), "Managed"); | ||
|
||
File.Copy(launcherSrc, launcherPath, true); | ||
CopyAll(new DirectoryInfo(managedFolder), new DirectoryInfo(dataPath)); | ||
|
||
Console.WriteLine("Successfully copied files!"); | ||
} catch(Exception e) | ||
{ | ||
Fail("Oops! This should not have happened.\n\n" + e); | ||
} | ||
} | ||
|
||
public static void CopyAll(DirectoryInfo source, DirectoryInfo target) | ||
{ | ||
Directory.CreateDirectory(target.FullName); | ||
|
||
// Copy each file into the new directory. | ||
foreach (FileInfo fi in source.GetFiles()) | ||
{ | ||
Console.WriteLine(@"Copying {0}\{1}", target.FullName, fi.Name); | ||
fi.CopyTo(Path.Combine(target.FullName, fi.Name), true); | ||
} | ||
|
||
// Copy each subdirectory using recursion. | ||
foreach (DirectoryInfo diSourceSubDir in source.GetDirectories()) | ||
{ | ||
DirectoryInfo nextTargetSubDir = | ||
target.CreateSubdirectory(diSourceSubDir.Name); | ||
CopyAll(diSourceSubDir, nextTargetSubDir); | ||
} | ||
} | ||
|
||
|
||
static void Fail(string message) | ||
{ | ||
Console.BackgroundColor = ConsoleColor.Red; | ||
Console.ForegroundColor = ConsoleColor.White; | ||
Console.Write("{0,80}", ""); | ||
Console.Write("{0,-80}", " "+message); | ||
Console.Write("{0,80}", ""); | ||
|
||
Console.ReadLine(); | ||
Environment.Exit(1); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("IPA")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("IPA")] | ||
[assembly: AssemblyCopyright("Copyright © 2016")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("14092533-98bb-40a4-9afc-27bb75672a70")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using UnityEngine; | ||
|
||
namespace IllusionInjector | ||
{ | ||
class Bootstrapper : MonoBehaviour | ||
{ | ||
public event Action Destroyed = delegate {}; | ||
|
||
void OnDestroy() | ||
{ | ||
Destroyed(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
using IllusionPlugin; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using UnityEngine; | ||
|
||
namespace IllusionInjector | ||
{ | ||
public class CompositePlugin : IPlugin | ||
{ | ||
IEnumerable<IPlugin> plugins; | ||
|
||
private delegate void CompositeCall(IPlugin plugin); | ||
|
||
public CompositePlugin(IEnumerable<IPlugin> plugins) | ||
{ | ||
this.plugins = plugins; | ||
} | ||
|
||
public void OnApplicationStart() | ||
{ | ||
Invoke(plugin => plugin.OnApplicationStart()); | ||
} | ||
|
||
public void OnApplicationQuit() | ||
{ | ||
Invoke(plugin => plugin.OnApplicationQuit()); | ||
} | ||
|
||
public void OnLevelWasLoaded(int level) | ||
{ | ||
foreach (var plugin in plugins) | ||
{ | ||
try | ||
{ | ||
plugin.OnLevelWasLoaded(level); | ||
} | ||
catch (Exception ex) | ||
{ | ||
Console.WriteLine("{0}: {1}", plugin.Name, ex); | ||
} | ||
} | ||
} | ||
|
||
|
||
private void Invoke(CompositeCall callback) | ||
{ | ||
foreach (var plugin in plugins) | ||
{ | ||
try | ||
{ | ||
callback(plugin); | ||
} | ||
catch (Exception ex) | ||
{ | ||
Console.WriteLine("{0}: {1}", plugin.Name, ex); | ||
} | ||
} | ||
} | ||
|
||
|
||
|
||
public void OnLevelWasInitialized(int level) | ||
{ | ||
foreach (var plugin in plugins) | ||
{ | ||
try | ||
{ | ||
plugin.OnLevelWasInitialized(level); | ||
} | ||
catch (Exception ex) | ||
{ | ||
Console.WriteLine("{0}: {1}", plugin.Name, ex); | ||
} | ||
} | ||
} | ||
|
||
|
||
public void OnUpdate() | ||
{ | ||
Invoke(plugin => plugin.OnUpdate()); | ||
} | ||
|
||
public void OnFixedUpdate() | ||
{ | ||
Invoke(plugin => plugin.OnFixedUpdate()); | ||
} | ||
|
||
|
||
public string Name | ||
{ | ||
get { throw new NotImplementedException(); } | ||
} | ||
|
||
public string Version | ||
{ | ||
get { throw new NotImplementedException(); } | ||
} | ||
|
||
public void OnLateUpdate() | ||
{ | ||
Invoke(plugin => | ||
{ | ||
if (plugin is IEnhancedPlugin) | ||
((IEnhancedPlugin)plugin).OnLateUpdate(); | ||
}); | ||
} | ||
} | ||
} |
Oops, something went wrong.