Merge pull request #502 from js6pak/disable-x32-xref

Add a config option to disable xref and disable it by default on x32
This commit is contained in:
Geoffrey Horsington authored and GitHub committed 2022-10-22 15:20:19 +03:00
commit d6861e8e77
1 file changed
+6 -1
@@ -58,6 +58,11 @@ internal static class Il2CppInteropManager
.AppendLine("resulting in names that persist after game updates.") .AppendLine("resulting in names that persist after game updates.")
.ToString()); .ToString());
private static readonly ConfigEntry<bool> ScanMethodRefs = ConfigFile.CoreConfig.Bind(
"IL2CPP", "ScanMethodRefs",
Environment.Is64BitProcess,
"If enabled, Il2CppInterop will use xref to find dead methods and generate CallerCount attributes.");
private static readonly ConfigEntry<bool> DumpDummyAssemblies = ConfigFile.CoreConfig.Bind( private static readonly ConfigEntry<bool> DumpDummyAssemblies = ConfigFile.CoreConfig.Bind(
"IL2CPP", "DumpDummyAssemblies", "IL2CPP", "DumpDummyAssemblies",
false, false,
@@ -287,7 +292,7 @@ internal static class Il2CppInteropManager
{ {
var opts = new GeneratorOptions var opts = new GeneratorOptions
{ {
GameAssemblyPath = GameAssemblyPath, GameAssemblyPath = ScanMethodRefs.Value ? GameAssemblyPath : null,
Source = sourceAssemblies, Source = sourceAssemblies,
OutputDir = IL2CPPInteropAssemblyPath, OutputDir = IL2CPPInteropAssemblyPath,
UnityBaseLibsDir = Directory.Exists(UnityBaseLibsDirectory) ? UnityBaseLibsDirectory : null, UnityBaseLibsDir = Directory.Exists(UnityBaseLibsDirectory) ? UnityBaseLibsDirectory : null,