@@ -19,6 +19,20 @@ Provides user-friendly error messages and ensures content integrity.
1919
2020// Validation result structure is defined in qcommon.h
2121
22+ // Global validation status
23+ static qboolean contentValidationPassed = qfalse ;
24+
25+ /*
26+ =================
27+ FS_ContentValidationPassed
28+
29+ Returns whether content validation passed during startup.
30+ =================
31+ */
32+ qboolean FS_ContentValidationPassed (void ) {
33+ return contentValidationPassed ;
34+ }
35+
2236// Function prototypes
2337qboolean Mod_ApplySandboxRestrictions ( const char * modName );
2438void Mod_RemoveSandboxRestrictions ( const char * modName );
@@ -82,6 +96,11 @@ Returns qtrue if all required content is present.
8296*/
8397qboolean FS_ValidateGameContent ( fs_validation_result_t * result ) {
8498 char errorMsg [MAX_OSPATH ];
99+ const char * fs_game = Cvar_VariableString ("fs_game" );
100+
101+ // If we're playing a mod, be more lenient - don't require base game assets
102+ qboolean isMod = (fs_game && fs_game [0 ] && Q_stricmp (fs_game , "base" ) != 0 && Q_stricmp (fs_game , "baseq3" ) != 0 );
103+
85104 const char * requiredPaks [] = {
86105 "pak0.pk3" ,
87106 NULL
@@ -114,16 +133,20 @@ qboolean FS_ValidateGameContent( fs_validation_result_t *result ) {
114133 result -> corrupted_files = 0 ;
115134
116135 // Check for required pak files
136+ // For mods, be more lenient - don't require pak0.pk3 if mod has its own assets
117137 for ( i = 0 ; requiredPaks [i ] != NULL ; i ++ ) {
118138 char pakPath [MAX_OSPATH ];
119139 fileHandle_t f ;
120140
121141 // Try to find the pak file
122142 int fileLen = FS_FOpenFileRead ( requiredPaks [i ], & f , qfalse );
123143 if ( fileLen < 0 || f == FS_INVALID_HANDLE ) {
124- result -> missing_files ++ ;
125- result -> valid = qfalse ;
126- allValid = qfalse ;
144+ // For mods, missing pak0.pk3 is not necessarily fatal
145+ if (!isMod ) {
146+ result -> missing_files ++ ;
147+ result -> valid = qfalse ;
148+ allValid = qfalse ;
149+ }
127150 continue ;
128151 }
129152 FS_FCloseFile ( f );
@@ -150,7 +173,33 @@ qboolean FS_ValidateGameContent( fs_validation_result_t *result ) {
150173 }
151174 }
152175
153- // If we have pak files but no critical assets, something is wrong
176+ // For mods, be more lenient - if we have any content at all, consider it valid
177+ if (isMod ) {
178+ // Check if mod has any content at all
179+ char modPak [MAX_OSPATH ];
180+ fileHandle_t modF ;
181+
182+ Com_sprintf (modPak , sizeof (modPak ), "%s/pak0.pk3" , fs_game );
183+ int modFileLen = FS_FOpenFileRead (modPak , & modF , qfalse );
184+ if (modFileLen >= 0 && modF != FS_INVALID_HANDLE ) {
185+ FS_FCloseFile (modF );
186+ // Mod has its own pak file, consider it valid
187+ result -> valid = qtrue ;
188+ return qtrue ;
189+ }
190+
191+ // Check for any .bsp files in maps directory (indicates mod has maps)
192+ fileHandle_t mapF ;
193+ int mapLen = FS_FOpenFileRead ("maps/q3dm9.bsp" , & mapF , qfalse );
194+ if (mapLen >= 0 && mapF != FS_INVALID_HANDLE ) {
195+ FS_FCloseFile (mapF );
196+ // Mod has maps, consider it valid
197+ result -> valid = qtrue ;
198+ return qtrue ;
199+ }
200+ }
201+
202+ // For base game, require critical assets
154203 if ( hasBasicContent && availableAssets == 0 ) {
155204 Com_Printf ( S_COLOR_YELLOW "WARNING: Pak files found but no critical assets detected. Content may be incomplete.\n" );
156205 result -> valid = qfalse ;
@@ -405,18 +454,20 @@ Called from FS_Startup or launcher.
405454qboolean FS_ValidateContentOnStartup ( void ) {
406455 fs_validation_result_t result ;
407456 qboolean valid ;
408-
457+
409458 Com_Printf ( "Validating game content...\n" );
410-
459+
411460 valid = FS_ValidateGameContent ( & result );
412-
461+
462+ contentValidationPassed = valid ;
463+
413464 if ( !valid ) {
414465 FS_ReportMissingContent ( & result );
415466 // Don't fail startup - allow engine to run with missing content
416467 // (user might be setting up or testing)
417468 return qfalse ;
418469 }
419-
470+
420471 Com_Printf ( S_COLOR_GREEN "Content validation: OK\n" );
421472 return qtrue ;
422473}
0 commit comments