diff --git a/r5dev/core/init.cpp b/r5dev/core/init.cpp index eb74afeb..64f9a2d6 100644 --- a/r5dev/core/init.cpp +++ b/r5dev/core/init.cpp @@ -306,19 +306,19 @@ void CheckCPU() // Respawn's engine and our SDK utilize POPCNT, SSE3 and SSSE3 ( { V_snprintf(szBuf, sizeof(szBuf), "CPU does not have %s!\n", "SSE 3"); MessageBoxA(NULL, szBuf, "Unsupported CPU", MB_ICONERROR | MB_OK); - ExitProcess(-1); + ExitProcess(0xFFFFFFFF); } if (!pi.m_bSSSE3) { V_snprintf(szBuf, sizeof(szBuf), "CPU does not have %s!\n", "SSSE 3 (Supplemental SSE 3 Instructions)"); MessageBoxA(NULL, szBuf, "Unsupported CPU", MB_ICONERROR | MB_OK); - ExitProcess(-1); + ExitProcess(0xFFFFFFFF); } if (!pi.m_bPOPCNT) { V_snprintf(szBuf, sizeof(szBuf), "CPU does not have %s!\n", "POPCNT"); MessageBoxA(NULL, szBuf, "Unsupported CPU", MB_ICONERROR | MB_OK); - ExitProcess(-1); + ExitProcess(0xFFFFFFFF); } } diff --git a/r5dev/engine/cmodel_bsp.cpp b/r5dev/engine/cmodel_bsp.cpp index b13a2d81..13e4422b 100644 --- a/r5dev/engine/cmodel_bsp.cpp +++ b/r5dev/engine/cmodel_bsp.cpp @@ -119,7 +119,7 @@ __int64 __fastcall Mod_GetQueuedPakHandle(char* a1, char* a2, __int64 a3) while ((v10[-v4] & 0xC0) == 0x80); } v11 = &v10[-v4]; - if (v4 != ((0xE5000000 >> (((unsigned __int8)*v11 >> 3) & 0x1E)) & 3)) + if (v4 != signed int(((0xE5000000 >> (((unsigned __int8)*v11 >> 3) & 0x1E)) & 3))) { *v11 = 0; v5 -= v4; @@ -265,7 +265,7 @@ void Mod_ProcessPakQueue() if (v13 && (unsigned int)(v13 - 13) > 1) return; *((_WORD*)v10 + 2) = 0; - *(_DWORD*)v10 = -1; + *(_DWORD*)v10 = 0xFFFFFFFF; } --v9; v10 -= 280; @@ -291,7 +291,7 @@ void Mod_ProcessPakQueue() Mod_GetQueuedPakHandle(v17, *((char**)v15 + 34), 260i64); if (v15[5]) break; - *(_DWORD*)v15 = -1; + *(_DWORD*)v15 = 0xFFFFFFFF; LABEL_40: ++v16; v15 += 280; @@ -356,7 +356,7 @@ void Mod_ProcessPakQueue() #else v22 = 184i64 * (v21 & 0x1FF); #endif - if (*(_DWORD*)((char*)&*g_pLoadedPakInfo + v22) != v21 || ((*(_DWORD*)((char*)&*g_pLoadedPakInfo + v22 + 4) - 9) & 0xFFFFFFFB) != 0) + if (*(_DWORD*)((char*)&*g_pLoadedPakInfo + v22) != _DWORD(v21) || ((*(_DWORD*)((char*)&*g_pLoadedPakInfo + v22 + 4) - 9) & 0xFFFFFFFB) != 0) { *byte_16709DDDF = 0; return; } diff --git a/r5dev/game/shared/ai_utility_shared.cpp b/r5dev/game/shared/ai_utility_shared.cpp index 0bf2601c..5e619ac5 100644 --- a/r5dev/game/shared/ai_utility_shared.cpp +++ b/r5dev/game/shared/ai_utility_shared.cpp @@ -533,7 +533,7 @@ int CAI_Utility::GetNearestNodeToPos(const CAI_Network* pAINetwork, const Vector v3 = pAINetwork->m_iNumScriptNodes; v4 = 0i64; v5 = 640000.0; - v6 = NO_NODE; + v6 = unsigned int(NO_NODE); if (v3 >= 4) { v7 = pAINetwork->m_ScriptNode; diff --git a/r5dev/gameui/IConsole.cpp b/r5dev/gameui/IConsole.cpp index 35c2378e..e612fc98 100644 --- a/r5dev/gameui/IConsole.cpp +++ b/r5dev/gameui/IConsole.cpp @@ -384,7 +384,7 @@ void CConsole::SuggestPanel(void) for (size_t i = 0, ns = m_vSuggest.size(); i < ns; i++) { const CSuggest& suggest = m_vSuggest[i]; - const bool bIsIndexActive = m_nSuggestPos == i; + const bool bIsIndexActive = m_nSuggestPos == ssize_t(i); ImGui::PushID(static_cast(i)); diff --git a/r5dev/public/utility/module.cpp b/r5dev/public/utility/module.cpp index 7814bda2..1ef232de 100644 --- a/r5dev/public/utility/module.cpp +++ b/r5dev/public/utility/module.cpp @@ -12,7 +12,8 @@ // Purpose: constructor // Input : *svModuleName //----------------------------------------------------------------------------- -CModule::CModule(const string& svModuleName) : m_svModuleName(svModuleName) +CModule::CModule(const string& svModuleName) + : m_svModuleName(svModuleName) { m_pModuleBase = reinterpret_cast(GetModuleHandleA(svModuleName.c_str())); @@ -24,7 +25,9 @@ CModule::CModule(const string& svModuleName) : m_svModuleName(svModuleName) // Purpose: constructor // Input : nModuleBase //----------------------------------------------------------------------------- -CModule::CModule(const uintptr_t nModuleBase, const string& svModuleName) : m_svModuleName(svModuleName), m_pModuleBase(nModuleBase) +CModule::CModule(const uintptr_t nModuleBase, const string& svModuleName) + : m_svModuleName(svModuleName) + , m_pModuleBase(nModuleBase) { Init(); LoadSections(); @@ -67,7 +70,7 @@ void CModule::LoadSections() // *szMask - // Output : CMemory //----------------------------------------------------------------------------- -CMemory CModule::FindPatternSIMD(const uint8_t* szPattern, const char* szMask, const ModuleSections_t* moduleSection, const uint32_t nOccurrence) const +CMemory CModule::FindPatternSIMD(const uint8_t* szPattern, const char* szMask, const ModuleSections_t* moduleSection, const size_t nOccurrence) const { if (!m_ExecutableCode.IsSectionValid()) return CMemory(); @@ -81,7 +84,7 @@ CMemory CModule::FindPatternSIMD(const uint8_t* szPattern, const char* szMask, c const uint8_t* pData = reinterpret_cast(nBase); const uint8_t* pEnd = pData + nSize - nMaskLen; - int nOccurrenceCount = 0; + size_t nOccurrenceCount = 0; int nMasks[64]; // 64*16 = enough masks for 1024 bytes. const int iNumMasks = static_cast(ceil(static_cast(nMaskLen) / 16.f)); @@ -274,9 +277,9 @@ CMemory CModule::FindString(const string& svString, const ptrdiff_t nOccurrence, // Purpose: get address of a virtual method table by rtti type descriptor name. // Input : *svTableName - // nRefIndex - -// Output : CMemory +// Output : address of virtual method table, null if not found. //----------------------------------------------------------------------------- -CMemory CModule::GetVirtualMethodTable(const string& svTableName, const uint32_t nRefIndex) +CMemory CModule::GetVirtualMethodTable(const string& svTableName, const size_t nRefIndex) { uint64_t nRVA; // Packed together as we can have multiple VFTable searches, but with different ref indexes. string svPackedTableName = svTableName + std::to_string(nRefIndex); diff --git a/r5dev/public/utility/module.h b/r5dev/public/utility/module.h index 7dd96a84..4eec0087 100644 --- a/r5dev/public/utility/module.h +++ b/r5dev/public/utility/module.h @@ -31,7 +31,7 @@ public: CMemory FindString(const string& string, const ptrdiff_t occurrence = 1, bool nullTerminator = false) const; CMemory FindStringReadOnly(const string& svString, bool nullTerminator) const; - CMemory GetVirtualMethodTable(const string& svTableName, const uint32_t nRefIndex = 0); + CMemory GetVirtualMethodTable(const string& svTableName, const size_t nRefIndex = 0); #endif // !PLUGINSDK CMemory GetImportedFunction(const string& svModuleName, const string& svFunctionName, const bool bGetFunctionReference) const; CMemory GetExportedFunction(const string& svFunctionName) const; @@ -50,7 +50,7 @@ public: ModuleSections_t m_ReadOnlyData; private: - CMemory FindPatternSIMD(const uint8_t* szPattern, const char* szMask, const ModuleSections_t* moduleSection = nullptr, const uint32_t nOccurrence = 0) const; + CMemory FindPatternSIMD(const uint8_t* szPattern, const char* szMask, const ModuleSections_t* moduleSection = nullptr, const size_t nOccurrence = 0) const; string m_svModuleName; uintptr_t m_pModuleBase{}; diff --git a/r5dev/rtech/rtech_utils.cpp b/r5dev/rtech/rtech_utils.cpp index 1051fffb..46116704 100644 --- a/r5dev/rtech/rtech_utils.cpp +++ b/r5dev/rtech/rtech_utils.cpp @@ -503,7 +503,7 @@ void RTech::CreateDXTexture(TextureHeader_t* textureHeader, int64_t imageData) textureHeader->m_nTextureMipLevels = textureHeader->m_nPermanentMipCount; const int totalStreamedMips = textureHeader->m_nOptStreamedMipCount + textureHeader->m_nStreamedMipCount; - uint32_t mipLevel = textureHeader->m_nPermanentMipCount + totalStreamedMips; + int mipLevel = textureHeader->m_nPermanentMipCount + totalStreamedMips; if (mipLevel != totalStreamedMips) { do diff --git a/r5dev/tier0/crashhandler.cpp b/r5dev/tier0/crashhandler.cpp index 19fe68cb..fe2e9bf9 100644 --- a/r5dev/tier0/crashhandler.cpp +++ b/r5dev/tier0/crashhandler.cpp @@ -535,7 +535,7 @@ long __stdcall BottomLevelExceptionFilter(EXCEPTION_POINTERS* pExceptionInfo) g_CrashHandler->SetExceptionPointers(pExceptionInfo); // Let the higher level exception handlers deal with this particular exception. - if (g_CrashHandler->ExceptionToString() == g_CrashHandler->ExceptionToString(-1)) + if (g_CrashHandler->ExceptionToString() == g_CrashHandler->ExceptionToString(0xFFFFFFFF)) { g_CrashHandler->End(); return EXCEPTION_CONTINUE_SEARCH; diff --git a/r5dev/tier1/bitbuf.cpp b/r5dev/tier1/bitbuf.cpp index 858be410..ca3b2181 100644 --- a/r5dev/tier1/bitbuf.cpp +++ b/r5dev/tier1/bitbuf.cpp @@ -163,7 +163,7 @@ bool CBitRead::ReadString(char* pStr, int maxLen, bool bLine, int* pOutNumChars) int iChar = 0; while (1) { - char val = ReadChar(); + char val = char(ReadChar()); if (val == 0) break; else if (bLine && val == '\n') @@ -189,7 +189,7 @@ bool CBitRead::ReadString(char* pStr, int maxLen, bool bLine, int* pOutNumChars) return !IsOverflowed() && !bTooSmall; } -bool CBitRead::Seek(size_t nPosition) +bool CBitRead::Seek(int64_t nPosition) { bool bSucc = true; if (nPosition < 0 || nPosition > m_nDataBits) @@ -239,7 +239,7 @@ bool CBitRead::Seek(size_t nPosition) return bSucc; } -void CBitRead::StartReading(const void* pData, size_t nBytes, size_t iStartBit, size_t nBits) +void CBitRead::StartReading(const void* pData, size_t nBytes, int64_t iStartBit, int64_t nBits) { // Make sure it's dword aligned and padded. assert(((unsigned long)pData & 3) == 0); diff --git a/r5dev/tier1/bitbuf.h b/r5dev/tier1/bitbuf.h index ba1c2804..a7b23ae1 100644 --- a/r5dev/tier1/bitbuf.h +++ b/r5dev/tier1/bitbuf.h @@ -26,7 +26,7 @@ public: //////////////////////////////////// const char* m_pDebugName; uint8_t m_bOverflow; - size_t m_nDataBits; + int64_t m_nDataBits; size_t m_nDataBytes; }; @@ -43,8 +43,8 @@ public: int ReadChar(); bool ReadString(char* pStr, int bufLen, bool bLine = false, int* pOutNumChars = nullptr); - void StartReading(const void* pData, size_t nBytes, size_t iStartBit = 0, size_t nBits = -1); - bool Seek(size_t nPosition); + void StartReading(const void* pData, size_t nBytes, int64_t iStartBit = 0, int64_t nBits = -1); + bool Seek(int64_t nPosition); //////////////////////////////////// uint32_t m_nInBufWord; diff --git a/r5dev/tier1/strtools.cpp b/r5dev/tier1/strtools.cpp index db01113f..073d4845 100644 --- a/r5dev/tier1/strtools.cpp +++ b/r5dev/tier1/strtools.cpp @@ -265,7 +265,7 @@ bool V_StringMatchesPattern(const char* pszSource, const char* pszPattern, int n continue; } - size_t nLength = 0; + ptrdiff_t nLength = 0; while ((*pszPattern) != '*' && (*pszPattern) != 0) { @@ -278,7 +278,7 @@ bool V_StringMatchesPattern(const char* pszSource, const char* pszPattern, int n const char* pszStartPattern = pszPattern - nLength; const char* pszSearch = pszSource; - for (size_t i = 0; i < nLength; i++, pszSearch++, pszStartPattern++) + for (ptrdiff_t i = 0; i < nLength; i++, pszSearch++, pszStartPattern++) { if ((*pszSearch) == 0) {