Removed the useless Sys_GetSystemRam and Sys_GetVideoRam

This commit is contained in:
Pat Raynor 2014-08-01 02:36:04 -04:00
parent afeab489dd
commit 6f65394d97
5 changed files with 0 additions and 150 deletions

View file

@ -258,35 +258,6 @@ void Sys_CPUCount( int& numLogicalCPUCores, int& numPhysicalCPUCores, int& numCP
}
// RB end
/*
================
Sys_GetSystemRam
returns in megabytes
================
*/
int Sys_GetSystemRam()
{
int mb;
long count, page_size;
count = sysconf( _SC_PHYS_PAGES );
if( count == -1 )
{
common->Printf( "GetSystemRam: sysconf _SC_PHYS_PAGES failed\n" );
return 512;
}
page_size = sysconf( _SC_PAGE_SIZE );
if( page_size == -1 )
{
common->Printf( "GetSystemRam: sysconf _SC_PAGE_SIZE failed\n" );
return 512;
}
mb = ( int )( ( double )count * ( double )page_size / ( 1024 * 1024 ) );
// round to the nearest 16Mb
mb = ( mb + 8 ) & ~15;
return mb;
}
/*
==================
Sys_DoStartProcess

View file

@ -166,32 +166,6 @@ void Sys_CPUCount( int& numLogicalCPUCores, int& numPhysicalCPUCores, int& numCP
}
// RB end
/*
================
Sys_GetSystemRam
returns in megabytes
================
*/
int Sys_GetSystemRam()
{
int mb, mib[2];
mib[0] = CTL_HW;
mib[1] = HW_MEMSIZE;
int64_t size = 0;
size_t len = sizeof( size );
if( sysctl( mib, 2, &size, &len, NULL, 0 ) == 0 )
{
mb = size / ( 1024 * 1024 );
mb = ( mb + 8 ) & ~15;
return mb;
}
common->Printf( "GetSystemRam: sysctl HW_MEMSIZE failed\n" );
return 512;
}
/*
==================
Sys_DoStartProcess

View file

@ -498,12 +498,6 @@ void Sys_FPU_SetFTZ( bool enable );
// sets Denormals-Are-Zero mode (only available when CPUID_DAZ is set)
void Sys_FPU_SetDAZ( bool enable );
// returns amount of system ram
int Sys_GetSystemRam();
// returns amount of video ram
int Sys_GetVideoRam();
// returns amount of drive space in path
int Sys_GetDriveFreeSpace( const char* path );

View file

@ -1255,8 +1255,6 @@ void Sys_Init() {
}
common->Printf( "%s\n", win32.sys_cpustring.GetString() );
common->Printf( "%d MB System Memory\n", Sys_GetSystemRam() );
common->Printf( "%d MB Video Memory\n", Sys_GetVideoRam() );
if ( ( win32.cpuid & CPUID_SSE2 ) == 0 ) {
common->Error( "SSE2 not supported!" );
}

View file

@ -92,25 +92,6 @@ uint64 Sys_Microseconds()
return ( ( uint64 )( ( int64 )Sys_GetClockTicks() << 10 ) ) / ticksPerMicrosecondTimes1024;
}
/*
================
Sys_GetSystemRam
returns amount of physical memory in MB
================
*/
int Sys_GetSystemRam()
{
MEMORYSTATUSEX statex;
statex.dwLength = sizeof( statex );
GlobalMemoryStatusEx( &statex );
int physRam = statex.ullTotalPhys / ( 1024 * 1024 );
// HACK: For some reason, ullTotalPhys is sometimes off by a meg or two, so we round up to the nearest 16 megs
physRam = ( physRam + 8 ) & ~15;
return physRam;
}
/*
================
Sys_GetDriveFreeSpace
@ -150,74 +131,6 @@ int64 Sys_GetDriveFreeSpaceInBytes( const char* path )
return ret;
}
/*
================
Sys_GetVideoRam
returns in megabytes
================
*/
int Sys_GetVideoRam()
{
unsigned int retSize = 64;
// RB begin
#if !defined(__MINGW32__)
CComPtr<IWbemLocator> spLoc = NULL;
HRESULT hr = CoCreateInstance( CLSID_WbemLocator, 0, CLSCTX_SERVER, IID_IWbemLocator, ( LPVOID* ) &spLoc );
if( hr != S_OK || spLoc == NULL )
{
return retSize;
}
CComBSTR bstrNamespace( _T( "\\\\.\\root\\CIMV2" ) );
CComPtr<IWbemServices> spServices;
// Connect to CIM
hr = spLoc->ConnectServer( bstrNamespace, NULL, NULL, 0, NULL, 0, 0, &spServices );
if( hr != WBEM_S_NO_ERROR )
{
return retSize;
}
// Switch the security level to IMPERSONATE so that provider will grant access to system-level objects.
hr = CoSetProxyBlanket( spServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE );
if( hr != S_OK )
{
return retSize;
}
// Get the vid controller
CComPtr<IEnumWbemClassObject> spEnumInst = NULL;
hr = spServices->CreateInstanceEnum( CComBSTR( "Win32_VideoController" ), WBEM_FLAG_SHALLOW, NULL, &spEnumInst );
if( hr != WBEM_S_NO_ERROR || spEnumInst == NULL )
{
return retSize;
}
ULONG uNumOfInstances = 0;
CComPtr<IWbemClassObject> spInstance = NULL;
hr = spEnumInst->Next( 10000, 1, &spInstance, &uNumOfInstances );
if( hr == S_OK && spInstance )
{
// Get properties from the object
CComVariant varSize;
hr = spInstance->Get( CComBSTR( _T( "AdapterRAM" ) ), 0, &varSize, 0, 0 );
if( hr == S_OK )
{
retSize = varSize.intVal / ( 1024 * 1024 );
if( retSize == 0 )
{
retSize = 64;
}
}
}
#endif
// RB end
return retSize;
}
/*
================
Sys_GetCurrentMemoryStatus