diff options
author | eray orçunus <erayorcunus@gmail.com> | 2020-10-05 13:24:45 +0200 |
---|---|---|
committer | eray orçunus <erayorcunus@gmail.com> | 2020-10-05 13:24:45 +0200 |
commit | 9db0d7bba14815a5f101c317b9ac2b0bae21d78b (patch) | |
tree | 33295112b0ba30c664097d5154c66000efb99f99 /src | |
parent | Fix Linux audio path (diff) | |
parent | Merge pull request #741 from ShFil119/fix/make_space (diff) | |
download | re3-9db0d7bba14815a5f101c317b9ac2b0bae21d78b.tar re3-9db0d7bba14815a5f101c317b9ac2b0bae21d78b.tar.gz re3-9db0d7bba14815a5f101c317b9ac2b0bae21d78b.tar.bz2 re3-9db0d7bba14815a5f101c317b9ac2b0bae21d78b.tar.lz re3-9db0d7bba14815a5f101c317b9ac2b0bae21d78b.tar.xz re3-9db0d7bba14815a5f101c317b9ac2b0bae21d78b.tar.zst re3-9db0d7bba14815a5f101c317b9ac2b0bae21d78b.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/Streaming.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index 507815fa..4e12ab6d 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -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; } |