Peace-Maker
50390f48e7
Fix defining virtual hooks in gamedata "Functions" section #1
...
The "offset" key wasn't included in the validation of having the target function set.
2018-05-20 10:48:56 +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
30fc311738
Fix linux build
2018-04-22 15:56:40 +02:00
Peace-Maker
5fce3e6c66
Bump version
2018-04-22 15:49:49 +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
2df53be4a5
Fix signed - unsigned comparison warning
2018-04-21 13:41:50 +02:00
Peace-Maker
3e2471f93a
Fix saving arguments in wrong order when parsing "Functions" section in gamedata
...
ke::HashMap doesn't keep the order the elements are added of course. Switch to a vector structure instead.
2018-04-21 11:50:07 +02:00
Peace-Maker
d9778021c7
Ignore build directory in .hgignore
2018-04-21 11:02:56 +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
dc12453b02
Fix build against SourceMod 1.9
2018-04-21 10:16:20 +02:00
Peace-Maker
c6266bfcf3
Remove optional callback parameter from DHookCreateFromConf
...
Encourage passing the callback when hooking instead of when setting the hook up.
2018-04-21 09:43:53 +02:00
Peace-Maker
556290e088
Fix typos in "Functions" section parsing
...
Some registers were upper case and HookParamType_CBaseEntity didn't follow the naming scheme of the other types.
2018-04-21 09:40:17 +02:00
Peace-Maker
294d5d4495
Update version to track detour support
2018-04-19 02:14:02 +02:00
Peace-Maker
43f275889e
Merge upstream master
2018-04-19 02:09:01 +02:00
Peace-Maker
274758c4ff
Fix not using passed alignment value for argument sizes
2018-04-18 00:58:56 +02:00
Peace-Maker
b16d1f9f3f
Fix crash when accessing invalid argument index
...
Just return null if a user tries to access an invalid argument that wasn't defined when detouring the function.
2018-04-18 00:57:58 +02:00
Peace-Maker
9bbca712b6
Fix detouring |thiscall| on linux
...
The this-pointer is always pushed first on the stack.
2018-04-18 00:50:26 +02:00
Peace-Maker
cd5b306d48
Fix linux build with clang
2018-04-18 00:47:45 +02:00
Drifter
ca920d2d96
Update version.
2018-01-30 10:09:57 -05:00
Drifter
67b3b54ae1
Fix crash
2018-01-29 12:36:43 -05:00
Drifter
17332379cb
Update documentation.
2018-01-29 12:36:26 -05: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
Drifter
16aa7900e0
Update version
2018-01-27 10:08:56 -05:00
Drifter
cd55a5026e
Add support for setting callback when hooking instead of on create only.
2018-01-27 10:08:44 -05:00
Drifter
b14f62435c
Update test gamedata.
2018-01-27 10:08:03 -05:00
Peace-Maker
aa3018a27d
Add support to define function signatures in gamedata
...
A "Functions" section is parsed in gamedata files that allow you to define the signature of functions including metadata like the calling convention and specifying the register an argument is passed in.
A new native DHookCreateFromConf can be used to setup a hook or detour from one of that function sections in the "Functions" section.
2018-01-25 17:18:30 +01:00
Peace-Maker
e2d71bae03
Mark new natives as optional if extension is optional
2018-01-23 14:58:09 +01:00
Peace-Maker
1ef64c56b5
Document the new natives in the include file
2018-01-23 14:01:41 +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
38aca973db
Update visual studio project files
2018-01-23 12:19:51 +01:00
Peace-Maker
94181be280
Fix assert when the pre-hook was fired, but the post hook was skipped
...
The post hook would have cleared the esp value from the return address map, but there seems to be a case where the post hook isn't called, but the function gets called with the same esp again. This is probably just masking a different error :(
2018-01-23 03:16:46 +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
5d21350e9e
Fix not clearing return address cache after use
...
The esp pointer wasn't removed from the map after the function was called and the original return address was retrieved.
If the same function was called again with the same esp this would fail due to there already being an (old) return address associated with the esp.
2018-01-22 00:11:28 +01:00
Peace-Maker
b6382f1c27
Fix compilation
2018-01-21 13:48:50 +01:00
Drifter
2591478ead
Update version
2016-12-20 09:48:44 -05:00
Drifter
a26316ba68
Fix not ending context.
2016-12-20 09:48:26 -05:00
Peace-Maker
8221a6522b
Save this pointer on windows after calling original function
...
ecx might get cleared before the original function returns leading to garbage in the post handler.
2016-12-13 17:47:59 -07: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
c70d3b9ee0
Use AMTL instead of the stdlib in DynamicHooks
2016-12-13 00:34:28 -07:00
Peace-Maker
8ab9c14e93
Add detour test plugin
2016-12-12 22:48:40 -07:00
Peace-Maker
63c6addc30
Fix new - free mismatch
2016-12-12 22:47:35 -07:00
Peace-Maker
764b325a1e
Switch to sp::MacroAssembler instead of AsmJit
2016-12-12 22:18:43 -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
Drifter
d506ce912e
Make sure hooks are entity hooks before removing.
2016-12-09 08:22:09 -05:00
Dr!fter
fd8866a540
Update AMBuildScript
2016-08-31 11:46:25 -04:00
Dr!fter
2b3368e0c0
Update vcxproj.
2016-08-31 11:46:14 -04:00