We recommend using the Thunderstore Mod Manager or an alternative for installing mods
Figured I might as well release some of my tooling so others can benefit from it.
This is a library that adds a functional-style DSL for writing IL hooks.
DSL = Domain Specific (programming) Language
In this case, its a fancy term for a set of functions that enable a specific style of programming within your C# code.
Don't worry about it if you don't know.
All you really need to know is that this style makes your IL hooks much, much, much easier to read and write.
static void MyILHook(ILContext il) => new ILCursor(il) .Goto(x => x.MatchLdcR4(2.65f)) .Delete() .Op_LdConst(3.5f);
static void MyILHook(ILContext il) => new ILCursor(il) .Goto(x => x.MatchAdd()) .Delete() .OP_Call<Func<int,int,int>>((lhs, rhs) => lhs * rhs + 14);
static void MyILHook(ILContext il) => new ILCursor(il) .Goto(MoveType.After, x => x.MatchLdfld<Cheese>(nameof(Cheese.goodLevel))) .OP_Dup() .AddLocal<int>(out var index) .OP_StLocal(index) .Goto(MoveType.After, x => x.MatchLdfld<NotCheese>(nameof(NotCheese.badLevel))) .OP_LdLocal(index) .OP_Sub();
private void MyILHook(ILContext il) => new ILCursor(il) .Log(base.Logger.LogError) .LogContext(base.Logger.LogFatal);
Initially I told myself I was releasing this to make life easier for some other people but then I spent 2 hours in paint making this horrible icon. Now I actually have no idea why I released this and am instead left with a profound feeling of self-doubt, confusion, and emptiness.
-Fixed nullability of a few cursor functions
Please note that the install buttons only work if you have compatible client software installed, such as the Thunderstore Mod Manager. Otherwise use the zip download links instead.
|Upload date||Version number||Downloads||Download link|