rehlds
rehlds copied to clipboard
`API`: Implement `*_Precache_*`, `ClientPrintf`, `CheckUserInfo` and `AddResource` hooks
- [x] PF_precache_generic_I
- [x] PF_precache_model_I
- [x] PF_precache_sound_I
- [x] SV_CheckUserInfo
- [x] SV_AddResource
- [x] EV_Precache
- [x] SV_ClientPrintf
Resource hooks related to #248
SV_CheckUserInfo
#238
SV_ClientPrintf
#903
If the reviewer wants, he could merge this pull and close https://github.com/dreamstalker/rehlds/pull/900, because it contains it.
I remember tried memhack hook those functions, & one of them was "fucked up under ReHLDS", as usual with it, unfortunately... So it is a safe & welcomed PR.
Well, the fact you implemented "SV_CheckUserInfo" inside this PR, and the other fact this PR contains multiple hooks, I think you can close your other one for simplicity. But add you added it too, in the description. Also, in order to have something "almost complete about precaching stuff", it will be nice if you could also add "EV_Precache" (precache_event) & "SV_AddResource" to your PR. Thanks in advance!
EDIT: Also, think to update "API minor" (+1) in the two files ("version.h" & "rehlds_api.h").
Nice! Now I think we could submit other hooks requests to it! Hehehe! Let's hope approvers will not be in panic! Even if I think it is simpler to have all-in-one.
Without abusing, I am thinking of "SV_ClientPrintf" (similar to "Con_Printf", but send to client [like when you type in-game some commands as "status", this uses this one], so very useful, you can put it in top of the list below "its friend"!), "Sys_Error" & "Host_Error" too (useful to prevent server crash on an error which may not be "critical for it", or, if we use an internal code to fix, as example I have a map where I have a "Bad surface extents ..." error shit, so I could not run it, then I blocked the function, map runs fine & I did not constated third-party troubles!). There are other functions, but as I said, I do not want to abuse with your time & devotion!
I guess you could rename the PR into "Implemented more hooks"! With such listing!
PS: I do not recommend to make the functions from the structure "RehldsFuncs_t" (g_RehldsApiFuncs) point to another "redirected function" (like now "SV_AddResource_api"), except if there is a conflit somewhere while compiling, or, if you add additionnal code inside that famous "_api" function. Mainly due to the fact we loose the possibility to get the address of the "real function", via this structure (& by using "g_RehldsApiFuncs" as base address).
Without abusing, I am thinking of "SV_ClientPrintf" (similar to "Con_Printf", but send to client [like when you type in-game some commands as "status", this uses this one], so very useful, you can put it in top of the list below "its friend"!), "Sys_Error" & "Host_Error" too (useful to prevent server crash on an error which may not be "critical for it", or, if we use an internal code to fix, as example I have a map where I have a "Bad surface extents ..." error shit, so I could not run it, then I blocked the function, map runs fine & I did not constated third-party troubles!). There are other functions, but as I said, I do not want to abuse with your time & devotion!
I will implement "SV_ClientPrintf" in another PR, because it's more cleaner. About "Sys_Error" and "Host_Error" they are crashing the server or client before bad things happen. They should NOT be blocked with a reason.
I guess you could rename the PR into "Implemented more hooks"! With such listing!
How I said, I will implement rest of chains in another PRs. This PR should've been dedicated only to precache resources hooks, but I merged "SV_CheckUserInfo" into my master branch and SV_AddResource could be assimilated with resources.
PS: I do not recommend to make the functions from the structure "RehldsFuncs_t" (g_RehldsApiFuncs) point to another "redirected function" (like now "SV_AddResource_api"), except if there is a conflit somewhere while compiling, or, if you add additionnal code inside that famous "_api" function. Mainly due to the fact we loose the possibility to get the address of the "real function", via this structure (& by using "g_RehldsApiFuncs" as base address).
Thank you for your recommendation. Finished the implementation. It can be downloaded from my rehlds's fork ( Actions tab: https://github.com/ShadowsAdi/rehlds/actions/runs/1938126909 )
You can rename your PR into "Implemented more useful hooks.", something like, only your branch name "precache-hooks" can be confusing, but that's just a branch name (changing things in the working progress happens...), the approver will edit the title in the comit when he will merge & people may not pay much attention to your branch name by reading the commit's details, besides this does not matter much. Since there is "SV_CheckUserInfo" which is "out of precache context", I think "SV_ClientPrintf" could also been added, and in the top, to be with his friend "ConPrintf"! Hehehe! After all, you added a bunch of hooks, what is one more for you? Hihi!
The errors functions are for "critical" stuff, as you said, but a few of them are not much very critical (some are just here to tell you passed a bad parameter, as example), & you can prevent server crash without generating third-party issues, or, use a specific code from the related message, to fix the issue (by hooking the functions where the error is called, catch it, prevent server crash, then apply your "fix"). But those functions are not as much important as the ones you added, and we can "live without", just welcomed if we have them among hooks listing.
I hope approvers will not let that pending for months... How people can keep motivation to contribute & submit PRs when it ends like that?
Good work!
Implement SV_ClientPrintf
hook
please do not refactor along with the implementation of the new functionality.
remove all refactoring from this PR please
Everything should be alright now, @wopox1337
Any news ? 👀
Nice feature, please merge it! :)
Any news ? 👀
Nice feature, please merge it! :)
Yes, nice feature. But corpses everywhere nowadays! All fucking dead! Disappointing huh! Population in the world keeps increasing, but it seems Aliens have kidnapped a lot of people to bring them "we do not know where"!
Yes, nice feature. But corpses everywhere nowadays! All fucking dead! Disappointing huh! Population in the world keeps increasing, but it seems Aliens have kidnapped a lot of people to bring them "we do not know where"!
Where place did you escape from?
I am one of the aliens (other group of aliens), I can not reveal secret defense information about possible location of others aliens lab!