mirror of
https://github.com/dhewm/dhewm3.git
synced 2024-11-23 12:53:09 +00:00
Remove all gamepak FileSystem<->Async[Client|Server] code
This commit is contained in:
parent
b049ea78e9
commit
cac32559e7
6 changed files with 23 additions and 59 deletions
|
@ -7,7 +7,6 @@ cmake_minimum_required(VERSION 2.6)
|
|||
# osx: -weak_framework ?
|
||||
|
||||
# maybe add these as options:
|
||||
# BUILD_GAMEPAK
|
||||
# TARGET_MONO
|
||||
# SETUP
|
||||
# SDK -D_D3SDK
|
||||
|
|
|
@ -359,9 +359,9 @@ public:
|
|||
virtual void CreateOSPath( const char *OSPath );
|
||||
virtual bool FileIsInPAK( const char *relativePath );
|
||||
virtual void UpdatePureServerChecksums( void );
|
||||
virtual fsPureReply_t SetPureServerChecksums( const int pureChecksums[ MAX_PURE_PAKS ], int gamePakChecksum, int missingChecksums[ MAX_PURE_PAKS ], int *missingGamePakChecksum );
|
||||
virtual void GetPureServerChecksums( int checksums[ MAX_PURE_PAKS ], int OS, int *gamePakChecksum );
|
||||
virtual void SetRestartChecksums( const int pureChecksums[ MAX_PURE_PAKS ], int gamePakChecksum );
|
||||
virtual fsPureReply_t SetPureServerChecksums( const int pureChecksums[ MAX_PURE_PAKS ], int missingChecksums[ MAX_PURE_PAKS ] );
|
||||
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 );
|
||||
|
@ -385,7 +385,7 @@ public:
|
|||
virtual bool HasD3XP( void );
|
||||
virtual bool RunningD3XP( void );
|
||||
virtual void CopyFile( const char *fromOSPath, const char *toOSPath );
|
||||
virtual int ValidateDownloadPakForChecksum( int checksum, char path[ MAX_STRING_CHARS ], bool isBinary );
|
||||
virtual int ValidateDownloadPakForChecksum( int checksum, char path[ MAX_STRING_CHARS ] );
|
||||
virtual idFile * MakeTemporaryFile( void );
|
||||
virtual int AddZipFile( const char *path );
|
||||
virtual findFile_t FindFile( const char *path, bool scheduleAddons );
|
||||
|
@ -435,9 +435,6 @@ private:
|
|||
bool loadedFileFromDir; // set to true once a file was loaded from a directory - can't switch to pure anymore
|
||||
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 )
|
||||
int restartGamePakChecksum;
|
||||
int gameDLLChecksum; // the checksum of the last loaded game DLL
|
||||
int gamePakChecksum; // the checksum of the pak holding the loaded game DLL
|
||||
|
||||
int gamePakForOS[ MAX_GAME_OS ];
|
||||
|
||||
|
@ -515,7 +512,6 @@ idFileSystemLocal::idFileSystemLocal( void ) {
|
|||
dir_cache_count = 0;
|
||||
d3xp = 0;
|
||||
loadedFileFromDir = false;
|
||||
restartGamePakChecksum = 0;
|
||||
memset( &backgroundThread, 0, sizeof( backgroundThread ) );
|
||||
backgroundThread_exit = false;
|
||||
addonPaks = NULL;
|
||||
|
@ -2390,9 +2386,6 @@ void idFileSystemLocal::Startup( void ) {
|
|||
}
|
||||
common->FatalError( "Failed to restart with pure mode restrictions for server connect" );
|
||||
}
|
||||
// also the game pak checksum
|
||||
// we could check if the game pak is actually present, but we would not be restarting if there wasn't one @ first pure check
|
||||
gamePakChecksum = restartGamePakChecksum;
|
||||
}
|
||||
|
||||
// add our commands
|
||||
|
@ -2477,12 +2470,11 @@ pack_t* idFileSystemLocal::GetPackForChecksum( int checksum, bool searchAddons )
|
|||
idFileSystemLocal::ValidateDownloadPakForChecksum
|
||||
===============
|
||||
*/
|
||||
int idFileSystemLocal::ValidateDownloadPakForChecksum( int checksum, char path[ MAX_STRING_CHARS ], bool isBinary ) {
|
||||
int idFileSystemLocal::ValidateDownloadPakForChecksum( int checksum, char path[ MAX_STRING_CHARS ] ) {
|
||||
int i;
|
||||
idStrList testList;
|
||||
idStr name;
|
||||
idStr relativePath;
|
||||
bool pakBinary;
|
||||
pack_t *pak = GetPackForChecksum( checksum );
|
||||
|
||||
if ( !pak ) {
|
||||
|
@ -2497,14 +2489,6 @@ int idFileSystemLocal::ValidateDownloadPakForChecksum( int checksum, char path[
|
|||
common->DPrintf( "%s is not a donwloadable pak\n", pak->pakFilename.c_str() );
|
||||
return 0;
|
||||
}
|
||||
// check the binary
|
||||
// a pure server sets the binary flag when starting the game
|
||||
assert( pak->binary != BINARY_UNKNOWN );
|
||||
pakBinary = ( pak->binary == BINARY_YES ) ? true : false;
|
||||
if ( isBinary != pakBinary ) {
|
||||
common->DPrintf( "%s binary flag mismatch\n", pak->pakFilename.c_str() );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// extract a path that includes the fs_game: != OSPathToRelativePath
|
||||
testList.Append( fs_savepath.GetString() );
|
||||
|
@ -2550,7 +2534,7 @@ DLL:
|
|||
the checksum of the pak containing the DLL is maintained seperately, the server can send different replies by OS
|
||||
=====================
|
||||
*/
|
||||
fsPureReply_t idFileSystemLocal::SetPureServerChecksums( const int pureChecksums[ MAX_PURE_PAKS ], int _gamePakChecksum, int missingChecksums[ MAX_PURE_PAKS ], int *missingGamePakChecksum ) {
|
||||
fsPureReply_t idFileSystemLocal::SetPureServerChecksums( const int pureChecksums[ MAX_PURE_PAKS ], int missingChecksums[ MAX_PURE_PAKS ] ) {
|
||||
pack_t *pack;
|
||||
int i, j, imissing;
|
||||
bool success = true;
|
||||
|
@ -2558,8 +2542,6 @@ fsPureReply_t idFileSystemLocal::SetPureServerChecksums( const int pureChecksums
|
|||
|
||||
imissing = 0;
|
||||
missingChecksums[ 0 ] = 0;
|
||||
assert( missingGamePakChecksum );
|
||||
*missingGamePakChecksum = 0;
|
||||
|
||||
if ( pureChecksums[ 0 ] == 0 ) {
|
||||
ClearPureChecksums();
|
||||
|
@ -2653,20 +2635,13 @@ fsPureReply_t idFileSystemLocal::SetPureServerChecksums( const int pureChecksums
|
|||
idFileSystemLocal::GetPureServerChecksums
|
||||
=====================
|
||||
*/
|
||||
void idFileSystemLocal::GetPureServerChecksums( int checksums[ MAX_PURE_PAKS ], int OS, int *_gamePakChecksum ) {
|
||||
void idFileSystemLocal::GetPureServerChecksums( int checksums[ MAX_PURE_PAKS ] ) {
|
||||
int i;
|
||||
|
||||
for ( i = 0; i < serverPaks.Num(); i++ ) {
|
||||
checksums[ i ] = serverPaks[ i ]->checksum;
|
||||
}
|
||||
checksums[ i ] = 0;
|
||||
if ( _gamePakChecksum ) {
|
||||
if ( OS >= 0 ) {
|
||||
*_gamePakChecksum = gamePakForOS[ OS ];
|
||||
} else {
|
||||
*_gamePakChecksum = gamePakChecksum;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2674,7 +2649,7 @@ void idFileSystemLocal::GetPureServerChecksums( int checksums[ MAX_PURE_PAKS ],
|
|||
idFileSystemLocal::SetRestartChecksums
|
||||
=====================
|
||||
*/
|
||||
void idFileSystemLocal::SetRestartChecksums( const int pureChecksums[ MAX_PURE_PAKS ], int gamePakChecksum ) {
|
||||
void idFileSystemLocal::SetRestartChecksums( const int pureChecksums[ MAX_PURE_PAKS ] ) {
|
||||
int i;
|
||||
pack_t *pack;
|
||||
|
||||
|
@ -2692,7 +2667,6 @@ void idFileSystemLocal::SetRestartChecksums( const int pureChecksums[ MAX_PURE_P
|
|||
restartChecksums.Append( pureChecksums[ i ] );
|
||||
i++;
|
||||
}
|
||||
restartGamePakChecksum = gamePakChecksum;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2794,8 +2768,6 @@ void idFileSystemLocal::Shutdown( bool reloading ) {
|
|||
addonChecksums.Clear();
|
||||
}
|
||||
loadedFileFromDir = false;
|
||||
gameDLLChecksum = 0;
|
||||
gamePakChecksum = 0;
|
||||
|
||||
ClearDirCache();
|
||||
|
||||
|
|
|
@ -201,13 +201,13 @@ public:
|
|||
// the function tries to configure pure mode from the paks already referenced and this new list
|
||||
// it returns wether the switch was successfull, and sets the missing checksums
|
||||
// the process is verbosive when fs_debug 1
|
||||
virtual fsPureReply_t SetPureServerChecksums( const int pureChecksums[ MAX_PURE_PAKS ], int gamePakChecksum, int missingChecksums[ MAX_PURE_PAKS ], int *missingGamePakChecksum ) = 0;
|
||||
virtual fsPureReply_t SetPureServerChecksums( const int pureChecksums[ MAX_PURE_PAKS ], int missingChecksums[ MAX_PURE_PAKS ] ) = 0;
|
||||
// fills a 0-terminated list of pak checksums for a client
|
||||
// if OS is -1, give the current game pak checksum. if >= 0, lookup the game pak table (server only)
|
||||
virtual void GetPureServerChecksums( int checksums[ MAX_PURE_PAKS ], int OS, int *gamePakChecksum ) = 0;
|
||||
virtual void GetPureServerChecksums( int checksums[ MAX_PURE_PAKS ] ) = 0;
|
||||
// before doing a restart, force the pure list and the search order
|
||||
// if the given checksum list can't be completely processed and set, will error out
|
||||
virtual void SetRestartChecksums( const int pureChecksums[ MAX_PURE_PAKS ], int gamePakChecksum ) = 0;
|
||||
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
|
||||
|
@ -265,7 +265,7 @@ public:
|
|||
virtual void CopyFile( const char *fromOSPath, const char *toOSPath ) = 0;
|
||||
|
||||
// lookup a relative path, return the size or 0 if not found
|
||||
virtual int ValidateDownloadPakForChecksum( int checksum, char path[ MAX_STRING_CHARS ], bool isGamePak ) = 0;
|
||||
virtual int ValidateDownloadPakForChecksum( int checksum, char path[ MAX_STRING_CHARS ] ) = 0;
|
||||
|
||||
virtual idFile * MakeTemporaryFile( void ) = 0;
|
||||
|
||||
|
|
|
@ -881,7 +881,6 @@ void idAsyncClient::ProcessReliableMessagePure( const idBitMsg &msg ) {
|
|||
byte msgBuf[ MAX_MESSAGE_SIZE ];
|
||||
int inChecksums[ MAX_PURE_PAKS ];
|
||||
int i;
|
||||
int gamePakChecksum;
|
||||
int serverGameInitId;
|
||||
|
||||
session->SetGUI( NULL, NULL );
|
||||
|
@ -906,7 +905,7 @@ void idAsyncClient::ProcessReliableMessagePure( const idBitMsg &msg ) {
|
|||
sessLocal.ExecuteMapChange( true );
|
||||
|
||||
// upon receiving our pure list, the server will send us SCS_INGAME and we'll start getting snapshots
|
||||
fileSystem->GetPureServerChecksums( inChecksums, -1, &gamePakChecksum );
|
||||
fileSystem->GetPureServerChecksums( inChecksums );
|
||||
outMsg.Init( msgBuf, sizeof( msgBuf ) );
|
||||
outMsg.WriteByte( CLIENT_RELIABLE_MESSAGE_PURE );
|
||||
|
||||
|
@ -1382,9 +1381,7 @@ idAsyncClient::ValidatePureServerChecksums
|
|||
bool idAsyncClient::ValidatePureServerChecksums( const netadr_t from, const idBitMsg &msg ) {
|
||||
int i, numChecksums, numMissingChecksums;
|
||||
int inChecksums[ MAX_PURE_PAKS ];
|
||||
int inGamePakChecksum = 0;
|
||||
int missingChecksums[ MAX_PURE_PAKS ];
|
||||
int missingGamePakChecksum;
|
||||
idBitMsg dlmsg;
|
||||
byte msgBuf[MAX_MESSAGE_SIZE];
|
||||
|
||||
|
@ -1402,14 +1399,14 @@ bool idAsyncClient::ValidatePureServerChecksums( const netadr_t from, const idBi
|
|||
} while ( i );
|
||||
inChecksums[ numChecksums ] = 0;
|
||||
|
||||
fsPureReply_t reply = fileSystem->SetPureServerChecksums( inChecksums, inGamePakChecksum, missingChecksums, &missingGamePakChecksum );
|
||||
fsPureReply_t reply = fileSystem->SetPureServerChecksums( inChecksums, missingChecksums );
|
||||
switch ( reply ) {
|
||||
case PURE_RESTART:
|
||||
// need to restart the filesystem with a different pure configuration
|
||||
cmdSystem->BufferCommandText( CMD_EXEC_NOW, "disconnect" );
|
||||
// restart with the right FS configuration and get back to the server
|
||||
clientState = CS_PURERESTART;
|
||||
fileSystem->SetRestartChecksums( inChecksums, inGamePakChecksum );
|
||||
fileSystem->SetRestartChecksums( inChecksums );
|
||||
cmdSystem->BufferCommandText( CMD_EXEC_NOW, "reloadEngine" );
|
||||
return false;
|
||||
case PURE_MISSING: {
|
||||
|
@ -1442,7 +1439,7 @@ bool idAsyncClient::ValidatePureServerChecksums( const netadr_t from, const idBi
|
|||
// ask the server to send back download info
|
||||
common->DPrintf( "missing %d paks: %s\n", numMissingChecksums, checksums.c_str() );
|
||||
// store the requested downloads
|
||||
GetDownloadRequest( missingChecksums, numMissingChecksums, missingGamePakChecksum );
|
||||
GetDownloadRequest( missingChecksums, numMissingChecksums );
|
||||
// build the download request message
|
||||
// NOTE: in a specific function?
|
||||
dlmsg.Init( msgBuf, sizeof( msgBuf ) );
|
||||
|
@ -1481,7 +1478,6 @@ void idAsyncClient::ProcessPureMessage( const netadr_t from, const idBitMsg &msg
|
|||
byte msgBuf[ MAX_MESSAGE_SIZE ];
|
||||
int i;
|
||||
int inChecksums[ MAX_PURE_PAKS ];
|
||||
int gamePakChecksum;
|
||||
|
||||
if ( clientState != CS_CONNECTING ) {
|
||||
common->Printf( "clientState != CS_CONNECTING, pure msg ignored\n" );
|
||||
|
@ -1492,7 +1488,7 @@ void idAsyncClient::ProcessPureMessage( const netadr_t from, const idBitMsg &msg
|
|||
return;
|
||||
}
|
||||
|
||||
fileSystem->GetPureServerChecksums( inChecksums, -1, &gamePakChecksum );
|
||||
fileSystem->GetPureServerChecksums( inChecksums );
|
||||
outMsg.Init( msgBuf, sizeof( msgBuf ) );
|
||||
outMsg.WriteShort( CONNECTIONLESS_MESSAGE_ID );
|
||||
outMsg.WriteString( "pureClient" );
|
||||
|
@ -2306,7 +2302,7 @@ void idAsyncClient::ProcessDownloadInfoMessage( const netadr_t from, const idBit
|
|||
idAsyncClient::GetDownloadRequest
|
||||
===============
|
||||
*/
|
||||
int idAsyncClient::GetDownloadRequest( const int checksums[ MAX_PURE_PAKS ], int count, int gamePakChecksum ) {
|
||||
int idAsyncClient::GetDownloadRequest( const int checksums[ MAX_PURE_PAKS ], int count ) {
|
||||
assert( !checksums[ count ] ); // 0-terminated
|
||||
if ( memcmp( dlChecksums, checksums, sizeof( int ) * count ) ) {
|
||||
idRandom newreq;
|
||||
|
|
|
@ -218,7 +218,7 @@ private:
|
|||
void ReadLocalizedServerString( const idBitMsg &msg, char* out, int maxLen );
|
||||
bool CheckTimeout( void );
|
||||
void ProcessDownloadInfoMessage( const netadr_t from, const idBitMsg &msg );
|
||||
int GetDownloadRequest( const int checksums[ MAX_PURE_PAKS ], int count, int gamePakChecksum );
|
||||
int GetDownloadRequest( const int checksums[ MAX_PURE_PAKS ], int count );
|
||||
};
|
||||
|
||||
#endif /* !__ASYNCCLIENT_H__ */
|
||||
|
|
|
@ -1551,10 +1551,9 @@ bool idAsyncServer::SendPureServerMessage( const netadr_t to, int OS ) {
|
|||
idBitMsg outMsg;
|
||||
byte msgBuf[ MAX_MESSAGE_SIZE ];
|
||||
int serverChecksums[ MAX_PURE_PAKS ];
|
||||
int gamePakChecksum;
|
||||
int i;
|
||||
|
||||
fileSystem->GetPureServerChecksums( serverChecksums, OS, &gamePakChecksum );
|
||||
fileSystem->GetPureServerChecksums( serverChecksums );
|
||||
if ( !serverChecksums[ 0 ] ) {
|
||||
// happens if you run fully expanded assets with si_pure 1
|
||||
common->Warning( "pure server has no pak files referenced" );
|
||||
|
@ -1587,9 +1586,8 @@ bool idAsyncServer::SendReliablePureToClient( int clientNum ) {
|
|||
byte msgBuf[ MAX_MESSAGE_SIZE ];
|
||||
int serverChecksums[ MAX_PURE_PAKS ];
|
||||
int i;
|
||||
int gamePakChecksum;
|
||||
|
||||
fileSystem->GetPureServerChecksums( serverChecksums, clients[ clientNum ].OS, &gamePakChecksum );
|
||||
fileSystem->GetPureServerChecksums( serverChecksums );
|
||||
if ( !serverChecksums[ 0 ] ) {
|
||||
// happens if you run fully expanded assets with si_pure 1
|
||||
common->Warning( "pure server has no pak files referenced" );
|
||||
|
@ -1872,7 +1870,6 @@ bool idAsyncServer::VerifyChecksumMessage( int clientNum, const netadr_t *from,
|
|||
int i, numChecksums;
|
||||
int checksums[ MAX_PURE_PAKS ];
|
||||
int serverChecksums[ MAX_PURE_PAKS ];
|
||||
int serverGamePakChecksum;
|
||||
|
||||
// pak checksums, in a 0-terminated list
|
||||
numChecksums = 0;
|
||||
|
@ -1888,7 +1885,7 @@ bool idAsyncServer::VerifyChecksumMessage( int clientNum, const netadr_t *from,
|
|||
} while ( i );
|
||||
numChecksums--;
|
||||
|
||||
fileSystem->GetPureServerChecksums( serverChecksums, OS, &serverGamePakChecksum );
|
||||
fileSystem->GetPureServerChecksums( serverChecksums );
|
||||
assert( serverChecksums[ 0 ] );
|
||||
|
||||
for ( i = 0; serverChecksums[ i ] != 0; i++ ) {
|
||||
|
@ -2680,7 +2677,7 @@ void idAsyncServer::ProcessDownloadRequestMessage( const netadr_t from, const id
|
|||
// read the checksums, build path names and pass that to the game code
|
||||
dlPakChecksum = msg.ReadInt();
|
||||
while ( dlPakChecksum ) {
|
||||
if ( !( dlSize[ numPaks ] = fileSystem->ValidateDownloadPakForChecksum( dlPakChecksum, pakbuf, false ) ) ) {
|
||||
if ( !( dlSize[ numPaks ] = fileSystem->ValidateDownloadPakForChecksum( dlPakChecksum, pakbuf ) ) ) {
|
||||
// we pass an empty token to the game so our list doesn't get offset
|
||||
common->Warning( "client requested an unknown pak 0x%x", dlPakChecksum );
|
||||
pakbuf[ 0 ] = '\0';
|
||||
|
|
Loading…
Reference in a new issue