Skip to content

Commit

Permalink
General Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
HerpDerpinstine committed Sep 26, 2024
1 parent 83434b3 commit 97bd3ce
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Dependencies/SupportModules/Il2Cpp/Il2Cpp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
https://nuget.bepinex.dev/v3/index.json
</RestoreAdditionalProjectSources>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Libs\**" />
<EmbeddedResource Remove="Libs\**" />
<None Remove="Libs\**" />
</ItemGroup>
<ItemGroup>
<Reference Include="Il2Cppmscorlib">
<HintPath>Libs\Il2Cppmscorlib.dll</HintPath>
Expand Down
5 changes: 5 additions & 0 deletions Dependencies/SupportModules/Mono/Mono.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>embedded</DebugType>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Libs\**" />
<EmbeddedResource Remove="Libs\**" />
<None Remove="Libs\**" />
</ItemGroup>
<ItemGroup>
<Reference Include="UnityEngine">
<HintPath>Libs\UnityEngine.dll</HintPath>
Expand Down
26 changes: 25 additions & 1 deletion MelonLoader/Fixes/Il2CppICallInjector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,30 @@ private static IntPtr il2cpp_resolve_icall_Detour(IntPtr signature)
return pair.Item3;
}

private static Type FindType(string typeFullName)
{
if (string.IsNullOrEmpty(typeFullName))
return null;

Type result = null;
foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies())
{
if (a == null)
continue;

result = a.GetValidType($"Il2Cpp.{typeFullName}");
if (result == null)
result = a.GetValidType($"Il2Cpp{typeFullName}");
if (result == null)
result = a.GetValidType(typeFullName);

if (result != null)
break;
}

return result;
}

private static bool ShouldInject(string signature, out MethodInfo unityShimMethod)
{
unityShimMethod = null;
Expand All @@ -170,7 +194,7 @@ private static bool ShouldInject(string signature, out MethodInfo unityShimMetho
string typeName = split[0];

// Find Managed Type
Type newType = Il2CppInteropFixes.FixedFindType(typeName);
Type newType = FindType(typeName);
if (newType == null)
return false;

Expand Down

0 comments on commit 97bd3ce

Please sign in to comment.