ReGameDLL_CS icon indicating copy to clipboard operation
ReGameDLL_CS copied to clipboard

[Feature Requests] New hooks to `API`

Open ShadowsAdi opened this issue 3 years ago • 19 comments

Hello,

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

Regards, Adi.

ShadowsAdi avatar Mar 22 '22 16:03 ShadowsAdi

Hooks WIP:

  • [x] PM_Jump
  • [ ] PM_WaterJump
  • [ ] PM_PlayWaterSounds
  • [ ] PM_Duck ( Not needed, it's called per PM_Move call )
  • [x] 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

ShadowsAdi avatar Mar 22 '22 19:03 ShadowsAdi

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.

Lopol2010 avatar Mar 24 '22 21:03 Lopol2010

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.

ShadowsAdi avatar Mar 25 '22 12:03 ShadowsAdi

can you also add PM_SpectatorMove hookchain?

Nord1cWarr1or avatar Mar 25 '22 14:03 Nord1cWarr1or

can you also add PM_SpectatorMove hookchain?

Added, thank you!

ShadowsAdi avatar Mar 25 '22 14:03 ShadowsAdi

Could this be useful in any way? https://github.com/s1lentq/ReGameDLL_CS/blob/master/regamedll/pm_shared/pm_shared.cpp#L1496

ShadowsAdi avatar Mar 25 '22 14:03 ShadowsAdi

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).

StevenKal avatar Mar 25 '22 16:03 StevenKal

Added new hooks to list

ShadowsAdi avatar Mar 27 '22 09:03 ShadowsAdi

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.

ShadowsAdi avatar Mar 27 '22 09:03 ShadowsAdi

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).

StevenKal avatar Mar 27 '22 11:03 StevenKal

DispatchTouch & DispatchUse

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

ShadowsAdi avatar Mar 28 '22 12:03 ShadowsAdi

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.

StevenKal avatar Mar 28 '22 13:03 StevenKal

Edited new hooks list.

ShadowsAdi avatar Mar 28 '22 18:03 ShadowsAdi

Could you add PM_AirAccelerate hookchain? pm_shared.cpp

Thanks in advance

igorkfmoura avatar Apr 02 '22 07:04 igorkfmoura

Could you add PM_AirAccelerate hookchain? pm_shared.cpp

Thanks in advance

Added on the list, thank you!

ShadowsAdi avatar Apr 02 '22 09:04 ShadowsAdi

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

Also, you can add CBasePlayer::CheckTimeBasedDamage https://github.com/s1lentq/ReGameDLL_CS/issues/749

RauliTop avatar Apr 08 '22 18:04 RauliTop

CBasePlayer::CheckTimeBasedDamage

Added on list, thank you!

ShadowsAdi avatar Apr 19 '22 18:04 ShadowsAdi

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.

StevenKal avatar Apr 19 '22 19:04 StevenKal

  • [ ] 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

WaLkZa avatar May 02 '23 15:05 WaLkZa