mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-04-23 10:12:59 +00:00
Get RAM in MB. #87
This commit is contained in:
parent
812fb78d52
commit
9b4f849cd5
1 changed files with 5 additions and 2 deletions
|
@ -427,6 +427,8 @@ returns in megabytes
|
|||
*/
|
||||
int Sys_GetSystemRam()
|
||||
{
|
||||
int mb;
|
||||
|
||||
#if defined(__APPLE__)
|
||||
int mib[2];
|
||||
mib[0] = CTL_HW;
|
||||
|
@ -435,14 +437,15 @@ int Sys_GetSystemRam()
|
|||
size_t len = sizeof( size );
|
||||
if ( sysctl( mib, 2, &size, &len, NULL, 0 ) == 0 )
|
||||
{
|
||||
return size;
|
||||
mb = size / ( 1024 * 1024 );
|
||||
mb = ( mb + 8 ) & ~15;
|
||||
return mb;
|
||||
}
|
||||
|
||||
common->Printf( "GetSystemRam: sysctl HW_MEMSIZE failed\n" );
|
||||
return 512;
|
||||
#else
|
||||
long count, page_size;
|
||||
int mb;
|
||||
|
||||
count = sysconf( _SC_PHYS_PAGES );
|
||||
if( count == -1 )
|
||||
|
|
Loading…
Reference in a new issue