Possible samp fix

This commit is contained in:
Silent 2014-06-29 22:27:45 +02:00
parent d28ad95d5c
commit 1e6d0ce958

View file

@ -2103,6 +2103,9 @@ BOOL InjectDelayedPatches_10()
return TRUE; return TRUE;
} }
bool bHasImVehFt = GetModuleHandle("ImVehFt.asi") != nullptr;
bool bSAMP = GetModuleHandle("samp") != nullptr;
bUseTwoPass = GetPrivateProfileIntW(L"SilentPatch", L"TwoPassRendering", FALSE, wcModulePath) != FALSE; bUseTwoPass = GetPrivateProfileIntW(L"SilentPatch", L"TwoPassRendering", FALSE, wcModulePath) != FALSE;
if ( bUseTwoPass ) if ( bUseTwoPass )
@ -2126,7 +2129,7 @@ BOOL InjectDelayedPatches_10()
InjectHook(0x464BC0, StartNewMission_BasketballFix, PATCH_JUMP); 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! // Shaders!
InjectHook(0x5DA743, SetShader); InjectHook(0x5DA743, SetShader);
@ -2191,7 +2194,7 @@ BOOL InjectDelayedPatches_10()
} }
// ImVehFt conflicts // ImVehFt conflicts
if ( GetModuleHandle("ImVehFt.asi") == nullptr ) if ( !bHasImVehFt )
{ {
// Lights // Lights
InjectHook(0x4C830C, LightMaterialsFix, PATCH_CALL); InjectHook(0x4C830C, LightMaterialsFix, PATCH_CALL);
@ -2206,6 +2209,26 @@ BOOL InjectDelayedPatches_10()
Patch<DWORD>(0x5D5DC2, 32); // 1.0 ONLY Patch<DWORD>(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<const void*>(&pVMT[7], pFunc);
Patch<BYTE>(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 FALSE;
} }
return TRUE; return TRUE;
@ -2379,23 +2402,6 @@ __forceinline void Patch_SA_10()
// Zones fix // Zones fix
InjectHook(0x572130, GetCurrentZoneLockedOrUnlocked, PATCH_JUMP); InjectHook(0x572130, GetCurrentZoneLockedOrUnlocked, PATCH_JUMP);
// Properly random numberplates
DWORD* pVMT = *(DWORD**)0x4C75FC;
void* pFunc;
_asm
{
mov eax, offset CVehicleModelInfo::Shutdown
mov [pFunc], eax
}
Patch<const void*>(&pVMT[7], pFunc);
Patch<BYTE>(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 // Fixed police scanner names
char* pScannerNames = *(char**)0x4E72D4; char* pScannerNames = *(char**)0x4E72D4;
strncpy(pScannerNames + (8*113), "WESTP", 8); strncpy(pScannerNames + (8*113), "WESTP", 8);