diff --git a/r5dev/core/init.cpp b/r5dev/core/init.cpp index 07e78dbf..60fd13e6 100644 --- a/r5dev/core/init.cpp +++ b/r5dev/core/init.cpp @@ -141,7 +141,7 @@ void Systems_Init() WinSock_Init(); // Initialize Winsock. MathLib_Init(); // Initialize Mathlib. - // Begin the detour transaction to hook the the process + // Begin the detour transaction to hook the process DetourTransactionBegin(); DetourUpdateThread(GetCurrentThread()); @@ -226,7 +226,8 @@ void Systems_Init() RuntimePtc_Init(); // Commit the transaction - if (LONG hr = DetourTransactionCommit() != NO_ERROR) + HRESULT hr = DetourTransactionCommit(); + if (hr != NO_ERROR) { // Failed to hook into the process, terminate Error(eDLL_T::COMMON, 0xBAD0C0DE, "Failed to detour process: error code = %08x\n", hr); @@ -267,7 +268,7 @@ void Systems_Shutdown() // Shutdown Winsock system. WinSock_Shutdown(); - // Begin the detour transaction to unhook the the process + // Begin the detour transaction to unhook the process DetourTransactionBegin(); DetourUpdateThread(GetCurrentThread()); diff --git a/r5dev/datacache/mdlcache.cpp b/r5dev/datacache/mdlcache.cpp index d5f1b5aa..91e0f5d7 100644 --- a/r5dev/datacache/mdlcache.cpp +++ b/r5dev/datacache/mdlcache.cpp @@ -62,7 +62,7 @@ studiohdr_t* CMDLCache::FindMDL(CMDLCache* cache, MDLHandle_t handle, void* a3) if (!pStudioHdr) Error(eDLL_T::ENGINE, EXIT_FAILURE, "Model with handle \"%hu\" not found and \"%s\" couldn't be loaded.\n", handle, ERROR_MODEL); else - Error(eDLL_T::ENGINE, NULL, "Model with handle \"%hu\" not found; replacing with \"%s\".\n", handle, ERROR_MODEL); + Error(eDLL_T::ENGINE, NO_ERROR, "Model with handle \"%hu\" not found; replacing with \"%s\".\n", handle, ERROR_MODEL); g_vBadMDLHandles.push_back(handle); } @@ -145,7 +145,7 @@ studiohdr_t* CMDLCache::FindUncachedMDL(CMDLCache* cache, MDLHandle_t handle, st if (!pStudioHdr) Error(eDLL_T::ENGINE, EXIT_FAILURE, "Model with handle \"%hu\" not found and \"%s\" couldn't be loaded.\n", handle, ERROR_MODEL); else - Error(eDLL_T::ENGINE, NULL, "Model with handle \"%hu\" not found; replacing with \"%s\".\n", handle, ERROR_MODEL); + Error(eDLL_T::ENGINE, NO_ERROR, "Model with handle \"%hu\" not found; replacing with \"%s\".\n", handle, ERROR_MODEL); g_vBadMDLHandles.push_back(handle); } @@ -167,7 +167,7 @@ studiohdr_t* CMDLCache::FindUncachedMDL(CMDLCache* cache, MDLHandle_t handle, st if (!pStudioHdr) Error(eDLL_T::ENGINE, EXIT_FAILURE, "Attempted to load old model \"%s\" and \"%s\" couldn't be loaded.\n", szModelName, ERROR_MODEL); else - Error(eDLL_T::ENGINE, NULL, "Attempted to load old model \"%s\"; replacing with \"%s\".\n", szModelName, ERROR_MODEL); + Error(eDLL_T::ENGINE, NO_ERROR, "Attempted to load old model \"%s\"; replacing with \"%s\".\n", szModelName, ERROR_MODEL); g_vBadMDLHandles.push_back(handle); } @@ -195,7 +195,7 @@ studiohdr_t* CMDLCache::FindUncachedMDL(CMDLCache* cache, MDLHandle_t handle, st if (!pStudioHdr) Error(eDLL_T::ENGINE, EXIT_FAILURE, "Model \"%s\" not found and \"%s\" couldn't be loaded.\n", szModelName, ERROR_MODEL); else - Error(eDLL_T::ENGINE, NULL, "Model \"%s\" not found; replacing with \"%s\".\n", szModelName, ERROR_MODEL); + Error(eDLL_T::ENGINE, NO_ERROR, "Model \"%s\" not found; replacing with \"%s\".\n", szModelName, ERROR_MODEL); g_vBadMDLHandles.push_back(handle); } @@ -217,7 +217,7 @@ studiohdr_t* CMDLCache::FindUncachedMDL(CMDLCache* cache, MDLHandle_t handle, st if (!pStudioHdr) Error(eDLL_T::ENGINE, EXIT_FAILURE, "Model \"%s\" has bad studio data and \"%s\" couldn't be loaded.\n", szModelName, ERROR_MODEL); else - Error(eDLL_T::ENGINE, NULL, "Model \"%s\" has bad studio data; replacing with \"%s\".\n", szModelName, ERROR_MODEL); + Error(eDLL_T::ENGINE, NO_ERROR, "Model \"%s\" has bad studio data; replacing with \"%s\".\n", szModelName, ERROR_MODEL); g_vBadMDLHandles.push_back(handle); } @@ -233,7 +233,7 @@ studiohdr_t* CMDLCache::FindUncachedMDL(CMDLCache* cache, MDLHandle_t handle, st if (!pStudioHdr) Error(eDLL_T::ENGINE, EXIT_FAILURE, "Model \"%s\" has no studio data and \"%s\" couldn't be loaded.\n", szModelName, ERROR_MODEL); else - Error(eDLL_T::ENGINE, NULL, "Model \"%s\" has no studio data; replacing with \"%s\".\n", szModelName, ERROR_MODEL); + Error(eDLL_T::ENGINE, NO_ERROR, "Model \"%s\" has no studio data; replacing with \"%s\".\n", szModelName, ERROR_MODEL); g_vBadMDLHandles.push_back(handle); } diff --git a/r5dev/engine/client/cl_rcon.cpp b/r5dev/engine/client/cl_rcon.cpp index 903d1a6f..0961a17e 100644 --- a/r5dev/engine/client/cl_rcon.cpp +++ b/r5dev/engine/client/cl_rcon.cpp @@ -204,7 +204,7 @@ void CRConClient::Recv(void) } if (nRecvLen < 0 && !m_pSocket->IsSocketBlocking()) { - Error(eDLL_T::CLIENT, NULL, "RCON Cmd: recv error (%s)\n", NET_ErrorString(WSAGetLastError())); + Error(eDLL_T::CLIENT, NO_ERROR, "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, NULL, "RCON Cmd: sync error (%d)\n", pData->m_nPayloadLen); + Error(eDLL_T::CLIENT, NO_ERROR, "RCON Cmd: sync error (%d)\n", pData->m_nPayloadLen); this->Disconnect(); // Out of sync (irrecoverable). break; diff --git a/r5dev/engine/cmodel_bsp.cpp b/r5dev/engine/cmodel_bsp.cpp index 82ecaecb..4dd87d8f 100644 --- a/r5dev/engine/cmodel_bsp.cpp +++ b/r5dev/engine/cmodel_bsp.cpp @@ -367,7 +367,7 @@ void MOD_PreloadPakFile(const string& svLevelName) RPakHandle_t nPakId = g_pakLoadApi->LoadAsync(svToLoad.c_str(), g_pMallocPool.GetPtr(), 4, 0); if (nPakId == INVALID_PAK_HANDLE) - Error(eDLL_T::ENGINE, NULL, "%s: unable to load pak '%s' results '%d'\n", __FUNCTION__, svToLoad.c_str(), nPakId); + Error(eDLL_T::ENGINE, NO_ERROR, "%s: unable to load pak '%s' results '%d'\n", __FUNCTION__, svToLoad.c_str(), nPakId); else g_vLoadedPakHandle.push_back(nPakId); } diff --git a/r5dev/engine/host_state.cpp b/r5dev/engine/host_state.cpp index 1b280aca..a1b8d7f8 100644 --- a/r5dev/engine/host_state.cpp +++ b/r5dev/engine/host_state.cpp @@ -334,7 +334,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, nSplitScreenPlayers, time) || !g_pServerGameClients) { - Error(eDLL_T::ENGINE, NULL, "%s - Error: Map not valid\n", "CHostState::State_NewGame"); + Error(eDLL_T::ENGINE, NO_ERROR, "%s - Error: Map not valid\n", "CHostState::State_NewGame"); #ifndef DEDICATED SCR_EndLoadingPlaque(); #endif // !DEDICATED @@ -365,7 +365,7 @@ FORCEINLINE void CHostState::State_ChangeLevelSP(void) } else { - Error(eDLL_T::ENGINE, NULL, "%s - Error: Unable to find map: '%s'\n", "CHostState::State_ChangeLevelSP", m_levelName); + Error(eDLL_T::ENGINE, NO_ERROR, "%s - Error: Unable to find map: '%s'\n", "CHostState::State_ChangeLevelSP", m_levelName); } m_iCurrentState = HostStates_t::HS_RUN; // Set current state to run. @@ -397,7 +397,7 @@ FORCEINLINE void CHostState::State_ChangeLevelMP(void) } else { - Error(eDLL_T::ENGINE, NULL, "%s - Error: Unable to find map: '%s'\n", "CHostState::State_ChangeLevelMP", m_levelName); + Error(eDLL_T::ENGINE, NO_ERROR, "%s - Error: Unable to find map: '%s'\n", "CHostState::State_ChangeLevelMP", m_levelName); } m_iCurrentState = HostStates_t::HS_RUN; // Set current state to run. diff --git a/r5dev/engine/net.cpp b/r5dev/engine/net.cpp index 6da5df0e..624b5ced 100644 --- a/r5dev/engine/net.cpp +++ b/r5dev/engine/net.cpp @@ -78,7 +78,7 @@ void NET_SetKey(string svNetKey) } else { - Error(eDLL_T::ENGINE, NULL, "AES-128 key not encoded or invalid\n"); + Error(eDLL_T::ENGINE, NO_ERROR, "AES-128 key not encoded or invalid\n"); } } @@ -96,14 +96,14 @@ void NET_GenerateKey() BCRYPT_ALG_HANDLE hAlgorithm; if (BCryptOpenAlgorithmProvider(&hAlgorithm, L"RNG", 0, 0) < 0) { - Error(eDLL_T::ENGINE, NULL, "Failed to open rng algorithm\n"); + Error(eDLL_T::ENGINE, NO_ERROR, "Failed to open rng algorithm\n"); return; } uint8_t pBuffer[AES_128_KEY_SIZE]; if (BCryptGenRandom(hAlgorithm, pBuffer, AES_128_KEY_SIZE, 0) < 0) { - Error(eDLL_T::ENGINE, NULL, "Failed to generate random data\n"); + Error(eDLL_T::ENGINE, NO_ERROR, "Failed to generate random data\n"); return; } diff --git a/r5dev/engine/server/sv_rcon.cpp b/r5dev/engine/server/sv_rcon.cpp index 542b9343..b364f98a 100644 --- a/r5dev/engine/server/sv_rcon.cpp +++ b/r5dev/engine/server/sv_rcon.cpp @@ -275,7 +275,7 @@ void CRConServer::Recv(void) } if (nRecvLen < 0 && !m_pSocket->IsSocketBlocking()) { - Error(eDLL_T::SERVER, NULL, "RCON Cmd: recv error (%s)\n", NET_ErrorString(WSAGetLastError())); + Error(eDLL_T::SERVER, NO_ERROR, "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, NULL, "RCON Cmd: sync error (%d)\n", pData->m_nPayloadLen); + Error(eDLL_T::SERVER, NO_ERROR, "RCON Cmd: sync error (%d)\n", pData->m_nPayloadLen); this->CloseConnection(); // Out of sync (irrecoverable). break; diff --git a/r5dev/engine/sys_dll.cpp b/r5dev/engine/sys_dll.cpp index f5c834ea..b1b6698a 100644 --- a/r5dev/engine/sys_dll.cpp +++ b/r5dev/engine/sys_dll.cpp @@ -8,10 +8,10 @@ int HSys_Error_Internal(char* fmt, va_list args) { char buffer[2048]{}; - Error(eDLL_T::COMMON, NULL, "_______________________________________________________________\n"); - Error(eDLL_T::COMMON, NULL, "] ENGINE ERROR ################################################\n"); + Error(eDLL_T::COMMON, NO_ERROR, "_______________________________________________________________\n"); + Error(eDLL_T::COMMON, NO_ERROR, "] ENGINE ERROR ################################################\n"); vsprintf(buffer, fmt, args); - Error(eDLL_T::COMMON, NULL, "%s\n", buffer); + Error(eDLL_T::COMMON, NO_ERROR, "%s\n", buffer); /////////////////////////////////////////////////////////////////////////// return Sys_Error_Internal(fmt, args); diff --git a/r5dev/engine/sys_utils.cpp b/r5dev/engine/sys_utils.cpp index 58eb08f7..e217d661 100644 --- a/r5dev/engine/sys_utils.cpp +++ b/r5dev/engine/sys_utils.cpp @@ -34,7 +34,7 @@ void HSys_Error(char* fmt, ...) buf[sizeof(buf) -1] = 0; va_end(args); - Error(eDLL_T::ENGINE, NULL, "%s", buf); + Error(eDLL_T::ENGINE, NO_ERROR, "%s", buf); return v_Sys_Error(buf); } diff --git a/r5dev/game/server/ai_networkmanager.cpp b/r5dev/game/server/ai_networkmanager.cpp index 24e064d6..17de1e9f 100644 --- a/r5dev/game/server/ai_networkmanager.cpp +++ b/r5dev/game/server/ai_networkmanager.cpp @@ -52,7 +52,7 @@ void CAI_NetworkBuilder::SaveNetworkGraph(CAI_Network* pNetwork) FileHandle_t pAIGraph = FileSystem()->Open(fsGraphPath.relative_path().u8string().c_str(), "wb", "GAME"); if (!pAIGraph) { - Error(eDLL_T::SERVER, NULL, "%s - Unable to write to '%s' (read-only?)\n", __FUNCTION__, fsGraphPath.relative_path().u8string().c_str()); + Error(eDLL_T::SERVER, NO_ERROR, "%s - Unable to write to '%s' (read-only?)\n", __FUNCTION__, fsGraphPath.relative_path().u8string().c_str()); return; } @@ -339,7 +339,7 @@ void CAI_NetworkManager::LoadNetworkGraph(CAI_NetworkManager* pAINetworkManager, FileHandle_t pAIGraph = FileSystem()->Open(fsGraphPath.relative_path().u8string().c_str(), "rb", "GAME"); if (!pAIGraph) { - Error(eDLL_T::SERVER, NULL, "%s - Unable to open '%s' (insufficient rights?)\n", __FUNCTION__, + Error(eDLL_T::SERVER, NO_ERROR, "%s - Unable to open '%s' (insufficient rights?)\n", __FUNCTION__, fsGraphPath.relative_path().u8string().c_str()); LoadNetworkGraphEx(pAINetworkManager, pBuffer, szAIGraphFile); @@ -376,7 +376,7 @@ void CAI_NetworkManager::LoadNetworkGraph(CAI_NetworkManager* pAINetworkManager, } else { - Error(eDLL_T::SERVER, NULL, "%s - AI node graph '%s' is corrupt\n", __FUNCTION__, + Error(eDLL_T::SERVER, NO_ERROR, "%s - AI node graph '%s' is corrupt\n", __FUNCTION__, fsGraphPath.relative_path().u8string().c_str()); } diff --git a/r5dev/networksystem/bansystem.cpp b/r5dev/networksystem/bansystem.cpp index 319eb382..02a5dc95 100644 --- a/r5dev/networksystem/bansystem.cpp +++ b/r5dev/networksystem/bansystem.cpp @@ -76,7 +76,7 @@ void CBanSystem::Save(void) const FileHandle_t pFile = FileSystem()->Open("banlist.json", "wt", "PLATFORM"); if (!pFile) { - Error(eDLL_T::SERVER, NULL, "%s - Unable to write to '%s' (read-only?)\n", __FUNCTION__, "banlist.json"); + Error(eDLL_T::SERVER, NO_ERROR, "%s - Unable to write to '%s' (read-only?)\n", __FUNCTION__, "banlist.json"); return; } diff --git a/r5dev/rtech/rtech_game.cpp b/r5dev/rtech/rtech_game.cpp index 6d62b1e2..3b5d11f0 100644 --- a/r5dev/rtech/rtech_game.cpp +++ b/r5dev/rtech/rtech_game.cpp @@ -51,12 +51,12 @@ RPakHandle_t CPakFile::LoadAsync(const char* szPakFileName, uintptr_t pMalloc, i if (pakHandle == INVALID_PAK_HANDLE) { - Error(eDLL_T::RTECH, NULL, "%s: Failed read '%s' results '%u'\n", __FUNCTION__, szPakFileName, pakHandle); + Error(eDLL_T::RTECH, NO_ERROR, "%s: Failed read '%s' results '%u'\n", __FUNCTION__, szPakFileName, pakHandle); } } else { - Error(eDLL_T::RTECH, NULL, "%s: Failed. File '%s' doesn't exist\n", __FUNCTION__, szPakFileName); + Error(eDLL_T::RTECH, NO_ERROR, "%s: Failed. File '%s' doesn't exist\n", __FUNCTION__, szPakFileName); } return pakHandle; diff --git a/r5dev/squirrel/sqscript.cpp b/r5dev/squirrel/sqscript.cpp index e21a8889..6ba41a46 100644 --- a/r5dev/squirrel/sqscript.cpp +++ b/r5dev/squirrel/sqscript.cpp @@ -258,14 +258,14 @@ void Script_Execute(const SQChar* code, SQCONTEXT context) CSquirrelVM* script = Script_GetContextObject(context); if (!script) { - Error(eDLL_T::ENGINE, NULL, "Attempted to run %s script with no handle to script context\n", SQVM_GetContextName(context)); + Error(eDLL_T::ENGINE, NO_ERROR, "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, NULL, "Attempted to run %s script while VM isn't initialized\n", SQVM_GetContextName(context)); + Error(eDLL_T::ENGINE, NO_ERROR, "Attempted to run %s script while VM isn't initialized\n", SQVM_GetContextName(context)); return; } diff --git a/r5dev/squirrel/sqvm.cpp b/r5dev/squirrel/sqvm.cpp index a032ddf8..740db93d 100644 --- a/r5dev/squirrel/sqvm.cpp +++ b/r5dev/squirrel/sqvm.cpp @@ -321,9 +321,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), NULL, "%s SCRIPT COMPILE ERROR: %s\n", SQVM_GetContextName(context), pszError); - Error(static_cast<eDLL_T>(context), NULL, " -> %s\n\n", szContextBuf); - Error(static_cast<eDLL_T>(context), NULL, "%s line [%d] column [%d]\n", pszFile, nLine, nColumn); + Error(static_cast<eDLL_T>(context), NO_ERROR, "%s SCRIPT COMPILE ERROR: %s\n", SQVM_GetContextName(context), pszError); + Error(static_cast<eDLL_T>(context), NO_ERROR, " -> %s\n\n", szContextBuf); + Error(static_cast<eDLL_T>(context), NO_ERROR, "%s line [%d] column [%d]\n", pszFile, nLine, nColumn); } //--------------------------------------------------------------------------------- diff --git a/r5dev/tier2/socketcreator.cpp b/r5dev/tier2/socketcreator.cpp index ec09e174..949b82b4 100644 --- a/r5dev/tier2/socketcreator.cpp +++ b/r5dev/tier2/socketcreator.cpp @@ -53,7 +53,7 @@ void CSocketCreator::ProcessAccept(void) if (!IsSocketBlocking()) { #ifndef NETCONSOLE - Error(eDLL_T::ENGINE, NULL, "Socket ProcessAccept Error: %s\n", NET_ErrorString(WSAGetLastError())); + Error(eDLL_T::ENGINE, NO_ERROR, "Socket ProcessAccept Error: %s\n", NET_ErrorString(WSAGetLastError())); #else printf("Socket ProcessAccept Error: %s\n", NET_ErrorString(WSAGetLastError())); #endif // !NETCONSOLE diff --git a/r5dev/vpklib/packedstore.cpp b/r5dev/vpklib/packedstore.cpp index aae71a1e..fe18fca8 100644 --- a/r5dev/vpklib/packedstore.cpp +++ b/r5dev/vpklib/packedstore.cpp @@ -576,7 +576,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, NULL, "Unsupported VPK directory file (invalid header criteria)\n"); + Error(eDLL_T::FS, NO_ERROR, "Unsupported VPK directory file (invalid header criteria)\n"); return; } BuildManifest(vDir.m_vEntryBlocks, svPathOut, GetSourceName(vDir.m_svDirPath)); @@ -600,7 +600,7 @@ void CPackedStore::UnpackAll(const VPKDir_t& vDir, const string& svPathOut) if (!oStream.IsWritable()) { - Error(eDLL_T::FS, NULL, "Unable to write file '%s'\n", svFilePath.c_str()); + Error(eDLL_T::FS, NO_ERROR, "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()); @@ -623,7 +623,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, NULL, "Status '%d' for chunk '%zu' within entry '%zu' in block '%hu' (chunk not decompressed)\n", + Error(eDLL_T::FS, NO_ERROR, "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. diff --git a/r5dev/vstdlib/callback.cpp b/r5dev/vstdlib/callback.cpp index 3e1ef6ff..4aecba86 100644 --- a/r5dev/vstdlib/callback.cpp +++ b/r5dev/vstdlib/callback.cpp @@ -187,7 +187,7 @@ void Host_KickID_f(const CCommand& args) } catch (const std::exception& e) { - Error(eDLL_T::SERVER, NULL, "%s - %s", __FUNCTION__, e.what()); + Error(eDLL_T::SERVER, NO_ERROR, "%s - %s", __FUNCTION__, e.what()); return; } } @@ -298,7 +298,7 @@ void Host_BanID_f(const CCommand& args) } catch (const std::exception& e) { - Error(eDLL_T::SERVER, NULL, "%s - %s", __FUNCTION__, e.what()); + Error(eDLL_T::SERVER, NO_ERROR, "%s - %s", __FUNCTION__, e.what()); return; } } @@ -334,7 +334,7 @@ void Host_Unban_f(const CCommand& args) } catch (const std::exception& e) { - Error(eDLL_T::SERVER, NULL, "%s - %s", __FUNCTION__, e.what()); + Error(eDLL_T::SERVER, NO_ERROR, "%s - %s", __FUNCTION__, e.what()); return; } } @@ -455,7 +455,7 @@ void Pak_RequestUnload_f(const CCommand& args) } catch (const std::exception& e) { - Error(eDLL_T::RTECH, NULL, "%s - %s", __FUNCTION__, e.what()); + Error(eDLL_T::RTECH, NO_ERROR, "%s - %s", __FUNCTION__, e.what()); return; } } @@ -518,7 +518,7 @@ void Pak_Swap_f(const CCommand& args) } catch (const std::exception& e) { - Error(eDLL_T::RTECH, NULL, "%s - %s", __FUNCTION__, e.what()); + Error(eDLL_T::RTECH, NO_ERROR, "%s - %s", __FUNCTION__, e.what()); return; } } @@ -570,7 +570,7 @@ void RTech_Decompress_f(const CCommand& args) if (!FileExists(pakNameIn)) { - Error(eDLL_T::RTECH, NULL, "%s - pak file '%s' does not exist!\n", __FUNCTION__, pakNameIn.c_str()); + Error(eDLL_T::RTECH, NO_ERROR, "%s - pak file '%s' does not exist!\n", __FUNCTION__, pakNameIn.c_str()); return; } @@ -594,17 +594,17 @@ void RTech_Decompress_f(const CCommand& args) if (rheader.m_nMagic != RPAKHEADER) { - Error(eDLL_T::RTECH, NULL, "%s - pak file '%s' has invalid magic!\n", __FUNCTION__, pakNameIn.c_str()); + Error(eDLL_T::RTECH, NO_ERROR, "%s - pak file '%s' has invalid magic!\n", __FUNCTION__, pakNameIn.c_str()); return; } if ((rheader.m_nFlags[1] & 1) != 1) { - Error(eDLL_T::RTECH, NULL, "%s - pak file '%s' already decompressed!\n", __FUNCTION__, pakNameIn.c_str()); + Error(eDLL_T::RTECH, NO_ERROR, "%s - pak file '%s' already decompressed!\n", __FUNCTION__, pakNameIn.c_str()); return; } if (rheader.m_nSizeDisk != reader.GetSize()) { - Error(eDLL_T::RTECH, NULL, "%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, NO_ERROR, "%s - pak file '%s' decompressed size '%zu' doesn't match expected value '%llu'!\n", __FUNCTION__, pakNameIn.c_str(), reader.GetSize(), rheader.m_nSizeMemory); return; } @@ -613,7 +613,7 @@ void RTech_Decompress_f(const CCommand& args) if (decompSize == rheader.m_nSizeDisk) { - Error(eDLL_T::RTECH, NULL, "%s - calculated size: '%llu' expected: '%llu'!\n", __FUNCTION__, decompSize, rheader.m_nSizeMemory); + Error(eDLL_T::RTECH, NO_ERROR, "%s - calculated size: '%llu' expected: '%llu'!\n", __FUNCTION__, decompSize, rheader.m_nSizeMemory); return; } else @@ -629,7 +629,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, NULL, "%s - decompression failed for '%s' return value: '%hu'!\n", __FUNCTION__, pakNameIn.c_str(), decompResult); + Error(eDLL_T::RTECH, NO_ERROR, "%s - decompression failed for '%s' return value: '%hu'!\n", __FUNCTION__, pakNameIn.c_str(), decompResult); return; } diff --git a/r5dev/windows/id3dx.cpp b/r5dev/windows/id3dx.cpp index 1de0e395..64995c05 100644 --- a/r5dev/windows/id3dx.cpp +++ b/r5dev/windows/id3dx.cpp @@ -474,7 +474,8 @@ void InstallDXHooks() DetourAttach(&(LPVOID&)g_oResizeBuffers, (PBYTE)GetResizeBuffers); // Commit the transaction - if (LONG hr = DetourTransactionCommit() != NO_ERROR) + HRESULT hr = DetourTransactionCommit(); + if (hr != NO_ERROR) { // Failed to hook into the process, terminate Error(eDLL_T::COMMON, 0xBAD0C0DE, "Failed to detour process: error code = %08x\n", hr);