Commit Graph

36 Commits

Author SHA1 Message Date
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
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
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
43f275889e Merge upstream master 2018-04-19 02:09:01 +02:00
Drifter
17332379cb Update documentation. 2018-01-29 12:36:26 -05:00
Drifter
cd55a5026e Add support for setting callback when hooking instead of on create only. 2018-01-27 10:08:44 -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
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
2e52ab24b7 First draft of dynamic detours using Ayuto's DynamicHooks library
https://github.com/Ayuto/DynamicHooks
2016-12-11 22:02:10 -07:00
Dr!fter
1fe19fc823 Remove functions now in util and fix more object related issues. 2016-08-30 16:40:24 -04:00
Dr!fter
47cf76c2e3 Fix getting and setting params after objects. 2016-08-30 10:56:56 -04:00
Dr!fter
9d09a52e99 Switch to amtl vectors. Change how hooks are checked for removal on frame action. 2016-08-27 10:20:38 -04:00
Dr!fter
bfd6abfb6c Fix setting vector returns not being marked as changed. 2016-08-01 16:35:27 -04:00
Dr!fter
f180db5427 Fix setting return value for vector pointers. 2016-08-01 16:03:18 -04:00
Dr!fter
97c3cdf304 Change Vector classname to SDKVector. 2016-06-26 13:00:27 -04:00
Dr!fter
0d3969ba55 Fix raw hooks not hooking and a bunch of other bugs with them. Fix Object vectors not being able to be set. 2015-11-13 16:26:05 -05:00
Dr!fter
9c95698c36 Fix not marking Vector params as changed. 2015-06-05 08:44:05 -04:00
Dr!fter
c04ce19b7c Fix pointer returns being incorrectly set and freed. 2015-05-14 12:03:48 -04:00
Dr!fter
709e3cd03b Fix EHANDLE natives. 2014-08-19 17:37:04 -04:00
Dr!fter
0f64a45a2b Remove the need for SDK's. Update AMBuild scripts to AMBuild2. Fix shutdown crash. Update gamedata for testing. General code fixups. 2014-08-19 13:14:48 -04:00
Dr!fter
8e4c7d7274 Remove the ability to set string_t return values. 2014-02-13 20:07:26 -05:00
Dr!fter
c7a075fd8e Add some safety for Object params. Add gamedata and test plugin! 2013-08-29 20:16:05 -04:00
Dr!fter
c3fcdbb7db More linux fixes. 2013-08-29 15:18:43 -04:00
Dr!fter
c5b8d2fecb More return struct fixes. Add Vector and Vector * return support. Change vfunc_call to use template. Update makefile 2013-08-28 14:20:20 -04:00
Dr!fter
e07e2286cb Change if to switch for ObjectString use one vec for Get/Set Object Vector 2013-08-26 22:36:57 -04:00
Dr!fter
e06b52c1ec Add more natives! Add support for reading Objects. Fix more boogs and update include 2013-08-26 22:19:05 -04:00
Dr!fter
0a051ab32e Fix string_t return hook, Fix GetHandleIfValidOrError checking only for g_HookSetupHandle 2013-08-25 22:45:42 -04:00
Dr!fter
caccb5a0ff Add natives for Vector params. Add include file with new updated natives. Moved handle check into function. 2013-08-23 14:29:01 -04:00
Dr!fter
6e40653db6 Add support for string returns (not fully tested) 2013-08-22 16:14:32 -04:00
Dr!fter
50b7eb0def Add more natives! 2013-08-22 14:55:33 -04:00
Dr!fter
6a47b6f1ef Add more natives, Fix using deprecated functions, Add support for float returns, Fix more callback return stuff. 2013-08-21 22:18:52 -04:00
Dr!fter
07f7869d10 Really fix return values now... Error out when overriding return but not given one. 2013-08-21 13:36:23 -04:00
Dr!fter
d655e31e95 Fix returns 2013-08-20 22:21:29 -04:00
Dr!fter
ae3ca716ce Update - working 2013-08-20 20:18:50 -04:00
Dr!fter
61c887f042 Update 2013-08-19 22:33:44 -04:00
Dr!fter
2f38de616e Update code add natives and listeners 2013-08-19 11:07:25 -04:00