-
-
Notifications
You must be signed in to change notification settings - Fork 491
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reimplemented NetFramework Variant of Cpp2IL as fallback
- Loading branch information
1 parent
e6f7f3b
commit a8033a5
Showing
3 changed files
with
114 additions
and
56 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
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
99 changes: 99 additions & 0 deletions
99
Dependencies/Il2CppAssemblyGenerator/Packages/Cpp2IL_NetFramework.cs
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,99 @@ | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using Semver; | ||
|
||
namespace MelonLoader.Il2CppAssemblyGenerator.Packages | ||
{ | ||
internal class Cpp2IL_NetFramework : Models.ExecutablePackage | ||
{ | ||
private static string ReleaseName => "Windows-Netframework472"; | ||
internal Cpp2IL_NetFramework() | ||
{ | ||
Version = MelonLaunchOptions.Il2CppAssemblyGenerator.ForceVersion_Dumper; | ||
#if !DEBUG | ||
if (string.IsNullOrEmpty(Version) || Version.Equals("0.0.0.0")) | ||
Version = RemoteAPI.Info.ForceDumperVersion; | ||
#endif | ||
if (string.IsNullOrEmpty(Version) || Version.Equals("0.0.0.0")) | ||
Version = $"2022.1.0-pre-release.15"; | ||
|
||
Name = nameof(Cpp2IL); | ||
Destination = Path.Combine(Core.BasePath, Name); | ||
OutputFolder = Path.Combine(Destination, "cpp2il_out"); | ||
|
||
URL = $"https://github.com/SamboyCoding/{Name}/releases/download/{Version}/{Name}-{Version}-{ReleaseName}.zip"; | ||
ExeFilePath = Path.Combine(Destination, $"{Name}.exe"); | ||
FilePath = Path.Combine(Core.BasePath, $"{Name}_{Version}.zip"); | ||
} | ||
|
||
internal override bool ShouldSetup() | ||
=> string.IsNullOrEmpty(Config.Values.DumperVersion) | ||
|| !Config.Values.DumperVersion.Equals(Version); | ||
|
||
internal override void Cleanup() { } | ||
|
||
internal override void Save() | ||
=> Save(ref Config.Values.DumperVersion); | ||
|
||
internal override bool Execute() | ||
{ | ||
if (SemVersion.Parse(Version) <= SemVersion.Parse("2022.0.999")) | ||
return ExecuteOld(); | ||
return ExecuteNew(); | ||
} | ||
|
||
private bool ExecuteNew() | ||
{ | ||
if (Execute([ | ||
MelonDebug.IsEnabled() ? "--verbose" : string.Empty, | ||
|
||
"--game-path", | ||
"\"" + Path.GetDirectoryName(Core.GameAssemblyPath) + "\"", | ||
|
||
"--exe-name", | ||
"\"" + Process.GetCurrentProcess().ProcessName + "\"", | ||
|
||
"--output-as", | ||
"dummydll", | ||
|
||
"--use-processor", | ||
"attributeanalyzer", | ||
"attributeinjector", | ||
MelonLaunchOptions.Cpp2IL.CallAnalyzer ? "callanalyzer" : string.Empty, | ||
MelonLaunchOptions.Cpp2IL.NativeMethodDetector ? "nativemethoddetector" : string.Empty, | ||
//"deobfmap", | ||
//"stablenamer", | ||
|
||
], false, new Dictionary<string, string>() { | ||
{"NO_COLOR", "1"} | ||
})) | ||
return true; | ||
|
||
return false; | ||
} | ||
|
||
private bool ExecuteOld() | ||
{ | ||
if (Execute([ | ||
MelonDebug.IsEnabled() ? "--verbose" : string.Empty, | ||
|
||
"--game-path", | ||
"\"" + Path.GetDirectoryName(Core.GameAssemblyPath) + "\"", | ||
|
||
"--exe-name", | ||
"\"" + Process.GetCurrentProcess().ProcessName + "\"", | ||
|
||
"--skip-analysis", | ||
"--skip-metadata-txts", | ||
"--disable-registration-prompts" | ||
|
||
], false, new Dictionary<string, string>() { | ||
{"NO_COLOR", "1"} | ||
})) | ||
return true; | ||
|
||
return false; | ||
} | ||
} | ||
} |