Revert "move models to higher priority pools if needed"

This reverts commit 1bfe9d509c.
This commit is contained in:
Agent X 2025-04-06 13:35:40 -04:00
parent bcfd4ace75
commit 3a751aac56
2 changed files with 33 additions and 33 deletions

View file

@ -65,40 +65,40 @@ void DynOS_Model_Dump() {
static struct GraphNode* DynOS_Model_LoadCommonInternal(u32* aId, enum ModelPool aModelPool, void* aAsset, u8 aLayer, struct GraphNode* aGraphNode, bool aDeDuplicate, enum ModelLoadType mlt) { static struct GraphNode* DynOS_Model_LoadCommonInternal(u32* aId, enum ModelPool aModelPool, void* aAsset, u8 aLayer, struct GraphNode* aGraphNode, bool aDeDuplicate, enum ModelLoadType mlt) {
// sanity check pool // sanity check pool
if (aModelPool < 0 || aModelPool >= MODEL_POOL_MAX) { return NULL; } if (aModelPool >= MODEL_POOL_MAX) { return NULL; }
// allocate pool // allocate pool
if (!sModelPools[aModelPool]) { if (!sModelPools[aModelPool]) {
sModelPools[aModelPool] = dynamic_pool_init(); sModelPools[aModelPool] = dynamic_pool_init();
} }
// check maps, permanent pool is always checked // check perm map
for (int i = 0; i < MODEL_POOL_MAX; ++i) { auto& permMap = sAssetMap[MODEL_POOL_PERMANENT];
auto& map = sAssetMap[i]; if (aDeDuplicate && permMap.count(aAsset)) {
if (aDeDuplicate && map.count(aAsset)) { auto& found = permMap[aAsset];
auto& found = map[aAsset]; if (*aId && *aId == found.id) {
return found.graphNode;
// if the expected pool has a higher priority,
// we need to move the asset to the new pool
if (i > aModelPool) {
found.modelPool = aModelPool;
sAssetMap[aModelPool][aAsset] = found;
map.erase(aAsset);
} }
if (*aId == 0) {
if (i != MODEL_POOL_PERMANENT && *aId && *aId != found.id) {
sOverwriteMap[*aId] = found.id;
}
*aId = found.id; *aId = found.id;
return found.graphNode; return found.graphNode;
} }
if (i < aModelPool) { i = aModelPool; } // to force check permanent pool, and then skip to the expected pool
} }
// load geo // check map
auto& map = sAssetMap[aModelPool]; auto& map = sAssetMap[aModelPool];
if (aDeDuplicate && map.count(aAsset)) {
auto& found = map[aAsset];
if (*aId && *aId != found.id) {
sOverwriteMap[*aId] = found.id;
}
*aId = found.id;
return found.graphNode;
}
sCurrModelDuplicates = new std::vector<void*>(); sCurrModelDuplicates = new std::vector<void*>();
// load geo
struct GraphNode* node = NULL; struct GraphNode* node = NULL;
switch (mlt) { switch (mlt) {
case MLT_GEO: case MLT_GEO:

View file

@ -2745,7 +2745,7 @@ s32 cur_obj_progress_direction_table(void) {
if (tableLength < 0 || index < 0 || tableLength >= 150 || index >= tableLength) { if (tableLength < 0 || index < 0 || tableLength >= 150 || index >= tableLength) {
ret = table[0]; ret = table[0];
o->oToxBoxMovementStep = 0; o->oToxBoxMovementStep = 0;
LOG_ERROR("Exceeded direction table! tableLength %d, index %d", tableLength, index); LOG_ERROR("Exceeded direction table! tableLength %d, index %d\n", tableLength, index);
} else if (table[index] != -1) { } else if (table[index] != -1) {
ret = table[index]; ret = table[index];
o->oToxBoxMovementStep++; o->oToxBoxMovementStep++;