2021.3.31.3

This commit is contained in:
js6pak committed 2021-04-03 23:45:38 +02:00
1 parent f450cae0be
commit c9387706d0
11 files changed
+70 -39

No files matched your search

+25 -12
View File
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Mono.Cecil;
using Mono.Cecil.Rocks;
using Reactor.OxygenFilter;
@@ -33,8 +32,6 @@ namespace Reactor.Greenhouse.Generation
return CleanFullName;
}
private static readonly Regex CompilerGeneratedRegex = new Regex(@"^<([\w\d]+)>.__\d+$", RegexOptions.Compiled);
public void UpdateNested()
{
if (ObfuscatedType.NestedTypes.Count == CleanType.NestedTypes.Count)
@@ -49,16 +46,32 @@ namespace Reactor.Greenhouse.Generation
}
}
private static string Clean(string name)
{
return name.Replace("<", "_").Replace(">", "_");
}
public MappedType ToMappedType()
{
var match = CompilerGeneratedRegex.Match(CleanType.Name);
var mappedType = new MappedType(ObfuscatedType.FullName, match.Success ? (match.Groups[1].Value + "__d") : CleanType.Name.Replace("<>", ""));
var mappedType = new MappedType(ObfuscatedType.FullName, Clean(CleanType.Name));
if (!string.IsNullOrEmpty(CleanType.Namespace))
{
mappedType.Mapped = CleanType.Namespace + "." + mappedType.Mapped;
}
if (ObfuscatedType.FullName == CleanFullName)
{
mappedType.Mapped = null;
}
if (ObfuscatedType.Fields.Count == CleanType.Fields.Count)
{
var sortedCleanFields = CleanType.Fields.OrderBy(x => x.HasConstant && x.Constant is string).ToArray();
for (var i = 0; i < CleanType.Fields.Count; i++)
{
var cleanField = CleanType.Fields[i];
var cleanField = sortedCleanFields[i];
var obfuscatedField = ObfuscatedType.Fields[i];
if (ObfuscatedType.DeclaringType != null)
@@ -76,11 +89,11 @@ namespace Reactor.Greenhouse.Generation
continue;
}
var fieldMatch = CompilerGeneratedRegex.Match(obfuscatedField.Name);
var clean = Clean(obfuscatedField.Name);
if (fieldMatch.Success)
if (clean != obfuscatedField.Name)
{
mappedType.Fields.Add(new MappedMember(obfuscatedField.Name, fieldMatch.Groups[1].Value));
mappedType.Fields.Add(new MappedMember(obfuscatedField.Name, clean));
continue;
}
}
@@ -161,11 +174,11 @@ namespace Reactor.Greenhouse.Generation
{
foreach (var obfuscatedMethod in ObfuscatedType.Methods)
{
var methodMatch = CompilerGeneratedRegex.Match(obfuscatedMethod.Name);
var clean = Clean(obfuscatedMethod.Name);
if (methodMatch.Success)
if (clean != obfuscatedMethod.Name)
{
mappedType.Methods.Add(new MappedMethod(obfuscatedMethod, methodMatch.Groups[1].Value));
mappedType.Methods.Add(new MappedMethod(obfuscatedMethod, clean));
}
}
}
+1 -1
View File
@@ -38,7 +38,7 @@ namespace Reactor.Greenhouse
ContractResolver = ShouldSerializeContractResolver.Instance,
};
var oldFile = Path.Combine("work", "Assembly-CSharp-2020.12.9s.dll");
var oldFile = Path.Combine("work", "Assembly-CSharp-2021.3.31.dll");
Console.WriteLine($"Generating mappings from {oldFile}");
using var cleanModule = ModuleDefinition.ReadModule(File.OpenRead(oldFile));
+1 -1
View File
@@ -13,6 +13,6 @@
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
<PackageReference Include="Mono.Cecil" Version="0.11.3" />
<ProjectReference Include="..\Reactor.OxygenFilter\Reactor.OxygenFilter.csproj" />
<PackageReference Include="js6pak.Il2CppDumper" Version="6.4.20" />
<PackageReference Include="Il2CppDumper" Version="6.5.3" />
</ItemGroup>
</Project>
+8 -9
View File
@@ -39,12 +39,13 @@ namespace Reactor.Greenhouse.Setup
return; // TODO
}
var version = GameVersionParser.Parse(System.IO.Path.Combine(Path, "Among Us_Data", "globalgamemanagers"));
// TODO version patch is hardcoded to version shower, wtf!?
// var version = GameVersionParser.Parse(System.IO.Path.Combine(Path, "Among Us_Data", "globalgamemanagers"));
if (!Provider.Version.Equals(new GameVersion(version), true))
{
throw new Exception("Downloaded game has invalid version");
}
// if (!Provider.Version.Equals(new GameVersion(version), true))
// {
// throw new Exception("Downloaded game has invalid version");
// }
}
public void Dump()
@@ -71,10 +72,8 @@ namespace Reactor.Greenhouse.Setup
Path,
new Config
{
RequireAnyKey = false,
GenerateScript = false,
DumpProperty = true,
DumpAttribute = true
GenerateStruct = false,
GenerateDummyDll = true
},
Console.WriteLine
))
+11 -9
View File
@@ -5,7 +5,7 @@ namespace Reactor.Greenhouse.Setup
{
public class GameVersion
{
private static readonly Regex _regex = new Regex(@"^(?<major>[0-9]+)\.(?<minor>[0-9]+)\.(?<patch>[0-9]+)(?<platform>[sia])?", RegexOptions.Compiled);
private static readonly Regex _regex = new Regex(@"^(?<year>[0-9]+)\.(?<month>[0-9]+)\.(?<day>[0-9]+)(\.(?<patch>[0-9]+))?(?<platform>[sia])?", RegexOptions.Compiled);
public static GamePlatform GamePlatformFromShorthand(string shorthand)
{
@@ -18,8 +18,9 @@ namespace Reactor.Greenhouse.Setup
};
}
public int Major { get; }
public int Minor { get; }
public int Year { get; }
public int Month { get; }
public int Day { get; }
public int Patch { get; }
public GamePlatform? Platform { get; }
@@ -27,9 +28,10 @@ namespace Reactor.Greenhouse.Setup
{
var match = _regex.Match(version);
Major = int.Parse(match.Groups["major"].Value);
Minor = int.Parse(match.Groups["minor"].Value);
Patch = int.Parse(match.Groups["patch"].Value);
Year = int.Parse(match.Groups["year"].Value);
Month = int.Parse(match.Groups["month"].Value);
Day = int.Parse(match.Groups["day"].Value);
Patch = match.Groups["patch"].Success ? int.Parse(match.Groups["patch"].Value) : 0;
var platform = match.Groups["platform"];
Platform = platform.Success && !string.IsNullOrEmpty(platform.Value) ? GamePlatformFromShorthand(platform.Value) : null;
@@ -37,7 +39,7 @@ namespace Reactor.Greenhouse.Setup
public override string ToString()
{
return $"{Major}.{Minor}.{Patch}" + Platform switch
return $"{Year}.{Month}.{Day}{(Patch == 0 ? string.Empty : $".{Patch}")}" + Platform switch
{
GamePlatform.Steam => "s",
GamePlatform.Itch => "i",
@@ -52,7 +54,7 @@ namespace Reactor.Greenhouse.Setup
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return Major == other.Major && Minor == other.Minor && Patch == other.Patch && (ignorePlatform || Platform == other.Platform);
return Year == other.Year && Month == other.Month && Day == other.Day && Patch == other.Patch && (ignorePlatform || Platform == other.Platform);
}
public override bool Equals(object obj)
@@ -62,7 +64,7 @@ namespace Reactor.Greenhouse.Setup
public override int GetHashCode()
{
return HashCode.Combine(Major, Minor, Patch, Platform);
return HashCode.Combine(Year, Month, Day, Patch, Platform);
}
}
@@ -16,7 +16,9 @@ namespace Reactor.Greenhouse.Setup.Provider
{
[new GameVersion("2019.10.10s")] = 3162069540887216240,
[new GameVersion("2020.12.9s")] = 3306639722673334636,
[new GameVersion("2021.3.5s")] = 5200448423569257054
[new GameVersion("2021.3.5s")] = 5200448423569257054,
[new GameVersion("2021.3.31s")] = 9177722260012976528,
[new GameVersion("2021.3.31.3s")] = 3941730972865408291
};
public ulong Manifest { get; }
@@ -47,7 +47,7 @@ namespace Reactor.OxygenFilter.MSBuild
var dumperConfig = new Il2CppDumper.Config
{
GenerateScript = false,
GenerateStruct = false,
GenerateDummyDll = true
};
@@ -4,7 +4,7 @@
<LangVersion>latest</LangVersion>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<Version>0.2.10</Version>
<Version>0.3.0</Version>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/NuclearPowered/Reactor.OxygenFilter</RepositoryUrl>
<PackageLicenseExpression>LGPL-3.0-or-later</PackageLicenseExpression>
@@ -21,8 +21,8 @@
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="16.8.0" />
<ProjectReference Include="..\Reactor.OxygenFilter\Reactor.OxygenFilter.csproj" />
<PackageReference Include="js6pak.Il2CppDumper" Version="6.4.20" />
<PackageReference Include="NuclearPowered.AssemblyUnhollower" Version="0.4.13" />
<PackageReference Include="Il2CppDumper" Version="6.5.4" />
<PackageReference Include="NuclearPowered.AssemblyUnhollower" Version="0.4.15" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net472' ">
+10 -1
View File
@@ -282,7 +282,16 @@ namespace Reactor.OxygenFilter.MSBuild
foreach (var pair in toObfuscate)
{
pair.Key.Name = pair.Value;
if (pair.Key is TypeReference typeReference)
{
var lastIndexOf = pair.Value.LastIndexOf('.');
typeReference.Namespace = lastIndexOf == -1 ? null : pair.Value.Substring(0, lastIndexOf);
typeReference.Name = pair.Value.Substring(lastIndexOf + 1);
}
else
{
pair.Key.Name = pair.Value;
}
}
foreach (var typeReference in moduleDefinition.GetTypeReferences())
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="BepInExLibs" value="https://pkgs.dev.azure.com/bepinex/BepInEx/_packaging/BepInExLibs/nuget/v3/index.json" />
</packageSources>
</configuration>