From 47a8e9d3f67244ca50ac095f34fe2715ef25a2d7 Mon Sep 17 00:00:00 2001 From: MysterD Date: Mon, 5 Jun 2023 15:19:33 -0700 Subject: [PATCH] Prevent clearing permanent vanilla model slot --- data/dynos_mgr_models.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/data/dynos_mgr_models.cpp b/data/dynos_mgr_models.cpp index f357de763..ff5681f0d 100644 --- a/data/dynos_mgr_models.cpp +++ b/data/dynos_mgr_models.cpp @@ -8,6 +8,8 @@ extern "C" { #include "model_ids.h" } +#define VANILLA_ID_END 255 + enum ModelLoadType { MLT_GEO, MLT_DL, @@ -28,7 +30,7 @@ static std::map> sIdMap; static std::map sOverwriteMap; static u32 find_empty_id() { - u32 id = 256; + u32 id = VANILLA_ID_END + 1; while (true) { if (id != 0) { if (sIdMap.count(id) == 0) { return id; } @@ -199,6 +201,9 @@ void DynOS_Model_ClearPool(enum ModelPool aModelPool) { auto& info = asset.second; if (sIdMap.count(info.id) == 0) { continue; } + // preventing clearing permanent vanilla model slot + if (info.id <= VANILLA_ID_END && sIdMap.count(info.id) <= 1) { continue; } + // erase from id map auto& idMap = sIdMap[info.id]; for (auto info2 = idMap.begin(); info2 != idMap.end(); ) {