mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2024-12-02 08:51:57 +00:00
Formatted code
This commit is contained in:
parent
5e582222cf
commit
afaf66ef40
17 changed files with 237 additions and 200 deletions
|
@ -1,4 +1,4 @@
|
||||||
astyle.exe -v --options=astyle-options.ini --exclude="libs" --recursive *.h
|
astyle.exe -v --options=astyle-options.ini --exclude="libs" --recursive *.h
|
||||||
astyle.exe -v --options=astyle-options.ini --exclude="libs" --exclude="idlib/math/Simd.cpp" --exclude="d3xp/gamesys/SysCvar.cpp" --exclude="d3xp/gamesys/Callbacks.cpp" --exclude="sys/win32/win_cpu.cpp" --exclude="sys/win32/win_main.cpp" --exclude="sys/win32/win_shared.cpp" --recursive *.cpp
|
astyle.exe -v --options=astyle-options.ini --exclude="libs" --exclude="idlib/math/Simd.cpp" --exclude="d3xp/gamesys/SysCvar.cpp" --exclude="d3xp/gamesys/Callbacks.cpp" --exclude="sys/win32/win_cpu.cpp" --exclude="sys/win32/win_main.cpp" --recursive *.cpp
|
||||||
|
|
||||||
pause
|
pause
|
|
@ -61,15 +61,21 @@ public:
|
||||||
|
|
||||||
// Sends new position/volume/pitch information to the hardware
|
// Sends new position/volume/pitch information to the hardware
|
||||||
bool Update()
|
bool Update()
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// returns the RMS levels of the most recently processed block of audio, SSF_FLICKER must have been passed to Start
|
// returns the RMS levels of the most recently processed block of audio, SSF_FLICKER must have been passed to Start
|
||||||
float GetAmplitude()
|
float GetAmplitude()
|
||||||
{ return 0.0f; }
|
{
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
// returns true if we can re-use this voice
|
// returns true if we can re-use this voice
|
||||||
bool CompatibleFormat( idSoundSample* s )
|
bool CompatibleFormat( idSoundSample* s )
|
||||||
{ return false; }
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 GetSampleRate() const
|
uint32 GetSampleRate() const
|
||||||
{
|
{
|
||||||
|
@ -92,18 +98,26 @@ public:
|
||||||
|
|
||||||
// FIXME: this is a bad name when having multiple sound backends... and maybe it's not even needed
|
// FIXME: this is a bad name when having multiple sound backends... and maybe it's not even needed
|
||||||
void* GetIXAudio2() const // NOTE: originally this returned IXAudio2*, but that was casted to void later anyway
|
void* GetIXAudio2() const // NOTE: originally this returned IXAudio2*, but that was casted to void later anyway
|
||||||
{ return NULL; }
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
idSoundVoice* AllocateVoice( const idSoundSample* leadinSample, const idSoundSample* loopingSample )
|
idSoundVoice* AllocateVoice( const idSoundSample* leadinSample, const idSoundSample* loopingSample )
|
||||||
{ return NULL; }
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void FreeVoice( idSoundVoice* voice ) {}
|
void FreeVoice( idSoundVoice* voice ) {}
|
||||||
|
|
||||||
int GetNumZombieVoices() const
|
int GetNumZombieVoices() const
|
||||||
{ return 0; }
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int GetNumFreeVoices() const
|
int GetNumFreeVoices() const
|
||||||
{ return 0; }
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,8 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
Sys_Milliseconds
|
Sys_Milliseconds
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
int Sys_Milliseconds() {
|
int Sys_Milliseconds()
|
||||||
|
{
|
||||||
static DWORD sys_timeBase = timeGetTime();
|
static DWORD sys_timeBase = timeGetTime();
|
||||||
return timeGetTime() - sys_timeBase;
|
return timeGetTime() - sys_timeBase;
|
||||||
}
|
}
|
||||||
|
@ -78,10 +79,12 @@ int Sys_Milliseconds() {
|
||||||
Sys_Microseconds
|
Sys_Microseconds
|
||||||
========================
|
========================
|
||||||
*/
|
*/
|
||||||
uint64 Sys_Microseconds() {
|
uint64 Sys_Microseconds()
|
||||||
|
{
|
||||||
static uint64 ticksPerMicrosecondTimes1024 = 0;
|
static uint64 ticksPerMicrosecondTimes1024 = 0;
|
||||||
|
|
||||||
if ( ticksPerMicrosecondTimes1024 == 0 ) {
|
if( ticksPerMicrosecondTimes1024 == 0 )
|
||||||
|
{
|
||||||
ticksPerMicrosecondTimes1024 = ( ( uint64 )Sys_ClockTicksPerSecond() << 10 ) / 1000000;
|
ticksPerMicrosecondTimes1024 = ( ( uint64 )Sys_ClockTicksPerSecond() << 10 ) / 1000000;
|
||||||
assert( ticksPerMicrosecondTimes1024 > 0 );
|
assert( ticksPerMicrosecondTimes1024 > 0 );
|
||||||
}
|
}
|
||||||
|
@ -96,7 +99,8 @@ Sys_GetSystemRam
|
||||||
returns amount of physical memory in MB
|
returns amount of physical memory in MB
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
int Sys_GetSystemRam() {
|
int Sys_GetSystemRam()
|
||||||
|
{
|
||||||
MEMORYSTATUSEX statex;
|
MEMORYSTATUSEX statex;
|
||||||
statex.dwLength = sizeof( statex );
|
statex.dwLength = sizeof( statex );
|
||||||
GlobalMemoryStatusEx( &statex );
|
GlobalMemoryStatusEx( &statex );
|
||||||
|
@ -113,13 +117,15 @@ Sys_GetDriveFreeSpace
|
||||||
returns in megabytes
|
returns in megabytes
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
int Sys_GetDriveFreeSpace( const char *path ) {
|
int Sys_GetDriveFreeSpace( const char* path )
|
||||||
|
{
|
||||||
DWORDLONG lpFreeBytesAvailable;
|
DWORDLONG lpFreeBytesAvailable;
|
||||||
DWORDLONG lpTotalNumberOfBytes;
|
DWORDLONG lpTotalNumberOfBytes;
|
||||||
DWORDLONG lpTotalNumberOfFreeBytes;
|
DWORDLONG lpTotalNumberOfFreeBytes;
|
||||||
int ret = 26;
|
int ret = 26;
|
||||||
//FIXME: see why this is failing on some machines
|
//FIXME: see why this is failing on some machines
|
||||||
if ( ::GetDiskFreeSpaceEx( path, (PULARGE_INTEGER)&lpFreeBytesAvailable, (PULARGE_INTEGER)&lpTotalNumberOfBytes, (PULARGE_INTEGER)&lpTotalNumberOfFreeBytes ) ) {
|
if( ::GetDiskFreeSpaceEx( path, ( PULARGE_INTEGER )&lpFreeBytesAvailable, ( PULARGE_INTEGER )&lpTotalNumberOfBytes, ( PULARGE_INTEGER )&lpTotalNumberOfFreeBytes ) )
|
||||||
|
{
|
||||||
ret = ( double )( lpFreeBytesAvailable ) / ( 1024.0 * 1024.0 );
|
ret = ( double )( lpFreeBytesAvailable ) / ( 1024.0 * 1024.0 );
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -130,13 +136,15 @@ int Sys_GetDriveFreeSpace( const char *path ) {
|
||||||
Sys_GetDriveFreeSpaceInBytes
|
Sys_GetDriveFreeSpaceInBytes
|
||||||
========================
|
========================
|
||||||
*/
|
*/
|
||||||
int64 Sys_GetDriveFreeSpaceInBytes( const char * path ) {
|
int64 Sys_GetDriveFreeSpaceInBytes( const char* path )
|
||||||
|
{
|
||||||
DWORDLONG lpFreeBytesAvailable;
|
DWORDLONG lpFreeBytesAvailable;
|
||||||
DWORDLONG lpTotalNumberOfBytes;
|
DWORDLONG lpTotalNumberOfBytes;
|
||||||
DWORDLONG lpTotalNumberOfFreeBytes;
|
DWORDLONG lpTotalNumberOfFreeBytes;
|
||||||
int64 ret = 1;
|
int64 ret = 1;
|
||||||
//FIXME: see why this is failing on some machines
|
//FIXME: see why this is failing on some machines
|
||||||
if ( ::GetDiskFreeSpaceEx( path, (PULARGE_INTEGER)&lpFreeBytesAvailable, (PULARGE_INTEGER)&lpTotalNumberOfBytes, (PULARGE_INTEGER)&lpTotalNumberOfFreeBytes ) ) {
|
if( ::GetDiskFreeSpaceEx( path, ( PULARGE_INTEGER )&lpFreeBytesAvailable, ( PULARGE_INTEGER )&lpTotalNumberOfBytes, ( PULARGE_INTEGER )&lpTotalNumberOfFreeBytes ) )
|
||||||
|
{
|
||||||
ret = lpFreeBytesAvailable;
|
ret = lpFreeBytesAvailable;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -148,14 +156,16 @@ Sys_GetVideoRam
|
||||||
returns in megabytes
|
returns in megabytes
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
int Sys_GetVideoRam() {
|
int Sys_GetVideoRam()
|
||||||
|
{
|
||||||
unsigned int retSize = 64;
|
unsigned int retSize = 64;
|
||||||
|
|
||||||
// RB begin
|
// RB begin
|
||||||
#if !defined(__MINGW32__)
|
#if !defined(__MINGW32__)
|
||||||
CComPtr<IWbemLocator> spLoc = NULL;
|
CComPtr<IWbemLocator> spLoc = NULL;
|
||||||
HRESULT hr = CoCreateInstance( CLSID_WbemLocator, 0, CLSCTX_SERVER, IID_IWbemLocator, ( LPVOID* ) &spLoc );
|
HRESULT hr = CoCreateInstance( CLSID_WbemLocator, 0, CLSCTX_SERVER, IID_IWbemLocator, ( LPVOID* ) &spLoc );
|
||||||
if ( hr != S_OK || spLoc == NULL ) {
|
if( hr != S_OK || spLoc == NULL )
|
||||||
|
{
|
||||||
return retSize;
|
return retSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,20 +174,23 @@ int Sys_GetVideoRam() {
|
||||||
|
|
||||||
// Connect to CIM
|
// Connect to CIM
|
||||||
hr = spLoc->ConnectServer( bstrNamespace, NULL, NULL, 0, NULL, 0, 0, &spServices );
|
hr = spLoc->ConnectServer( bstrNamespace, NULL, NULL, 0, NULL, 0, 0, &spServices );
|
||||||
if ( hr != WBEM_S_NO_ERROR ) {
|
if( hr != WBEM_S_NO_ERROR )
|
||||||
|
{
|
||||||
return retSize;
|
return retSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch the security level to IMPERSONATE so that provider will grant access to system-level objects.
|
// 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 );
|
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 ) {
|
if( hr != S_OK )
|
||||||
|
{
|
||||||
return retSize;
|
return retSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the vid controller
|
// Get the vid controller
|
||||||
CComPtr<IEnumWbemClassObject> spEnumInst = NULL;
|
CComPtr<IEnumWbemClassObject> spEnumInst = NULL;
|
||||||
hr = spServices->CreateInstanceEnum( CComBSTR( "Win32_VideoController" ), WBEM_FLAG_SHALLOW, NULL, &spEnumInst );
|
hr = spServices->CreateInstanceEnum( CComBSTR( "Win32_VideoController" ), WBEM_FLAG_SHALLOW, NULL, &spEnumInst );
|
||||||
if ( hr != WBEM_S_NO_ERROR || spEnumInst == NULL ) {
|
if( hr != WBEM_S_NO_ERROR || spEnumInst == NULL )
|
||||||
|
{
|
||||||
return retSize;
|
return retSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,13 +198,16 @@ int Sys_GetVideoRam() {
|
||||||
CComPtr<IWbemClassObject> spInstance = NULL;
|
CComPtr<IWbemClassObject> spInstance = NULL;
|
||||||
hr = spEnumInst->Next( 10000, 1, &spInstance, &uNumOfInstances );
|
hr = spEnumInst->Next( 10000, 1, &spInstance, &uNumOfInstances );
|
||||||
|
|
||||||
if ( hr == S_OK && spInstance ) {
|
if( hr == S_OK && spInstance )
|
||||||
|
{
|
||||||
// Get properties from the object
|
// Get properties from the object
|
||||||
CComVariant varSize;
|
CComVariant varSize;
|
||||||
hr = spInstance->Get( CComBSTR( _T( "AdapterRAM" ) ), 0, &varSize, 0, 0 );
|
hr = spInstance->Get( CComBSTR( _T( "AdapterRAM" ) ), 0, &varSize, 0, 0 );
|
||||||
if ( hr == S_OK ) {
|
if( hr == S_OK )
|
||||||
|
{
|
||||||
retSize = varSize.intVal / ( 1024 * 1024 );
|
retSize = varSize.intVal / ( 1024 * 1024 );
|
||||||
if ( retSize == 0 ) {
|
if( retSize == 0 )
|
||||||
|
{
|
||||||
retSize = 64;
|
retSize = 64;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,7 +226,8 @@ Sys_GetCurrentMemoryStatus
|
||||||
all values are in kB except the memoryload
|
all values are in kB except the memoryload
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Sys_GetCurrentMemoryStatus( sysMemoryStats_t &stats ) {
|
void Sys_GetCurrentMemoryStatus( sysMemoryStats_t& stats )
|
||||||
|
{
|
||||||
MEMORYSTATUSEX statex = {};
|
MEMORYSTATUSEX statex = {};
|
||||||
unsigned __int64 work;
|
unsigned __int64 work;
|
||||||
|
|
||||||
|
@ -248,7 +265,8 @@ void Sys_GetCurrentMemoryStatus( sysMemoryStats_t &stats ) {
|
||||||
Sys_LockMemory
|
Sys_LockMemory
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
bool Sys_LockMemory( void *ptr, int bytes ) {
|
bool Sys_LockMemory( void* ptr, int bytes )
|
||||||
|
{
|
||||||
return ( VirtualLock( ptr, ( SIZE_T )bytes ) != FALSE );
|
return ( VirtualLock( ptr, ( SIZE_T )bytes ) != FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,7 +275,8 @@ bool Sys_LockMemory( void *ptr, int bytes ) {
|
||||||
Sys_UnlockMemory
|
Sys_UnlockMemory
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
bool Sys_UnlockMemory( void *ptr, int bytes ) {
|
bool Sys_UnlockMemory( void* ptr, int bytes )
|
||||||
|
{
|
||||||
return ( VirtualUnlock( ptr, ( SIZE_T )bytes ) != FALSE );
|
return ( VirtualUnlock( ptr, ( SIZE_T )bytes ) != FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,7 +285,8 @@ bool Sys_UnlockMemory( void *ptr, int bytes ) {
|
||||||
Sys_SetPhysicalWorkMemory
|
Sys_SetPhysicalWorkMemory
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Sys_SetPhysicalWorkMemory( int minBytes, int maxBytes ) {
|
void Sys_SetPhysicalWorkMemory( int minBytes, int maxBytes )
|
||||||
|
{
|
||||||
::SetProcessWorkingSetSize( GetCurrentProcess(), minBytes, maxBytes );
|
::SetProcessWorkingSetSize( GetCurrentProcess(), minBytes, maxBytes );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,16 +295,19 @@ void Sys_SetPhysicalWorkMemory( int minBytes, int maxBytes ) {
|
||||||
Sys_GetCurrentUser
|
Sys_GetCurrentUser
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
char *Sys_GetCurrentUser() {
|
char* Sys_GetCurrentUser()
|
||||||
|
{
|
||||||
static char s_userName[1024];
|
static char s_userName[1024];
|
||||||
unsigned long size = sizeof( s_userName );
|
unsigned long size = sizeof( s_userName );
|
||||||
|
|
||||||
|
|
||||||
if ( !GetUserName( s_userName, &size ) ) {
|
if( !GetUserName( s_userName, &size ) )
|
||||||
|
{
|
||||||
strcpy( s_userName, "player" );
|
strcpy( s_userName, "player" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !s_userName[0] ) {
|
if( !s_userName[0] )
|
||||||
|
{
|
||||||
strcpy( s_userName, "player" );
|
strcpy( s_userName, "player" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue