From e88b16c9e727562ee2d14813cd903b21b1a46344 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sun, 21 Jan 2024 11:37:44 -0600 Subject: [PATCH 1/3] Add better directions/error for missing default pk3 files --- code/qcommon/files.c | 118 +++++++++++++++++++++++++++++++++---------- 1 file changed, 91 insertions(+), 27 deletions(-) diff --git a/code/qcommon/files.c b/code/qcommon/files.c index 11d46aedc5..f9f721de2a 100644 --- a/code/qcommon/files.c +++ b/code/qcommon/files.c @@ -3452,6 +3452,64 @@ static void FS_Startup( const char *gameName ) } #ifndef STANDALONE +/* +=================== +FS_AppendUserFriendlyPakList +=================== +*/ +static void FS_AppendUserFriendlyPakList( char *buf, size_t bufsize, int foundPakFiles, int numPakFiles ) +{ + int missingCount = 0; + int missingIndex = 0; + int missingMin = numPakFiles; + int missingMax = 0; + qboolean missingConsecutive = qtrue; + int i; + + for ( i = 0; i < numPakFiles; i++ ) { + if ( foundPakFiles & ( 1 << i ) ) { + continue; + } + + missingCount++; + + if ( missingMin > i ) { + missingMin = i; + } + if ( missingMax < i ) { + missingMax = i; + } + + if ( i > missingMin && ( foundPakFiles & ( 1<< ( i - 1 ) ) ) ) { + missingConsecutive = qfalse; + } + } + + if ( missingConsecutive && missingMax >= missingMin + 2 ) { + Q_strcat( buf, bufsize, + va( " \"pak%d.pk3\" through \"pak%d.pk3\"", + missingMin, missingMax ) ); + } else { + for ( i = 0; i < numPakFiles; i++ ) { + if ( foundPakFiles & (1< 0 && missingCount > 2 ) { + Q_strcat( buf, bufsize, "," ); + } + + if ( missingIndex == missingCount - 1 && missingCount > 1 ) { + Q_strcat( buf, bufsize, " and" ); + } + + Q_strcat( buf, bufsize, va( " \"pak%d.pk3\"", i ) ); + + missingIndex++; + } + } +} + /* =================== FS_CheckPak0 @@ -3600,24 +3658,24 @@ static void FS_CheckPak0( void ) } } - - if(!com_standalone->integer && (foundPak & 0x1ff) != 0x1ff) + if(!com_standalone->integer && (foundPak & ((1<string, PATH_SEP, BASEGAME, PATH_SEP)); + + Q_strcat(errorText, sizeof(errorText), + "Quake 3 must be purchased to legitimately obtain pak0. " + "Quake 3 1.32 point release files (pak1 through pak8) " + "are freely available at:\n\n" + "https://ioquake3.org/extras/patch-data/\n\n"); Q_strcat(errorText, sizeof(errorText), va("Also check that your ioq3 executable is in " @@ -3627,23 +3685,29 @@ static void FS_CheckPak0( void ) Com_Error(ERR_FATAL, "%s", errorText); } - if(!com_standalone->integer && foundTA && (foundTA & 0x0f) != 0x0f) + if(!com_standalone->integer && foundTA && (foundTA & ((1<string, PATH_SEP, BASETA, PATH_SEP)); + + Q_strcat(errorText, sizeof(errorText), + "Quake 3 Team Arena must be purchased to legitimately obtain pak0. " + "Quake 3 Team Arena point release files (pak1 through pak3) " + "are freely available at:\n\n" + "https://ioquake3.org/extras/patch-data/\n\n"); + + Q_strcat(errorText, sizeof(errorText), + va("Also check that your ioq3 executable is in " + "the correct place and that every file " + "in the \"%s\" directory is present and readable", BASETA)); Com_Error(ERR_FATAL, "%s", errorText); } From 4dfc81da85477792cd6d654f751ac0bb97c5e632 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sun, 21 Jan 2024 12:36:46 -0600 Subject: [PATCH 2/3] Make Team Arena pk3 error show when missing all pk3 files The error was only displayed for Team Arena if one of the Team Arena pk3s were found. Fix it to be display when trying to run Team Arena even with no Team Arena pk3s present. --- code/qcommon/files.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/qcommon/files.c b/code/qcommon/files.c index f9f721de2a..3962caeffe 100644 --- a/code/qcommon/files.c +++ b/code/qcommon/files.c @@ -3685,7 +3685,8 @@ static void FS_CheckPak0( void ) Com_Error(ERR_FATAL, "%s", errorText); } - if(!com_standalone->integer && foundTA && (foundTA & ((1<integer && (foundTA & ((1<string, BASETA) || !Q_stricmp(fs_basegame->string, BASETA))) { char errorText[MAX_STRING_CHARS] = ""; From a89a26f150871b6bd8ee70a7020f0102eff0b2a2 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sun, 21 Jan 2024 12:49:44 -0600 Subject: [PATCH 3/3] Make copy to clipboard in Windows error dialog include error message There is a copy to clipboard option but the error itself wasn't printed to the console so it wasn't copied to the clipboard. Unix-like platforms print it to the console so it's written in crashlog.txt. --- code/sys/sys_win32.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/sys/sys_win32.c b/code/sys/sys_win32.c index d5e1c637b5..f5c888567b 100644 --- a/code/sys/sys_win32.c +++ b/code/sys/sys_win32.c @@ -724,6 +724,8 @@ Display an error message */ void Sys_ErrorDialog( const char *error ) { + Sys_Print( va( "%s\n", error ) ); + if( Sys_Dialog( DT_YES_NO, va( "%s. Copy console log to clipboard?", error ), "Error" ) == DR_YES ) {