mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
updated the user directories patch to apply and function properly after
the latset changes. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@391 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
a892a57873
commit
da4d431a18
1 changed files with 46 additions and 34 deletions
|
@ -1,30 +1,41 @@
|
|||
support for user directories, based on a patch by Piotr Szymaniak.
|
||||
against quakespasm svn revision 97.
|
||||
** !! in alpha state, minimally tested, and certainly outdated !! **
|
||||
** against quakespasm svn revision 390.
|
||||
** in alpha state, minimally tested.
|
||||
** on-the-fly game directory changes not supported yet.
|
||||
** needs more work.
|
||||
|
||||
Index: Quake/common.c
|
||||
===================================================================
|
||||
--- Quake/common.c (revision 301)
|
||||
--- Quake/common.c (revision 390)
|
||||
+++ Quake/common.c (working copy)
|
||||
@@ -1778,25 +1778,27 @@
|
||||
@@ -1825,32 +1825,36 @@
|
||||
COM_AddGameDirectory -- johnfitz -- modified based on topaz's tutorial
|
||||
=================
|
||||
*/
|
||||
-void COM_AddGameDirectory (const char *dir)
|
||||
+#define SYS_USERDIR ".quakespasm"
|
||||
+static char *homedir = NULL;
|
||||
+void COM_AddGameDirectory (const char *base, const char *dir)
|
||||
{
|
||||
int i;
|
||||
unsigned int path_id;
|
||||
searchpath_t *search;
|
||||
pack_t *pak;
|
||||
char pakfile[MAX_OSPATH];
|
||||
+ qboolean been_here = false;
|
||||
|
||||
- strcpy (com_gamedir, dir);
|
||||
+ if (!base)
|
||||
+ return;
|
||||
+ strcpy(com_gamedir, va("%s/%s", base, dir));
|
||||
+ strcpy (com_gamedir, va("%s/%s", base, dir));
|
||||
|
||||
// assign a path_id to this game directory
|
||||
if (com_searchpaths)
|
||||
path_id = com_searchpaths->path_id << 1;
|
||||
else path_id = 1U;
|
||||
|
||||
+_add_path:
|
||||
// add the directory to the search path
|
||||
search = (searchpath_t *) Z_Malloc(sizeof(searchpath_t));
|
||||
search->path_id = path_id;
|
||||
- strcpy (search->filename, dir);
|
||||
+ strcpy (search->filename, com_gamedir);
|
||||
search->next = com_searchpaths;
|
||||
|
@ -38,68 +49,69 @@ Index: Quake/common.c
|
|||
pak = COM_LoadPackFile (pakfile);
|
||||
if (!pak)
|
||||
break;
|
||||
@@ -1839,7 +1841,12 @@
|
||||
@@ -1860,6 +1864,14 @@
|
||||
search->next = com_searchpaths;
|
||||
com_searchpaths = search;
|
||||
}
|
||||
+
|
||||
+ if (!been_here && homedir != NULL)
|
||||
+ {
|
||||
+ been_here = true;
|
||||
+ strcpy(com_gamedir, va("%s/%s/%s", homedir, SYS_USERDIR, dir));
|
||||
+ Sys_mkdir(com_gamedir);
|
||||
+ goto _add_path;
|
||||
+ }
|
||||
}
|
||||
|
||||
static void kill_id1_conback (void) /* QuakeSpasm customization: */
|
||||
@@ -1894,6 +1906,10 @@
|
||||
{
|
||||
int i, j;
|
||||
searchpath_t *search;
|
||||
+ char *home;
|
||||
|
||||
+ home = getenv("HOME");
|
||||
+ if (home)
|
||||
+ Sys_mkdir (va("%s/.quakespasm", home));
|
||||
+ homedir = getenv("HOME");
|
||||
+ if (homedir)
|
||||
+ Sys_mkdir (va("%s/%s", homedir, SYS_USERDIR));
|
||||
+
|
||||
i = COM_CheckParm ("-basedir");
|
||||
if (i && i < com_argc-1)
|
||||
strcpy (com_basedir, com_argv[i + 1]);
|
||||
@@ -1854,8 +1861,8 @@
|
||||
@@ -1908,8 +1924,7 @@
|
||||
}
|
||||
|
||||
// start up with GAMENAME by default (id1)
|
||||
- COM_AddGameDirectory (va("%s/"GAMENAME, com_basedir));
|
||||
- strcpy (com_gamedir, va("%s/"GAMENAME, com_basedir));
|
||||
+ COM_AddGameDirectory(com_basedir, GAMENAME);
|
||||
+ COM_AddGameDirectory(home, ".quakespasm/" GAMENAME);
|
||||
+ COM_AddGameDirectory (com_basedir, GAMENAME);
|
||||
|
||||
if (!fitzmode)
|
||||
{ /* QuakeSpasm customization: */
|
||||
@@ -1867,17 +1874,20 @@
|
||||
@@ -1921,17 +1936,17 @@
|
||||
com_nummissionpacks = 0;
|
||||
if (COM_CheckParm ("-rogue"))
|
||||
{
|
||||
- COM_AddGameDirectory (va("%s/rogue", com_basedir));
|
||||
+ COM_AddGameDirectory(com_basedir, "rogue");
|
||||
+ COM_AddGameDirectory(home, ".quakespasm/rogue");
|
||||
+ COM_AddGameDirectory (com_basedir, "rogue");
|
||||
com_nummissionpacks++;
|
||||
}
|
||||
if (COM_CheckParm ("-hipnotic"))
|
||||
{
|
||||
- COM_AddGameDirectory (va("%s/hipnotic", com_basedir));
|
||||
+ COM_AddGameDirectory(com_basedir, "hipnotic");
|
||||
+ COM_AddGameDirectory(home, ".quakespasm/hipnotic");
|
||||
+ COM_AddGameDirectory (com_basedir, "hipnotic");
|
||||
com_nummissionpacks++;
|
||||
}
|
||||
if (COM_CheckParm ("-quoth"))
|
||||
{
|
||||
- COM_AddGameDirectory (va("%s/quoth", com_basedir));
|
||||
+ COM_AddGameDirectory(com_basedir, "quoth");
|
||||
+ COM_AddGameDirectory(home, ".quakespasm/quoth");
|
||||
+ COM_AddGameDirectory (com_basedir, "quoth");
|
||||
com_nummissionpacks++;
|
||||
}
|
||||
//johnfitz
|
||||
@@ -1886,9 +1896,14 @@
|
||||
@@ -1940,7 +1955,7 @@
|
||||
if (i && i < com_argc-1)
|
||||
{
|
||||
com_modified = true;
|
||||
- COM_AddGameDirectory (va("%s/%s", com_basedir, com_argv[i + 1]));
|
||||
+ COM_AddGameDirectory(com_basedir, com_argv[i + 1]);
|
||||
+ COM_AddGameDirectory(home, va(".quakespasm/%s", com_argv[i + 1]));
|
||||
+ COM_AddGameDirectory (com_basedir, com_argv[i + 1]);
|
||||
}
|
||||
}
|
||||
|
||||
+ /* If home is available, create the game directory */
|
||||
+ if (home)
|
||||
+ Sys_mkdir(com_gamedir);
|
||||
+
|
||||
i = COM_CheckParm ("-path");
|
||||
if (i)
|
||||
{
|
||||
|
||||
|
|
Loading…
Reference in a new issue