Caves of Qud

Caves of Qud

This item is incompatible with Caves of Qud. Please see the instructions page for reasons why this item might not work within Caves of Qud.
62 ratings
Harmony Injector
   
Award
Favorite
Favorited
Unfavorite
Type: Library, Script
File Size
Posted
Updated
1.599 MB
Jan 15, 2019 @ 9:26am
Aug 17, 2019 @ 9:45am
17 Change Notes ( view )

Subscribe to download
Harmony Injector

Description
Note: Thanks to @HawkleyFox for updated Harmony Injector with new features.
Contributor can go here: https://github.com/JHawkley/Harmony-Injector

Note: At the first time install before Enable this mod, you should restart game for make sure mod compiled success.

Note: Upgrade guide from HarmonyShim to Harmony Injector here: https://steamcommunity.com/workshop/filedetails/discussion/1625698528/1771511442696801069/

Harmony Injector is another injector for Harmony lib. This allow other mods patch any method of the game that not available for modding at current time.

Compare with HarmonyShim this mod allow to use mostly all features of Harmonylike PatchAll with Annotation, Manual Patching, AccessTools, Traverse, ... and just like you using Harmony package directly

For using just:
using Harmony; ... create patch class: in where we patch Mutate function of MultipleArms class [HarmonyPatch(typeof(MultipleArms))] [HarmonyPatch("Mutate", new[] { typeof(GameObject), typeof(int) })] class Patch { static void Postfix() { Debug.Log("[Namkazt.HarmonyTest] Yay!. We just override mutate function if you have mutation [MultipleArms]"); } }
and call Harmony functions like normal.

Note: you do NOT have to call:
var harmony = HarmonyInstance.Create("your.mod.id"); harmony.PatchAll(XRL.ModManager.modAssembly); // or harmony.PatchAll(Assembly.GetExecutingAssembly());

New update: allow to patch in unity MonoBehaviour easier (internal class) by follow this example:
using HarmonyInjector; .... your name space public static class Init { static Init() { try { var original = Injector.GetUnityType("Unity MonoBehaviour Class").GetMethod("Method to patch"); var postfix = typeof(Patch_NewGame_SelectSubtype).GetMethod("Transpiler"); Injector.Shared.Patch(original, null, null, new HarmonyMethod(postfix)); } catch (Exception ex) { Debug.Log(ex); } } }

Learn about Harmony: https://github.com/pardeike/Harmony/wiki/Patching
Popular Discussions View All (12)
6
Aug 14, 2019 @ 12:24pm
CoQ Update Broke Harmony Injector?
HawkleyFox
2
May 19, 2021 @ 7:42pm
bug report from game itself
Engreaved
3
Apr 1, 2019 @ 4:51am
Better Ability Bar + Hover Info = Error
HawkleyFox
33 Comments
HawkleyFox  [author] Sep 30, 2020 @ 6:07am 
Awesome to hear. A nice official addition for modding~
namkazt  [author] Sep 28, 2020 @ 5:13pm 
@gnarf: cool, thanks
gnarf  [developer] Sep 28, 2020 @ 4:13pm 
The latest version of Qud now ships Harmony enabled by default; this mod should no longer be required, and I'm hiding it as Incompatible.
HawkleyFox  [author] Aug 14, 2019 @ 2:03am 
Ahh, I see. Yeah, I guess Steam does not auto-subscribe you to new discussions on your Workshop mods by default, but I think you can enable it. Anyways, I posted the GitHub link in the discussion topic. Give it a try and let me know how it works on your end.
namkazt  [author] Aug 14, 2019 @ 1:38am 
No but i got notification in here.
HawkleyFox  [author] Aug 13, 2019 @ 4:01pm 
I've been trying to contact you; the mod is broken at the moment, but I've prepared a fix for it, along with some other added features (I got main-menu popups working). Did Steam not notify you of the forum topic I created?
namkazt  [author] Mar 17, 2019 @ 8:34pm 
Ok thanks. I will put on description
Deon ☣ Mar 17, 2019 @ 3:26am 
I got the same problem as Tyrant, and disabling that option fixed it. Thank you!
You may want to put it in mod description that the option can mess with Harmony.
namkazt  [author] Mar 9, 2019 @ 2:31am 
@Tyrant: never test that case but it is not supposed to happen :D
Tyrant Mar 8, 2019 @ 11:22pm 
I know that's what it's supposed to mean, but that's not the way it's behaving in this instance. If you have this option enabled and are subscribed to Harmony Injector AND a Harmony Injector addon (either Better Ability Bars, Hover Info, or both), Harmony Injector will be un-approvable.