Skip to content

Commit

Permalink
filesystem: massively rework how scanning game directories work
Browse files Browse the repository at this point in the history
* No more conversion from liblist.gam to gameinfo.txt. We are using liblist.gam directly now.
  gameinfo.txt being native format to Xash3D not only remains, it takes priority over liblist.gam.
* Quake game directories now don't receive autogenerated gameinfo.txt.
* Empty directories don't get gameinfo.txt either, finally making it easier to support HD addon folders.
* If user still wishes to generate gameinfo.txt, there is now command fs_make_gameinfo that creates
  gameinfo.txt for currently running game.
* No more creating empty folders for RoDir. They are now created on demand.
  • Loading branch information
a1batross committed Jan 7, 2025
1 parent 6099d5e commit d3feb6c
Show file tree
Hide file tree
Showing 5 changed files with 285 additions and 194 deletions.
6 changes: 6 additions & 0 deletions engine/common/filesystem_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ static void FS_Path_f_( void )
FS_Path_f();
}

static void FS_MakeGameInfo_f( void )
{
g_fsapi.MakeGameInfo();
}

static const fs_interface_t fs_memfuncs =
{
Con_Printf,
Expand Down Expand Up @@ -272,6 +277,7 @@ void FS_Init( const char *basedir )
Cmd_AddRestrictedCommand( "fs_rescan", FS_Rescan_f, "rescan filesystem search pathes" );
Cmd_AddRestrictedCommand( "fs_path", FS_Path_f_, "show filesystem search pathes" );
Cmd_AddRestrictedCommand( "fs_clearpaths", FS_ClearPaths_f, "clear filesystem search pathes" );
Cmd_AddRestrictedCommand( "fs_make_gameinfo", FS_MakeGameInfo_f, "create gameinfo.txt for current running game" );

if( !Sys_GetParmFromCmdLine( "-dll", host.gamedll ))
host.gamedll[0] = 0;
Expand Down
6 changes: 3 additions & 3 deletions filesystem/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ static void FS_PopulateDirEntries( dir_t *dir, const char *path )
}

stringlistinit( &list );
listdirectory( &list, path );
listdirectory( &list, path, false );
if( !list.numstrings )
{
dir->numentries = DIRENTRY_EMPTY_DIRECTORY;
Expand Down Expand Up @@ -225,7 +225,7 @@ static int FS_MaybeUpdateDirEntries( dir_t *dir, const char *path, const char *e
int ret;

stringlistinit( &list );
listdirectory( &list, path );
listdirectory( &list, path, false );

if( list.numstrings == 0 ) // empty directory
{
Expand Down Expand Up @@ -421,7 +421,7 @@ static void FS_Search_DIR( searchpath_t *search, stringlist_t *list, const char
}

stringlistinit( &dirlist );
listdirectory( &dirlist, netpath );
listdirectory( &dirlist, netpath, false );

Q_strncpy( temp, basepath, sizeof( temp ));

Expand Down
Loading

0 comments on commit d3feb6c

Please sign in to comment.