Work around weird issue with Bgetsysmemsize() that occurs on exactly one system we've tested

git-svn-id: https://svn.eduke32.com/eduke32@7319 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-01-30 00:13:00 +00:00
parent 43d140eaee
commit 61c74f25aa

View file

@ -589,17 +589,18 @@ uint32_t Bgetsysmemsize(void)
MEMORYSTATUSEX memst; MEMORYSTATUSEX memst;
memst.dwLength = sizeof(MEMORYSTATUSEX); memst.dwLength = sizeof(MEMORYSTATUSEX);
if (aGlobalMemoryStatusEx(&memst)) if (aGlobalMemoryStatusEx(&memst))
siz = min<uint32_t>(UINT32_MAX, memst.ullTotalPhys); siz = min<decltype(memst.ullTotalPhys)>(UINT32_MAX, memst.ullTotalPhys);
} }
else
if (siz == UINT32_MAX || siz == 0)
{ {
// Yeah, there's enough Win9x hatred here that a perfectly good workaround
// has been replaced by an error message. Oh well, we don't support 9x anyway.
initprintf("Bgetsysmemsize(): error determining system memory size!\n"); initprintf("Bgetsysmemsize(): error determining system memory size!\n");
siz = UINT32_MAX;
} }
FreeLibrary(lib); FreeLibrary(lib);
} }
else initprintf("Bgetsysmemsize(): unable to load KERNEL32.DLL!\n");
return siz; return siz;
#elif (defined(_SC_PAGE_SIZE) || defined(_SC_PAGESIZE)) && defined(_SC_PHYS_PAGES) && !defined(GEKKO) #elif (defined(_SC_PAGE_SIZE) || defined(_SC_PAGESIZE)) && defined(_SC_PHYS_PAGES) && !defined(GEKKO)