mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-17 19:47:08 +02:00
Stock worlds allocate 8,200 bodies (+1 internal) from FBPhysicsWorldSize. Studio maps give every collision part its own static body, so large maps (e.g. a 41k-part GTA IV export) hit the FatalAssert "bodyIndex < m_freeBodyList.capacity()" in FBPhysicsWorld::asyncAllocateBody and crash on load. Hook fb::FBPhysicsWorld creation (RVA 0x02606ff0) and raise the size descriptor before it is copied into the job arguments, so every free list and per-body array is sized consistently. BodyCount becomes 65,000 (kept below 16 bits); the pools a static mesh body also draws from (geometry, owner, hull/mesh, shape, aggregate/fixed shape, fixed partition, persistent spatial index) scale by the same factor, capped at 2^20. Contacts, joints, queries and culling tables keep their native sizes. Both native callers build the descriptor on their own stack, so raising it in place only affects that world. Contract bytes for the entry, the descriptor copy, the internal-body increment and both call sites are validated before the hook is enabled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>