mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-28 23:03:01 +05:00
Fixed ammo granting from SCM - III/VC
This commit is contained in:
parent
916c82b5a4
commit
4653e4f00c
2 changed files with 36 additions and 0 deletions
|
@ -354,6 +354,13 @@ void __declspec(naked) AutoPilotTimerFix_III()
|
|||
}
|
||||
}
|
||||
|
||||
static void (__thiscall *orgGiveWeapon)( void* ped, unsigned int weapon, unsigned int ammo );
|
||||
static void __fastcall GiveWeapon_SP( void* ped, void*, unsigned int weapon, unsigned int ammo )
|
||||
{
|
||||
if ( ammo == 0 ) ammo = 1;
|
||||
orgGiveWeapon( ped, weapon, ammo );
|
||||
}
|
||||
|
||||
void Patch_III_10(const RECT& desktop)
|
||||
{
|
||||
using namespace Memory;
|
||||
|
@ -841,6 +848,17 @@ void Patch_III_Common()
|
|||
Patch<uint8_t>( do_processing.get<uint8_t*>(1), 0xBF ); // movzx eax, word ptr [ebx+28h] -> movsx eax, word ptr [ebx+28h]
|
||||
Patch<uint8_t>( do_processing.get<uint8_t*>(7), 0x74 ); // jge -> jz
|
||||
}
|
||||
|
||||
|
||||
// Fixed ammo from SCM
|
||||
{
|
||||
auto give_weapon = get_pattern( "6B C0 4F 51 8B 34", 0x13 );
|
||||
ReadCall( give_weapon, orgGiveWeapon );
|
||||
InjectHook( give_weapon, GiveWeapon_SP );
|
||||
|
||||
give_weapon = get_pattern( "89 C7 A1 ? ? ? ? 55 89 F9 50", 11 );
|
||||
InjectHook( give_weapon, GiveWeapon_SP );
|
||||
}
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
|
|
|
@ -219,6 +219,13 @@ void __declspec(naked) AutoPilotTimerFix_VC()
|
|||
}
|
||||
}
|
||||
|
||||
static void (__thiscall *orgGiveWeapon)( void* ped, unsigned int weapon, unsigned int ammo, bool flag );
|
||||
static void __fastcall GiveWeapon_SP( void* ped, void*, unsigned int weapon, unsigned int ammo, bool flag )
|
||||
{
|
||||
if ( ammo == 0 ) ammo = 1;
|
||||
orgGiveWeapon( ped, weapon, ammo, flag );
|
||||
}
|
||||
|
||||
void Patch_VC_10(const RECT& desktop)
|
||||
{
|
||||
using namespace Memory;
|
||||
|
@ -654,6 +661,17 @@ void Patch_VC_Common()
|
|||
Patch<uint8_t>( do_processing.get<uint8_t*>(7), 0x74 ); // jge -> jz
|
||||
}
|
||||
|
||||
|
||||
// Fixed ammo from SCM
|
||||
{
|
||||
auto give_weapon = get_pattern( "6B C0 2E 6A 01 56 8B 3C", 0x15 );
|
||||
ReadCall( give_weapon, orgGiveWeapon );
|
||||
InjectHook( give_weapon, GiveWeapon_SP );
|
||||
|
||||
give_weapon = get_pattern( "89 F9 6A 01 55 50 E8", 6 );
|
||||
InjectHook( give_weapon, GiveWeapon_SP );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
|
|
Loading…
Reference in a new issue