MonoDetour 0.1.0-dev.10
See the version list below for details.
dotnet add package MonoDetour --version 0.1.0-dev.10
NuGet\Install-Package MonoDetour -Version 0.1.0-dev.10
<PackageReference Include="MonoDetour" Version="0.1.0-dev.10" />
<PackageVersion Include="MonoDetour" Version="0.1.0-dev.10" />
<PackageReference Include="MonoDetour" />
paket add MonoDetour --version 0.1.0-dev.10
#r "nuget: MonoDetour, 0.1.0-dev.10"
#addin nuget:?package=MonoDetour&version=0.1.0-dev.10&prerelease
#tool nuget:?package=MonoDetour&version=0.1.0-dev.10&prerelease
MonoDetour
MonoDetour | MonoDetour.HookGen |
---|---|
A MonoMod.RuntimeDetour
wrapper optimized for convenience, based around HookGen with C# source generators.
This library is not fully released, and things will change.
- Bugs and missing functionality is expected
- Documentation may not reflect reality
Major things missing for you may be:
- Currently there is no HarmonyX interoperability
- Hooks that change control flow (HarmonyX prefix return false) will ignore MonoDetour/HarmonyX
Add to Your Project
Change the version number to optimally the newest:
<ItemGroup>
<PackageReference Include="MonoDetour.HookGen" Version="0.1.0-*" PrivateAssets="all" />
<PackageReference Include="MonoDetour" Version="0.1.0-*" />
</ItemGroup>
MonoDetour.HookGen will automatically bring in the oldest MonoDetour reference it supports, so it's a good idea to specify the version for both.
Additionally MonoDetour automatically brings in the oldest MonoMod.RuntimeDetour version it supports, so also specify its version to the one you want (or don't if it's included by e.g. BepInEx references). MonoDetour should support MonoMod.RuntimeDetour versions 21.12.13.1 and 25.*, with possibly anything in between.
Documentation
Usage
MonoDetour is mainly designed to be used with HookGen. That is, MonoDetour generates helpers hooks to make hooking easy.
You can use the generated hooks like so:
[MonoDetourTargets(typeof(SomeType))]
class SomeTypeHooks
{
[MonoDetourHookInit]
internal static void InitHooks()
{
// Note: this is using the default generated MonoDetourManager
// MonoDetour.HookGen.DefaultMonoDetourManager.Instance by default.
// Use it for managing your hooks.
On.SomeNamespace.SomeType.SomeMethod.Prefix(Prefix_SomeType_SomeMethod);
}
static void Prefix_SomeType_SomeMethod(SomeType self)
{
Console.WriteLine("Hello from Prefix hook 1!");
}
}
MonoDetour entirely relies on ILHook
s for hooking similar to HarmonyX. But instead of having monolithic ILHook
methods like in HarmonyX, MonoDetour maps every hook to a unique ILHook
.
Core Concepts
MonoDetourManager
https://monodetour.github.io/getting-started/monodetourmanager/
Why?
https://monodetour.github.io/getting-started/why-monodetour/
How Does the HookGen Work?
https://monodetour.github.io/getting-started/hookgen/
Credits
The HookGen source generator is heavily based on MonoMod.HookGen.V2. Without it, this project probably wouldn't exist.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- MonoMod.RuntimeDetour (>= 21.12.13.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on MonoDetour:
Package | Downloads |
---|---|
MonoDetour.HookGen
Hook generation for MonoDetour via C# source generators: On.Namespace.Type.Method.Prefix(MyPrefix); |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.6.3 | 0 | 6/11/2025 |
0.6.2 | 29 | 6/10/2025 |
0.6.1 | 35 | 6/8/2025 |
0.6.0 | 77 | 6/6/2025 |
0.5.4 | 100 | 6/6/2025 |
0.5.3 | 112 | 6/4/2025 |
0.5.2 | 106 | 6/4/2025 |
0.5.1 | 105 | 6/4/2025 |
0.5.0 | 143 | 6/4/2025 |
0.4.7 | 107 | 6/4/2025 |
0.4.6 | 111 | 6/3/2025 |
0.4.5 | 109 | 6/1/2025 |
0.4.4 | 64 | 6/1/2025 |
0.4.3 | 67 | 6/1/2025 |
0.4.2 | 79 | 5/30/2025 |
0.4.0 | 200 | 5/28/2025 |
0.3.1-dev | 110 | 5/28/2025 |
0.3.0-dev | 170 | 5/27/2025 |
0.2.0-dev | 111 | 5/26/2025 |
0.1.1-dev | 157 | 5/25/2025 |
0.1.0-dev.10 | 122 | 5/25/2025 |
0.1.0-dev.5 | 75 | 5/24/2025 |
0.1.0-dev | 52 | 5/24/2025 |