Add 'fatal' functionality to Error()

When fatal is set, the function will show a error dialogue, which will halt the process and close when the message is dismissed. Else we will end up in a crash.
This commit is contained in:
Kawe Mazidjatari 2022-08-22 12:42:41 +02:00
parent 2c7aaf531f
commit 2010e11310
24 changed files with 77 additions and 72 deletions

View File

@ -418,7 +418,7 @@ void QuerySystemInfo()
{
if (MessageBoxA(NULL, "SSE and SSE2 are required.", "Unsupported CPU", MB_ICONERROR | MB_OK))
{
TerminateProcess(GetCurrentProcess(), 0xBAD0C0DE);
TerminateProcess(GetCurrentProcess(), 1);
}
}
}

View File

@ -60,9 +60,9 @@ studiohdr_t* CMDLCache::FindMDL(CMDLCache* cache, MDLHandle_t handle, void* a3)
if (!IsKnownBadModel(handle))
{
if (!pStudioHdr)
Error(eDLL_T::ENGINE, "Model with handle \"%hu\" not found and \"%s\" couldn't be loaded.\n", handle, ERROR_MODEL);
Error(eDLL_T::ENGINE, true, "Model with handle \"%hu\" not found and \"%s\" couldn't be loaded.\n", handle, ERROR_MODEL);
else
Error(eDLL_T::ENGINE, "Model with handle \"%hu\" not found; replacing with \"%s\".\n", handle, ERROR_MODEL);
Error(eDLL_T::ENGINE, false, "Model with handle \"%hu\" not found; replacing with \"%s\".\n", handle, ERROR_MODEL);
g_vBadMDLHandles.push_back(handle);
}
@ -143,9 +143,9 @@ studiohdr_t* CMDLCache::FindUncachedMDL(CMDLCache* cache, MDLHandle_t handle, st
if (!IsKnownBadModel(handle))
{
if (!pStudioHdr)
Error(eDLL_T::ENGINE, "Model with handle \"%hu\" not found and \"%s\" couldn't be loaded.\n", handle, ERROR_MODEL);
Error(eDLL_T::ENGINE, true, "Model with handle \"%hu\" not found and \"%s\" couldn't be loaded.\n", handle, ERROR_MODEL);
else
Error(eDLL_T::ENGINE, "Model with handle \"%hu\" not found; replacing with \"%s\".\n", handle, ERROR_MODEL);
Error(eDLL_T::ENGINE, false, "Model with handle \"%hu\" not found; replacing with \"%s\".\n", handle, ERROR_MODEL);
g_vBadMDLHandles.push_back(handle);
}
@ -165,9 +165,9 @@ studiohdr_t* CMDLCache::FindUncachedMDL(CMDLCache* cache, MDLHandle_t handle, st
if (!IsKnownBadModel(handle))
{
if (!pStudioHdr)
Error(eDLL_T::ENGINE, "Attempted to load old model \"%s\" and \"%s\" couldn't be loaded.\n", szModelName, ERROR_MODEL);
Error(eDLL_T::ENGINE, true, "Attempted to load old model \"%s\" and \"%s\" couldn't be loaded.\n", szModelName, ERROR_MODEL);
else
Error(eDLL_T::ENGINE, "Attempted to load old model \"%s\"; replacing with \"%s\".\n", szModelName, ERROR_MODEL);
Error(eDLL_T::ENGINE, false, "Attempted to load old model \"%s\"; replacing with \"%s\".\n", szModelName, ERROR_MODEL);
g_vBadMDLHandles.push_back(handle);
}
@ -192,10 +192,10 @@ studiohdr_t* CMDLCache::FindUncachedMDL(CMDLCache* cache, MDLHandle_t handle, st
pStudioHdr = GetErrorModel();
if (!IsKnownBadModel(handle))
{
if (pStudioHdr)
Error(eDLL_T::ENGINE, "Model \"%s\" not found; replacing with \"%s\".\n", szModelName, ERROR_MODEL);
if (!pStudioHdr)
Error(eDLL_T::ENGINE, true, "Model \"%s\" not found and \"%s\" couldn't be loaded.\n", szModelName, ERROR_MODEL);
else
Error(eDLL_T::ENGINE, "Model \"%s\" not found and \"%s\" couldn't be loaded.\n", szModelName, ERROR_MODEL);
Error(eDLL_T::ENGINE, false, "Model \"%s\" not found; replacing with \"%s\".\n", szModelName, ERROR_MODEL);
g_vBadMDLHandles.push_back(handle);
}
@ -215,9 +215,9 @@ studiohdr_t* CMDLCache::FindUncachedMDL(CMDLCache* cache, MDLHandle_t handle, st
if (!IsKnownBadModel(handle))
{
if (!pStudioHdr)
Error(eDLL_T::ENGINE, "Model \"%s\" has bad studio data and \"%s\" couldn't be loaded.\n", szModelName, ERROR_MODEL);
Error(eDLL_T::ENGINE, true, "Model \"%s\" has bad studio data and \"%s\" couldn't be loaded.\n", szModelName, ERROR_MODEL);
else
Error(eDLL_T::ENGINE, "Model \"%s\" has bad studio data; replacing with \"%s\".\n", szModelName, ERROR_MODEL);
Error(eDLL_T::ENGINE, false, "Model \"%s\" has bad studio data; replacing with \"%s\".\n", szModelName, ERROR_MODEL);
g_vBadMDLHandles.push_back(handle);
}
@ -231,9 +231,9 @@ studiohdr_t* CMDLCache::FindUncachedMDL(CMDLCache* cache, MDLHandle_t handle, st
if (!IsKnownBadModel(handle))
{
if (!pStudioHdr)
Error(eDLL_T::ENGINE, "Model \"%s\" has no studio data and \"%s\" couldn't be loaded.\n", szModelName, ERROR_MODEL);
Error(eDLL_T::ENGINE, true, "Model \"%s\" has no studio data and \"%s\" couldn't be loaded.\n", szModelName, ERROR_MODEL);
else
Error(eDLL_T::ENGINE, "Model \"%s\" has no studio data; replacing with \"%s\".\n", szModelName, ERROR_MODEL);
Error(eDLL_T::ENGINE, false, "Model \"%s\" has no studio data; replacing with \"%s\".\n", szModelName, ERROR_MODEL);
g_vBadMDLHandles.push_back(handle);
}
@ -257,7 +257,7 @@ studiohdr_t* CMDLCache::GetStudioHDR(CMDLCache* pMDLCache, MDLHandle_t handle)
{
pStudioHdr = GetErrorModel();
if (!pStudioHdr)
Error(eDLL_T::ENGINE, "Attempted to load model with no handle and \"%s\" couldn't be loaded.\n", ERROR_MODEL);
Error(eDLL_T::ENGINE, true, "Attempted to load model with no handle and \"%s\" couldn't be loaded.\n", ERROR_MODEL);
return pStudioHdr;
}
@ -293,7 +293,7 @@ studiohwdata_t* CMDLCache::GetHardwareData(CMDLCache* cache, MDLHandle_t handle)
{
if (!g_pMDLFallback->m_hErrorMDL)
{
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, true, "Studio hardware with handle \"%hu\" not found and \"%s\" couldn't be loaded.\n", handle, ERROR_MODEL);
return nullptr;
}
pStudioData = m_MDLDict->Find(g_pMDLFallback->m_hErrorMDL);

View File

@ -7,10 +7,10 @@
bool IsOriginInitialized()
{
#ifndef DEDICATED
//if ((!(*g_OriginErrorLevel)
// && (*g_bEbisuSDKInitialized)
// && (*g_NucleusID)
// && (*g_bEbisuSDKCvarInitialized)
if ((!(*g_OriginErrorLevel)
&& (*g_bEbisuSDKInitialized)
&& (*g_NucleusID)
&& (*g_bEbisuSDKCvarInitialized)))
// && (*g_OriginAuthCode)
// && (g_OriginNucleusToken[0])))
#endif // DEDICATED

View File

@ -204,7 +204,7 @@ void CRConClient::Recv(void)
}
if (nRecvLen < 0 && !m_pSocket->IsSocketBlocking())
{
Error(eDLL_T::CLIENT, "RCON Cmd: recv error (%s)\n", NET_ErrorString(WSAGetLastError()));
Error(eDLL_T::CLIENT, false, "RCON Cmd: recv error (%s)\n", NET_ErrorString(WSAGetLastError()));
break;
}
@ -260,7 +260,7 @@ void CRConClient::ProcessBuffer(const char* pRecvBuf, int nRecvLen, CConnectedNe
if (pData->m_nPayloadLen < 0 ||
pData->m_nPayloadLen > pData->m_RecvBuffer.max_size())
{
Error(eDLL_T::CLIENT, "RCON Cmd: sync error (%d)\n", pData->m_nPayloadLen);
Error(eDLL_T::CLIENT, false, "RCON Cmd: sync error (%d)\n", pData->m_nPayloadLen);
this->Disconnect(); // Out of sync (irrecoverable).
break;

View File

@ -361,7 +361,7 @@ void MOD_PreloadPakFile(const string& svLevelName)
RPakHandle_t nPakId = g_pakLoadApi->LoadAsync(svToLoad.c_str(), g_pMallocPool.GetPtr(), 4, 0);
if (nPakId == -1)
Error(eDLL_T::ENGINE, "%s: unable to load pak '%s' results '%d'\n", __FUNCTION__, svToLoad.c_str(), nPakId);
Error(eDLL_T::ENGINE, false, "%s: unable to load pak '%s' results '%d'\n", __FUNCTION__, svToLoad.c_str(), nPakId);
else
g_vLoadedPakHandle.push_back(nPakId);
}

View File

@ -313,7 +313,7 @@ FORCEINLINE void CHostState::State_NewGame(void)
if (!CModelLoader__Map_IsValid(g_pModelLoader, m_levelName) // Check if map is valid and if we can start a new game.
|| !Host_NewGame(m_levelName, nullptr, m_bBackgroundLevel, m_bSplitScreenConnect, time) || !g_pServerGameClients)
{
Error(eDLL_T::ENGINE, "%s - Error: Map not valid\n", "CHostState::State_NewGame");
Error(eDLL_T::ENGINE, false, "%s - Error: Map not valid\n", "CHostState::State_NewGame");
#ifndef DEDICATED
SCR_EndLoadingPlaque();
#endif // !DEDICATED
@ -344,7 +344,7 @@ FORCEINLINE void CHostState::State_ChangeLevelSP(void)
}
else
{
Error(eDLL_T::ENGINE, "%s - Error: Unable to find map: '%s'\n", "CHostState::State_ChangeLevelSP", m_levelName);
Error(eDLL_T::ENGINE, false, "%s - Error: Unable to find map: '%s'\n", "CHostState::State_ChangeLevelSP", m_levelName);
}
m_iCurrentState = HostStates_t::HS_RUN; // Set current state to run.
@ -376,7 +376,7 @@ FORCEINLINE void CHostState::State_ChangeLevelMP(void)
}
else
{
Error(eDLL_T::ENGINE, "%s - Error: Unable to find map: '%s'\n", "CHostState::State_ChangeLevelMP", m_levelName);
Error(eDLL_T::ENGINE, false, "%s - Error: Unable to find map: '%s'\n", "CHostState::State_ChangeLevelMP", m_levelName);
}
m_iCurrentState = HostStates_t::HS_RUN; // Set current state to run.

View File

@ -86,13 +86,13 @@ void NET_GenerateKey()
BCRYPT_ALG_HANDLE hAlgorithm;
if (BCryptOpenAlgorithmProvider(&hAlgorithm, L"RNG", 0, 0) < 0)
{
Error(eDLL_T::ENGINE, "Failed to open rng algorithm\n");
Error(eDLL_T::ENGINE, false, "Failed to open rng algorithm\n");
return;
}
unsigned char pBuffer[0x10u];
if (BCryptGenRandom(hAlgorithm, pBuffer, 0x10u, 0) < 0)
{
Error(eDLL_T::ENGINE, "Failed to generate random data\n");
Error(eDLL_T::ENGINE, false, "Failed to generate random data\n");
return;
}

View File

@ -275,7 +275,7 @@ void CRConServer::Recv(void)
}
if (nRecvLen < 0 && !m_pSocket->IsSocketBlocking())
{
Error(eDLL_T::SERVER, "RCON Cmd: recv error (%s)\n", NET_ErrorString(WSAGetLastError()));
Error(eDLL_T::SERVER, false, "RCON Cmd: recv error (%s)\n", NET_ErrorString(WSAGetLastError()));
break;
}
@ -450,7 +450,7 @@ void CRConServer::ProcessBuffer(const char* pRecvBuf, int nRecvLen, CConnectedNe
if (pData->m_nPayloadLen < 0 ||
pData->m_nPayloadLen > pData->m_RecvBuffer.max_size())
{
Error(eDLL_T::SERVER, "RCON Cmd: sync error (%d)\n", pData->m_nPayloadLen);
Error(eDLL_T::SERVER, false, "RCON Cmd: sync error (%d)\n", pData->m_nPayloadLen);
this->CloseConnection(); // Out of sync (irrecoverable).
break;

View File

@ -8,10 +8,10 @@
int HSys_Error_Internal(char* fmt, va_list args)
{
char buffer[2048]{};
Error(eDLL_T::COMMON, "_______________________________________________________________\n");
Error(eDLL_T::COMMON, "] ENGINE ERROR ################################################\n");
Error(eDLL_T::COMMON, false, "_______________________________________________________________\n");
Error(eDLL_T::COMMON, false, "] ENGINE ERROR ################################################\n");
vsprintf(buffer, fmt, args);
Error(eDLL_T::COMMON, "%s\n", buffer);
Error(eDLL_T::COMMON, false, "%s\n", buffer);
///////////////////////////////////////////////////////////////////////////
return Sys_Error_Internal(fmt, args);

View File

@ -34,7 +34,7 @@ void HSys_Error(char* fmt, ...)
buf[sizeof(buf) -1] = 0;
va_end(args);
Error(eDLL_T::ENGINE, "%s", buf);
Error(eDLL_T::ENGINE, false, "%s", buf);
return v_Sys_Error(buf);
}

View File

@ -4058,7 +4058,7 @@ void MathLib_Init(float gamma, float texGamma, float brightness, int overbright,
Assert(0);
if (MessageBoxA(NULL, "SSE and SSE2 are required.", "Unsupported CPU", MB_ICONERROR | MB_OK))
{
TerminateProcess(GetCurrentProcess(), 0xBAD0C0DE);
TerminateProcess(GetCurrentProcess(), 1);
}
}
#endif //!360

View File

@ -51,12 +51,12 @@ RPakHandle_t CPakFile::LoadAsync(const char* szPakFileName, uintptr_t pMalloc, i
if (pakHandle == INVALID_PAK_HANDLE)
{
Error(eDLL_T::RTECH, "%s: Failed read '%s' results '%u'\n", __FUNCTION__, szPakFileName, pakHandle);
Error(eDLL_T::RTECH, false, "%s: Failed read '%s' results '%u'\n", __FUNCTION__, szPakFileName, pakHandle);
}
}
else
{
Error(eDLL_T::RTECH, "%s: Failed. File '%s' doesn't exist\n", __FUNCTION__, szPakFileName);
Error(eDLL_T::RTECH, false, "%s: Failed. File '%s' doesn't exist\n", __FUNCTION__, szPakFileName);
}
return pakHandle;

View File

@ -578,7 +578,7 @@ void RTech::CreateDXTexture(RTechTextureInfo_t* textureHeader, int64_t imageData
const D3D11_SUBRESOURCE_DATA* subResData = (D3D11_SUBRESOURCE_DATA*)((uint8_t*)initialData + offsetStartResourceData);
const HRESULT createTextureRes = (*g_ppGameDevice)->CreateTexture2D(&textureDesc, subResData, &textureHeader->m_ppTexture);
if (createTextureRes < S_OK)
Error(eDLL_T::RTECH, "Couldn't create texture \"%s\": error code %08x\n", textureHeader->m_nDebugName, createTextureRes);
Error(eDLL_T::RTECH, true, "Couldn't create texture \"%s\": error code %08x\n", textureHeader->m_nDebugName, createTextureRes);
D3D11_SHADER_RESOURCE_VIEW_DESC shaderResource{};
shaderResource.Format = dxgiFormat;
@ -596,7 +596,7 @@ void RTech::CreateDXTexture(RTechTextureInfo_t* textureHeader, int64_t imageData
const HRESULT createShaderResourceRes = (*g_ppGameDevice)->CreateShaderResourceView(textureHeader->m_ppTexture, &shaderResource, &textureHeader->m_ppShaderResourceView);
if (createShaderResourceRes < S_OK)
Error(eDLL_T::RTECH, "Couldn't create shader resource view for texture \"%s\": error code %08x\n", textureHeader->m_nDebugName, createShaderResourceRes);
Error(eDLL_T::RTECH, true, "Couldn't create shader resource view for texture \"%s\": error code %08x\n", textureHeader->m_nDebugName, createShaderResourceRes);
}
#pragma warning( pop )
#endif

View File

@ -144,7 +144,7 @@ SQBool Script_CreateServerVM()
if (results)
DevMsg(eDLL_T::SERVER, "Created SERVER VM: '%p'\n", g_pServerScript.GetValue<CSquirrelVM*>());
else
Error(eDLL_T::SERVER, "Failed to create SERVER VM\n");
Error(eDLL_T::SERVER, true, "Failed to create SERVER VM\n");
return results;
}
#endif // !CLIENT_DLL
@ -161,7 +161,7 @@ SQBool Script_CreateClientVM(CHLClient* hlclient)
if (results)
DevMsg(eDLL_T::CLIENT, "Created CLIENT VM: '%p'\n", g_pClientScript.GetValue<CSquirrelVM*>());
else
Error(eDLL_T::CLIENT, "Failed to create CLIENT VM\n");
Error(eDLL_T::CLIENT, true, "Failed to create CLIENT VM\n");
return results;
}
@ -175,7 +175,7 @@ SQBool Script_CreateUIVM()
if (results)
DevMsg(eDLL_T::UI, "Created UI VM: '%p'\n", g_pUIScript.GetValue<CSquirrelVM*>());
else
Error(eDLL_T::UI, "Failed to create UI VM\n");
Error(eDLL_T::UI, true, "Failed to create UI VM\n");
return results;
}
#endif // !DEDICATED
@ -259,17 +259,16 @@ void Script_Execute(const SQChar* code, SQCONTEXT context)
}
CSquirrelVM* script = Script_GetContextObject(context);
if (!script)
{
Error(eDLL_T::ENGINE, "Attempted to run %s script while VM isn't initialized\n", SQVM_GetContextName(context));
Error(eDLL_T::ENGINE, false, "Attempted to run %s script with no handle to script context\n", SQVM_GetContextName(context));
return;
}
HSQUIRRELVM v = script->GetVM();
if (!v)
{
Error(eDLL_T::ENGINE, "Attempted to run %s script while VM isn't initialized\n", SQVM_GetContextName(context));
Error(eDLL_T::ENGINE, false, "Attempted to run %s script while VM isn't initialized\n", SQVM_GetContextName(context));
return;
}

View File

@ -324,9 +324,9 @@ void SQVM_CompileError(HSQUIRRELVM v, const SQChar* pszError, const SQChar* pszF
v_SQVM_GetErrorLine(pszFile, nLine, szContextBuf, sizeof(szContextBuf));
Error(static_cast<eDLL_T>(context), "%s SCRIPT COMPILE ERROR: %s\n", SQVM_GetContextName(context), pszError);
Error(static_cast<eDLL_T>(context), " -> %s\n\n", szContextBuf);
Error(static_cast<eDLL_T>(context), "%s line [%d] column [%d]\n", pszFile, nLine, nColumn);
Error(static_cast<eDLL_T>(context), false, "%s SCRIPT COMPILE ERROR: %s\n", SQVM_GetContextName(context), pszError);
Error(static_cast<eDLL_T>(context), false, " -> %s\n\n", szContextBuf);
Error(static_cast<eDLL_T>(context), false, "%s line [%d] column [%d]\n", pszFile, nLine, nColumn);
}
//---------------------------------------------------------------------------------

View File

@ -475,9 +475,10 @@ void Warning(eDLL_T context, const char* fmt, ...)
//-----------------------------------------------------------------------------
// Purpose: Print engine and SDK errors
// Input : context -
// fatal -
// *fmt - ... -
//-----------------------------------------------------------------------------
void Error(eDLL_T context, const char* fmt, ...)
void Error(eDLL_T context, bool fatal, const char* fmt, ...)
{
static char szBuf[4096] = {};
@ -546,5 +547,12 @@ void Error(eDLL_T context, const char* fmt, ...)
g_spd_sys_w_oss.str("");
g_spd_sys_w_oss.clear();
#endif // !DEDICATED
if (fatal)
{
if (MessageBoxA(NULL, fmt::format("{:s}- {:s}", Plat_GetProcessUpTime(), szBuf).c_str(), "SDK Error", MB_ICONERROR | MB_OK))
{
TerminateProcess(GetCurrentProcess(), 1);
}
}
s_LogMutex.unlock();
}

View File

@ -81,7 +81,7 @@ extern std::mutex s_LogMutex;
PLATFORM_INTERFACE void NetMsg(EGlobalContext_t context, const char* fmt, ...) FMTFUNCTION(2, 3);
PLATFORM_INTERFACE void DevMsg(eDLL_T context, const char* fmt, ...) FMTFUNCTION(2, 3);
PLATFORM_INTERFACE void Warning(eDLL_T context, const char* fmt, ...) FMTFUNCTION(1, 2);
PLATFORM_INTERFACE void Error(eDLL_T context, const char* fmt, ...) FMTFUNCTION(1, 2);
PLATFORM_INTERFACE void Error(eDLL_T context, bool fatal, const char* fmt, ...) FMTFUNCTION(1, 2);
// You can use this macro like a runtime assert macro.
// If the condition fails, then Error is called with the message. This macro is called

View File

@ -269,7 +269,7 @@ void CUtlBlockMemory<T, I>::ChangeSize(int nBlocks)
if (!m_pMemory)
{
Error(eDLL_T::COMMON, "CUtlBlockMemory overflow!\n");
Error(eDLL_T::COMMON, true, "CUtlBlockMemory overflow!\n");
}
// allocate new blocks if growing

View File

@ -296,7 +296,7 @@ void CUtlFixedMemory<T>::Grow(ssize_t num)
BlockHeader_t* RESTRICT pBlockHeader = (BlockHeader_t*)malloc(sizeof(BlockHeader_t) + nBlockSize * sizeof(T));
if (!pBlockHeader)
{
Error(eDLL_T::ENGINE, "CUtlFixedMemory overflow!\n");
Error(eDLL_T::ENGINE, true, "CUtlFixedMemory overflow!\n");
}
pBlockHeader->m_pNext = NULL;
pBlockHeader->m_nBlockSize = nBlockSize;

View File

@ -683,7 +683,7 @@ I CUtlRBTree<T, I, L, M>::NewNode()
Assert(m_Elements.IsValidIterator(it));
if (!m_Elements.IsValidIterator(it))
{
Error(eDLL_T::ENGINE, "CUtlRBTree overflow!\n");
Error(eDLL_T::ENGINE, true, "CUtlRBTree overflow!\n");
}
}
m_LastAlloc = it;

View File

@ -53,7 +53,7 @@ void CSocketCreator::ProcessAccept(void)
if (!IsSocketBlocking())
{
#ifndef NETCONSOLE
Error(eDLL_T::ENGINE, "Socket ProcessAccept Error: %s\n", NET_ErrorString(WSAGetLastError()));
Error(eDLL_T::ENGINE, false, "Socket ProcessAccept Error: %s\n", NET_ErrorString(WSAGetLastError()));
#else
printf("Socket ProcessAccept Error: %s\n", NET_ErrorString(WSAGetLastError()));
#endif // !NETCONSOLE

View File

@ -546,7 +546,7 @@ void CPackedStore::UnpackAll(const VPKDir_t& vDir, const string& svPathOut)
vDir.m_vHeader.m_nMajorVersion != VPK_MAJOR_VERSION ||
vDir.m_vHeader.m_nMinorVersion != VPK_MINOR_VERSION)
{
Error(eDLL_T::FS, "Unsupported VPK directory file (invalid header criteria)\n");
Error(eDLL_T::FS, false, "Unsupported VPK directory file (invalid header criteria)\n");
return;
}
BuildManifest(vDir.m_vEntryBlocks, svPathOut, GetSourceName(vDir.m_svDirPath));
@ -570,7 +570,7 @@ void CPackedStore::UnpackAll(const VPKDir_t& vDir, const string& svPathOut)
if (!oStream.IsWritable())
{
Error(eDLL_T::FS, "Unable to write file '%s'\n", svFilePath.c_str());
Error(eDLL_T::FS, false, "Unable to write file '%s'\n", svFilePath.c_str());
continue;
}
DevMsg(eDLL_T::FS, "Unpacking entry '%zu' from block '%zu' ('%s')\n", j, i, vDir.m_vEntryBlocks[j].m_svEntryPath.c_str());
@ -593,7 +593,7 @@ void CPackedStore::UnpackAll(const VPKDir_t& vDir, const string& svPathOut)
if (m_lzDecompStatus != lzham_decompress_status_t::LZHAM_DECOMP_STATUS_SUCCESS)
{
Error(eDLL_T::FS, "Status '%d' for chunk '%zu' within entry '%zu' in block '%hu' (chunk not decompressed)\n",
Error(eDLL_T::FS, false, "Status '%d' for chunk '%zu' within entry '%zu' in block '%hu' (chunk not decompressed)\n",
m_lzDecompStatus, m_nChunkCount, i, vDir.m_vEntryBlocks[j].m_iPackFileIndex);
}
else // If successfully decompressed, write to file.

View File

@ -173,7 +173,7 @@ void Host_KickID_f(const CCommand& args)
}
catch (std::exception& e)
{
Error(eDLL_T::SERVER, "%s - sv_kickid requires a UserID or OriginID. You can get the UserID with the 'status' command. Error: %s", __FUNCTION__, e.what());
Error(eDLL_T::SERVER, false, "%s - sv_kickid requires a UserID or OriginID. You can get the UserID with the 'status' command. Error: %s", __FUNCTION__, e.what());
return;
}
}
@ -274,7 +274,7 @@ void Host_BanID_f(const CCommand& args)
}
catch (std::exception& e)
{
Error(eDLL_T::SERVER, "%s - Banid Error: %s", __FUNCTION__, e.what());
Error(eDLL_T::SERVER, false, "%s - Banid Error: %s", __FUNCTION__, e.what());
return;
}
}
@ -306,7 +306,7 @@ void Host_Unban_f(const CCommand& args)
}
catch (std::exception& e)
{
Error(eDLL_T::SERVER, "%s - Unban error: %s", __FUNCTION__, e.what());
Error(eDLL_T::SERVER, false, "%s - Unban error: %s", __FUNCTION__, e.what());
return;
}
}
@ -416,7 +416,7 @@ void Pak_RequestUnload_f(const CCommand& args)
}
catch (std::exception& e)
{
Error(eDLL_T::RTECH, "%s - %s", __FUNCTION__, e.what());
Error(eDLL_T::RTECH, false, "%s - %s", __FUNCTION__, e.what());
return;
}
}
@ -479,7 +479,7 @@ void Pak_Swap_f(const CCommand& args)
}
catch (std::exception& e)
{
Error(eDLL_T::RTECH, "%s - %s", __FUNCTION__, e.what());
Error(eDLL_T::RTECH, false, "%s - %s", __FUNCTION__, e.what());
return;
}
}
@ -531,7 +531,7 @@ void RTech_Decompress_f(const CCommand& args)
if (!FileExists(pakNameIn))
{
Error(eDLL_T::RTECH, "%s - pak file '%s' does not exist!\n", __FUNCTION__, pakNameIn.c_str());
Error(eDLL_T::RTECH, false, "%s - pak file '%s' does not exist!\n", __FUNCTION__, pakNameIn.c_str());
return;
}
@ -555,17 +555,17 @@ void RTech_Decompress_f(const CCommand& args)
if (rheader.m_nMagic != RPAKHEADER)
{
Error(eDLL_T::RTECH, "%s - pak file '%s' has invalid magic!\n", __FUNCTION__, pakNameIn.c_str());
Error(eDLL_T::RTECH, false, "%s - pak file '%s' has invalid magic!\n", __FUNCTION__, pakNameIn.c_str());
return;
}
if ((rheader.m_nFlags[1] & 1) != 1)
{
Error(eDLL_T::RTECH, "%s - pak file '%s' already decompressed!\n", __FUNCTION__, pakNameIn.c_str());
Error(eDLL_T::RTECH, false, "%s - pak file '%s' already decompressed!\n", __FUNCTION__, pakNameIn.c_str());
return;
}
if (rheader.m_nSizeDisk != reader.GetSize())
{
Error(eDLL_T::RTECH, "%s - pak file '%s' decompressed size '%zu' doesn't match expected value '%llu'!\n", __FUNCTION__, pakNameIn.c_str(), reader.GetSize(), rheader.m_nSizeMemory);
Error(eDLL_T::RTECH, false, "%s - pak file '%s' decompressed size '%zu' doesn't match expected value '%llu'!\n", __FUNCTION__, pakNameIn.c_str(), reader.GetSize(), rheader.m_nSizeMemory);
return;
}
@ -574,7 +574,7 @@ void RTech_Decompress_f(const CCommand& args)
if (decompSize == rheader.m_nSizeDisk)
{
Error(eDLL_T::RTECH, "%s - calculated size: '%llu' expected: '%llu'!\n", __FUNCTION__, decompSize, rheader.m_nSizeMemory);
Error(eDLL_T::RTECH, false, "%s - calculated size: '%llu' expected: '%llu'!\n", __FUNCTION__, decompSize, rheader.m_nSizeMemory);
return;
}
else
@ -590,7 +590,7 @@ void RTech_Decompress_f(const CCommand& args)
uint8_t decompResult = g_pRTech->DecompressPakFile(&state, reader.GetSize(), pakBuf.size());
if (decompResult != 1)
{
Error(eDLL_T::RTECH, "%s - decompression failed for '%s' return value: '%hu'!\n", __FUNCTION__, pakNameIn.c_str(), decompResult);
Error(eDLL_T::RTECH, false, "%s - decompression failed for '%s' return value: '%hu'!\n", __FUNCTION__, pakNameIn.c_str(), decompResult);
return;
}

View File

@ -211,9 +211,7 @@ void GetPresent()
&nFeatureLevelsSupported,
&pContext)))
{
Error(eDLL_T::MS, "Failed to create device and swap chain: error code = %08x\n", hr);
DirectX_Shutdown();
Error(eDLL_T::MS, true, "Failed to create device and swap chain: error code = %08x\n", hr);
return;
}
@ -391,7 +389,7 @@ HRESULT __stdcall Present(IDXGISwapChain* pSwapChain, UINT nSyncInterval, UINT n
HRESULT hr = 0;
if (FAILED(hr = GetDeviceAndCtxFromSwapchain(pSwapChain, &g_pDevice, &g_pDeviceContext)))
{
Error(eDLL_T::MS, "Failed to get device and context from swap chain: error code = %08x\n", hr);
Error(eDLL_T::MS, true, "Failed to get device and context from swap chain: error code = %08x\n", hr);
return g_fnIDXGISwapChainPresent(pSwapChain, nSyncInterval, nFlags);
}