Skip to content

Commit

Permalink
Fixed an issue with Il2CppAssemblyGenerator using Incorrect Module Pa…
Browse files Browse the repository at this point in the history
…thing to Load
  • Loading branch information
HerpDerpinstine committed Dec 8, 2024
1 parent c4a93e8 commit 91d56f3
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions MelonLoader/InternalUtils/Il2CppAssemblyGenerator.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#if NET6_0_OR_GREATER

using MelonLoader.Modules;
using System;
using System.Diagnostics;
Expand All @@ -9,17 +10,25 @@ namespace MelonLoader.InternalUtils
{
internal static class Il2CppAssemblyGenerator
{
public static readonly MelonModule.Info moduleInfo = new MelonModule.Info(
$"{MelonEnvironment.GameRootDirectory}{Path.DirectorySeparatorChar}MelonLoader{Path.DirectorySeparatorChar}Dependencies{Path.DirectorySeparatorChar}Il2CppAssemblyGenerator{Path.DirectorySeparatorChar}Il2CppAssemblyGenerator.dll"
, () => !MelonUtils.IsGameIl2Cpp());
private static readonly string modulePath = Path.Combine(MelonEnvironment.Il2CppAssemblyGeneratorDirectory, "Il2CppAssemblyGenerator.dll");
public static readonly MelonModule.Info moduleInfo = new MelonModule.Info(modulePath, () => !MelonUtils.IsGameIl2Cpp());

internal static bool Run()
{
var module = MelonModule.Load(moduleInfo);
if (module == null)
if (MelonEnvironment.IsMonoRuntime)
return true;

MelonLogger.MsgDirect("Loading Il2CppAssemblyGenerator...");
var module = MelonModule.Load(moduleInfo);
if (module == null)
{
if (File.Exists(modulePath))
MelonLogger.Error("Failed to Load Il2CppAssemblyGenerator!");
else
MelonLogger.Error("Il2CppAssemblyGenerator was Not Found!");
return false;
}

if (MelonUtils.IsWindows)
{
IntPtr windowHandle = Process.GetCurrentProcess().MainWindowHandle;
Expand All @@ -38,4 +47,5 @@ internal static bool Run()
}
}
}

#endif

0 comments on commit 91d56f3

Please sign in to comment.