Browse Source

Added support for the Doorstop early loader

pull/46/head
Anairkoen Schno 6 years ago
parent
commit
722b6d3393
6 changed files with 286 additions and 85 deletions
  1. +3
    -0
      .gitmodules
  2. +130
    -0
      BSIPA.sln
  3. +1
    -0
      Doorstop
  4. +16
    -9
      IPA.Injector/Injector.cs
  5. +27
    -1
      IPA/IPA.csproj
  6. +109
    -75
      IPA/Program.cs

+ 3
- 0
.gitmodules View File

@ -0,0 +1,3 @@
[submodule "Doorstop"]
path = Doorstop
url = https://github.com/NeighTools/UnityDoorstop.git

+ 130
- 0
BSIPA.sln View File

@ -17,32 +17,162 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IPA.Loader", "IPA.Loader\IP
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IPA.Injector", "IPA.Injector\IPA.Injector.csproj", "{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IPA.Injector", "IPA.Injector\IPA.Injector.csproj", "{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "proxy", "Doorstop\Proxy\Proxy.vcxproj", "{88609E16-731F-46C9-8139-6B1A7A83240D}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
Verbose_Release|Any CPU = Verbose_Release|Any CPU
Verbose_Release|x64 = Verbose_Release|x64
Verbose_Release|x86 = Verbose_Release|x86
Verbose|Any CPU = Verbose|Any CPU
Verbose|x64 = Verbose|x64
Verbose|x86 = Verbose|x86
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{14092533-98BB-40A4-9AFC-27BB75672A70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {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}.Debug|Any CPU.Build.0 = Debug|Any CPU
{14092533-98BB-40A4-9AFC-27BB75672A70}.Debug|x64.ActiveCfg = Debug|Any CPU
{14092533-98BB-40A4-9AFC-27BB75672A70}.Debug|x64.Build.0 = Debug|Any CPU
{14092533-98BB-40A4-9AFC-27BB75672A70}.Debug|x86.ActiveCfg = Debug|Any CPU
{14092533-98BB-40A4-9AFC-27BB75672A70}.Debug|x86.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.ActiveCfg = Release|Any CPU
{14092533-98BB-40A4-9AFC-27BB75672A70}.Release|Any CPU.Build.0 = Release|Any CPU {14092533-98BB-40A4-9AFC-27BB75672A70}.Release|Any CPU.Build.0 = Release|Any CPU
{14092533-98BB-40A4-9AFC-27BB75672A70}.Release|x64.ActiveCfg = Release|Any CPU
{14092533-98BB-40A4-9AFC-27BB75672A70}.Release|x64.Build.0 = Release|Any CPU
{14092533-98BB-40A4-9AFC-27BB75672A70}.Release|x86.ActiveCfg = Release|Any CPU
{14092533-98BB-40A4-9AFC-27BB75672A70}.Release|x86.Build.0 = Release|Any CPU
{14092533-98BB-40A4-9AFC-27BB75672A70}.Verbose_Release|Any CPU.ActiveCfg = Release|Any CPU
{14092533-98BB-40A4-9AFC-27BB75672A70}.Verbose_Release|Any CPU.Build.0 = Release|Any CPU
{14092533-98BB-40A4-9AFC-27BB75672A70}.Verbose_Release|x64.ActiveCfg = Verbose_Release|Any CPU
{14092533-98BB-40A4-9AFC-27BB75672A70}.Verbose_Release|x64.Build.0 = Verbose_Release|Any CPU
{14092533-98BB-40A4-9AFC-27BB75672A70}.Verbose_Release|x86.ActiveCfg = Release|Any CPU
{14092533-98BB-40A4-9AFC-27BB75672A70}.Verbose_Release|x86.Build.0 = Release|Any CPU
{14092533-98BB-40A4-9AFC-27BB75672A70}.Verbose|Any CPU.ActiveCfg = Release|Any CPU
{14092533-98BB-40A4-9AFC-27BB75672A70}.Verbose|Any CPU.Build.0 = Release|Any CPU
{14092533-98BB-40A4-9AFC-27BB75672A70}.Verbose|x64.ActiveCfg = Verbose|Any CPU
{14092533-98BB-40A4-9AFC-27BB75672A70}.Verbose|x64.Build.0 = Verbose|Any CPU
{14092533-98BB-40A4-9AFC-27BB75672A70}.Verbose|x86.ActiveCfg = Release|Any CPU
{14092533-98BB-40A4-9AFC-27BB75672A70}.Verbose|x86.Build.0 = Release|Any CPU
{C66092B0-5C1E-44E9-B524-E0E8E1425379}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C66092B0-5C1E-44E9-B524-E0E8E1425379}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C66092B0-5C1E-44E9-B524-E0E8E1425379}.Debug|Any CPU.Build.0 = Debug|Any CPU {C66092B0-5C1E-44E9-B524-E0E8E1425379}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C66092B0-5C1E-44E9-B524-E0E8E1425379}.Debug|x64.ActiveCfg = Debug|Any CPU
{C66092B0-5C1E-44E9-B524-E0E8E1425379}.Debug|x64.Build.0 = Debug|Any CPU
{C66092B0-5C1E-44E9-B524-E0E8E1425379}.Debug|x86.ActiveCfg = Debug|Any CPU
{C66092B0-5C1E-44E9-B524-E0E8E1425379}.Debug|x86.Build.0 = Debug|Any CPU
{C66092B0-5C1E-44E9-B524-E0E8E1425379}.Release|Any CPU.ActiveCfg = Release|Any CPU {C66092B0-5C1E-44E9-B524-E0E8E1425379}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C66092B0-5C1E-44E9-B524-E0E8E1425379}.Release|Any CPU.Build.0 = Release|Any CPU {C66092B0-5C1E-44E9-B524-E0E8E1425379}.Release|Any CPU.Build.0 = Release|Any CPU
{C66092B0-5C1E-44E9-B524-E0E8E1425379}.Release|x64.ActiveCfg = Release|Any CPU
{C66092B0-5C1E-44E9-B524-E0E8E1425379}.Release|x86.ActiveCfg = Release|Any CPU
{C66092B0-5C1E-44E9-B524-E0E8E1425379}.Release|x86.Build.0 = Release|Any CPU
{C66092B0-5C1E-44E9-B524-E0E8E1425379}.Verbose_Release|Any CPU.ActiveCfg = Release|Any CPU
{C66092B0-5C1E-44E9-B524-E0E8E1425379}.Verbose_Release|Any CPU.Build.0 = Release|Any CPU
{C66092B0-5C1E-44E9-B524-E0E8E1425379}.Verbose_Release|x64.ActiveCfg = Release|Any CPU
{C66092B0-5C1E-44E9-B524-E0E8E1425379}.Verbose_Release|x86.ActiveCfg = Release|Any CPU
{C66092B0-5C1E-44E9-B524-E0E8E1425379}.Verbose_Release|x86.Build.0 = Release|Any CPU
{C66092B0-5C1E-44E9-B524-E0E8E1425379}.Verbose|Any CPU.ActiveCfg = Release|Any CPU
{C66092B0-5C1E-44E9-B524-E0E8E1425379}.Verbose|Any CPU.Build.0 = Release|Any CPU
{C66092B0-5C1E-44E9-B524-E0E8E1425379}.Verbose|x64.ActiveCfg = Debug|Any CPU
{C66092B0-5C1E-44E9-B524-E0E8E1425379}.Verbose|x64.Build.0 = Debug|Any CPU
{C66092B0-5C1E-44E9-B524-E0E8E1425379}.Verbose|x86.ActiveCfg = Release|Any CPU
{C66092B0-5C1E-44E9-B524-E0E8E1425379}.Verbose|x86.Build.0 = Release|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Debug|Any CPU.Build.0 = Debug|Any CPU {F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Debug|x64.ActiveCfg = Debug|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Debug|x64.Build.0 = Debug|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Debug|x86.ActiveCfg = Debug|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Debug|x86.Build.0 = Debug|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Release|Any CPU.ActiveCfg = Release|Any CPU {F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Release|Any CPU.Build.0 = Release|Any CPU {F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Release|Any CPU.Build.0 = Release|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Release|x64.ActiveCfg = Release|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Release|x64.Build.0 = Release|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Release|x86.ActiveCfg = Release|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Release|x86.Build.0 = Release|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Verbose_Release|Any CPU.ActiveCfg = Release|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Verbose_Release|Any CPU.Build.0 = Release|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Verbose_Release|x64.ActiveCfg = Release|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Verbose_Release|x64.Build.0 = Release|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Verbose_Release|x86.ActiveCfg = Release|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Verbose_Release|x86.Build.0 = Release|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Verbose|Any CPU.ActiveCfg = Release|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Verbose|Any CPU.Build.0 = Release|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Verbose|x64.ActiveCfg = Debug|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Verbose|x64.Build.0 = Debug|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Verbose|x86.ActiveCfg = Release|Any CPU
{F08C3C7A-3221-432E-BAB8-32BCE58408C8}.Verbose|x86.Build.0 = Release|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5AD344F0-01A0-4CA8-92E5-9D095737744D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Debug|Any CPU.Build.0 = Debug|Any CPU {5AD344F0-01A0-4CA8-92E5-9D095737744D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Debug|x64.ActiveCfg = Debug|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Debug|x64.Build.0 = Debug|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Debug|x86.ActiveCfg = Debug|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Debug|x86.Build.0 = Debug|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Release|Any CPU.ActiveCfg = Release|Any CPU {5AD344F0-01A0-4CA8-92E5-9D095737744D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Release|Any CPU.Build.0 = Release|Any CPU {5AD344F0-01A0-4CA8-92E5-9D095737744D}.Release|Any CPU.Build.0 = Release|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Release|x64.ActiveCfg = Release|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Release|x64.Build.0 = Release|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Release|x86.ActiveCfg = Release|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Release|x86.Build.0 = Release|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Verbose_Release|Any CPU.ActiveCfg = Release|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Verbose_Release|Any CPU.Build.0 = Release|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Verbose_Release|x64.ActiveCfg = Release|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Verbose_Release|x64.Build.0 = Release|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Verbose_Release|x86.ActiveCfg = Release|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Verbose_Release|x86.Build.0 = Release|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Verbose|Any CPU.ActiveCfg = Release|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Verbose|Any CPU.Build.0 = Release|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Verbose|x64.ActiveCfg = Debug|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Verbose|x64.Build.0 = Debug|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Verbose|x86.ActiveCfg = Release|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Verbose|x86.Build.0 = Release|Any CPU
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Debug|Any CPU.Build.0 = Debug|Any CPU {2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Debug|x64.ActiveCfg = Debug|Any CPU
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Debug|x64.Build.0 = Debug|Any CPU
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Debug|x86.ActiveCfg = Debug|Any CPU
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Debug|x86.Build.0 = Debug|Any CPU
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Release|Any CPU.ActiveCfg = Release|Any CPU {2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Release|Any CPU.Build.0 = Release|Any CPU {2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Release|Any CPU.Build.0 = Release|Any CPU
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Release|x64.ActiveCfg = Release|Any CPU
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Release|x64.Build.0 = Release|Any CPU
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Release|x86.ActiveCfg = Release|Any CPU
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Release|x86.Build.0 = Release|Any CPU
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Verbose_Release|Any CPU.ActiveCfg = Release|Any CPU
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Verbose_Release|Any CPU.Build.0 = Release|Any CPU
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Verbose_Release|x64.ActiveCfg = Release|Any CPU
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Verbose_Release|x64.Build.0 = Release|Any CPU
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Verbose_Release|x86.ActiveCfg = Release|Any CPU
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Verbose_Release|x86.Build.0 = Release|Any CPU
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Verbose|Any CPU.ActiveCfg = Release|Any CPU
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Verbose|Any CPU.Build.0 = Release|Any CPU
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Verbose|x64.ActiveCfg = Debug|Any CPU
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Verbose|x64.Build.0 = Debug|Any CPU
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Verbose|x86.ActiveCfg = Release|Any CPU
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7}.Verbose|x86.Build.0 = Release|Any CPU
{88609E16-731F-46C9-8139-6B1A7A83240D}.Debug|Any CPU.ActiveCfg = Debug|Win32
{88609E16-731F-46C9-8139-6B1A7A83240D}.Debug|x64.ActiveCfg = Debug|x64
{88609E16-731F-46C9-8139-6B1A7A83240D}.Debug|x64.Build.0 = Debug|x64
{88609E16-731F-46C9-8139-6B1A7A83240D}.Debug|x86.ActiveCfg = Debug|Win32
{88609E16-731F-46C9-8139-6B1A7A83240D}.Debug|x86.Build.0 = Debug|Win32
{88609E16-731F-46C9-8139-6B1A7A83240D}.Release|Any CPU.ActiveCfg = Release|Win32
{88609E16-731F-46C9-8139-6B1A7A83240D}.Release|x64.ActiveCfg = Release|x64
{88609E16-731F-46C9-8139-6B1A7A83240D}.Release|x64.Build.0 = Release|x64
{88609E16-731F-46C9-8139-6B1A7A83240D}.Release|x86.ActiveCfg = Release|Win32
{88609E16-731F-46C9-8139-6B1A7A83240D}.Release|x86.Build.0 = Release|Win32
{88609E16-731F-46C9-8139-6B1A7A83240D}.Verbose_Release|Any CPU.ActiveCfg = Verbose_Release|Win32
{88609E16-731F-46C9-8139-6B1A7A83240D}.Verbose_Release|x64.ActiveCfg = Verbose_Release|x64
{88609E16-731F-46C9-8139-6B1A7A83240D}.Verbose_Release|x64.Build.0 = Verbose_Release|x64
{88609E16-731F-46C9-8139-6B1A7A83240D}.Verbose_Release|x86.ActiveCfg = Verbose_Release|Win32
{88609E16-731F-46C9-8139-6B1A7A83240D}.Verbose_Release|x86.Build.0 = Verbose_Release|Win32
{88609E16-731F-46C9-8139-6B1A7A83240D}.Verbose|Any CPU.ActiveCfg = Verbose|Win32
{88609E16-731F-46C9-8139-6B1A7A83240D}.Verbose|x64.ActiveCfg = Verbose|x64
{88609E16-731F-46C9-8139-6B1A7A83240D}.Verbose|x64.Build.0 = Verbose|x64
{88609E16-731F-46C9-8139-6B1A7A83240D}.Verbose|x86.ActiveCfg = Verbose|Win32
{88609E16-731F-46C9-8139-6B1A7A83240D}.Verbose|x86.Build.0 = Verbose|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE


+ 1
- 0
Doorstop

@ -0,0 +1 @@
Subproject commit 563b4d704eef6d96528b8940306ac25ead715594

+ 16
- 9
IPA.Injector/Injector.cs View File

@ -19,17 +19,24 @@ namespace IPA.Injector
// aren't defined in mscorlib, we can control exactly what // aren't defined in mscorlib, we can control exactly what
// gets loaded. // gets loaded.
// This loads AppDomain, System.IO, System.Collections.Generic, and System.Reflection.
// If kernel32.dll is not already loaded, this will also load it.
// This call also loads IPA.Loader and initializes the logging system. In the process
// it loads Ionic.Zip.
SetupLibraryLoading();
try
{
// This loads System.Runtime.InteropServices, and Microsoft.Win32.SafeHandles.
Windows.WinConsole.Initialize();
// This loads System.Runtime.InteropServices, and Microsoft.Win32.SafeHandles.
Windows.WinConsole.Initialize();
// This loads AppDomain, System.IO, System.Collections.Generic, and System.Reflection.
// If kernel32.dll is not already loaded, this will also load it.
// This call also loads IPA.Loader and initializes the logging system. In the process
// it loads Ionic.Zip.
SetupLibraryLoading();
// This will load Harmony and UnityEngine.CoreModule
InstallBootstrapPatch();
// This will load Harmony and UnityEngine.CoreModule
InstallBootstrapPatch();
}
catch (Exception e)
{
Console.WriteLine(e);
}
} }
private static void InstallBootstrapPatch() private static void InstallBootstrapPatch()


+ 27
- 1
IPA/IPA.csproj View File

@ -28,6 +28,8 @@
<IsWebBootstrapper>false</IsWebBootstrapper> <IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
<OtherConfig></OtherConfig>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@ -39,6 +41,7 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
<OtherConfig>Debug</OtherConfig>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@ -50,6 +53,7 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
<UseVSHostingProcess>true</UseVSHostingProcess> <UseVSHostingProcess>true</UseVSHostingProcess>
<OtherConfig>Release</OtherConfig>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<ApplicationIcon>favicon.ico</ApplicationIcon> <ApplicationIcon>favicon.ico</ApplicationIcon>
@ -60,6 +64,20 @@
<PropertyGroup> <PropertyGroup>
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Verbose|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Verbose\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<OtherConfig>Debug</OtherConfig>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Verbose_Release|AnyCPU'">
<OutputPath>bin\Verbose_Release\</OutputPath>
<OtherConfig>Release</OtherConfig>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
@ -106,6 +124,11 @@
<Install>false</Install> <Install>false</Install>
</BootstrapperPackage> </BootstrapperPackage>
</ItemGroup> </ItemGroup>
<ItemGroup>
<!--<ProjectsToBuild Include="$(SolutionDir)Doorstop\Proxy\Proxy.vcxproj">
<DestDir>bin\Proxy\$(Configuration)</DestDir>
</ProjectsToBuild>-->
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.
@ -117,9 +140,12 @@
<Target Name="AfterBuild"> <Target Name="AfterBuild">
<Message Text="Packing..." Importance="normal" /> <Message Text="Packing..." Importance="normal" />
<ItemGroup> <ItemGroup>
<Dlls Include="$(SolutionDir)IPA.Injector\$(OutDir)**\*" />
<Dlls Include="$(SolutionDir)IPA.Injector\bin\$(OtherConfig)\**\*" />
<Dlls Include="$(SolutionDir)Doorstop\Proxy\bin\x64\$(Configuration)\**\*.dll" />
<Dlls Include="$(SolutionDir)Doorstop\Proxy\bin\x64\$(Configuration)\**\*.pdb" />
</ItemGroup> </ItemGroup>
<Copy SourceFiles="@(Dlls)" DestinationFolder="$(OutputPath)IPA\%(RecursiveDir)" /> <Copy SourceFiles="@(Dlls)" DestinationFolder="$(OutputPath)IPA\%(RecursiveDir)" />
<Move SourceFiles="$(OutputPath)IPA\proxy.dll" DestinationFiles="$(OutputPath)IPA\winhttp.dll" />
<ItemGroup> <ItemGroup>
<BadDlls Include="$(OutputPath)Mono.Cecil.*" /> <BadDlls Include="$(OutputPath)Mono.Cecil.*" />
<!-- Kill the Mono.Cecil stuff that get put in the root, don't want to dupe it --> <!-- Kill the Mono.Cecil stuff that get put in the root, don't want to dupe it -->


+ 109
- 75
IPA/Program.cs View File

@ -31,11 +31,12 @@ namespace IPA
public static ArgumentFlag ArgNoWait = new ArgumentFlag("--nowait", "-n") { DocString = "doesn't wait for user input after the operation" }; public static ArgumentFlag ArgNoWait = new ArgumentFlag("--nowait", "-n") { DocString = "doesn't wait for user input after the operation" };
public static ArgumentFlag ArgStart = new ArgumentFlag("--start", "-s") { DocString = "uses value as arguments to start the game after the patch/unpatch", ValueString = "ARGUMENTS" }; public static ArgumentFlag ArgStart = new ArgumentFlag("--start", "-s") { DocString = "uses value as arguments to start the game after the patch/unpatch", ValueString = "ARGUMENTS" };
public static ArgumentFlag ArgLaunch = new ArgumentFlag("--launch", "-l") { DocString = "uses positional parameters as arguments to start the game after patch/unpatch" }; public static ArgumentFlag ArgLaunch = new ArgumentFlag("--launch", "-l") { DocString = "uses positional parameters as arguments to start the game after patch/unpatch" };
public static ArgumentFlag ArgDestructive = new ArgumentFlag("--destructive", "-d") { DocString = "patches the game using the now outdated destructive methods" };
[STAThread] [STAThread]
static void Main(string[] args) static void Main(string[] args)
{ {
Arguments.CmdLine.Flags(ArgHelp, ArgWaitFor, ArgForce, ArgRevert, ArgNoWait, ArgStart, ArgLaunch).Process();
Arguments.CmdLine.Flags(ArgHelp, ArgWaitFor, ArgForce, ArgRevert, ArgNoWait, ArgStart, ArgLaunch, ArgDestructive).Process();
if (ArgHelp) if (ArgHelp)
{ {
@ -132,35 +133,115 @@ namespace IPA
{ {
var backup = new BackupUnit(context); var backup = new BackupUnit(context);
#region Patch Version Check
if (ArgDestructive)
{
#region Patch Version Check
var patchedModule = PatchedModule.Load(context.EngineFile);
var patchedModule = PatchedModule.Load(context.EngineFile);
#if DEBUG #if DEBUG
var isCurrentNewer = Version.CompareTo(patchedModule.Data.Version) >= 0;
var isCurrentNewer = Version.CompareTo(patchedModule.Data.Version) >= 0;
#else #else
var isCurrentNewer = Version.CompareTo(patchedModule.Data.Version) > 0;
var isCurrentNewer = Version.CompareTo(patchedModule.Data.Version) > 0;
#endif #endif
Console.WriteLine($"Current: {Version} Patched: {patchedModule.Data.Version}");
if (isCurrentNewer)
Console.WriteLine($"Current: {Version} Patched: {patchedModule.Data.Version}");
if (isCurrentNewer)
{
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine(
$"Preparing for update, {(patchedModule.Data.Version == null ? "UnPatched" : patchedModule.Data.Version.ToString())} => {Version}");
Console.WriteLine("--- Starting ---");
Revert(context);
Console.ResetColor();
#region File Copying
Console.ForegroundColor = ConsoleColor.Magenta;
Console.WriteLine("Updating files... ");
var nativePluginFolder = Path.Combine(context.DataPathDst, "Plugins");
bool isFlat = Directory.Exists(nativePluginFolder) &&
Directory.GetFiles(nativePluginFolder).Any(f => f.EndsWith(".dll"));
bool force = !BackupManager.HasBackup(context) || ArgForce;
var architecture = DetectArchitecture(context.Executable);
Console.WriteLine("Architecture: {0}", architecture);
CopyAll(new DirectoryInfo(context.DataPathSrc), new DirectoryInfo(context.DataPathDst), force,
backup,
(from, to) => NativePluginInterceptor(from, to, new DirectoryInfo(nativePluginFolder), isFlat,
architecture));
CopyAll(new DirectoryInfo(context.LibsPathSrc), new DirectoryInfo(context.LibsPathDst), force,
backup,
(from, to) => NativePluginInterceptor(from, to, new DirectoryInfo(nativePluginFolder), isFlat,
architecture));
Console.WriteLine("Successfully updated files!");
#endregion
}
else
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine($"Files up to date @ Version {Version}!");
Console.ResetColor();
}
#endregion
#region Patching
if (!patchedModule.Data.IsPatched || isCurrentNewer)
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine($"Patching UnityEngine.dll with Version {Application.ProductVersion}... ");
backup.Add(context.EngineFile);
patchedModule.Patch(Version);
Console.WriteLine("Done!");
Console.ResetColor();
}
#endregion
#region Creating shortcut
if (!File.Exists(context.ShortcutPath))
{
Console.ForegroundColor = ConsoleColor.DarkGreen;
Console.WriteLine("Creating shortcut to IPA ({0})... ", context.IPA);
try
{
Shortcut.Create(
fileName: context.ShortcutPath,
targetPath: context.IPA,
arguments: Args(context.Executable, "-ln"),
workingDirectory: context.ProjectRoot,
description: "Launches the game and makes sure it's in a patched state",
hotkey: "",
iconPath: context.Executable
);
}
catch (Exception)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.Error.WriteLine("Failed to create shortcut, but game was patched!");
}
Console.ResetColor();
}
#endregion
}
else
{ {
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine(
$"Preparing for update, {(patchedModule.Data.Version == null ? "UnPatched" : patchedModule.Data.Version.ToString())} => {Version}");
Console.WriteLine("--- Starting ---");
Revert(context);
Console.ResetColor();
#region File Copying
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine("Restoring old version... ");
if (BackupManager.HasBackup(context))
BackupManager.Restore(context);
Console.ForegroundColor = ConsoleColor.Magenta;
Console.WriteLine("Updating files... ");
var nativePluginFolder = Path.Combine(context.DataPathDst, "Plugins"); var nativePluginFolder = Path.Combine(context.DataPathDst, "Plugins");
bool isFlat = Directory.Exists(nativePluginFolder) && bool isFlat = Directory.Exists(nativePluginFolder) &&
Directory.GetFiles(nativePluginFolder).Any(f => f.EndsWith(".dll")); Directory.GetFiles(nativePluginFolder).Any(f => f.EndsWith(".dll"));
bool force = !BackupManager.HasBackup(context) || ArgForce; bool force = !BackupManager.HasBackup(context) || ArgForce;
var architecture = DetectArchitecture(context.Executable); var architecture = DetectArchitecture(context.Executable);
Console.WriteLine("Architecture: {0}", architecture);
Console.ForegroundColor = ConsoleColor.DarkCyan;
Console.WriteLine("Installing files... ");
CopyAll(new DirectoryInfo(context.DataPathSrc), new DirectoryInfo(context.DataPathDst), force, CopyAll(new DirectoryInfo(context.DataPathSrc), new DirectoryInfo(context.DataPathDst), force,
backup, backup,
@ -170,20 +251,11 @@ namespace IPA
backup, backup,
(from, to) => NativePluginInterceptor(from, to, new DirectoryInfo(nativePluginFolder), isFlat, (from, to) => NativePluginInterceptor(from, to, new DirectoryInfo(nativePluginFolder), isFlat,
architecture)); architecture));
Console.WriteLine("Successfully updated files!");
#endregion
}
else
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine($"Files up to date @ Version {Version}!");
Console.ResetColor();
CopyAll(new DirectoryInfo(context.IPARoot), new DirectoryInfo(context.ProjectRoot), force,
backup,
null, false);
} }
#endregion
#region Create Plugin Folder #region Create Plugin Folder
if (!Directory.Exists(context.PluginsFolder)) if (!Directory.Exists(context.PluginsFolder))
@ -196,20 +268,6 @@ namespace IPA
#endregion #endregion
#region Patching
if (!patchedModule.Data.IsPatched || isCurrentNewer)
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine($"Patching UnityEngine.dll with Version {Application.ProductVersion}... ");
backup.Add(context.EngineFile);
patchedModule.Patch(Version);
Console.WriteLine("Done!");
Console.ResetColor();
}
#endregion
#region Virtualizing #region Virtualizing
if (File.Exists(context.AssemblyFile)) if (File.Exists(context.AssemblyFile))
@ -228,31 +286,6 @@ namespace IPA
#endregion #endregion
#region Creating shortcut
if (!File.Exists(context.ShortcutPath))
{
Console.ForegroundColor = ConsoleColor.DarkGreen;
Console.WriteLine("Creating shortcut to IPA ({0})... ", context.IPA);
try
{
Shortcut.Create(
fileName: context.ShortcutPath,
targetPath: context.IPA,
arguments: Args(context.Executable, "-ln"),
workingDirectory: context.ProjectRoot,
description: "Launches the game and makes sure it's in a patched state",
hotkey: "",
iconPath: context.Executable
);
}
catch (Exception)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.Error.WriteLine("Failed to create shortcut, but game was patched!");
}
Console.ResetColor();
}
#endregion
} }
catch (Exception e) catch (Exception e)
{ {
@ -372,7 +405,7 @@ namespace IPA
} }
public static void CopyAll(DirectoryInfo source, DirectoryInfo target, bool aggressive, BackupUnit backup, public static void CopyAll(DirectoryInfo source, DirectoryInfo target, bool aggressive, BackupUnit backup,
Func<FileInfo, FileInfo, IEnumerable<FileInfo>> interceptor = null)
Func<FileInfo, FileInfo, IEnumerable<FileInfo>> interceptor = null, bool recurse = true)
{ {
if (interceptor == null) if (interceptor == null)
{ {
@ -398,11 +431,12 @@ namespace IPA
} }
// Copy each subdirectory using recursion. // Copy each subdirectory using recursion.
foreach (DirectoryInfo diSourceSubDir in source.GetDirectories())
{
DirectoryInfo nextTargetSubDir = new DirectoryInfo(Path.Combine(target.FullName, diSourceSubDir.Name));
CopyAll(diSourceSubDir, nextTargetSubDir, aggressive, backup, interceptor);
}
if (recurse)
foreach (DirectoryInfo diSourceSubDir in source.GetDirectories())
{
DirectoryInfo nextTargetSubDir = new DirectoryInfo(Path.Combine(target.FullName, diSourceSubDir.Name));
CopyAll(diSourceSubDir, nextTargetSubDir, aggressive, backup, interceptor, recurse);
}
} }


Loading…
Cancel
Save