]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
make the win32 case compile too (hope it doesn't break TOO horribly above 4G RAM...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 10 Sep 2010 11:42:56 +0000 (11:42 +0000)
committerRudolf Polzer <divVerent@alientrap.org>
Fri, 10 Sep 2010 15:57:07 +0000 (17:57 +0200)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10453 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=abbafda6735457111f0fffa4e168d84b0a530d85

zone.c

diff --git a/zone.c b/zone.c
index 7a285ecc13d0e8ed767a84f0d7e2c937c11c4569..296e85507f69c875699a37f31572ed59719d597a 100644 (file)
--- 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 <windows.h>
+#include <winbase.h>
 #else
 #include <unistd.h>
 #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