Owlcat.GenericDetours
0.1.0-alpha.18
dotnet add package Owlcat.GenericDetours --version 0.1.0-alpha.18
NuGet\Install-Package Owlcat.GenericDetours -Version 0.1.0-alpha.18
<PackageReference Include="Owlcat.GenericDetours" Version="0.1.0-alpha.18" />
<PackageVersion Include="Owlcat.GenericDetours" Version="0.1.0-alpha.18" />
<PackageReference Include="Owlcat.GenericDetours" />
paket add Owlcat.GenericDetours --version 0.1.0-alpha.18
#r "nuget: Owlcat.GenericDetours, 0.1.0-alpha.18"
#:package Owlcat.GenericDetours@0.1.0-alpha.18
#addin nuget:?package=Owlcat.GenericDetours&version=0.1.0-alpha.18&prerelease
#tool nuget:?package=Owlcat.GenericDetours&version=0.1.0-alpha.18&prerelease
Owlcat.GenericDetours
Owlcat.GenericDetours detours open generic methods in Owlcat Unity games without deploying assemblies named MonoMod.* or Mono.Cecil.*. Its implementation dependencies are internalized into this assembly, so loading it does not replace the MonoMod version used by HarmonyX or another mod.
The library targets .NET Framework 3.5 for compatibility with older Unity Mono runtimes and can be referenced by the net472 and net481 projects produced by Owlcat.Templates.
Install the prerelease package with:
dotnet add package Owlcat.GenericDetours --version 0.1.0-alpha.17
Usage
using Owlcat.RuntimeDetour;
using System;
using System.Reflection;
static class Example
{
private static T Identity<T>(T value) => value;
private static T Replacement<T>(Func<T, T> orig, T value)
{
// Call orig(value), replace the result, or both.
return orig(value);
}
public static GenericDetour Install()
{
const BindingFlags Flags = BindingFlags.NonPublic | BindingFlags.Static;
var source = typeof(Example).GetMethod(nameof(Identity), Flags);
var target = typeof(Example).GetMethod(nameof(Replacement), Flags);
return new GenericDetour(
source,
target,
new[] { new[] { typeof(string) } });
}
}
Keep the returned GenericDetour alive for as long as the patch is needed and dispose it when the mod unloads. Use Prime to add instantiations discovered later.
Automatic discovery is optional. Explicit priming is the predictable default and bypasses discovery, but it does not bypass the runtime-specific dispatch machinery. In particular, Mono generic contexts that are not carried by this currently require x86-64 or Arm64, and Mono builds using the alternative MONO_SMALL_CONFIG generic-metadata layout are not supported. Some explicitly primed hooks do not need those paths and can still work elsewhere.
Isolation boundary
Managed assembly loading is isolated: the package contains only Owlcat.GenericDetours.dll, and its implementation types are internal. Native patches are process-wide. Do not patch the same concrete method body with this library and another detour engine concurrently; neither engine can preserve the other's private detour chain.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET Framework | net35 is compatible. net40 was computed. net403 was computed. net45 was computed. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
.NETFramework 3.5
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-alpha.18 | 76 | 8/27/2026 |
| 0.1.0-alpha.17 | 84 | 8/13/2026 |
| 0.1.0-alpha.10 | 71 | 8/13/2026 |
| 0.1.0-alpha.9 | 78 | 8/13/2026 |
| 0.1.0-alpha.8 | 69 | 8/13/2026 |
| 0.1.0-alpha.7 | 70 | 8/13/2026 |
| 0.1.0-alpha.6 | 68 | 8/13/2026 |
| 0.1.0-alpha.5 | 69 | 8/13/2026 |
| 0.1.0-alpha.4 | 72 | 8/13/2026 |
| 0.1.0-alpha.3 | 72 | 8/13/2026 |
| 0.1.0-alpha.2 | 69 | 8/13/2026 |
| 0.1.0-alpha.1 | 73 | 8/13/2026 |