Browse Source

Switched to using BuildTools submodule

pull/46/head
DaNike 5 years ago
parent
commit
3c8e31cc6f
17 changed files with 39 additions and 677 deletions
  1. +3
    -0
      .gitmodules
  2. +33
    -30
      BSIPA.sln
  3. +1
    -0
      BuildTools
  4. +0
    -6
      CollectDependencies/App.config
  5. +0
    -71
      CollectDependencies/CollectDependencies.csproj
  6. +0
    -135
      CollectDependencies/Program.cs
  7. +0
    -35
      CollectDependencies/Properties/AssemblyInfo.cs
  8. +0
    -111
      CollectDependencies/Virtualizer.cs
  9. +0
    -4
      CollectDependencies/packages.config
  10. +1
    -4
      IPA.Injector/PostBuild.msbuild
  11. +0
    -73
      MSBuildTasks/AssemblyRenameTask.cs
  12. +0
    -84
      MSBuildTasks/MSBuildTasks.csproj
  13. +0
    -79
      MSBuildTasks/Pdb2Mdb.cs
  14. +0
    -35
      MSBuildTasks/Properties/AssemblyInfo.cs
  15. +0
    -9
      MSBuildTasks/packages.config
  16. BIN
      Refs/UnityEngine.CoreModule.dll
  17. +1
    -1
      Refs/refs.txt

+ 3
- 0
.gitmodules View File

@ -1,3 +1,6 @@
[submodule "Doorstop"]
path = Doorstop
url = https://github.com/nike4613/UnityDoorstop-BSIPA
[submodule "BuildTools"]
path = BuildTools
url = https://github.com/nike4613/BS-Plugin-BuildTools.git

+ 33
- 30
BSIPA.sln View File

@ -5,11 +5,11 @@ VisualStudioVersion = 15.0.27428.2043
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IPA", "IPA\IPA.csproj", "{14092533-98BB-40A4-9AFC-27BB75672A70}"
ProjectSection(ProjectDependencies) = postProject
{5F33B310-DC8D-4C0D-877E-BAC3908DE10F} = {5F33B310-DC8D-4C0D-877E-BAC3908DE10F}
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A} = {E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}
{2A1AF16B-27F1-46E0-9A95-181516BC1CB7} = {2A1AF16B-27F1-46E0-9A95-181516BC1CB7}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MSBuildTasks", "MSBuildTasks\MSBuildTasks.csproj", "{F08C3C7A-3221-432E-BAB8-32BCE58408C8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IPA.Loader", "IPA.Loader\IPA.Loader.csproj", "{5AD344F0-01A0-4CA8-92E5-9D095737744D}"
ProjectSection(ProjectDependencies) = postProject
{5F33B310-DC8D-4C0D-877E-BAC3908DE10F} = {5F33B310-DC8D-4C0D-877E-BAC3908DE10F}
@ -19,7 +19,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IPA.Injector", "IPA.Injecto
ProjectSection(ProjectDependencies) = postProject
{5F33B310-DC8D-4C0D-877E-BAC3908DE10F} = {5F33B310-DC8D-4C0D-877E-BAC3908DE10F}
{88609E16-731F-46C9-8139-6B1A7A83240D} = {88609E16-731F-46C9-8139-6B1A7A83240D}
{F08C3C7A-3221-432E-BAB8-32BCE58408C8} = {F08C3C7A-3221-432E-BAB8-32BCE58408C8}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "proxy", "Doorstop\Proxy\Proxy.vcxproj", "{88609E16-731F-46C9-8139-6B1A7A83240D}"
@ -29,14 +28,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{C79C2C3A
Refs\refs.txt = Refs\refs.txt
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CollectDependencies", "CollectDependencies\CollectDependencies.csproj", "{5F33B310-DC8D-4C0D-877E-BAC3908DE10F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4D6639A2-BD39-4F9B-AF7F-8E5F3B88243D}"
ProjectSection(SolutionItems) = preProject
appveyor.yml = appveyor.yml
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CollectDependencies", "BuildTools\CollectDependencies\CollectDependencies.csproj", "{5F33B310-DC8D-4C0D-877E-BAC3908DE10F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyRenameStep", "BuildTools\AssemblyRenameStep\AssemblyRenameStep.csproj", "{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -77,30 +78,6 @@ Global
{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
{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|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.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.Build.0 = Debug|Any CPU
{5AD344F0-01A0-4CA8-92E5-9D095737744D}.Debug|x64.ActiveCfg = Debug|Any CPU
@ -178,11 +155,13 @@ Global
{5F33B310-DC8D-4C0D-877E-BAC3908DE10F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5F33B310-DC8D-4C0D-877E-BAC3908DE10F}.Release|Any CPU.Build.0 = Release|Any CPU
{5F33B310-DC8D-4C0D-877E-BAC3908DE10F}.Release|x64.ActiveCfg = Release|Any CPU
{5F33B310-DC8D-4C0D-877E-BAC3908DE10F}.Release|x64.Build.0 = Release|Any CPU
{5F33B310-DC8D-4C0D-877E-BAC3908DE10F}.Release|x86.ActiveCfg = Release|Any CPU
{5F33B310-DC8D-4C0D-877E-BAC3908DE10F}.Release|x86.Build.0 = Release|Any CPU
{5F33B310-DC8D-4C0D-877E-BAC3908DE10F}.Verbose_Release|Any CPU.ActiveCfg = Release|Any CPU
{5F33B310-DC8D-4C0D-877E-BAC3908DE10F}.Verbose_Release|Any CPU.Build.0 = Release|Any CPU
{5F33B310-DC8D-4C0D-877E-BAC3908DE10F}.Verbose_Release|x64.ActiveCfg = Release|Any CPU
{5F33B310-DC8D-4C0D-877E-BAC3908DE10F}.Verbose_Release|x64.Build.0 = Release|Any CPU
{5F33B310-DC8D-4C0D-877E-BAC3908DE10F}.Verbose_Release|x86.ActiveCfg = Release|Any CPU
{5F33B310-DC8D-4C0D-877E-BAC3908DE10F}.Verbose_Release|x86.Build.0 = Release|Any CPU
{5F33B310-DC8D-4C0D-877E-BAC3908DE10F}.Verbose|Any CPU.ActiveCfg = Release|Any CPU
@ -191,13 +170,37 @@ Global
{5F33B310-DC8D-4C0D-877E-BAC3908DE10F}.Verbose|x64.Build.0 = Release|Any CPU
{5F33B310-DC8D-4C0D-877E-BAC3908DE10F}.Verbose|x86.ActiveCfg = Release|Any CPU
{5F33B310-DC8D-4C0D-877E-BAC3908DE10F}.Verbose|x86.Build.0 = Release|Any CPU
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}.Debug|x64.ActiveCfg = Debug|Any CPU
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}.Debug|x64.Build.0 = Debug|Any CPU
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}.Debug|x86.ActiveCfg = Debug|Any CPU
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}.Debug|x86.Build.0 = Debug|Any CPU
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}.Release|Any CPU.Build.0 = Release|Any CPU
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}.Release|x64.ActiveCfg = Release|Any CPU
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}.Release|x64.Build.0 = Release|Any CPU
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}.Release|x86.ActiveCfg = Release|Any CPU
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}.Release|x86.Build.0 = Release|Any CPU
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}.Verbose_Release|Any CPU.ActiveCfg = Release|Any CPU
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}.Verbose_Release|Any CPU.Build.0 = Release|Any CPU
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}.Verbose_Release|x64.ActiveCfg = Release|Any CPU
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}.Verbose_Release|x64.Build.0 = Release|Any CPU
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}.Verbose_Release|x86.ActiveCfg = Release|Any CPU
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}.Verbose_Release|x86.Build.0 = Release|Any CPU
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}.Verbose|Any CPU.ActiveCfg = Release|Any CPU
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}.Verbose|Any CPU.Build.0 = Release|Any CPU
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}.Verbose|x64.ActiveCfg = Release|Any CPU
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}.Verbose|x64.Build.0 = Release|Any CPU
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}.Verbose|x86.ActiveCfg = Release|Any CPU
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A}.Verbose|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{F08C3C7A-3221-432E-BAB8-32BCE58408C8} = {C79C2C3A-A7FC-40D6-A5CC-9752A661AFA9}
{5F33B310-DC8D-4C0D-877E-BAC3908DE10F} = {C79C2C3A-A7FC-40D6-A5CC-9752A661AFA9}
{E2CCDD2F-1D4F-4B06-9CD4-E0D2B9AE543A} = {C79C2C3A-A7FC-40D6-A5CC-9752A661AFA9}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C7380FAB-02D6-4A2A-B428-B4BFCFE3A054}


+ 1
- 0
BuildTools

@ -0,0 +1 @@
Subproject commit de919c49496a7e7e11382bd876473018ddceaa1a

+ 0
- 6
CollectDependencies/App.config View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

+ 0
- 71
CollectDependencies/CollectDependencies.csproj View File

@ -1,71 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" 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>{5F33B310-DC8D-4C0D-877E-BAC3908DE10F}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>CollectDependencies</RootNamespace>
<AssemblyName>CollectDependencies</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</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>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Cecil, Version=0.10.3.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.10.3\lib\net40\Mono.Cecil.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Mdb, Version=0.10.3.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.10.3\lib\net40\Mono.Cecil.Mdb.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Pdb, Version=0.10.3.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.10.3\lib\net40\Mono.Cecil.Pdb.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Rocks, Version=0.10.3.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.10.3\lib\net40\Mono.Cecil.Rocks.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Virtualizer.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="AfterBuild">
<Exec Command="&quot;$(SolutionDir)$(AssemblyName)\$(OutputPath)$(AssemblyName).exe&quot; Refs/refs.txt" WorkingDirectory="$(SolutionDir)">
</Exec>
</Target>
</Project>

+ 0
- 135
CollectDependencies/Program.cs View File

@ -1,135 +0,0 @@
using Mono.Cecil;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace CollectDependencies
{
static class Program
{
static void Main(string[] args)
{
var depsFile = File.ReadAllText(args[0]);
var directoryName = Path.GetDirectoryName(args[0]);
var files = new List<Tuple<string, int>>();
{ // Create files from stuff in depsfile
var stack = new Stack<string>();
void Push(string val)
{
string pre = "";
if (stack.Count > 0)
pre = stack.First();
stack.Push(pre + val);
}
string Pop() => stack.Pop();
string Replace(string val)
{
var v2 = Pop();
Push(val);
return v2;
}
var lineNo = 0;
foreach (var line in depsFile.Split(new[] { Environment.NewLine, "\n" }, StringSplitOptions.None))
{
var parts = line.Split('"');
var path = parts.Last();
var level = parts.Length - 1;
if (path.StartsWith("::"))
{ // pseudo-command
parts = path.Split(' ');
var command = parts[0].Substring(2);
parts = parts.Skip(1).ToArray();
var arglist = string.Join(" ", parts);
if (command == "from")
{ // an "import" type command
path = File.ReadAllText(Path.Combine(directoryName ?? throw new InvalidOperationException(), arglist));
}
else if (command == "prompt")
{
Console.Write(arglist);
path = Console.ReadLine();
}
else
{
path = "";
Console.Error.WriteLine($"Invalid command {command}");
}
}
if (level > stack.Count - 1)
Push(path);
else if (level == stack.Count - 1)
files.Add(new Tuple<string, int>(Replace(path), lineNo));
else if (level < stack.Count - 1)
{
files.Add(new Tuple<string, int>(Pop(), lineNo));
while (level < stack.Count)
Pop();
Push(path);
}
lineNo++;
}
files.Add(new Tuple<string, int>(Pop(), lineNo));
}
foreach (var file in files)
{
try
{
var fparts = file.Item1.Split('?');
var fname = fparts[0];
if (fname == "") continue;
var outp = Path.Combine(directoryName ?? throw new InvalidOperationException(),
Path.GetFileName(fname) ?? throw new InvalidOperationException());
Console.WriteLine($"Copying \"{fname}\" to \"{outp}\"");
if (File.Exists(outp)) File.Delete(outp);
if (Path.GetExtension(fname)?.ToLower() == ".dll")
{
// ReSharper disable once StringLiteralTypo
if (fparts.Length > 1 && fparts[1] == "virt")
{
var module = VirtualizedModule.Load(fname);
module.Virtualize(Path.Combine(Path.GetTempPath(), Path.GetRandomFileName(),
Path.GetFileName(fname) ?? throw new InvalidOperationException()));
}
var modl = ModuleDefinition.ReadModule(fparts[0]);
foreach (var t in modl.Types)
{
foreach (var m in t.Methods)
{
if (m.Body != null)
{
m.Body.Instructions.Clear();
m.Body.InitLocals = false;
m.Body.Variables.Clear();
}
}
}
modl.Write(outp);
}
else
{
File.Copy(fname, outp);
}
}
catch (Exception e)
{
Console.WriteLine($"{Path.Combine(Environment.CurrentDirectory, args[0])}({file.Item2}): error: {e}");
}
}
}
}
}

+ 0
- 35
CollectDependencies/Properties/AssemblyInfo.cs View File

@ -1,35 +0,0 @@
using System.Reflection;
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("CollectDependencies")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CollectDependencies")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[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("5f33b310-dc8d-4c0d-877e-bac3908de10f")]
// 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")]

+ 0
- 111
CollectDependencies/Virtualizer.cs View File

@ -1,111 +0,0 @@
using Mono.Cecil;
using System.IO;
using System.Linq;
namespace CollectDependencies
{
class VirtualizedModule
{
private readonly FileInfo _file;
private ModuleDefinition _module;
public static VirtualizedModule Load(string engineFile)
{
return new VirtualizedModule(engineFile);
}
private VirtualizedModule(string assemblyFile)
{
_file = new FileInfo(assemblyFile);
LoadModules();
}
private void LoadModules()
{
var resolver = new DefaultAssemblyResolver();
resolver.AddSearchDirectory(_file.DirectoryName);
var parameters = new ReaderParameters
{
AssemblyResolver = resolver,
};
_module = ModuleDefinition.ReadModule(_file.FullName, parameters);
}
/// <summary>
///
/// </summary>
/// <param name="targetFile"></param>
public void Virtualize(string targetFile)
{
foreach (var type in _module.Types)
{
VirtualizeType(type);
}
_module.Write(targetFile);
}
private void VirtualizeType(TypeDefinition type)
{
if(type.IsSealed)
{
// Unseal
type.IsSealed = false;
}
if (type.IsInterface) return;
if (type.IsAbstract) return;
// These two don't seem to work.
if (type.Name == "SceneControl" || type.Name == "ConfigUI") return;
// Take care of sub types
foreach (var subType in type.NestedTypes)
{
VirtualizeType(subType);
}
foreach (var method in type.Methods)
{
if (method.IsManaged
&& method.IsIL
&& !method.IsStatic
&& !method.IsVirtual
&& !method.IsAbstract
&& !method.IsAddOn
&& !method.IsConstructor
&& !method.IsSpecialName
&& !method.IsGenericInstance
&& !method.HasOverrides)
{
method.IsVirtual = true;
method.IsPublic = true;
method.IsPrivate = false;
method.IsNewSlot = true;
method.IsHideBySig = true;
}
}
foreach (var field in type.Fields)
{
if (field.IsPrivate) field.IsFamily = true;
}
}
public bool IsVirtualized
{
get
{
var awakeMethods = _module.GetTypes().SelectMany(t => t.Methods.Where(m => m.Name == "Awake"));
var methodDefinitions = awakeMethods as MethodDefinition[] ?? awakeMethods.ToArray();
if (!methodDefinitions.Any()) return false;
return ((float)methodDefinitions.Count(m => m.IsVirtual) / methodDefinitions.Count()) > 0.5f;
}
}
}
}

+ 0
- 4
CollectDependencies/packages.config View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Mono.Cecil" version="0.10.3" targetFramework="net472" />
</packages>

+ 1
- 4
IPA.Injector/PostBuild.msbuild View File

@ -5,8 +5,7 @@
<SolDir></SolDir>
</PropertyGroup>
<UsingTask TaskName="AssemblyRename" AssemblyFile="$(SolDir)MSBuildTasks\bin\$(Configuration)\MSBuildTasks.dll" />
<UsingTask TaskName="PdbToMdb" AssemblyFile="$(SolDir)MSBuildTasks\bin\$(Configuration)\MSBuildTasks.dll" />
<UsingTask TaskName="AssemblyRename" AssemblyFile="$(SolDir)BuildTools\AssemblyRenameStep\bin\$(Configuration)\AssemblyRenameStep.dll" />
<Target Name="PostBuild">
<Message Text="Relocating" Importance="normal" />
@ -30,9 +29,7 @@
<ItemGroup>
<ToRename Include="$(OPath)Libs\**\*.dll" />
<ToMdb Include="$(OPath)**\*.pdb" />
</ItemGroup>
<AssemblyRename Assemblies="@(ToRename)" />
<PdbToMdb Binaries="@(ToMdb)" />
</Target>
</Project>

+ 0
- 73
MSBuildTasks/AssemblyRenameTask.cs View File

@ -1,73 +0,0 @@
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Mono.Cecil;
using System;
using System.IO;
namespace MSBuildTasks
{
public class AssemblyRename : Task
{
[Required]
// ReSharper disable once UnusedAutoPropertyAccessor.Global
public ITaskItem[] Assemblies { get; set; }
public override bool Execute()
{
foreach (ITaskItem assembly in Assemblies)
{
// ItemSpec holds the filename or path of an Item
if (assembly.ItemSpec.Length > 0)
{
if (!File.Exists(assembly.ItemSpec))
{
Log.LogMessage(MessageImportance.Normal, "No file at " + assembly.ItemSpec);
continue;
}
if (Path.GetExtension(assembly.ItemSpec) != ".dll")
{
Log.LogMessage(MessageImportance.Normal, assembly.ItemSpec + " not a DLL");
continue;
}
try
{
Log.LogMessage(MessageImportance.Normal, "Reading " + assembly.ItemSpec);
var module = ModuleDefinition.ReadModule(assembly.ItemSpec);
var asmName = module.Assembly.Name;
var name = asmName.Name;
var version = asmName.Version;
var newFilen = $"{name}.{version}.dll";
var newFilePath = Path.Combine(Path.GetDirectoryName(assembly.ItemSpec) ?? throw new InvalidOperationException(), newFilen);
module.Dispose();
Log.LogMessage(MessageImportance.Normal, $"Old file: {assembly.ItemSpec}, new file: {newFilePath}");
if (File.Exists(newFilePath))
File.Delete(newFilePath);
Log.LogMessage(MessageImportance.Normal, "Moving");
try
{
File.Move(assembly.ItemSpec, newFilePath);
}
catch (Exception)
{
File.Copy(assembly.ItemSpec, newFilePath);
File.Delete(assembly.ItemSpec);
}
}
catch (Exception e)
{
Log.LogErrorFromException(e);
}
}
}
return !Log.HasLoggedErrors;
}
}
}

+ 0
- 84
MSBuildTasks/MSBuildTasks.csproj View File

@ -1,84 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" 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>{F08C3C7A-3221-432E-BAB8-32BCE58408C8}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MSBuildTasks</RootNamespace>
<AssemblyName>MSBuildTasks</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>true</UseVSHostingProcess>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Build.Framework.15.9.20\lib\net46\Microsoft.Build.Framework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Build.Utilities.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Build.Utilities.Core.15.9.20\lib\net46\Microsoft.Build.Utilities.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.Setup.Configuration.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.VisualStudio.Setup.Configuration.Interop.1.16.30\lib\net35\Microsoft.VisualStudio.Setup.Configuration.Interop.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Mono.Cecil, Version=0.10.3.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.10.3\lib\net40\Mono.Cecil.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Mdb, Version=0.10.3.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.10.3\lib\net40\Mono.Cecil.Mdb.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Pdb, Version=0.10.3.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.10.3\lib\net40\Mono.Cecil.Pdb.dll</HintPath>
</Reference>
<Reference Include="Mono.Cecil.Rocks, Version=0.10.3.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\packages\Mono.Cecil.0.10.3\lib\net40\Mono.Cecil.Rocks.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Collections.Immutable, Version=1.2.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Collections.Immutable.1.5.0\lib\netstandard1.3\System.Collections.Immutable.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyRenameTask.cs" />
<Compile Include="Pdb2Mdb.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

+ 0
- 79
MSBuildTasks/Pdb2Mdb.cs View File

@ -1,79 +0,0 @@
using System;
using System.IO;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace MSBuildTasks
{
public class PdbToMdb : Task
{
[Required]
// ReSharper disable once UnusedAutoPropertyAccessor.Global
public ITaskItem[] Binaries { get; set; }
public override bool Execute()
{
//var readerProvider = new PdbReaderProvider();
//var writerProvider = new MdbWriterProvider();
foreach (ITaskItem dll in Binaries)
{
// ItemSpec holds the filename or path of an Item
if (dll.ItemSpec.Length > 0)
{
if (!File.Exists(dll.ItemSpec))
{
Log.LogMessage(MessageImportance.Normal, "No file at " + dll.ItemSpec);
continue;
}
if (Path.GetExtension(dll.ItemSpec) != ".dll" && Path.GetExtension(dll.ItemSpec) != ".pdb")
{
Log.LogMessage(MessageImportance.Normal, dll.ItemSpec + " not a DLL or PDB");
continue;
}
try
{
/*Log.LogMessage(MessageImportance.Normal, "Processing PDB for " + dll.ItemSpec);
var path = Path.ChangeExtension(dll.ItemSpec, ".dll");
var module = ModuleDefinition.ReadModule(path);
var reader = readerProvider.GetSymbolReader(module, path);
var writer = writerProvider.GetSymbolWriter(module, path);
foreach (var type in module.Types)
foreach (var method in type.Methods)
{
var read = reader.Read(method);
if (read == null) Log.LogWarning($"Method {module.FileName} -> {method.FullName} read from PDB as null");
else writer.Write(read);
}
writer.Dispose();
reader.Dispose();
module.Dispose();*/
var path = Path.ChangeExtension(dll.ItemSpec, ".dll");
Log.LogMessage(MessageImportance.Normal, "Processing PDB for " + path);
/*Process.Start(new ProcessStartInfo
{
WorkingDirectory = Path.GetDirectoryName(path) ?? throw new InvalidOperationException(),
FileName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase) ?? throw new InvalidOperationException(), "pdb2mdb.exe"),
Arguments = Path.GetFileName(path)
});*/
//Pdb2Mdb.Converter.Convert(path);
}
catch (Exception e)
{
Log.LogErrorFromException(e);
Log.LogError(e.ToString());
}
}
}
return !Log.HasLoggedErrors;
}
}
}

+ 0
- 35
MSBuildTasks/Properties/AssemblyInfo.cs View File

@ -1,35 +0,0 @@
using System.Reflection;
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("MSBuildTasks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MSBuildTasks")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[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("f08c3c7a-3221-432e-bab8-32bce58408c8")]
// 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")]

+ 0
- 9
MSBuildTasks/packages.config View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Build.Framework" version="15.9.20" targetFramework="net46" />
<package id="Microsoft.Build.Utilities.Core" version="15.9.20" targetFramework="net46" />
<package id="Microsoft.VisualStudio.Setup.Configuration.Interop" version="1.16.30" targetFramework="net46" developmentDependency="true" />
<package id="Mono.Cecil" version="0.10.3" targetFramework="net46" />
<package id="System.Collections.Immutable" version="1.5.0" targetFramework="net46" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net46" />
</packages>

BIN
Refs/UnityEngine.CoreModule.dll View File


+ 1
- 1
Refs/refs.txt View File

@ -1,4 +1,4 @@
::from ../bsinstalldir.txt
::from ./bsinstalldir.txt
"Beat Saber_Data/
""Managed/
"""UnityEngine.


Loading…
Cancel
Save