-
Notifications
You must be signed in to change notification settings - Fork 780
[Il2Cpp] Native Detour Providers & FastNativeDetour removal #409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Do we still need to use monomod |
| if (!typeof(Delegate).IsAssignableFrom(typeof(T))) | ||
| throw new InvalidOperationException($"Type {typeof(T)} not a delegate type."); | ||
|
|
||
| return GenerateTrampoline(typeof(T).GetMethod("Invoke")).CreateDelegate(typeof(T)) as T; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to do this whole dance instead just TrampolinePtr.AsDelegate<T>()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was reused from the original FastNativeDetour's GenerateTrampoline implementation, but it can be rewritten as is seen on the doorstop 4 support branch
Firstly, I don't think Secondly, does NativeLibrary have a ready attribute-based API like |
I merged this PR into #391 (after simplifying the code using .NET 6/C#10 features). |
|
This was merged into master via #391 |

Description
Removes FastNativeDetour in favor of native detour providers.
Creates a NativeDetourHelper for a managed API of obtaining OS-specific detour providers.
Implements detour providers for funchook & Dobby
Adds a configuration option to force NativeDetourHelper to use a specific provider
Motivation and Context
The native detour providers are added so we can support a wider set of architectures in the future by providing wrappers around native detour libraries.
Abstracting the creation of detours into a single helper class obsoletes FastNativeDetour and it's DetourGenerator, leading to their removal.
How Has This Been Tested?
So far this has been tested on a build of funchook & Dobby on a Windows 10 x64 environment on the game GTFO.
Native detours applied and disposed by IL2CPPChainloader work without issue on GTFO (unity v2019.4.21f1) and so do Harmony patches.
Types of changes
Checklist:
TODO: