Commit Graph
13 Commits
Author SHA1 Message Date
Peace-Maker 9da7e666f6 Fix |thiscall| on linux for functions with arguments
The previous fix messed up parameter getters and setters.
2018-06-02 13:36:52 +02:00
Peace-Maker 9d43111829 Don't call sourcepawn detour callbacks from threads other than the main thread
The SourcePawn VM isn't threadsafe.
2018-05-02 13:37:41 +02:00
Peace-Maker e8dafcb741 Fix changing return value of detoured function
AutoPtr boxing fuckup here.
2018-04-22 14:13:43 +02:00
Peace-Maker b442f519f0 Cleanup detour callback MRES return value handling
Deduplicate code for changed return values.

Add comments for non-trivial code.
2018-04-21 10:18:40 +02:00
Peace-Maker 462d9b99b7 More linux fixes 2018-01-27 17:27:03 +01:00
Peace-Maker b365b775c9 Fix linux build 2018-01-27 17:24:02 +01:00
Peace-Maker 2ba221b6a3 Fix passing this pointer to callback even if the detour was setup to ignore it
The this pointer was always passed to the plugin callback if the calling convention was a thiscall. Even if the plugin author set the this pointer type to ThisPointer_Ignore.
2018-01-23 13:40:55 +01:00
Peace-Maker 02e0545d75 Fix saving arguments in custom registers in combination with arguments on the stack
If a function was optimized to only pass one parameter in a register, but still pass other parameters on the stack, save the registers at the correct offset in the buffer.
2018-01-23 13:39:37 +01:00
Peace-Maker 1b9fa3743f Add support for custom calling convention passing arguments in registers
If the compiler decided to pass an argument in a register on an internal function instead of pushing it on the stack to save time, allow us to specify the register the parameter is going to be in.

DHookAddParam received another parameter to set the register.
2018-01-23 03:15:03 +01:00
Peace-Maker b18e3284e1 Fix overriding return value
The custom return value was lost when calling the original function.
Save and restore our own return value, if we're about to call the original function.
2016-12-13 17:45:22 -07:00
Peace-Maker 6e96e0fb84 Don't use std::list at all in DynamicHooks
Switch to amtl Vector.
2016-12-13 17:37:12 -07:00
Peace-Maker 63ccb7448f Cleanup detour structures properly on unload 2016-12-11 22:18:53 -07:00
Peace-Maker 2e52ab24b7 First draft of dynamic detours using Ayuto's DynamicHooks library
https://github.com/Ayuto/DynamicHooks
2016-12-11 22:02:10 -07:00