So here is an easy way to do no recoil and no spread with absolutely no reversing of classes.
Make your type definition:
PHP Code:
typedef const void * ( __fastcall* tGetRecoil )( void *thisptr, void *unknown, void *a2, char a3 );
const void* __fastcall hkGetRecoil( void *thisptr, void *unknown, void *a2, char a3 );
tGetRecoil oGetRecoil = NULL;
Do hook
.................................................. .................................................. .................................................. ...
PHP Code:
//I'm lazy, so this is an easy way to backup the function
oGetRecoil = (tGetRecoil)DetourFunction( (BYTE*)0x0077B350, (BYTE*)&hkGetRecoil );
//Retour so you won't get kicked (just copies over 6 bytes)
memcpy_safe_retour( (BYTE *)0x0077B350, (BYTE *)"\x55\x8B\xEC\x83\xE4\xF0" );
//Hook here (copies 4 bytes -> address off hkGetRecoil)
memcpy_safe_dword( (BYTE *)0x2096D54, (BYTE *)hkGetRecoil );
To explain the above code, DetourFunction will back up all the bytes for you, so you can call the original function.
However, detours will overwrite the first 6 bytes and PB will kick you for corrupted memory.
To avoid that, we retour, (put in the original 6 bytes)
Then we can hook in another spot, where PB doesn't scan.
.................................................. .................................................. ........................
PHP Code:
const void* __fastcall hkGetRecoil( void *thisptr, void *unknown, void *a2, char a3 )
{
__asm pushad;
//just an example, the class is exactly the same as in the PDB no reversing equired
//thisptr = fb::GunSway
//if you have class from my other post you can type cast it
//fb::GunSway* gunSway = (fb::GunSway *)thisptr;
DWORD fb__gunSway = (DWORD )thisptr;
*( float *)( fb__gunSway + 0xAC ) = 0.0f; //m_DeviationPitch
*( float *)( fb__gunSway + 0xB0 ) = 0.0f; //m_DeviationYaw
*( float *)( fb__gunSway + 0xB4 ) = 0.0f; //m_DeviationRoll
*( float *)( fb__gunSway + 0xB8 ) = 0.0f; //m_DeviationTransY
*( float *)( fb__gunSway + 0x120 ) = 0.0f; //m_dispersionAngle
*( float *)( fb__gunSway + 0x124 ) = 0.0f; //m_DeviationPitch
*( float *)( fb__gunSway + 0x13C ) = 0.00001f; //m_currentGameplayDeviationScaleFactor
*( float *)( fb__gunSway + 0x140 ) = 0.00001f; //m_currentVisualDeviationScaleFactor
*( float *)( fb__gunSway + 0x15C ) = 0.00001f; //m_randomAngle
*( float *)( fb__gunSway + 0x160 ) = 0.00001f; //m_randomRadius
__asm popad;
return oGetRecoil( thisptr, unknown, a2, a3 );
}
Set a virtual hook on WeaponSway::Update for the win.
cpp:
void __fastcall Hooked_Update( PVOID ThisPtr, int EDX, float deltaTime, fb::WeaponSway::SoldierAttributesCallback* soldierAttributesCallback )
{
gAccuracy.ClearDeviation( ThisPtr );
}
Do not ask how to use it, its usefull only for coders(credit´s to Shrooms Hook) i forgot it... but i made some changes... hope you like it
)






(credit´s to Shrooms Hook) i forgot it... but i made some changes... hope you like it
)
Reply With Quote
endeavor Game
Epic War 4 Game
Crystal Story Game
Haunt the House Game
Colour My Fate Game
LARRY: Pup Run Game
Demolition City Game
Sushi Cat Game
Cursed Treasure Game
Manhattan Project Game


















