From: divverent Date: Fri, 10 Sep 2010 11:42:56 +0000 (+0000) Subject: make the win32 case compile too (hope it doesn't break TOO horribly above 4G RAM... X-Git-Tag: xonotic-v0.1.0preview~238 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=50397a7c0335b205ff5908f15c6a2b704c40f2f2;p=xonotic%2Fdarkplaces.git make the win32 case compile too (hope it doesn't break TOO horribly above 4G RAM, someone please test) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10453 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=abbafda6735457111f0fffa4e168d84b0a530d85 --- diff --git a/zone.c b/zone.c index 7a285ecc..296e8550 100644 --- a/zone.c +++ b/zone.c @@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifdef WIN32 #include +#include #else #include #endif @@ -883,10 +884,11 @@ void Memory_Init_Commands (void) Cvar_RegisterVariable (&sys_memsize_virtual); #if defined(WIN32) +#ifdef _WIN64 { MEMORYSTATUSEX status; // first guess - Cvar_SetQuick(&sys_memsize_virtual, (sizeof(void*) == 4) ? 2048 : 8388608); + Cvar_SetValueQuick(&sys_memsize_virtual, 8388608); // then improve status.dwLength = sizeof(status); if(!GlobalMemoryStatusEx(&status)) @@ -895,6 +897,18 @@ void Memory_Init_Commands (void) Cvar_SetValueQuick(&sys_memsize_virtual, min(sys_memsize_virtual.value, status.ullTotalVirtual / 1048576.0)); } } +#else + { + MEMORYSTATUS status; + // first guess + Cvar_SetValueQuick(&sys_memsize_virtual, 2048); + // then improve + status.dwLength = sizeof(status); + GlobalMemoryStatus(&status); + Cvar_SetValueQuick(&sys_memsize_physical, status.dwTotalPhys / 1048576.0); + Cvar_SetValueQuick(&sys_memsize_virtual, min(sys_memsize_virtual.value, status.dwTotalVirtual / 1048576.0)); + } +#endif #else { // first guess