Some mdlcache error handling improvements

This commit is contained in:
Kawe Mazidjatari 2022-05-04 12:44:01 +02:00
parent aedc722a8f
commit 325fee107b
2 changed files with 13 additions and 3 deletions

View File

@ -197,7 +197,15 @@ studiohdr_t* CMDLCache::FindUncachedMDL(CMDLCache* cache, MDLHandle_t handle, vo
else else
{ {
v_CMDLCache__FindCachedMDL(cache, a3, a4); v_CMDLCache__FindCachedMDL(cache, a3, a4);
v17 = **(studiohdr_t***)a3; if ((__int64)*(studiohdr_t**)a3)
{
if ((__int64)*(studiohdr_t**)a3 == 0xDEADFEEDDEADFEED)
v17 = g_pMDLFallback->m_pErrorHDR;
else
v17 = **(studiohdr_t***)a3;
}
else
v17 = g_pMDLFallback->m_pErrorHDR;
} }
CThreadFastMutex::ReleaseWaiter((CThreadFastMutex*)a3 + 128); CThreadFastMutex::ReleaseWaiter((CThreadFastMutex*)a3 + 128);
return v17; return v17;
@ -263,11 +271,14 @@ CStudioHWDataRef* CMDLCache::GetStudioHardwareRef(CMDLCache* cache, MDLHandle_t
Error(eDLL_T::ENGINE, "Studio hardware with handle \"%hu\" not found and \"%s\" couldn't be loaded.\n", handle, ERROR_MODEL); Error(eDLL_T::ENGINE, "Studio hardware with handle \"%hu\" not found and \"%s\" couldn't be loaded.\n", handle, ERROR_MODEL);
return nullptr; return nullptr;
} }
v3 = *(_QWORD*)(m_MDLDict.Deref().GetPtr() + 24 * g_pMDLFallback->m_hErrorMDL + 16); v3 = *(_QWORD*)(m_MDLDict.Deref().GetPtr() + 24i64 * g_pMDLFallback->m_hErrorMDL + 16);
} }
if (*(_QWORD*)v3) if (*(_QWORD*)v3)
{ {
if (*(_QWORD*)v3 == 0xDEADFEEDDEADFEED)
return nullptr;
v4 = *(_QWORD*)(*(_QWORD*)v3 + 8i64); v4 = *(_QWORD*)(*(_QWORD*)v3 + 8i64);
AcquireSRWLockExclusive(reinterpret_cast<PSRWLOCK>(&*m_MDLLock)); AcquireSRWLockExclusive(reinterpret_cast<PSRWLOCK>(&*m_MDLLock));
v_CStudioHWDataRef__SetFlags(reinterpret_cast<CStudioHWDataRef*>(v4), 1i64); // !!! DECLARED INLINE IN < S3 !!! v_CStudioHWDataRef__SetFlags(reinterpret_cast<CStudioHWDataRef*>(v4), 1i64); // !!! DECLARED INLINE IN < S3 !!!

View File

@ -38,7 +38,6 @@ class HThreadTools : public IDetour
v_MutexInternal_WaitForLock = p_MutexInternal_WaitForLock.RCast<int (*)(void*)>(); /*48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 48 8B D9 FF 15 ?? ?? ?? ??*/ v_MutexInternal_WaitForLock = p_MutexInternal_WaitForLock.RCast<int (*)(void*)>(); /*48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 48 8B D9 FF 15 ?? ?? ?? ??*/
v_MutexInternal_ReleaseWaiter = p_MutexInternal_ReleaseWaiter.RCast<int (*)(void*)>(); /*40 53 48 83 EC 20 8B 41 04 48 8B D9 83 E8 01*/ v_MutexInternal_ReleaseWaiter = p_MutexInternal_ReleaseWaiter.RCast<int (*)(void*)>(); /*40 53 48 83 EC 20 8B 41 04 48 8B D9 83 E8 01*/
} }
virtual void GetVar(void) const { } virtual void GetVar(void) const { }
virtual void GetCon(void) const { } virtual void GetCon(void) const { }