Jump to content

Recommended Posts

Posted

Hi all! I'm trying to update an old mod from 1.14 for 1.20... or i guess 1.21 now. But this is my first code mod and I'm having a hard time figuring out what's going wrong with the old mod. There's a StartClientSide method that calls harmony.PatchAll, and there's only one annotated class:

  [HarmonyPatch(typeof(ClientPlatformWindows))]
  [HarmonyPatch("AudioCreate")]
  public class Patch_ClientPlatformWindows_AudioCreate {
    public static void Prefix(
      SoundParams sound,
      AudioData data
    )

Now, just based on a stack of assumptions, this patches the AudioCreate method inside the ClientPlatformWindows class, and it prefixes the existing method with the new functionality defined in this file?

Since 1.14, it seems that the method's been renamed, there's now a CreateAudio method with the exact same signature. But just swapping the names around isn't working, so I'm building up my assumptions from the bottom to see where I'm going wrong, because currently I'm only getting this error when the mod calls harmony.PatchAll: Exception: Patching exception in method null.

So is there something small and obvious I'm missing, has Harmony updated how it works since 1.14, or do I just need to sit down with some documentation rather than trying to throw stuff at the compiler and seeing what sticks?

Posted

Nevermind, hit the books and confirmed, managed to target the patch appropriately to the new function and deambiguated it, because the runtime errors told me to. I think I may need some extra reworking but this bridge at least is crossed. 

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.