rehlds / ReGameDLL_CS

:hammer: Reverse-engineered gamedll (CS 1.6 / CZero)
GNU General Public License v3.0
584 stars 203 forks source link

Add more hooks to the API (+ extras) #320

Open simosalis opened 6 years ago

simosalis commented 6 years ago

hello there,

Could you please add more hooks to the API. I saw a bunch of them in the list (https://github.com/s1lentq/ReGameDLL_CS/blob/master/regamedll/public/regamedll/regamedll_api.h), it's good, but the fact is, a lot of them are already hookable via Ham and other modules, so despite slight efficiency gain against virtual hooking methods (something people may don't care much nowadays), they are more useful for third-party modules as your ReAPI.

I'm thinking of the useful functions that are not hookable normaly via a memory hook module, due to some annoying compilations optimizations (for the other ones unproblematic, there is no emergency). Precisely, functions like all the C< WeaponClass >::< WeaponClass > ones like this (all in one hook with weapon entity, type and the three parameters in the format right after), the FireBullets/FireBullets3 functions, and maybe some other being useful and unhookable via a memory hook module (try to search for them yourself). Some functions like FireBullets[3] are useful and important, we can hook them in memory with a module and with the default CS binary, but not with your project. Your project is better than the original CS, but if there are lacks like this, you should provide an alternative to the coders as a fix (that I'm suggesting). Adding "more hooks" is also something that concerns ReHLDS too...

Plus, if you could add support to FL_NOTARGET & EF_NODRAW (and maybe full invisibility render modes/FX and amount) to the bots. When a player has such properties, bots (at least ennemies) can't see him.

Plus, you could also use CVar pointers on the areas that are not using this optimization. Then, link the classes not linked (LINK_ENTITY_TO_CLASS), as you did for the CCSBot. But there is normally only the "gib" one.

Plus, what is the thing (compilation option??) on ReHLDS which make the symbols research failure? (when we search for a symbol)? Is this really needed?

SmiteIsTrashBro commented 6 years ago

Although these functions (CAK47::AK47Fire for example) would be possible to "remake" in amxx itself, I accord that yes, would be just useful.

You already can hook FireBullets and FireBullets3 with ReAPI. https://github.com/s1lentq/reapi/blob/master/reapi/extra/amxmodx/scripting/include/reapi_gamedll.inc#L321

simosalis commented 6 years ago

Well, if we start blocking some code, then overwrite it when no alternative, this is gonna be a pain, not really efficient, and problematic in some situations, as with third-party plugins. The best way to do something in programming is usually the most "natural" way, that means hooking then altering some informations (parameters), for the sake of simplificity and quality.

And no, you CAN'T HOOK the FireBullets[3] functions with ReAPI, you can just CALL them. There is a difference between calling a function, and hooking/catching it! That I'm requesting!

I hope the developer(s) will have interest consider my requestS, on these "Re" projects that sounds a bit "asleep" to me from the last months... while they have good potential and there are still a lot of things that could be done.

WPMGPRoSToTeMa commented 6 years ago

@simosalis what is the purpose of hooking FireBullets? Can you provide an example?

RauliTop commented 6 years ago

@WPMGPRoSToTeMa hooking FireBullets3 to change iPenetration value.

It will be great