@@ -664,6 +664,22 @@ static void HookStereo()
664664 hook::jump (GetNvapi (0x1FB0BC30 ), NvAPI_Stereo_IsActivated);
665665}
666666
667+ static void ** g_fwPortalSceneGraphNode_dataPtr;
668+
669+ static void * (*g_origPoolCtor)(void * self, int count, void * data, void * flags, const char * name, int v, int size);
670+
671+ static void * PortalSceneGraphPoolCtor (void * self, int count, void * data, void * flags, const char * name, int v, int size)
672+ {
673+ count *= 3 ;
674+
675+ flags = rage::GetAllocator ()->Allocate (count, 16 , 0 );
676+ data = rage::GetAllocator ()->Allocate (count * size, 16 , 0 );
677+
678+ *g_fwPortalSceneGraphNode_dataPtr = data;
679+
680+ return g_origPoolCtor (self, count, data, flags, name, v, size);
681+ }
682+
667683static HookFunction hookFunction ([]()
668684{
669685#if 0
@@ -760,6 +776,19 @@ static HookFunction hookFunction([]()
760776 // make GTA default rage::fwMapData::ms_entityLevelCap to PRI_OPTIONAL_LOW, not PRI_OPTIONAL_MEDIUM (RAGE suite defaults)
761777 hook::put<uint32_t >(hook::get_pattern (" BB 02 00 00 00 39 1D" , 1 ), 3 );
762778
779+ // increase fwPortalSceneGraphNode pool size (in the process, replacing all of it)
780+ if (!Is1868 ())
781+ {
782+ auto location = hook::get_pattern<char >(" 4D 8B CD BA 90 01 00 00" , -0x2D1 );
783+
784+ // we can't just replace the size, for it leads to a single batched allocation and a base pointer
785+ // instead, we'll ignore the existing allocation and make our own
786+ g_fwPortalSceneGraphNode_dataPtr = hook::get_address<decltype (g_fwPortalSceneGraphNode_dataPtr)>(location + 0x2BE );
787+
788+ hook::set_call (&g_origPoolCtor, location + 0x2E5 );
789+ hook::call (location + 0x2E5 , PortalSceneGraphPoolCtor);
790+ }
791+
763792 // limit adjuster!
764793 AdjustLimits ();
765794
0 commit comments