From 6f65394d97e046763ac488feb51b8a42a93d2319 Mon Sep 17 00:00:00 2001 From: Pat Raynor Date: Fri, 1 Aug 2014 02:36:04 -0400 Subject: [PATCH] Removed the useless Sys_GetSystemRam and Sys_GetVideoRam --- neo/sys/posix/platform_linux.cpp | 29 ----------- neo/sys/posix/platform_osx.cpp | 26 ---------- neo/sys/sys_public.h | 6 --- neo/sys/win32/win_main.cpp | 2 - neo/sys/win32/win_shared.cpp | 87 -------------------------------- 5 files changed, 150 deletions(-) diff --git a/neo/sys/posix/platform_linux.cpp b/neo/sys/posix/platform_linux.cpp index 8342a00e..22ddc841 100644 --- a/neo/sys/posix/platform_linux.cpp +++ b/neo/sys/posix/platform_linux.cpp @@ -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 diff --git a/neo/sys/posix/platform_osx.cpp b/neo/sys/posix/platform_osx.cpp index dd484003..05d09dcd 100644 --- a/neo/sys/posix/platform_osx.cpp +++ b/neo/sys/posix/platform_osx.cpp @@ -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 diff --git a/neo/sys/sys_public.h b/neo/sys/sys_public.h index 8fc66034..24cfc3e1 100644 --- a/neo/sys/sys_public.h +++ b/neo/sys/sys_public.h @@ -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 ); diff --git a/neo/sys/win32/win_main.cpp b/neo/sys/win32/win_main.cpp index 7b58153d..157d1e0f 100644 --- a/neo/sys/win32/win_main.cpp +++ b/neo/sys/win32/win_main.cpp @@ -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!" ); } diff --git a/neo/sys/win32/win_shared.cpp b/neo/sys/win32/win_shared.cpp index bae1b630..88a6d35d 100644 --- a/neo/sys/win32/win_shared.cpp +++ b/neo/sys/win32/win_shared.cpp @@ -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 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 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 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 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