karkkant / valheim-spearfishing

Valheim client side mod that enables fishing with projectile weapons
MIT License
3 stars 3 forks source link

Incompatible with Ashlands update #7

Closed nbusseneau closed 5 months ago

nbusseneau commented 6 months ago

Hey, thanks for your mods.

Seems like the Ashlands update broke the Projectile.OnHit patch.

[Info   :   BepInEx] Loading [Spearfishing 1.0.2]
[Error  : Unity Log] InvalidProgramException: Invalid IL code in (wrapper dynamic-method) Projectile:DMD<Projectile::OnHit> (Projectile,UnityEngine.Collider,UnityEngine.Vector3,bool,UnityEngine.Vector3): IL_028d: callvirt  0x00000087

Stack trace:
System.RuntimeMethodHandle.GetFunctionPointer () (at <17d9ce77f27a4bd2afb5ba32c9bea976>:0)
MonoMod.RuntimeDetour.Platforms.DetourRuntimeILPlatform.GetFunctionPointer (System.Reflection.MethodBase method, System.RuntimeMethodHandle handle) (at <4e2760c7517c4ea79c633d67e84b319f>:0)
MonoMod.RuntimeDetour.Platforms.DetourRuntimeILPlatform.GetNativeStart (System.Reflection.MethodBase method) (at <4e2760c7517c4ea79c633d67e84b319f>:0)
MonoMod.RuntimeDetour.DetourHelper.GetNativeStart (System.Reflection.MethodBase method) (at <4e2760c7517c4ea79c633d67e84b319f>:0)
MonoMod.RuntimeDetour.Detour._RefreshChain (System.Reflection.MethodBase method) (at <4e2760c7517c4ea79c633d67e84b319f>:0)
MonoMod.RuntimeDetour.Detour.Apply () (at <4e2760c7517c4ea79c633d67e84b319f>:0)
MonoMod.RuntimeDetour.Detour..ctor (System.Reflection.MethodBase from, System.Reflection.MethodBase to, MonoMod.RuntimeDetour.DetourConfig& config) (at <4e2760c7517c4ea79c633d67e84b319f>:0)
(wrapper dynamic-method) MonoMod.RuntimeDetour.ILHook+Context.DMD<MonoMod.RuntimeDetour.ILHook+Context::Refresh>(MonoMod.RuntimeDetour.ILHook/Context)
(wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition.Trampoline<MonoMod.RuntimeDetour.ILHook+Context::Refresh>?55061666(object)
HarmonyLib.Internal.RuntimeFixes.StackTraceFixes.OnILChainRefresh (System.Object self) (at <474744d65d8e460fa08cd5fd82b5d65f>:0)
MonoMod.RuntimeDetour.ILHook.Apply () (at <4e2760c7517c4ea79c633d67e84b319f>:0)
HarmonyLib.Public.Patching.ManagedMethodPatcher.DetourTo (System.Reflection.MethodBase replacement) (at <474744d65d8e460fa08cd5fd82b5d65f>:0)
Rethrow as HarmonyException: IL Compile Error (unknown location)
HarmonyLib.Public.Patching.ManagedMethodPatcher.DetourTo (System.Reflection.MethodBase replacement) (at <474744d65d8e460fa08cd5fd82b5d65f>:0)
HarmonyLib.PatchFunctions.UpdateWrapper (System.Reflection.MethodBase original, HarmonyLib.PatchInfo patchInfo) (at <474744d65d8e460fa08cd5fd82b5d65f>:0)
Rethrow as HarmonyException: IL Compile Error (unknown location)
HarmonyLib.PatchClassProcessor.ReportException (System.Exception exception, System.Reflection.MethodBase original) (at <474744d65d8e460fa08cd5fd82b5d65f>:0)
HarmonyLib.PatchClassProcessor.Patch () (at <474744d65d8e460fa08cd5fd82b5d65f>:0)
HarmonyLib.Harmony.<PatchAll>b__11_0 (System.Type type) (at <474744d65d8e460fa08cd5fd82b5d65f>:0)
HarmonyLib.CollectionExtensions.Do[T] (System.Collections.Generic.IEnumerable`1[T] sequence, System.Action`1[T] action) (at <474744d65d8e460fa08cd5fd82b5d65f>:0)
HarmonyLib.Harmony.PatchAll (System.Reflection.Assembly assembly) (at <474744d65d8e460fa08cd5fd82b5d65f>:0)
HarmonyLib.Harmony.PatchAll () (at <474744d65d8e460fa08cd5fd82b5d65f>:0)
Spearfishing.Plugin.Awake () (at <cc5110ca593042779b96459eaac6f768>:0)
UnityEngine.GameObject:AddComponent(Type)
BepInEx.Bootstrap.Chainloader:Start()
UnityEngine.GameObject:.cctor()
PlatformTools.Common.SingletonMonoBehaviour`1:get_Instance()
PlatformTools.PlatformManagerInitializer:OnRuntimeMethodLoad()
karkkant commented 6 months ago

Try uninstall and re-install the mod, it worked for me.

The Projectile.OnHit method signature has changed slightly but none of that should matter for this mod. It's a weird one, might be some Modman caching issue or such...

probablykory commented 6 months ago

Worked fine for me. I just tested things out locally to double check. image

nbusseneau commented 6 months ago

Still not working on my end, even after uninstall/reinstall and manually cleaning r2modman's cache. Doesn't work on a fresh r2modman profile with just Spearfishing / SolidHitboxes either. Validated Steam files just in case, still the same. Something fishy is going on, but I'm not quite sure what... đŸ¤”

nbusseneau commented 6 months ago

OK, actually when only Spearfishing is present, it works, but SolidHitboxes alone doesn't work (it fails with https://github.com/karkkant/valheim-solid_hitboxes/issues/5), and if both are present then Spearfishing exhibits the issue above.

So, when SolidHitboxes is present, it makes Spearfishing's patch fail. Perhaps it fails in the middle of IL patching but has already had enough impact to make Spearfishing fail?

karkkant commented 5 months ago

Yeah SolidHitboxes is not Ashlands compatible at the moment. They both patch Projectile.OnHit method so it can definitely cause issues.