Remove all OS specific gamepak code

Useless since there are no gamepaks.
This commit is contained in:
dhewg 2012-07-04 00:07:57 +02:00
parent cac32559e7
commit 0b08240e02
9 changed files with 12 additions and 89 deletions

View file

@ -60,11 +60,6 @@ If you have questions concerning this license or the applicable additional terms
#define ID_ALLOW_CHEATS 0 #define ID_ALLOW_CHEATS 0
#endif #endif
// fake a pure client. useful to connect an all-debug client to a server
#ifndef ID_FAKE_PURE
#define ID_FAKE_PURE 0
#endif
// verify checksums in clientinfo traffic // verify checksums in clientinfo traffic
// NOTE: this makes the network protocol incompatible // NOTE: this makes the network protocol incompatible
#ifndef ID_CLIENTINFO_TAGS #ifndef ID_CLIENTINFO_TAGS

View file

@ -320,7 +320,6 @@ typedef struct searchpath_s {
#define MAX_CACHED_DIRS 6 #define MAX_CACHED_DIRS 6
// how many OSes to handle game paks for ( we don't have to know them precisely ) // how many OSes to handle game paks for ( we don't have to know them precisely )
#define MAX_GAME_OS 6
#define BINARY_CONFIG "binary.conf" #define BINARY_CONFIG "binary.conf"
#define ADDON_CONFIG "addon.conf" #define ADDON_CONFIG "addon.conf"
@ -363,7 +362,6 @@ public:
virtual void GetPureServerChecksums( int checksums[ MAX_PURE_PAKS ] ); virtual void GetPureServerChecksums( int checksums[ MAX_PURE_PAKS ] );
virtual void SetRestartChecksums( const int pureChecksums[ MAX_PURE_PAKS ] ); virtual void SetRestartChecksums( const int pureChecksums[ MAX_PURE_PAKS ] );
virtual void ClearPureChecksums( void ); virtual void ClearPureChecksums( void );
virtual int GetOSMask( void );
virtual int ReadFile( const char *relativePath, void **buffer, ID_TIME_T *timestamp ); virtual int ReadFile( const char *relativePath, void **buffer, ID_TIME_T *timestamp );
virtual void FreeFile( void *buffer ); virtual void FreeFile( void *buffer );
virtual int WriteFile( const char *relativePath, const void *buffer, int size, const char *basePath = "fs_savepath" ); virtual int WriteFile( const char *relativePath, const void *buffer, int size, const char *basePath = "fs_savepath" );
@ -436,8 +434,6 @@ private:
idList<int> restartChecksums; // used during a restart to set things in right order idList<int> restartChecksums; // used during a restart to set things in right order
idList<int> addonChecksums; // list of checksums that should go to the search list directly ( for restarts ) idList<int> addonChecksums; // list of checksums that should go to the search list directly ( for restarts )
int gamePakForOS[ MAX_GAME_OS ];
idDEntry dir_cache[ MAX_CACHED_DIRS ]; // fifo idDEntry dir_cache[ MAX_CACHED_DIRS ]; // fifo
int dir_cache_index; int dir_cache_index;
int dir_cache_count; int dir_cache_count;
@ -1999,15 +1995,7 @@ void idFileSystemLocal::Path_f( const idCmdArgs &args ) {
common->Printf( "%s/%s\n", sp->dir->path.c_str(), sp->dir->gamedir.c_str() ); common->Printf( "%s/%s\n", sp->dir->path.c_str(), sp->dir->gamedir.c_str() );
} }
} }
common->Printf( "game DLL: 0x%x in pak: 0x%x\n", fileSystemLocal.gameDLLChecksum, fileSystemLocal.gamePakChecksum );
#if ID_FAKE_PURE
common->Printf( "Note: ID_FAKE_PURE is enabled\n" );
#endif
for( i = 0; i < MAX_GAME_OS; i++ ) {
if ( fileSystemLocal.gamePakForOS[ i ] ) {
common->Printf( "OS %d - pak 0x%x\n", i, fileSystemLocal.gamePakForOS[ i ] );
}
}
// show addon packs that are *not* in the search lists // show addon packs that are *not* in the search lists
common->Printf( "Addon pk4s:\n" ); common->Printf( "Addon pk4s:\n" );
for ( sp = fileSystemLocal.addonPaks; sp; sp = sp->next ) { for ( sp = fileSystemLocal.addonPaks; sp; sp = sp->next ) {
@ -2019,24 +2007,6 @@ void idFileSystemLocal::Path_f( const idCmdArgs &args ) {
} }
} }
/*
============
idFileSystemLocal::GetOSMask
============
*/
int idFileSystemLocal::GetOSMask( void ) {
int i, ret = 0;
for( i = 0; i < MAX_GAME_OS; i++ ) {
if ( fileSystemLocal.gamePakForOS[ i ] ) {
ret |= ( 1 << i );
}
}
if ( !ret ) {
return -1;
}
return ret;
}
/* /*
============ ============
idFileSystemLocal::TouchFile_f idFileSystemLocal::TouchFile_f
@ -3697,11 +3667,7 @@ void idFileSystemLocal::FindDLL( const char *name, char _dllPath[ MAX_OSPATH ] )
sys->DLL_GetFileName( name, dllName, MAX_OSPATH ); sys->DLL_GetFileName( name, dllName, MAX_OSPATH );
#if ID_FAKE_PURE
if ( 1 ) {
#else
if (!serverPaks.Num() && Sys_GetPath(PATH_EXE, dllPath)) { if (!serverPaks.Num() && Sys_GetPath(PATH_EXE, dllPath)) {
#endif
// from executable directory first - this is handy for developement // from executable directory first - this is handy for developement
dllPath.StripFilename( ); dllPath.StripFilename( );
dllPath.AppendPath( dllName ); dllPath.AppendPath( dllName );

View file

@ -210,8 +210,6 @@ public:
virtual void SetRestartChecksums( const int pureChecksums[ MAX_PURE_PAKS ] ) = 0; virtual void SetRestartChecksums( const int pureChecksums[ MAX_PURE_PAKS ] ) = 0;
// equivalent to calling SetPureServerChecksums with an empty list // equivalent to calling SetPureServerChecksums with an empty list
virtual void ClearPureChecksums( void ) = 0; virtual void ClearPureChecksums( void ) = 0;
// get a mask of supported OSes. if not pure, returns -1
virtual int GetOSMask( void ) = 0;
// Reads a complete file. // Reads a complete file.
// Returns the length of the file, or -1 on failure. // Returns the length of the file, or -1 on failure.
// A null buffer will just return the file length without loading. // A null buffer will just return the file length without loading.

View file

@ -1197,7 +1197,6 @@ void idAsyncClient::ProcessInfoResponseMessage( const netadr_t from, const idBit
} }
serverInfo.clients++; serverInfo.clients++;
} }
serverInfo.OSMask = msg.ReadInt();
index = serverList.InfoResponse( serverInfo ); index = serverList.InfoResponse( serverInfo );
common->Printf( "%d: server %s - protocol %d.%d - %s\n", index, Sys_NetAdrToString( serverInfo.adr ), protocol >> 16, protocol & 0xffff, serverInfo.serverInfo.GetString( "si_name" ) ); common->Printf( "%d: server %s - protocol %d.%d - %s\n", index, Sys_NetAdrToString( serverInfo.adr ), protocol >> 16, protocol & 0xffff, serverInfo.serverInfo.GetString( "si_name" ) );
@ -1656,12 +1655,6 @@ void idAsyncClient::SetupConnection( void ) {
msg.WriteShort( CONNECTIONLESS_MESSAGE_ID ); msg.WriteShort( CONNECTIONLESS_MESSAGE_ID );
msg.WriteString( "connect" ); msg.WriteString( "connect" );
msg.WriteInt( ASYNC_PROTOCOL_VERSION ); msg.WriteInt( ASYNC_PROTOCOL_VERSION );
#if ID_FAKE_PURE
// fake win32 OS - might need to adapt depending on the case
msg.WriteShort( 0 );
#else
msg.WriteShort( BUILD_OS_ID );
#endif
msg.WriteInt( clientDataChecksum ); msg.WriteInt( clientDataChecksum );
msg.WriteInt( serverChallenge ); msg.WriteInt( serverChallenge );
msg.WriteShort( clientId ); msg.WriteShort( clientId );
@ -1908,7 +1901,6 @@ void idAsyncClient::SendVersionCheck( bool fromMenu ) {
msg.WriteShort( CONNECTIONLESS_MESSAGE_ID ); msg.WriteShort( CONNECTIONLESS_MESSAGE_ID );
msg.WriteString( "versionCheck" ); msg.WriteString( "versionCheck" );
msg.WriteInt( ASYNC_PROTOCOL_VERSION ); msg.WriteInt( ASYNC_PROTOCOL_VERSION );
msg.WriteShort( BUILD_OS_ID );
msg.WriteString( cvarSystem->GetCVarString( "si_version" ) ); msg.WriteString( cvarSystem->GetCVarString( "si_version" ) );
msg.WriteString( cvarSystem->GetCVarString( "com_guid" ) ); msg.WriteString( cvarSystem->GetCVarString( "com_guid" ) );
clientPort.SendPacket( idAsyncNetwork::GetMasterAddress(), msg.GetData(), msg.GetSize() ); clientPort.SendPacket( idAsyncNetwork::GetMasterAddress(), msg.GetData(), msg.GetSize() );

View file

@ -1547,7 +1547,7 @@ void idAsyncServer::ProcessChallengeMessage( const netadr_t from, const idBitMsg
idAsyncServer::SendPureServerMessage idAsyncServer::SendPureServerMessage
================== ==================
*/ */
bool idAsyncServer::SendPureServerMessage( const netadr_t to, int OS ) { bool idAsyncServer::SendPureServerMessage( const netadr_t to ) {
idBitMsg outMsg; idBitMsg outMsg;
byte msgBuf[ MAX_MESSAGE_SIZE ]; byte msgBuf[ MAX_MESSAGE_SIZE ];
int serverChecksums[ MAX_PURE_PAKS ]; int serverChecksums[ MAX_PURE_PAKS ];
@ -1660,10 +1660,9 @@ void idAsyncServer::ProcessConnectMessage( const netadr_t from, const idBitMsg &
byte msgBuf[ MAX_MESSAGE_SIZE ]; byte msgBuf[ MAX_MESSAGE_SIZE ];
char guid[ 12 ]; char guid[ 12 ];
char password[ 17 ]; char password[ 17 ];
int i, ichallenge, islot, OS, numClients; int i, ichallenge, islot, numClients;
protocol = msg.ReadInt(); protocol = msg.ReadInt();
OS = msg.ReadShort();
// check the protocol version // check the protocol version
if ( protocol != ASYNC_PROTOCOL_VERSION ) { if ( protocol != ASYNC_PROTOCOL_VERSION ) {
@ -1686,13 +1685,12 @@ void idAsyncServer::ProcessConnectMessage( const netadr_t from, const idBitMsg &
if ( ( ichallenge = ValidateChallenge( from, challenge, clientId ) ) == -1 ) { if ( ( ichallenge = ValidateChallenge( from, challenge, clientId ) ) == -1 ) {
return; return;
} }
challenges[ ichallenge ].OS = OS;
msg.ReadString( guid, sizeof( guid ) ); msg.ReadString( guid, sizeof( guid ) );
switch ( challenges[ ichallenge ].authState ) { switch ( challenges[ ichallenge ].authState ) {
case CDK_PUREWAIT: case CDK_PUREWAIT:
SendPureServerMessage( from, OS ); SendPureServerMessage( from );
return; return;
case CDK_ONLYLAN: case CDK_ONLYLAN:
common->DPrintf( "%s: not a lan client\n", Sys_NetAdrToString( from ) ); common->DPrintf( "%s: not a lan client\n", Sys_NetAdrToString( from ) );
@ -1779,7 +1777,7 @@ void idAsyncServer::ProcessConnectMessage( const netadr_t from, const idBitMsg &
// enter pure checks if necessary // enter pure checks if necessary
if ( sessLocal.mapSpawnData.serverInfo.GetInt( "si_pure" ) && challenges[ ichallenge ].authState != CDK_PUREOK ) { if ( sessLocal.mapSpawnData.serverInfo.GetInt( "si_pure" ) && challenges[ ichallenge ].authState != CDK_PUREOK ) {
if ( SendPureServerMessage( from, OS ) ) { if ( SendPureServerMessage( from ) ) {
challenges[ ichallenge ].authState = CDK_PUREWAIT; challenges[ ichallenge ].authState = CDK_PUREWAIT;
return; return;
} }
@ -1825,7 +1823,6 @@ void idAsyncServer::ProcessConnectMessage( const netadr_t from, const idBitMsg &
if ( clientNum < MAX_ASYNC_CLIENTS ) { if ( clientNum < MAX_ASYNC_CLIENTS ) {
// initialize // initialize
clients[ clientNum ].channel.Init( from, serverId ); clients[ clientNum ].channel.Init( from, serverId );
clients[ clientNum ].OS = OS;
strncpy( clients[ clientNum ].guid, guid, 12 ); strncpy( clients[ clientNum ].guid, guid, 12 );
clients[ clientNum ].guid[11] = 0; clients[ clientNum ].guid[11] = 0;
break; break;
@ -1866,7 +1863,7 @@ void idAsyncServer::ProcessConnectMessage( const netadr_t from, const idBitMsg &
idAsyncServer::VerifyChecksumMessage idAsyncServer::VerifyChecksumMessage
================== ==================
*/ */
bool idAsyncServer::VerifyChecksumMessage( int clientNum, const netadr_t *from, const idBitMsg &msg, idStr &reply, int OS ) { bool idAsyncServer::VerifyChecksumMessage( int clientNum, const netadr_t *from, const idBitMsg &msg, idStr &reply ) {
int i, numChecksums; int i, numChecksums;
int checksums[ MAX_PURE_PAKS ]; int checksums[ MAX_PURE_PAKS ];
int serverChecksums[ MAX_PURE_PAKS ]; int serverChecksums[ MAX_PURE_PAKS ];
@ -1924,7 +1921,7 @@ void idAsyncServer::ProcessPureMessage( const netadr_t from, const idBitMsg &msg
return; return;
} }
if ( !VerifyChecksumMessage( iclient, &from, msg, reply, challenges[ iclient ].OS ) ) { if ( !VerifyChecksumMessage( iclient, &from, msg, reply ) ) {
PrintOOB( from, SERVER_PRINT_MISC, reply ); PrintOOB( from, SERVER_PRINT_MISC, reply );
return; return;
} }
@ -1961,7 +1958,7 @@ void idAsyncServer::ProcessReliablePure( int clientNum, const idBitMsg &msg ) {
return; return;
} }
if ( !VerifyChecksumMessage( clientNum, NULL, msg, reply, clients[ clientNum ].OS ) ) { if ( !VerifyChecksumMessage( clientNum, NULL, msg, reply ) ) {
DropClient( clientNum, reply ); DropClient( clientNum, reply );
return; return;
} }
@ -2065,7 +2062,6 @@ void idAsyncServer::ProcessGetInfoMessage( const netadr_t from, const idBitMsg &
outMsg.WriteString( sessLocal.mapSpawnData.userInfo[i].GetString( "ui_name", "Player" ) ); outMsg.WriteString( sessLocal.mapSpawnData.userInfo[i].GetString( "ui_name", "Player" ) );
} }
outMsg.WriteByte( MAX_ASYNC_CLIENTS ); outMsg.WriteByte( MAX_ASYNC_CLIENTS );
outMsg.WriteInt( fileSystem->GetOSMask() );
serverPort.SendPacket( from, outMsg.GetData(), outMsg.GetSize() ); serverPort.SendPacket( from, outMsg.GetData(), outMsg.GetSize() );
} }
@ -2079,12 +2075,11 @@ see (client) "getInfo" -> (server) "infoResponse" -> (client)ProcessGetInfoMessa
void idAsyncServer::PrintLocalServerInfo( void ) { void idAsyncServer::PrintLocalServerInfo( void ) {
int i; int i;
common->Printf( "server '%s' IP = %s\nprotocol %d.%d OS mask 0x%x\n", common->Printf( "server '%s' IP = %s\nprotocol %d.%d\n",
sessLocal.mapSpawnData.serverInfo.GetString( "si_name" ), sessLocal.mapSpawnData.serverInfo.GetString( "si_name" ),
Sys_NetAdrToString( serverPort.GetAdr() ), Sys_NetAdrToString( serverPort.GetAdr() ),
ASYNC_PROTOCOL_MAJOR, ASYNC_PROTOCOL_MAJOR,
ASYNC_PROTOCOL_MINOR, ASYNC_PROTOCOL_MINOR );
fileSystem->GetOSMask() );
sessLocal.mapSpawnData.serverInfo.Print(); sessLocal.mapSpawnData.serverInfo.Print();
for ( i = 0; i < MAX_ASYNC_CLIENTS; i++ ) { for ( i = 0; i < MAX_ASYNC_CLIENTS; i++ ) {
serverClient_t &client = clients[i]; serverClient_t &client = clients[i];

View file

@ -90,7 +90,6 @@ typedef struct challenge_s {
authReplyMsg_t authReplyMsg; // default auth messages authReplyMsg_t authReplyMsg; // default auth messages
idStr authReplyPrint; // custom msg idStr authReplyPrint; // custom msg
char guid[12]; // guid char guid[12]; // guid
int OS;
} challenge_t; } challenge_t;
typedef enum { typedef enum {
@ -102,7 +101,6 @@ typedef enum {
} serverClientState_t; } serverClientState_t;
typedef struct serverClient_s { typedef struct serverClient_s {
int OS;
int clientId; int clientId;
serverClientState_t clientState; serverClientState_t clientState;
int clientPrediction; int clientPrediction;
@ -246,12 +244,12 @@ private:
bool ConnectionlessMessage( const netadr_t from, const idBitMsg &msg ); bool ConnectionlessMessage( const netadr_t from, const idBitMsg &msg );
bool ProcessMessage( const netadr_t from, idBitMsg &msg ); bool ProcessMessage( const netadr_t from, idBitMsg &msg );
void ProcessAuthMessage( const idBitMsg &msg ); void ProcessAuthMessage( const idBitMsg &msg );
bool SendPureServerMessage( const netadr_t to, int OS ); // returns false if no pure paks on the list bool SendPureServerMessage( const netadr_t to ); // returns false if no pure paks on the list
void ProcessPureMessage( const netadr_t from, const idBitMsg &msg ); void ProcessPureMessage( const netadr_t from, const idBitMsg &msg );
int ValidateChallenge( const netadr_t from, int challenge, int clientId ); // returns -1 if validate failed int ValidateChallenge( const netadr_t from, int challenge, int clientId ); // returns -1 if validate failed
bool SendReliablePureToClient( int clientNum ); bool SendReliablePureToClient( int clientNum );
void ProcessReliablePure( int clientNum, const idBitMsg &msg ); void ProcessReliablePure( int clientNum, const idBitMsg &msg );
bool VerifyChecksumMessage( int clientNum, const netadr_t *from, const idBitMsg &msg, idStr &reply, int OS ); // if from is NULL, clientNum is used for error messages bool VerifyChecksumMessage( int clientNum, const netadr_t *from, const idBitMsg &msg, idStr &reply ); // if from is NULL, clientNum is used for error messages
void SendReliableMessage( int clientNum, const idBitMsg &msg ); // checks for overflow and disconnects the faulty client void SendReliableMessage( int clientNum, const idBitMsg &msg ); // checks for overflow and disconnects the faulty client
int UpdateTime( int clamp ); int UpdateTime( int clamp );
void SendEnterGameToClient( int clientNum ); void SendEnterGameToClient( int clientNum );

View file

@ -510,20 +510,6 @@ bool idServerScan::IsFiltered( const networkServer_t server ) {
int i; int i;
const idKeyValue *keyval; const idKeyValue *keyval;
// OS support filter
#if 0
// filter out pure servers that won't provide checksumed game code for client OS
keyval = server.serverInfo.FindKey( "si_pure" );
if ( keyval && !idStr::Cmp( keyval->GetValue(), "1" ) ) {
if ( ( server.OSMask & ( 1 << BUILD_OS_ID ) ) == 0 ) {
return true;
}
}
#else
if ( ( server.OSMask & ( 1 << BUILD_OS_ID ) ) == 0 ) {
return true;
}
#endif
// password filter // password filter
keyval = server.serverInfo.FindKey( "si_usePass" ); keyval = server.serverInfo.FindKey( "si_usePass" );
if ( keyval && gui_filter_password.GetInteger() == 1 ) { if ( keyval && gui_filter_password.GetInteger() == 1 ) {

View file

@ -58,7 +58,6 @@ typedef struct {
char nickname[ MAX_NICKLEN ][ MAX_ASYNC_CLIENTS ]; char nickname[ MAX_NICKLEN ][ MAX_ASYNC_CLIENTS ];
short pings[ MAX_ASYNC_CLIENTS ]; short pings[ MAX_ASYNC_CLIENTS ];
int rate[ MAX_ASYNC_CLIENTS ]; int rate[ MAX_ASYNC_CLIENTS ];
int OSMask;
int challenge; int challenge;
} networkServer_t; } networkServer_t;

View file

@ -43,8 +43,6 @@ If you have questions concerning this license or the applicable additional terms
// Win32 // Win32
#if defined(WIN32) || defined(_WIN32) #if defined(WIN32) || defined(_WIN32)
#define BUILD_OS_ID 0
#define _alloca16( x ) ((void *)((((uintptr_t)_alloca( (x)+15 )) + 15) & ~15)) #define _alloca16( x ) ((void *)((((uintptr_t)_alloca( (x)+15 )) + 15) & ~15))
#define PATHSEPERATOR_STR "\\" #define PATHSEPERATOR_STR "\\"
@ -80,8 +78,6 @@ If you have questions concerning this license or the applicable additional terms
// Mac OSX // Mac OSX
#if defined(MACOS_X) || defined(__APPLE__) #if defined(MACOS_X) || defined(__APPLE__)
#define BUILD_OS_ID 1
#ifdef GAME_DLL #ifdef GAME_DLL
#define ID_GAME_API __attribute__((visibility ("default"))) #define ID_GAME_API __attribute__((visibility ("default")))
#else #else
@ -112,8 +108,6 @@ If you have questions concerning this license or the applicable additional terms
// Unix // Unix
#ifdef __unix__ #ifdef __unix__
#define BUILD_OS_ID 2
#define _alloca alloca #define _alloca alloca
#define _alloca16( x ) ((void *)((((uintptr_t)alloca( (x)+15 )) + 15) & ~15)) #define _alloca16( x ) ((void *)((((uintptr_t)alloca( (x)+15 )) + 15) & ~15))