private static void Load() { MelonLogger.Msg("Loading Il2CppAssemblyGenerator..."); string BaseDirectory = Path.Combine(Path.Combine(Path.Combine(MelonUtils.BaseDirectory, "MelonLoader"), "Dependencies"), "Il2CppAssemblyGenerator"); if (!Directory.Exists(BaseDirectory)) { MelonLogger.Error("Failed to Find Il2CppAssemblyGenerator Directory!"); return; } string AssemblyPath = Path.Combine(BaseDirectory, $"{FileName}.dll"); if (!File.Exists(AssemblyPath)) { MelonLogger.Error($"Failed to Find {FileName}.dll!"); return; } try { asm = Assembly.LoadFrom(AssemblyPath); if (asm == null) { MelonLogger.ThrowInternalFailure($"Failed to Load Assembly for {FileName}.dll!"); return; } MonoInternals.MonoResolveManager.GetAssemblyResolveInfo(FileName).Override = asm; Type type = asm.GetType("MelonLoader.Il2CppAssemblyGenerator.Core"); if (type == null) { MelonLogger.ThrowInternalFailure($"Failed to Get Type for MelonLoader.Il2CppAssemblyGenerator.Core!"); return; } RunMethod = type.GetMethod("Run", BindingFlags.NonPublic | BindingFlags.Static); } catch (Exception ex) { MelonLogger.ThrowInternalFailure($"Il2CppAssemblyGenerator Exception: {ex}"); } }
internal static bool Setup() { IntPtr NativeMonoPtr = GetLibPtr(); if (NativeMonoPtr == IntPtr.Zero) { MelonLogger.ThrowInternalFailure("[MonoLibrary] Failed to get Mono Library Pointer from Internal Call!"); return(false); } try { Instance = NativeMonoPtr.ToNewNativeLibrary <MonoLibrary>().Instance; } catch (Exception ex) { MelonLogger.ThrowInternalFailure($"[MonoLibrary] Failed to load Mono NativeLibrary!\n{ex}"); return(false); } MelonDebug.Msg("[MonoLibrary] Setup Successful!"); return(true); }