From 16a8b1508608ef32d1441b4c4efcc20881ac74c0 Mon Sep 17 00:00:00 2001 From: Silent Date: Sun, 22 Apr 2018 00:18:12 +0200 Subject: [PATCH] Removed nasty ReadCall hacks --- SilentPatch/Common.cpp | 4 +--- SilentPatchSA/SilentPatchSA.cpp | 15 ++++----------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/SilentPatch/Common.cpp b/SilentPatch/Common.cpp index 2341583..ed34edd 100644 --- a/SilentPatch/Common.cpp +++ b/SilentPatch/Common.cpp @@ -15,9 +15,7 @@ namespace Common { { auto addr = get_pattern( "83 3C 33 00 74 19 89 F9 E8", 8 ); - void* pRestoreCar; - ReadCall( addr, pRestoreCar ); - CStoredCar::orgRestoreCar = *(decltype(CStoredCar::orgRestoreCar)*)&pRestoreCar; + ReadCall( addr, CStoredCar::orgRestoreCar ); InjectHook( addr, &CStoredCar::RestoreCar_SilentPatch ); } } diff --git a/SilentPatchSA/SilentPatchSA.cpp b/SilentPatchSA/SilentPatchSA.cpp index 2248d70..d7b829b 100644 --- a/SilentPatchSA/SilentPatchSA.cpp +++ b/SilentPatchSA/SilentPatchSA.cpp @@ -3514,9 +3514,7 @@ void Patch_SA_10() // Fixed bomb ownership/bombs saving for bikes { - void* pRestoreCar; - ReadCall( 0x44856A, pRestoreCar ); - CStoredCar::orgRestoreCar = *(decltype(CStoredCar::orgRestoreCar)*)&pRestoreCar; + ReadCall( 0x44856A, CStoredCar::orgRestoreCar ); InjectHook( 0x44856A, &CStoredCar::RestoreCar_SilentPatch ); InjectHook( 0x4485DB, &CStoredCar::RestoreCar_SilentPatch ); } @@ -3550,9 +3548,7 @@ void Patch_SA_10() // Fixed ammo from SCM { - void* pGiveWeapon; - ReadCall( 0x47D335, pGiveWeapon ); - CPed::orgGiveWeapon = *(decltype(CPed::orgGiveWeapon)*)&pGiveWeapon; + ReadCall( 0x47D335, CPed::orgGiveWeapon ); InjectHook( 0x47D335, &CPed::GiveWeapon_SP ); } @@ -3565,13 +3561,10 @@ void Patch_SA_10() InjectHook( 0x53A986, GetVehicleDriver ); InjectHook( 0x53A9A9, GetVehicleDriver ); - void* func; - ReadCall( 0x53A990, func ); - CPlayerPed::orgDoStuffToGoOnFire = *(decltype(CPlayerPed::orgDoStuffToGoOnFire)*)&func; + ReadCall( 0x53A990, CPlayerPed::orgDoStuffToGoOnFire ); InjectHook( 0x53A990, DoStuffToGoOnFire_NullAndPlayerCheck ); - ReadCall( 0x53A9B7, func ); - CFireManager::orgStartFire = *(decltype(CFireManager::orgStartFire)*)&func; + ReadCall( 0x53A9B7, CFireManager::orgStartFire ); InjectHook( 0x53A9B7, &CFireManager::StartFire_NullEntityCheck ); }