-
-
Notifications
You must be signed in to change notification settings - Fork 132
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
Extend DynamicHooks
to support virtual functions
#617
base: main
Are you sure you want to change the base?
Conversation
Dynamic
DynamicHooks
to support virtual functions
/// <summary> | ||
/// <b>WARNING:</b> this is only supposed to be used with <see cref="VirtualFunctionVoid"/> and <see cref="VirtualFunctionWithReturn{TResult}"/> | ||
/// </summary> | ||
internal BaseMemoryFunction(IntPtr objectPtr, int offset, DataType returnType, DataType[] parameters) : base( |
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.
This and related constructors are internal
because they should not be used randomly. People should only use the exposed VirtualFunctionVoid
and VirtualFunctionWithReturn
versions
} | ||
} | ||
|
||
return function; |
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.
might need a better way? if we pass another entity instance (ptr) with the same offset it will probably try to hook the same function again and fail? (untested currently, will answer here when I can test it)
5c674f5
to
73fe4ff
Compare
@roflmuffin +1 on this |
my second review has to be resolved before this pr is ready |
With these changes, we will be able to hook virtual functions based on offset.
Example
Testing
StartTouch
,Touch
,EndTouch
hooks on the soccerball in de_dust2Developers should be aware that they are hooking the virtual function, which is shared between instances (same as with signatures)