/BTHarmonyUtils

Utility Library for patching with Harmony

Primary LanguageC#

Features

BTHarmonyUtils is stuffed with classes that are intended to make your life easier.
Let's have a look at its features.

Feature Complexity Description
InstructionSimplifier 🔴 Converts Instructions to a simplified InstructionSet to improve patch consistency.
You won't be using this explicitly, but I recommend taking a look at it to understand how your patches are applied.
Midfix_Patch 🔴 An extension of Prefix/Postfix patching, lets you place your patch anywhere inside a Method.
Transpiler_Patch 🔴🔴 If you want to change Methods in ways that cannot be done with Prefix, Midfix or Postfix patches, this is for you.
This tool takes care of correctly rewriting the instruction stack, so you can focus solely on how code needs to be changed.
IEnumerator_Patching 🔴 Patching a Method that returns an IEnumerator? You'll want this.
Instruction_Search 🔴🔴🔴 Useful for more complex Transpiler operations like
* branching to an existing label (e.g. when patching if conditionals)
* or dynamically extracting local variable indices.
MethodBodyReader 🔴🔴🔴 If you, for some reason, want to read the Instructions of a Method without Patching it with a Transpiler, this is for you.
As an example: you could dynamically extract part of an existing Method into a separate Method.
ByteBuffer 🔴🔴 Allows you to read built-in value types from an Array of Bytes.
Main use-case is reading compressed data from Save-Files or Memory.
TableBuilders 🔴 Allows you to easy to read tables to log files or other places.

VS Snippets

'HarmonySnippetsForVS.snippet' contains Midfix, Prefix, Postfix and Transpiler Snippets for Visual Studio.
You can import them by pressing 'ctrl+k' -> 'ctrl+b' and clicking on 'Import'. To load a snippet, press 'ctrl+k' -> 'ctrl+x' and select the snippet.