From 3bd7a8d842536cc998d1abae19058ecc17084738 Mon Sep 17 00:00:00 2001 From: SmileTheory Date: Fri, 25 Sep 2015 04:52:17 -0700 Subject: [PATCH] Search for mods in steam path as well as home and base paths. --- code/qcommon/files.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/code/qcommon/files.c b/code/qcommon/files.c index a0440839..77dfd295 100644 --- a/code/qcommon/files.c +++ b/code/qcommon/files.c @@ -2502,6 +2502,8 @@ int FS_GetModList( char *listbuf, int bufsize ) { int dummy; char **pFiles0 = NULL; char **pFiles1 = NULL; + char **pFiles2 = NULL; + char **pFiles3 = NULL; qboolean bDrop = qfalse; *listbuf = 0; @@ -2509,9 +2511,12 @@ int FS_GetModList( char *listbuf, int bufsize ) { pFiles0 = Sys_ListFiles( fs_homepath->string, NULL, NULL, &dummy, qtrue ); pFiles1 = Sys_ListFiles( fs_basepath->string, NULL, NULL, &dummy, qtrue ); + pFiles2 = Sys_ListFiles( fs_steampath->string, NULL, NULL, &dummy, qtrue ); // we searched for mods in the three paths // it is likely that we have duplicate names now, which we will cleanup below - pFiles = Sys_ConcatenateFileLists( pFiles0, pFiles1 ); + pFiles3 = Sys_ConcatenateFileLists( pFiles0, pFiles1 ); + pFiles = Sys_ConcatenateFileLists( pFiles2, pFiles3 ); + nPotential = Sys_CountFileList(pFiles); for ( i = 0 ; i < nPotential ; i++ ) { @@ -2553,6 +2558,15 @@ int FS_GetModList( char *listbuf, int bufsize ) { Sys_FreeFileList( pPaks ); } + /* try on steam path */ + if ( nPaks <= 0 ) + { + path = FS_BuildOSPath( fs_steampath->string, name, "" ); + nPaks = 0; + pPaks = Sys_ListFiles( path, ".pk3", NULL, &nPaks, qfalse ); + Sys_FreeFileList( pPaks ); + } + if (nPaks > 0) { nLen = strlen(name) + 1; // nLen is the length of the mod path @@ -3320,6 +3334,9 @@ static void FS_Startup( const char *gameName ) // check for additional base game so mods can be based upon other mods if ( fs_basegame->string[0] && Q_stricmp( fs_basegame->string, gameName ) ) { + if (fs_steampath->string[0]) { + FS_AddGameDirectory(fs_steampath->string, fs_basegame->string); + } if (fs_basepath->string[0]) { FS_AddGameDirectory(fs_basepath->string, fs_basegame->string); } @@ -3330,6 +3347,9 @@ static void FS_Startup( const char *gameName ) // check for additional game folder for mods if ( fs_gamedirvar->string[0] && Q_stricmp( fs_gamedirvar->string, gameName ) ) { + if (fs_steampath->string[0]) { + FS_AddGameDirectory(fs_steampath->string, fs_gamedirvar->string); + } if (fs_basepath->string[0]) { FS_AddGameDirectory(fs_basepath->string, fs_gamedirvar->string); }