From f6e0c6fd19adf854f87abc3abba3c65c1a34c85a Mon Sep 17 00:00:00 2001 From: Ludwig Nussel Date: Sat, 30 Dec 2006 16:16:25 +0000 Subject: [PATCH] - also check for point release pak files - make missing pak0 non fatal if fs_game != baseq3. This way total conversions like westernq3 work without Q3 data. --- code/qcommon/files.c | 76 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 61 insertions(+), 15 deletions(-) diff --git a/code/qcommon/files.c b/code/qcommon/files.c index df905888..f975f27d 100644 --- a/code/qcommon/files.c +++ b/code/qcommon/files.c @@ -196,12 +196,20 @@ or configs will never get loaded from disk! */ -#define DEMOGAME "demota" - // every time a new demo pk3 file is built, this checksum must be updated. // the easiest way to get it is to just run the game and see what it spits out #define DEMO_PAK0_CHECKSUM 2985612116u -#define PAK0_CHECKSUM 1566731103u +static const unsigned pak_checksums[] = { + 1566731103u, + 298122907u, + 412165236u, + 2991495316u, + 1197932710u, + 4087071573u, + 3709064859u, + 908855077u, + 977125798u +}; // if this is defined, the executable positively won't work with any paks other // than the demo pak, even if productid is present. This is only used for our @@ -2893,14 +2901,18 @@ Q3 media pak0.pk3, you'll want to remove this function static void FS_CheckPak0( void ) { searchpath_t *path; - qboolean foundPak0 = qfalse; + qboolean founddemo = qfalse; + unsigned foundPak = 0; for( path = fs_searchpaths; path; path = path->next ) { - if( path->pack && - !Q_stricmpn( path->pack->pakBasename, "pak0", MAX_OSPATH ) && - (!Q_stricmpn( path->pack->pakGamename, BASEGAME, MAX_OSPATH ) || - !Q_stricmpn( path->pack->pakGamename, "demoq3", MAX_OSPATH ))) { - foundPak0 = qtrue; + const char* pakBasename = path->pack->pakBasename; + + if(!path->pack) + continue; + + if(!Q_stricmpn( path->pack->pakGamename, "demoq3", MAX_OSPATH ) + && !Q_stricmpn( pakBasename, "pak0", MAX_OSPATH )) { + founddemo = qtrue; if( path->pack->checksum == DEMO_PAK0_CHECKSUM ) { Com_Printf( "\n\n" @@ -2909,22 +2921,56 @@ static void FS_CheckPak0( void ) "from the demo. This may work fine, but it is not\n" "guaranteed or supported.\n" "**************************************************\n\n\n" ); - } else if( path->pack->checksum != PAK0_CHECKSUM ) { - Com_Printf( "\n\n" + } + } else if(!Q_stricmpn( path->pack->pakGamename, BASEGAME, MAX_OSPATH ) + && strlen(pakBasename) == 4 && !Q_stricmpn( pakBasename, "pak", 3 ) + && pakBasename[3] >= '0' && pakBasename[3] <= '8') { + + if( path->pack->checksum != pak_checksums[pakBasename[3]-'0'] ) { + if(pakBasename[0] == '0') { + Com_Printf("\n\n" "**************************************************\n" "WARNING: pak0.pk3 is present but its checksum (%u)\n" "is not correct. Please re-copy pak0.pk3 from your\n" "legitimate Q3 CDROM.\n" "**************************************************\n\n\n", path->pack->checksum ); + } else { + Com_Printf("\n\n" + "**************************************************\n" + "WARNING: pak%d.pk3 is present but its checksum (%u)\n" + "is not correct. Please re-install the point release\n" + "**************************************************\n\n\n", + pakBasename[3]-'0', path->pack->checksum ); + } } + + foundPak |= 1<<(pakBasename[3]-'0'); } } - if( !foundPak0 ) { - Com_Error( ERR_FATAL, "Couldn't find pak0.pk3. Check that your Q3\n" - "executable is in the correct place and that every file\n" - "in the %s directory is present and readable.", BASEGAME); + if( !founddemo && foundPak != 0x1ff ) { + if((foundPak&1) != 1 ) { + Com_Printf("\n\n" + "pak0.pk3 is missing. Please copy it\n" + "from your legitimate Q3 CDROM.\n"); + } + + if((foundPak&0x1fe) != 0x1fe ) { + Com_Printf("\n\n" + "Point Release files are missing. Please\n" + "re-install the 1.32 point release.\n"); + } + + Com_Printf("\n\n" + "Also check that your Q3 executable is in\n" + "the correct place and that every file\n" + "in the %s directory is present and readable.\n", BASEGAME); + + if(!fs_gamedirvar->string[0] + || !Q_stricmp( fs_gamedirvar->string, BASEGAME ) + || !Q_stricmp( fs_gamedirvar->string, "missionpack" )) + Com_Error(ERR_FATAL, "\n*** you need to install Quake III Arena in order to play ***"); } }