ILHookHelperAPI

版本 v1.0.1·更新於 2021-04-04

Implements a functional-styled DSL for working with ILHooks inside C# syntax.

模組介紹 作者原文

Figured I might as well release some of my tooling so others can benefit from it.

Summary

This is a library that adds a functional-style DSL for writing IL hooks.

Wtf is a DSL?

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.

Wtf does functional-style mean?

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.

Example code

Simple value swap

static void MyILHook(ILContext il) => new ILCursor(il).Goto(x => x.MatchLdcR4(2.65f)).Delete().Op_LdConst(3.5f);

Swap add for custom function

static void MyILHook(ILContext il) => new ILCursor(il).Goto(x => x.MatchAdd()).Delete().OP_Call>((lhs, rhs) => lhs * rhs + 14);

Store value from one place, reuse it in another

static void MyILHook(ILContext il) => new ILCursor(il).Goto(MoveType.After, x => x.MatchLdfld(nameof(Cheese.goodLevel))).OP_Dup().AddLocal(out var index).OP_StLocal(index).Goto(MoveType.After, x => x.MatchLdfld(nameof(NotCheese.badLevel))).OP_LdLocal(index).OP_Sub();

Spam console with useless text to confuse users

private void MyILHook(ILContext il) => new ILCursor(il).Log(base.Logger.LogError).LogContext(base.Logger.LogFatal);

Why?

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.

Changelog

1.0.1

-Fixed nullability of a few cursor functions

安裝與使用 安裝:BepInEx 外掛

  1. 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
  2. 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
  3. 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
  4. 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。

帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。

檔案與校驗

檔案名稱
ILHookHelperAPI-1.0.1.zip
檔案大小
12.6 KiB
SHA-256
8e865751c9cda851cefd5c9156067836d99e4e466fb3277f20941177c5f9e13a
入庫時間
2026-10-12 00:53