diff --git a/build.ps1 b/build.ps1 index 4da82c78..476ec05d 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,4 +1,4 @@ -# ----------- MelonLoader IL2CPP (net6) ----------- +# ----------- MelonLoader IL2CPP Unhollower (net6) ----------- dotnet build src/UnityExplorer.sln -c Release_ML_Cpp_net6 $Path = "Release\UnityExplorer.MelonLoader.IL2CPP.net6preview" # ILRepack @@ -17,6 +17,27 @@ Move-Item -Path $Path/UniverseLib.IL2CPP.Unhollower.dll -Destination $Path/UserL Remove-Item $Path/../UnityExplorer.MelonLoader.IL2CPP.net6preview.zip -ErrorAction SilentlyContinue 7z a $Path/../UnityExplorer.MelonLoader.IL2CPP.net6preview.zip .\$Path\* +# ----------- MelonLoader IL2CPP Interop (net6) ----------- +dotnet build src/UnityExplorer.sln -c Release_ML_Cpp_net6_interop +$Path = "Release\UnityExplorer.MelonLoader.IL2CPP.net6preview.interop" +# ILRepack +lib/ILRepack.exe /target:library /lib:lib/net6 /lib:lib/interop /lib:$Path /internalize /out:$Path/UnityExplorer.ML.IL2CPP.net6preview.interop.dll $Path/UnityExplorer.ML.IL2CPP.net6preview.interop.dll $Path/mcs.dll +# (cleanup and move files) +Remove-Item $Path/UnityExplorer.ML.IL2CPP.net6preview.interop.deps.json +Remove-Item $Path/Tomlet.dll +Remove-Item $Path/mcs.dll +Remove-Item $Path/Iced.dll +Remove-Item $Path/Il2CppInterop.Common.dll +Remove-Item $Path/Il2CppInterop.Runtime.dll +Remove-Item $Path/Microsoft.Extensions.Logging.Abstractions.dll +New-Item -Path "$Path" -Name "Mods" -ItemType "directory" -Force +Move-Item -Path $Path/UnityExplorer.ML.IL2CPP.net6preview.interop.dll -Destination $Path/Mods -Force +New-Item -Path "$Path" -Name "UserLibs" -ItemType "directory" -Force +Move-Item -Path $Path/UniverseLib.IL2CPP.Interop.ML.dll -Destination $Path/UserLibs -Force +# (create zip archive) +Remove-Item $Path/../UnityExplorer.MelonLoader.IL2CPP.net6preview.interop.zip -ErrorAction SilentlyContinue +7z a $Path/../UnityExplorer.MelonLoader.IL2CPP.net6preview.interop.zip .\$Path\* + # ----------- MelonLoader IL2CPP (net472) ----------- dotnet build src/UnityExplorer.sln -c Release_ML_Cpp_net472 $Path = "Release/UnityExplorer.MelonLoader.IL2CPP" diff --git a/src/Config/ConfigManager.cs b/src/Config/ConfigManager.cs index 42df799e..99f08576 100644 --- a/src/Config/ConfigManager.cs +++ b/src/Config/ConfigManager.cs @@ -27,6 +27,7 @@ public static class ConfigManager public static ConfigElement UI_MouseInspect_Keybind; public static ConfigElement CSConsole_Assembly_Blacklist; public static ConfigElement Reflection_Signature_Blacklist; + public static ConfigElement Reflection_Hide_NativeInfoPtrs; // internal configs internal static InternalConfigHandler InternalHandler { get; private set; } @@ -139,6 +140,11 @@ private static void CreateConfigElements() "Seperate signatures with a semicolon ';'.\r\n" + "For example, to blacklist Camera.main, you would add 'UnityEngine.Camera.main;'", ""); + + Reflection_Hide_NativeInfoPtrs = new("Hide NativeMethodInfoPtr_s and NativeFieldInfoPtr_s", + "Use this to blacklist NativeMethodPtr_s and NativeFieldInfoPtrs_s from the class inspector, mainly to reduce clutter.\r\n" + + "For example, this will hide 'Class.NativeFieldInfoPtr_value' for the field 'Class.value'.", + false); } } } diff --git a/src/ExplorerCore.cs b/src/ExplorerCore.cs index 05195afe..263d86fc 100644 --- a/src/ExplorerCore.cs +++ b/src/ExplorerCore.cs @@ -19,7 +19,7 @@ namespace UnityExplorer public static class ExplorerCore { public const string NAME = "UnityExplorer"; - public const string VERSION = "4.9.0"; + public const string VERSION = "4.9.4"; public const string AUTHOR = "Sinai"; public const string GUID = "com.sinai.unityexplorer"; diff --git a/src/Loader/MelonLoader/ExplorerMelonMod.cs b/src/Loader/MelonLoader/ExplorerMelonMod.cs index 48862e29..e7882d79 100644 --- a/src/Loader/MelonLoader/ExplorerMelonMod.cs +++ b/src/Loader/MelonLoader/ExplorerMelonMod.cs @@ -25,7 +25,7 @@ public class ExplorerMelonMod : MelonMod, IExplorerLoader public string UnhollowedModulesFolder => Path.Combine( Path.GetDirectoryName(MelonHandler.ModsDirectory), - Path.Combine("MelonLoader", "Managed")); + Path.Combine("MelonLoader", "Il2CppAssemblies")); public ConfigHandler ConfigHandler => _configHandler; public MelonLoaderConfigHandler _configHandler; diff --git a/src/Runtime/UERuntimeHelper.cs b/src/Runtime/UERuntimeHelper.cs index 6786d426..542ccf45 100644 --- a/src/Runtime/UERuntimeHelper.cs +++ b/src/Runtime/UERuntimeHelper.cs @@ -70,9 +70,15 @@ public static void LoadBlacklistString(string blacklist) public static bool IsBlacklisted(MemberInfo member) { + if (ConfigManager.Reflection_Hide_NativeInfoPtrs.Value) { + bool isNativeInfoPtr = member.Name.StartsWith("NativeFieldInfoPtr_") || member.Name.StartsWith("NativeMethodInfoPtr_"); + if (isNativeInfoPtr) + return true; + } + if (string.IsNullOrEmpty(member.DeclaringType?.Namespace)) return false; - + string sig = $"{member.DeclaringType.FullName}.{member.Name}"; return currentBlacklist.Contains(sig); diff --git a/src/UnityExplorer.csproj b/src/UnityExplorer.csproj index aa7594a2..12ed5ee1 100644 --- a/src/UnityExplorer.csproj +++ b/src/UnityExplorer.csproj @@ -7,20 +7,27 @@ true false none - false - none + true + embedded UnityExplorer - 10.0 - BIE_Cpp;BIE_Cpp_CoreCLR;BIE5_Mono;BIE6_Mono;ML_Cpp_net6;ML_Cpp_net472;ML_Mono;STANDALONE_Mono;STANDALONE_Cpp + latest + BIE_Cpp;BIE_Cpp_CoreCLR;BIE5_Mono;BIE6_Mono;ML_Cpp_net6;ML_Cpp_net6_interop;ML_Cpp_net472;ML_Mono;STANDALONE_Mono;STANDALONE_Cpp - + net6 ..\Release\UnityExplorer.MelonLoader.IL2CPP.net6preview\ CPP,ML,UNHOLLOWER UnityExplorer.ML.IL2CPP.net6preview + + + net6 + ..\Release\UnityExplorer.MelonLoader.IL2CPP.net6preview.interop\ + CPP,ML,INTEROP + UnityExplorer.ML.IL2CPP.net6preview.interop + net472 @@ -93,6 +100,11 @@ + + + + + @@ -114,7 +126,7 @@ - + ..\lib\net6\MelonLoader.dll False @@ -211,7 +223,7 @@ - + ..\lib\interop\Il2Cppmscorlib.dll False diff --git a/src/UnityExplorer.sln b/src/UnityExplorer.sln index ef2e7e66..dca061cb 100644 --- a/src/UnityExplorer.sln +++ b/src/UnityExplorer.sln @@ -13,6 +13,7 @@ Global Release_BIE6_Mono|Any CPU = Release_BIE6_Mono|Any CPU Release_ML_Cpp_net472|Any CPU = Release_ML_Cpp_net472|Any CPU Release_ML_Cpp_net6|Any CPU = Release_ML_Cpp_net6|Any CPU + Release_ML_Cpp_net6_interop|Any CPU = Release_ML_Cpp_net6_interop|Any CPU Release_ML_Mono|Any CPU = Release_ML_Mono|Any CPU Release_STANDALONE_Cpp|Any CPU = Release_STANDALONE_Cpp|Any CPU Release_STANDALONE_Mono|Any CPU = Release_STANDALONE_Mono|Any CPU @@ -30,6 +31,8 @@ Global {B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_ML_Cpp_net472|Any CPU.Build.0 = ML_Cpp_net472|Any CPU {B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_ML_Cpp_net6|Any CPU.ActiveCfg = ML_Cpp_net6|Any CPU {B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_ML_Cpp_net6|Any CPU.Build.0 = ML_Cpp_net6|Any CPU + {B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_ML_Cpp_net6_interop|Any CPU.ActiveCfg = ML_Cpp_net6_interop|Any CPU + {B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_ML_Cpp_net6_interop|Any CPU.Build.0 = ML_Cpp_net6_interop|Any CPU {B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_ML_Mono|Any CPU.ActiveCfg = ML_Mono|Any CPU {B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_ML_Mono|Any CPU.Build.0 = ML_Mono|Any CPU {B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_STANDALONE_Cpp|Any CPU.ActiveCfg = STANDALONE_Cpp|Any CPU