mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-02-21 11:31:49 +00:00
Get rid of dead code in the Windows backend
Not used by anything.
This commit is contained in:
parent
6f8bb2dfc3
commit
f7915a5ffa
3 changed files with 0 additions and 197 deletions
|
@ -53,8 +53,6 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
void Sys_CreateConsole( void );
|
void Sys_CreateConsole( void );
|
||||||
void Sys_DestroyConsole( void );
|
void Sys_DestroyConsole( void );
|
||||||
|
|
||||||
char *Sys_GetCurrentUser( void );
|
|
||||||
|
|
||||||
void Win_SetErrorText( const char *text );
|
void Win_SetErrorText( const char *text );
|
||||||
|
|
||||||
const unsigned char *Win_GetScanTable( void );
|
const unsigned char *Win_GetScanTable( void );
|
||||||
|
@ -80,8 +78,6 @@ struct Win32Vars_t {
|
||||||
PIXELFORMATDESCRIPTOR pfd;
|
PIXELFORMATDESCRIPTOR pfd;
|
||||||
int pixelformat;
|
int pixelformat;
|
||||||
|
|
||||||
static idCVar sys_arch;
|
|
||||||
static idCVar win_username;
|
|
||||||
static idCVar win_outputDebugString;
|
static idCVar win_outputDebugString;
|
||||||
static idCVar win_outputEditString;
|
static idCVar win_outputEditString;
|
||||||
static idCVar win_viewlog;
|
static idCVar win_viewlog;
|
||||||
|
|
|
@ -52,8 +52,6 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
#include <SDL_main.h>
|
#include <SDL_main.h>
|
||||||
|
|
||||||
idCVar Win32Vars_t::sys_arch( "sys_arch", "", CVAR_SYSTEM | CVAR_INIT, "" );
|
|
||||||
idCVar Win32Vars_t::win_username( "win_username", "", CVAR_SYSTEM | CVAR_INIT, "windows user name" );
|
|
||||||
idCVar Win32Vars_t::win_outputDebugString( "win_outputDebugString", "0", CVAR_SYSTEM | CVAR_BOOL, "" );
|
idCVar Win32Vars_t::win_outputDebugString( "win_outputDebugString", "0", CVAR_SYSTEM | CVAR_BOOL, "" );
|
||||||
idCVar Win32Vars_t::win_outputEditString( "win_outputEditString", "1", CVAR_SYSTEM | CVAR_BOOL, "" );
|
idCVar Win32Vars_t::win_outputEditString( "win_outputEditString", "1", CVAR_SYSTEM | CVAR_BOOL, "" );
|
||||||
idCVar Win32Vars_t::win_viewlog( "win_viewlog", "0", CVAR_SYSTEM | CVAR_INTEGER, "" );
|
idCVar Win32Vars_t::win_viewlog( "win_viewlog", "0", CVAR_SYSTEM | CVAR_INTEGER, "" );
|
||||||
|
@ -72,127 +70,6 @@ void Sys_GetExeLaunchMemoryStatus( sysMemoryStats_t &stats ) {
|
||||||
stats = exeLaunchMemoryStats;
|
stats = exeLaunchMemoryStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
==================
|
|
||||||
Sys_Sentry
|
|
||||||
==================
|
|
||||||
*/
|
|
||||||
void Sys_Sentry() {
|
|
||||||
int j = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma optimize( "", on )
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
|
|
||||||
|
|
||||||
static unsigned int debug_total_alloc = 0;
|
|
||||||
static unsigned int debug_total_alloc_count = 0;
|
|
||||||
static unsigned int debug_current_alloc = 0;
|
|
||||||
static unsigned int debug_current_alloc_count = 0;
|
|
||||||
static unsigned int debug_frame_alloc = 0;
|
|
||||||
static unsigned int debug_frame_alloc_count = 0;
|
|
||||||
|
|
||||||
idCVar sys_showMallocs( "sys_showMallocs", "0", CVAR_SYSTEM, "" );
|
|
||||||
|
|
||||||
// _HOOK_ALLOC, _HOOK_REALLOC, _HOOK_FREE
|
|
||||||
|
|
||||||
typedef struct CrtMemBlockHeader
|
|
||||||
{
|
|
||||||
struct _CrtMemBlockHeader *pBlockHeaderNext; // Pointer to the block allocated just before this one:
|
|
||||||
struct _CrtMemBlockHeader *pBlockHeaderPrev; // Pointer to the block allocated just after this one
|
|
||||||
char *szFileName; // File name
|
|
||||||
int nLine; // Line number
|
|
||||||
size_t nDataSize; // Size of user block
|
|
||||||
int nBlockUse; // Type of block
|
|
||||||
long lRequest; // Allocation number
|
|
||||||
byte gap[4]; // Buffer just before (lower than) the user's memory:
|
|
||||||
} CrtMemBlockHeader;
|
|
||||||
|
|
||||||
#include <crtdbg.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
==================
|
|
||||||
Sys_AllocHook
|
|
||||||
|
|
||||||
called for every malloc/new/free/delete
|
|
||||||
==================
|
|
||||||
*/
|
|
||||||
int Sys_AllocHook( int nAllocType, void *pvData, size_t nSize, int nBlockUse, long lRequest, const unsigned char * szFileName, int nLine )
|
|
||||||
{
|
|
||||||
CrtMemBlockHeader *pHead;
|
|
||||||
byte *temp;
|
|
||||||
|
|
||||||
if ( nBlockUse == _CRT_BLOCK )
|
|
||||||
{
|
|
||||||
return( TRUE );
|
|
||||||
}
|
|
||||||
|
|
||||||
// get a pointer to memory block header
|
|
||||||
temp = ( byte * )pvData;
|
|
||||||
temp -= 32;
|
|
||||||
pHead = ( CrtMemBlockHeader * )temp;
|
|
||||||
|
|
||||||
switch( nAllocType ) {
|
|
||||||
case _HOOK_ALLOC:
|
|
||||||
debug_total_alloc += nSize;
|
|
||||||
debug_current_alloc += nSize;
|
|
||||||
debug_frame_alloc += nSize;
|
|
||||||
debug_total_alloc_count++;
|
|
||||||
debug_current_alloc_count++;
|
|
||||||
debug_frame_alloc_count++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case _HOOK_FREE:
|
|
||||||
assert( pHead->gap[0] == 0xfd && pHead->gap[1] == 0xfd && pHead->gap[2] == 0xfd && pHead->gap[3] == 0xfd );
|
|
||||||
|
|
||||||
debug_current_alloc -= pHead->nDataSize;
|
|
||||||
debug_current_alloc_count--;
|
|
||||||
debug_total_alloc_count++;
|
|
||||||
debug_frame_alloc_count++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case _HOOK_REALLOC:
|
|
||||||
assert( pHead->gap[0] == 0xfd && pHead->gap[1] == 0xfd && pHead->gap[2] == 0xfd && pHead->gap[3] == 0xfd );
|
|
||||||
|
|
||||||
debug_current_alloc -= pHead->nDataSize;
|
|
||||||
debug_total_alloc += nSize;
|
|
||||||
debug_current_alloc += nSize;
|
|
||||||
debug_frame_alloc += nSize;
|
|
||||||
debug_total_alloc_count++;
|
|
||||||
debug_current_alloc_count--;
|
|
||||||
debug_frame_alloc_count++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return( TRUE );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
==================
|
|
||||||
Sys_DebugMemory_f
|
|
||||||
==================
|
|
||||||
*/
|
|
||||||
void Sys_DebugMemory_f( void ) {
|
|
||||||
common->Printf( "Total allocation %8dk in %d blocks\n", debug_total_alloc / 1024, debug_total_alloc_count );
|
|
||||||
common->Printf( "Current allocation %8dk in %d blocks\n", debug_current_alloc / 1024, debug_current_alloc_count );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
==================
|
|
||||||
Sys_MemFrame
|
|
||||||
==================
|
|
||||||
*/
|
|
||||||
void Sys_MemFrame( void ) {
|
|
||||||
if( sys_showMallocs.GetInteger() ) {
|
|
||||||
common->Printf("Frame: %8dk in %5d blocks\n", debug_frame_alloc / 1024, debug_frame_alloc_count );
|
|
||||||
}
|
|
||||||
|
|
||||||
debug_frame_alloc = 0;
|
|
||||||
debug_frame_alloc_count = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==================
|
==================
|
||||||
Sys_FlushCacheMemory
|
Sys_FlushCacheMemory
|
||||||
|
@ -609,9 +486,6 @@ Sys_Init
|
||||||
The cvar system must already be setup
|
The cvar system must already be setup
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
#define OSR2_BUILD_NUMBER 1111
|
|
||||||
#define WIN98_BUILD_NUMBER 1998
|
|
||||||
|
|
||||||
void Sys_Init( void ) {
|
void Sys_Init( void ) {
|
||||||
|
|
||||||
CoInitialize( NULL );
|
CoInitialize( NULL );
|
||||||
|
@ -630,11 +504,6 @@ void Sys_Init( void ) {
|
||||||
cmdSystem->AddCommand( "setAsyncSound", Sys_SetAsyncSound_f, CMD_FL_SYSTEM, "set the async sound option" );
|
cmdSystem->AddCommand( "setAsyncSound", Sys_SetAsyncSound_f, CMD_FL_SYSTEM, "set the async sound option" );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
|
||||||
// Windows user name
|
|
||||||
//
|
|
||||||
win32.win_username.SetString( Sys_GetCurrentUser() );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Windows version
|
// Windows version
|
||||||
//
|
//
|
||||||
|
@ -650,43 +519,6 @@ void Sys_Init( void ) {
|
||||||
Sys_Error( GAME_NAME " doesn't run on Win32s" );
|
Sys_Error( GAME_NAME " doesn't run on Win32s" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( win32.osversion.dwPlatformId == VER_PLATFORM_WIN32_NT ) {
|
|
||||||
if( win32.osversion.dwMajorVersion <= 4 ) {
|
|
||||||
win32.sys_arch.SetString( "WinNT (NT)" );
|
|
||||||
} else if( win32.osversion.dwMajorVersion == 5 && win32.osversion.dwMinorVersion == 0 ) {
|
|
||||||
win32.sys_arch.SetString( "Win2K (NT)" );
|
|
||||||
} else if( win32.osversion.dwMajorVersion == 5 && win32.osversion.dwMinorVersion == 1 ) {
|
|
||||||
win32.sys_arch.SetString( "WinXP (NT)" );
|
|
||||||
} else if ( win32.osversion.dwMajorVersion == 6 ) {
|
|
||||||
win32.sys_arch.SetString( "Vista" );
|
|
||||||
} else {
|
|
||||||
win32.sys_arch.SetString( "Unknown NT variant" );
|
|
||||||
}
|
|
||||||
} else if( win32.osversion.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ) {
|
|
||||||
if( win32.osversion.dwMajorVersion == 4 && win32.osversion.dwMinorVersion == 0 ) {
|
|
||||||
// Win95
|
|
||||||
if( win32.osversion.szCSDVersion[1] == 'C' ) {
|
|
||||||
win32.sys_arch.SetString( "Win95 OSR2 (95)" );
|
|
||||||
} else {
|
|
||||||
win32.sys_arch.SetString( "Win95 (95)" );
|
|
||||||
}
|
|
||||||
} else if( win32.osversion.dwMajorVersion == 4 && win32.osversion.dwMinorVersion == 10 ) {
|
|
||||||
// Win98
|
|
||||||
if( win32.osversion.szCSDVersion[1] == 'A' ) {
|
|
||||||
win32.sys_arch.SetString( "Win98SE (95)" );
|
|
||||||
} else {
|
|
||||||
win32.sys_arch.SetString( "Win98 (95)" );
|
|
||||||
}
|
|
||||||
} else if( win32.osversion.dwMajorVersion == 4 && win32.osversion.dwMinorVersion == 90 ) {
|
|
||||||
// WinMe
|
|
||||||
win32.sys_arch.SetString( "WinMe (95)" );
|
|
||||||
} else {
|
|
||||||
win32.sys_arch.SetString( "Unknown 95 variant" );
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
win32.sys_arch.SetString( "unknown Windows variant" );
|
|
||||||
}
|
|
||||||
|
|
||||||
common->Printf( "%d MB System Memory\n", Sys_GetSystemRam() );
|
common->Printf( "%d MB System Memory\n", Sys_GetSystemRam() );
|
||||||
common->Printf( "%d MB Video Memory\n", Sys_GetVideoRam() );
|
common->Printf( "%d MB Video Memory\n", Sys_GetVideoRam() );
|
||||||
}
|
}
|
||||||
|
@ -826,10 +658,6 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
Win_Frame();
|
Win_Frame();
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
Sys_MemFrame();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// set exceptions, even if some crappy syscall changes them!
|
// set exceptions, even if some crappy syscall changes them!
|
||||||
Sys_FPU_EnableExceptions( TEST_FPU_EXCEPTIONS );
|
Sys_FPU_EnableExceptions( TEST_FPU_EXCEPTIONS );
|
||||||
|
|
||||||
|
|
|
@ -144,24 +144,3 @@ Sys_SetPhysicalWorkMemory
|
||||||
void Sys_SetPhysicalWorkMemory( int minBytes, int maxBytes ) {
|
void Sys_SetPhysicalWorkMemory( int minBytes, int maxBytes ) {
|
||||||
::SetProcessWorkingSetSize( GetCurrentProcess(), minBytes, maxBytes );
|
::SetProcessWorkingSetSize( GetCurrentProcess(), minBytes, maxBytes );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
================
|
|
||||||
Sys_GetCurrentUser
|
|
||||||
================
|
|
||||||
*/
|
|
||||||
char *Sys_GetCurrentUser( void ) {
|
|
||||||
static char s_userName[1024];
|
|
||||||
unsigned long size = sizeof( s_userName );
|
|
||||||
|
|
||||||
|
|
||||||
if ( !GetUserName( s_userName, &size ) ) {
|
|
||||||
strcpy( s_userName, "player" );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !s_userName[0] ) {
|
|
||||||
strcpy( s_userName, "player" );
|
|
||||||
}
|
|
||||||
|
|
||||||
return s_userName;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue