2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-01-17 09:07:54 +03:00
Bug: Sys_InitMemory are not sets '-heapsize'
This commit is contained in:
s1lentq 2016-02-27 21:50:45 +06:00
parent 7b3636c110
commit 0f6961c140
3 changed files with 17 additions and 19 deletions

View File

@ -263,7 +263,7 @@ qboolean Info_IsKeyImportant(const char *key)
return true; return true;
if (!Q_strcmp(key, "topcolor")) if (!Q_strcmp(key, "topcolor"))
return true; return true;
if (!Q_strcmp(key, "botomcolor")) if (!Q_strcmp(key, "bottomcolor"))
return true; return true;
if (!Q_strcmp(key, "cl_updaterate")) if (!Q_strcmp(key, "cl_updaterate"))
return true; return true;

View File

@ -346,42 +346,39 @@ NOXREF void Sys_ShutdownArgv(void)
void Sys_InitMemory(void) void Sys_InitMemory(void)
{ {
int i; int i;
//bool bDidDefault;//unsued?
i = COM_CheckParm("-heapsize"); i = COM_CheckParm("-heapsize");
if (i && i < Cmd_Argc() - 1) if (i && i < com_argc - 1)
host_parms.memsize = Q_atoi(Cmd_Argv(i + 1)) * 1024; host_parms.memsize = Q_atoi(com_argv[i + 1]) * 1024;
#ifdef _WIN32
MEMORYSTATUS lpBuffer;
if (host_parms.memsize < MINIMUM_WIN_MEMORY) if (host_parms.memsize < MINIMUM_WIN_MEMORY)
{ {
#ifdef _WIN32
MEMORYSTATUS lpBuffer;
lpBuffer.dwLength = sizeof(MEMORYSTATUS); lpBuffer.dwLength = sizeof(MEMORYSTATUS);
GlobalMemoryStatus(&lpBuffer); GlobalMemoryStatus(&lpBuffer);
if (lpBuffer.dwTotalPhys) if (lpBuffer.dwTotalPhys)
{ {
if (lpBuffer.dwTotalPhys < FIFTEEN_MB) if (lpBuffer.dwTotalPhys < FIFTEEN_MB)
Sys_Error("Available memory less than 15MB!!! %i", i); Sys_Error("Available memory less than 15MB!!! %i", host_parms.memsize);
host_parms.memsize = (int)(lpBuffer.dwTotalPhys >> 1); host_parms.memsize = (int)(lpBuffer.dwTotalPhys >> 1);
if ((signed int)host_parms.memsize < MINIMUM_WIN_MEMORY) if (host_parms.memsize < MINIMUM_WIN_MEMORY)
host_parms.memsize = MINIMUM_WIN_MEMORY; host_parms.memsize = MINIMUM_WIN_MEMORY;
} }
else else
host_parms.memsize = 0x8000000; host_parms.memsize = MAXIMUM_WIN_MEMORY;
if (g_bIsDedicatedServer) if (g_bIsDedicatedServer)
host_parms.memsize = MAXIMUM_DEDICATED_MEMORY; host_parms.memsize = DEFAULT_MEMORY;
}
#else #else
if ((signed int)host_parms.memsize <= 0xDFFFFFu) host_parms.memsize = DEFAULT_MEMORY;
host_parms.memsize = MAXIMUM_DEDICATED_MEMORY;
#endif // _WIN32 #endif // _WIN32
}
if ((signed int)host_parms.memsize > 0x8000000) if (host_parms.memsize > MAXIMUM_DEDICATED_MEMORY)
host_parms.memsize = 0x8000000; host_parms.memsize = MAXIMUM_DEDICATED_MEMORY;
if (COM_CheckParm("-minmemory")) if (COM_CheckParm("-minmemory"))
host_parms.memsize = MINIMUM_WIN_MEMORY; host_parms.memsize = MINIMUM_WIN_MEMORY;
@ -392,7 +389,7 @@ void Sys_InitMemory(void)
#endif // _WIN32 #endif // _WIN32
if (!host_parms.membase) if (!host_parms.membase)
Sys_Error("Unable to allocate %.2f MB\n", (float)(host_parms.memsize) / (1024.0f * 1024.0f)); Sys_Error("Unable to allocate %.2f MB\n", (float)host_parms.memsize / (1024.0f * 1024.0f));
} }
/* <906c2> ../engine/sys_dll2.cpp:626 */ /* <906c2> ../engine/sys_dll2.cpp:626 */

View File

@ -43,8 +43,9 @@
#define FIFTEEN_MB (15 * 1024 * 1024) #define FIFTEEN_MB (15 * 1024 * 1024)
#define MINIMUM_WIN_MEMORY 0x0e00000 #define MINIMUM_WIN_MEMORY 0x0e00000
#define WARNING_MEMORY 0x0200000 #define WARNING_MEMORY 0x0200000
#define MAXIMUM_WIN_MEMORY 0x2800000 // Ask for 40 MB max #define MAXIMUM_WIN_MEMORY 0x8000000 // Ask for 128 MB max
#define MAXIMUM_DEDICATED_MEMORY 0x2800000 // Ask for 40 MB max #define MAXIMUM_DEDICATED_MEMORY 0x8000000 // Ask for 128 MB max
#define DEFAULT_MEMORY 0x2800000
#ifdef HOOK_ENGINE #ifdef HOOK_ENGINE
#define dedicated_ (*pdedicated) #define dedicated_ (*pdedicated)