[quakefs] Support loading dirconf directly

With this, it is a little easier to make qwaq independent of quake. The
default dirconf is still meant for quake, and fs_dirconf can still be
used to override the configuration.
This commit is contained in:
Bill Currie 2024-01-31 00:15:12 +09:00
parent 1d0b0f85af
commit 6151bab0d1
2 changed files with 23 additions and 1 deletions

View file

@ -109,6 +109,7 @@ extern int qfs_filesize;
struct cache_user_s;
struct dstring_s;
struct memhunk_s;
struct plitem_s;
/** Initialize the Quake Filesystem.
@ -125,6 +126,17 @@ struct memhunk_s;
*/
void QFS_Init (struct memhunk_s *hunk, const char *game);
/** Set the directory configuration prior to initialization
This allows the default configuration to be overriden at build time. Must
be called before QFS_Init is called. fs_dirconf will still allow the
configuration to be overridden.
\param config Property list specifity the directory layout used by the
engine. The list will be 'retained'.
*/
void QFS_SetConfig (struct plitem_s *config);
/** Change the current game directory.
The configuration for the game directory is taken from \ref dirconf.

View file

@ -718,6 +718,14 @@ no_config:
qfs_gd_plist = PL_GetPropertyList (qfs_default_dirconf, 0);
}
void
QFS_SetConfig (plitem_t *config)
{
PL_Retain (config);
PL_Release (qfs_gd_plist);
qfs_gd_plist = config;
}
/*
qfs_contains_updir
@ -1492,7 +1500,9 @@ QFS_Init (memhunk_t *hunk, const char *game)
qfs_userpath = Sys_ExpandSquiggle (fs_userpath);
qfs_load_config ();
if (!qfs_gd_plist || *fs_dirconf) {
qfs_load_config ();
}
qfs_game = game;