2016-08-25 00:12:14 +00:00
//copyright 'Spike', license gplv2+
//provides both a package manager and downloads menu.
2017-03-26 01:46:08 +00:00
//FIXME: block downloads of exe/dll/so/etc if not an https url (even if inside zips). also block such files from package lists over http.
2005-04-16 16:22:17 +00:00
# include "quakedef.h"
2005-12-22 02:29:11 +00:00
2018-08-04 07:05:20 +00:00
# ifdef PACKAGEMANAGER
2016-11-20 20:52:41 +00:00
# if !defined(NOBUILTINMENUS) && !defined(SERVERONLY)
# define DOWNLOADMENU
# endif
2005-12-22 02:29:11 +00:00
# endif
2016-11-20 20:52:41 +00:00
# ifdef PACKAGEMANAGER
2016-08-25 00:12:14 +00:00
# include "fs.h"
2016-07-26 11:47:59 +00:00
//whole load of extra args for the downloads menu (for the downloads menu to handle engine updates).
2019-03-23 07:06:37 +00:00
# if defined(VKQUAKE) && !defined(SERVERONLY)
2016-07-26 11:47:59 +00:00
# define PHPVK "&vk=1"
# else
# define PHPVK
# endif
2019-03-23 07:06:37 +00:00
# if defined(GLQUAKE) && !defined(SERVERONLY)
2016-07-26 11:47:59 +00:00
# define PHPGL "&gl=1"
# else
# define PHPGL
# endif
2019-03-23 07:06:37 +00:00
# if defined(D3DQUAKE) && !defined(SERVERONLY)
2016-07-26 11:47:59 +00:00
# define PHPD3D "&d3d=1"
# else
# define PHPD3D
# endif
# ifdef MINIMAL
# define PHPMIN "&min=1"
# else
# define PHPMIN
# endif
2019-04-16 22:40:05 +00:00
# ifdef HAVE_LEGACY
2017-01-24 10:27:39 +00:00
# define PHPLEG "&leg=1&test=1"
2019-04-16 22:40:05 +00:00
# else
# define PHPLEG "&leg=0&test=1"
2016-07-26 11:47:59 +00:00
# endif
# if defined(_DEBUG) || defined(DEBUG)
# define PHPDBG "&dbg=1"
# else
# define PHPDBG
# endif
# ifndef SVNREVISION
# define SVNREVISION -
# endif
2017-01-24 10:27:39 +00:00
# define SVNREVISIONSTR STRINGIFY(SVNREVISION)
# define DOWNLOADABLESARGS "ver=" SVNREVISIONSTR PHPVK PHPGL PHPD3D PHPMIN PHPLEG PHPDBG "&arch="PLATFORM "_" ARCH_CPU_POSTFIX
2016-07-26 11:47:59 +00:00
2017-01-24 10:27:39 +00:00
extern cvar_t pm_autoupdate ;
extern cvar_t pm_downloads_url ;
2005-04-16 16:22:17 +00:00
# define INSTALLEDFILES "installed.lst" //the file that resides in the quakedir (saying what's installed).
2016-08-25 00:12:14 +00:00
//installed native okay [previously manually installed, or has no a qhash]
//installed cached okay [had a qhash]
//installed native corrupt [they overwrote it manually]
//installed cached corrupt [we fucked up, probably]
//installed native missing (becomes not installed) [deleted]
//installed cached missing (becomes not installed) [deleted]
//installed none [meta package with no files]
//!installed native okay [was manually installed, flag as installed now]
//!installed cached okay [they got it from some other source / previously installed]
//!installed native corrupt [manually installed conflict]
//!installed cached corrupt [we fucked up, probably]
//!installed * missing [simply not installed]
2018-10-11 10:31:23 +00:00
# define DPF_ENABLED (1u<<0)
# define DPF_NATIVE (1u<<1) //appears to be installed properly
# define DPF_CACHED (1u<<2) //appears to be installed in their dlcache dir (and has a qhash)
# define DPF_CORRUPT (1u<<3) //will be deleted before it can be changed
# define DPF_USERMARKED (1u<<4) //user selected it
# define DPF_AUTOMARKED (1u<<5) //selected only to satisfy a dependancy
# define DPF_DISPLAYVERSION (1u<<6) //some sort of conflict, the package is listed twice, so show versions so the user knows what's old.
# define DPF_FORGETONUNINSTALL (1u<<7) //for previously installed packages, remove them from the list if there's no current version any more (should really be automatic if there's no known mirrors)
# define DPF_HIDDEN (1u<<8) //wrong arch, file conflicts, etc. still listed if actually installed.
# define DPF_PURGE (1u<<9) //package should be completely removed (ie: the dlcache dir too). if its still marked then it should be reinstalled anew. available on cached or corrupt packages, implied by native.
# define DPF_MANIFEST (1u<<10) //package was named by the manifest, and should only be uninstalled after a warning.
# define DPF_TESTING (1u<<11) //package is provided on a testing/trial basis, and will only be selected/listed if autoupdates are configured to allow it.
# define DPF_ENGINE (1u<<12) //engine update. replaces old autoupdate mechanism
# define DPF_PLUGIN (1u<<13) //this is a plugin package, with a dll
# define DPF_TRUSTED (1u<<14) //flag used when parsing package lists. if not set then packages will be ignored if they are anything but paks/pk3s
# define DPF_MARKED (DPF_USERMARKED|DPF_AUTOMARKED)
2017-01-24 10:27:39 +00:00
# define DPF_PRESENT (DPF_NATIVE|DPF_CACHED)
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
# define DPF_DISABLEDINSTALLED (DPF_ENGINE|DPF_PLUGIN) //engines+plugins can be installed without being enabled.
2016-08-25 00:12:14 +00:00
//pak.lst
//priories <0
//pakX
//manifest packages
//priority 0-999
//*.pak
//priority >=1000
# define PM_DEFAULTPRIORITY 1000
2005-10-16 12:53:42 +00:00
2013-03-12 23:03:04 +00:00
void CL_StartCinematicOrMenu ( void ) ;
2005-10-16 12:53:42 +00:00
2016-08-25 00:12:14 +00:00
# if defined(SERVERONLY)
# define ENGINE_RENDERER "sv"
# elif defined(GLQUAKE) && (defined(VKQUAKE) || defined(D3DQUAKE) || defined(SWQUAKE))
# define ENGINE_RENDERER "m"
# elif defined(GLQUAKE)
# define ENGINE_RENDERER "gl"
# elif defined(VKQUAKE)
# define ENGINE_RENDERER "vk"
# elif defined(D3DQUAKE)
# define ENGINE_RENDERER "d3d"
# else
# define ENGINE_RENDERER "none"
# endif
# if defined(NOCOMPAT)
# define ENGINE_CLIENT "-nc"
# elif defined(MINIMAL)
# define ENGINE_CLIENT "-min"
# elif defined(CLIENTONLY)
# define ENGINE_CLIENT "-cl"
# else
# define ENGINE_CLIENT
# endif
2005-04-16 16:22:17 +00:00
2016-07-26 11:47:59 +00:00
# define THISARCH PLATFORM "_" ARCH_CPU_POSTFIX
2016-08-25 00:12:14 +00:00
# define THISENGINE THISARCH "-" DISTRIBUTION "-" ENGINE_RENDERER ENGINE_CLIENT
2016-07-26 11:47:59 +00:00
2005-04-16 16:22:17 +00:00
typedef struct package_s {
char * name ;
2016-11-20 20:52:41 +00:00
char * category ; //in path form
2005-04-16 16:22:17 +00:00
2016-08-25 00:12:14 +00:00
struct package_s * alternative ; //alternative (hidden) forms of this package.
2016-07-26 11:47:59 +00:00
2017-01-24 10:27:39 +00:00
char * mirror [ 8 ] ; //FIXME: move to two types of dep...
2005-10-14 18:28:44 +00:00
char gamedir [ 16 ] ;
2016-07-21 19:36:34 +00:00
enum fs_relative fsroot ;
char version [ 16 ] ;
2016-07-26 11:47:59 +00:00
char * arch ;
2016-08-25 00:12:14 +00:00
char * qhash ;
2016-11-20 20:52:41 +00:00
char * title ;
2016-08-25 00:12:14 +00:00
char * description ;
char * license ;
char * author ;
2019-01-15 14:12:49 +00:00
char * website ;
2016-08-25 00:12:14 +00:00
char * previewimage ;
2016-07-26 11:47:59 +00:00
enum
{
EXTRACT_COPY , //just copy the download over
EXTRACT_XZ , //give the download code a write filter so that it automatically decompresses on the fly
EXTRACT_GZ , //give the download code a write filter so that it automatically decompresses on the fly
EXTRACT_ZIP //extract stuff once it completes. kinda sucky.
} extract ;
2016-07-21 19:36:34 +00:00
struct packagedep_s
{
struct packagedep_s * next ;
enum
{
DEP_CONFLICT ,
2016-07-26 11:47:59 +00:00
DEP_FILECONFLICT , //don't install if this file already exists.
2016-07-21 19:36:34 +00:00
DEP_REQUIRE ,
DEP_RECOMMEND , //like depend, but uninstalling will not bubble.
2019-06-05 20:48:06 +00:00
DEP_SUGGEST , //like recommend, but will not force install (ie: only prevents auto-uninstall)
2017-01-24 10:27:39 +00:00
// DEP_MIRROR,
// DEP_FAILEDMIRROR,
2016-07-26 11:47:59 +00:00
DEP_FILE
2016-07-21 19:36:34 +00:00
} dtype ;
char name [ 1 ] ;
} * deps ;
2005-10-16 12:53:42 +00:00
2018-08-04 07:05:20 +00:00
# ifdef WEBCLIENT
2016-07-21 19:36:34 +00:00
struct dl_download * download ;
2018-08-04 07:05:20 +00:00
unsigned int trymirrors ;
# endif
2005-10-16 12:53:42 +00:00
2005-04-16 16:22:17 +00:00
int flags ;
2016-08-25 00:12:14 +00:00
int priority ;
struct package_s * * link ;
2005-04-16 16:22:17 +00:00
struct package_s * next ;
} package_t ;
2016-08-25 00:12:14 +00:00
static qboolean loadedinstalled ;
2016-07-21 19:36:34 +00:00
static package_t * availablepackages ;
static int numpackages ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
static char * manifestpackages ; //metapackage named by the manicfest.
static char * declinedpackages ; //metapackage named by the manicfest.
2017-03-04 19:36:06 +00:00
static int domanifestinstall ; //SECURITY_MANIFEST_*
2016-08-25 00:12:14 +00:00
2017-09-20 11:27:13 +00:00
# ifdef PLUGINS
2017-04-18 11:12:17 +00:00
static qboolean pluginpromptshown ; //so we only show prompts for new externally-installed plugins once, instead of every time the file is reloaded.
2017-09-20 11:27:13 +00:00
# endif
2018-08-04 07:05:20 +00:00
# ifdef WEBCLIENT
2016-11-25 08:14:54 +00:00
static qboolean doautoupdate ; //updates will be marked (but not applied without the user's actions)
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
static qboolean pkg_updating ; //when flagged, further changes are blocked until completion.
2018-08-04 07:05:20 +00:00
# else
static const qboolean pkg_updating = false ;
# endif
2016-11-20 20:52:41 +00:00
//FIXME: these are allocated for the life of the exe. changing basedir should purge the list.
2016-08-25 00:12:14 +00:00
static int numdownloadablelists = 0 ;
static struct
{
char * url ;
char * prefix ;
2017-04-18 11:12:17 +00:00
qboolean trustworthy ; //trusted
2016-08-25 00:12:14 +00:00
char received ; //says if we got a response yet or not
2016-11-20 20:52:41 +00:00
qboolean save ; //written into our local file
2016-08-25 00:12:14 +00:00
struct dl_download * curdl ; //the download context
} downloadablelist [ 32 ] ;
2016-11-25 08:14:54 +00:00
static int downloadablessequence ; //bumped any time any package is purged
2016-08-25 00:12:14 +00:00
static void PM_FreePackage ( package_t * p )
{
struct packagedep_s * d ;
int i ;
if ( p - > link )
{
if ( p - > alternative )
{ //replace it with its alternative package
* p - > link = p - > alternative ;
p - > alternative - > alternative = p - > alternative - > next ;
if ( p - > alternative - > alternative )
p - > alternative - > alternative - > link = & p - > alternative - > alternative ;
p - > alternative - > next = p - > next ;
p - > alternative - > link = p - > link ;
}
else
{ //just remove it from the list.
* p - > link = p - > next ;
if ( p - > next )
p - > next - > link = p - > link ;
}
}
//free its data.
while ( p - > deps )
{
d = p - > deps ;
p - > deps = d - > next ;
Z_Free ( d ) ;
}
for ( i = 0 ; i < countof ( p - > mirror ) ; i + + )
Z_Free ( p - > mirror [ i ] ) ;
2016-11-25 08:14:54 +00:00
Z_Free ( p - > name ) ;
Z_Free ( p - > category ) ;
Z_Free ( p - > title ) ;
2016-09-08 19:04:35 +00:00
Z_Free ( p - > description ) ;
Z_Free ( p - > author ) ;
2019-01-15 14:12:49 +00:00
Z_Free ( p - > website ) ;
2016-09-08 19:04:35 +00:00
Z_Free ( p - > license ) ;
Z_Free ( p - > previewimage ) ;
2016-08-25 00:12:14 +00:00
Z_Free ( p - > qhash ) ;
Z_Free ( p - > arch ) ;
Z_Free ( p ) ;
}
2019-03-23 07:06:37 +00:00
static qboolean PM_PurgeOnDisable ( package_t * p )
2017-01-24 10:27:39 +00:00
{
//corrupt packages must be purged
if ( p - > flags & DPF_CORRUPT )
return true ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
//certain updates can be present and not enabled
if ( p - > flags & DPF_DISABLEDINSTALLED )
2017-01-24 10:27:39 +00:00
return false ;
//hashed packages can also be present and not enabled, but only if they're in the cache and not native
2017-07-31 17:15:37 +00:00
if ( * p - > gamedir & & p - > qhash & & ( p - > flags & DPF_PRESENT ) )
2017-01-24 10:27:39 +00:00
return false ;
//FIXME: add basedir-plugins to the package manager so they can be enabled/disabled properly.
//if (p->arch)
// return false;
//all other packages must be deleted to disable them
return true ;
}
2016-08-25 00:12:14 +00:00
//checks the status of each package
2019-03-23 07:06:37 +00:00
static void PM_ValidatePackage ( package_t * p )
2016-08-25 00:12:14 +00:00
{
package_t * o ;
struct packagedep_s * dep ;
vfsfile_t * pf ;
p - > flags & = ~ ( DPF_NATIVE | DPF_CACHED | DPF_CORRUPT ) ;
2017-01-24 10:27:39 +00:00
if ( p - > flags & DPF_ENABLED )
2016-08-25 00:12:14 +00:00
{
for ( dep = p - > deps ; dep ; dep = dep - > next )
{
char * n ;
if ( dep - > dtype ! = DEP_FILE )
continue ;
if ( * p - > gamedir )
n = va ( " %s/%s " , p - > gamedir , dep - > name ) ;
else
n = dep - > name ;
pf = FS_OpenVFS ( n , " rb " , p - > fsroot ) ;
if ( pf )
{
VFS_CLOSE ( pf ) ;
p - > flags | = DPF_NATIVE ;
}
else if ( * p - > gamedir & & p - > qhash )
{
char temp [ MAX_OSPATH ] ;
if ( FS_GenCachedPakName ( n , p - > qhash , temp , sizeof ( temp ) ) )
{
pf = FS_OpenVFS ( temp , " rb " , p - > fsroot ) ;
if ( pf )
{
VFS_CLOSE ( pf ) ;
p - > flags | = DPF_CACHED ;
}
}
}
if ( ! ( p - > flags & ( DPF_NATIVE | DPF_CACHED ) ) )
2016-11-20 20:52:41 +00:00
Con_Printf ( " WARNING: %s (%s) no longer exists \n " , p - > name , n ) ;
2016-08-25 00:12:14 +00:00
}
}
else
{
for ( dep = p - > deps ; dep ; dep = dep - > next )
{
char * n ;
struct packagedep_s * odep ;
unsigned int fl = DPF_NATIVE ;
if ( dep - > dtype ! = DEP_FILE )
continue ;
if ( * p - > gamedir )
n = va ( " %s/%s " , p - > gamedir , dep - > name ) ;
else
n = dep - > name ;
pf = FS_OpenVFS ( n , " rb " , p - > fsroot ) ;
if ( ! pf & & * p - > gamedir & & p - > qhash )
{
char temp [ MAX_OSPATH ] ;
if ( FS_GenCachedPakName ( n , p - > qhash , temp , sizeof ( temp ) ) )
{
pf = FS_OpenVFS ( temp , " rb " , p - > fsroot ) ;
fl = DPF_CACHED ;
}
//fixme: skip any archive checks
}
if ( pf )
{
for ( o = availablepackages ; o ; o = o - > next )
{
if ( o = = p )
continue ;
2017-01-24 10:27:39 +00:00
if ( o - > flags & DPF_ENABLED )
2016-08-25 00:12:14 +00:00
{
if ( ! strcmp ( p - > gamedir , o - > gamedir ) & & p - > fsroot = = o - > fsroot )
2016-11-20 20:52:41 +00:00
if ( strcmp ( p - > name , o - > name ) | | strcmp ( p - > version , o - > version ) )
2016-08-25 00:12:14 +00:00
{
for ( odep = o - > deps ; odep ; odep = odep - > next )
{
if ( ! strcmp ( dep - > name , odep - > name ) )
break ;
}
if ( odep )
break ;
}
}
}
2017-03-04 19:42:12 +00:00
if ( ( o & & o - > qhash & & p - > qhash & & ( o - > flags & DPF_CACHED ) ) | | fl = = DPF_CACHED )
2016-08-25 00:12:14 +00:00
p - > flags | = DPF_CACHED ;
else if ( ! o )
{
2017-01-24 10:27:39 +00:00
if ( ! PM_PurgeOnDisable ( p ) )
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
{
2017-01-24 10:27:39 +00:00
p - > flags | = fl ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
VFS_CLOSE ( pf ) ;
}
2017-01-24 10:27:39 +00:00
else if ( p - > qhash )
2016-08-25 00:12:14 +00:00
{
searchpathfuncs_t * archive ;
2018-04-27 16:40:50 +00:00
# ifdef PACKAGE_Q1PAK
2018-07-22 11:49:37 +00:00
char buf [ 8 ] ;
2016-08-25 00:12:14 +00:00
if ( ! Q_strcasecmp ( COM_FileExtension ( n , buf , sizeof ( buf ) ) , " pak " ) )
2018-03-04 14:41:16 +00:00
archive = FSPAK_LoadArchive ( pf , NULL , n , n , NULL ) ;
2016-08-25 00:12:14 +00:00
else
2018-04-27 16:40:50 +00:00
# endif
2016-08-25 00:12:14 +00:00
{
2018-11-27 16:48:19 +00:00
# ifdef PACKAGE_PK3 //assume zip/pk3/pk4/apk/etc
2018-03-04 14:41:16 +00:00
archive = FSZIP_LoadArchive ( pf , NULL , n , n , NULL ) ;
2016-08-25 00:12:14 +00:00
# else
archive = NULL ;
2016-07-21 19:36:34 +00:00
# endif
2016-08-25 00:12:14 +00:00
}
if ( archive )
{
unsigned int fqhash ;
pf = NULL ;
fqhash = archive - > GeneratePureCRC ( archive , 0 , 0 ) ;
archive - > ClosePath ( archive ) ;
if ( fqhash = = ( unsigned int ) strtoul ( p - > qhash , NULL , 0 ) )
{
p - > flags | = fl ;
if ( fl & DPF_NATIVE )
2017-01-24 10:27:39 +00:00
p - > flags | = DPF_MARKED | DPF_ENABLED ;
2016-08-25 00:12:14 +00:00
break ;
}
else
pf = NULL ;
}
else
VFS_CLOSE ( pf ) ;
}
else
{
p - > flags | = DPF_CORRUPT | fl ;
VFS_CLOSE ( pf ) ;
}
break ;
}
VFS_CLOSE ( pf ) ;
}
}
}
}
static qboolean PM_MergePackage ( package_t * oldp , package_t * newp )
{
//we don't track mirrors for previously-installed packages.
//use the file list of the installed package, zips ignore the file list of the remote package but otherwise they must match to be mergeable
//local installed copies of the package may lack some information, like mirrors.
//the old package *might* be installed, the new won't be. this means we need to use the old's file list rather than the new
if ( ! oldp - > qhash | | ! strcmp ( oldp - > qhash ? oldp - > qhash : " " , newp - > qhash ? newp - > qhash : " " ) )
{
unsigned int om , nm ;
struct packagedep_s * od , * nd ;
qboolean ignorefiles ;
for ( om = 0 ; om < countof ( oldp - > mirror ) & & oldp - > mirror [ om ] ; om + + )
;
for ( nm = 0 ; nm < countof ( newp - > mirror ) & & newp - > mirror [ nm ] ; nm + + )
;
2016-09-01 14:31:24 +00:00
// if (oldp->priority != newp->priority)
// return false;
2016-08-25 00:12:14 +00:00
ignorefiles = ( oldp - > extract = = EXTRACT_ZIP ) ; //zips ignore the remote file list, its only important if its already installed (so just keep the old file list and its fine).
if ( oldp - > extract ! = newp - > extract )
{ //if both have mirrors of different types then we have some sort of conflict
if ( ignorefiles | | ( om & & nm ) )
return false ;
}
for ( od = oldp - > deps , nd = newp - > deps ; od & & nd ; )
{
//if its a zip then the 'remote' file list will be blank while the local list is not (we can just keep the local list).
//if the file list DOES change, then bump the version.
if ( ignorefiles )
{
if ( od - > dtype = = DEP_FILE )
{
od = od - > next ;
continue ;
}
if ( nd - > dtype = = DEP_FILE )
{
nd = nd - > next ;
continue ;
}
}
if ( od - > dtype ! = nd - > dtype )
return false ; //deps don't match
if ( strcmp ( od - > name , nd - > name ) )
return false ;
od = od - > next ;
nd = nd - > next ;
}
//overwrite these. use the 'new' / remote values for each of them
//the versions of the two packages will be the same, so the texts should be the same. still favour the new one so that things can be corrected serverside without needing people to redownload everything.
if ( newp - > qhash ) { Z_Free ( oldp - > qhash ) ; oldp - > qhash = Z_StrDup ( newp - > qhash ) ; }
if ( newp - > description ) { Z_Free ( oldp - > description ) ; oldp - > description = Z_StrDup ( newp - > description ) ; }
if ( newp - > license ) { Z_Free ( oldp - > license ) ; oldp - > license = Z_StrDup ( newp - > license ) ; }
if ( newp - > author ) { Z_Free ( oldp - > author ) ; oldp - > author = Z_StrDup ( newp - > author ) ; }
if ( newp - > previewimage ) { Z_Free ( oldp - > previewimage ) ; oldp - > previewimage = Z_StrDup ( newp - > previewimage ) ; }
2016-09-01 14:31:24 +00:00
oldp - > priority = newp - > priority ;
2016-08-25 00:12:14 +00:00
if ( nm )
{ //copy over the mirrors
oldp - > extract = newp - > extract ;
for ( ; nm - - > 0 & & om < countof ( oldp - > mirror ) ; om + + )
{
oldp - > mirror [ om ] = newp - > mirror [ nm ] ;
newp - > mirror [ nm ] = NULL ;
}
}
2017-01-24 10:27:39 +00:00
//these flags should only remain set if set in both.
oldp - > flags & = ~ ( DPF_FORGETONUNINSTALL | DPF_TESTING ) | ( newp - > flags & ( DPF_FORGETONUNINSTALL | DPF_TESTING ) ) ;
2016-08-25 00:12:14 +00:00
PM_FreePackage ( newp ) ;
return true ;
}
return false ;
}
static void PM_InsertPackage ( package_t * p )
{
package_t * * link ;
for ( link = & availablepackages ; * link ; link = & ( * link ) - > next )
{
package_t * prev = * link ;
2016-11-20 20:52:41 +00:00
int v = strcmp ( prev - > name , p - > name ) ;
2016-08-25 00:12:14 +00:00
if ( v > 0 )
break ; //insert before this one
else if ( v = = 0 )
{ //name matches.
//if (!strcmp(p->fullname),prev->fullname)
if ( ! strcmp ( p - > version , prev - > version ) )
if ( ! strcmp ( p - > gamedir , prev - > gamedir ) )
if ( ! strcmp ( p - > arch ? p - > arch : " " , prev - > arch ? prev - > arch : " " ) )
{ /*package matches, merge them somehow, don't add*/
package_t * a ;
if ( PM_MergePackage ( prev , p ) )
return ;
for ( a = p - > alternative ; a ; a = a - > next )
{
if ( PM_MergePackage ( a , p ) )
return ;
}
p - > next = prev - > alternative ;
prev - > alternative = p ;
p - > link = & prev - > alternative ;
return ;
}
//something major differs, display both independantly.
p - > flags | = DPF_DISPLAYVERSION ;
prev - > flags | = DPF_DISPLAYVERSION ;
}
}
p - > next = * link ;
p - > link = link ;
* link = p ;
PM_ValidatePackage ( p ) ;
numpackages + + ;
}
2005-04-16 16:22:17 +00:00
2016-08-25 00:12:14 +00:00
static qboolean PM_CheckFile ( const char * filename , enum fs_relative base )
2016-07-26 11:47:59 +00:00
{
vfsfile_t * f = FS_OpenVFS ( filename , " rb " , base ) ;
if ( f )
{
VFS_CLOSE ( f ) ;
return true ;
}
return false ;
}
2016-08-25 00:12:14 +00:00
static void PM_AddDep ( package_t * p , int deptype , const char * depname )
2016-07-26 11:47:59 +00:00
{
struct packagedep_s * nd , * * link ;
//no dupes.
for ( link = & p - > deps ; ( nd = * link ) ; link = & nd - > next )
{
if ( nd - > dtype = = deptype & & ! strcmp ( nd - > name , depname ) )
return ;
}
//add it on the end, preserving order.
nd = Z_Malloc ( sizeof ( * nd ) + strlen ( depname ) ) ;
nd - > dtype = deptype ;
strcpy ( nd - > name , depname ) ;
nd - > next = * link ;
* link = nd ;
}
2017-04-18 11:12:17 +00:00
static void PM_AddSubList ( const char * url , const char * prefix , qboolean save , qboolean trustworthy )
2016-07-21 19:36:34 +00:00
{
int i ;
2016-11-20 20:52:41 +00:00
if ( ! * url )
return ;
if ( strchr ( url , ' \" ' ) | | strchr ( url , ' \n ' ) )
return ;
if ( strchr ( prefix , ' \" ' ) | | strchr ( prefix , ' \n ' ) )
return ;
2016-07-21 19:36:34 +00:00
for ( i = 0 ; i < numdownloadablelists ; i + + )
{
2016-08-25 00:12:14 +00:00
if ( ! strcmp ( downloadablelist [ i ] . url , url ) )
2016-07-21 19:36:34 +00:00
break ;
}
if ( i = = numdownloadablelists & & i < countof ( downloadablelist ) )
{
2017-04-18 11:12:17 +00:00
if ( ! strncmp ( url , " https: " , 6 ) )
downloadablelist [ i ] . trustworthy = trustworthy ;
else
downloadablelist [ i ] . trustworthy = false ; //if its not a secure url, never consider it as trustworthy
2016-11-20 20:52:41 +00:00
downloadablelist [ i ] . save = save ;
2016-08-25 00:12:14 +00:00
downloadablelist [ i ] . url = BZ_Malloc ( strlen ( url ) + 1 ) ;
strcpy ( downloadablelist [ i ] . url , url ) ;
2016-07-21 19:36:34 +00:00
2016-08-25 00:12:14 +00:00
downloadablelist [ i ] . prefix = BZ_Malloc ( strlen ( prefix ) + 1 ) ;
strcpy ( downloadablelist [ i ] . prefix , prefix ) ;
2016-07-21 19:36:34 +00:00
numdownloadablelists + + ;
}
}
2016-11-20 20:52:41 +00:00
static void PM_RemSubList ( const char * url )
{
int i ;
for ( i = 0 ; i < numdownloadablelists ; i + + )
{
if ( ! strcmp ( downloadablelist [ i ] . url , url ) )
{
downloadablelist [ i ] . save = false ;
}
}
}
2016-07-21 19:36:34 +00:00
2019-06-17 04:21:41 +00:00
static qboolean PM_ParsePackageList ( vfsfile_t * f , int parseflags , const char * url , const char * prefix )
2005-04-16 16:22:17 +00:00
{
2016-08-25 00:12:14 +00:00
char line [ 65536 ] ;
package_t * p ;
2016-07-26 11:47:59 +00:00
struct packagedep_s * dep ;
2005-04-16 16:22:17 +00:00
char * sl ;
2005-10-14 18:28:44 +00:00
int version ;
2016-07-21 19:36:34 +00:00
char defaultgamedir [ 64 ] ;
char mirror [ countof ( p - > mirror ) ] [ MAX_OSPATH ] ;
int nummirrors = 0 ;
2019-01-13 16:51:50 +00:00
qboolean isauto ;
2019-03-23 07:06:37 +00:00
char * tokstart ;
2019-06-17 04:21:41 +00:00
qboolean forcewrite = false ;
2005-10-14 18:28:44 +00:00
2013-06-24 09:04:00 +00:00
if ( ! f )
2019-06-17 04:21:41 +00:00
return forcewrite ;
2013-06-24 09:04:00 +00:00
2016-07-21 19:36:34 +00:00
Q_strncpyz ( defaultgamedir , FS_GetGamedir ( false ) , sizeof ( defaultgamedir ) ) ;
if ( url )
{
Q_strncpyz ( mirror [ nummirrors ] , url , sizeof ( mirror [ nummirrors ] ) ) ;
sl = COM_SkipPath ( mirror [ nummirrors ] ) ;
* sl = 0 ;
nummirrors + + ;
}
2005-04-16 16:22:17 +00:00
do
{
2005-12-22 02:29:11 +00:00
if ( ! VFS_GETS ( f , line , sizeof ( line ) - 1 ) )
break ;
2005-04-16 16:22:17 +00:00
while ( ( sl = strchr ( line , ' \n ' ) ) )
* sl = ' \0 ' ;
while ( ( sl = strchr ( line , ' \r ' ) ) )
* sl = ' \0 ' ;
Cmd_TokenizeString ( line , false , false ) ;
2005-12-22 02:29:11 +00:00
} while ( ! Cmd_Argc ( ) ) ;
2005-04-16 16:22:17 +00:00
if ( strcmp ( Cmd_Argv ( 0 ) , " version " ) )
2019-06-17 04:21:41 +00:00
return forcewrite ; //it's not the right format.
2005-04-16 16:22:17 +00:00
2005-10-14 18:28:44 +00:00
version = atoi ( Cmd_Argv ( 1 ) ) ;
2016-07-21 19:36:34 +00:00
if ( version ! = 0 & & version ! = 1 & & version ! = 2 )
2005-10-14 18:28:44 +00:00
{
2007-10-05 18:08:47 +00:00
Con_Printf ( " Packagelist is of a future or incompatible version \n " ) ;
2019-06-17 04:21:41 +00:00
return forcewrite ; //it's not the right version.
2005-10-14 18:28:44 +00:00
}
2005-04-16 16:22:17 +00:00
2005-12-22 02:29:11 +00:00
while ( 1 )
2005-04-16 16:22:17 +00:00
{
2005-12-22 02:29:11 +00:00
if ( ! VFS_GETS ( f , line , sizeof ( line ) - 1 ) )
2005-04-16 16:22:17 +00:00
break ;
while ( ( sl = strchr ( line , ' \n ' ) ) )
* sl = ' \0 ' ;
while ( ( sl = strchr ( line , ' \r ' ) ) )
* sl = ' \0 ' ;
2019-03-23 07:06:37 +00:00
tokstart = COM_StringParse ( line , com_token , sizeof ( com_token ) , false , false ) ;
if ( * com_token )
2005-04-16 16:22:17 +00:00
{
2019-03-23 07:06:37 +00:00
if ( ! strcmp ( com_token , " sublist " ) )
2005-04-16 16:22:17 +00:00
{
2016-07-21 19:36:34 +00:00
char * subprefix ;
2019-03-23 07:06:37 +00:00
char url [ MAX_OSPATH ] ;
tokstart = COM_StringParse ( tokstart , url , sizeof ( url ) , false , false ) ;
tokstart = COM_StringParse ( tokstart , com_token , sizeof ( com_token ) , false , false ) ;
2016-07-21 19:36:34 +00:00
if ( * prefix )
2019-03-23 07:06:37 +00:00
subprefix = va ( " %s/%s " , prefix , com_token ) ;
2016-07-21 19:36:34 +00:00
else
2019-03-23 07:06:37 +00:00
subprefix = com_token ;
2019-06-17 04:21:41 +00:00
# ifdef HAVE_LEGACY
//hack. I'm trying to retire the self-signed cert on [fte.]triptohell.info
if ( ! strcmp ( url , " https://triptohell.info/downloadables.php " ) | | ! strcmp ( url , " https://fte.triptohell.info/downloadables.php " ) )
{
Q_strncpyz ( url , " https://updates.triptohell.info/downloadables.php " , sizeof ( url ) ) ;
forcewrite = true ;
}
# endif
2019-03-23 07:06:37 +00:00
PM_AddSubList ( url , subprefix , ( parseflags & DPF_ENABLED ) ? true : false , ( parseflags & DPF_TRUSTED ) ) ;
2016-07-21 19:36:34 +00:00
continue ;
}
2019-03-23 07:06:37 +00:00
if ( ! strcmp ( com_token , " set " ) )
2016-07-21 19:36:34 +00:00
{
2019-03-23 07:06:37 +00:00
tokstart = COM_StringParse ( tokstart , com_token , sizeof ( com_token ) , false , false ) ;
if ( ! strcmp ( com_token , " gamedir " ) )
2016-07-21 19:36:34 +00:00
{
2019-03-23 07:06:37 +00:00
tokstart = COM_StringParse ( tokstart , com_token , sizeof ( com_token ) , false , false ) ;
if ( ! * com_token )
2016-07-21 19:36:34 +00:00
Q_strncpyz ( defaultgamedir , FS_GetGamedir ( false ) , sizeof ( defaultgamedir ) ) ;
else
2019-03-23 07:06:37 +00:00
Q_strncpyz ( defaultgamedir , com_token , sizeof ( defaultgamedir ) ) ;
2016-07-21 19:36:34 +00:00
}
2019-03-23 07:06:37 +00:00
else if ( ! strcmp ( com_token , " mirrors " ) )
2016-07-21 19:36:34 +00:00
{
nummirrors = 0 ;
2019-03-23 07:06:37 +00:00
while ( nummirrors < countof ( mirror ) & & tokstart )
2016-07-21 19:36:34 +00:00
{
2019-03-23 07:06:37 +00:00
tokstart = COM_StringParse ( tokstart , com_token , sizeof ( com_token ) , false , false ) ;
if ( * com_token )
{
Q_strncpyz ( mirror [ nummirrors ] , com_token , sizeof ( mirror [ nummirrors ] ) ) ;
nummirrors + + ;
}
2016-07-21 19:36:34 +00:00
}
}
2019-03-23 07:06:37 +00:00
else if ( ! strcmp ( com_token , " updatemode " ) )
2017-01-24 10:27:39 +00:00
{
2019-03-23 07:06:37 +00:00
tokstart = COM_StringParse ( tokstart , com_token , sizeof ( com_token ) , false , false ) ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
if ( parseflags & DPF_ENABLED ) //don't use a downloaded file's version of this, only use the local version of it.
2019-06-17 04:21:41 +00:00
Cvar_ForceSet ( & pkg_autoupdate , com_token ) ;
2017-01-24 10:27:39 +00:00
}
2019-03-23 07:06:37 +00:00
else if ( ! strcmp ( com_token , " declined " ) )
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
{
if ( parseflags & DPF_ENABLED ) //don't use a downloaded file's version of this, only use the local version of it.
{
2019-03-23 07:06:37 +00:00
tokstart = COM_StringParse ( tokstart , com_token , sizeof ( com_token ) , false , false ) ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
Z_Free ( declinedpackages ) ;
2019-03-23 07:06:37 +00:00
if ( * com_token )
declinedpackages = Z_StrDup ( com_token ) ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
else
declinedpackages = NULL ;
}
}
2016-07-21 19:36:34 +00:00
else
{
//erk
}
continue ;
}
2019-01-13 16:51:50 +00:00
isauto = false ;
2019-03-23 07:06:37 +00:00
#if 0
if ( version < 2 )
{
char pathname [ 256 ] ;
const char * fullname = Cmd_Argv ( 0 ) ;
if ( argc > 5 | | argc < 3 )
{
Con_Printf ( " Package list is bad - %s \n " , line ) ;
continue ; //but try the next line away
}
p = Z_Malloc ( sizeof ( * p ) ) ;
if ( * prefix )
Q_snprintfz ( pathname , sizeof ( pathname ) , " %s/%s " , prefix , fullname ) ;
else
Q_snprintfz ( pathname , sizeof ( pathname ) , " %s " , fullname ) ;
p - > name = Z_StrDup ( COM_SkipPath ( pathname ) ) ;
p - > title = Z_StrDup ( p - > name ) ;
* COM_SkipPath ( pathname ) = 0 ;
p - > category = Z_StrDup ( pathname ) ;
p - > mirror [ 0 ] = Z_StrDup ( p - > name ) ;
p - > priority = PM_DEFAULTPRIORITY ;
p - > flags = parseflags ;
p - > mirror [ 0 ] = Z_StrDup ( Cmd_Argv ( 1 ) ) ;
PM_AddDep ( p , DEP_FILE , Cmd_Argv ( 2 ) ) ;
Q_strncpyz ( p - > version , Cmd_Argv ( 3 ) , sizeof ( p - > version ) ) ;
Q_strncpyz ( p - > gamedir , Cmd_Argv ( 4 ) , sizeof ( p - > gamedir ) ) ;
if ( ! strcmp ( p - > gamedir , " ../ " ) )
{
p - > fsroot = FS_ROOT ;
* p - > gamedir = 0 ;
}
else
{
if ( ! * p - > gamedir )
{
strcpy ( p - > gamedir , FS_GetGamedir ( false ) ) ;
// p->fsroot = FS_GAMEONLY;
}
p - > fsroot = FS_ROOT ;
}
}
else
# endif
2016-07-21 19:36:34 +00:00
{
2016-11-20 20:52:41 +00:00
char pathname [ 256 ] ;
2019-03-23 07:06:37 +00:00
char * fullname = Z_StrDup ( com_token ) ;
2016-07-21 19:36:34 +00:00
char * file = NULL ;
char * url = NULL ;
char * gamedir = NULL ;
char * ver = NULL ;
2016-08-25 00:12:14 +00:00
char * arch = NULL ;
char * qhash = NULL ;
2016-11-20 20:52:41 +00:00
char * title = NULL ;
2016-11-25 08:14:54 +00:00
char * category = NULL ;
2016-08-25 00:12:14 +00:00
char * description = NULL ;
char * license = NULL ;
char * author = NULL ;
char * previewimage = NULL ;
2019-01-15 14:12:49 +00:00
char * website = NULL ;
2016-07-26 11:47:59 +00:00
int extract = EXTRACT_COPY ;
2016-08-25 00:12:14 +00:00
int priority = PM_DEFAULTPRIORITY ;
unsigned int flags = parseflags ;
2017-04-18 11:12:17 +00:00
enum fs_relative fsroot = FS_ROOT ;
2005-10-14 18:28:44 +00:00
int i ;
2016-07-26 11:47:59 +00:00
2016-08-25 00:12:14 +00:00
if ( version > 2 )
2017-01-24 10:27:39 +00:00
flags & = ~ DPF_ENABLED ;
2016-08-25 00:12:14 +00:00
2016-07-26 11:47:59 +00:00
p = Z_Malloc ( sizeof ( * p ) ) ;
2019-03-23 07:06:37 +00:00
for ( i = 1 ; tokstart ; i + + )
2005-04-16 16:22:17 +00:00
{
2019-03-23 07:06:37 +00:00
char key [ 8192 ] ;
char val [ 8192 ] ;
char * eq ;
//the following are [\]["]key=["]value["] parameters, which is definitely messy, yes.
//skip leading whitespace
while ( * tokstart > 0 & & * tokstart < = ' ' )
tokstart + + ;
* val = 0 ;
if ( * tokstart = = ' \\ ' | | * tokstart = = ' \" ' )
{ //legacy quoting
tokstart = COM_StringParse ( tokstart , key , sizeof ( key ) , false , false ) ;
eq = strchr ( key , ' = ' ) ;
if ( eq )
{
* eq = 0 ;
Q_strncpyz ( val , eq + 1 , sizeof ( val ) ) ;
}
}
else
{
tokstart = COM_ParseTokenOut ( tokstart , " = " , key , sizeof ( key ) , NULL ) ;
if ( ! * key )
continue ;
if ( tokstart & & * tokstart = = ' = ' )
{
tokstart + + ;
if ( ! ( * tokstart > = 0 & & * tokstart < = ' ' ) )
tokstart = COM_ParseCString ( tokstart , val , sizeof ( val ) , NULL ) ;
}
}
if ( ! strcmp ( key , " url " ) )
Z_StrDupPtr ( & url , val ) ;
else if ( ! strcmp ( key , " category " ) )
Z_StrDupPtr ( & category , val ) ;
else if ( ! strcmp ( key , " title " ) )
Z_StrDupPtr ( & title , val ) ;
else if ( ! strcmp ( key , " gamedir " ) )
Z_StrDupPtr ( & gamedir , val ) ;
else if ( ! strcmp ( key , " ver " ) | | ! strcmp ( key , " v " ) )
Z_StrDupPtr ( & ver , val ) ;
else if ( ! strcmp ( key , " arch " ) )
Z_StrDupPtr ( & arch , val ) ;
else if ( ! strcmp ( key , " priority " ) )
priority = atoi ( val ) ;
else if ( ! strcmp ( key , " qhash " ) )
Z_StrDupPtr ( & qhash , val ) ;
else if ( ! strcmp ( key , " desc " ) | | ! strcmp ( key , " description " ) )
Z_StrDupPtr ( & description , val ) ;
else if ( ! strcmp ( key , " license " ) )
Z_StrDupPtr ( & license , val ) ;
else if ( ! strcmp ( key , " author " ) )
Z_StrDupPtr ( & author , val ) ;
else if ( ! strcmp ( key , " preview " ) )
Z_StrDupPtr ( & previewimage , val ) ;
else if ( ! strcmp ( key , " website " ) )
Z_StrDupPtr ( & website , val ) ;
else if ( ! strcmp ( key , " file " ) )
2016-07-26 11:47:59 +00:00
{
if ( ! file )
2019-03-23 07:06:37 +00:00
Z_StrDupPtr ( & file , val ) ;
PM_AddDep ( p , DEP_FILE , val ) ;
2016-07-26 11:47:59 +00:00
}
2019-03-23 07:06:37 +00:00
else if ( ! strcmp ( key , " extract " ) )
2016-07-21 19:36:34 +00:00
{
2019-03-23 07:06:37 +00:00
if ( ! strcmp ( val , " xz " ) )
2016-07-26 11:47:59 +00:00
extract = EXTRACT_XZ ;
2019-03-23 07:06:37 +00:00
else if ( ! strcmp ( val , " gz " ) )
2016-07-26 11:47:59 +00:00
extract = EXTRACT_GZ ;
2019-03-23 07:06:37 +00:00
else if ( ! strcmp ( val , " zip " ) )
2016-07-26 11:47:59 +00:00
extract = EXTRACT_ZIP ;
2016-07-21 19:36:34 +00:00
else
2019-03-23 07:06:37 +00:00
Con_Printf ( " Unknown decompression method: %s \n " , val ) ;
2016-07-21 19:36:34 +00:00
}
2019-03-23 07:06:37 +00:00
else if ( ! strcmp ( key , " depend " ) )
PM_AddDep ( p , DEP_REQUIRE , val ) ;
else if ( ! strcmp ( key , " conflict " ) )
PM_AddDep ( p , DEP_CONFLICT , val ) ;
else if ( ! strcmp ( key , " fileconflict " ) )
PM_AddDep ( p , DEP_FILECONFLICT , val ) ;
else if ( ! strcmp ( key , " recommend " ) )
PM_AddDep ( p , DEP_RECOMMEND , val ) ;
2019-06-05 20:48:06 +00:00
else if ( ! strcmp ( key , " suggest " ) )
PM_AddDep ( p , DEP_SUGGEST , val ) ;
2019-03-23 07:06:37 +00:00
else if ( ! strcmp ( key , " test " ) )
2017-01-24 10:27:39 +00:00
flags | = DPF_TESTING ;
2019-03-23 07:06:37 +00:00
else if ( ! strcmp ( key , " stale " ) & & version = = 2 )
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
flags & = ~ DPF_ENABLED ; //known about, (probably) cached, but not actually enabled.
2019-03-23 07:06:37 +00:00
else if ( ! strcmp ( key , " installed " ) & & version > 2 )
2017-01-24 10:27:39 +00:00
flags | = parseflags & DPF_ENABLED ;
2019-03-23 07:06:37 +00:00
else if ( ! strcmp ( key , " auto " ) )
2019-01-13 16:51:50 +00:00
isauto = true ; //autoinstalled and NOT user-installed
2019-03-23 07:06:37 +00:00
else if ( ! strcmp ( key , " root " ) & & ( parseflags & DPF_ENABLED ) )
2017-04-18 11:12:17 +00:00
{
2019-03-23 07:06:37 +00:00
if ( ! Q_strcasecmp ( val , " bin " ) )
2017-04-18 11:12:17 +00:00
fsroot = FS_BINARYPATH ;
else
fsroot = FS_ROOT ;
}
2016-07-26 11:47:59 +00:00
else
2016-07-21 19:36:34 +00:00
{
2016-07-26 11:47:59 +00:00
Con_DPrintf ( " Unknown package property \n " ) ;
2016-07-21 19:36:34 +00:00
}
2005-10-14 18:28:44 +00:00
}
2005-10-16 12:53:42 +00:00
2016-11-25 08:14:54 +00:00
if ( category )
{
2019-03-23 07:06:37 +00:00
p - > name = fullname ;
2016-11-25 08:14:54 +00:00
if ( * prefix )
Q_snprintfz ( pathname , sizeof ( pathname ) , " %s/%s " , prefix , category ) ;
else
Q_snprintfz ( pathname , sizeof ( pathname ) , " %s " , category ) ;
if ( * pathname )
{
if ( pathname [ strlen ( pathname ) - 1 ] ! = ' / ' )
Q_strncatz ( pathname , " / " , sizeof ( pathname ) ) ;
}
p - > category = Z_StrDup ( pathname ) ;
}
2016-07-21 19:36:34 +00:00
else
2016-11-25 08:14:54 +00:00
{
if ( * prefix )
Q_snprintfz ( pathname , sizeof ( pathname ) , " %s/%s " , prefix , fullname ) ;
else
Q_snprintfz ( pathname , sizeof ( pathname ) , " %s " , fullname ) ;
2019-03-23 07:06:37 +00:00
Z_Free ( fullname ) ;
2016-11-25 08:14:54 +00:00
p - > name = Z_StrDup ( COM_SkipPath ( pathname ) ) ;
* COM_SkipPath ( pathname ) = 0 ;
p - > category = Z_StrDup ( pathname ) ;
}
2016-11-20 20:52:41 +00:00
if ( ! title )
2019-03-23 07:06:37 +00:00
title = Z_StrDup ( p - > name ) ;
2005-10-16 12:53:42 +00:00
2016-07-21 19:36:34 +00:00
Q_strncpyz ( p - > version , ver ? ver : " " , sizeof ( p - > version ) ) ;
2006-01-28 06:41:20 +00:00
2019-03-23 07:06:37 +00:00
Q_snprintfz ( p - > gamedir , sizeof ( p - > gamedir ) , " %s " , gamedir ? gamedir : defaultgamedir ) ;
2017-04-18 11:12:17 +00:00
p - > fsroot = fsroot ;
2016-07-21 19:36:34 +00:00
p - > extract = extract ;
2016-08-25 00:12:14 +00:00
p - > priority = priority ;
p - > flags = flags ;
2019-03-23 07:06:37 +00:00
p - > title = title ;
p - > arch = arch ;
p - > qhash = qhash ;
p - > description = description ;
p - > license = license ;
p - > author = author ;
p - > previewimage = previewimage ;
p - > website = website ;
2016-07-21 19:36:34 +00:00
if ( url & & ( ! strncmp ( url , " http:// " , 7 ) | | ! strncmp ( url , " https:// " , 8 ) ) )
p - > mirror [ 0 ] = Z_StrDup ( url ) ;
else
{
int m ;
char * ext = " " ;
2019-03-23 07:06:37 +00:00
char * relurl = url ;
if ( ! relurl )
2016-07-21 19:36:34 +00:00
{
2016-07-26 11:47:59 +00:00
if ( extract = = EXTRACT_XZ )
2016-07-21 19:36:34 +00:00
ext = " .xz " ;
2016-07-26 11:47:59 +00:00
else if ( extract = = EXTRACT_GZ )
2016-07-21 19:36:34 +00:00
ext = " .gz " ;
2016-07-26 11:47:59 +00:00
else if ( extract = = EXTRACT_ZIP )
ext = " .zip " ;
2019-03-23 07:06:37 +00:00
relurl = file ;
2016-07-21 19:36:34 +00:00
}
2019-03-23 07:06:37 +00:00
if ( relurl )
2016-08-25 00:12:14 +00:00
{
for ( m = 0 ; m < nummirrors ; m + + )
2019-03-23 07:06:37 +00:00
p - > mirror [ m ] = Z_StrDup ( va ( " %s%s%s " , mirror [ m ] , relurl , ext ) ) ;
2016-07-21 19:36:34 +00:00
}
}
2019-03-23 07:06:37 +00:00
Z_Free ( ver ) ;
Z_Free ( file ) ;
Z_Free ( url ) ;
Z_Free ( gamedir ) ;
Z_Free ( category ) ;
2005-04-16 16:22:17 +00:00
}
2016-08-25 00:12:14 +00:00
if ( p - > arch )
2016-07-26 11:47:59 +00:00
{
2016-08-25 00:12:14 +00:00
if ( ! Q_strcasecmp ( p - > arch , THISENGINE ) )
2016-07-26 11:47:59 +00:00
{
2017-01-24 10:27:39 +00:00
if ( ! Sys_EngineCanUpdate ( ) )
2016-07-26 11:47:59 +00:00
p - > flags | = DPF_HIDDEN ;
2016-08-25 00:12:14 +00:00
else
p - > flags | = DPF_ENGINE ;
2016-07-26 11:47:59 +00:00
}
2016-08-25 00:12:14 +00:00
else if ( ! Q_strcasecmp ( p - > arch , THISARCH ) )
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
{
2019-03-23 07:06:37 +00:00
if ( ( p - > fsroot = = FS_ROOT | | p - > fsroot = = FS_BINARYPATH ) & & ! * p - > gamedir & & p - > priority = = PM_DEFAULTPRIORITY )
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
p - > flags | = DPF_PLUGIN ;
}
2016-08-25 00:12:14 +00:00
else
p - > flags | = DPF_HIDDEN ; //other engine builds or other cpus are all hidden
2016-07-26 11:47:59 +00:00
}
2016-08-25 00:12:14 +00:00
for ( dep = p - > deps ; dep ; dep = dep - > next )
2016-07-21 19:36:34 +00:00
{
2016-08-25 00:12:14 +00:00
if ( dep - > dtype = = DEP_FILECONFLICT )
2016-07-26 11:47:59 +00:00
{
2016-08-25 00:12:14 +00:00
const char * n ;
2016-07-26 11:47:59 +00:00
if ( * p - > gamedir )
n = va ( " %s/%s " , p - > gamedir , dep - > name ) ;
else
n = dep - > name ;
2016-08-25 00:12:14 +00:00
if ( PM_CheckFile ( n , p - > fsroot ) )
p - > flags | = DPF_HIDDEN ;
2016-07-26 11:47:59 +00:00
}
2016-07-21 19:36:34 +00:00
}
2017-01-24 10:27:39 +00:00
if ( p - > flags & DPF_ENABLED )
2019-01-13 16:51:50 +00:00
{
if ( isauto )
p - > flags | = DPF_AUTOMARKED ; //FIXME: we don't know if this was manual or auto
else
p - > flags | = DPF_USERMARKED ; //FIXME: we don't know if this was manual or auto
}
2016-08-25 00:12:14 +00:00
PM_InsertPackage ( p ) ;
}
}
2019-06-17 04:21:41 +00:00
return forcewrite ;
2016-08-25 00:12:14 +00:00
}
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
# ifdef PLUGINS
void PM_EnumeratePlugins ( void ( * callback ) ( const char * name ) )
{
package_t * p ;
struct packagedep_s * d ;
for ( p = availablepackages ; p ; p = p - > next )
{
if ( ( p - > flags & DPF_ENABLED ) & & ( p - > flags & DPF_PLUGIN ) )
{
for ( d = p - > deps ; d ; d = d - > next )
{
if ( d - > dtype = = DEP_FILE )
{
if ( ! Q_strncasecmp ( d - > name , " fteplug_ " , 8 ) )
callback ( d - > name ) ;
}
}
}
}
}
# endif
2017-04-18 11:12:17 +00:00
# ifdef PLUGINS
static void PM_WriteInstalledPackages ( void ) ;
static package_t * PM_FindPackage ( const char * packagename ) ;
static int QDECL PM_EnumeratedPlugin ( const char * name , qofs_t size , time_t mtime , void * param , searchpathfuncs_t * spath )
2016-08-25 00:12:14 +00:00
{
2019-02-16 19:09:07 +00:00
static const char * knownarch [ ] =
{
" x32 " , " x64 " , " amd64 " , " x86 " , //various x86 ABIs
" arm " , " arm64 " , " armhf " , //various arm ABIs
" ppc " , " unk " , //various misc ABIs
} ;
2016-08-25 00:12:14 +00:00
package_t * p ;
2017-04-18 11:12:17 +00:00
struct packagedep_s * dep ;
char vmname [ MAX_QPATH ] ;
2019-02-16 19:09:07 +00:00
int len , l , a ;
2017-04-18 11:12:17 +00:00
char * dot ;
if ( ! strncmp ( name , " fteplug_ " , 8 ) )
Q_strncpyz ( vmname , name + 8 , sizeof ( vmname ) ) ;
else
Q_strncpyz ( vmname , name , sizeof ( vmname ) ) ;
len = strlen ( vmname ) ;
2019-02-16 19:09:07 +00:00
l = strlen ( ARCH_CPU_POSTFIX ARCH_DL_POSTFIX ) ;
if ( len > l & & ! strcmp ( vmname + len - l , ARCH_CPU_POSTFIX ARCH_DL_POSTFIX ) )
{
len - = l ;
2017-04-18 11:12:17 +00:00
vmname [ len ] = 0 ;
2019-02-16 19:09:07 +00:00
}
2017-04-18 11:12:17 +00:00
else
{
dot = strchr ( vmname , ' . ' ) ;
if ( dot )
2019-02-16 19:09:07 +00:00
{
2017-04-18 11:12:17 +00:00
* dot = 0 ;
2019-02-16 19:09:07 +00:00
len = strlen ( vmname ) ;
//if we can find a known cpu arch there then ignore it - its a different cpu arch
for ( a = 0 ; a < countof ( knownarch ) ; a + + )
{
l = strlen ( knownarch [ a ] ) ;
if ( len > l & & ! Q_strcasecmp ( vmname + len - l , knownarch [ a ] ) )
return true ; //wrong arch! ignore it.
}
}
2017-04-18 11:12:17 +00:00
}
if ( len > 0 & & vmname [ len - 1 ] = = ' _ ' )
vmname [ len - 1 ] = 0 ;
2016-08-25 00:12:14 +00:00
2017-04-18 11:12:17 +00:00
for ( p = availablepackages ; p ; p = p - > next )
{
if ( ! ( p - > flags & DPF_PLUGIN ) )
continue ;
for ( dep = p - > deps ; dep ; dep = dep - > next )
{
if ( dep - > dtype ! = DEP_FILE )
continue ;
if ( ! Q_strcasecmp ( dep - > name , name ) )
return true ;
}
}
if ( PM_FindPackage ( vmname ) )
return true ; //don't include it if its a dupe anyway.
p = Z_Malloc ( sizeof ( * p ) ) ;
p - > deps = Z_Malloc ( sizeof ( * p - > deps ) + strlen ( name ) ) ;
p - > deps - > dtype = DEP_FILE ;
strcpy ( p - > deps - > name , name ) ;
p - > arch = Z_StrDup ( THISARCH ) ;
p - > name = Z_StrDup ( vmname ) ;
p - > title = Z_StrDup ( vmname ) ;
p - > category = Z_StrDup ( " Plugins/ " ) ;
p - > priority = PM_DEFAULTPRIORITY ;
p - > fsroot = FS_BINARYPATH ;
strcpy ( p - > version , " ?? " " ?? " ) ;
p - > flags = DPF_PLUGIN | DPF_NATIVE | DPF_FORGETONUNINSTALL ;
PM_InsertPackage ( p ) ;
* ( int * ) param = true ;
return true ;
}
2017-04-18 13:47:02 +00:00
# ifndef SERVERONLY
2017-04-18 11:12:17 +00:00
void PM_PluginDetected ( void * ctx , int status )
{
PM_WriteInstalledPackages ( ) ;
if ( status = = 0 )
{
Cmd_ExecuteString ( " menu_download \n " , RESTRICT_LOCAL ) ;
Cmd_ExecuteString ( " menu_download \" Plugins/ \" \n " , RESTRICT_LOCAL ) ;
}
}
# endif
2017-04-18 13:47:02 +00:00
# endif
2017-04-18 11:12:17 +00:00
static void PM_PreparePackageList ( void )
{
2016-08-25 00:12:14 +00:00
//figure out what we've previously installed.
if ( ! loadedinstalled )
{
vfsfile_t * f = FS_OpenVFS ( INSTALLEDFILES , " rb " , FS_ROOT ) ;
loadedinstalled = true ;
if ( f )
{
2019-06-17 04:21:41 +00:00
if ( PM_ParsePackageList ( f , DPF_FORGETONUNINSTALL | DPF_ENABLED , NULL , " " ) )
PM_WriteInstalledPackages ( ) ;
2016-08-25 00:12:14 +00:00
VFS_CLOSE ( f ) ;
}
2017-04-18 11:12:17 +00:00
# ifdef PLUGINS
{
int foundone = false ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
char nat [ MAX_OSPATH ] ;
2017-04-18 11:12:17 +00:00
FS_NativePath ( " " , FS_BINARYPATH , nat , sizeof ( nat ) ) ;
Con_DPrintf ( " Loading plugins from \" %s \" \n " , nat ) ;
2019-02-16 19:09:07 +00:00
Sys_EnumerateFiles ( nat , " fteplug_* " ARCH_DL_POSTFIX , PM_EnumeratedPlugin , & foundone , NULL ) ;
2017-04-18 11:12:17 +00:00
if ( foundone & & ! pluginpromptshown )
{
pluginpromptshown = true ;
2017-04-18 13:47:02 +00:00
# ifndef SERVERONLY
2017-04-29 02:45:21 +00:00
M_Menu_Prompt ( PM_PluginDetected , NULL , " Plugin(s) appears to have \n been installed externally. \n Use the updates menu \n to enable them. " , " View " , NULL , " Disable " ) ;
2017-04-18 13:47:02 +00:00
# endif
2017-04-18 11:12:17 +00:00
}
}
# endif
2016-08-25 00:12:14 +00:00
}
2017-04-18 11:12:17 +00:00
}
void PM_LoadPackages ( searchpath_t * * oldpaths , const char * parent_pure , const char * parent_logical , searchpath_t * search , unsigned int loadstuff , int minpri , int maxpri )
{
package_t * p ;
struct packagedep_s * d ;
char temp [ MAX_OSPATH ] ;
int pri ;
//figure out what we've previously installed.
PM_PreparePackageList ( ) ;
2016-08-25 00:12:14 +00:00
do
{
//find the lowest used priority above the previous
pri = maxpri ;
for ( p = availablepackages ; p ; p = p - > next )
{
2017-01-24 10:27:39 +00:00
if ( ( p - > flags & DPF_ENABLED ) & & p - > qhash & & p - > priority > = minpri & & p - > priority < pri & & ! Q_strcasecmp ( parent_pure , p - > gamedir ) )
2016-08-25 00:12:14 +00:00
pri = p - > priority ;
}
minpri = pri + 1 ;
for ( p = availablepackages ; p ; p = p - > next )
{
2017-01-24 10:27:39 +00:00
if ( ( p - > flags & DPF_ENABLED ) & & p - > qhash & & p - > priority = = pri & & ! Q_strcasecmp ( parent_pure , p - > gamedir ) )
2016-07-21 19:36:34 +00:00
{
2016-08-25 00:12:14 +00:00
for ( d = p - > deps ; d ; d = d - > next )
2016-07-21 19:36:34 +00:00
{
2016-08-25 00:12:14 +00:00
if ( d - > dtype = = DEP_FILE )
2016-07-26 11:47:59 +00:00
{
2016-08-25 00:12:14 +00:00
Q_snprintfz ( temp , sizeof ( temp ) , " %s/%s " , p - > gamedir , d - > name ) ;
2017-11-23 07:46:39 +00:00
FS_AddHashedPackage ( oldpaths , parent_pure , parent_logical , search , loadstuff , temp , p - > qhash , NULL , SPF_COPYPROTECTED | SPF_UNTRUSTED ) ;
2016-07-26 11:47:59 +00:00
}
2016-07-21 19:36:34 +00:00
}
}
2005-04-16 16:22:17 +00:00
}
2016-08-25 00:12:14 +00:00
} while ( pri < maxpri ) ;
2005-04-16 16:22:17 +00:00
}
2016-08-25 00:12:14 +00:00
void PM_Shutdown ( void )
2016-07-26 11:47:59 +00:00
{
2016-08-25 00:12:14 +00:00
//free everything...
2019-06-17 04:21:41 +00:00
pkg_downloads_url . modified = false ;
2016-08-25 00:12:14 +00:00
downloadablessequence + + ;
while ( numdownloadablelists > 0 )
2016-07-26 11:47:59 +00:00
{
2016-08-25 00:12:14 +00:00
numdownloadablelists - - ;
2018-08-04 07:05:20 +00:00
# ifdef WEBCLIENT
2016-08-25 00:12:14 +00:00
if ( downloadablelist [ numdownloadablelists ] . curdl )
{
DL_Close ( downloadablelist [ numdownloadablelists ] . curdl ) ;
downloadablelist [ numdownloadablelists ] . curdl = NULL ;
}
2018-08-04 07:05:20 +00:00
# endif
2016-08-25 00:12:14 +00:00
downloadablelist [ numdownloadablelists ] . received = 0 ;
Z_Free ( downloadablelist [ numdownloadablelists ] . url ) ;
downloadablelist [ numdownloadablelists ] . url = NULL ;
Z_Free ( downloadablelist [ numdownloadablelists ] . prefix ) ;
downloadablelist [ numdownloadablelists ] . prefix = NULL ;
2016-07-26 11:47:59 +00:00
}
2016-08-25 00:12:14 +00:00
while ( availablepackages )
PM_FreePackage ( availablepackages ) ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
loadedinstalled = false ;
2016-07-26 11:47:59 +00:00
}
2016-08-25 00:12:14 +00:00
//finds the newest version
2016-11-20 20:52:41 +00:00
static package_t * PM_FindPackage ( const char * packagename )
2005-08-26 22:56:51 +00:00
{
2016-08-25 00:12:14 +00:00
package_t * p , * r = NULL ;
2005-08-26 22:56:51 +00:00
2016-11-20 20:52:41 +00:00
//fixme: NAME (>VER)
//fixme: NAME (<VER)
//fixme: NAME:ARCH (>VER)
2006-01-28 06:41:20 +00:00
2016-07-21 19:36:34 +00:00
for ( p = availablepackages ; p ; p = p - > next )
{
if ( ! strcmp ( p - > name , packagename ) )
{
if ( ! r | | strcmp ( r - > version , p - > version ) > 0 )
r = p ;
}
}
return r ;
}
2016-08-25 00:12:14 +00:00
//returns the marked version of a package, if any.
2019-03-23 07:06:37 +00:00
static package_t * PM_MarkedPackage ( const char * packagename , int markflag )
2016-07-21 19:36:34 +00:00
{
package_t * p ;
for ( p = availablepackages ; p ; p = p - > next )
{
2019-03-23 07:06:37 +00:00
if ( p - > flags & markflag )
2016-11-20 20:52:41 +00:00
if ( ! strcmp ( p - > name , packagename ) )
2016-07-21 19:36:34 +00:00
return p ;
}
return NULL ;
}
2016-11-20 20:52:41 +00:00
//just resets all actions, so that a following apply won't do anything.
static void PM_RevertChanges ( void )
{
package_t * p ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
if ( pkg_updating )
return ;
2016-11-20 20:52:41 +00:00
for ( p = availablepackages ; p ; p = p - > next )
{
2017-01-24 10:27:39 +00:00
if ( p - > flags & DPF_ENABLED )
2018-10-11 10:31:23 +00:00
p - > flags | = DPF_USERMARKED ;
2016-11-20 20:52:41 +00:00
else
p - > flags & = ~ DPF_MARKED ;
p - > flags & = ~ DPF_PURGE ;
}
}
2018-10-11 10:31:23 +00:00
static qboolean PM_HasDependant ( package_t * package , unsigned int markflag )
{
package_t * o ;
struct packagedep_s * dep ;
for ( o = availablepackages ; o ; o = o - > next )
{
if ( o - > flags & markflag )
for ( dep = o - > deps ; dep ; dep = dep - > next )
2019-06-05 20:48:06 +00:00
if ( dep - > dtype = = DEP_REQUIRE | | dep - > dtype = = DEP_RECOMMEND | | dep - > dtype = = DEP_SUGGEST )
2018-10-11 10:31:23 +00:00
if ( ! strcmp ( package - > name , dep - > name ) )
return true ;
}
return false ;
}
//just flags, doesn't delete (yet)
//markflag should be DPF_AUTOMARKED or DPF_USERMARKED
static void PM_UnmarkPackage ( package_t * package , unsigned int markflag )
2016-07-21 19:36:34 +00:00
{
package_t * o ;
struct packagedep_s * dep ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
if ( pkg_updating )
return ;
2018-10-11 10:31:23 +00:00
if ( ! ( package - > flags & markflag ) )
2016-07-21 19:36:34 +00:00
return ; //looks like its already deselected.
2018-10-11 10:31:23 +00:00
package - > flags & = ~ ( markflag ) ;
2016-07-21 19:36:34 +00:00
2018-10-11 10:31:23 +00:00
if ( ! ( package - > flags & DPF_MARKED ) )
{
2018-08-04 07:05:20 +00:00
# ifdef WEBCLIENT
2018-10-11 10:31:23 +00:00
//Is this safe?
package - > trymirrors = 0 ; //if its enqueued, cancel that quickly...
if ( package - > download )
{ //if its currently downloading, cancel it.
DL_Close ( package - > download ) ;
package - > download = NULL ;
}
2018-08-04 07:05:20 +00:00
# endif
2016-07-21 19:36:34 +00:00
2018-10-11 10:31:23 +00:00
//remove stuff that depends on us
for ( o = availablepackages ; o ; o = o - > next )
{
for ( dep = o - > deps ; dep ; dep = dep - > next )
if ( dep - > dtype = = DEP_REQUIRE )
if ( ! strcmp ( dep - > name , package - > name ) )
PM_UnmarkPackage ( o , DPF_MARKED ) ;
}
}
if ( ! ( package - > flags & DPF_USERMARKED ) )
2016-07-21 19:36:34 +00:00
{
2018-10-11 10:31:23 +00:00
//go through dependancies and unmark any automarked packages if nothing else depends upon them
for ( dep = package - > deps ; dep ; dep = dep - > next )
{
if ( dep - > dtype = = DEP_REQUIRE | | dep - > dtype = = DEP_RECOMMEND )
{
2019-03-23 07:06:37 +00:00
package_t * d = PM_MarkedPackage ( dep - > name , DPF_AUTOMARKED ) ;
2018-10-11 10:31:23 +00:00
if ( d & & ! ( d - > flags & DPF_USERMARKED ) )
{
if ( ! PM_HasDependant ( d , DPF_MARKED ) )
PM_UnmarkPackage ( d , DPF_AUTOMARKED ) ;
}
}
}
2016-07-21 19:36:34 +00:00
}
}
//just flags, doesn't install
2018-10-11 10:31:23 +00:00
static void PM_MarkPackage ( package_t * package , unsigned int markflag )
2016-07-21 19:36:34 +00:00
{
package_t * o ;
2016-07-26 11:47:59 +00:00
struct packagedep_s * dep , * dep2 ;
2016-07-21 19:36:34 +00:00
qboolean replacing = false ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
if ( pkg_updating )
return ;
2016-08-25 00:12:14 +00:00
if ( package - > flags & DPF_MARKED )
2018-10-11 10:31:23 +00:00
{
package - > flags | = markflag ;
2019-03-23 07:06:37 +00:00
return ; //looks like its already picked. marking it again will do no harm.
2018-10-11 10:31:23 +00:00
}
2016-07-26 11:47:59 +00:00
2019-05-23 15:11:32 +00:00
# ifndef WEBCLIENT
//can't mark for download if we cannot download.
if ( ! ( package - > flags & DPF_PRESENT ) )
{ //though we can at least unmark it for deletion...
package - > flags & = ~ DPF_PURGE ;
return ;
}
# endif
2016-07-26 11:47:59 +00:00
//any file-conflicts prevent the package from being installable.
//this is mostly for pak1.pak
for ( dep = package - > deps ; dep ; dep = dep - > next )
{
if ( dep - > dtype = = DEP_FILECONFLICT )
{
const char * n ;
if ( * package - > gamedir )
n = va ( " %s/%s " , package - > gamedir , dep - > name ) ;
else
n = dep - > name ;
2016-08-25 00:12:14 +00:00
if ( PM_CheckFile ( n , package - > fsroot ) )
2016-07-26 11:47:59 +00:00
return ;
}
}
2018-10-11 10:31:23 +00:00
package - > flags | = markflag ;
2016-07-21 19:36:34 +00:00
//first check to see if we're replacing a different version of the same package
for ( o = availablepackages ; o ; o = o - > next )
{
if ( o = = package )
continue ;
2016-08-25 00:12:14 +00:00
if ( o - > flags & DPF_MARKED )
2016-07-21 19:36:34 +00:00
{
2016-11-20 20:52:41 +00:00
if ( ! strcmp ( o - > name , package - > name ) )
2016-07-21 19:36:34 +00:00
{ //replaces this package
2016-08-25 00:12:14 +00:00
o - > flags & = ~ DPF_MARKED ;
2016-07-21 19:36:34 +00:00
replacing = true ;
}
2016-08-25 00:12:14 +00:00
else
{ //two packages with the same filename are always mutually incompatible, but with totally separate dependancies etc.
qboolean remove = false ;
for ( dep = package - > deps ; dep ; dep = dep - > next )
{
if ( dep - > dtype = = DEP_FILE )
for ( dep2 = o - > deps ; dep2 ; dep2 = dep2 - > next )
{
if ( dep2 - > dtype = = DEP_FILE )
if ( ! strcmp ( dep - > name , dep2 - > name ) )
{
2018-10-11 10:31:23 +00:00
PM_UnmarkPackage ( o , DPF_MARKED ) ;
2016-08-25 00:12:14 +00:00
remove = true ;
break ;
}
}
if ( remove )
break ;
}
//fixme: zip content conflicts
}
}
}
//if we are replacing an existing one, then dependancies are already settled (only because we don't do version deps)
if ( replacing )
return ;
//satisfy our dependancies.
for ( dep = package - > deps ; dep ; dep = dep - > next )
{
if ( dep - > dtype = = DEP_REQUIRE | | dep - > dtype = = DEP_RECOMMEND )
{
2019-03-23 07:06:37 +00:00
package_t * d = PM_MarkedPackage ( dep - > name , DPF_MARKED ) ;
2016-08-25 00:12:14 +00:00
if ( ! d )
{
d = PM_FindPackage ( dep - > name ) ;
if ( d )
2018-10-11 10:31:23 +00:00
PM_MarkPackage ( d , DPF_AUTOMARKED ) ;
2016-08-25 00:12:14 +00:00
else
Con_DPrintf ( " Couldn't find dependancy \" %s \" \n " , dep - > name ) ;
}
}
if ( dep - > dtype = = DEP_CONFLICT )
{
for ( ; ; )
{
2019-03-23 07:06:37 +00:00
package_t * d = PM_MarkedPackage ( dep - > name , DPF_MARKED ) ;
2016-08-25 00:12:14 +00:00
if ( ! d )
break ;
2018-10-11 10:31:23 +00:00
PM_UnmarkPackage ( d , DPF_MARKED ) ;
2016-08-25 00:12:14 +00:00
}
}
}
//remove any packages that conflict with us.
for ( o = availablepackages ; o ; o = o - > next )
{
for ( dep = o - > deps ; dep ; dep = dep - > next )
if ( dep - > dtype = = DEP_CONFLICT )
2016-11-20 20:52:41 +00:00
if ( ! strcmp ( dep - > name , package - > name ) )
2018-10-11 10:31:23 +00:00
PM_UnmarkPackage ( o , DPF_MARKED ) ;
2016-08-25 00:12:14 +00:00
}
}
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
static qboolean PM_NameIsInStrings ( const char * strings , const char * match )
{
char tok [ 1024 ] ;
while ( strings & & * strings )
{
strings = COM_ParseStringSetSep ( strings , ' ; ' , tok , sizeof ( tok ) ) ;
if ( ! Q_strcasecmp ( tok , match ) ) //okay its here.
return true ;
}
return false ;
}
2016-08-25 00:12:14 +00:00
//just flag stuff as needing updating
2019-03-23 07:06:37 +00:00
unsigned int PM_MarkUpdates ( void )
2016-08-25 00:12:14 +00:00
{
unsigned int changecount = 0 ;
package_t * p , * o , * b , * e = NULL ;
2017-03-04 19:36:06 +00:00
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
if ( manifestpackages )
2017-03-04 19:36:06 +00:00
{
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
char tok [ 1024 ] ;
char * strings = manifestpackages ;
while ( strings & & * strings )
2017-03-04 19:36:06 +00:00
{
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
strings = COM_ParseStringSetSep ( strings , ' ; ' , tok , sizeof ( tok ) ) ;
if ( PM_NameIsInStrings ( declinedpackages , tok ) )
continue ;
2019-03-23 07:06:37 +00:00
p = PM_MarkedPackage ( tok , DPF_MARKED ) ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
if ( ! p )
2017-03-04 19:36:06 +00:00
{
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
p = PM_FindPackage ( tok ) ;
if ( p )
{
2018-10-11 10:31:23 +00:00
PM_MarkPackage ( p , DPF_AUTOMARKED ) ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
changecount + + ;
}
2017-03-04 19:36:06 +00:00
}
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
else if ( ! ( p - > flags & DPF_ENABLED ) )
changecount + + ;
2017-03-04 19:36:06 +00:00
}
}
2016-08-25 00:12:14 +00:00
for ( p = availablepackages ; p ; p = p - > next )
{
if ( ( p - > flags & DPF_ENGINE ) & & ! ( p - > flags & DPF_HIDDEN ) )
{
2019-06-17 04:21:41 +00:00
if ( ! ( p - > flags & DPF_TESTING ) | | pkg_autoupdate . ival > = UPD_TESTING )
2017-01-24 10:27:39 +00:00
if ( ! e | | strcmp ( e - > version , p - > version ) < 0 ) //package must be more recent than the previously found engine
if ( strcmp ( SVNREVISIONSTR , " - " ) & & strcmp ( SVNREVISIONSTR , p - > version ) < 0 ) //package must be more recent than the current engine too, there's no point auto-updating to an older revision.
e = p ;
2016-08-25 00:12:14 +00:00
}
if ( p - > flags & DPF_MARKED )
{
b = NULL ;
for ( o = availablepackages ; o ; o = o - > next )
{
if ( p = = o | | ( o - > flags & DPF_HIDDEN ) )
continue ;
2019-06-17 04:21:41 +00:00
if ( ! ( o - > flags & DPF_TESTING ) | | pkg_autoupdate . ival > = UPD_TESTING )
2017-01-24 10:27:39 +00:00
if ( ! strcmp ( o - > name , p - > name ) & & ! strcmp ( o - > arch ? o - > arch : " " , p - > arch ? p - > arch : " " ) & & strcmp ( o - > version , p - > version ) > 0 )
{
if ( ! b | | strcmp ( b - > version , o - > version ) < 0 )
b = o ;
}
2016-08-25 00:12:14 +00:00
}
if ( b )
{
changecount + + ;
2018-10-11 10:31:23 +00:00
PM_MarkPackage ( b , p - > flags & DPF_MARKED ) ;
PM_UnmarkPackage ( p , DPF_MARKED ) ;
2016-08-25 00:12:14 +00:00
}
}
}
if ( e & & ! ( e - > flags & DPF_MARKED ) )
{
2019-06-17 04:21:41 +00:00
if ( pkg_autoupdate . ival > = UPD_STABLE )
2016-08-25 00:12:14 +00:00
{
changecount + + ;
2018-10-11 10:31:23 +00:00
PM_MarkPackage ( e , DPF_AUTOMARKED ) ;
2016-08-25 00:12:14 +00:00
}
}
return changecount ;
}
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
# if defined(M_Menu_Prompt) || defined(SERVERONLY)
# else
static unsigned int PM_ChangeList ( char * out , size_t outsize )
{
unsigned int changes = 0 ;
const char * change ;
package_t * p ;
size_t l ;
size_t ofs = 0 ;
if ( ! outsize )
out = NULL ;
else
* out = 0 ;
for ( p = availablepackages ; p ; p = p - > next )
{
if ( ! ( p - > flags & DPF_MARKED ) ! = ! ( p - > flags & DPF_ENABLED ) | | ( p - > flags & DPF_PURGE ) )
{
changes + + ;
if ( ! out )
continue ;
if ( p - > flags & DPF_MARKED )
{
if ( p - > flags & DPF_PURGE )
change = va ( " reinstall %s \n " , p - > name ) ;
else if ( p - > flags & DPF_PRESENT )
change = va ( " enable %s \n " , p - > name ) ;
else
change = va ( " install %s \n " , p - > name ) ;
}
2017-07-31 17:15:37 +00:00
else if ( ( p - > flags & DPF_PURGE ) | | ! ( p - > qhash & & ( p - > flags & DPF_PRESENT ) ) )
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
change = va ( " uninstall %s \n " , p - > name ) ;
else
change = va ( " disable %s \n " , p - > name ) ;
l = strlen ( change ) ;
if ( ofs + l > = outsize )
{
Q_strncpyz ( out , " Too many changes \n " , outsize ) ;
out = NULL ;
break ;
}
else
{
memcpy ( out + ofs , change , l ) ;
ofs + = l ;
out [ ofs ] = 0 ;
}
}
}
return changes ;
}
# endif
2016-11-20 20:52:41 +00:00
static void PM_PrintChanges ( void )
{
qboolean changes = 0 ;
package_t * p ;
for ( p = availablepackages ; p ; p = p - > next )
{
2017-01-24 10:27:39 +00:00
if ( ! ( p - > flags & DPF_MARKED ) ! = ! ( p - > flags & DPF_ENABLED ) | | ( p - > flags & DPF_PURGE ) )
2016-11-20 20:52:41 +00:00
{
changes + + ;
if ( p - > flags & DPF_MARKED )
{
if ( p - > flags & DPF_PURGE )
Con_Printf ( " reinstall %s \n " , p - > name ) ;
else
Con_Printf ( " install %s \n " , p - > name ) ;
}
else if ( ( p - > flags & DPF_PURGE ) | | ! ( p - > qhash & & ( p - > flags & DPF_CACHED ) ) )
Con_Printf ( " uninstall %s \n " , p - > name ) ;
else
Con_Printf ( " disable %s \n " , p - > name ) ;
}
}
if ( ! changes )
Con_Printf ( " <no changes> \n " ) ;
else
Con_Printf ( " <%i package(s) changed> \n " , changes ) ;
}
2018-08-04 07:05:20 +00:00
# ifdef WEBCLIENT
2016-08-25 00:12:14 +00:00
static void PM_ListDownloaded ( struct dl_download * dl )
{
int i ;
vfsfile_t * f ;
f = dl - > file ;
dl - > file = NULL ;
i = dl - > user_num ;
if ( dl ! = downloadablelist [ i ] . curdl )
{
//this request looks stale.
VFS_CLOSE ( f ) ;
return ;
}
downloadablelist [ i ] . curdl = NULL ;
if ( f )
{
downloadablelist [ i ] . received = 1 ;
PM_ParsePackageList ( f , 0 , dl - > url , downloadablelist [ i ] . prefix ) ;
VFS_CLOSE ( f ) ;
}
else
downloadablelist [ i ] . received = - 1 ;
2016-11-25 08:14:54 +00:00
if ( ! doautoupdate & & ! domanifestinstall )
2016-08-25 00:12:14 +00:00
return ; //don't spam this.
for ( i = 0 ; i < numdownloadablelists ; i + + )
{
if ( ! downloadablelist [ i ] . received )
break ;
}
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
/*
if ( domanifestinstall = = MANIFEST_SECURITY_INSTALLER & & manifestpackages )
2016-11-25 08:14:54 +00:00
{
package_t * meta ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
meta = PM_MarkedPackage ( manifestpackages ) ;
2016-11-25 08:14:54 +00:00
if ( ! meta )
{
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
meta = PM_FindPackage ( manifestpackages ) ;
2017-03-04 19:36:06 +00:00
if ( meta )
{
PM_RevertChanges ( ) ;
PM_MarkPackage ( meta ) ;
PM_ApplyChanges ( ) ;
2016-11-25 08:14:54 +00:00
# ifdef DOWNLOADMENU
2017-03-04 19:36:06 +00:00
if ( ! isDedicated )
2016-11-25 08:14:54 +00:00
{
2017-03-04 19:36:06 +00:00
if ( Key_Dest_Has ( kdm_emenu ) )
{
Key_Dest_Remove ( kdm_emenu ) ;
}
2016-11-25 08:14:54 +00:00
# ifdef MENU_DAT
2017-03-04 19:36:06 +00:00
if ( Key_Dest_Has ( kdm_gmenu ) )
MP_Toggle ( 0 ) ;
2016-11-25 08:14:54 +00:00
# endif
2017-03-04 19:36:06 +00:00
Cmd_ExecuteString ( " menu_download \n " , RESTRICT_LOCAL ) ;
}
2016-11-25 08:14:54 +00:00
# endif
2017-03-04 19:36:06 +00:00
return ;
}
2016-11-25 08:14:54 +00:00
}
}
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
*/
2017-03-04 19:36:06 +00:00
if ( ( doautoupdate | | domanifestinstall = = MANIFEST_SECURITY_DEFAULT ) & & i = = numdownloadablelists )
2016-08-25 00:12:14 +00:00
{
if ( PM_MarkUpdates ( ) )
{
2016-11-20 20:52:41 +00:00
# ifdef DOWNLOADMENU
if ( ! isDedicated )
2016-08-25 00:12:14 +00:00
{
2016-11-20 20:52:41 +00:00
if ( Key_Dest_Has ( kdm_emenu ) )
Key_Dest_Remove ( kdm_emenu ) ;
2016-08-25 00:12:14 +00:00
# ifdef MENU_DAT
2016-11-20 20:52:41 +00:00
if ( Key_Dest_Has ( kdm_gmenu ) )
MP_Toggle ( 0 ) ;
# endif
Cmd_ExecuteString ( " menu_download \n " , RESTRICT_LOCAL ) ;
}
else
2016-08-25 00:12:14 +00:00
# endif
2016-11-20 20:52:41 +00:00
PM_PrintChanges ( ) ;
2016-08-25 00:12:14 +00:00
}
}
}
2018-08-04 07:05:20 +00:00
# endif
2016-08-25 00:12:14 +00:00
//retry 1==
static void PM_UpdatePackageList ( qboolean autoupdate , int retry )
{
unsigned int i ;
2019-06-17 04:21:41 +00:00
if ( retry > 1 | | pkg_downloads_url . modified )
2016-08-25 00:12:14 +00:00
PM_Shutdown ( ) ;
PM_PreparePackageList ( ) ;
//make sure our sources are okay.
2019-06-17 04:21:41 +00:00
if ( * pkg_downloads_url . string )
PM_AddSubList ( pkg_downloads_url . string , " " , false , true ) ;
2016-08-25 00:12:14 +00:00
2018-08-04 07:05:20 +00:00
# ifndef WEBCLIENT
for ( i = 0 ; i < numdownloadablelists ; i + + )
downloadablelist [ i ] . received = true ;
# else
2016-08-25 00:12:14 +00:00
doautoupdate | = autoupdate ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
//kick off the initial tier of list-downloads.
2016-08-25 00:12:14 +00:00
for ( i = 0 ; i < numdownloadablelists ; i + + )
{
if ( downloadablelist [ i ] . received )
continue ;
autoupdate = false ;
if ( downloadablelist [ i ] . curdl )
continue ;
2017-01-24 10:27:39 +00:00
downloadablelist [ i ] . curdl = HTTP_CL_Get ( va ( " %s%s " DOWNLOADABLESARGS , downloadablelist [ i ] . url , strchr ( downloadablelist [ i ] . url , ' ? ' ) ? " & " : " ? " ) , NULL , PM_ListDownloaded ) ;
2016-08-25 00:12:14 +00:00
if ( downloadablelist [ i ] . curdl )
{
downloadablelist [ i ] . curdl - > user_num = i ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
downloadablelist [ i ] . curdl - > file = VFSPIPE_Open ( 1 , false ) ;
2016-08-25 00:12:14 +00:00
downloadablelist [ i ] . curdl - > isquery = true ;
DL_CreateThread ( downloadablelist [ i ] . curdl , NULL , NULL ) ;
}
else
{
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
Con_Printf ( " Could not contact updates server - %s \n " , downloadablelist [ i ] . url ) ;
2016-08-25 00:12:14 +00:00
downloadablelist [ i ] . received = - 1 ;
}
}
if ( autoupdate )
{
doautoupdate = 0 ;
if ( PM_MarkUpdates ( ) )
{
2016-11-20 20:52:41 +00:00
# ifdef DOWNLOADMENU
if ( ! isDedicated )
Cbuf_AddText ( " menu_download \n " , RESTRICT_LOCAL ) ;
else
# endif
PM_PrintChanges ( ) ;
2016-08-25 00:12:14 +00:00
}
}
2018-08-04 07:05:20 +00:00
# endif
2016-08-25 00:12:14 +00:00
}
static void COM_QuotedConcat ( const char * cat , char * buf , size_t bufsize )
{
const unsigned char * gah ;
for ( gah = ( const unsigned char * ) cat ; * gah ; gah + + )
{
if ( * gah < = ' ' | | * gah = = ' $ ' | | * gah = = ' \" ' | | * gah = = ' \n ' | | * gah = = ' \r ' )
break ;
}
if ( * gah | | * cat = = ' \\ ' | |
strstr ( cat , " // " ) | | strstr ( cat , " /* " ) )
{ //contains some dodgy stuff.
size_t curlen = strlen ( buf ) ;
buf + = curlen ;
bufsize - = curlen ;
COM_QuotedString ( cat , buf , bufsize , false ) ;
}
else
{ //okay, no need for quotes.
Q_strncatz ( buf , cat , bufsize ) ;
}
}
static void PM_WriteInstalledPackages ( void )
{
2019-03-23 07:06:37 +00:00
char buf [ 65536 ] ;
2016-11-20 20:52:41 +00:00
int i ;
2016-08-25 00:12:14 +00:00
char * s ;
package_t * p , * e = NULL ;
struct packagedep_s * dep , * ef = NULL ;
vfsfile_t * f = FS_OpenVFS ( INSTALLEDFILES , " wb " , FS_ROOT ) ;
if ( ! f )
{
2019-06-17 04:21:41 +00:00
Con_Printf ( " package manager: Can't update installed list \n " ) ;
2016-08-25 00:12:14 +00:00
return ;
}
s = " version 2 \n " ;
VFS_WRITE ( f , s , strlen ( s ) ) ;
2016-11-20 20:52:41 +00:00
2019-06-17 04:21:41 +00:00
s = va ( " set updatemode %s \n " , COM_QuotedString ( pkg_autoupdate . string , buf , sizeof ( buf ) , false ) ) ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
VFS_WRITE ( f , s , strlen ( s ) ) ;
s = va ( " set declined %s \n " , COM_QuotedString ( declinedpackages ? declinedpackages : " " , buf , sizeof ( buf ) , false ) ) ;
2017-01-24 10:27:39 +00:00
VFS_WRITE ( f , s , strlen ( s ) ) ;
2016-11-20 20:52:41 +00:00
for ( i = 0 ; i < numdownloadablelists ; i + + )
{
if ( downloadablelist [ i ] . save )
{
s = va ( " sublist \" %s \" \" %s \" \n " , downloadablelist [ i ] . url , downloadablelist [ i ] . prefix ) ;
VFS_WRITE ( f , s , strlen ( s ) ) ;
}
}
2016-08-25 00:12:14 +00:00
for ( p = availablepackages ; p ; p = p - > next )
{
2017-01-24 10:27:39 +00:00
if ( p - > flags & ( DPF_PRESENT | DPF_ENABLED ) )
2016-08-25 00:12:14 +00:00
{
buf [ 0 ] = 0 ;
2016-11-20 20:52:41 +00:00
COM_QuotedString ( va ( " %s%s " , p - > category , p - > name ) , buf , sizeof ( buf ) , false ) ;
2017-01-24 10:27:39 +00:00
if ( p - > flags & DPF_ENABLED )
2016-08-25 00:12:14 +00:00
{ //v3+
// Q_strncatz(buf, " ", sizeof(buf));
// COM_QuotedConcat(va("installed=1"), buf, sizeof(buf));
}
else
{ //v2
Q_strncatz ( buf , " " , sizeof ( buf ) ) ;
COM_QuotedConcat ( va ( " stale=1 " ) , buf , sizeof ( buf ) ) ;
}
2016-11-20 20:52:41 +00:00
if ( * p - > title & & strcmp ( p - > title , p - > name ) )
{
Q_strncatz ( buf , " " , sizeof ( buf ) ) ;
2019-05-23 15:11:32 +00:00
COM_QuotedConcat ( va ( " title=%s " , p - > title ) , buf , sizeof ( buf ) ) ;
2016-11-20 20:52:41 +00:00
}
2016-08-25 00:12:14 +00:00
if ( * p - > version )
{
Q_strncatz ( buf , " " , sizeof ( buf ) ) ;
COM_QuotedConcat ( va ( " ver=%s " , p - > version ) , buf , sizeof ( buf ) ) ;
}
//if (*p->gamedir)
{
Q_strncatz ( buf , " " , sizeof ( buf ) ) ;
COM_QuotedConcat ( va ( " gamedir=%s " , p - > gamedir ) , buf , sizeof ( buf ) ) ;
}
if ( p - > qhash )
{
Q_strncatz ( buf , " " , sizeof ( buf ) ) ;
COM_QuotedConcat ( va ( " qhash=%s " , p - > qhash ) , buf , sizeof ( buf ) ) ;
}
if ( p - > priority ! = PM_DEFAULTPRIORITY )
{
Q_strncatz ( buf , " " , sizeof ( buf ) ) ;
COM_QuotedConcat ( va ( " priority=%i " , p - > priority ) , buf , sizeof ( buf ) ) ;
}
if ( p - > arch )
{
Q_strncatz ( buf , " " , sizeof ( buf ) ) ;
COM_QuotedConcat ( va ( " arch=%s " , p - > arch ) , buf , sizeof ( buf ) ) ;
}
2019-01-15 14:12:49 +00:00
if ( p - > license )
2016-08-25 00:12:14 +00:00
{
Q_strncatz ( buf , " " , sizeof ( buf ) ) ;
2019-01-15 14:12:49 +00:00
COM_QuotedConcat ( va ( " license=%s " , p - > license ) , buf , sizeof ( buf ) ) ;
2016-08-25 00:12:14 +00:00
}
2019-01-15 14:12:49 +00:00
if ( p - > website )
2016-08-25 00:12:14 +00:00
{
Q_strncatz ( buf , " " , sizeof ( buf ) ) ;
2019-01-15 14:12:49 +00:00
COM_QuotedConcat ( va ( " website=%s " , p - > website ) , buf , sizeof ( buf ) ) ;
2016-08-25 00:12:14 +00:00
}
if ( p - > author )
{
Q_strncatz ( buf , " " , sizeof ( buf ) ) ;
COM_QuotedConcat ( va ( " author=%s " , p - > author ) , buf , sizeof ( buf ) ) ;
}
2019-01-15 14:12:49 +00:00
if ( p - > description )
{
Q_strncatz ( buf , " " , sizeof ( buf ) ) ;
COM_QuotedConcat ( va ( " desc=%s " , p - > description ) , buf , sizeof ( buf ) ) ;
}
2016-08-25 00:12:14 +00:00
if ( p - > previewimage )
{
Q_strncatz ( buf , " " , sizeof ( buf ) ) ;
COM_QuotedConcat ( va ( " preview=%s " , p - > previewimage ) , buf , sizeof ( buf ) ) ;
}
2017-04-18 11:12:17 +00:00
if ( p - > fsroot = = FS_BINARYPATH )
{
Q_strncatz ( buf , " " , sizeof ( buf ) ) ;
2017-04-18 13:47:02 +00:00
COM_QuotedConcat ( " root=bin " , buf , sizeof ( buf ) ) ;
2017-04-18 11:12:17 +00:00
}
2016-08-25 00:12:14 +00:00
for ( dep = p - > deps ; dep ; dep = dep - > next )
{
if ( dep - > dtype = = DEP_FILE )
2016-07-26 11:47:59 +00:00
{
2016-08-25 00:12:14 +00:00
Q_strncatz ( buf , " " , sizeof ( buf ) ) ;
COM_QuotedConcat ( va ( " file=%s " , dep - > name ) , buf , sizeof ( buf ) ) ;
2017-01-24 10:27:39 +00:00
if ( ( p - > flags & DPF_ENABLED ) & & ( p - > flags & DPF_ENGINE ) & & ( ! e | | strcmp ( e - > version , p - > version ) < 0 ) )
2016-07-26 11:47:59 +00:00
{
2016-08-25 00:12:14 +00:00
e = p ;
ef = dep ;
2016-07-26 11:47:59 +00:00
}
}
2016-08-25 00:12:14 +00:00
else if ( dep - > dtype = = DEP_REQUIRE )
{
Q_strncatz ( buf , " " , sizeof ( buf ) ) ;
COM_QuotedConcat ( va ( " depend=%s " , dep - > name ) , buf , sizeof ( buf ) ) ;
}
else if ( dep - > dtype = = DEP_CONFLICT )
{
Q_strncatz ( buf , " " , sizeof ( buf ) ) ;
COM_QuotedConcat ( va ( " conflict=%s " , dep - > name ) , buf , sizeof ( buf ) ) ;
}
else if ( dep - > dtype = = DEP_FILECONFLICT )
{
Q_strncatz ( buf , " " , sizeof ( buf ) ) ;
COM_QuotedConcat ( va ( " fileconflict=%s " , dep - > name ) , buf , sizeof ( buf ) ) ;
}
else if ( dep - > dtype = = DEP_RECOMMEND )
{
Q_strncatz ( buf , " " , sizeof ( buf ) ) ;
COM_QuotedConcat ( va ( " recommend=%s " , dep - > name ) , buf , sizeof ( buf ) ) ;
}
2016-07-21 19:36:34 +00:00
}
2016-08-25 00:12:14 +00:00
2017-01-24 10:27:39 +00:00
if ( p - > flags & DPF_TESTING )
{
Q_strncatz ( buf , " " , sizeof ( buf ) ) ;
COM_QuotedConcat ( " test=1 " , buf , sizeof ( buf ) ) ;
}
2019-01-13 16:51:50 +00:00
if ( ( p - > flags & DPF_AUTOMARKED ) & & ! ( p - > flags & DPF_USERMARKED ) )
{
Q_strncatz ( buf , " " , sizeof ( buf ) ) ;
COM_QuotedConcat ( " auto " , buf , sizeof ( buf ) ) ;
}
2016-08-25 00:12:14 +00:00
buf [ sizeof ( buf ) - 2 ] = 0 ; //just in case.
Q_strncatz ( buf , " \n " , sizeof ( buf ) ) ;
VFS_WRITE ( f , buf , strlen ( buf ) ) ;
2016-07-21 19:36:34 +00:00
}
}
2016-08-25 00:12:14 +00:00
VFS_CLOSE ( f ) ;
2016-07-21 19:36:34 +00:00
2016-08-25 00:12:14 +00:00
if ( ef )
2016-07-21 19:36:34 +00:00
{
2016-08-25 00:12:14 +00:00
char native [ MAX_OSPATH ] ;
FS_NativePath ( ef - > name , e - > fsroot , native , sizeof ( native ) ) ;
Sys_SetUpdatedBinary ( native ) ;
}
}
2018-08-04 07:05:20 +00:00
# ifdef WEBCLIENT
2016-11-20 20:52:41 +00:00
//callback from PM_Download_Got, extracts each file from an archive
static int QDECL PM_ExtractFiles ( const char * fname , qofs_t fsize , time_t mtime , void * parm , searchpathfuncs_t * spath )
{ //this is gonna suck. threading would help, but gah.
package_t * p = parm ;
flocation_t loc ;
if ( fname [ strlen ( fname ) - 1 ] = = ' / ' )
{ //directory.
}
else if ( spath - > FindFile ( spath , & loc , fname , NULL ) & & loc . len < 0x80000000u )
{
char * f = malloc ( loc . len ) ;
const char * n ;
if ( f )
{
spath - > ReadFile ( spath , & loc , f ) ;
if ( * p - > gamedir )
n = va ( " %s/%s " , p - > gamedir , fname ) ;
else
n = fname ;
if ( FS_WriteFile ( n , f , loc . len , p - > fsroot ) )
2017-01-24 10:27:39 +00:00
p - > flags | = DPF_NATIVE | DPF_ENABLED ;
2016-11-20 20:52:41 +00:00
free ( f ) ;
//keep track of the installed files, so we can delete them properly after.
PM_AddDep ( p , DEP_FILE , fname ) ;
}
}
return 1 ;
}
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
//package has been downloaded and installed, but some packages need to be enabled
//(plugins might have other dll dependancies, so this can only happen AFTER the entire package was extracted)
2017-04-18 11:12:17 +00:00
static void PM_PackageEnabled ( package_t * p )
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
{
char ext [ 8 ] ;
struct packagedep_s * dep ;
FS_FlushFSHashFull ( ) ;
for ( dep = p - > deps ; dep ; dep = dep - > next )
{
if ( dep - > dtype ! = DEP_FILE )
continue ;
COM_FileExtension ( dep - > name , ext , sizeof ( ext ) ) ;
if ( ! stricmp ( ext , " pak " ) | | ! stricmp ( ext , " pk3 " ) )
FS_ReloadPackFiles ( ) ;
# ifdef PLUGINS
if ( ( p - > flags & DPF_PLUGIN ) & & ! Q_strncasecmp ( dep - > name , " fteplug_ " , 8 ) )
Cmd_ExecuteString ( va ( " plug_load %s \n " , dep - > name ) , RESTRICT_LOCAL ) ;
# endif
# ifdef MENU_DAT
if ( ! Q_strcasecmp ( dep - > name , " menu.dat " ) )
Cmd_ExecuteString ( " menu_restart \n " , RESTRICT_LOCAL ) ;
# endif
}
}
2016-11-20 20:52:41 +00:00
static void PM_StartADownload ( void ) ;
//callback from PM_StartADownload
static void PM_Download_Got ( struct dl_download * dl )
2016-08-25 00:12:14 +00:00
{
2017-01-24 10:27:39 +00:00
char native [ MAX_OSPATH ] ;
2016-11-20 20:52:41 +00:00
qboolean successful = dl - > status = = DL_FINISHED ;
2016-08-25 00:12:14 +00:00
package_t * p ;
2016-11-20 20:52:41 +00:00
char * tempname = dl - > user_ctx ;
for ( p = availablepackages ; p ; p = p - > next )
{
if ( p - > download = = dl )
break ;
}
if ( dl - > file )
{
VFS_CLOSE ( dl - > file ) ;
dl - > file = NULL ;
}
2016-08-25 00:12:14 +00:00
if ( p )
{
2016-11-20 20:52:41 +00:00
char ext [ 8 ] ;
char * destname ;
struct packagedep_s * dep ;
p - > download = NULL ;
2016-08-25 00:12:14 +00:00
2016-11-20 20:52:41 +00:00
if ( ! successful )
2016-07-21 19:36:34 +00:00
{
2016-11-20 20:52:41 +00:00
Con_Printf ( " Couldn't download %s (from %s) \n " , p - > name , dl - > url ) ;
FS_Remove ( tempname , p - > fsroot ) ;
Z_Free ( tempname ) ;
PM_StartADownload ( ) ;
return ;
}
if ( p - > extract = = EXTRACT_ZIP )
{
2018-11-27 16:48:19 +00:00
# ifdef PACKAGE_PK3
2016-11-20 20:52:41 +00:00
vfsfile_t * f = FS_OpenVFS ( tempname , " rb " , p - > fsroot ) ;
if ( f )
2016-07-21 19:36:34 +00:00
{
2018-03-04 14:41:16 +00:00
searchpathfuncs_t * archive = FSZIP_LoadArchive ( f , NULL , tempname , tempname , NULL ) ;
2016-11-20 20:52:41 +00:00
if ( archive )
2016-08-25 00:12:14 +00:00
{
2017-01-24 10:27:39 +00:00
p - > flags & = ~ ( DPF_NATIVE | DPF_CACHED | DPF_CORRUPT | DPF_ENABLED ) ;
2016-11-20 20:52:41 +00:00
archive - > EnumerateFiles ( archive , " * " , PM_ExtractFiles , p ) ;
archive - > EnumerateFiles ( archive , " */* " , PM_ExtractFiles , p ) ;
archive - > EnumerateFiles ( archive , " */*/* " , PM_ExtractFiles , p ) ;
archive - > EnumerateFiles ( archive , " */*/*/* " , PM_ExtractFiles , p ) ;
archive - > EnumerateFiles ( archive , " */*/*/*/* " , PM_ExtractFiles , p ) ;
archive - > EnumerateFiles ( archive , " */*/*/*/*/* " , PM_ExtractFiles , p ) ;
archive - > EnumerateFiles ( archive , " */*/*/*/*/*/* " , PM_ExtractFiles , p ) ;
archive - > EnumerateFiles ( archive , " */*/*/*/*/*/*/* " , PM_ExtractFiles , p ) ;
archive - > EnumerateFiles ( archive , " */*/*/*/*/*/*/*/* " , PM_ExtractFiles , p ) ;
archive - > ClosePath ( archive ) ;
PM_WriteInstalledPackages ( ) ;
// if (!stricmp(ext, "pak") || !stricmp(ext, "pk3"))
// FS_ReloadPackFiles();
2016-08-25 00:12:14 +00:00
}
else
2016-11-20 20:52:41 +00:00
VFS_CLOSE ( f ) ;
}
PM_ValidatePackage ( p ) ;
2018-11-27 16:48:19 +00:00
# else
Con_Printf ( " zip format not supported in this build - %s (from %s) \n " , p - > name , dl - > url ) ;
# endif
2016-11-20 20:52:41 +00:00
FS_Remove ( tempname , p - > fsroot ) ;
Z_Free ( tempname ) ;
PM_StartADownload ( ) ;
return ;
}
else
{
for ( dep = p - > deps ; dep ; dep = dep - > next )
{
unsigned int nfl ;
if ( dep - > dtype ! = DEP_FILE )
continue ;
COM_FileExtension ( dep - > name , ext , sizeof ( ext ) ) ;
if ( ! stricmp ( ext , " pak " ) | | ! stricmp ( ext , " pk3 " ) )
FS_UnloadPackFiles ( ) ; //we reload them after
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
# ifdef PLUGINS
2016-11-20 20:52:41 +00:00
if ( ( ! stricmp ( ext , " dll " ) | | ! stricmp ( ext , " so " ) ) & & ! Q_strncmp ( dep - > name , " fteplug_ " , 8 ) )
Cmd_ExecuteString ( va ( " plug_close %s \n " , dep - > name ) , RESTRICT_LOCAL ) ; //try to purge plugins so there's no files left open
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
# endif
2016-11-20 20:52:41 +00:00
nfl = DPF_NATIVE ;
if ( * p - > gamedir )
{
char temp [ MAX_OSPATH ] ;
destname = va ( " %s/%s " , p - > gamedir , dep - > name ) ;
if ( p - > qhash & & FS_GenCachedPakName ( destname , p - > qhash , temp , sizeof ( temp ) ) )
{
nfl = DPF_CACHED ;
destname = va ( " %s " , temp ) ;
}
}
2016-08-25 00:12:14 +00:00
else
2016-11-20 20:52:41 +00:00
destname = dep - > name ;
2017-01-24 10:27:39 +00:00
nfl | = DPF_ENABLED | ( p - > flags & ~ ( DPF_CACHED | DPF_NATIVE | DPF_CORRUPT ) ) ;
2016-11-20 20:52:41 +00:00
FS_CreatePath ( destname , p - > fsroot ) ;
if ( FS_Remove ( destname , p - > fsroot ) )
;
if ( ! FS_Rename2 ( tempname , destname , p - > fsroot , p - > fsroot ) )
2016-08-25 00:12:14 +00:00
{
2016-11-20 20:52:41 +00:00
//error!
2017-01-24 10:27:39 +00:00
if ( ! FS_NativePath ( destname , p - > fsroot , native , sizeof ( native ) ) )
Q_strncpyz ( native , destname , sizeof ( native ) ) ;
Con_Printf ( " Couldn't rename %s to %s. Removed instead. \n " , tempname , native ) ;
2016-11-20 20:52:41 +00:00
FS_Remove ( tempname , p - > fsroot ) ;
}
else
{ //success!
2017-01-24 10:27:39 +00:00
if ( ! FS_NativePath ( destname , p - > fsroot , native , sizeof ( native ) ) )
Q_strncpyz ( native , destname , sizeof ( native ) ) ;
Con_Printf ( " Downloaded %s (to %s) \n " , p - > name , native ) ;
2016-11-20 20:52:41 +00:00
p - > flags = nfl ;
PM_WriteInstalledPackages ( ) ;
2016-08-25 00:12:14 +00:00
}
2016-07-21 19:36:34 +00:00
2016-11-20 20:52:41 +00:00
PM_ValidatePackage ( p ) ;
2016-08-25 00:12:14 +00:00
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
PM_PackageEnabled ( p ) ;
2016-11-20 20:52:41 +00:00
Z_Free ( tempname ) ;
PM_StartADownload ( ) ;
return ;
}
}
Con_Printf ( " menu_download: %s has no filename info \n " , p - > name ) ;
2016-07-21 19:36:34 +00:00
}
2016-11-20 20:52:41 +00:00
else
Con_Printf ( " menu_download: Can't figure out where %s came from (url: %s) \n " , dl - > localname , dl - > url ) ;
2016-08-25 00:12:14 +00:00
2016-11-20 20:52:41 +00:00
FS_Remove ( tempname , FS_GAMEONLY ) ;
Z_Free ( tempname ) ;
PM_StartADownload ( ) ;
2006-01-28 06:41:20 +00:00
}
2016-11-20 20:52:41 +00:00
static char * PM_GetTempName ( package_t * p )
2016-07-26 11:47:59 +00:00
{
2016-08-25 00:12:14 +00:00
struct packagedep_s * dep , * fdep ;
2016-07-26 11:47:59 +00:00
char * destname , * t , * ts ;
2016-08-25 00:12:14 +00:00
//always favour the file so that we can rename safely without needing a copy.
for ( dep = p - > deps , fdep = NULL ; dep ; dep = dep - > next )
2016-07-26 11:47:59 +00:00
{
if ( dep - > dtype ! = DEP_FILE )
continue ;
2016-08-25 00:12:14 +00:00
if ( fdep )
{
fdep = NULL ;
break ;
}
fdep = dep ;
}
if ( fdep )
{
2016-07-26 11:47:59 +00:00
if ( * p - > gamedir )
2016-08-25 00:12:14 +00:00
destname = va ( " %s/%s.tmp " , p - > gamedir , fdep - > name ) ;
2016-07-26 11:47:59 +00:00
else
2016-08-25 00:12:14 +00:00
destname = va ( " %s.tmp " , fdep - > name ) ;
2016-07-26 11:47:59 +00:00
return Z_StrDup ( destname ) ;
}
ts = Z_StrDup ( p - > name ) ;
for ( t = ts ; * t ; t + + )
{
switch ( * t )
{
case ' / ' :
case ' ? ' :
case ' < ' :
case ' > ' :
case ' \\ ' :
case ' : ' :
case ' * ' :
case ' | ' :
case ' \" ' :
case ' . ' :
* t = ' _ ' ;
break ;
default :
break ;
}
}
if ( * ts )
{
if ( * p - > gamedir )
destname = va ( " %s/%s.tmp " , p - > gamedir , ts ) ;
else
destname = va ( " %s.tmp " , ts ) ;
}
else
destname = va ( " %x.tmp " , ( unsigned int ) ( quintptr_t ) p ) ;
Z_Free ( ts ) ;
return Z_StrDup ( destname ) ;
}
2018-08-04 07:05:20 +00:00
# endif
2016-07-26 11:47:59 +00:00
2016-12-07 18:45:25 +00:00
/*static void PM_AddDownloadedPackage(const char *filename)
2016-07-21 19:36:34 +00:00
{
2016-11-25 08:14:54 +00:00
char pathname [ 1024 ] ;
2016-07-21 19:36:34 +00:00
package_t * p ;
2016-11-25 08:14:54 +00:00
Q_snprintfz ( pathname , sizeof ( pathname ) , " %s/%s " , " Cached " , filename ) ;
p - > name = Z_StrDup ( COM_SkipPath ( pathname ) ) ;
* COM_SkipPath ( pathname ) = 0 ;
p - > category = Z_StrDup ( pathname ) ;
Q_strncpyz ( p - > version , " " , sizeof ( p - > version ) ) ;
Q_snprintfz ( p - > gamedir , sizeof ( p - > gamedir ) , " %s " , " " ) ;
p - > fsroot = FS_ROOT ;
p - > extract = EXTRACT_COPY ;
p - > priority = 0 ;
p - > flags = DPF_INSTALLED ;
p - > title = Z_StrDup ( p - > name ) ;
p - > arch = NULL ;
p - > qhash = NULL ; //FIXME
p - > description = NULL ;
p - > license = NULL ;
p - > author = NULL ;
p - > previewimage = NULL ;
2016-12-07 18:45:25 +00:00
} */
2016-07-21 19:36:34 +00:00
2017-03-04 19:36:06 +00:00
int PM_IsApplying ( qboolean listsonly )
2016-11-25 08:14:54 +00:00
{
int count = 0 ;
2018-08-04 07:05:20 +00:00
# ifdef WEBCLIENT
package_t * p ;
2016-11-25 08:14:54 +00:00
int i ;
2017-03-04 19:36:06 +00:00
if ( ! listsonly )
2016-07-21 19:36:34 +00:00
{
2017-03-04 19:36:06 +00:00
for ( p = availablepackages ; p ; p = p - > next )
{
if ( p - > download )
count + + ;
}
2016-11-25 08:14:54 +00:00
}
for ( i = 0 ; i < numdownloadablelists ; i + + )
{
if ( downloadablelist [ i ] . curdl )
count + + ;
2016-07-21 19:36:34 +00:00
}
2018-08-04 07:05:20 +00:00
# endif
2016-11-25 08:14:54 +00:00
return count ;
}
2016-07-21 19:36:34 +00:00
2016-11-25 08:14:54 +00:00
//looks for the next package that needs downloading, and grabs it
static void PM_StartADownload ( void )
{
2018-08-04 07:05:20 +00:00
# ifdef WEBCLIENT
2016-11-25 08:14:54 +00:00
vfsfile_t * tmpfile ;
char * temp ;
package_t * p ;
2017-03-04 19:36:06 +00:00
const int simultaneous = PM_IsApplying ( true ) ? 1 : 2 ;
2016-11-25 08:14:54 +00:00
int i ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
qboolean downloading = false ;
2016-11-25 08:14:54 +00:00
2017-03-04 19:36:06 +00:00
for ( p = availablepackages ; p & & simultaneous > PM_IsApplying ( false ) ; p = p - > next )
2016-07-21 19:36:34 +00:00
{
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
if ( p - > download )
downloading = true ;
2016-07-21 19:36:34 +00:00
if ( p - > trymirrors )
{ //flagged for a (re?)download
char * mirror = NULL ;
for ( i = 0 ; i < countof ( p - > mirror ) ; i + + )
{
if ( p - > mirror [ i ] & & ( p - > trymirrors & ( 1u < < i ) ) )
{
mirror = p - > mirror [ i ] ;
p - > trymirrors & = ~ ( 1u < < i ) ;
break ;
}
}
if ( ! mirror )
{ //erk...
p - > trymirrors = 0 ;
2016-08-25 00:12:14 +00:00
for ( i = 0 ; i < countof ( p - > mirror ) ; i + + )
if ( p - > mirror [ i ] )
break ;
if ( i = = countof ( p - > mirror ) )
{ //this appears to be a meta package with no download
//just directly install it.
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
//FIXME: make sure there's no files...
2016-08-25 00:12:14 +00:00
p - > flags & = ~ ( DPF_NATIVE | DPF_CACHED | DPF_CORRUPT ) ;
2017-01-24 10:27:39 +00:00
p - > flags | = DPF_ENABLED ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
Con_Printf ( " Enabled meta package %s \n " , p - > name ) ;
2016-08-25 00:12:14 +00:00
PM_WriteInstalledPackages ( ) ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
PM_PackageEnabled ( p ) ;
2016-08-25 00:12:14 +00:00
}
continue ;
}
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
if ( ( p - > flags & DPF_PRESENT ) & & ! PM_PurgeOnDisable ( p ) )
2016-08-25 00:12:14 +00:00
{ //its in our cache directory, so lets just use that
p - > trymirrors = 0 ;
2017-01-24 10:27:39 +00:00
p - > flags | = DPF_ENABLED ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
Con_Printf ( " Enabled cached package %s \n " , p - > name ) ;
2016-08-25 00:12:14 +00:00
PM_WriteInstalledPackages ( ) ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
PM_PackageEnabled ( p ) ;
2016-07-21 19:36:34 +00:00
continue ;
}
2016-08-25 00:12:14 +00:00
2016-11-20 20:52:41 +00:00
temp = PM_GetTempName ( p ) ;
2016-07-21 19:36:34 +00:00
//FIXME: we should lock in the temp path, in case the user foolishly tries to change gamedirs.
FS_CreatePath ( temp , p - > fsroot ) ;
switch ( p - > extract )
{
2016-07-26 11:47:59 +00:00
case EXTRACT_ZIP :
case EXTRACT_COPY :
2016-07-21 19:36:34 +00:00
tmpfile = FS_OpenVFS ( temp , " wb " , p - > fsroot ) ;
break ;
# ifdef AVAIL_XZDEC
2016-07-26 11:47:59 +00:00
case EXTRACT_XZ :
2016-07-21 19:36:34 +00:00
{
vfsfile_t * raw ;
raw = FS_OpenVFS ( temp , " wb " , p - > fsroot ) ;
tmpfile = FS_XZ_DecompressWriteFilter ( raw ) ;
if ( ! tmpfile )
VFS_CLOSE ( raw ) ;
}
break ;
# endif
# ifdef AVAIL_GZDEC
2016-07-26 11:47:59 +00:00
case EXTRACT_GZ :
2016-07-21 19:36:34 +00:00
{
vfsfile_t * raw ;
raw = FS_OpenVFS ( temp , " wb " , p - > fsroot ) ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
tmpfile = FS_GZ_WriteFilter ( raw , true , false ) ;
2016-07-21 19:36:34 +00:00
if ( ! tmpfile )
VFS_CLOSE ( raw ) ;
}
break ;
# endif
default :
Con_Printf ( " decompression method not supported \n " ) ;
continue ;
}
if ( tmpfile )
2018-11-19 06:37:25 +00:00
{
2016-11-20 20:52:41 +00:00
p - > download = HTTP_CL_Get ( mirror , NULL , PM_Download_Got ) ;
2018-11-19 06:37:25 +00:00
if ( ! p - > download )
Con_Printf ( " Unable to download %s \n " , p - > name ) ;
}
else
{
char syspath [ MAX_OSPATH ] ;
FS_NativePath ( temp , p - > fsroot , syspath , sizeof ( syspath ) ) ;
Con_Printf ( " Unable to write %s. Fix permissions before trying to download %s \n " , syspath , p - > name ) ;
}
2016-07-21 19:36:34 +00:00
if ( p - > download )
{
2016-11-20 20:52:41 +00:00
Con_Printf ( " Downloading %s \n " , p - > name ) ;
2016-07-21 19:36:34 +00:00
p - > download - > file = tmpfile ;
2016-07-26 11:47:59 +00:00
p - > download - > user_ctx = temp ;
2016-07-21 19:36:34 +00:00
DL_CreateThread ( p - > download , NULL , NULL ) ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
downloading = true ;
2016-07-21 19:36:34 +00:00
}
else
{
2016-08-25 00:12:14 +00:00
p - > flags & = ~ DPF_MARKED ; //can't do it.
2016-07-21 19:36:34 +00:00
if ( tmpfile )
VFS_CLOSE ( tmpfile ) ;
FS_Remove ( temp , p - > fsroot ) ;
}
}
}
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
//clear the updating flag once there's no more activity needed
pkg_updating = downloading ;
2018-08-04 07:05:20 +00:00
# endif
2016-07-21 19:36:34 +00:00
}
2016-11-20 20:52:41 +00:00
//'just' starts doing all the things needed to remove/install selected packages
2019-03-23 07:06:37 +00:00
void PM_ApplyChanges ( void )
2006-01-28 06:41:20 +00:00
{
2016-11-20 20:52:41 +00:00
package_t * p , * * link ;
2017-07-31 17:15:37 +00:00
char temp [ MAX_OSPATH ] ;
2016-07-21 19:36:34 +00:00
2018-08-04 07:05:20 +00:00
# ifdef WEBCLIENT
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
if ( pkg_updating )
return ;
pkg_updating = true ;
2018-08-04 07:05:20 +00:00
# endif
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
2016-11-20 20:52:41 +00:00
//delete any that don't exist
for ( link = & availablepackages ; * link ; )
{
p = * link ;
2018-08-04 07:05:20 +00:00
# ifdef WEBCLIENT
2016-11-25 08:14:54 +00:00
if ( p - > download )
; //erk, dude, don't do two!
2018-08-04 07:05:20 +00:00
else
# endif
if ( ( p - > flags & DPF_PURGE ) | | ( ! ( p - > flags & DPF_MARKED ) & & ( p - > flags & DPF_ENABLED ) ) )
2017-01-24 10:27:39 +00:00
{ //if we don't want it but we have it anyway. don't bother to follow this logic when reinstalling
2016-11-20 20:52:41 +00:00
qboolean reloadpacks = false ;
struct packagedep_s * dep ;
2017-01-24 10:27:39 +00:00
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
for ( dep = p - > deps ; dep ; dep = dep - > next )
{
if ( dep - > dtype = = DEP_FILE )
{
char ext [ 8 ] ;
COM_FileExtension ( dep - > name , ext , sizeof ( ext ) ) ;
if ( ! stricmp ( ext , " pak " ) | | ! stricmp ( ext , " pk3 " ) )
reloadpacks = true ;
# ifdef PLUGINS //when disabling/purging plugins, be sure to unload them first (unfortunately there might be some latency before this can actually happen).
if ( ( p - > flags & DPF_PLUGIN ) & & ! Q_strncasecmp ( dep - > name , " fteplug_ " , 8 ) )
Cmd_ExecuteString ( va ( " plug_close %s \n " , dep - > name ) , RESTRICT_LOCAL ) ; //try to purge plugins so there's no files left open
# endif
}
}
if ( reloadpacks ) //okay, some package was removed, unload all, do the deletions/disables, then reload them. This is kinda shit. Would be better to remove individual packages, which would avoid unnecessary config execs.
FS_UnloadPackFiles ( ) ;
2017-01-24 10:27:39 +00:00
if ( ( p - > flags & DPF_PURGE ) | | PM_PurgeOnDisable ( p ) )
2016-11-20 20:52:41 +00:00
{
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
Con_Printf ( " Purging package %s \n " , p - > name ) ;
2017-01-24 10:27:39 +00:00
for ( dep = p - > deps ; dep ; dep = dep - > next )
2006-01-28 06:41:20 +00:00
{
2017-01-24 10:27:39 +00:00
if ( dep - > dtype = = DEP_FILE )
2016-07-26 11:47:59 +00:00
{
2017-01-24 10:27:39 +00:00
if ( * p - > gamedir )
2016-08-25 00:12:14 +00:00
{
2017-01-24 10:27:39 +00:00
char * f = va ( " %s/%s " , p - > gamedir , dep - > name ) ;
if ( p - > qhash & & FS_GenCachedPakName ( f , p - > qhash , temp , sizeof ( temp ) ) & & PM_CheckFile ( temp , p - > fsroot ) )
{
if ( ! FS_Remove ( temp , p - > fsroot ) )
p - > flags | = DPF_CACHED ;
}
else if ( ! FS_Remove ( va ( " %s/%s " , p - > gamedir , dep - > name ) , p - > fsroot ) )
p - > flags | = DPF_NATIVE ;
2016-08-25 00:12:14 +00:00
}
2017-01-24 10:27:39 +00:00
else if ( ! FS_Remove ( dep - > name , p - > fsroot ) )
p - > flags | = DPF_NATIVE ;
2016-07-26 11:47:59 +00:00
}
2016-07-21 19:36:34 +00:00
}
2016-11-20 20:52:41 +00:00
}
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
else
2017-07-31 17:15:37 +00:00
{
for ( dep = p - > deps ; dep ; dep = dep - > next )
{
if ( dep - > dtype = = DEP_FILE )
{
if ( * p - > gamedir )
{
char * f = va ( " %s/%s " , p - > gamedir , dep - > name ) ;
if ( ( p - > flags & DPF_NATIVE ) & & p - > qhash & & FS_GenCachedPakName ( f , p - > qhash , temp , sizeof ( temp ) ) )
FS_Rename ( f , temp , p - > fsroot ) ;
}
}
}
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
Con_Printf ( " Disabling package %s \n " , p - > name ) ;
2017-07-31 17:15:37 +00:00
}
2017-01-24 10:27:39 +00:00
p - > flags & = ~ ( DPF_PURGE | DPF_ENABLED ) ;
/* FIXME: windows bug:
* * deleting an exe might ' succeed ' but leave the file on disk for a while anyway .
* * the file will eventually disappear , but until then we ' ll still see it as present ,
* * be unable to delete it again , and trying to open it to see if it still exists
* * will fail .
* * there ' s nothing we can do other than wait until whatever part of
* * windows that ' s fucking up releases its handles .
* * thankfully this only affects reinstalling exes / engines .
*/
2006-01-28 06:41:20 +00:00
2016-11-20 20:52:41 +00:00
PM_ValidatePackage ( p ) ;
PM_WriteInstalledPackages ( ) ;
2016-07-26 11:47:59 +00:00
2016-11-20 20:52:41 +00:00
if ( reloadpacks )
FS_ReloadPackFiles ( ) ;
2006-01-28 06:41:20 +00:00
2017-04-18 11:12:17 +00:00
if ( ( p - > flags & DPF_FORGETONUNINSTALL ) & & ! ( p - > flags & DPF_PRESENT ) )
2016-11-20 20:52:41 +00:00
{
2017-04-18 11:12:17 +00:00
# if 1
downloadablessequence + + ;
PM_FreePackage ( p ) ;
# else
2016-11-20 20:52:41 +00:00
if ( p - > alternative )
{ //replace it with its alternative package
* p - > link = p - > alternative ;
p - > alternative - > alternative = p - > alternative - > next ;
if ( p - > alternative - > alternative )
p - > alternative - > alternative - > link = & p - > alternative - > alternative ;
p - > alternative - > next = p - > next ;
}
else
{ //just remove it from the list.
* p - > link = p - > next ;
if ( p - > next )
p - > next - > link = p - > link ;
}
2016-07-26 11:47:59 +00:00
2016-08-25 00:12:14 +00:00
//FIXME: the menu(s) hold references to packages, so its not safe to purge them
2016-11-20 20:52:41 +00:00
p - > flags | = DPF_HIDDEN ;
2016-07-26 11:47:59 +00:00
// BZ_Free(p);
2017-04-18 11:12:17 +00:00
# endif
2006-01-28 06:41:20 +00:00
2016-11-20 20:52:41 +00:00
continue ;
2006-01-28 06:41:20 +00:00
}
}
2016-11-20 20:52:41 +00:00
link = & ( * link ) - > next ;
2006-01-28 06:41:20 +00:00
}
2018-08-04 07:05:20 +00:00
# ifdef WEBCLIENT
2016-11-20 20:52:41 +00:00
//and flag any new/updated ones for a download
for ( p = availablepackages ; p ; p = p - > next )
2016-08-25 00:12:14 +00:00
{
2017-01-24 10:27:39 +00:00
if ( ( p - > flags & DPF_MARKED ) & & ! ( p - > flags & DPF_ENABLED ) & & ! p - > download )
2016-11-20 20:52:41 +00:00
p - > trymirrors = ~ 0u ;
2016-08-25 00:12:14 +00:00
}
2018-08-04 07:05:20 +00:00
# endif
2016-11-20 20:52:41 +00:00
PM_StartADownload ( ) ; //and try to do those downloads.
2016-08-25 00:12:14 +00:00
}
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
# if defined(M_Menu_Prompt) || defined(SERVERONLY)
//if M_Menu_Prompt is a define, then its a stub...
static void PM_PromptApplyChanges ( void )
{
PM_ApplyChanges ( ) ;
}
# else
static qboolean PM_DeclinedPackages ( char * out , size_t outsize )
{
size_t ofs = 0 ;
package_t * p ;
qboolean ret = false ;
if ( manifestpackages )
{
char tok [ 1024 ] ;
char * strings = manifestpackages ;
while ( strings & & * strings )
{
strings = COM_ParseStringSetSep ( strings , ' ; ' , tok , sizeof ( tok ) ) ;
//already in the list
if ( PM_NameIsInStrings ( declinedpackages , tok ) )
continue ;
2019-03-23 07:06:37 +00:00
p = PM_MarkedPackage ( tok , DPF_MARKED ) ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
if ( p ) //don't mark it as declined if it wasn't
continue ;
p = PM_FindPackage ( tok ) ;
if ( p )
{ //okay, it was declined
ret = true ;
if ( ! out )
{ //we're confirming that they should be flagged as declined
if ( declinedpackages )
{
char * t = declinedpackages ;
declinedpackages = Z_StrDup ( va ( " %s;%s " , declinedpackages , tok ) ) ;
Z_Free ( t ) ;
}
else
declinedpackages = Z_StrDup ( tok ) ;
}
else
{ //we're collecting a list of package names
char * change = va ( " %s \n " , p - > name ) ;
size_t l = strlen ( change ) ;
if ( ofs + l > = outsize )
{
Q_strncpyz ( out , " Too many changes \n " , outsize ) ;
out = NULL ;
break ;
}
else
{
memcpy ( out + ofs , change , l ) ;
ofs + = l ;
out [ ofs ] = 0 ;
}
break ;
}
}
}
}
if ( ! out & & ret )
PM_WriteInstalledPackages ( ) ;
return ret ;
}
static void PM_PromptApplyChanges_Callback ( void * ctx , int opt )
{
2018-08-04 07:05:20 +00:00
# ifdef WEBCLIENT
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
pkg_updating = false ;
2018-08-04 07:05:20 +00:00
# endif
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
if ( opt = = 0 )
PM_ApplyChanges ( ) ;
}
static void PM_PromptApplyChanges ( void ) ;
static void PM_PromptApplyDecline_Callback ( void * ctx , int opt )
{
2018-08-04 07:05:20 +00:00
# ifdef WEBCLIENT
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
pkg_updating = false ;
2018-08-04 07:05:20 +00:00
# endif
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
if ( opt = = 1 )
{
PM_DeclinedPackages ( NULL , 0 ) ;
PM_PromptApplyChanges ( ) ;
}
}
static void PM_PromptApplyChanges ( void )
{
unsigned int changes ;
char text [ 8192 ] ;
2018-08-04 07:05:20 +00:00
# ifdef WEBCLIENT
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
//lock it down, so noone can make any changes while this prompt is still displayed
if ( pkg_updating )
{
M_Menu_Prompt ( PM_PromptApplyChanges_Callback , NULL , " An update is already in progress \n Please wait \n " , NULL , NULL , " Cancel " ) ;
return ;
}
pkg_updating = true ;
2018-08-04 07:05:20 +00:00
# endif
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
strcpy ( text , " Really decline the following \n recommendedpackages? \n \n " ) ;
if ( PM_DeclinedPackages ( text + strlen ( text ) , sizeof ( text ) - strlen ( text ) ) )
M_Menu_Prompt ( PM_PromptApplyDecline_Callback , NULL , text , NULL , " Confirm " , " Cancel " ) ;
else
{
strcpy ( text , " Apply the following changes? \n \n " ) ;
changes = PM_ChangeList ( text + strlen ( text ) , sizeof ( text ) - strlen ( text ) ) ;
if ( ! changes )
2018-08-04 07:05:20 +00:00
{
# ifdef WEBCLIENT
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
pkg_updating = false ; //no changes...
2018-08-04 07:05:20 +00:00
# endif
}
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
else
M_Menu_Prompt ( PM_PromptApplyChanges_Callback , NULL , text , " Apply " , NULL , " Cancel " ) ;
}
}
# endif
2016-12-07 18:45:25 +00:00
//names packages that were listed from the manifest.
//if 'mark' is true, then this is an initial install.
2017-03-04 19:36:06 +00:00
void PM_ManifestPackage ( const char * metaname , int security )
2016-11-25 08:14:54 +00:00
{
2017-03-04 19:36:06 +00:00
domanifestinstall = security ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
Z_Free ( manifestpackages ) ;
2017-03-04 19:42:12 +00:00
if ( metaname & & security )
2016-11-25 08:14:54 +00:00
{
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
manifestpackages = Z_StrDup ( metaname ) ;
// PM_UpdatePackageList(false, false);
2016-11-25 08:14:54 +00:00
}
else
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
manifestpackages = NULL ;
2016-11-25 08:14:54 +00:00
}
2018-06-06 09:09:14 +00:00
qboolean PM_CanInstall ( const char * packagename )
{
int i ;
package_t * p = PM_FindPackage ( packagename ) ;
if ( p & & ! ( p - > flags & ( DPF_ENABLED | DPF_CORRUPT | DPF_HIDDEN ) ) )
{
for ( i = 0 ; i < countof ( p - > mirror ) ; i + + )
if ( p - > mirror [ i ] )
return true ;
}
return false ;
}
2016-11-20 20:52:41 +00:00
void PM_Command_f ( void )
2006-01-28 06:41:20 +00:00
{
2005-04-16 16:22:17 +00:00
package_t * p ;
2016-11-20 20:52:41 +00:00
const char * act = Cmd_Argv ( 1 ) ;
const char * key ;
2016-08-25 00:12:14 +00:00
2016-11-20 20:52:41 +00:00
if ( Cmd_FromGamecode ( ) )
2016-07-21 19:36:34 +00:00
{
2016-11-20 20:52:41 +00:00
Con_Printf ( " %s may not be used from gamecode \n " , Cmd_Argv ( 0 ) ) ;
return ;
2016-07-21 19:36:34 +00:00
}
2016-11-20 20:52:41 +00:00
if ( ! loadedinstalled )
PM_UpdatePackageList ( false , false ) ;
2016-07-21 19:36:34 +00:00
2016-11-20 20:52:41 +00:00
if ( ! strcmp ( act , " list " ) )
2006-01-28 06:41:20 +00:00
{
2016-11-20 20:52:41 +00:00
for ( p = availablepackages ; p ; p = p - > next )
2006-01-28 06:41:20 +00:00
{
2016-11-20 20:52:41 +00:00
const char * status ;
char * markup ;
2017-01-24 10:27:39 +00:00
if ( p - > flags & DPF_ENABLED )
2016-11-20 20:52:41 +00:00
markup = S_COLOR_GREEN ;
else if ( p - > flags & DPF_CORRUPT )
markup = S_COLOR_RED ;
else if ( p - > flags & ( DPF_CACHED ) )
markup = S_COLOR_YELLOW ; //downloaded but not active
else
markup = S_COLOR_WHITE ;
2017-01-24 10:27:39 +00:00
if ( ! ( p - > flags & DPF_MARKED ) ! = ! ( p - > flags & DPF_ENABLED ) | | ( p - > flags & DPF_PURGE ) )
2016-11-20 20:52:41 +00:00
{
if ( p - > flags & DPF_MARKED )
{
if ( p - > flags & DPF_PURGE )
status = S_COLOR_CYAN " <reinstall> " ;
else
2019-03-23 07:06:37 +00:00
status = S_COLOR_CYAN " <inst all> " ;
2016-11-20 20:52:41 +00:00
}
else if ( ( p - > flags & DPF_PURGE ) | | ! ( p - > qhash & & ( p - > flags & DPF_CACHED ) ) )
status = S_COLOR_CYAN " <uninstall> " ;
else
status = S_COLOR_CYAN " <disable> " ;
}
2017-01-24 10:27:39 +00:00
else if ( ( p - > flags & ( DPF_ENABLED | DPF_CACHED ) ) = = DPF_CACHED )
2016-11-20 20:52:41 +00:00
status = S_COLOR_CYAN " <disabled> " ;
2019-03-23 07:06:37 +00:00
else if ( p - > flags & DPF_USERMARKED )
status = S_COLOR_GRAY " <manual> " ;
else if ( p - > flags & DPF_AUTOMARKED )
status = S_COLOR_GRAY " <auto> " ;
2016-11-20 20:52:41 +00:00
else
status = " " ;
2019-03-23 07:06:37 +00:00
Con_Printf ( " ^[ " S_COLOR_GRAY " %s%s%s%s%s^] %s " S_COLOR_GRAY " %s (%s%s) \n " , p - > category ? p - > category : " " , markup , p - > name , p - > arch ? " : " : " " , p - > arch ? p - > arch : " " , status , strcmp ( p - > name , p - > title ) ? p - > title : " " , p - > version , ( p - > flags & DPF_TESTING ) ? " -testing " : " " ) ;
2016-11-20 20:52:41 +00:00
}
Con_Printf ( " <end of list> \n " ) ;
}
else if ( ! strcmp ( act , " show " ) )
{
key = Cmd_Argv ( 2 ) ;
p = PM_FindPackage ( key ) ;
if ( p )
{
if ( p - > previewimage )
Con_Printf ( " ^[%s (%s) \\ tipimg \\ %s \\ tip \\ %s^] \n " , p - > name , p - > version , p - > previewimage , " " ) ;
else
Con_Printf ( " %s (%s) \n " , p - > name , p - > version ) ;
if ( p - > title )
Con_Printf ( " title: %s \n " , p - > title ) ;
if ( p - > license )
Con_Printf ( " license: %s \n " , p - > license ) ;
if ( p - > author )
Con_Printf ( " author: %s \n " , p - > author ) ;
2019-01-15 14:12:49 +00:00
if ( p - > website )
Con_Printf ( " website: %s \n " , p - > website ) ;
2016-11-20 20:52:41 +00:00
if ( p - > description )
2019-01-15 14:12:49 +00:00
Con_Printf ( " %s \n " , p - > description ) ;
2016-11-20 20:52:41 +00:00
if ( p - > flags & DPF_MARKED )
{
2017-01-24 10:27:39 +00:00
if ( p - > flags & DPF_ENABLED )
2016-11-20 20:52:41 +00:00
{
if ( p - > flags & DPF_PURGE )
Con_Printf ( " package is flagged to be re-installed \n " ) ;
else
Con_Printf ( " package is currently installed \n " ) ;
}
else
Con_Printf ( " package is flagged to be installed \n " ) ;
}
else
{
2017-01-24 10:27:39 +00:00
if ( p - > flags & DPF_ENABLED )
2016-11-20 20:52:41 +00:00
{
if ( p - > flags & DPF_PURGE )
Con_Printf ( " package is flagged to be purged \n " ) ;
else
Con_Printf ( " package is flagged to be disabled \n " ) ;
}
else
Con_Printf ( " package is not installed \n " ) ;
}
if ( p - > flags & DPF_NATIVE )
Con_Printf ( " package is native \n " ) ;
if ( p - > flags & DPF_CACHED )
Con_Printf ( " package is cached \n " ) ;
if ( p - > flags & DPF_CORRUPT )
Con_Printf ( " package is corrupt \n " ) ;
if ( p - > flags & DPF_DISPLAYVERSION )
Con_Printf ( " package has a version conflict \n " ) ;
if ( p - > flags & DPF_FORGETONUNINSTALL )
Con_Printf ( " package is obsolete \n " ) ;
if ( p - > flags & DPF_HIDDEN )
Con_Printf ( " package is hidden \n " ) ;
if ( p - > flags & DPF_ENGINE )
Con_Printf ( " package is an engine update \n " ) ;
2017-01-24 10:27:39 +00:00
if ( p - > flags & DPF_TESTING )
Con_Printf ( " package is untested \n " ) ;
2016-11-20 20:52:41 +00:00
return ;
}
Con_Printf ( " <package not found> \n " ) ;
}
else if ( ! strcmp ( act , " search " ) | | ! strcmp ( act , " find " ) )
{
const char * key = Cmd_Argv ( 2 ) ;
for ( p = availablepackages ; p ; p = p - > next )
{
if ( Q_strcasestr ( p - > name , key ) | | ( p - > title & & Q_strcasestr ( p - > title , key ) ) | | ( p - > description & & Q_strcasestr ( p - > description , key ) ) )
{
Con_Printf ( " %s \n " , p - > name ) ;
}
}
Con_Printf ( " <end of list> \n " ) ;
}
2019-05-23 15:11:32 +00:00
# ifdef WEBCLIENT
2019-03-23 07:06:37 +00:00
else if ( ! strcmp ( act , " sources " ) | | ! strcmp ( act , " addsource " ) )
2016-11-20 20:52:41 +00:00
{
if ( Cmd_Argc ( ) = = 2 )
{
int i ;
for ( i = 0 ; i < numdownloadablelists ; i + + )
Con_Printf ( " %s %s \n " , downloadablelist [ i ] . url , downloadablelist [ i ] . save ? " (explicit) " : " (implicit) " ) ;
Con_Printf ( " <%i sources> \n " , numdownloadablelists ) ;
}
else
2019-06-17 04:21:41 +00:00
{
2017-04-18 11:12:17 +00:00
PM_AddSubList ( Cmd_Argv ( 2 ) , " " , true , true ) ;
2019-06-17 04:21:41 +00:00
PM_WriteInstalledPackages ( ) ;
}
2016-11-20 20:52:41 +00:00
}
2019-05-23 15:11:32 +00:00
# endif
2016-11-20 20:52:41 +00:00
else if ( ! strcmp ( act , " remsource " ) )
2019-06-17 04:21:41 +00:00
{
2016-11-20 20:52:41 +00:00
PM_RemSubList ( Cmd_Argv ( 2 ) ) ;
2019-06-17 04:21:41 +00:00
PM_WriteInstalledPackages ( ) ;
}
2016-11-20 20:52:41 +00:00
else if ( ! strcmp ( act , " apply " ) )
{
Con_Printf ( " Applying package changes \n " ) ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
if ( qrenderer ! = QR_NONE )
PM_PromptApplyChanges ( ) ;
2018-06-02 08:55:57 +00:00
else if ( Cmd_ExecLevel = = RESTRICT_LOCAL )
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
PM_ApplyChanges ( ) ;
2016-11-20 20:52:41 +00:00
}
else if ( ! strcmp ( act , " changes " ) )
{
PM_PrintChanges ( ) ;
}
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
else if ( ! strcmp ( act , " reset " ) | | ! strcmp ( act , " revert " ) )
2016-11-20 20:52:41 +00:00
{
PM_RevertChanges ( ) ;
}
2019-05-23 15:11:32 +00:00
# ifdef WEBCLIENT
2017-09-20 11:27:13 +00:00
else if ( ! strcmp ( act , " update " ) )
{ //flush package cache, make a new request.
2019-05-23 15:11:32 +00:00
int i ;
2017-09-20 11:27:13 +00:00
for ( i = 0 ; i < numdownloadablelists ; i + + )
downloadablelist [ i ] . received = 0 ;
}
2016-11-20 20:52:41 +00:00
else if ( ! strcmp ( act , " upgrade " ) )
2017-09-20 11:27:13 +00:00
{ //auto-mark any updated packages.
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
unsigned int changes = PM_MarkUpdates ( ) ;
if ( changes )
{
2017-03-21 17:51:34 +00:00
Con_Printf ( " %u packages flagged \n " , changes ) ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
PM_PromptApplyChanges ( ) ;
}
else
Con_Printf ( " Already using latest versions of all packages \n " ) ;
2016-11-20 20:52:41 +00:00
}
2019-05-23 15:11:32 +00:00
# endif
2016-11-20 20:52:41 +00:00
else if ( ! strcmp ( act , " add " ) | | ! strcmp ( act , " get " ) | | ! strcmp ( act , " install " ) | | ! strcmp ( act , " enable " ) )
2017-09-20 11:27:13 +00:00
{ //FIXME: make sure this updates.
2016-11-20 20:52:41 +00:00
int arg = 2 ;
for ( arg = 2 ; arg < Cmd_Argc ( ) ; arg + + )
{
const char * key = Cmd_Argv ( arg ) ;
p = PM_FindPackage ( key ) ;
if ( p )
2018-10-11 10:31:23 +00:00
PM_MarkPackage ( p , DPF_USERMARKED ) ;
2016-11-20 20:52:41 +00:00
else
Con_Printf ( " %s: package %s not known \n " , Cmd_Argv ( 0 ) , key ) ;
}
PM_PrintChanges ( ) ;
}
2019-05-23 15:11:32 +00:00
# ifdef WEBCLIENT
2016-11-20 20:52:41 +00:00
else if ( ! strcmp ( act , " reinstall " ) )
2017-09-20 11:27:13 +00:00
{ //fixme: favour the current verson.
2016-11-20 20:52:41 +00:00
int arg = 2 ;
for ( arg = 2 ; arg < Cmd_Argc ( ) ; arg + + )
{
const char * key = Cmd_Argv ( arg ) ;
p = PM_FindPackage ( key ) ;
if ( p )
{
2018-10-11 10:31:23 +00:00
PM_MarkPackage ( p , DPF_USERMARKED ) ;
2016-11-20 20:52:41 +00:00
p - > flags | = DPF_PURGE ;
}
else
Con_Printf ( " %s: package %s not known \n " , Cmd_Argv ( 0 ) , key ) ;
}
PM_PrintChanges ( ) ;
}
2019-05-23 15:11:32 +00:00
# endif
2019-03-23 07:06:37 +00:00
else if ( ! strcmp ( act , " disable " ) | | ! strcmp ( act , " rem " ) | | ! strcmp ( act , " remove " ) )
2016-11-20 20:52:41 +00:00
{
int arg = 2 ;
for ( arg = 2 ; arg < Cmd_Argc ( ) ; arg + + )
{
const char * key = Cmd_Argv ( arg ) ;
2019-03-23 07:06:37 +00:00
p = PM_MarkedPackage ( key , DPF_MARKED ) ;
2016-11-20 20:52:41 +00:00
if ( ! p )
p = PM_FindPackage ( key ) ;
if ( p )
2018-10-11 10:31:23 +00:00
PM_UnmarkPackage ( p , DPF_MARKED ) ;
2016-11-20 20:52:41 +00:00
else
Con_Printf ( " %s: package %s not known \n " , Cmd_Argv ( 0 ) , key ) ;
}
PM_PrintChanges ( ) ;
}
else if ( ! strcmp ( act , " del " ) | | ! strcmp ( act , " purge " ) | | ! strcmp ( act , " delete " ) | | ! strcmp ( act , " uninstall " ) )
{
int arg = 2 ;
for ( arg = 2 ; arg < Cmd_Argc ( ) ; arg + + )
{
const char * key = Cmd_Argv ( arg ) ;
2019-03-23 07:06:37 +00:00
p = PM_MarkedPackage ( key , DPF_MARKED ) ;
2016-11-20 20:52:41 +00:00
if ( ! p )
p = PM_FindPackage ( key ) ;
if ( p )
{
2018-10-11 10:31:23 +00:00
PM_UnmarkPackage ( p , DPF_MARKED ) ;
2016-11-20 20:52:41 +00:00
p - > flags | = DPF_PURGE ;
}
else
Con_Printf ( " %s: package %s not known \n " , Cmd_Argv ( 0 ) , key ) ;
}
PM_PrintChanges ( ) ;
}
else
2019-03-23 07:06:37 +00:00
Con_Printf ( " %s: Unknown action %s \n Should be one of list, show, search, upgrade, revert, add, rem, del, changes, apply, sources, addsource, remsource \n " , Cmd_Argv ( 0 ) , act ) ;
2016-11-20 20:52:41 +00:00
}
2017-01-24 10:27:39 +00:00
qboolean PM_FindUpdatedEngine ( char * syspath , size_t syspathsize )
{
struct packagedep_s * dep ;
package_t * e = NULL , * p ;
char * pfname ;
//figure out what we've previously installed.
2017-04-18 11:12:17 +00:00
PM_PreparePackageList ( ) ;
2017-01-24 10:27:39 +00:00
for ( p = availablepackages ; p ; p = p - > next )
{
if ( ( p - > flags & DPF_ENGINE ) & & ! ( p - > flags & DPF_HIDDEN ) & & p - > fsroot = = FS_ROOT )
{
if ( ( p - > flags & DPF_ENABLED ) & & ( ! e | | strcmp ( e - > version , p - > version ) < 0 ) )
if ( strcmp ( SVNREVISIONSTR , " - " ) & & strcmp ( SVNREVISIONSTR , p - > version ) < 0 ) //package must be more recent than the current engine too, there's no point auto-updating to an older revision.
{
for ( dep = p - > deps , pfname = NULL ; dep ; dep = dep - > next )
{
if ( dep - > dtype ! = DEP_FILE )
continue ;
if ( pfname )
{
pfname = NULL ;
break ;
}
pfname = dep - > name ;
}
if ( pfname & & PM_CheckFile ( pfname , p - > fsroot ) )
{
if ( FS_NativePath ( pfname , p - > fsroot , syspath , syspathsize ) )
e = p ;
}
}
}
}
if ( e )
return true ;
return false ;
}
2016-11-20 20:52:41 +00:00
# else
2018-07-22 11:49:37 +00:00
qboolean PM_CanInstall ( const char * packagename )
{
return false ;
}
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
void PM_EnumeratePlugins ( void ( * callback ) ( const char * name ) )
{
}
2017-03-04 19:42:12 +00:00
void PM_ManifestPackage ( const char * metaname , int security )
2016-12-07 18:45:25 +00:00
{
}
2017-03-04 19:46:37 +00:00
int PM_IsApplying ( qboolean listsonly )
{
return false ;
}
2017-01-24 10:35:59 +00:00
qboolean PM_FindUpdatedEngine ( char * syspath , size_t syspathsize )
{
return false ;
}
2016-11-20 20:52:41 +00:00
# endif
# ifdef DOWNLOADMENU
2016-12-13 11:50:15 +00:00
typedef struct {
menucustom_t * list ;
char intermediatefilename [ MAX_QPATH ] ;
char pathprefix [ MAX_QPATH ] ;
int downloadablessequence ;
2018-10-11 10:31:23 +00:00
char titletext [ 128 ] ;
2016-12-13 11:50:15 +00:00
qboolean populated ;
} dlmenu_t ;
2016-11-20 20:52:41 +00:00
static void MD_Draw ( int x , int y , struct menucustom_s * c , struct menu_s * m )
{
package_t * p ;
char * n ;
if ( c - > dint ! = downloadablessequence )
return ; //probably stale
p = c - > dptr ;
if ( p )
{
if ( p - > alternative & & ( p - > flags & DPF_HIDDEN ) )
p = p - > alternative ;
2018-08-04 07:05:20 +00:00
# ifdef WEBCLIENT
2016-11-20 20:52:41 +00:00
if ( p - > download )
2019-01-13 16:51:50 +00:00
Draw_FunStringWidth ( x , y , va ( " %i%% " , ( int ) p - > download - > qdownload . percent ) , 48 , 2 , false ) ;
2016-11-20 20:52:41 +00:00
else if ( p - > trymirrors )
2019-01-13 16:51:50 +00:00
Draw_FunStringWidth ( x , y , " PND " , 48 , 2 , false ) ;
2018-08-04 07:05:20 +00:00
else
# endif
2016-11-20 20:52:41 +00:00
{
2019-01-13 16:51:50 +00:00
if ( p - > flags & DPF_USERMARKED )
2016-11-20 20:52:41 +00:00
{
2018-10-11 10:31:23 +00:00
if ( ! ( p - > flags & DPF_ENABLED ) )
2019-01-13 16:51:50 +00:00
{ //DPF_MARKED|!DPF_ENABLED:
2018-10-11 10:31:23 +00:00
if ( p - > flags & DPF_PURGE )
2019-01-13 16:51:50 +00:00
Draw_FunStringWidth ( x , y , " GET " , 48 , 2 , false ) ;
else if ( p - > flags & ( DPF_PRESENT ) )
Draw_FunStringWidth ( x , y , " USE " , 48 , 2 , false ) ;
2018-10-11 10:31:23 +00:00
else
2019-01-13 16:51:50 +00:00
Draw_FunStringWidth ( x , y , " GET " , 48 , 2 , false ) ;
2016-11-20 20:52:41 +00:00
}
else
2019-01-13 16:51:50 +00:00
{ //DPF_MARKED|DPF_ENABLED:
if ( p - > flags & DPF_PURGE )
Draw_FunStringWidth ( x , y , " GET " , 48 , 2 , false ) ; //purge and reinstall.
else if ( p - > flags & DPF_CORRUPT )
Draw_FunStringWidth ( x , y , " ? " " ? " " ? " , 48 , 2 , false ) ;
2018-10-11 10:31:23 +00:00
else
2019-01-13 16:51:50 +00:00
{
Draw_FunStringWidth ( x , y , " ^Ue080^Ue082 " , 48 , 2 , false ) ;
Draw_FunStringWidth ( x , y , " ^Ue083 " , 48 , 2 , false ) ;
}
2018-10-11 10:31:23 +00:00
}
}
2019-01-13 16:51:50 +00:00
else if ( p - > flags & DPF_MARKED )
2018-10-11 10:31:23 +00:00
{
if ( ! ( p - > flags & DPF_ENABLED ) )
{ //DPF_MARKED|!DPF_ENABLED:
if ( p - > flags & DPF_PURGE )
2019-01-13 16:51:50 +00:00
Draw_FunStringWidth ( x , y , " ^hGET " , 48 , 2 , false ) ;
2018-10-11 10:31:23 +00:00
else if ( p - > flags & ( DPF_PRESENT ) )
2019-01-13 16:51:50 +00:00
Draw_FunStringWidth ( x , y , " ^hUSE " , 48 , 2 , false ) ;
2018-10-11 10:31:23 +00:00
else
2019-01-13 16:51:50 +00:00
Draw_FunStringWidth ( x , y , " ^hGET " , 48 , 2 , false ) ;
2018-10-11 10:31:23 +00:00
}
2016-11-20 20:52:41 +00:00
else
2018-10-11 10:31:23 +00:00
{ //DPF_MARKED|DPF_ENABLED:
if ( p - > flags & DPF_PURGE )
2019-01-13 16:51:50 +00:00
Draw_FunStringWidth ( x , y , " ^hGET " , 48 , 2 , false ) ; //purge and reinstall.
else if ( p - > flags & DPF_CORRUPT )
Draw_FunStringWidth ( x , y , " ? " " ? " " ? " , 48 , 2 , false ) ;
else
{
Draw_FunStringWidth ( x , y , " ^Ue080^Ue082 " , 48 , 2 , false ) ;
Draw_FunStringWidth ( x , y , " ^Ue083 " , 48 , 2 , false ) ;
}
}
}
else
{
if ( ! ( p - > flags & DPF_ENABLED ) )
{ //!DPF_MARKED|!DPF_ENABLED:
if ( p - > flags & DPF_PURGE )
Draw_FunStringWidth ( x , y , " DEL " , 48 , 2 , false ) ; //purge
else if ( p - > flags & DPF_HIDDEN )
Draw_FunStringWidth ( x , y , " --- " , 48 , 2 , false ) ;
2018-10-11 10:31:23 +00:00
else if ( p - > flags & DPF_CORRUPT )
2019-01-13 16:51:50 +00:00
Draw_FunStringWidth ( x , y , " !!! " , 48 , 2 , false ) ;
2018-10-11 10:31:23 +00:00
else
{
2019-01-13 16:51:50 +00:00
Draw_FunStringWidth ( x , y , " ^Ue080^Ue082 " , 48 , 2 , false ) ;
Draw_FunStringWidth ( x , y , " ^Ue081 " , 48 , 2 , false ) ;
if ( p - > flags & DPF_PRESENT )
Draw_FunStringWidth ( x , y , " - " , 48 , 2 , false ) ;
2018-10-11 10:31:23 +00:00
}
2016-11-20 20:52:41 +00:00
}
2019-01-13 16:51:50 +00:00
else
{ //!DPF_MARKED|DPF_ENABLED:
if ( ( p - > flags & DPF_PURGE ) | | PM_PurgeOnDisable ( p ) )
Draw_FunStringWidth ( x , y , " DEL " , 48 , 2 , false ) ;
else
Draw_FunStringWidth ( x , y , " REM " , 48 , 2 , false ) ;
}
2016-11-20 20:52:41 +00:00
}
}
2016-11-25 08:14:54 +00:00
n = p - > title ;
2016-11-20 20:52:41 +00:00
if ( p - > flags & DPF_DISPLAYVERSION )
n = va ( " %s (%s) " , n , * p - > version ? p - > version : " unversioned " ) ;
2017-01-24 10:27:39 +00:00
if ( p - > flags & DPF_TESTING ) //hide testing updates
n = va ( " ^h%s " , n ) ;
// if (!(p->flags & (DPF_ENABLED|DPF_MARKED|DPF_PRESENT))
// continue;
2019-01-13 16:51:50 +00:00
// if (&m->selecteditem->common == &c->common)
// Draw_AltFunString (x+48, y, n);
// else
2016-11-20 20:52:41 +00:00
Draw_FunString ( x + 48 , y , n ) ;
}
}
static qboolean MD_Key ( struct menucustom_s * c , struct menu_s * m , int key , unsigned int unicode )
{
2019-01-15 14:12:49 +00:00
extern qboolean keydown [ ] ;
qboolean ctrl = keydown [ K_LCTRL ] | | keydown [ K_RCTRL ] ;
2016-11-20 20:52:41 +00:00
package_t * p , * p2 ;
struct packagedep_s * dep , * dep2 ;
if ( c - > dint ! = downloadablessequence )
return false ; //probably stale
p = c - > dptr ;
2019-01-15 14:12:49 +00:00
if ( key = = ' c ' & & ctrl )
Sys_SaveClipboard ( CBT_CLIPBOARD , p - > website ) ;
else if ( key = = K_ENTER | | key = = K_KP_ENTER | | key = = K_GP_START | | key = = K_MOUSE1 )
2016-11-20 20:52:41 +00:00
{
if ( p - > alternative & & ( p - > flags & DPF_HIDDEN ) )
p = p - > alternative ;
2017-01-24 10:27:39 +00:00
if ( p - > flags & DPF_ENABLED )
2016-11-20 20:52:41 +00:00
{
switch ( p - > flags & ( DPF_PURGE | DPF_MARKED ) )
{
2018-10-11 10:31:23 +00:00
case DPF_USERMARKED :
case DPF_AUTOMARKED :
2016-11-20 20:52:41 +00:00
case DPF_MARKED :
2018-10-11 10:31:23 +00:00
PM_UnmarkPackage ( p , DPF_MARKED ) ; //deactivate it
2016-11-20 20:52:41 +00:00
break ;
case 0 :
p - > flags | = DPF_PURGE ; //purge
2017-01-24 10:27:39 +00:00
if ( ! PM_PurgeOnDisable ( p ) )
2016-11-20 20:52:41 +00:00
break ;
//fall through
case DPF_PURGE :
2018-10-11 10:31:23 +00:00
PM_MarkPackage ( p , DPF_USERMARKED ) ; //reinstall
2016-11-20 20:52:41 +00:00
// if (!(p->flags & DPF_HIDDEN) && !(p->flags & DPF_CACHED))
// break;
//fall through
2018-10-11 10:31:23 +00:00
case DPF_USERMARKED | DPF_PURGE :
case DPF_AUTOMARKED | DPF_PURGE :
2016-11-20 20:52:41 +00:00
case DPF_MARKED | DPF_PURGE :
p - > flags & = ~ DPF_PURGE ; //back to no-change
break ;
}
}
else
{
switch ( p - > flags & ( DPF_PURGE | DPF_MARKED ) )
{
case 0 :
2018-10-11 10:31:23 +00:00
PM_MarkPackage ( p , DPF_USERMARKED ) ;
2016-11-20 20:52:41 +00:00
//now: try to install
break ;
2019-01-13 16:51:50 +00:00
case DPF_AUTOMARKED : //
p - > flags | = DPF_USERMARKED ;
break ;
2018-10-11 10:31:23 +00:00
case DPF_USERMARKED :
2016-11-20 20:52:41 +00:00
case DPF_MARKED :
p - > flags | = DPF_PURGE ;
2019-05-23 15:11:32 +00:00
# ifdef WEBCLIENT
2016-11-20 20:52:41 +00:00
//now: re-get despite already having it.
added r_meshpitch cvar that allows for fixing the unfixable mesh pitch bug from vanilla... needs a better name... do note that this will break pretty much any mod, so this is really only for TCs designed to use it. Its likely that I missed places.
nqsv: added support for spectators with nq clients. the angles are a bit rough, but hey. need to do something about frags so nq clients know who's a spectator. use 'cmd observe' to get an nq client to spectate on an fte server (then attack/jump behave the same as in qw clients).
nqsv: rewrote EF_MUZZLEFLASH handling, so svc_muzzleflash is now translated properly to EF_MUZZLEFLASH, and vice versa. No more missing muzzleflashes!
added screenshot_cubemap, so you can actually pre-generate cubemaps with fte (which can be used for reflections or whatever).
misc fixes (server crash, a couple of other less important ones).
external files based on a model's name will now obey r_replacemodels properly, instead of needing to use foo.mdl_0.skin for foo.md3.
identify <playernum> should now use the correct masked ip, instead of abrubtly failing (reported by kt)
vid_toggle console command should now obey vid_width and vid_height when switching to fullscreen, but only if vid_fullscreen is actually set, which should make it seem better behaved (reported by kt).
qcc: cleaned up sym->symboldata[sym->ofs] to be more consistent at all stages.
qcc: typedef float vec4[4]; now works to define a float array with 4 elements (however, it will be passed by-value rather than by-reference).
qcc: cleaned up optional vs __out ordering issues.
qccgui: shift+f3 searches backwards
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5064 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-02-27 09:34:35 +00:00
if ( ( p - > flags & DPF_CORRUPT ) | | ( ( p - > flags & DPF_PRESENT ) & & ! PM_PurgeOnDisable ( p ) ) )
2016-11-20 20:52:41 +00:00
break ; //only makes sense if we already have a cached copy that we're not going to use.
2019-05-23 15:11:32 +00:00
# endif
2016-11-20 20:52:41 +00:00
//fallthrough
2018-10-11 10:31:23 +00:00
case DPF_USERMARKED | DPF_PURGE :
case DPF_AUTOMARKED | DPF_PURGE :
2016-11-20 20:52:41 +00:00
case DPF_MARKED | DPF_PURGE :
2018-10-11 10:31:23 +00:00
PM_UnmarkPackage ( p , DPF_MARKED ) ;
2016-11-20 20:52:41 +00:00
//now: delete
added r_meshpitch cvar that allows for fixing the unfixable mesh pitch bug from vanilla... needs a better name... do note that this will break pretty much any mod, so this is really only for TCs designed to use it. Its likely that I missed places.
nqsv: added support for spectators with nq clients. the angles are a bit rough, but hey. need to do something about frags so nq clients know who's a spectator. use 'cmd observe' to get an nq client to spectate on an fte server (then attack/jump behave the same as in qw clients).
nqsv: rewrote EF_MUZZLEFLASH handling, so svc_muzzleflash is now translated properly to EF_MUZZLEFLASH, and vice versa. No more missing muzzleflashes!
added screenshot_cubemap, so you can actually pre-generate cubemaps with fte (which can be used for reflections or whatever).
misc fixes (server crash, a couple of other less important ones).
external files based on a model's name will now obey r_replacemodels properly, instead of needing to use foo.mdl_0.skin for foo.md3.
identify <playernum> should now use the correct masked ip, instead of abrubtly failing (reported by kt)
vid_toggle console command should now obey vid_width and vid_height when switching to fullscreen, but only if vid_fullscreen is actually set, which should make it seem better behaved (reported by kt).
qcc: cleaned up sym->symboldata[sym->ofs] to be more consistent at all stages.
qcc: typedef float vec4[4]; now works to define a float array with 4 elements (however, it will be passed by-value rather than by-reference).
qcc: cleaned up optional vs __out ordering issues.
qccgui: shift+f3 searches backwards
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5064 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-02-27 09:34:35 +00:00
if ( ( p - > flags & DPF_CORRUPT ) | | ( ( p - > flags & DPF_PRESENT ) & & ! PM_PurgeOnDisable ( p ) ) )
2016-11-20 20:52:41 +00:00
break ; //only makes sense if we have a cached/corrupt copy of it already
//fallthrough
case DPF_PURGE :
p - > flags & = ~ DPF_PURGE ;
//now: no change
break ;
}
}
if ( p - > flags & DPF_MARKED )
{
//any other packages that conflict should be flagged for uninstall now that this one will replace it.
for ( p2 = availablepackages ; p2 ; p2 = p2 - > next )
{
if ( p = = p2 )
continue ;
for ( dep = p - > deps ; dep ; dep = dep - > next )
{
if ( dep - > dtype ! = DEP_FILE )
continue ;
for ( dep2 = p2 - > deps ; dep2 ; dep2 = dep2 - > next )
{
if ( dep2 - > dtype ! = DEP_FILE )
continue ;
if ( ! strcmp ( dep - > name , dep2 - > name ) )
{
2018-10-11 10:31:23 +00:00
PM_UnmarkPackage ( p2 , DPF_MARKED ) ;
2016-11-20 20:52:41 +00:00
break ;
}
}
}
}
}
2018-08-04 07:05:20 +00:00
# ifdef WEBCLIENT
2016-11-20 20:52:41 +00:00
else
p - > trymirrors = 0 ;
2018-08-04 07:05:20 +00:00
# endif
2016-11-20 20:52:41 +00:00
return true ;
}
return false ;
}
2018-08-04 07:05:20 +00:00
# ifdef WEBCLIENT
2016-11-20 20:52:41 +00:00
static void MD_AutoUpdate_Draw ( int x , int y , struct menucustom_s * c , struct menu_s * m )
{
char * settings [ ] =
{
" Off " ,
" Stable Updates " ,
2016-11-25 08:14:54 +00:00
" Test Updates "
2016-11-20 20:52:41 +00:00
} ;
char * text ;
2019-06-17 04:21:41 +00:00
int setting = bound ( 0 , pkg_autoupdate . ival , 2 ) ;
2019-01-13 16:51:50 +00:00
text = va ( " Auto Update: ^a%s " , settings [ setting ] ) ;
// if (&m->selecteditem->common == &c->common)
// Draw_AltFunString (x, y, text);
// else
Draw_FunString ( x , y , text ) ;
2016-11-20 20:52:41 +00:00
}
static qboolean MD_AutoUpdate_Key ( struct menucustom_s * c , struct menu_s * m , int key , unsigned int unicode )
{
2017-08-16 02:14:07 +00:00
if ( key = = K_ENTER | | key = = K_KP_ENTER | | key = = K_GP_START | | key = = K_MOUSE1 )
2016-11-20 20:52:41 +00:00
{
2017-01-24 10:27:39 +00:00
char nv [ 8 ] = " 0 " ;
2019-06-17 04:21:41 +00:00
if ( pkg_autoupdate . ival < UPD_TESTING & & pkg_autoupdate . ival > = 0 )
Q_snprintfz ( nv , sizeof ( nv ) , " %i " , pkg_autoupdate . ival + 1 ) ;
Cvar_ForceSet ( & pkg_autoupdate , nv ) ;
2017-01-24 10:27:39 +00:00
PM_WriteInstalledPackages ( ) ;
PM_UpdatePackageList ( true , 0 ) ;
2016-11-20 20:52:41 +00:00
}
return false ;
}
2018-08-04 07:05:20 +00:00
static qboolean MD_MarkUpdatesButton ( union menuoption_s * mo , struct menu_s * m , int key )
2016-11-20 20:52:41 +00:00
{
2017-08-16 02:14:07 +00:00
if ( key = = K_ENTER | | key = = K_KP_ENTER | | key = = K_GP_START | | key = = K_MOUSE1 )
2016-11-20 20:52:41 +00:00
{
2018-08-04 07:05:20 +00:00
PM_MarkUpdates ( ) ;
2016-11-20 20:52:41 +00:00
return true ;
}
return false ;
}
2018-08-04 07:05:20 +00:00
# endif
2016-11-20 20:52:41 +00:00
2018-08-04 07:05:20 +00:00
qboolean MD_PopMenu ( union menuoption_s * mo , struct menu_s * m , int key )
2016-11-20 20:52:41 +00:00
{
2017-08-16 02:14:07 +00:00
if ( key = = K_ENTER | | key = = K_KP_ENTER | | key = = K_GP_START | | key = = K_MOUSE1 )
2016-11-20 20:52:41 +00:00
{
2018-08-04 07:05:20 +00:00
M_RemoveMenu ( m ) ;
2016-11-20 20:52:41 +00:00
return true ;
}
return false ;
}
2018-08-04 07:05:20 +00:00
static qboolean MD_ApplyDownloads ( union menuoption_s * mo , struct menu_s * m , int key )
2016-11-20 20:52:41 +00:00
{
2017-08-16 02:14:07 +00:00
if ( key = = K_ENTER | | key = = K_KP_ENTER | | key = = K_GP_START | | key = = K_MOUSE1 )
2016-11-20 20:52:41 +00:00
{
2018-08-04 07:05:20 +00:00
PM_PromptApplyChanges ( ) ;
2016-11-20 20:52:41 +00:00
return true ;
}
return false ;
}
2018-08-04 07:05:20 +00:00
2016-11-20 20:52:41 +00:00
static qboolean MD_RevertUpdates ( union menuoption_s * mo , struct menu_s * m , int key )
{
2017-08-16 02:14:07 +00:00
if ( key = = K_ENTER | | key = = K_KP_ENTER | | key = = K_GP_START | | key = = K_MOUSE1 )
2016-11-20 20:52:41 +00:00
{
PM_RevertChanges ( ) ;
return true ;
}
return false ;
}
2019-01-13 16:51:50 +00:00
static int MD_AddItemsToDownloadMenu ( menu_t * m , int y , const char * pathprefix )
2016-11-20 20:52:41 +00:00
{
char path [ MAX_QPATH ] ;
package_t * p ;
menucustom_t * c ;
char * slash ;
menuoption_t * mo ;
2019-01-13 16:51:50 +00:00
int prefixlen = strlen ( pathprefix ) ;
2016-11-20 20:52:41 +00:00
2019-01-13 16:51:50 +00:00
//add all packages in this dir
for ( p = availablepackages ; p ; p = p - > next )
2016-11-20 20:52:41 +00:00
{
2019-01-13 16:51:50 +00:00
if ( strncmp ( p - > category , pathprefix , prefixlen ) )
continue ;
if ( ( p - > flags & DPF_HIDDEN ) & & ( p - > arch | | ! ( p - > flags & DPF_ENABLED ) ) )
continue ;
slash = strchr ( p - > category + prefixlen , ' / ' ) ;
if ( ! slash )
{
2019-01-15 14:12:49 +00:00
char * desc ;
if ( p - > author | | p - > license | | p - > website )
desc = va ( " ^aauthor: ^a%s \n ^alicense: ^a%s \n ^awebsite: ^a%s \n %s " , p - > author ? p - > author : " ^hUnknown^h " , p - > license ? p - > license : " ^hUnknown^h " , p - > website ? p - > website : " ^hUnknown^h " , p - > description ) ;
else
desc = p - > description ;
c = MC_AddCustom ( m , 0 , y , p , downloadablessequence , desc ) ;
2019-01-13 16:51:50 +00:00
c - > draw = MD_Draw ;
c - > key = MD_Key ;
c - > common . width = 320 ;
c - > common . height = 8 ;
y + = 8 ;
2018-08-04 07:05:20 +00:00
2019-01-13 16:51:50 +00:00
if ( ! m - > selecteditem )
m - > selecteditem = ( menuoption_t * ) c ;
}
2016-11-20 20:52:41 +00:00
}
2019-01-13 16:51:50 +00:00
//and then try to add any subdirs...
2016-11-20 20:52:41 +00:00
for ( p = availablepackages ; p ; p = p - > next )
{
2019-01-13 16:51:50 +00:00
if ( strncmp ( p - > category , pathprefix , prefixlen ) )
2016-11-20 20:52:41 +00:00
continue ;
2017-01-24 10:27:39 +00:00
if ( ( p - > flags & DPF_HIDDEN ) & & ( p - > arch | | ! ( p - > flags & DPF_ENABLED ) ) )
2016-11-20 20:52:41 +00:00
continue ;
slash = strchr ( p - > category + prefixlen , ' / ' ) ;
if ( slash )
{
Q_strncpyz ( path , p - > category , MAX_QPATH ) ;
slash = strchr ( path + prefixlen , ' / ' ) ;
2006-01-28 06:41:20 +00:00
if ( slash )
* slash = ' \0 ' ;
2008-02-13 07:57:42 +00:00
2006-01-28 06:41:20 +00:00
for ( mo = m - > options ; mo ; mo = mo - > common . next )
2019-01-13 16:51:50 +00:00
if ( mo - > common . type = = mt_text /*mt_button*/ )
if ( ! strcmp ( mo - > button . text , path + prefixlen ) )
2006-01-28 06:41:20 +00:00
break ;
if ( ! mo )
{
y + = 8 ;
2019-01-13 16:51:50 +00:00
MC_AddBufferedText ( m , 48 , 320 , y , path + prefixlen , false , true ) ;
y + = 8 ;
Q_strncatz ( path , " / " , sizeof ( path ) ) ;
y = MD_AddItemsToDownloadMenu ( m , y , path ) ;
2006-01-28 06:41:20 +00:00
}
}
2016-07-21 19:36:34 +00:00
}
2019-01-13 16:51:50 +00:00
return y ;
2006-01-28 06:41:20 +00:00
}
2016-08-25 00:12:14 +00:00
# include "shader.h"
2017-04-18 11:12:17 +00:00
static void MD_Download_UpdateStatus ( struct menu_s * m )
2006-01-28 06:41:20 +00:00
{
dlmenu_t * info = m - > data ;
2019-01-13 16:51:50 +00:00
int i , y ;
2018-10-11 10:31:23 +00:00
package_t * p ;
2019-05-23 15:11:32 +00:00
unsigned int totalpackages = 0 , selectedpackages = 0 , addpackages = 0 , rempackages = 0 ;
2018-10-11 10:31:23 +00:00
menuoption_t * si ;
2019-01-13 16:51:50 +00:00
menubutton_t * b , * d ;
2019-05-23 15:11:32 +00:00
# ifdef WEBCLIENT
unsigned int downloads = 0 ;
2019-01-13 16:51:50 +00:00
menucustom_t * c ;
2019-05-23 15:11:32 +00:00
# endif
2006-01-28 06:41:20 +00:00
2018-10-11 10:31:23 +00:00
if ( info - > downloadablessequence ! = downloadablessequence | | ! info - > populated )
2016-08-25 00:12:14 +00:00
{
while ( m - > options )
{
menuoption_t * op = m - > options ;
m - > options = op - > common . next ;
if ( op - > common . iszone )
Z_Free ( op ) ;
}
m - > cursoritem = m - > selecteditem = NULL ;
2016-11-20 20:52:41 +00:00
info - > downloadablessequence = downloadablessequence ;
2016-08-25 00:12:14 +00:00
info - > populated = false ;
2018-10-11 10:31:23 +00:00
MC_AddWhiteText ( m , 24 , 320 , 8 , " Downloads " , false ) - > text = info - > titletext ;
MC_AddWhiteText ( m , 16 , 320 , 24 , " ^Ue01d^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01e^Ue01f " , false ) ;
2016-08-25 00:12:14 +00:00
//FIXME: should probably reselect the previous selected item. lets just assume everyone uses a mouse...
}
2005-04-16 16:22:17 +00:00
2018-10-11 10:31:23 +00:00
for ( p = availablepackages ; p ; p = p - > next )
{
if ( p - > alternative & & ( p - > flags & DPF_HIDDEN ) )
p = p - > alternative ;
totalpackages + + ;
# ifdef WEBCLIENT
if ( p - > download | | p - > trymirrors )
downloads + + ; //downloading or pending
# endif
if ( p - > flags & DPF_MARKED )
{
if ( p - > flags & DPF_ENABLED )
{
selectedpackages + + ;
if ( p - > flags & DPF_PURGE )
{
rempackages + + ;
addpackages + + ;
}
}
else
{
selectedpackages + + ;
if ( p - > flags & DPF_PURGE )
rempackages + + ; //adding, but also deleting. how weird is that!
addpackages + + ;
}
}
else
{
if ( p - > flags & DPF_ENABLED )
rempackages + + ;
else
{
if ( p - > flags & DPF_PURGE )
rempackages + + ;
}
}
}
//show status.
if ( cls . download )
{ //we can actually download more than one thing at a time, but that makes the UI messy, so only show one active download here.
if ( cls . download - > sizeunknown & & cls . download - > size = = 0 )
Q_snprintfz ( info - > titletext , sizeof ( info - > titletext ) , " Downloads (%ukbps - %s) " , CL_DownloadRate ( ) / 1000 , cls . download - > localname ) ;
else
Q_snprintfz ( info - > titletext , sizeof ( info - > titletext ) , " Downloads (%u%% %ukbps - %s) " , ( int ) cls . download - > percent , CL_DownloadRate ( ) / 1000 , cls . download - > localname ) ;
}
else if ( ! addpackages & & ! rempackages )
Q_snprintfz ( info - > titletext , sizeof ( info - > titletext ) , " Downloads (%i of %i) " , selectedpackages , totalpackages ) ;
else
Q_snprintfz ( info - > titletext , sizeof ( info - > titletext ) , " Downloads (+%u -%u) " , addpackages , rempackages ) ;
2016-08-25 00:12:14 +00:00
if ( ! info - > populated )
{
for ( i = 0 ; i < numdownloadablelists ; i + + )
2006-01-28 06:41:20 +00:00
{
2016-08-25 00:12:14 +00:00
if ( ! downloadablelist [ i ] . received )
2006-01-28 06:41:20 +00:00
{
2016-08-25 00:12:14 +00:00
Draw_FunStringWidth ( 0 , vid . height - 8 , " Querying for package list " , vid . width , 2 , false ) ;
2006-01-28 06:41:20 +00:00
return ;
}
}
2016-08-25 00:12:14 +00:00
info - > populated = true ;
2019-01-13 16:51:50 +00:00
MC_AddFrameStart ( m , 48 ) ;
y = 48 ;
b = MC_AddCommand ( m , 48 , 170 , y , " Apply " , MD_ApplyDownloads ) ;
b - > rightalign = false ;
b - > common . tooltip = " Enable/Disable/Download/Delete packages to match any changes made (you will be prompted with a list of the changes that will be made). " ;
y + = 8 ;
d = b = MC_AddCommand ( m , 48 , 170 , y , " Back " , MD_PopMenu ) ;
b - > rightalign = false ;
y + = 8 ;
# ifdef WEBCLIENT
b = MC_AddCommand ( m , 48 , 170 , y , " Mark Updates " , MD_MarkUpdatesButton ) ;
b - > rightalign = false ;
b - > common . tooltip = " Select any updated versions of packages that are already installed. " ;
y + = 8 ;
# endif
b = MC_AddCommand ( m , 48 , 170 , y , " Revert Updates " , MD_RevertUpdates ) ;
b - > rightalign = false ;
b - > common . tooltip = " Reset selection to only those packages that are currently installed. " ;
y + = 8 ;
# ifdef WEBCLIENT
2019-01-15 14:12:49 +00:00
c = MC_AddCustom ( m , 48 , y , p , 0 , NULL ) ;
2019-01-13 16:51:50 +00:00
c - > draw = MD_AutoUpdate_Draw ;
c - > key = MD_AutoUpdate_Key ;
c - > common . width = 320 ;
c - > common . height = 8 ;
y + = 8 ;
# endif
y + = 4 ; //small gap
MD_AddItemsToDownloadMenu ( m , y , info - > pathprefix ) ;
if ( ! m - > selecteditem )
m - > selecteditem = ( menuoption_t * ) d ;
m - > cursoritem = ( menuoption_t * ) MC_AddWhiteText ( m , 40 , 0 , m - > selecteditem - > common . posy , NULL , false ) ;
MC_AddFrameEnd ( m , 48 ) ;
2006-01-28 06:41:20 +00:00
}
2016-08-25 00:12:14 +00:00
2018-10-11 10:31:23 +00:00
si = m - > mouseitem ;
if ( ! si )
si = m - > selecteditem ;
if ( si & & si - > common . type = = mt_custom & & si - > custom . dptr )
2006-01-28 06:41:20 +00:00
{
2018-10-11 10:31:23 +00:00
package_t * p = si - > custom . dptr ;
2016-08-25 00:12:14 +00:00
if ( p - > previewimage )
2005-04-16 16:22:17 +00:00
{
2017-01-24 20:15:14 +00:00
shader_t * sh = R_RegisterPic ( p - > previewimage , NULL ) ;
2016-08-25 00:12:14 +00:00
if ( R_GetShaderSizes ( sh , NULL , NULL , false ) > 0 )
R2D_Image ( 0 , 0 , vid . width , vid . height , 0 , 0 , 1 , 1 , sh ) ;
2005-04-16 16:22:17 +00:00
}
}
2006-01-28 06:41:20 +00:00
}
2005-04-16 16:22:17 +00:00
void Menu_DownloadStuff_f ( void )
{
menu_t * menu ;
dlmenu_t * info ;
2015-07-14 14:47:00 +00:00
Key_Dest_Add ( kdm_emenu ) ;
2005-04-16 16:22:17 +00:00
menu = M_CreateMenu ( sizeof ( dlmenu_t ) ) ;
info = menu - > data ;
2017-01-24 10:27:39 +00:00
menu - > persist = true ;
2017-04-18 11:12:17 +00:00
menu - > predraw = MD_Download_UpdateStatus ;
2016-08-25 00:12:14 +00:00
info - > downloadablessequence = downloadablessequence ;
2005-04-16 16:22:17 +00:00
2016-07-21 19:36:34 +00:00
2006-01-28 06:41:20 +00:00
Q_strncpyz ( info - > pathprefix , Cmd_Argv ( 1 ) , sizeof ( info - > pathprefix ) ) ;
2016-08-25 00:12:14 +00:00
if ( ! * info - > pathprefix | | ! loadedinstalled )
PM_UpdatePackageList ( false , true ) ;
2006-01-28 06:41:20 +00:00
2018-10-11 10:31:23 +00:00
info - > populated = false ; //will add any headers as needed
2016-08-25 00:12:14 +00:00
}
2005-04-16 16:22:17 +00:00
2016-08-25 00:12:14 +00:00
//should only be called AFTER the filesystem etc is inited.
void Menu_Download_Update ( void )
{
2019-06-17 04:21:41 +00:00
if ( ! pkg_autoupdate . ival )
2016-08-25 00:12:14 +00:00
return ;
PM_UpdatePackageList ( true , 2 ) ;
2005-04-16 16:22:17 +00:00
}
2012-11-27 03:23:19 +00:00
# else
2016-12-13 11:50:15 +00:00
void Menu_Download_Update ( void )
{
2019-03-23 07:06:37 +00:00
# ifdef PACKAGEMANAGER
PM_UpdatePackageList ( true , 2 ) ;
# endif
2016-12-13 11:50:15 +00:00
}
2013-06-23 02:17:02 +00:00
void Menu_DownloadStuff_f ( void )
2012-11-27 03:23:19 +00:00
{
2013-06-23 02:17:02 +00:00
Con_Printf ( " Download menu not implemented in this build \n " ) ;
2012-11-27 03:23:19 +00:00
}
# endif