From 675c2d114b33db1d9f4e7f75d5a1590ec69c997f Mon Sep 17 00:00:00 2001 From: Silent Date: Mon, 23 Jun 2014 15:08:48 +0200 Subject: [PATCH] Numberplates code optimised --- SilentPatch/Vehicle.cpp | 20 ++++++++++---------- SilentPatch/Vehicle.h | 2 +- SilentPatch/dllmain.cpp | 3 ++- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/SilentPatch/Vehicle.cpp b/SilentPatch/Vehicle.cpp index 29890d2..316e975 100644 --- a/SilentPatch/Vehicle.cpp +++ b/SilentPatch/Vehicle.cpp @@ -44,7 +44,7 @@ bool CVehicle::CustomCarPlate_TextureCreate(CVehicleModelInfo* pModelInfo) return true; } -static RwTexture* pPushedTextures[NUM_MAX_PLATES]; +//static RwTexture* pPushedTextures[NUM_MAX_PLATES]; void CVehicle::CustomCarPlate_BeforeRenderingStart(CVehicleModelInfo* pModelInfo) { @@ -52,10 +52,10 @@ void CVehicle::CustomCarPlate_BeforeRenderingStart(CVehicleModelInfo* pModelInfo { if ( pModelInfo->m_apPlateMaterials[i] ) { - RwTexture* pPlateTex = RpMaterialGetTexture(pModelInfo->m_apPlateMaterials[i]); + //RwTexture* pPlateTex = RpMaterialGetTexture(pModelInfo->m_apPlateMaterials[i]); - RwTextureAddRef(pPlateTex); - pPushedTextures[i] = pPlateTex; + //RwTextureAddRef(pPlateTex); + //pPushedTextures[i] = pPlateTex; RpMaterialSetTexture(pModelInfo->m_apPlateMaterials[i], PlateTexture); } @@ -71,8 +71,8 @@ void CVehicle::CustomCarPlate_BeforeRenderingStart(CVehicleModelInfo* pModelInfo } } - -void CVehicle::CustomCarPlate_AfterRenderingStop(CVehicleModelInfo* pModelInfo) +// This is not needed +/*void CVehicle::CustomCarPlate_AfterRenderingStop(CVehicleModelInfo* pModelInfo) { for ( int i = 0; i < NUM_MAX_PLATES; i++ ) { @@ -83,13 +83,13 @@ void CVehicle::CustomCarPlate_AfterRenderingStop(CVehicleModelInfo* pModelInfo) //RwTextureAddRef(pPlateTex); //pPushedTextures[i] = pPlateTex; - RpMaterialSetTexture(pModelInfo->m_apPlateMaterials[i], pPushedTextures[i]); - RwTextureDestroy(pPushedTextures[i]); - pPushedTextures[i] = nullptr; + //RpMaterialSetTexture(pModelInfo->m_apPlateMaterials[i], pPushedTextures[i]); + //RwTextureDestroy(pPushedTextures[i]); + //pPushedTextures[i] = nullptr; } } -} +}*/ void CHeli::Render() { diff --git a/SilentPatch/Vehicle.h b/SilentPatch/Vehicle.h index 818ac9e..8c294d1 100644 --- a/SilentPatch/Vehicle.h +++ b/SilentPatch/Vehicle.h @@ -111,7 +111,7 @@ public: bool CustomCarPlate_TextureCreate(CVehicleModelInfo* pModelInfo); void CustomCarPlate_BeforeRenderingStart(CVehicleModelInfo* pModelInfo); - void CustomCarPlate_AfterRenderingStop(CVehicleModelInfo* pModelInfo); + //void CustomCarPlate_AfterRenderingStop(CVehicleModelInfo* pModelInfo); bool IsLawEnforcementVehicle(); diff --git a/SilentPatch/dllmain.cpp b/SilentPatch/dllmain.cpp index af6b5a1..9f48f4a 100644 --- a/SilentPatch/dllmain.cpp +++ b/SilentPatch/dllmain.cpp @@ -2388,10 +2388,11 @@ __forceinline void Patch_SA_10() 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); - InjectMethodVP(0x6D0E53, CVehicle::CustomCarPlate_AfterRenderingStop, PATCH_NOTHING); + //InjectMethodVP(0x6D0E53, CVehicle::CustomCarPlate_AfterRenderingStop, PATCH_NOTHING); // Fixed police scanner names char* pScannerNames = *(char**)0x4E72D4;