Skip to content

Commit 8956a35

Browse files
committed
Shared: Merge ioquake/ioq3@376267d
Don't load .pk3s as .dlls, and don't load user config files from .pk3s.
1 parent b823aa7 commit 8956a35

File tree

5 files changed

+25
-2
lines changed

5 files changed

+25
-2
lines changed

Diff for: code/client/cl_main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ void CL_InitRef( void ) {
10841084
GetRefAPI_t GetRefAPI;
10851085

10861086
Com_Printf( "----- Initializing Renderer ----\n" );
1087-
cl_renderer = Cvar_Get( "cl_renderer", DEFAULT_RENDER_LIBRARY, CVAR_ARCHIVE|CVAR_LATCH );
1087+
cl_renderer = Cvar_Get( "cl_renderer", DEFAULT_RENDER_LIBRARY, CVAR_ARCHIVE|CVAR_LATCH|CVAR_PROTECTED );
10881088

10891089
Com_sprintf( dllName, sizeof( dllName ), "%s_" ARCH_STRING DLL_EXT, cl_renderer->string );
10901090

Diff for: code/qcommon/files.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,7 @@ long FS_FOpenFileRead( const char *filename, fileHandle_t *file, qboolean unique
12581258
long hash;
12591259
//unz_s *zfi;
12601260
//void *temp;
1261+
bool isUserConfig = false;
12611262

12621263
hash = 0;
12631264

@@ -1291,6 +1292,8 @@ long FS_FOpenFileRead( const char *filename, fileHandle_t *file, qboolean unique
12911292
return -1;
12921293
}
12931294

1295+
isUserConfig = !Q_stricmp( filename, "autoexec_sp.cfg" ) || !Q_stricmp( filename, Q3CONFIG_NAME );
1296+
12941297
//
12951298
// search through the path, one element at a time
12961299
//
@@ -1316,6 +1319,11 @@ long FS_FOpenFileRead( const char *filename, fileHandle_t *file, qboolean unique
13161319
}
13171320
// is the element a pak file?
13181321
if ( search->pack && search->pack->hashTable[hash] ) {
1322+
// autoexec_sp.cfg and openjk_sp.cfg can only be loaded outside of pk3 files.
1323+
if ( isUserConfig ) {
1324+
continue;
1325+
}
1326+
13191327
// look through all the pak file elements
13201328
pak = search->pack;
13211329
pakFile = pak->hashTable[hash];

Diff for: codemp/client/cl_main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2364,7 +2364,7 @@ void CL_InitRef( void ) {
23642364

23652365
Com_Printf( "----- Initializing Renderer ----\n" );
23662366

2367-
cl_renderer = Cvar_Get( "cl_renderer", DEFAULT_RENDER_LIBRARY, CVAR_ARCHIVE|CVAR_LATCH, "Which renderer library to use" );
2367+
cl_renderer = Cvar_Get( "cl_renderer", DEFAULT_RENDER_LIBRARY, CVAR_ARCHIVE|CVAR_LATCH|CVAR_PROTECTED, "Which renderer library to use" );
23682368

23692369
Com_sprintf( dllName, sizeof( dllName ), "%s_" ARCH_STRING DLL_EXT, cl_renderer->string );
23702370

Diff for: codemp/qcommon/files.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -1267,6 +1267,7 @@ long FS_FOpenFileRead( const char *filename, fileHandle_t *file, qboolean unique
12671267
//unz_s *zfi;
12681268
//void *temp;
12691269
int l;
1270+
bool isUserConfig = false;
12701271

12711272
hash = 0;
12721273

@@ -1300,6 +1301,8 @@ long FS_FOpenFileRead( const char *filename, fileHandle_t *file, qboolean unique
13001301
return -1;
13011302
}
13021303

1304+
isUserConfig = !Q_stricmp( filename, "autoexec.cfg" ) || !Q_stricmp( filename, Q3CONFIG_CFG );
1305+
13031306
//
13041307
// search through the path, one element at a time
13051308
//
@@ -1330,6 +1333,11 @@ long FS_FOpenFileRead( const char *filename, fileHandle_t *file, qboolean unique
13301333
continue;
13311334
}
13321335

1336+
// autoexec.cfg and openjk.cfg can only be loaded outside of pk3 files.
1337+
if ( isUserConfig ) {
1338+
continue;
1339+
}
1340+
13331341
// look through all the pak file elements
13341342
pak = search->pack;
13351343
pakFile = pak->hashTable[hash];

Diff for: shared/sys/sys_main.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,13 @@ void *Sys_LoadDll( const char *name, qboolean useSystemLib )
298298
{
299299
void *dllhandle = NULL;
300300

301+
// Don't load any DLLs that end with the pk3 extension
302+
if ( COM_CompareExtension( name, ".pk3" ) )
303+
{
304+
Com_Printf( S_COLOR_YELLOW "WARNING: Rejecting DLL named \"%s\"", name );
305+
return NULL;
306+
}
307+
301308
if ( useSystemLib )
302309
{
303310
Com_Printf( "Trying to load \"%s\"...\n", name );

0 commit comments

Comments
 (0)