Skip to content

Commit 027f890

Browse files
committed
port baydock's changes
1 parent 1e1fb0e commit 027f890

7 files changed

Lines changed: 59 additions & 11 deletions

File tree

build.ps1

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ----------- MelonLoader IL2CPP (net6) -----------
1+
# ----------- MelonLoader IL2CPP Unhollower (net6) -----------
22
dotnet build src/UnityExplorer.sln -c Release_ML_Cpp_net6
33
$Path = "Release\UnityExplorer.MelonLoader.IL2CPP.net6preview"
44
# ILRepack
@@ -17,6 +17,27 @@ Move-Item -Path $Path/UniverseLib.IL2CPP.Unhollower.dll -Destination $Path/UserL
1717
Remove-Item $Path/../UnityExplorer.MelonLoader.IL2CPP.net6preview.zip -ErrorAction SilentlyContinue
1818
7z a $Path/../UnityExplorer.MelonLoader.IL2CPP.net6preview.zip .\$Path\*
1919

20+
# ----------- MelonLoader IL2CPP Interop (net6) -----------
21+
dotnet build src/UnityExplorer.sln -c Release_ML_Cpp_net6_interop
22+
$Path = "Release\UnityExplorer.MelonLoader.IL2CPP.net6preview.interop"
23+
# ILRepack
24+
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
25+
# (cleanup and move files)
26+
Remove-Item $Path/UnityExplorer.ML.IL2CPP.net6preview.interop.deps.json
27+
Remove-Item $Path/Tomlet.dll
28+
Remove-Item $Path/mcs.dll
29+
Remove-Item $Path/Iced.dll
30+
Remove-Item $Path/Il2CppInterop.Common.dll
31+
Remove-Item $Path/Il2CppInterop.Runtime.dll
32+
Remove-Item $Path/Microsoft.Extensions.Logging.Abstractions.dll
33+
New-Item -Path "$Path" -Name "Mods" -ItemType "directory" -Force
34+
Move-Item -Path $Path/UnityExplorer.ML.IL2CPP.net6preview.interop.dll -Destination $Path/Mods -Force
35+
New-Item -Path "$Path" -Name "UserLibs" -ItemType "directory" -Force
36+
Move-Item -Path $Path/UniverseLib.IL2CPP.Interop.ML.dll -Destination $Path/UserLibs -Force
37+
# (create zip archive)
38+
Remove-Item $Path/../UnityExplorer.MelonLoader.IL2CPP.net6preview.interop.zip -ErrorAction SilentlyContinue
39+
7z a $Path/../UnityExplorer.MelonLoader.IL2CPP.net6preview.interop.zip .\$Path\*
40+
2041
# ----------- MelonLoader IL2CPP (net472) -----------
2142
dotnet build src/UnityExplorer.sln -c Release_ML_Cpp_net472
2243
$Path = "Release/UnityExplorer.MelonLoader.IL2CPP"

src/Config/ConfigManager.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public static class ConfigManager
2727
public static ConfigElement<KeyCode> UI_MouseInspect_Keybind;
2828
public static ConfigElement<string> CSConsole_Assembly_Blacklist;
2929
public static ConfigElement<string> Reflection_Signature_Blacklist;
30+
public static ConfigElement<bool> Reflection_Hide_NativeInfoPtrs;
3031

3132
// internal configs
3233
internal static InternalConfigHandler InternalHandler { get; private set; }
@@ -139,6 +140,11 @@ private static void CreateConfigElements()
139140
"Seperate signatures with a semicolon ';'.\r\n" +
140141
"For example, to blacklist Camera.main, you would add 'UnityEngine.Camera.main;'",
141142
"");
143+
144+
Reflection_Hide_NativeInfoPtrs = new("Hide NativeMethodInfoPtr_s and NativeFieldInfoPtr_s",
145+
"Use this to blacklist NativeMethodPtr_s and NativeFieldInfoPtrs_s from the class inspector, mainly to reduce clutter.\r\n" +
146+
"For example, this will hide 'Class.NativeFieldInfoPtr_value' for the field 'Class.value'.",
147+
false);
142148
}
143149
}
144150
}

src/ExplorerCore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace UnityExplorer
1919
public static class ExplorerCore
2020
{
2121
public const string NAME = "UnityExplorer";
22-
public const string VERSION = "4.9.0";
22+
public const string VERSION = "4.9.4";
2323
public const string AUTHOR = "Sinai";
2424
public const string GUID = "com.sinai.unityexplorer";
2525

src/Loader/MelonLoader/ExplorerMelonMod.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class ExplorerMelonMod : MelonMod, IExplorerLoader
2525

2626
public string UnhollowedModulesFolder => Path.Combine(
2727
Path.GetDirectoryName(MelonHandler.ModsDirectory),
28-
Path.Combine("MelonLoader", "Managed"));
28+
Path.Combine("MelonLoader", "Il2CppAssemblies"));
2929

3030
public ConfigHandler ConfigHandler => _configHandler;
3131
public MelonLoaderConfigHandler _configHandler;

src/Runtime/UERuntimeHelper.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,15 @@ public static void LoadBlacklistString(string blacklist)
7070

7171
public static bool IsBlacklisted(MemberInfo member)
7272
{
73+
if (ConfigManager.Reflection_Hide_NativeInfoPtrs.Value) {
74+
bool isNativeInfoPtr = member.Name.StartsWith("NativeFieldInfoPtr_") || member.Name.StartsWith("NativeMethodInfoPtr_");
75+
if (isNativeInfoPtr)
76+
return true;
77+
}
78+
7379
if (string.IsNullOrEmpty(member.DeclaringType?.Namespace))
7480
return false;
75-
81+
7682
string sig = $"{member.DeclaringType.FullName}.{member.Name}";
7783

7884
return currentBlacklist.Contains(sig);

src/UnityExplorer.csproj

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,27 @@
77
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
88
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
99
<AllowedReferenceRelatedFileExtensions>none</AllowedReferenceRelatedFileExtensions>
10-
<DebugSymbols>false</DebugSymbols>
11-
<DebugType>none</DebugType>
10+
<DebugSymbols>true</DebugSymbols>
11+
<DebugType>embedded</DebugType>
1212
<RootNamespace>UnityExplorer</RootNamespace>
13-
<LangVersion>10.0</LangVersion>
14-
<Configurations>BIE_Cpp;BIE_Cpp_CoreCLR;BIE5_Mono;BIE6_Mono;ML_Cpp_net6;ML_Cpp_net472;ML_Mono;STANDALONE_Mono;STANDALONE_Cpp</Configurations>
13+
<LangVersion>latest</LangVersion>
14+
<Configurations>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</Configurations>
1515
</PropertyGroup>
1616
<!-- ~~~~~ CONFIGURATIONS ~~~~~ -->
17-
<!-- ML IL2CPP net6 -->
17+
<!-- ML IL2CPP Unhollower net6 -->
1818
<PropertyGroup Condition="'$(Configuration)'=='ML_Cpp_net6'">
1919
<TargetFramework>net6</TargetFramework>
2020
<OutputPath>..\Release\UnityExplorer.MelonLoader.IL2CPP.net6preview\</OutputPath>
2121
<DefineConstants>CPP,ML,UNHOLLOWER</DefineConstants>
2222
<AssemblyName>UnityExplorer.ML.IL2CPP.net6preview</AssemblyName>
2323
</PropertyGroup>
24+
<!-- ML IL2CPP Interop net6 -->
25+
<PropertyGroup Condition="'$(Configuration)'=='ML_Cpp_net6_interop'">
26+
<TargetFramework>net6</TargetFramework>
27+
<OutputPath>..\Release\UnityExplorer.MelonLoader.IL2CPP.net6preview.interop\</OutputPath>
28+
<DefineConstants>CPP,ML,INTEROP</DefineConstants>
29+
<AssemblyName>UnityExplorer.ML.IL2CPP.net6preview.interop</AssemblyName>
30+
</PropertyGroup>
2431
<!-- ML IL2CPP net472 (TEMP) -->
2532
<PropertyGroup Condition="'$(Configuration)'=='ML_Cpp_net472'">
2633
<TargetFramework>net472</TargetFramework>
@@ -93,6 +100,11 @@
93100
<PackageReference Include="Il2CppInterop.Runtime" Version="1.0.0" />
94101
<PackageReference Include="UniverseLib.IL2CPP.Interop" Version="1.5.1" />
95102
</ItemGroup>
103+
<ItemGroup Condition="'$(Configuration)'=='ML_Cpp_net6_interop'">
104+
<PackageReference Include="Il2CppInterop.Common" Version="1.0.0" />
105+
<PackageReference Include="Il2CppInterop.Runtime" Version="1.0.0" />
106+
<PackageReference Include="UniverseLib.IL2CPP.Interop.ML" Version="1.5.4.1" />
107+
</ItemGroup>
96108
<!-- mono nuget -->
97109
<ItemGroup Condition="'$(Configuration)'=='BIE6_Mono' or '$(Configuration)'=='BIE5_Mono' or '$(Configuration)'=='ML_Mono' or '$(Configuration)'=='STANDALONE_Mono'">
98110
<PackageReference Include="UniverseLib.Mono" Version="1.5.1" />
@@ -114,7 +126,7 @@
114126
</Reference>
115127
</ItemGroup>
116128
<!-- MelonLoader net6 -->
117-
<ItemGroup Condition="'$(Configuration)'=='ML_Cpp_net6'">
129+
<ItemGroup Condition="'$(Configuration)'=='ML_Cpp_net6' or '$(Configuration)'=='ML_Cpp_net6_interop'">
118130
<Reference Include="MelonLoader">
119131
<HintPath>..\lib\net6\MelonLoader.dll</HintPath>
120132
<Private>False</Private>
@@ -211,7 +223,7 @@
211223
</Reference>
212224
</ItemGroup>
213225
<!-- Il2Cpp Interop -->
214-
<ItemGroup Condition="'$(Configuration)'=='BIE_Cpp_CoreCLR'">
226+
<ItemGroup Condition="'$(Configuration)'=='BIE_Cpp_CoreCLR' or '$(Configuration)'=='ML_Cpp_net6_interop'">
215227
<Reference Include="Il2Cppmscorlib">
216228
<HintPath>..\lib\interop\Il2Cppmscorlib.dll</HintPath>
217229
<Private>False</Private>

src/UnityExplorer.sln

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Global
1313
Release_BIE6_Mono|Any CPU = Release_BIE6_Mono|Any CPU
1414
Release_ML_Cpp_net472|Any CPU = Release_ML_Cpp_net472|Any CPU
1515
Release_ML_Cpp_net6|Any CPU = Release_ML_Cpp_net6|Any CPU
16+
Release_ML_Cpp_net6_interop|Any CPU = Release_ML_Cpp_net6_interop|Any CPU
1617
Release_ML_Mono|Any CPU = Release_ML_Mono|Any CPU
1718
Release_STANDALONE_Cpp|Any CPU = Release_STANDALONE_Cpp|Any CPU
1819
Release_STANDALONE_Mono|Any CPU = Release_STANDALONE_Mono|Any CPU
@@ -30,6 +31,8 @@ Global
3031
{B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_ML_Cpp_net472|Any CPU.Build.0 = ML_Cpp_net472|Any CPU
3132
{B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_ML_Cpp_net6|Any CPU.ActiveCfg = ML_Cpp_net6|Any CPU
3233
{B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_ML_Cpp_net6|Any CPU.Build.0 = ML_Cpp_net6|Any CPU
34+
{B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_ML_Cpp_net6_interop|Any CPU.ActiveCfg = ML_Cpp_net6_interop|Any CPU
35+
{B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_ML_Cpp_net6_interop|Any CPU.Build.0 = ML_Cpp_net6_interop|Any CPU
3336
{B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_ML_Mono|Any CPU.ActiveCfg = ML_Mono|Any CPU
3437
{B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_ML_Mono|Any CPU.Build.0 = ML_Mono|Any CPU
3538
{B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}.Release_STANDALONE_Cpp|Any CPU.ActiveCfg = STANDALONE_Cpp|Any CPU

0 commit comments

Comments
 (0)