summaryrefslogtreecommitdiffstats
path: root/src/core/Streaming.cpp
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-10-05 13:26:42 +0200
committereray orçunus <erayorcunus@gmail.com>2020-10-05 13:26:42 +0200
commitc5a61b3d3bccdbed385b68c48c7afb7d881f364d (patch)
tree140b4f6dcca75ca3701223b1c7098c6d69dd258c /src/core/Streaming.cpp
parentFix some sanitizer errors, improve POSIX streamer (diff)
parentMerge branch 'master' of https://github.com/GTAmodding/re3 into audioFix (diff)
downloadre3-c5a61b3d3bccdbed385b68c48c7afb7d881f364d.tar
re3-c5a61b3d3bccdbed385b68c48c7afb7d881f364d.tar.gz
re3-c5a61b3d3bccdbed385b68c48c7afb7d881f364d.tar.bz2
re3-c5a61b3d3bccdbed385b68c48c7afb7d881f364d.tar.lz
re3-c5a61b3d3bccdbed385b68c48c7afb7d881f364d.tar.xz
re3-c5a61b3d3bccdbed385b68c48c7afb7d881f364d.tar.zst
re3-c5a61b3d3bccdbed385b68c48c7afb7d881f364d.zip
Diffstat (limited to 'src/core/Streaming.cpp')
-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 4d14ff63..3c5689fd 100644
--- a/src/core/Streaming.cpp
+++ b/src/core/Streaming.cpp
@@ -2556,12 +2556,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;
}