From 0b08240e028e3d6beeb45dd17c142a303650bd50 Mon Sep 17 00:00:00 2001 From: dhewg Date: Wed, 4 Jul 2012 00:07:57 +0200 Subject: [PATCH] Remove all OS specific gamepak code Useless since there are no gamepaks. --- neo/framework/BuildDefines.h | 5 ---- neo/framework/FileSystem.cpp | 36 +---------------------------- neo/framework/FileSystem.h | 2 -- neo/framework/async/AsyncClient.cpp | 8 ------- neo/framework/async/AsyncServer.cpp | 23 ++++++++---------- neo/framework/async/AsyncServer.h | 6 ++--- neo/framework/async/ServerScan.cpp | 14 ----------- neo/framework/async/ServerScan.h | 1 - neo/sys/platform.h | 6 ----- 9 files changed, 12 insertions(+), 89 deletions(-) diff --git a/neo/framework/BuildDefines.h b/neo/framework/BuildDefines.h index cccf5910..46740aae 100644 --- a/neo/framework/BuildDefines.h +++ b/neo/framework/BuildDefines.h @@ -60,11 +60,6 @@ If you have questions concerning this license or the applicable additional terms #define ID_ALLOW_CHEATS 0 #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 // NOTE: this makes the network protocol incompatible #ifndef ID_CLIENTINFO_TAGS diff --git a/neo/framework/FileSystem.cpp b/neo/framework/FileSystem.cpp index 169e6f9e..fa3df7b4 100644 --- a/neo/framework/FileSystem.cpp +++ b/neo/framework/FileSystem.cpp @@ -320,7 +320,6 @@ typedef struct searchpath_s { #define MAX_CACHED_DIRS 6 // 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 ADDON_CONFIG "addon.conf" @@ -363,7 +362,6 @@ public: virtual void GetPureServerChecksums( int checksums[ MAX_PURE_PAKS ] ); virtual void SetRestartChecksums( const int pureChecksums[ MAX_PURE_PAKS ] ); virtual void ClearPureChecksums( void ); - virtual int GetOSMask( void ); virtual int ReadFile( const char *relativePath, void **buffer, ID_TIME_T *timestamp ); virtual void FreeFile( void *buffer ); virtual int WriteFile( const char *relativePath, const void *buffer, int size, const char *basePath = "fs_savepath" ); @@ -436,8 +434,6 @@ private: idList restartChecksums; // used during a restart to set things in right order idList 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 int dir_cache_index; 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( "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 common->Printf( "Addon pk4s:\n" ); 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 @@ -3697,11 +3667,7 @@ void idFileSystemLocal::FindDLL( const char *name, char _dllPath[ MAX_OSPATH ] ) sys->DLL_GetFileName( name, dllName, MAX_OSPATH ); -#if ID_FAKE_PURE - if ( 1 ) { -#else if (!serverPaks.Num() && Sys_GetPath(PATH_EXE, dllPath)) { -#endif // from executable directory first - this is handy for developement dllPath.StripFilename( ); dllPath.AppendPath( dllName ); diff --git a/neo/framework/FileSystem.h b/neo/framework/FileSystem.h index 5c0dc4f0..f18441bc 100644 --- a/neo/framework/FileSystem.h +++ b/neo/framework/FileSystem.h @@ -210,8 +210,6 @@ public: virtual void SetRestartChecksums( const int pureChecksums[ MAX_PURE_PAKS ] ) = 0; // equivalent to calling SetPureServerChecksums with an empty list 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. // Returns the length of the file, or -1 on failure. // A null buffer will just return the file length without loading. diff --git a/neo/framework/async/AsyncClient.cpp b/neo/framework/async/AsyncClient.cpp index 5b4e667a..6cf1ce6d 100644 --- a/neo/framework/async/AsyncClient.cpp +++ b/neo/framework/async/AsyncClient.cpp @@ -1197,7 +1197,6 @@ void idAsyncClient::ProcessInfoResponseMessage( const netadr_t from, const idBit } serverInfo.clients++; } - serverInfo.OSMask = msg.ReadInt(); 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" ) ); @@ -1656,12 +1655,6 @@ void idAsyncClient::SetupConnection( void ) { msg.WriteShort( CONNECTIONLESS_MESSAGE_ID ); msg.WriteString( "connect" ); 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( serverChallenge ); msg.WriteShort( clientId ); @@ -1908,7 +1901,6 @@ void idAsyncClient::SendVersionCheck( bool fromMenu ) { msg.WriteShort( CONNECTIONLESS_MESSAGE_ID ); msg.WriteString( "versionCheck" ); msg.WriteInt( ASYNC_PROTOCOL_VERSION ); - msg.WriteShort( BUILD_OS_ID ); msg.WriteString( cvarSystem->GetCVarString( "si_version" ) ); msg.WriteString( cvarSystem->GetCVarString( "com_guid" ) ); clientPort.SendPacket( idAsyncNetwork::GetMasterAddress(), msg.GetData(), msg.GetSize() ); diff --git a/neo/framework/async/AsyncServer.cpp b/neo/framework/async/AsyncServer.cpp index fe9e2ccb..121ad2bc 100644 --- a/neo/framework/async/AsyncServer.cpp +++ b/neo/framework/async/AsyncServer.cpp @@ -1547,7 +1547,7 @@ void idAsyncServer::ProcessChallengeMessage( const netadr_t from, const idBitMsg idAsyncServer::SendPureServerMessage ================== */ -bool idAsyncServer::SendPureServerMessage( const netadr_t to, int OS ) { +bool idAsyncServer::SendPureServerMessage( const netadr_t to ) { idBitMsg outMsg; byte msgBuf[ MAX_MESSAGE_SIZE ]; int serverChecksums[ MAX_PURE_PAKS ]; @@ -1660,10 +1660,9 @@ void idAsyncServer::ProcessConnectMessage( const netadr_t from, const idBitMsg & byte msgBuf[ MAX_MESSAGE_SIZE ]; char guid[ 12 ]; char password[ 17 ]; - int i, ichallenge, islot, OS, numClients; + int i, ichallenge, islot, numClients; protocol = msg.ReadInt(); - OS = msg.ReadShort(); // check the 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 ) { return; } - challenges[ ichallenge ].OS = OS; msg.ReadString( guid, sizeof( guid ) ); switch ( challenges[ ichallenge ].authState ) { case CDK_PUREWAIT: - SendPureServerMessage( from, OS ); + SendPureServerMessage( from ); return; case CDK_ONLYLAN: 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 if ( sessLocal.mapSpawnData.serverInfo.GetInt( "si_pure" ) && challenges[ ichallenge ].authState != CDK_PUREOK ) { - if ( SendPureServerMessage( from, OS ) ) { + if ( SendPureServerMessage( from ) ) { challenges[ ichallenge ].authState = CDK_PUREWAIT; return; } @@ -1825,7 +1823,6 @@ void idAsyncServer::ProcessConnectMessage( const netadr_t from, const idBitMsg & if ( clientNum < MAX_ASYNC_CLIENTS ) { // initialize clients[ clientNum ].channel.Init( from, serverId ); - clients[ clientNum ].OS = OS; strncpy( clients[ clientNum ].guid, guid, 12 ); clients[ clientNum ].guid[11] = 0; break; @@ -1866,7 +1863,7 @@ void idAsyncServer::ProcessConnectMessage( const netadr_t from, const idBitMsg & 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 checksums[ MAX_PURE_PAKS ]; int serverChecksums[ MAX_PURE_PAKS ]; @@ -1924,7 +1921,7 @@ void idAsyncServer::ProcessPureMessage( const netadr_t from, const idBitMsg &msg return; } - if ( !VerifyChecksumMessage( iclient, &from, msg, reply, challenges[ iclient ].OS ) ) { + if ( !VerifyChecksumMessage( iclient, &from, msg, reply ) ) { PrintOOB( from, SERVER_PRINT_MISC, reply ); return; } @@ -1961,7 +1958,7 @@ void idAsyncServer::ProcessReliablePure( int clientNum, const idBitMsg &msg ) { return; } - if ( !VerifyChecksumMessage( clientNum, NULL, msg, reply, clients[ clientNum ].OS ) ) { + if ( !VerifyChecksumMessage( clientNum, NULL, msg, reply ) ) { DropClient( clientNum, reply ); 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.WriteByte( MAX_ASYNC_CLIENTS ); - outMsg.WriteInt( fileSystem->GetOSMask() ); serverPort.SendPacket( from, outMsg.GetData(), outMsg.GetSize() ); } @@ -2079,12 +2075,11 @@ see (client) "getInfo" -> (server) "infoResponse" -> (client)ProcessGetInfoMessa void idAsyncServer::PrintLocalServerInfo( void ) { 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" ), Sys_NetAdrToString( serverPort.GetAdr() ), ASYNC_PROTOCOL_MAJOR, - ASYNC_PROTOCOL_MINOR, - fileSystem->GetOSMask() ); + ASYNC_PROTOCOL_MINOR ); sessLocal.mapSpawnData.serverInfo.Print(); for ( i = 0; i < MAX_ASYNC_CLIENTS; i++ ) { serverClient_t &client = clients[i]; diff --git a/neo/framework/async/AsyncServer.h b/neo/framework/async/AsyncServer.h index 36753745..39cdc8d5 100644 --- a/neo/framework/async/AsyncServer.h +++ b/neo/framework/async/AsyncServer.h @@ -90,7 +90,6 @@ typedef struct challenge_s { authReplyMsg_t authReplyMsg; // default auth messages idStr authReplyPrint; // custom msg char guid[12]; // guid - int OS; } challenge_t; typedef enum { @@ -102,7 +101,6 @@ typedef enum { } serverClientState_t; typedef struct serverClient_s { - int OS; int clientId; serverClientState_t clientState; int clientPrediction; @@ -246,12 +244,12 @@ private: bool ConnectionlessMessage( const netadr_t from, const idBitMsg &msg ); bool ProcessMessage( const netadr_t from, 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 ); int ValidateChallenge( const netadr_t from, int challenge, int clientId ); // returns -1 if validate failed bool SendReliablePureToClient( int clientNum ); 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 int UpdateTime( int clamp ); void SendEnterGameToClient( int clientNum ); diff --git a/neo/framework/async/ServerScan.cpp b/neo/framework/async/ServerScan.cpp index 1655533c..61307222 100644 --- a/neo/framework/async/ServerScan.cpp +++ b/neo/framework/async/ServerScan.cpp @@ -510,20 +510,6 @@ bool idServerScan::IsFiltered( const networkServer_t server ) { int i; 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 keyval = server.serverInfo.FindKey( "si_usePass" ); if ( keyval && gui_filter_password.GetInteger() == 1 ) { diff --git a/neo/framework/async/ServerScan.h b/neo/framework/async/ServerScan.h index abb8d17c..b7e5b4fd 100644 --- a/neo/framework/async/ServerScan.h +++ b/neo/framework/async/ServerScan.h @@ -58,7 +58,6 @@ typedef struct { char nickname[ MAX_NICKLEN ][ MAX_ASYNC_CLIENTS ]; short pings[ MAX_ASYNC_CLIENTS ]; int rate[ MAX_ASYNC_CLIENTS ]; - int OSMask; int challenge; } networkServer_t; diff --git a/neo/sys/platform.h b/neo/sys/platform.h index 49980393..64aa5d2e 100644 --- a/neo/sys/platform.h +++ b/neo/sys/platform.h @@ -43,8 +43,6 @@ If you have questions concerning this license or the applicable additional terms // Win32 #if defined(WIN32) || defined(_WIN32) -#define BUILD_OS_ID 0 - #define _alloca16( x ) ((void *)((((uintptr_t)_alloca( (x)+15 )) + 15) & ~15)) #define PATHSEPERATOR_STR "\\" @@ -80,8 +78,6 @@ If you have questions concerning this license or the applicable additional terms // Mac OSX #if defined(MACOS_X) || defined(__APPLE__) -#define BUILD_OS_ID 1 - #ifdef GAME_DLL #define ID_GAME_API __attribute__((visibility ("default"))) #else @@ -112,8 +108,6 @@ If you have questions concerning this license or the applicable additional terms // Unix #ifdef __unix__ -#define BUILD_OS_ID 2 - #define _alloca alloca #define _alloca16( x ) ((void *)((((uintptr_t)alloca( (x)+15 )) + 15) & ~15))