HelpPTC and FPS problems

Posts 115 of 24 · Page 1 of 2
PTC and FPS problems
Hello. Problem is that if i call PTC in Present i expirience a huge FPS lags. If i add a lot features my FPS becomes less than 15, but normally (without PTC but with menu and hooked dip for wallhack/chams) i have ~80-90! If i add more than 4 features game becomes unplayable.

Here is the PTC function that i use:
Code:
void PushToConsole( const char* Command )
{
    DWORD *Adress = ( DWORD* ) LTClientEXE;

    if ( *(BYTE *) GameStatus ) 
    {
        __asm
        {
            PUSHAD;
            PUSH Command
            CALL Adress
            ADD ESP, 0x4
            POPAD;
        }
    }
}
Code:
HRESULT WINAPI myPresent(LPDIRECT3DDEVICE9 pDevice, const RECT *a, const RECT *b, HWND c, const RGNDATA *d)
{
    // call menu and other shit

    if ( NxChams )
    PushToConsole("SkelModelStencil 1.0");
    else
    PushToConsole("SkelModelStencil 0.0");

    if ( Fog )
    PushToConsole("FogEnable 1.0");
    else
    PushToConsole("FogEnable 0.0");

    if ( Fullbright )
    PushToConsole("FullBright 1");
    else
    PushToConsole("FullBright 0");

    return pPresent(pDevice, a, b, c, d);
}
With this now i got ~30-35 from normally 90! Also i tried Nightmare's hotkeys base that hook Present but doesn't do any drawing on the screen and still have a performance issues. It is possible to use PTC and have a normal gameplay with the same time? Maybe it's possible to call it in another d3d function which doesn't works so slowly but doesn't have an ideas which one is better or maybe other ideas i'll be very glad if you help here a little.
if it's something like:
Code:
while(true = true){ // creates the loop of course
if ( NxChams )
    PushToConsole("SkelModelStencil 1.0");
    else
    PushToConsole("SkelModelStencil 0.0");

    if ( Fog )
    PushToConsole("FogEnable 1.0");
    else
    PushToConsole("FogEnable 0.0");

    if ( Fullbright )
    PushToConsole("FullBright 1");
    else
    PushToConsole("FullBright 0");
}
Your issue would be that it's reapplying code millions of time.

Also inside of PTC you should have
Code:
sleep(50);
Spares the cpu a bit.

Someone more experienced please correct me here if i'm wrong.
Quote Originally Posted by LilGho$t View Post
if it's something like:
Code:
while(true = true){ // creates the loop of course
if ( NxChams )
    PushToConsole("SkelModelStencil 1.0");
    else
    PushToConsole("SkelModelStencil 0.0");

    if ( Fog )
    PushToConsole("FogEnable 1.0");
    else
    PushToConsole("FogEnable 0.0");

    if ( Fullbright )
    PushToConsole("FullBright 1");
    else
    PushToConsole("FullBright 0");
}
Your issue would be that it's reapplying code millions of time.

Also inside of PTC you should have
Code:
sleep(50);
Spares the cpu a bit.

Someone more experienced please correct me here if i'm wrong.
lol, thanks for trying to help, but i call PTC inside present function and if i add while{}/sleep() game will be fucked. don't know what to do, looks like serious trouble.
Quote Originally Posted by Sneak84 View Post
lol, thanks for trying to help, but i call PTC inside present function and if i add while{}/sleep() game will be fucked. don't know what to do, looks like serious trouble.
Your console commands are being activated repeatedly, causing lag. Have it enable once when activated, not every frame. You also won't need the while(true) if it's in your present.
Quote Originally Posted by Shadow` View Post
Your console commands are being activated repeatedly, causing lag. Have it enable once when activated, not every frame. You also won't need the while(true) if it's in your present.
^ this ^
However i didn't know about it being in present xD

anyways, as a general rule of thumb (at least what i do) is:
Code:
void PushToConsole( const char* Command )
{
    DWORD *Adress = ( DWORD* ) LTClientEXE;

    if ( *(BYTE *) GameStatus ) 
    {
        __asm
        {
            PUSHAD;
            PUSH Command
            CALL Adress
            ADD ESP, 0x4
            POPAD;
            sleep(50); // spares le cpu
        }
    }
}
Quote Originally Posted by LilGho$t View Post
^ this ^
However i didn't know about it being in present xD

anyways, as a general rule of thumb (at least what i do) is:
Code:
void PushToConsole( const char* Command )
{
    DWORD *Adress = ( DWORD* ) LTClientEXE;

    if ( *(BYTE *) GameStatus ) 
    {
        __asm
        {
            PUSHAD;
            PUSH Command
            CALL Adress
            ADD ESP, 0x4
            POPAD;
            sleep(50); // spares le cpu
        }
    }
}
That will barely help, it's still rendering the ptc command every frame, just create a timer where you call the ptc hacks and you're set. Or do what @Shadow` said, enable it only once when activated.
Quote Originally Posted by arun823 View Post
That will barely help, it's still rendering the ptc command every frame, just create a timer where you call the ptc hacks and you're set. Or do what @Shadow` said, enable it only once when activated.
Issue with enabling it each time and never pushing it again is that some ptc commands (fog for example) disable themselves after a while.
Quote Originally Posted by LilGho$t View Post
Issue with enabling it each time and never pushing it again is that some ptc commands (fog for example) disable themselves after a while.
Never experienced that, then use a timer if all else fails.
Quote Originally Posted by arun823 View Post
Never experienced that, then use a timer if all else fails.
I haven't coded for ca in a few months so that might have changed but back when i was coding you occasionally had to reapply every so often.
Inc(iCounter)

if iCounter > 20000 then
begin
do your hacks
iCounter:= 0
end
Don't call Sleep in your present

It'll just make it lag more. Either call each item only once and push the command once, or just call it all in a timer.

Either of those are better.
Quote Originally Posted by Flengo View Post
Don't call Sleep in your present

It'll just make it lag more. Either call each item only once and push the command once, or just call it all in a timer.

Either of those are better.
of course you wouldn't call sleep in your present xD that'd make shit so laggy because it'd be sleeping like 50 ms, normal for maybe 3 then sleeping again. I just recommend putting sleep in the ptc method.
Quote Originally Posted by LilGho$t View Post
of course you wouldn't call sleep in your present xD that'd make shit so laggy because it'd be sleeping like 50 ms, normal for maybe 3 then sleeping again. I just recommend putting sleep in the ptc method.
Sleep in that sense will delay each frame by whatever your ms input was.
bool Hack=false;
bool bHack=false;

if( Hack && !bHack ){
CommandOn;
bHack=true;}
else if( !Hack && bHack ){
CommandOff;
bHack=false;}
i gave you then simple answer, have a counter which increases each time present is called when the counter reaches a given value then parse the hacks, also when you turn a hack on set the global counter to above given value making it parse the hacks in the next present call... couldn't be any easier... and no sleep functions ect.. I never ran any hacks in present when i was coding, I always used a separate thread ..
Posts 115 of 24 · Page 1 of 2

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?