mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-23 04:52:07 +00:00
Add a cvar fs_portable. When set to 1 the game is 'portable'.
Normally Q2 writes all persistent data (the configurations, saves, etc.) into a subdirectory in the users $HOME. That can be a problem when the game is installed onto an thumb drive or something like that. Therefor provide a cvar fs_portable. When set to 1 the games uses it binary dir as it's persistent storage location. Examples: ./quake2 +set fs_portable 1 ./quake2 +set basedir ~/games/quake2 +set fs_portable 1 fs_portable is _not_ saved into the config file. It must be set at every start! This closed issue #158.
This commit is contained in:
parent
4a54fdd0ed
commit
692b64ad38
1 changed files with 10 additions and 0 deletions
|
@ -131,6 +131,7 @@ cvar_t *fs_basedir;
|
|||
cvar_t *fs_cddir;
|
||||
cvar_t *fs_gamedirvar;
|
||||
cvar_t *fs_debug;
|
||||
cvar_t *fs_portable;
|
||||
|
||||
fsHandle_t *FS_GetFileByHandle(fileHandle_t f);
|
||||
char *Sys_GetCurrentDirectory(void);
|
||||
|
@ -942,6 +943,12 @@ FS_AddHomeAsGameDirectory(char *dir)
|
|||
char gdir[MAX_OSPATH];
|
||||
size_t len;
|
||||
|
||||
if (fs_portable->value)
|
||||
{
|
||||
Com_Printf("======================>>>>>>>>>>>> Portableflappen\n");
|
||||
return;
|
||||
}
|
||||
|
||||
home = Sys_GetHomeDir();
|
||||
|
||||
if (home == NULL)
|
||||
|
@ -1566,6 +1573,9 @@ FS_InitFilesystem(void)
|
|||
/* Current directory. */
|
||||
fs_homepath = Cvar_Get("homepath", Sys_GetCurrentDirectory(), CVAR_NOSET);
|
||||
|
||||
/* Be portable, don't add HOME to the search patch */
|
||||
fs_portable = Cvar_Get("fs_portable", "0", 0);
|
||||
|
||||
/* Add baseq2 to search path. */
|
||||
FS_AddGameDirectory(va("%s/" BASEDIRNAME, fs_basedir->string));
|
||||
FS_AddBinaryDirAsGameDirectory(BASEDIRNAME);
|
||||
|
|
Loading…
Reference in a new issue