From 97fb3fd8d4d806268e8aac67e171ac73defdf15c Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sat, 30 Apr 2022 05:06:59 +0200 Subject: [PATCH] Also lock the upgrade error behind already known bad model handles Reduce console verbosity --- r5dev/datacache/mdlcache.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/r5dev/datacache/mdlcache.cpp b/r5dev/datacache/mdlcache.cpp index 4f1aa034..6fcd6cae 100644 --- a/r5dev/datacache/mdlcache.cpp +++ b/r5dev/datacache/mdlcache.cpp @@ -127,6 +127,7 @@ studiohdr_t* CMDLCache::FindUncachedMDL(CMDLCache* cache, MDLHandle_t handle, vo bool v16; // zf studiohdr_t* v17; // rdi studiohdr_t** v18; // rax + bool bOldModel {}; CThreadFastMutex::WaitForLock((CThreadFastMutex*)a3 + 0x80); EnterCriticalSection(reinterpret_cast(&*m_MDLMutex)); @@ -143,7 +144,7 @@ studiohdr_t* CMDLCache::FindUncachedMDL(CMDLCache* cache, MDLHandle_t handle, vo (_stricmp(&v8[v9 - 5], ".rrig") != 0) && (_stricmp(&v8[v9 - 5], ".rpak") != 0)) { - Error(eDLL_T::ENGINE, "Attempted to load old model \"%s\"; replace with rmdl.\n", v8); + bOldModel = true; goto LABEL_ERROR; } @@ -162,12 +163,17 @@ studiohdr_t* CMDLCache::FindUncachedMDL(CMDLCache* cache, MDLHandle_t handle, vo LABEL_ERROR: if (std::find(g_vBadMDLHandles.begin(), g_vBadMDLHandles.end(), handle) == g_vBadMDLHandles.end()) { - if (g_pMDLFallback->m_hErrorMDL) - Error(eDLL_T::ENGINE, "Model \"%s\" not found; replacing with \"%s\".\n", v8, ERROR_MODEL); + if (!bOldModel) + { + if (g_pMDLFallback->m_hErrorMDL) + Error(eDLL_T::ENGINE, "Model \"%s\" not found; replacing with \"%s\".\n", v8, ERROR_MODEL); + else + Error(eDLL_T::ENGINE, "Model \"%s\" not found and \"%s\" couldn't be loaded.\n", v8, ERROR_MODEL); + } else - Error(eDLL_T::ENGINE, "Model \"%s\" not found and \"%s\" couldn't be loaded.\n", v8, ERROR_MODEL); - g_vBadMDLHandles.push_back(handle); + Error(eDLL_T::ENGINE, "Attempted to load old model \"%s\"; replace with rmdl.\n", v8); + g_vBadMDLHandles.push_back(handle); } v17 = g_pMDLFallback->m_pErrorHDR; old_gather_props->SetValue(true); // mdl/error.rmdl fallback is not supported (yet) in the new GatherProps solution!