Integrate caedes systemwide installation patch

This commit is contained in:
Yamagi Burmeister 2011-10-04 19:29:40 +00:00
parent 6be8120804
commit 0bd9096f7f
3 changed files with 40 additions and 1 deletions

6
README
View file

@ -428,4 +428,10 @@ Can I use texture sets with Yamagi Quake 2?
- No, you can't. Yamagi Quake 2 is dedicated to a game experience like
in 1997 and thus texture packs are not supported. Use another client.
I'm creating a package or port for my system. Is a system wide install
possible without patching the source?
- Yes. Just set -DSYSTEMWIDE. If you want to change the default
directory from /usr/share/games/quake2/, just set -DSYSTEMDIR
to the desired path.
===============================================================================

1
TODO
View file

@ -5,7 +5,6 @@ game.so:
client:
- Integrate a signalhandler and print an backtrace with Maxims
libexecinfo (only 2 sourcefiles, BSD licensed)
- Integrate caedes systemwide installation patches
- Add a optional overwrite for the defaults.cfg
- Rename the config.cfg to yq2config.cfg for compatiblity with other
sourceports

View file

@ -35,6 +35,12 @@
#define MAX_FIND_FILES 0x04000
#define MAX_PAKS 100
#ifdef SYSTEMWIDE
#ifndef SYSTEMDIR
#define SYSTEMDIR "/usr/share/games/quake2/"
#endif
#endif
typedef struct
{
char name[MAX_QPATH];
@ -1234,6 +1240,26 @@ FS_AddHomeAsGameDirectory(char *dir)
}
}
#ifdef SYSTEMWIDE
void FS_AddSystemwideGameDirectory(char *dir)
{
char gdir[MAX_OSPATH];
char *datadir = SYSTEMDIR;
int len = snprintf(gdir, sizeof(gdir), "%s/%s/", datadir, dir);
printf("Using %s to fetch paks\n", gdir);
if ((len > 0) && (len < sizeof(gdir)) && (gdir[len-1] == '/'))
{
gdir[len-1] = 0;
}
FS_AddGameDirectory (gdir);
}
#endif
/*
* Allows enumerating all of the directories in the search path.
*/
@ -1439,6 +1465,10 @@ FS_SetGamedir(char *dir)
if (fs_cddir->string[0] == '\0')
FS_AddGameDirectory(va("%s/%s", fs_cddir->string, dir));
#ifdef SYSTEMWIDE
FS_AddSystemwideGameDirectory(dir);
#endif
FS_AddGameDirectory(va("%s/%s", fs_basedir->string, dir));
FS_AddHomeAsGameDirectory(dir);
}
@ -1809,6 +1839,10 @@ FS_InitFilesystem(void)
/* Current directory. */
fs_homepath = Cvar_Get("homepath", Sys_GetCurrentDirectory(), CVAR_NOSET);
#ifdef SYSTEMWIDE
FS_AddSystemwideGameDirectory(BASEDIRNAME);
#endif
/* Add baseq2 to search path. */
FS_AddGameDirectory(va("%s/" BASEDIRNAME, fs_basedir->string));
FS_AddHomeAsGameDirectory(BASEDIRNAME);