mirror of
https://github.com/dhewm/dhewm3.git
synced 2024-11-23 12:53:09 +00:00
Remove all client/server gamepak checks
We don't use any gamepaks anymore, remove the related checks.
This commit is contained in:
parent
3d4be95474
commit
72156cb1b4
4 changed files with 6 additions and 106 deletions
|
@ -2621,12 +2621,6 @@ fsPureReply_t idFileSystemLocal::SetPureServerChecksums( const int pureChecksums
|
|||
int i, j, imissing;
|
||||
bool success = true;
|
||||
bool canPrepend = true;
|
||||
char dllName[MAX_OSPATH];
|
||||
int dllHash;
|
||||
fileInPack_t * pakFile;
|
||||
|
||||
sys->DLL_GetFileName( "game", dllName, MAX_OSPATH );
|
||||
dllHash = HashFileName( dllName );
|
||||
|
||||
imissing = 0;
|
||||
missingChecksums[ 0 ] = 0;
|
||||
|
@ -2705,48 +2699,6 @@ fsPureReply_t idFileSystemLocal::SetPureServerChecksums( const int pureChecksums
|
|||
j++;
|
||||
}
|
||||
|
||||
// DLL checksuming
|
||||
if ( !_gamePakChecksum ) {
|
||||
// server doesn't have knowledge of code we can use ( OS issue )
|
||||
return PURE_NODLL;
|
||||
}
|
||||
assert( gameDLLChecksum );
|
||||
#if ID_FAKE_PURE
|
||||
gamePakChecksum = _gamePakChecksum;
|
||||
#endif
|
||||
if ( _gamePakChecksum != gamePakChecksum ) {
|
||||
// current DLL is wrong, search for a pak with the approriate checksum
|
||||
// ( search all paks, the pure list is not relevant here )
|
||||
pack = GetPackForChecksum( _gamePakChecksum );
|
||||
if ( !pack ) {
|
||||
if ( fs_debug.GetBool() ) {
|
||||
common->Printf( "missing the game code pak ( 0x%x )\n", _gamePakChecksum );
|
||||
}
|
||||
// if there are other paks missing they have also been marked above
|
||||
*missingGamePakChecksum = _gamePakChecksum;
|
||||
return PURE_MISSING;
|
||||
}
|
||||
// if assets paks are missing, don't try any of the DLL restart / NODLL
|
||||
if ( imissing ) {
|
||||
return PURE_MISSING;
|
||||
}
|
||||
// we have a matching pak
|
||||
if ( fs_debug.GetBool() ) {
|
||||
common->Printf( "server's game code pak candidate is '%s' ( 0x%x )\n", pack->pakFilename.c_str(), pack->checksum );
|
||||
}
|
||||
// make sure there is a valid DLL for us
|
||||
if ( pack->hashTable[ dllHash ] ) {
|
||||
for ( pakFile = pack->hashTable[ dllHash ]; pakFile; pakFile = pakFile->next ) {
|
||||
if ( !FilenameCompare( pakFile->name, dllName ) ) {
|
||||
gamePakChecksum = _gamePakChecksum; // this will be used to extract the DLL in pure mode FindDLL
|
||||
return PURE_RESTART;
|
||||
}
|
||||
}
|
||||
}
|
||||
common->Warning( "media is misconfigured. server claims pak '%s' ( 0x%x ) has media for us, but '%s' is not found\n", pack->pakFilename.c_str(), pack->checksum, dllName );
|
||||
return PURE_NODLL;
|
||||
}
|
||||
|
||||
// we reply to missing after DLL check so it can be part of the list
|
||||
if ( imissing ) {
|
||||
return PURE_MISSING;
|
||||
|
|
|
@ -72,7 +72,6 @@ typedef enum {
|
|||
PURE_OK, // we are good to connect as-is
|
||||
PURE_RESTART, // restart required
|
||||
PURE_MISSING, // pak files missing on the client
|
||||
PURE_NODLL // no DLL could be extracted
|
||||
} fsPureReply_t;
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -917,7 +917,6 @@ void idAsyncClient::ProcessReliableMessagePure( const idBitMsg &msg ) {
|
|||
outMsg.WriteInt( inChecksums[ i++ ] );
|
||||
}
|
||||
outMsg.WriteInt( 0 );
|
||||
outMsg.WriteInt( gamePakChecksum );
|
||||
|
||||
if ( !channel.SendReliableMessage( outMsg ) ) {
|
||||
common->Error( "client->server reliable messages overflow\n" );
|
||||
|
@ -1383,7 +1382,7 @@ idAsyncClient::ValidatePureServerChecksums
|
|||
bool idAsyncClient::ValidatePureServerChecksums( const netadr_t from, const idBitMsg &msg ) {
|
||||
int i, numChecksums, numMissingChecksums;
|
||||
int inChecksums[ MAX_PURE_PAKS ];
|
||||
int inGamePakChecksum;
|
||||
int inGamePakChecksum = 0;
|
||||
int missingChecksums[ MAX_PURE_PAKS ];
|
||||
int missingGamePakChecksum;
|
||||
idBitMsg dlmsg;
|
||||
|
@ -1402,7 +1401,6 @@ bool idAsyncClient::ValidatePureServerChecksums( const netadr_t from, const idBi
|
|||
}
|
||||
} while ( i );
|
||||
inChecksums[ numChecksums ] = 0;
|
||||
inGamePakChecksum = msg.ReadInt();
|
||||
|
||||
fsPureReply_t reply = fileSystem->SetPureServerChecksums( inChecksums, inGamePakChecksum, missingChecksums, &missingGamePakChecksum );
|
||||
switch ( reply ) {
|
||||
|
@ -1431,9 +1429,6 @@ bool idAsyncClient::ValidatePureServerChecksums( const netadr_t from, const idBi
|
|||
if ( numMissingChecksums > 0 ) {
|
||||
message += va( common->GetLanguageDict()->GetString( "#str_06751" ), numMissingChecksums, checksums.c_str() );
|
||||
}
|
||||
if ( missingGamePakChecksum ) {
|
||||
message += va( common->GetLanguageDict()->GetString( "#str_06750" ), missingGamePakChecksum );
|
||||
}
|
||||
|
||||
common->Printf( message );
|
||||
cmdSystem->BufferCommandText( CMD_EXEC_NOW, "disconnect" );
|
||||
|
@ -1445,10 +1440,7 @@ bool idAsyncClient::ValidatePureServerChecksums( const netadr_t from, const idBi
|
|||
return false;
|
||||
}
|
||||
// ask the server to send back download info
|
||||
common->DPrintf( "missing %d paks: %s\n", numMissingChecksums + ( missingGamePakChecksum ? 1 : 0 ), checksums.c_str() );
|
||||
if ( missingGamePakChecksum ) {
|
||||
common->DPrintf( "game code pak: 0x%x\n", missingGamePakChecksum );
|
||||
}
|
||||
common->DPrintf( "missing %d paks: %s\n", numMissingChecksums, checksums.c_str() );
|
||||
// store the requested downloads
|
||||
GetDownloadRequest( missingChecksums, numMissingChecksums, missingGamePakChecksum );
|
||||
// build the download request message
|
||||
|
@ -1461,7 +1453,6 @@ bool idAsyncClient::ValidatePureServerChecksums( const netadr_t from, const idBi
|
|||
// used to make sure the server replies to the same download request
|
||||
dlmsg.WriteInt( dlRequest );
|
||||
// special case the code pak - if we have a 0 checksum then we don't need to download it
|
||||
dlmsg.WriteInt( missingGamePakChecksum );
|
||||
// 0-terminated list of missing paks
|
||||
i = 0;
|
||||
while ( missingChecksums[ i ] ) {
|
||||
|
@ -1473,10 +1464,6 @@ bool idAsyncClient::ValidatePureServerChecksums( const netadr_t from, const idBi
|
|||
|
||||
return false;
|
||||
}
|
||||
case PURE_NODLL:
|
||||
common->Printf( common->GetLanguageDict()->GetString( "#str_07211" ), Sys_NetAdrToString( from ) );
|
||||
cmdSystem->BufferCommandText( CMD_EXEC_NOW, "disconnect" );
|
||||
return false;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1516,7 +1503,7 @@ void idAsyncClient::ProcessPureMessage( const netadr_t from, const idBitMsg &msg
|
|||
outMsg.WriteInt( inChecksums[ i++ ] );
|
||||
}
|
||||
outMsg.WriteInt( 0 );
|
||||
outMsg.WriteInt( gamePakChecksum );
|
||||
|
||||
clientPort.SendPacket( from, outMsg.GetData(), outMsg.GetSize() );
|
||||
}
|
||||
|
||||
|
@ -2321,15 +2308,14 @@ idAsyncClient::GetDownloadRequest
|
|||
*/
|
||||
int idAsyncClient::GetDownloadRequest( const int checksums[ MAX_PURE_PAKS ], int count, int gamePakChecksum ) {
|
||||
assert( !checksums[ count ] ); // 0-terminated
|
||||
if ( memcmp( dlChecksums + 1, checksums, sizeof( int ) * count ) || gamePakChecksum != dlChecksums[ 0 ] ) {
|
||||
if ( memcmp( dlChecksums, checksums, sizeof( int ) * count ) ) {
|
||||
idRandom newreq;
|
||||
|
||||
dlChecksums[ 0 ] = gamePakChecksum;
|
||||
memcpy( dlChecksums + 1, checksums, sizeof( int ) * MAX_PURE_PAKS );
|
||||
memcpy( dlChecksums, checksums, sizeof( int ) * MAX_PURE_PAKS );
|
||||
|
||||
newreq.SetSeed( Sys_Milliseconds() );
|
||||
dlRequest = newreq.RandomInt();
|
||||
dlCount = count + ( gamePakChecksum ? 1 : 0 );
|
||||
dlCount = count;
|
||||
return dlRequest;
|
||||
}
|
||||
// this is the same dlRequest, we haven't heard from the server. keep the same id
|
||||
|
|
|
@ -337,16 +337,6 @@ void idAsyncServer::ExecuteMapChange( void ) {
|
|||
}
|
||||
}
|
||||
|
||||
// setup the game pak checksums
|
||||
// since this is not dependant on si_pure we catch anything bad before loading map
|
||||
if ( sessLocal.mapSpawnData.serverInfo.GetInt( "si_pure" ) ) {
|
||||
if ( !fileSystem->UpdateGamePakChecksums( ) ) {
|
||||
session->MessageBox( MSG_OK, common->GetLanguageDict()->GetString ( "#str_04337" ), common->GetLanguageDict()->GetString ( "#str_04338" ), true );
|
||||
cmdSystem->BufferCommandText( CMD_EXEC_APPEND, "disconnect\n" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// load map
|
||||
sessLocal.ExecuteMapChange();
|
||||
|
||||
|
@ -1583,9 +1573,6 @@ bool idAsyncServer::SendPureServerMessage( const netadr_t to, int OS ) {
|
|||
}
|
||||
outMsg.WriteInt( 0 );
|
||||
|
||||
// write the pak checksum for game code
|
||||
outMsg.WriteInt( gamePakChecksum );
|
||||
|
||||
serverPort.SendPacket( to, outMsg.GetData(), outMsg.GetSize() );
|
||||
return true;
|
||||
}
|
||||
|
@ -1621,7 +1608,6 @@ bool idAsyncServer::SendReliablePureToClient( int clientNum ) {
|
|||
msg.WriteInt( serverChecksums[ i++ ] );
|
||||
}
|
||||
msg.WriteInt( 0 );
|
||||
msg.WriteInt( gamePakChecksum );
|
||||
|
||||
SendReliableMessage( clientNum, msg );
|
||||
|
||||
|
@ -1885,7 +1871,6 @@ idAsyncServer::VerifyChecksumMessage
|
|||
bool idAsyncServer::VerifyChecksumMessage( int clientNum, const netadr_t *from, const idBitMsg &msg, idStr &reply, int OS ) {
|
||||
int i, numChecksums;
|
||||
int checksums[ MAX_PURE_PAKS ];
|
||||
int gamePakChecksum;
|
||||
int serverChecksums[ MAX_PURE_PAKS ];
|
||||
int serverGamePakChecksum;
|
||||
|
||||
|
@ -1903,18 +1888,9 @@ bool idAsyncServer::VerifyChecksumMessage( int clientNum, const netadr_t *from,
|
|||
} while ( i );
|
||||
numChecksums--;
|
||||
|
||||
// code pak checksum
|
||||
gamePakChecksum = msg.ReadInt( );
|
||||
|
||||
fileSystem->GetPureServerChecksums( serverChecksums, OS, &serverGamePakChecksum );
|
||||
assert( serverChecksums[ 0 ] );
|
||||
|
||||
// compare the lists
|
||||
if ( serverGamePakChecksum != gamePakChecksum ) {
|
||||
common->Printf( "client %s: invalid game code pak ( 0x%x )\n", from ? Sys_NetAdrToString( *from ) : va( "%d", clientNum ), gamePakChecksum );
|
||||
sprintf( reply, "#str_07145" );
|
||||
return false;
|
||||
}
|
||||
for ( i = 0; serverChecksums[ i ] != 0; i++ ) {
|
||||
if ( checksums[ i ] != serverChecksums[ i ] ) {
|
||||
common->DPrintf( "client %s: pak missing ( 0x%x )\n", from ? Sys_NetAdrToString( *from ) : va( "%d", clientNum ), serverChecksums[ i ] );
|
||||
|
@ -2673,7 +2649,6 @@ idAsyncServer::ProcessDownloadRequestMessage
|
|||
*/
|
||||
void idAsyncServer::ProcessDownloadRequestMessage( const netadr_t from, const idBitMsg &msg ) {
|
||||
int challenge, clientId, iclient, numPaks, i;
|
||||
int dlGamePak;
|
||||
int dlPakChecksum;
|
||||
int dlSize[ MAX_PURE_PAKS ]; // sizes
|
||||
idStrList pakNames; // relative path
|
||||
|
@ -2699,18 +2674,6 @@ void idAsyncServer::ProcessDownloadRequestMessage( const netadr_t from, const id
|
|||
return;
|
||||
}
|
||||
|
||||
// the first token of the pak names list passed to the game will be empty if no game pak is requested
|
||||
dlGamePak = msg.ReadInt();
|
||||
if ( dlGamePak ) {
|
||||
if ( !( dlSize[ 0 ] = fileSystem->ValidateDownloadPakForChecksum( dlGamePak, pakbuf, true ) ) ) {
|
||||
common->Warning( "client requested unknown game pak 0x%x", dlGamePak );
|
||||
pakbuf[ 0 ] = '\0';
|
||||
voidSlots++;
|
||||
}
|
||||
} else {
|
||||
pakbuf[ 0 ] = '\0';
|
||||
voidSlots++;
|
||||
}
|
||||
pakNames.Append( pakbuf );
|
||||
numPaks = 1;
|
||||
|
||||
|
|
Loading…
Reference in a new issue