Table of Contents

Method GetRetargetBytes

Namespace
MonoMod.Core.Platforms
Assembly
MonoMod.Core.dll

GetRetargetBytes(NativeDetourInfo, NativeDetourInfo, Span<byte>, out IDisposable?, out bool, out bool)

Gets the actual bytes to apply to perform the retarget.
int GetRetargetBytes(NativeDetourInfo original, NativeDetourInfo retarget, Span<byte> buffer, out IDisposable? allocationHandle, out bool needsRepatch, out bool disposeOldAlloc)

Parameters

original NativeDetourInfo
The original detour being retargeted.
retarget NativeDetourInfo
The NativeDetourInfo returned by ComputeRetargetInfo(NativeDetourInfo, nint, int) for this retarget.
buffer Span<byte>
The buffer to write the patch data into. This must be at least Size (of retarget bytes in length.
allocationHandle IDisposable
A handle to any allocation which must stay alive with the detour.
needsRepatch bool
true if the data in buffer should be patched into source location. If this is false, the data should not be patched in.
disposeOldAlloc bool
true if allocations associated with the old detour should be disposed. If this is false, then the old allocations should not be disposed, but do not necessarily need to be kept alive.

Returns

int
The number of bytes written to the buffer.
See Also