mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-10-18 19:22:41 +00:00
Sanity check collisions, and increase efficiency of growingpool
This commit is contained in:
parent
aeb8817f0d
commit
3456e10216
2 changed files with 17 additions and 7 deletions
|
@ -764,6 +764,10 @@ void load_object_collision_model(void) {
|
|||
LOG_ERROR("Object collisions had invalid vertex count");
|
||||
return;
|
||||
}
|
||||
if (numVertices >= 4096) {
|
||||
LOG_ERROR("Object collisions had too many vertices");
|
||||
return;
|
||||
}
|
||||
|
||||
static s32 sVertexDataCount = 0;
|
||||
static s16* sVertexData = NULL;
|
||||
|
|
|
@ -135,13 +135,19 @@ void* growing_pool_alloc(struct GrowingPool *pool, u32 size) {
|
|||
}
|
||||
|
||||
// search for space in nodes
|
||||
struct GrowingPoolNode* node = pool->tail;
|
||||
u32 depth = 0;
|
||||
while (node) {
|
||||
depth++;
|
||||
s64 freeSpace = (s64)pool->nodeSize - (s64)node->usedSpace;
|
||||
if (freeSpace > size) { break; }
|
||||
node = node->prev;
|
||||
struct GrowingPoolNode* node = NULL;
|
||||
if (size < pool->nodeSize) {
|
||||
node = pool->tail;
|
||||
u32 depth = 0;
|
||||
while (node && depth < 128) {
|
||||
depth++;
|
||||
s64 freeSpace = (s64)pool->nodeSize - (s64)node->usedSpace;
|
||||
if (freeSpace > size) { break; }
|
||||
node = node->prev;
|
||||
}
|
||||
if (depth >= 128) {
|
||||
node = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// allocate new node
|
||||
|
|
Loading…
Reference in a new issue