Skip to content

Harmony v1.1.0

Compare
Choose a tag to compare
@pardeike pardeike released this 20 May 18:29
· 1337 commits to master since this release

Hello Modders!

This is the 2nd major release for Harmony. The API has become more mature and this release contains a few important bug fixes. There are a lot of changes:

# Harmony now supports methods with try/catch logic

This is a big one. CodeInstructions for transpilers now carry a new field 'blocks' that is a list over different enum values that reflect start and end points for exception blocks. If you copy existing instructions around you should use the new Clone() method or empty that field manually.

A mixture of old and new Harmony versions can co-exist because the new Harmony has a self-patching feature that updates selected parts of itself (in this case the transpiler pipeline). There is also a preserving function that makes sure that old CodeInstructions don't lead to information loss.

# Improved AccessTools

There are now more ways to get your MethodInfo's - for declared methods and for private types. Have a look and don't use ordinary reflections.

# Patching improvements

You can now unpatch and there are new ways to mass patch a whole class. Also, Prepare and TargetMethod have been improved.

Postfixes now support a pipe-through function so you can change results that cannot be changed by ref (IEnumerable i.e.). Error reporting has been improved and is faster.

Private fields of the current instance/class can now be injected in your prefixes/postfixes by using their name prefixed with three underscores. It is also possible to annotate argument name translations for obfuscated methods.

# Misc

Tons of other stuff has changed and the documentation will be updated soon. Compatibility with .NET has been improved and you can extract IL code from other methods for usage in your transpilers. AccessCache had a bug fixed where it would cache types wrongly. And lots more...

Please consult the Wiki to learn more about how to use Harmony.

Thanks again to all the friendly people from the different gaming and modding communities. Without you, we would not have come this far.

Andreas Pardeike