summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorshfil <filip.gawin@zoho.com>2020-10-04 22:02:28 +0200
committerGitHub <noreply@github.com>2020-10-04 22:02:28 +0200
commitc31e3e68235730e86c9a28e594cd6e1ee4f9520b (patch)
treeed7163e5c89cb3b2b01148691b88267dea1268b3 /src
parentMerge pull request #738 from erorcun/master (diff)
parentFix unsigned comparison in CStreaming::MakeSpaceFor(int32 size) (diff)
downloadre3-c31e3e68235730e86c9a28e594cd6e1ee4f9520b.tar
re3-c31e3e68235730e86c9a28e594cd6e1ee4f9520b.tar.gz
re3-c31e3e68235730e86c9a28e594cd6e1ee4f9520b.tar.bz2
re3-c31e3e68235730e86c9a28e594cd6e1ee4f9520b.tar.lz
re3-c31e3e68235730e86c9a28e594cd6e1ee4f9520b.tar.xz
re3-c31e3e68235730e86c9a28e594cd6e1ee4f9520b.tar.zst
re3-c31e3e68235730e86c9a28e594cd6e1ee4f9520b.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/Streaming.cpp15
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;
}