1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-22 19:10:00 +00:00

Merge pull request #741 from ShFil119/fix/make_space

Fix unsigned comparison in CStreaming::MakeSpaceFor(int32 size)
This commit is contained in:
shfil 2020-10-04 22:02:28 +02:00 committed by GitHub
commit c31e3e6823
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2436,12 +2436,17 @@ CStreaming::DeleteRwObjectsNotInFrustumInSectorList(CPtrList &list, size_t mem)
void
CStreaming::MakeSpaceFor(int32 size)
{
// BUG: ms_memoryAvailable can be uninitialized
// the code still happens to work in that case because ms_memoryAvailable is unsigned
// but it's not nice....
#ifdef FIX_BUGS
#define MB (1024 * 1024)
if(ms_memoryAvailable == 0) {
extern size_t _dwMemAvailPhys;
ms_memoryAvailable = (_dwMemAvailPhys - 10 * MB) / 2;
if(ms_memoryAvailable < 50 * MB) ms_memoryAvailable = 50 * MB;
}
#undef MB
#endif
while(ms_memoryUsed >= ms_memoryAvailable - size)
if(!RemoveLeastUsedModel()){
if(!RemoveLeastUsedModel()) {
DeleteRwObjectsBehindCamera(ms_memoryAvailable - size);
return;
}