mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2025-01-31 06:57:28 +05:00
Reduce stencil shadows memory usage
This commit is contained in:
parent
27d80800a0
commit
181f492a03
1 changed files with 21 additions and 0 deletions
|
@ -863,6 +863,20 @@ void UpdateEscalators()
|
|||
}
|
||||
|
||||
|
||||
static char** pStencilShadowsPad = *AddressByVersion<char***>(0x70FC4F, 0, 0);
|
||||
void StencilShadowAlloc( )
|
||||
{
|
||||
static char* pMemory = nullptr;
|
||||
if ( pMemory == nullptr )
|
||||
{
|
||||
pMemory = static_cast<char*>( orgNewAlloc( 3 * 0x6000 ) );
|
||||
pStencilShadowsPad[0] = pMemory;
|
||||
pStencilShadowsPad[1] = pMemory+0x6000;
|
||||
pStencilShadowsPad[2] = pMemory+(2*0x6000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#include <xnamath.h>
|
||||
|
||||
static void* pNVCShader = nullptr;
|
||||
|
@ -2920,6 +2934,13 @@ void Patch_SA_10()
|
|||
InjectHook(0x71791F, &CEscalator::SwitchOffNoRemove);
|
||||
|
||||
|
||||
// Don't allocate constant memory for stencil shadows every frame
|
||||
InjectHook(0x711DD5, StencilShadowAlloc, PATCH_CALL);
|
||||
Nop(0x711E0D, 3);
|
||||
Patch<WORD>(0x711DDA, 0x2CEB);
|
||||
Patch<DWORD>(0x711E5F, 0x90C35D5F); // pop edi, pop ebp, ret
|
||||
|
||||
|
||||
|
||||
// Fixed police scanner names
|
||||
char* pScannerNames = *(char**)0x4E72D4;
|
||||
|
|
Loading…
Reference in a new issue