I hook a custom virtual function in two extensions:
CBaseEntity* CreateEntityByName(const char * className);
So that control is passed to B function of extension B, then to A from extension A then back to the original CreateEntityByName. It works fine if I use RETURN_META_VALUE_MNEWPARAMS in both A and B. I get this sequence:
O -> B -> A -> CreateEntityByName -> back to O
But I need to know the result CBaseEntity pointer in both A and B. So I replace the RETURN_META_VALUE_MNEWPARAMS with:
SH_CALL and RETURN_META_VALUE(MRES_SUPERCEDE , false);
The problem here is that SH_CALL bypasses both hooks and the original CreateEntityByName is called twice, so 2 entities are created. I get this sequence:
O -> B, SH_CALL-> CreateEntityByName -> back to B -> A, SH_CALL-> CreateEntityByName -> back to A -> back to O
Is there a way to bypass only current hook to get correct sequence?
O -> B, SH_CALL-> A, SH_CALL-> CreateEntityByName -> back to A -> back to B -> back to O