Change ShouldCollide to a posthook#1657
Change ShouldCollide to a posthook#1657asherkin merged 1 commit intoalliedmodders:masterfrom Kenzzer:master
Conversation
|
This fix looks correct to me, but I'd like it to get some testing around the behaviour of ShouldCollide before merging. |
|
Will try to test this weekend then. Though by behavior what exactly are you looking into being tested ? All I can think right now, is retrieving the address of I believe this would satisfy testing the behaviour ? Edit : Something like public bool Test_SDKHook_ShouldCollide(int entity, int collisiongroup, int contentsmask, bool originalResult)
{
if (originalResult != SDKCall(sigCallShouldCollide, collisiongroup, contentsmask))
{
SetFailState("SDKHook_ShouldCollide mismatch!");
}
return originalResult;
}With this plugin and setting the hook up on entities that don't override the virtual function. We should after a while, get a mismatch and the plugin unloaded. And with the PR hopefully no mismatch ever. |
|
I've tested this on TF2 Windows. Without the changes in this PR, a couple entities report a mismatch between SDKHook's With the changes in this PR, the only entities that report a mismatch are the ones that override TF2 Windows sig in case someone else would like to test: |
Thank you very much for your feedback |
Fixes #1650
As pointed by @asherkin over discord the use of
META_RESULT_OVERRIDE_RETorMETA_RESULT_ORIG_RETwithin a non post hook is wrong. This PR fixes that.I'm not super familiar with sourcehook, so my fix could be horribly wrong. If I'm wrong, at the very least this PR will kick off a discussion? I was also tempted to replace the
META_RESULT_ORIG_RETline with anSH_CALLinstead, but this would end to essentially turning the function into a post hook.Smallest PR in the small west ?