This commit is contained in:
js6pak committed 2020-12-23 21:40:00 +01:00
1 parent 9dc7745be4
commit 11b3108a9a
14 files changed
+301 -26

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
name: Cake
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.101
- name: Download artifact
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: main.yml
workflow_conclusion: success
branch: reactor
name: BepInEx-reactor
repo: NuclearPowered/BepInEx
- name: Cake Action
run: sh build.sh
env:
STEAM: ${{ secrets.STEAM }}
- uses: actions/upload-artifact@v2
with:
name: Reactor.dll
path: Reactor/bin/Release/net472/Reactor.dll
+3
View File
@@ -0,0 +1,3 @@
[submodule "lib/Il2CppAssemblyUnhollower"]
path = lib/Il2CppAssemblyUnhollower
url = https://github.com/NuclearPowered/Il2CppAssemblyUnhollower
+3 -1
View File
@@ -57,6 +57,7 @@
</Reference>
<Reference Include="UnityEngine.IMGUIModule">
<HintPath>$(AmongUs)\BepInEx\unhollowed\UnityEngine.IMGUIModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>$(AmongUs)\BepInEx\unhollowed\UnityEngine.UI.dll</HintPath>
@@ -64,6 +65,7 @@
</Reference>
<Reference Include="UnityEngine.UIModule">
<HintPath>$(AmongUs)\BepInEx\unhollowed\UnityEngine.UIModule.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
@@ -73,4 +75,4 @@
</ItemGroup>
<Copy SourceFiles="@(OutputFiles)" DestinationFolder="$(AmongUs)/BepInEx/plugins/" Condition="'$(Configuration)' == 'Debug'" />
</Target>
</Project>
</Project>
+17 -6
View File
@@ -19,17 +19,21 @@ namespace Reactor.Greenhouse
{
private static Task<int> Main(string[] args)
{
var rootCommand = new RootCommand();
var rootCommand = new RootCommand
{
new Option<bool>("steam"),
new Option<bool>("itch"),
};
rootCommand.Handler = CommandHandler.Create(SearchAsync);
rootCommand.Handler = CommandHandler.Create<bool, bool>(GenerateAsync);
return rootCommand.InvokeAsync(args);
}
private static async Task SearchAsync()
private static async Task GenerateAsync(bool steam, bool itch)
{
var gameManager = new GameManager();
await gameManager.SetupAsync();
await gameManager.SetupAsync(steam, itch);
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
{
@@ -42,8 +46,15 @@ namespace Reactor.Greenhouse
Console.WriteLine($"Generating mappings from {gameManager.PreObfuscation.Name} ({gameManager.PreObfuscation.Version})");
using var old = ModuleDefinition.ReadModule(File.OpenRead(gameManager.PreObfuscation.Dll));
await GenerateAsync(gameManager.Steam, old);
await GenerateAsync(gameManager.Itch, old);
if (steam)
{
await GenerateAsync(gameManager.Steam, old);
}
if (itch)
{
await GenerateAsync(gameManager.Itch, old);
}
}
private static async Task GenerateAsync(Game game, ModuleDefinition old)
+1 -1
View File
@@ -13,7 +13,7 @@
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.20478.1" />
<ProjectReference Include="..\Reactor.OxygenFilter\Reactor.OxygenFilter.csproj" />
<Reference Include="Il2CppDumper">
<HintPath>lib\Il2CppDumper.dll</HintPath>
<HintPath>..\lib\Il2CppDumper.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
+23 -7
View File
@@ -22,11 +22,11 @@ namespace Reactor.Greenhouse.Setup
Itch = new Game(new ItchProvider(), "itch", Path.Combine(WorkPath, "itch"));
}
public async Task SetupAsync()
public async Task SetupAsync(bool setupSteam, bool setupItch)
{
var preObfuscation = PreObfuscation.Provider.IsUpdateNeeded();
var steam = Steam.Provider.IsUpdateNeeded();
var itch = Itch.Provider.IsUpdateNeeded();
var steam = setupSteam && Steam.Provider.IsUpdateNeeded();
var itch = setupItch && Itch.Provider.IsUpdateNeeded();
if (preObfuscation || steam || itch)
{
@@ -54,8 +54,16 @@ namespace Reactor.Greenhouse.Setup
ContentDownloader.ShutdownSteam3();
PreObfuscation.UpdateVersion();
Steam.UpdateVersion();
Itch.UpdateVersion();
if (setupSteam)
{
Steam.UpdateVersion();
}
if (setupItch)
{
Itch.UpdateVersion();
}
if (PreObfuscation.Version != "2020.9.9")
{
@@ -63,8 +71,16 @@ namespace Reactor.Greenhouse.Setup
}
PreObfuscation.Dump();
Steam.Dump();
Itch.Dump();
if (setupSteam)
{
Steam.Dump();
}
if (setupItch)
{
Itch.Dump();
}
}
}
}
@@ -62,21 +62,31 @@ namespace Reactor.Greenhouse.Setup.Provider
AccountSettingsStore.LoadFromFile("account.config");
ContentDownloader.Config.RememberPassword = true;
var environmentVariable = Environment.GetEnvironmentVariable("STEAM");
Console.Write("Steam username: ");
var username = Console.ReadLine();
string password = null;
if (!AccountSettingsStore.Instance.LoginKeys.ContainsKey(username))
if (environmentVariable != null)
{
Console.Write("Steam password: ");
password = ContentDownloader.Config.SuppliedPassword = Util.ReadPassword();
Console.WriteLine();
var split = environmentVariable.Split(":");
ContentDownloader.InitializeSteam3(split[0], split[1]);
}
else
{
ContentDownloader.Config.RememberPassword = true;
ContentDownloader.InitializeSteam3(username, password);
Console.Write("Steam username: ");
var username = Console.ReadLine();
string password = null;
if (!AccountSettingsStore.Instance.LoginKeys.ContainsKey(username))
{
Console.Write("Steam password: ");
password = ContentDownloader.Config.SuppliedPassword = Util.ReadPassword();
Console.WriteLine();
}
ContentDownloader.InitializeSteam3(username, password);
}
ContentDownloader.Config.UsingFileList = true;
ContentDownloader.Config.FilesToDownload = new List<string>
+30
View File
@@ -7,6 +7,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Reactor.Debugger", "Reactor
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Reactor.Greenhouse", "Reactor.Greenhouse\Reactor.Greenhouse.csproj", "{00BF8959-652F-46B8-AA0F-891B4DA1112B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build", "build\Build.csproj", "{58AC4924-AC3D-45EA-80D7-E9F860FD1DD2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{E2F4DAFA-E98C-4A7D-BA47-AAB0271A769D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyUnhollower", "lib/Il2CppAssemblyUnhollower\AssemblyUnhollower\AssemblyUnhollower.csproj", "{64ABFD11-CE06-4220-A626-55B39AB85B62}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnhollowerBaseLib", "lib/Il2CppAssemblyUnhollower\UnhollowerBaseLib\UnhollowerBaseLib.csproj", "{17B4E6AE-EA5A-43BE-9184-5BBB6594C5E7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -29,5 +37,27 @@ Global
{00BF8959-652F-46B8-AA0F-891B4DA1112B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{00BF8959-652F-46B8-AA0F-891B4DA1112B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{00BF8959-652F-46B8-AA0F-891B4DA1112B}.Release|Any CPU.Build.0 = Release|Any CPU
{58AC4924-AC3D-45EA-80D7-E9F860FD1DD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{58AC4924-AC3D-45EA-80D7-E9F860FD1DD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{58AC4924-AC3D-45EA-80D7-E9F860FD1DD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{58AC4924-AC3D-45EA-80D7-E9F860FD1DD2}.Release|Any CPU.Build.0 = Release|Any CPU
{64ABFD11-CE06-4220-A626-55B39AB85B62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{64ABFD11-CE06-4220-A626-55B39AB85B62}.Debug|Any CPU.Build.0 = Debug|Any CPU
{64ABFD11-CE06-4220-A626-55B39AB85B62}.Release|Any CPU.ActiveCfg = Release|Any CPU
{64ABFD11-CE06-4220-A626-55B39AB85B62}.Release|Any CPU.Build.0 = Release|Any CPU
{17B4E6AE-EA5A-43BE-9184-5BBB6594C5E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{17B4E6AE-EA5A-43BE-9184-5BBB6594C5E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{17B4E6AE-EA5A-43BE-9184-5BBB6594C5E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{17B4E6AE-EA5A-43BE-9184-5BBB6594C5E7}.Release|Any CPU.Build.0 = Release|Any CPU
{78FD0EDA-0F47-44E9-8FB1-6B4E64E21AD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{78FD0EDA-0F47-44E9-8FB1-6B4E64E21AD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{78FD0EDA-0F47-44E9-8FB1-6B4E64E21AD7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{78FD0EDA-0F47-44E9-8FB1-6B4E64E21AD7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{64ABFD11-CE06-4220-A626-55B39AB85B62} = {E2F4DAFA-E98C-4A7D-BA47-AAB0271A769D}
{58AC4924-AC3D-45EA-80D7-E9F860FD1DD2} = {E2F4DAFA-E98C-4A7D-BA47-AAB0271A769D}
{17B4E6AE-EA5A-43BE-9184-5BBB6594C5E7} = {E2F4DAFA-E98C-4A7D-BA47-AAB0271A769D}
{78FD0EDA-0F47-44E9-8FB1-6B4E64E21AD7} = {E2F4DAFA-E98C-4A7D-BA47-AAB0271A769D}
EndGlobalSection
EndGlobal
+2
View File
@@ -0,0 +1,2 @@
dotnet run --project build/Build.csproj -- $args
exit $LASTEXITCODE;
+1
View File
@@ -0,0 +1 @@
dotnet run --project ./build/Build.csproj -- "$@"
+17
View File
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<RunWorkingDirectory>$(MSBuildProjectDirectory)/..</RunWorkingDirectory>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Cake.Frosting" Version="1.0.0-rc0002" />
<PackageReference Include="DepotDownloader.Library" Version="0.1.2" />
<Reference Include="Il2CppDumper">
<HintPath>..\lib\Il2CppDumper.dll</HintPath>
</Reference>
<ProjectReference Include="..\Reactor.OxygenFilter\Reactor.OxygenFilter.csproj" />
<ProjectReference Include="..\lib\Il2CppAssemblyUnhollower\AssemblyUnhollower\AssemblyUnhollower.csproj" />
<ProjectReference Include="..\lib\Il2CppAssemblyUnhollower\UnhollowerBaseLib\UnhollowerBaseLib.csproj" />
</ItemGroup>
</Project>
+141
View File
@@ -0,0 +1,141 @@
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using AssemblyUnhollower;
using Cake.Common;
using Cake.Common.Diagnostics;
using Cake.Common.IO;
using Cake.Common.Tools.DotNetCore;
using Cake.Common.Tools.DotNetCore.Build;
using Cake.Common.Tools.DotNetCore.Run;
using Cake.Core;
using Cake.Frosting;
using DepotDownloader;
using Reactor.OxygenFilter;
public static class Program
{
public static int Main(string[] args)
{
return new CakeHost()
.UseContext<BuildContext>()
.Run(args);
}
}
public class BuildContext : FrostingContext
{
public string TempPath { get; } = "bin/temp";
public string AmongUsPath { get; } = "bin/Among Us";
public BuildContext(ICakeContext context) : base(context)
{
context.CreateDirectory(TempPath);
context.CreateDirectory(AmongUsPath);
}
}
[TaskName("SetupAmongUs")]
public sealed class SetupAmongUsTask : AsyncFrostingTask<BuildContext>
{
public const uint AppId = 945360;
public const uint DepotId = 945361;
public override async Task RunAsync(BuildContext context)
{
AccountSettingsStore.LoadFromFile("account.config");
var steam = context.EnvironmentVariable<string>("STEAM", null).Split(":");
context.Information("Logging into steam");
ContentDownloader.InitializeSteam3(steam[0], steam[1]);
ContentDownloader.Config.InstallDirectory = context.AmongUsPath;
context.Information("Downloading the game from steam");
await ContentDownloader.DownloadAppAsync(AppId, DepotId);
ContentDownloader.ShutdownSteam3();
context.Unzip(context.GetFiles("BepInEx_UnityIL2CPP_x86_*.zip").Single(), Path.Combine(context.AmongUsPath));
}
}
[TaskName("GenerateProxyAssembly")]
[IsDependentOn(typeof(SetupAmongUsTask))]
public sealed class GenerateProxyAssemblyTask : FrostingTask<BuildContext>
{
public override void Run(BuildContext context)
{
var dumperConfig = new Il2CppDumper.Config
{
GenerateScript = false,
GenerateDummyDll = true
};
context.Information("Generating Il2CppDumper intermediate assemblies");
var gameAssemblyPath = Path.Combine(context.AmongUsPath, "GameAssembly.dll");
Il2CppDumper.Il2CppDumper.PerformDump(
gameAssemblyPath,
Path.Combine(context.AmongUsPath, "Among Us_Data", "il2cpp_data", "Metadata", "global-metadata.dat"),
context.TempPath, dumperConfig, context.Debug
);
context.Information("Executing Reactor.Greenhouse");
context.DotNetCoreRun(".", "steam", new DotNetCoreRunSettings
{
WorkingDirectory = "Reactor.Greenhouse"
});
context.Information("Executing Reactor.OxygenFilter");
var oxygenFilter = new OxygenFilter();
var dumpedDll = new FileInfo(Path.Combine(context.TempPath, "DummyDll", "Assembly-CSharp.dll"));
oxygenFilter.Start(new FileInfo(Path.Combine("Reactor.Greenhouse", "work", "2020.12.9s.json")), dumpedDll, dumpedDll);
context.Information("Executing Il2CppUnhollower generator");
UnhollowerBaseLib.LogSupport.InfoHandler += context.Information;
UnhollowerBaseLib.LogSupport.WarningHandler += context.Warning;
UnhollowerBaseLib.LogSupport.TraceHandler += context.Debug;
UnhollowerBaseLib.LogSupport.ErrorHandler += context.Error;
var unityBaseLibDir = Path.Combine(context.AmongUsPath, "BepInEx", "unhollowed", "base");
var unhollowerOptions = new UnhollowerOptions
{
GameAssemblyPath = gameAssemblyPath,
MscorlibPath = Path.Combine(context.AmongUsPath, "mono", "Managed", "mscorlib.dll"),
SourceDir = Path.Combine(context.TempPath, "DummyDll"),
OutputDir = Path.Combine(context.AmongUsPath, "BepInEx", "unhollowed"),
UnityBaseLibsDir = unityBaseLibDir,
NoCopyUnhollowerLibs = true
};
AssemblyUnhollower.Program.Main(unhollowerOptions);
}
}
[TaskName("Build")]
[IsDependentOn(typeof(GenerateProxyAssemblyTask))]
public sealed class BuildTask : FrostingTask<BuildContext>
{
public override void Run(BuildContext context)
{
context.DotNetCoreBuild("./Reactor/Reactor.csproj", new DotNetCoreBuildSettings
{
Configuration = "Release",
EnvironmentVariables =
{
["AmongUs"] = Path.GetFullPath(context.AmongUsPath)
}
});
}
}
[IsDependentOn(typeof(BuildTask))]
public sealed class Default : FrostingTask<BuildContext>
{
}
File renamed without changes.