Raised This Month: $51 Target: $400
 12% 

ReAPI


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PartialCloning
Senior Member
Join Date: Dec 2015
Old 10-10-2016 , 14:36   ReAPI
Reply With Quote #1

Is ReAPI more efficient than other modules?

1. Is hooking player spawn through reapi better than using hamsandwich? or is setting pev vars through reapi more efficient than using fakemeta?

2. It seems like reapi is a combination of several default amx modules, but is it actually more efficient?

3. For hooks that would require orpheu in the original hlds, is it more efficient to use reapi?

4. Would Okapi if it ever gets fixed be a better alternative to both orpheu and reapi?

5.
Quote:
Originally Posted by Arkshine View Post
It might be difficult to hook this function under linux, with Orpheu and with latest HLDS version.
Because of optimization at compilation, some functions in game binary are split into two functions.
This means that the first part will be called from some specific functions and part two by another specific functions.

The original function looks like that now:

Code:
void CBasePlayer::SetAnimation(PLAYER_ANIM playerAnim)
{
    if (!pev->modelindex)
    {
        return;
    }
    
    if ((playerAnim == PLAYER_FLINCH || playerAnim == PLAYER_LARGE_FLINCH) && HasShield())
    {
        return;
    }
    
    if (!(playerAnim == PLAYER_FLINCH || playerAnim == PLAYER_LARGE_FLINCH || gpGlobals->time > m_flFlinchTime || pev->health <= 0))
    {
        return;
    }
    
    SetAnimation_part2(playerAnim);
}
Right now, SetAnimation (original function) will be called only from anything related to weapon (Reload/Fire), while SetAnimation_part2 will be called only from anything related to player (Duck/Jump/TakeDamage/Killed/PostThink).

By hooking the original function, Orpheu won't catch any player's related events.

If you want to catch all valid calls, you will need to hook SetAnimation_part2. But that the annoying part, because the way it's split, I'm not sure Orpheu will be able to hook properly, nor retrieving function arguments. You might to create a new config file in functions/ directory (not in CBasePlayer), and with such signatures for linux:
Code:
[0x55,0x57,0x56,0x89,"*",0x53,0x89,"*",0x83,"*","*",0x8B]
Config file should be likely similar to :
Code:
{
    "name"      : "SetAnimation2",
    "library"   : "mod",
    "arguments" :
    [
        {
            "type" : "CBasePlayer *"
        },
        {
            "type" : "PLAYER_ANIM"
        }
    ],
    "identifiers":
    [
        {
            "os"    : "linux",
            "mod"   : "cstrike",
            "value" : [0x55,0x57,0x56,0x89,"*",0x53,0x89,"*",0x83,"*","*",0x8B]
        }
    ]
}
No idea. Give a try.
5-2. Reapi has a forward for that function, how is it able to hook it when it seems it's not possible to properly hook it with Orpheu?

6. Would Okapi work in the sameway between hlds and rehlds?
PartialCloning is offline
safetymoose
Senior Member
Join Date: Feb 2015
Old 10-10-2016 , 14:56   Re: ReAPI
Reply With Quote #2

ReHLDS and ReGameDLL_CS are some of the best things that could possibly happen to GoldSource. ReAPI is an amx module that gives you access to the functions and features within ReHLDS and ReGameDLL_CS. I cant really compare ReAPI to orpheu as ReAPI uses functions directly from ReHLDS or the game dll(it should be faster), while orpheu works with memory patching. But if you're already using ReHLDS then it would definitely be better to use ReAPI.

Orpheu is incompatible with ReHLDS, but you can use RePatcher to do the same memory patching as orpheu.

ReAPI should be faster and more efficient than fakemeta, i dont know about hamsandwich tho, people have said that ReAPI still didnt have the full functionality of hamsandwich. But if you're switched to ReHLDS, then ReAPI is the way to go
safetymoose is offline
Mistrick
Senior Member
Join Date: Aug 2012
Location: Russia
Old 10-10-2016 , 15:47   Re: ReAPI
Reply With Quote #3

1. [s/g]et_entvar() faster than fm ~50%
2. In future reapi should replace cstrike and some func will be identical to other modules
3. Forgot about mem hook/patch with sources. You can ask developer to do hook in API.
4. 3
5. 3
6. 3
Mistrick is offline
Asmodai
New Member
Join Date: May 2011
Old 10-11-2016 , 20:22   Re: ReAPI
Reply With Quote #4

1) Reapi hookchains are much faster than hamsandwich hooks. Hamsandwich uses a very complicated and slow way of arguments passing. Entity variables setting are also faster but not so significantly.
2) Yes, but it's not full replacement of all other modules. The main purpose of Reapi is to replace modules that using hacks to access certain features of engine and gamedll. It's orpheu, okapi, cstrike, hamsandwich and some others.
3,4) No, these modules aren't efficient.
5) Use Reapi:
Code:
#include <amxmodx> 
#include <reapi> 

public plugin_init() 
{ 
    RegisterHookChain(RG_CBasePlayer_SetAnimation, "CBasePlayer_SetAnimation"); 
} 

public CBasePlayer_SetAnimation(const this, PLAYER_ANIM:playerAnim)
{ 

}
5-2) Reapi uses ReGameDll API integrated to the gamedll sourcecode, so Reapi hookchains will always work correctly regardless of compiler optimizations.
6) No, Okapi isn't capable to correctly hook rehlds functions.

Last edited by Asmodai; 10-11-2016 at 20:46.
Asmodai is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:57.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode