1
0
Fork 0
forked from fte/fteqw

Try to fix a couple of issues raised by beloko.

One was a bug with registered not getting set properly (configs hid the bug from me). The registered check is now updated on (and AFTER) gamedir changes, ensuring the filesystem is up and running properly before determining if we have any proof of purchase in it.
The other was a bug due to pak/path precedence which broke hexen2 maplist.txt support, this update should match the new filesystem path/pak ordering fixing the bug.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4481 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2013-09-26 09:24:52 +00:00
parent 350bafee54
commit db3f55f24a
2 changed files with 33 additions and 18 deletions

View file

@ -3766,17 +3766,29 @@ being registered.
*/
void COM_CheckRegistered (void)
{
char *newdef;
vfsfile_t *h;
h = FS_OpenVFS("gfx/pop.lmp", "rb", FS_GAME);
static_registered = false;
if (!h)
return;
VFS_CLOSE(h);
if (h)
{
static_registered = true;
VFS_CLOSE(h);
}
else
static_registered = false;
static_registered = true;
Con_TPrintf (TL_REGISTEREDVERSION);
newdef = static_registered?"1":"0";
if (strcmp(registered.defaultstr, newdef))
{
registered.defaultstr = newdef;
Cvar_ForceSet(&registered, newdef);
if (static_registered)
Con_TPrintf (TL_REGISTEREDVERSION);
}
}
@ -4146,12 +4158,6 @@ void COM_Init (void)
Cmd_AddCommand ("errorme", COM_ErrorMe_f);
COM_InitFilesystem ();
COM_CheckRegistered ();
if (static_registered)
registered.defaultstr = "1";
else
registered.defaultstr = "0";
Cvar_Register (&registered, "Copy protection");
Cvar_Register (&gameversion, "Gamecode");
Cvar_Register (&gameversion_min, "Gamecode");

View file

@ -23,6 +23,7 @@ extern cvar_t com_fs_cache;
int active_fs_cachetype;
static int fs_referencetype;
int fs_finds;
void COM_CheckRegistered (void);
struct
{
@ -489,10 +490,12 @@ void COM_Path_f (void)
Con_Printf ("Pure paths:\n");
for (s=com_purepaths ; s ; s=s->nextpure)
{
Con_Printf("%s %s%s%s\n", s->logicalpath,
Con_Printf("%s %s%s%s%s%s\n", s->logicalpath,
(s->flags & SPF_REFERENCED)?"(ref)":"",
(s->flags & SPF_TEMPORARY)?"(temp)":"",
(s->flags & SPF_COPYPROTECTED)?"(c)":"");
(s->flags & SPF_COPYPROTECTED)?"(c)":"",
(s->flags & SPF_EXPLICIT)?"(e)":"",
(s->flags & SPF_UNTRUSTED)?"(u)":"" );
}
Con_Printf ("----------\n");
if (fs_puremode == 2)
@ -507,10 +510,12 @@ void COM_Path_f (void)
if (s == com_base_searchpaths)
Con_Printf ("----------\n");
Con_Printf("%s %s%s%s\n", s->logicalpath,
Con_Printf("%s %s%s%s%s%s\n", s->logicalpath,
(s->flags & SPF_REFERENCED)?"(ref)":"",
(s->flags & SPF_TEMPORARY)?"(temp)":"",
(s->flags & SPF_COPYPROTECTED)?"(c)":"");
(s->flags & SPF_COPYPROTECTED)?"(c)":"",
(s->flags & SPF_EXPLICIT)?"(e)":"",
(s->flags & SPF_UNTRUSTED)?"(u)":"" );
}
}
@ -808,6 +813,7 @@ int FS_FLocateFile(const char *filename, FSLF_ReturnType_e returntype, flocation
{
for (search = com_purepaths ; search ; search = search->nextpure)
{
depth += ((search->flags & SPF_EXPLICIT) || returntype == FSLFRT_DEPTH_ANYPATH);
fs_finds++;
if (search->handle->FindFile(search->handle, loc, filename, pf))
{
@ -823,7 +829,6 @@ int FS_FLocateFile(const char *filename, FSLF_ReturnType_e returntype, flocation
com_file_untrusted = !!(search->flags & SPF_UNTRUSTED);
goto out;
}
depth += ((search->flags & SPF_EXPLICIT) || returntype == FSLFRT_DEPTH_ANYPATH);
}
}
@ -834,6 +839,7 @@ int FS_FLocateFile(const char *filename, FSLF_ReturnType_e returntype, flocation
//
for (search = com_searchpaths ; search ; search = search->next)
{
depth += ((search->flags & SPF_EXPLICIT) || returntype == FSLFRT_DEPTH_ANYPATH);
fs_finds++;
if (search->handle->FindFile(search->handle, loc, filename, pf))
{
@ -849,7 +855,6 @@ int FS_FLocateFile(const char *filename, FSLF_ReturnType_e returntype, flocation
com_file_untrusted = !!(search->flags & SPF_UNTRUSTED);
goto out;
}
depth += ((search->flags & SPF_EXPLICIT) || returntype == FSLFRT_DEPTH_ANYPATH);
}
}
fail:
@ -2914,6 +2919,9 @@ static void FS_StartupWithGame(int gamenum)
if (i && i < com_argc-1)
{
COM_Gamedir(com_argv[i+1]);
#ifndef CLIENTONLY
Info_SetValueForStarKey (svs.info, "*gamedir", com_argv[i+1], MAX_SERVERINFO_STRING);
#endif
}
#ifdef ANDROID
@ -3328,6 +3336,7 @@ qboolean FS_ChangeGame(ftemanifest_t *man, qboolean allowreloadconfigs)
FS_BeginNextPackageDownload();
COM_CheckRegistered();
if (allowreloadconfigs)
{