PDA

View Full Version : Code Remove Dependency on CVerifiedUserCmd



Forza
01-02-2012, 08:58 PM
// Probably old news...
bool __fastcall CHook::Hooked_WriteUserCmdDeltaToBuffer( void *thisptr, int edx, bf_write *buf, int from, int to, bool isnewcommand )
{
CUserCmd nullcmd;
CUserCmd *pFrom, *pTo;

if ( from == -1 )
pFrom = &nullcmd;
else
{
pFrom = gInput->GetUserCmd( from );

if ( !pFrom )
pFrom = &nullcmd;
}

pTo = gInput->GetUserCmd( to );

if ( !pTo )
pTo = &nullcmd;

WriteUsercmd( buf, pTo, pFrom );

if ( buf->IsOverflowed() )
return false;

return true;
}

Listing
01-03-2012, 05:05 AM
Good job :), though I still like the other solution better as it potentially could even work in an external hack and is cleaner than intercepting some processing function.

v3n0m4
01-04-2012, 10:38 PM
ontopic:
op, nice way, thx for sharing.

offtopic:



http://www.youtube.com/watch?v=7_Rza7pTy-c

proclub sucks noob leetchan owns you

who is that fatty?

!Slrig
01-27-2012, 07:45 PM
bool __stdcall Hooked_WriteUserCmdDeltaToBuffer( bf_write *buf, int from, int to, bool isnewcommand )
{
WriteUsercmd( buf, g_pInput->GetUserCmd( to ), g_pInput->GetUserCmd( from ) );

if ( buf->IsOverflowed() )
return false;

return true;
}

Much cleaner and doesn't need __fastcall since you don't reference the class for anything.

_pancho
01-28-2012, 04:11 AM
It is about time one of us check out gcc and wrote our own relevant calling conventions/patches. Are we really willing to let academia hog all the glory? Step it up everyone.