bool isReady = false;
typedef struct
{
BYTE Data[0x3000];
} WeaponMgrCopy;
WeaponMgrCopy* Weapons[3300];
void backup(DWORD CShell, DWORD WeaponMgr)
{
DWORD pWeaponMgr = *(DWORD*)(CShell + WeaponMgr);
for (int i = 0; i <= 3300; i++)
{
DWORD Weapon = (*(DWORD*)(pWeaponMgr + (4 * i)));
if (Weapon != NULL)
{
Weapons[i] = new WeaponMgrCopy;
memcpy(Weapons[i], (void*)(Weapon), 0x1400);
}
}
}
WeaponMgrCopy* bypass(int GunIndexNR)
{
return Weapons[GunIndexNR];
}
void MakeCall(BYTE* paddress, DWORD yourfunction, DWORD dwlen)
{
DWORD dwOldProtect, dwBkup, dwRelAddr;
VirtualProtect(paddress, dwlen, PAGE_EXECUTE_READWRITE, &dwOldProtect);
dwRelAddr = (DWORD)(yourfunction - (DWORD)paddress) - 5;
*paddress = 0xE8;
*((DWORD*)(paddress + 0x1)) = dwRelAddr;
for (DWORD x = 0x5; x < dwlen; x++) *(paddress + x) = 0x90;
VirtualProtect(paddress, dwlen, dwOldProtect, &dwBkup);
return;
}
void WeaponCheats()
{
DWORD CShell = (DWORD)GetModuleHandleA("CShell.dll");
DWORD WeaponMgr = *(DWORD*)(CShell + o_weaponMgr);
if (isReady == false)
{
backup(CShell, WeaponMgr);
if (*(BYTE*)(CShell + 0x7BC475)) // - Update This
{
MakeCall((BYTE*)(CShell + 0x7BC475), (DWORD)bypass, 5); // - Update This
isReady = true;
}
}
if (isReady)
{
if (WeaponMgr)
{
for (int i = 0; i < 3300; i++)
{
DWORD Weapon = *(DWORD *)(WeaponMgr + (4 * i));
if (Weapon != 0)
{
*(float *)(Weapon + 0x1320) = 999.0F;
*(float *)(Weapon + 0x1324) = 999.0F;
}
}
}
}
}