From 1e6d0ce9581341a4c806512b547031dceaf0f489 Mon Sep 17 00:00:00 2001 From: Silent Date: Sun, 29 Jun 2014 22:27:45 +0200 Subject: [PATCH] Possible samp fix --- SilentPatch/dllmain.cpp | 44 +++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/SilentPatch/dllmain.cpp b/SilentPatch/dllmain.cpp index 6d5f5d2..d0d08eb 100644 --- a/SilentPatch/dllmain.cpp +++ b/SilentPatch/dllmain.cpp @@ -2103,6 +2103,9 @@ BOOL InjectDelayedPatches_10() return TRUE; } + bool bHasImVehFt = GetModuleHandle("ImVehFt.asi") != nullptr; + bool bSAMP = GetModuleHandle("samp") != nullptr; + bUseTwoPass = GetPrivateProfileIntW(L"SilentPatch", L"TwoPassRendering", FALSE, wcModulePath) != FALSE; if ( bUseTwoPass ) @@ -2126,7 +2129,7 @@ BOOL InjectDelayedPatches_10() InjectHook(0x464BC0, StartNewMission_BasketballFix, PATCH_JUMP); } - if ( GetPrivateProfileIntW(L"SilentPatch", L"NVCShader", TRUE, wcModulePath) != FALSE ) + if ( !bSAMP && GetPrivateProfileIntW(L"SilentPatch", L"NVCShader", TRUE, wcModulePath) != FALSE ) { // Shaders! InjectHook(0x5DA743, SetShader); @@ -2191,7 +2194,7 @@ BOOL InjectDelayedPatches_10() } // ImVehFt conflicts - if ( GetModuleHandle("ImVehFt.asi") == nullptr ) + if ( !bHasImVehFt ) { // Lights InjectHook(0x4C830C, LightMaterialsFix, PATCH_CALL); @@ -2206,6 +2209,26 @@ BOOL InjectDelayedPatches_10() Patch(0x5D5DC2, 32); // 1.0 ONLY } + if ( !bHasImVehFt && !bSAMP ) + { + // Properly random numberplates + DWORD* pVMT = *(DWORD**)0x4C75FC; + void* pFunc; + _asm + { + mov eax, offset CVehicleModelInfo::Shutdown + mov [pFunc], eax + } + Patch(&pVMT[7], pFunc); + Patch(0x6D0E43, 0xEB); + InjectMethodVP(0x4C9660, CVehicleModelInfo::SetCarCustomPlate, PATCH_NOTHING); + InjectMethodVP(0x6D6A58, CVehicle::CustomCarPlate_TextureCreate, PATCH_NOTHING); + InjectMethodVP(0x6D651C, CVehicle::CustomCarPlate_BeforeRenderingStart, PATCH_NOTHING); + InjectHook(0x6FDFE0, CCustomCarPlateMgr::SetupClumpAfterVehicleUpgrade, PATCH_JUMP); + //InjectMethodVP(0x6D0E53, CVehicle::CustomCarPlate_AfterRenderingStop, PATCH_NOTHING); + Nop(0x6D6517, 2); + } + return FALSE; } return TRUE; @@ -2379,23 +2402,6 @@ __forceinline void Patch_SA_10() // Zones fix InjectHook(0x572130, GetCurrentZoneLockedOrUnlocked, PATCH_JUMP); - // Properly random numberplates - DWORD* pVMT = *(DWORD**)0x4C75FC; - void* pFunc; - _asm - { - mov eax, offset CVehicleModelInfo::Shutdown - mov [pFunc], eax - } - Patch(&pVMT[7], pFunc); - Patch(0x6D0E43, 0xEB); - InjectMethodVP(0x4C9660, CVehicleModelInfo::SetCarCustomPlate, PATCH_NOTHING); - InjectMethodVP(0x6D6A58, CVehicle::CustomCarPlate_TextureCreate, PATCH_NOTHING); - InjectMethodVP(0x6D651C, CVehicle::CustomCarPlate_BeforeRenderingStart, PATCH_NOTHING); - InjectHook(0x6FDFE0, CCustomCarPlateMgr::SetupClumpAfterVehicleUpgrade, PATCH_JUMP); - //InjectMethodVP(0x6D0E53, CVehicle::CustomCarPlate_AfterRenderingStop, PATCH_NOTHING); - Nop(0x6D6517, 2); - // Fixed police scanner names char* pScannerNames = *(char**)0x4E72D4; strncpy(pScannerNames + (8*113), "WESTP", 8);