BepInEx / BepInEx.MelonLoader.Loader

BepInEx loader for MelonLoader mods and plugins
GNU Affero General Public License v3.0
38 stars 4 forks source link

Mods using harmony do not initialize properly #1

Closed headassbtw closed 3 years ago

headassbtw commented 3 years ago

Hi, i'm trying to play audica with MelonLoader mods, but whenever i do, only one mod out of the few i have installed actually loads. From looking at the logs it appears as if most of them are having an issue pertaining to harmony, and being unable to find the HarmonyPatch class. I've attached a full log if that helps LogOutput.log

btw, i'm using linux and proton

bbepis commented 3 years ago

Try the v1.2 release. The underlying issue is that MelonLoader for some strange reason packs Harmony(X) and other dependent libraries into the MelonLoader.dll assembly, and as such mods will try and look for Harmony types within the MelonLoader assembly instead of the Harmony assembly as it should be.

The fix is to use the [TypeForwardedTo] attribute inside the loader to tell mods to look inside of the HarmonyX library to find the Harmony types. I had a bunch of the most used Harmony types, but I made a script to find and forward all public HarmonyX types to prevent this issue from happening again.

headassbtw commented 3 years ago

this seems to have fixed the issue, along with setting EnablePatchShield to false, mods appear to load flawlessly but both of my controllers are dead so i can't really test