Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Requests] New hooks to API #741

Open
ShadowsAdi opened this issue Mar 22, 2022 · 19 comments
Open

[Feature Requests] New hooks to API #741

ShadowsAdi opened this issue Mar 22, 2022 · 19 comments

Comments

@ShadowsAdi
Copy link
Contributor

Hello,

In this Issue topic, you can request any new hook you want to see implemented in the future releases.

Regards, Adi.

@ShadowsAdi ShadowsAdi changed the title [Features Requests] New hooks to API [Feature Requests] New hooks to API Mar 22, 2022
@ShadowsAdi
Copy link
Contributor Author

ShadowsAdi commented Mar 22, 2022

Hooks WIP:

  • PM_Jump
  • PM_WaterJump
  • PM_PlayWaterSounds
  • PM_Duck ( Not needed, it's called per PM_Move call )
  • PM_UnDuck
  • PM_WaterMove
  • PM_PlayStepSound
  • CBasePlayerWeapon::ItemPostFrame
  • CBasePlayerWeapon::PlayEmptySound
  • CWeaponBox::BombThink
  • CWeaponBox::Touch
  • CArmoury::ArmouryTouch
  • PM_SpectatorMove @Nord1cWarr1or
  • PM_CheckStuck
  • CREATE_NAMED_ENTITY
  • REMOVE_ENTITY
  • DispatchTouch
  • DispatchUse
  • CBaseEntity::FVisible
  • CBasePlayer::HasWeapons
  • CWeaponBox::PackWeapon
  • CWeaponBox::PackAmmo
  • CWeaponBox::Kill
  • CBasePlayer::IsArmored
  • CBasePlayer::ReloadWeapons
  • CBasePlayer::UpdateLocation
  • CBasePlayer::ThrowWeapon
  • PM_AirAccelerate @igorkelvin
  • CBasePlayer::CheckTimeBasedDamage @RauliTop

@Lopol2010
Copy link
Contributor

Event on exit and enter from box. For example there is touch events, but not exit. Exit and enter usually implemented in plugins using think event or tasks. Not that I need it so hard, already have those in plugins. Just a good suggestion i guess.

@ShadowsAdi
Copy link
Contributor Author

Event on exit and enter from box. For example there is touch events, but not exit. Exit and enter usually implemented in plugins using think event or tasks. Not that I need it so hard, already have those in plugins. Just a good suggestion i guess.

I think you mean to a think function. It is already implemented SetThink.

@Nord1cWarr1or
Copy link
Contributor

can you also add PM_SpectatorMove hookchain?

@ShadowsAdi
Copy link
Contributor Author

can you also add PM_SpectatorMove hookchain?

Added, thank you!

@ShadowsAdi
Copy link
Contributor Author

@StevenKal
Copy link
Contributor

StevenKal commented Mar 25, 2022

Event on exit and enter from box. For example there is touch events, but not exit. Exit and enter usually implemented in plugins using think event or tasks. Not that I need it so hard, already have those in plugins. Just a good suggestion i guess.

I think you mean to a think function. It is already implemented SetThink.

I think he was refering to "when we get out from a touch", like, we are in a buyzone, we permanently "Touch" it, but he wants a hook to detect when we stop touching it (like once we move outside from it). But that's out of "default hooks we already have", as there is no "pfnUnTouch"!

PS:
Despite this is not a problem for that (about compatibility), please keep the order of the "typedef *" in the .h files same as for the virtual, by adding them in the end (I think wopox will ask you to do it if he saw it, so).
"PM_PlayerMove" not needed, there is already "PM_Move".
And I am not sure this really worth to add "virtual functions already hookable via a known virtual module" ("ItemPostFrame" & "PlayEmptySound"), maybe except for custom/new modules using ReGameDLL_CS's API hooks, or, tiny performance gain.
But adding more hooks is not complicated, neither long, so not much a problem after all, but I just think it is better to mainly focus on hooks we can not already have "easily" (without memory hooking).

@ShadowsAdi
Copy link
Contributor Author

Added new hooks to list

@ShadowsAdi
Copy link
Contributor Author

ShadowsAdi commented Mar 27, 2022

PS: Despite this is not a problem for that (about compatibility), please keep the order of the "typedef *" in the .h files same as for the virtual, by adding them in the end (I think wopox will ask you to do it if he saw it, so). "PM_PlayerMove" not needed, there is already "PM_Move". And I am not sure this really worth to add "virtual functions already hookable via a known virtual module" ("ItemPostFrame" & "PlayEmptySound"), maybe except for custom/new modules using ReGameDLL_CS's API hooks, or, tiny performance gain. But adding more hooks is not complicated, neither long, so not much a problem after all, but I just think it is better to mainly focus on hooks we can not already have "easily" (without memory hooking).

Agree with PM_PlayerMove, but ItemPostFrame and PlayEmptySound could help for directly calling into memory of the chain.

@StevenKal
Copy link
Contributor

StevenKal commented Mar 27, 2022

DispatchTouch & DispatchUse: No need.
CREATE_NAMED_ENTITY: Maybe except for hashtable thing detection... & "only detect pure game calls", but not much needed, we can already hook the normal "pfnCreateNamedEntity" engine function used internally by this last.
REMOVE_ENTITY: Game DLL function just points to the engine function, & we can already hook it, also, on ReHLDS, there is "ED_Free" which is able to catch "any entity removal call", so either from "pfnRemoveEntity", either when "FL_KILLME" set.
I think you should add a "line" & move your "Hooks in WIP" in your first topic, & remove your old post, will be more visible for people (just suggestion).

@ShadowsAdi
Copy link
Contributor Author

DispatchTouch & DispatchUse

Why are these hooks unnecessarily?
Also, you can contribute with new hook ideas tho.

@StevenKal
Copy link
Contributor

StevenKal commented Mar 28, 2022

About Dispatch*, I slightly mistaken, they can be useful only to detect a call from "dllfunc(DLLFunc_<Touch|Use>, ...)" or the other standalone natives (fake_touch, entity_use, force_use), since the Metamod's hooks (usable via AMX's VexdUM or AMXX's Engine/Fakemeta) will not be triggerred.
But we can "bypass" that by memhacking pfnTouch & pfnUse (people using AMXX can do it via Orpheu), or, by hooking the standalone virtual functions ("CBase*::Touch" & "CBase*::Use") the internal code of those Dispatch* is pointing (on AMXX, via Ham..), which is more "reliable", since it is the end function.
So you can still add them if you wish, but they are not really needed, even useless, knowing we can use the virtual functions, which, most of the "modern plugins" do.

About new hooks, I basically like to see new ones, more to upgrade my own module ReAPI since I have not more power for now on "that I am working", and also for distracting. But, to be honest, and, regarding that I am coding & my further plans, I do not care to see new hooks added, except when a hook is not "memhackable properly" (case for ReHLDS), but ReGameDLL_CS does not have such issue for almost all so.
And I basically started to work on my "own ReGameDLL_CS" version, a few days ago, so I am probably not gonna contribute anymore here (submitting PRs), when I see my last PR stuck from months, no.
I just like to come sometimes & contribute/suggest/help if I can, because I am usually nice & devoted, but that's all.

Maybe "CBasePlayer::IsArmored", more to be able to modify (remove) the "arms armor" to be realistic (CS has armor protection on arms while bullets-proof vests do not have). But a CVar with flags (abcdefg) for each bodypart could do the job too.

@ShadowsAdi
Copy link
Contributor Author

Edited new hooks list.

@igorkfmoura
Copy link

Could you add PM_AirAccelerate hookchain? pm_shared.cpp

Thanks in advance

@ShadowsAdi
Copy link
Contributor Author

Could you add PM_AirAccelerate hookchain? pm_shared.cpp

Thanks in advance

Added on the list, thank you!

@RauliTop
Copy link
Contributor

RauliTop commented Apr 8, 2022

@ShadowsAdi I suggest you to reorder list by alphabetical order.

Also, you can add CBasePlayer::CheckTimeBasedDamage
#749

@ShadowsAdi
Copy link
Contributor Author

CBasePlayer::CheckTimeBasedDamage

Added on list, thank you!

@StevenKal
Copy link
Contributor

CBasePlayer::ThrowWeapon: Kind of duplicate of "CBasePlayer::DropPlayerItem", & never used too, you can remove it from your list, the code itself could even be removed from the DLL.

@WaLkZa
Copy link

WaLkZa commented May 2, 2023

  • PM_Duck ( Not needed, it's called per PM_Move call )

@ShadowsAdi It will be more easy to port an existing plugin to ReAPI with PM_Duck hook.

Some examples:

Fast Duck
Prone Position
Zombie Class: Charger
Counter-Strike 1.3
Fly mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants