Commit Graph

190 Commits

Author SHA1 Message Date
BotoX
0e6936a7ee Revert "Fix crash"
This reverts commit 67b3b54ae1.
2019-09-25 18:57:27 +02:00
BotoX
100166dafa remove Werror 2019-09-21 22:16:54 +02:00
Peace-Maker
1f67ca6fa5 Bump version 2019-08-19 17:01:55 +02:00
Peace-Maker
a6b21e56fa Merge upstream master 2019-08-19 16:53:55 +02:00
Peace-Maker
5d61c92a82 Bump version 2019-08-03 18:39:03 +02:00
Peace-Maker
88451023fb Fix changing of charptr and vectorptr returns and parameters
The new buffer/vector was freed before the old function was called with the new parameters
or the return value could be used by the called. This caused undefined behavior which seemed
to be fine before, where free didn't change the user-payload. free does change the user data now,
causing the changed values to be garbage.

Wait until the next frame before deleting the newly allocated buffers/vectors, so the original code had a chance
to use the live pointers. AddFrameAction might be a bad choice if our hook happens before the game ticks, but
we can tackle that problem when it happens ;)
2019-08-03 18:26:53 +02:00
Peace-Maker
891fa5352e Add support for the "fastcall" calling convention
Callee cleans the stack and first two arguments are passed in registers ecx and edx.
You could emulate this by choosing stdcall and setting the custom_registers on the arguments manually, but this is easier.
2019-06-20 02:14:07 +02:00
Drifter
7a9e0c973d Trigger 2019-06-09 12:51:52 -04:00
Drifter
2972e0abc5 Fix incorrect casting of return 2019-05-24 05:06:33 -04:00
Peace-Maker
70eee8482a Fix compilation against SourceMod 1.10
MacroAssembler base is now in the |sp| namespace.
2019-05-06 18:29:40 +02:00
Drifter
7450244663 Trigger build 2019-04-30 04:48:58 -04:00
Drifter
442f4f608e Trigger build 2019-04-21 06:03:41 -04:00
Drifter
e54dd120bc Fix setting return vector. 2019-04-21 06:00:01 -04:00
Peace-Maker
f775e44e80 Bump version 2018-11-21 20:15:22 +01:00
Drifter
0c4ec7922f Update project file. 2018-11-15 09:54:24 -05:00
Peace-Maker
076d40510c Fix crash when trying to decode NULL this pointer
When the this pointer is set to ThisPointer_CBaseEntity and the address is null, just return INVALID_ENT_REFERENCE instead of trying to access the pointer.
2018-10-05 14:23:38 +02:00
Peace-Maker
274b4276c0 Fix crash on unaligned SSE instructions
movaps requires the memory address to be 16-byte aligned. Make sure our buffer is properly aligned for the xmm0-7 registers.
2018-10-05 14:13:12 +02:00
Peace-Maker
ef60b120cc Bump version 2018-08-28 16:55:28 +02:00
Peace-Maker
a89eb67124 Fix detour of functions returning a float
Floats are always returned in FPU register st0. Since the value in st0 doesn't matter in a pre-hook before the function was executed, don't try to save and restore the value of the FPU stack top for a pre-hook.
Only replace st0 after a post hook.
2018-08-18 12:54:30 +02:00
Peace-Maker
6a98d26307 Bump version 2018-08-08 01:14:14 +02:00
Peace-Maker
382287b86a Improve error message on bad detour argument setup 2018-08-08 01:03:06 +02:00
Peace-Maker
e0583c514b Fix adding arguments multiple times when reloading a gamedata file
If the Functions section was parsed before and the gamedata file is loaded again,
the arguments were all added again instead of keeping the old number of arguments.
2018-08-08 01:01:56 +02:00
Peace-Maker
46682568f5 Fix skipping plugin callbacks on plugin unload
When removing a plugin's callback from the list of callbacks of a detour
the next callback in the list would be skipped. Don't only check every second callback,
but every single one!
2018-08-08 00:34:41 +02:00
Peace-Maker
9c0693f425 Bump version 2018-06-06 14:47:39 +02:00
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
0d24200a49 Bump version 2018-05-20 11:01:32 +02:00
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