mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-12-20 06:52:36 +00:00
Prevent immediate freeing of dynos model pools
This commit is contained in:
parent
136ac0d84c
commit
c126bf82b3
1 changed files with 9 additions and 10 deletions
|
|
@ -23,7 +23,6 @@ struct ModelInfo {
|
||||||
|
|
||||||
struct ScheduledFreePool {
|
struct ScheduledFreePool {
|
||||||
struct DynamicPool* pool;
|
struct DynamicPool* pool;
|
||||||
u32 timeout;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct DynamicPool* sModelPools[MODEL_POOL_MAX] = { 0 };
|
static struct DynamicPool* sModelPools[MODEL_POOL_MAX] = { 0 };
|
||||||
|
|
@ -171,7 +170,6 @@ void DynOS_Model_ClearPool(enum ModelPool aModelPool) {
|
||||||
// schedule pool to be freed
|
// schedule pool to be freed
|
||||||
sPoolsToFree.push_back({
|
sPoolsToFree.push_back({
|
||||||
.pool = sModelPools[aModelPool],
|
.pool = sModelPools[aModelPool],
|
||||||
.timeout = 30
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// clear pointer
|
// clear pointer
|
||||||
|
|
@ -203,12 +201,13 @@ void DynOS_Model_ClearPool(enum ModelPool aModelPool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynOS_Model_Update() {
|
void DynOS_Model_Update() {
|
||||||
for (auto it = sPoolsToFree.begin(); it != sPoolsToFree.end(); ) {
|
|
||||||
if (--it->timeout <= 0) {
|
// only free a pool when we've scheduled at least 3
|
||||||
dynamic_pool_free_pool(it->pool);
|
// this is required because the way that sm64 loads areas is actually insane
|
||||||
it = sPoolsToFree.erase(it);
|
// if we free immediately, the camera graph node is incorrect on the star selection screen
|
||||||
} else {
|
if (sPoolsToFree.size() <= 2) { return; }
|
||||||
it++;
|
|
||||||
}
|
auto& it = sPoolsToFree[0];
|
||||||
}
|
dynamic_pool_free_pool(it.pool);
|
||||||
|
sPoolsToFree.erase(sPoolsToFree.begin());
|
||||||
}
|
}
|
||||||
Loading…
Add table
Reference in a new issue