wiiu: don't hardcode free memory

This commit is contained in:
GaryOderNichts 2020-12-28 21:30:04 +01:00
parent 676f71e2d1
commit 91893ff104
2 changed files with 14 additions and 3 deletions

View File

@ -222,7 +222,7 @@ CStreaming::Init2(void)
desiredNumVehiclesLoaded = (int32)((ms_memoryAvailable / MB - 50) / 3 + 12);
if(desiredNumVehiclesLoaded > MAXVEHICLESLOADED)
desiredNumVehiclesLoaded = MAXVEHICLESLOADED;
debug("Memory allocated to Streaming is %zuMB", ms_memoryAvailable/MB); // original modifier was %d
debug("Memory allocated to Streaming is %u", ms_memoryAvailable/MB);
#undef MB
#endif

View File

@ -13,6 +13,8 @@
#include <padscore/wpad.h>
#include <coreinit/time.h>
#include <coreinit/memheap.h>
#include <coreinit/memexpheap.h>
#include <stdio.h>
#include "rwcore.h"
@ -286,8 +288,17 @@ psInitialize(void)
#endif
// memory required to have all vehicles loaded
_dwMemAvailPhys = 1024*1024*170;
MEMHeapHandle heapHandle = MEMGetBaseHeapHandle(MEM_BASE_HEAP_MEM2);
if (heapHandle) {
_dwMemAvailPhys = MEMGetTotalFreeSizeForExpHeap(heapHandle);
}
else {
debug("Can't get heap handle");
// fall back to hardcoded value
_dwMemAvailPhys = 1024*1024*500;
}
debug("_dwMemAvailPhys: %u MB", _dwMemAvailPhys/1024/1024);
TheText.Unload();