]> 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)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 10 Sep 2010 11:42:56 +0000 (11:42 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10453 d7cf8633-e32d-0410-b094-e92efae38249

zone.c

diff --git a/zone.c b/zone.c
index e90df30bff1283333b035af9e8cea2f007c527b4..fb314e4b535375280c024f7c41f7b7b940b60af3 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