LighterPatcher is an adaptation of @xiaoxiao921's LighterHook. It aims to reduce the weight of MonoMod RuntimeDetour's generated MMHook file as a BepInEx patcher.
MMHOOK_Assembly-CSharp.dll
sometimes makes games slow. This patcher makes MMHOOK_Assembly-CSharp the smallest it can be.
Patcher make make computer go faster.
Put the LighterPatcher.dll
into BepInEx\Patchers
folder.
MMHOOK_Assembly-Csharp
contains a lot of extranous types that take a lot of processing power to handle, this patcher strips all types that aren't required by any plugins.
The process to do so is as follows:
- Scan all dll files in the
BepInEx\Plugins
folder, and when that finds a mod with a reference toMMHOOK_Assembly-CSharp.dll
, scan all methods of that dll for references toOn.*
andIL.*
. - Back up the original
MMHOOK_Assembly-CSharp.dll
toMMHOOK_Assembly-CSharp.dll.backup
. - Sort all types needed, and all types present.
- Do a mergeSort-esque iteration over both lists and remove types in the 'original' list that not present in the 'needed' list.
- Expand all nested types while doing so.
- Write the stripped MMHOOK.
-
1.0.5
- Fix an issue where if a method didn't have it's first instructions as call(virt)s, it would be skipped. Thanks
Windows10CE
. - 1.0.5.1 Added better trace messages.
- 1.0.5.1 Fixed needing types not available in the
IL
namespace.
- Fix an issue where if a method didn't have it's first instructions as call(virt)s, it would be skipped. Thanks
-
1.0.4
- Fix case where patcher would fail on certain well-formed instructions.
-
1.0.3
- Skip trimming types that are not part of the
On
andIL
namespace, as we have not done any scanning for dependencies on such types. Additionally, such types may be used as markers by other modifications. Like BepInEx.MonoMod.HookGenPatcher.
- Skip trimming types that are not part of the
-
1.0.2
- Fix case where patcher would remove types needed by parameters of uncalled methods.
- Failing to succesfully build will no longer leave the enviroment in an unstable state.
- More expansive logging when set to 'Debug'.
- Remove unused non-delegate nested types. (Thanks iDeath for pointing this out)
- No longer expand nested types of unused types.
-
1.0.1
- Fix case where patcher would fail to backup the mmhook because it already existed.
-
1.0.0
- initial release