Embed some basic metadata into plugins. Still needs signatures.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6067 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2021-10-05 05:05:22 +00:00
parent b91273a930
commit ca999f6eb4
5 changed files with 141 additions and 91 deletions

View file

@ -62,7 +62,8 @@ IF (EXISTS ${CMAKE_SOURCE_DIR}/.git)
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
MESSAGE(STATUS "FTE GIT ${FTE_BRANCH} Revision git-${FTE_REVISON_GIT}, ${FTE_DATE}")
SET(FTE_REVISON SVNREVISION=git-${FTE_REVISON_GIT} SVNDATE=${FTE_DATE} FTE_BRANCH=${FTE_BRANCH})
SET(SVNREVISION git-${FTE_REVISON_GIT})
SET(FTE_REVISON SVNREVISION=${SVNREVISION} SVNDATE=${FTE_DATE} FTE_BRANCH=${FTE_BRANCH})
ENDIF()
#plugins need visibility hidden in order to avoid conflicts with function names that match the engine.
@ -212,6 +213,21 @@ IF(CMAKE_BUILD_TYPE MATCHES "Debug")
ENDIF()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FILE_OFFSET_BITS=64")
FUNCTION(EMBED_PLUGIN_META PLUGNAME PLUGTITLE PLUGDESC)
SET_TARGET_PROPERTIES(plug_${PLUGNAME} PROPERTIES OUTPUT_NAME "${PLUGNAME}")
SET_TARGET_PROPERTIES(plug_${PLUGNAME} PROPERTIES PREFIX "fteplug_")
SET_TARGET_PROPERTIES(plug_${PLUGNAME} PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
SET(INSTALLTARGS ${INSTALLTARGS} "plug_${PLUGNAME}")
#sadly we need to use a temp zip file, because otherwise zip insists on using zip64 extensions which breaks zip -A (as well as any attempts to read any files).
ADD_CUSTOM_COMMAND(
TARGET plug_${PLUGNAME} POST_BUILD
COMMAND echo "{\\n package fteplug_${PLUGNAME}\\n ver \"${SVNREVISION}\"\\n category Plugins\\n title \"${PLUGTITLE}\"\\n gamedir \"\"\\n desc \"${PLUGDESC}\"\\n}" | zip -q -9 -fz- $<TARGET_FILE:plug_${PLUGNAME}>.zip -
COMMAND cat $<TARGET_FILE:plug_${PLUGNAME}>.zip >> "$<TARGET_FILE:plug_${PLUGNAME}>"
COMMAND zip -A "$<TARGET_FILE:plug_${PLUGNAME}>"
COMMAND rm $<TARGET_FILE:plug_${PLUGNAME}>.zip
VERBATIM)
ENDFUNCTION()
IF(${ANDROID})
# FIND_PACKAGE(Freetype REQUIRED)
@ -799,11 +815,9 @@ ELSE()
)
TARGET_INCLUDE_DIRECTORIES(plug_bullet PUBLIC ${BULLET_INCLUDE_DIRS})
SET_TARGET_PROPERTIES(plug_bullet PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;${FTE_LIB_DEFINES}")
SET_TARGET_PROPERTIES(plug_bullet PROPERTIES OUTPUT_NAME "bullet")
SET_TARGET_PROPERTIES(plug_bullet PROPERTIES PREFIX "fteplug_")
SET_TARGET_PROPERTIES(plug_bullet PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
TARGET_LINK_LIBRARIES(plug_bullet ${SYS_LIBS} ${BULLET_LIBRARIES})
SET(INSTALLTARGS ${INSTALLTARGS} plug_bullet)
EMBED_PLUGIN_META(bullet "Bullet Physics Plugin" "Provides Rigid Body Physics.")
ELSE()
MESSAGE(WARNING "bullet library not detected, skipping plugin")
ENDIF()
@ -1051,10 +1065,9 @@ IF(0)
engine/sw/sw_spans.h
)
SET_TARGET_PROPERTIES(sw PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;${FTE_LIB_DEFINES};SWQUAKE")
SET_TARGET_PROPERTIES(sw PROPERTIES PREFIX "fteplug_")
SET_TARGET_PROPERTIES(sw PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
TARGET_LINK_LIBRARIES(sw ${SYS_LIBS})
SET(INSTALLTARGS ${INSTALLTARGS} sw)
EMBED_PLUGIN_META(sw "Software Renderer" "Provides software rendering. Slow.")
ENDIF()
#Quake Injector Alike plugin
@ -1067,11 +1080,9 @@ IF(FTE_PLUG_QI)
plugins/jabber/xml.c
)
SET_TARGET_PROPERTIES(plug_qi PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;${FTE_LIB_DEFINES}")
SET_TARGET_PROPERTIES(plug_qi PROPERTIES OUTPUT_NAME "qi")
SET_TARGET_PROPERTIES(plug_qi PROPERTIES PREFIX "fteplug_")
SET_TARGET_PROPERTIES(plug_qi PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
TARGET_LINK_LIBRARIES(plug_qi ${SYS_LIBS})
SET(INSTALLTARGS ${INSTALLTARGS} plug_qi)
EMBED_PLUGIN_META(qi "Quaddicted Map Database" "Provides easy access to the quaddicted map database. Once installed you can use eg 'map qi_dopa:start' to begin playing dopa, or load it via the menus.")
ENDIF()
SET(FTE_PLUG_OPENSSL false CACHE BOOL "Compile OpenSSL (beware license).")
@ -1094,11 +1105,9 @@ IF(FTE_PLUG_OPENSSL)
plugins/net_ssl_openssl.c
)
SET_TARGET_PROPERTIES(plug_openssl PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;${FTE_LIB_DEFINES}")
SET_TARGET_PROPERTIES(plug_openssl PROPERTIES OUTPUT_NAME "openssl")
SET_TARGET_PROPERTIES(plug_openssl PROPERTIES PREFIX "fteplug_")
SET_TARGET_PROPERTIES(plug_openssl PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
TARGET_LINK_LIBRARIES(plug_openssl ${SYS_LIBS} ${OPENSSL_LIBRARIES})
SET(INSTALLTARGS ${INSTALLTARGS} plug_openssl)
EMBED_PLUGIN_META(openssl "OpenSSL" "Provides OpenSSL support for dtls/tls/https support. The crypto library that is actually used is controlled via the tls_provider cvar.")
ENDIF()
ENDIF()
@ -1117,11 +1126,9 @@ IF(FTE_PLUG_ODE)
)
TARGET_INCLUDE_DIRECTORIES(plug_ode PUBLIC ${ODE_INCLUDE_DIRS})
SET_TARGET_PROPERTIES(plug_ode PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;ODE_STATIC")
SET_TARGET_PROPERTIES(plug_ode PROPERTIES OUTPUT_NAME "ode")
SET_TARGET_PROPERTIES(plug_ode PROPERTIES PREFIX "fteplug_")
SET_TARGET_PROPERTIES(plug_ode PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
TARGET_LINK_LIBRARIES(plug_ode ${SYS_LIBS} ${LIBODE_LIBRARY})
SET(INSTALLTARGS ${INSTALLTARGS} plug_ode)
EMBED_PLUGIN_META(ode "ODE Physics" "Provides Rigid Body Physics behaviours.")
ELSE()
MESSAGE(WARNING "ODE library not found, no ode plugin for you")
ENDIF()
@ -1138,11 +1145,9 @@ IF(FTE_PLUG_EZHUD)
plugins/ezhud/hud_editor.c
)
SET_TARGET_PROPERTIES(plug_ezhud PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;${FTE_LIB_DEFINES}")
SET_TARGET_PROPERTIES(plug_ezhud PROPERTIES OUTPUT_NAME "ezhud")
SET_TARGET_PROPERTIES(plug_ezhud PROPERTIES PREFIX "fteplug_")
SET_TARGET_PROPERTIES(plug_ezhud PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
TARGET_LINK_LIBRARIES(plug_ezhud ${SYS_LIBS})
SET(INSTALLTARGS ${INSTALLTARGS} plug_ezhud)
EMBED_PLUGIN_META(ezhud "EzHud Plugin" "Provides compat with ezquake's hud scripts.")
ENDIF()
#NameMaker string generation plugin
@ -1158,6 +1163,8 @@ IF(FTE_PLUG_NAMEMAKER)
SET_TARGET_PROPERTIES(plug_namemaker PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
TARGET_LINK_LIBRARIES(plug_namemaker ${SYS_LIBS})
SET(INSTALLTARGS ${INSTALLTARGS} plug_namemaker)
EMBED_PLUGIN_META(namemaker "Name Maker Plugin" "Provides a lame UI for selecting arbitrary non-ascii glyphs as part of your nickname.")
ENDIF()
#Terrain Generation plugin
@ -1168,11 +1175,9 @@ IF(FTE_PLUG_TERRAINGEN)
plugins/terrorgen/terragen.c
)
SET_TARGET_PROPERTIES(plug_terraingen PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;${FTE_LIB_DEFINES}")
SET_TARGET_PROPERTIES(plug_terraingen PROPERTIES OUTPUT_NAME "terragen")
SET_TARGET_PROPERTIES(plug_terraingen PROPERTIES PREFIX "fteplug_")
SET_TARGET_PROPERTIES(plug_terraingen PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
TARGET_LINK_LIBRARIES(plug_terraingen ${SYS_LIBS})
SET(INSTALLTARGS ${INSTALLTARGS} plug_terraingen)
EMBED_PLUGIN_META(terraingen "TerrainGen Plugin" "A lame example plugin for randomised terrain generation.")
ENDIF()
#IRC client plugin
@ -1183,11 +1188,9 @@ IF(FTE_PLUG_IRC)
plugins/irc/ircclient.c
)
SET_TARGET_PROPERTIES(plug_irc PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;${FTE_REVISON};${FTE_LIB_DEFINES}")
SET_TARGET_PROPERTIES(plug_irc PROPERTIES OUTPUT_NAME "irc")
SET_TARGET_PROPERTIES(plug_irc PROPERTIES PREFIX "fteplug_")
SET_TARGET_PROPERTIES(plug_irc PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
TARGET_LINK_LIBRARIES(plug_irc ${SYS_LIBS})
SET(INSTALLTARGS ${INSTALLTARGS} plug_irc)
EMBED_PLUGIN_META(irc "IRC Plugin" "Allows you to chat on IRC without tabbing out.")
ENDIF()
#mpq package format plugin (blizzard games)
@ -1199,11 +1202,9 @@ IF(FTE_PLUG_MPQ)
plugins/mpq/fs_mpq.c
)
SET_TARGET_PROPERTIES(plug_mpq PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;${FTE_LIB_DEFINES}")
SET_TARGET_PROPERTIES(plug_mpq PROPERTIES OUTPUT_NAME "mpq")
SET_TARGET_PROPERTIES(plug_mpq PROPERTIES PREFIX "fteplug_")
SET_TARGET_PROPERTIES(plug_mpq PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
TARGET_LINK_LIBRARIES(plug_mpq ${SYS_LIBS} ${ZLIB_LIBRARIES})
SET(INSTALLTARGS ${INSTALLTARGS} plug_mpq)
EMBED_PLUGIN_META(irc "MPQ Archive Plugin" "Adds support for reading .mpq files. Not very useful...")
ENDIF()
#model formats plugin
@ -1216,11 +1217,9 @@ IF(FTE_PLUG_MODELS)
plugins/models/exportiqm.c
)
SET_TARGET_PROPERTIES(plug_models PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;${FTE_LIB_DEFINES}")
SET_TARGET_PROPERTIES(plug_models PROPERTIES OUTPUT_NAME "models")
SET_TARGET_PROPERTIES(plug_models PROPERTIES PREFIX "fteplug_")
SET_TARGET_PROPERTIES(plug_models PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
TARGET_LINK_LIBRARIES(plug_models ${SYS_LIBS})
SET(INSTALLTARGS ${INSTALLTARGS} plug_models)
EMBED_PLUGIN_META(models "Models Plugin" "Kinda redundant now that the engine has gltf2 loading.")
ENDIF()
SET(FTE_PLUG_X11SV false CACHE BOOL "Compile x11 server plugin.")
@ -1235,11 +1234,9 @@ IF(FTE_PLUG_X11SV)
engine/qclib/hash.c
)
SET_TARGET_PROPERTIES(plug_x11sv PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;${FTE_LIB_DEFINES}")
SET_TARGET_PROPERTIES(plug_x11sv PROPERTIES OUTPUT_NAME "x11sv")
SET_TARGET_PROPERTIES(plug_x11sv PROPERTIES PREFIX "fteplug_")
SET_TARGET_PROPERTIES(plug_x11sv PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
TARGET_LINK_LIBRARIES(plug_x11sv ${SYS_LIBS})
SET(INSTALLTARGS ${INSTALLTARGS} plug_x11sv)
EMBED_PLUGIN_META(x11sv "X11 Server Plugin" "Provides a primitive X11 server in the form of a video decoder plugin.")
ENDIF()
#ffmpeg client plugin. no proper way to detect dependancies right now, so I've gotta try the manual way.
@ -1262,12 +1259,10 @@ IF(FTE_PLUG_FFMPEG)
plugins/avplug/avencode.c
)
TARGET_INCLUDE_DIRECTORIES(plug_ffmpeg PUBLIC ${AVCODEC_INCLUDE_DIR} ${AVFORMAT_INCLUDE_DIR} ${AVUTIL_INCLUDE_DIR} ${AVSWSCALE_INCLUDE_DIR})
SET_TARGET_PROPERTIES(plug_ffmpeg PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
TARGET_LINK_LIBRARIES(plug_ffmpeg ${SYS_LIBS} ${AVFORMAT_LIBRARY} ${AVCODEC_LIBRARY} ${AVUTIL_LIBRARY} ${AVSWSCALE_LIBRARY})
SET_TARGET_PROPERTIES(plug_ffmpeg PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;${FTE_LIB_DEFINES}")
SET_TARGET_PROPERTIES(plug_ffmpeg PROPERTIES OUTPUT_NAME "ffmpeg")
SET_TARGET_PROPERTIES(plug_ffmpeg PROPERTIES PREFIX "fteplug_")
SET(INSTALLTARGS ${INSTALLTARGS} plug_ffmpeg)
EMBED_PLUGIN_META(ffmpeg "FFMPEG Video Decoding Plugin" "Provides support for more audio formats, as well as video playback and better capture support.")
ELSE()
MESSAGE(WARNING "ffmpeg library NOT available. Quake shouldn't be playing fmv anyway.")
ENDIF()
@ -1285,12 +1280,10 @@ IF(FTE_PLUG_TIMIDITY)
plugins/timidity.c
)
TARGET_INCLUDE_DIRECTORIES(plug_timidity PUBLIC ${TIMIDITY_INCLUDE_DIR})
SET_TARGET_PROPERTIES(plug_timidity PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
TARGET_LINK_LIBRARIES(plug_timidity ${SYS_LIBS} ${TIMIDITY_LIBRARY})
SET_TARGET_PROPERTIES(plug_timidity PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;${FTE_LIB_DEFINES}")
SET_TARGET_PROPERTIES(plug_timidity PROPERTIES OUTPUT_NAME "timidity")
SET_TARGET_PROPERTIES(plug_timidity PROPERTIES PREFIX "fteplug_")
SET(INSTALLTARGS ${INSTALLTARGS} plug_timidity)
EMBED_PLUGIN_META(timidity "Timidity Plugin" "Provides support for playback of midi files.")
ELSE()
MESSAGE(WARNING "timidity library NOT available. We'll just stick to fake-cd music for hexen2.")
ENDIF()
@ -1311,9 +1304,6 @@ IF(FTE_PLUG_OPENXR)
)
TARGET_INCLUDE_DIRECTORIES(plug_openxr PRIVATE ${OPENXR_INCLUDE_DIRS} )
SET_TARGET_PROPERTIES(plug_openxr PROPERTIES OUTPUT_NAME "openxr")
SET_TARGET_PROPERTIES(plug_openxr PROPERTIES PREFIX "fteplug_")
SET_TARGET_PROPERTIES(plug_openxr PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
IF (1) #dynamically link
SET_TARGET_PROPERTIES(plug_openxr PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;${FTE_LIB_DEFINES};${FTE_DEFINES};XR_NO_PROTOTYPES")
TARGET_LINK_LIBRARIES(plug_openxr ${SYS_LIBS})
@ -1321,7 +1311,8 @@ IF(FTE_PLUG_OPENXR)
SET_TARGET_PROPERTIES(plug_openxr PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;${FTE_LIB_DEFINES};${FTE_DEFINES}")
TARGET_LINK_LIBRARIES(plug_openxr ${SYS_LIBS} ${OPENXR_LIBRARIES})
ENDIF()
SET(INSTALLTARGS ${INSTALLTARGS} plug_openxr)
EMBED_PLUGIN_META(openxr "OpenXR Plugin" "Provides support for Virtual Reality headsets and input devices.")
ELSE()
MESSAGE(WARNING "openxr library NOT available. Quake is already a reality anyway.")
ENDIF()
@ -1402,9 +1393,7 @@ IF(FTE_PLUG_CEF)
ENDIF()
ENDIF()
SET_TARGET_PROPERTIES(plug_cef PROPERTIES PREFIX "fteplug_")
SET_TARGET_PROPERTIES(plug_cef PROPERTIES OUTPUT_NAME "cef")
SET_TARGET_PROPERTIES(plug_cef PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
EMBED_PLUGIN_META(cef "libcef(Browser) Plugin" "This plugin provides support for an in-game web browser.")
ELSE()
MESSAGE(WARNING "libcef library NOT available. no web browser support on walls.")
ENDIF()
@ -1425,14 +1414,12 @@ IF(FTE_PLUG_XMPP)
plugins/emailnot/md5.c
)
SET_TARGET_PROPERTIES(plug_xmpp PROPERTIES COMPILE_DEFINITIONS "FTEPLUGIN;${FTE_LIB_DEFINES}")
SET_TARGET_PROPERTIES(plug_xmpp PROPERTIES OUTPUT_NAME "xmpp")
SET_TARGET_PROPERTIES(plug_xmpp PROPERTIES PREFIX "fteplug_")
SET_TARGET_PROPERTIES(plug_xmpp PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
IF(${WIN32})
ELSE()
TARGET_LINK_LIBRARIES(plug_xmpp ${SYS_LIBS} resolv)
ENDIF()
SET(INSTALLTARGS ${INSTALLTARGS} plug_xmpp)
EMBED_PLUGIN_META(xmpp "XMPP Plugin" "XMPP/Jabber instant messenger plugin for chatting without tabbing out.")
ENDIF()
ENDIF() #android

View file

@ -52,12 +52,18 @@ ifeq ($(SVNREVISION),)
SVN_VERSION:=$(shell test -d $(BASE_DIR)/../.svn && svnversion $(BASE_DIR))
SVN_DATE:=$(shell test -d $(BASE_DIR)/../.svn && cd $(BASE_DIR) && svn info --show-item last-changed-date --no-newline)
ifeq (,$(SVN_VERSION))
#try to get git version info instead.
SVN_VERSION:=$(shell test -d $(BASE_DIR)/../.git && cd $(BASE_DIR) && git describe --long --always --dirty)
#grab the svn version from git-svn (assuming no other modifications). this fails when there's extra commits (probably a good thing).
SVN_VERSION=$(shell test -d $(BASE_DIR)/../.git && git svn find-rev `git rev-parse HEAD`)
SVN_DATE:=$(shell test -d $(BASE_DIR)/../.git && git log -1 --format=%cs $(BASE_DIR))
endif
ifeq (,$(SVN_VERSION))
#try to get git version info instead. this usually uses git-count-hash[-dirty] format
SVN_VERSION:=$(shell test -d $(BASE_DIR)/../.git && cd $(BASE_DIR) && echo $$((`git rev-list HEAD --count` + 29)))
GIT_VERSION:=$(shell test -d $(BASE_DIR)/../.git && cd $(BASE_DIR) && git describe --long --always --dirty)
SVN_DATE:=$(shell test -d $(BASE_DIR)/../.git && git log -1 --format=%cs $(BASE_DIR))
ifneq (,$(SVN_VERSION))
#make sure its prefixed with something specific. we use versions for versioning, which will confuse the update mechanism if they're inconsistent - like random hashses that have no implied ordering...
SVN_VERSION:=git-$(SVN_VERSION)
SVN_VERSION:=git-$(SVN_VERSION)-$(GIT_VERSION)
endif
endif
@ -69,7 +75,7 @@ ifneq (M,$(findstring M,$(SVN_VERSION)))
SVNREVISION+=-DSVNDATE=$(SVN_DATE)
endif
endif
MAKE:=$(MAKE) --no-print-directory SVNREVISION="$(SVNREVISION)"
MAKE:=$(MAKE) --no-print-directory SVNREVISION="$(SVNREVISION)" SVN_VERSION="$(SVN_VERSION)"
#WHOAMI:=$(shell whoami)

View file

@ -131,7 +131,7 @@ typedef struct package_s {
char *mirror[MAXMIRRORS]; //FIXME: move to two types of dep...
char gamedir[16];
enum fs_relative fsroot; //FS_BINARYPATH or FS_ROOT _ONLY_
char version[16];
char version[24];
char *arch;
char *qhash;
char *packprefix; //extra weirdness to skip embedded gamedirs or force extra maps/ nesting
@ -1241,7 +1241,7 @@ static const char *PM_ParsePackage(struct packagesourceinfo_s *source, const cha
Z_StrDupPtr(&p->signature, val);
else
{
Con_DPrintf("Unknown package property\n");
Con_DPrintf("Unknown package property \"%s\"\n", key);
}
}
@ -1693,7 +1693,7 @@ static qboolean QDECL Host_StubClose (struct vfsfile_s *file)
{
return true;
}
static char *PM_GetMetaTextFromFile(vfsfile_t *file, char *filename, char *qhash, size_t hashsize) //seeks, but does not close.
static char *PM_GetMetaTextFromFile(vfsfile_t *file, const char *filename, char *qhash, size_t hashsize) //seeks, but does not close.
{
qboolean (QDECL *OriginalClose) (struct vfsfile_s *file) = file->Close; //evilness
searchpathfuncs_t *archive;
@ -1708,6 +1708,8 @@ static char *PM_GetMetaTextFromFile(vfsfile_t *file, char *filename, char *qhash
vfsfile_t *metafile = NULL;
if (archive->FindFile(archive, &loc, "fte.meta", NULL))
metafile = archive->OpenVFS(archive, &loc, "rb");
else if (archive->FindFile(archive, &loc, "-", NULL)) //lame.
metafile = archive->OpenVFS(archive, &loc, "rb");
if (metafile)
{
size_t sz = VFS_GETLEN(metafile);
@ -1800,23 +1802,32 @@ static qboolean PM_FileInstalled_Internal(const char *package, const char *categ
{
p = Z_Malloc(sizeof(*p));
p->priority = PM_DEFAULTPRIORITY;
p->fsroot = fsroot;
strcpy(p->version, "?" "?" "?" "?");
}
p->deps = Z_Malloc(sizeof(*p->deps) + strlen(filename));
p->deps->dtype = DEP_FILE;
strcpy(p->deps->name, filename);
p->fsroot = fsroot;
if (pkgflags&DPF_PLUGIN)
p->arch = Z_StrDup(THISARCH);
{
if (strcmp(p->version, STRINGIFY(SVNREVISION)))
enable = false;
if (!p->arch)
p->arch = Z_StrDup(THISARCH);
Z_Free(p->qhash); //don't get confused.
p->qhash = NULL;
}
else
pkgflags |= DPF_FORGETONUNINSTALL;
if (!p->name || !*p->name)
p->name = Z_StrDup(package);
if (!p->title || !*p->title)
p->title = Z_StrDup(title);
if (!p->category || !*p->category)
p->category = Z_StrDup(category);
p->flags = pkgflags|DPF_NATIVE|DPF_FORGETONUNINSTALL;
p->flags = pkgflags|DPF_NATIVE;
if (enable)
p->flags |= DPF_USERMARKED|DPF_ENABLED;
@ -1852,6 +1863,8 @@ static int QDECL PM_EnumeratedPlugin (const char *name, qofs_t size, time_t mtim
int len, l, a;
char *dot;
char *pkgname;
char *metainfo = NULL;
vfsfile_t *f;
if (!strncmp(name, PLUGINPREFIX, strlen(PLUGINPREFIX)))
Q_strncpyz(vmname, name+strlen(PLUGINPREFIX), sizeof(vmname));
else
@ -1904,7 +1917,16 @@ static int QDECL PM_EnumeratedPlugin (const char *name, qofs_t size, time_t mtim
return true; //don't include it if its a dupe anyway.
//FIXME: should be checking whether there's a package that provides the file...
return PM_FileInstalled_Internal(pkgname, "Plugins/", vmname, name, FS_BINARYPATH, DPF_PLUGIN, NULL,
f = FS_OpenVFS(name, "rb", FS_BINARYPATH);
if (f)
{
char qhash[16];
metainfo = PM_GetMetaTextFromFile(f, name, qhash, sizeof(qhash));
VFS_CLOSE(f);
}
return PM_FileInstalled_Internal(pkgname, "Plugins/", vmname, name, FS_BINARYPATH, DPF_PLUGIN|DPF_SIGNATUREACCEPTED, metainfo,
#ifdef ENABLEPLUGINSBYDEFAULT
true
#else
@ -1956,10 +1978,13 @@ static void PM_PreparePackageList(void)
//make sure our sources are okay.
if (fs_manifest && fs_manifest->downloadsurl && *fs_manifest->downloadsurl)
{
unsigned int fl = SRCFL_MANIFEST;
char *s = fs_manifest->downloadsurl;
if (fs_manifest->security==MANIFEST_SECURITY_NOT)
PM_AddSubList(fs_manifest->downloadsurl, NULL, SRCFL_MANIFEST|SRCFL_DISABLED); //don't trust it, don't even prompt.
else
PM_AddSubList(fs_manifest->downloadsurl, NULL, SRCFL_MANIFEST); //enable it by default. functionality is kinda broken otherwise.
fl |= SRCFL_DISABLED; //don't trust it, don't even prompt.
while ((s = COM_Parse(s)))
PM_AddSubList(com_token, NULL, SRCFL_MANIFEST); //enable it by default. functionality is kinda broken otherwise.
}
#ifdef PLUGINS
@ -2682,16 +2707,24 @@ static void PM_ListDownloaded(struct dl_download *dl)
static void PM_Plugin_Source_Finished(void *ctx, vfsfile_t *f)
{
struct pm_source_s *src = ctx;
COM_AssertMainThread("PM_Plugin_Source_Finished");
if (!src->curdl)
size_t idx = src-pm_source;
if (idx < pm_numsources && ctx == &pm_source[idx])
{
struct dl_download dl;
dl.file = f;
dl.status = DL_FINISHED;
dl.user_num = src-pm_source;
dl.url = src->url;
src->curdl = &dl;
PM_ListDownloaded(&dl);
COM_AssertMainThread("PM_Plugin_Source_Finished");
if (!src->curdl)
{
struct dl_download dl;
dl.file = f;
dl.status = DL_FINISHED;
dl.user_num = src-pm_source;
dl.url = src->url;
src->curdl = &dl;
PM_ListDownloaded(&dl);
}
}
else
{
Con_Printf("PM_Plugin_Source_Finished: stale\n");
}
VFS_CLOSE(f);
}

View file

@ -654,8 +654,9 @@ static qboolean FS_Manifest_ParseTokens(ftemanifest_t *man)
#ifdef PACKAGEMANAGER
else if (!Q_strcasecmp(cmd, "downloadsurl"))
{
Z_Free(man->downloadsurl);
man->downloadsurl = Z_StrDup(Cmd_Argv(1));
if (man->downloadsurl)
Z_StrCat(&man->downloadsurl, " ");
Z_StrCat(&man->downloadsurl, Cmd_Argv(1));
}
else if (!Q_strcasecmp(cmd, "install"))
{
@ -7281,6 +7282,8 @@ void FS_RegisterDefaultFileSystems(void)
FS_RegisterFileSystemType(NULL, "apk", FSZIP_LoadArchive, false); //android package
FS_RegisterFileSystemType(NULL, "zip", FSZIP_LoadArchive, false); //regular zip file (don't automatically read from these, because it gets messy)
FS_RegisterFileSystemType(NULL, "exe", FSZIP_LoadArchive, false); //for self-extracting zips.
FS_RegisterFileSystemType(NULL, "dll", FSZIP_LoadArchive, false); //for plugin metas / self-extracting zips.
FS_RegisterFileSystemType(NULL, "so", FSZIP_LoadArchive, false); //for plugin metas / self-extracting zips.
#endif
#ifdef PACKAGE_VPK
FS_RegisterFileSystemType(NULL, "vpk", FSVPK_LoadArchive, true);

View file

@ -112,6 +112,14 @@ PLUG_LDFLAGS:=-L../engine/libs-$(ARCH) $(PLUG_LDFLAGS)
PLUG_CFLAGS:=-I../engine/libs-$(ARCH) $(PLUG_CFLAGS)
PLUG_CXXFLAGS:=-I../engine/libs-$(ARCH) $(PLUG_CXXFLAGS)
#$1 is the plugin name, $2 is its filename, $3 is title, $4 is description
define EMBEDMETA
@echo "{\\n package fteplug_$1\\n ver \"${SVN_VERSION}\"\\n category Plugins\\n title \"$3\"\\n gamedir \"\"\\n desc \"$4\"\\n}" | zip -q -9 -fz- $2.metazip -
@cat $2.metazip >> $2
@zip -q -A $2
@rm $2.metazip
endef
#legacy build rule, now equivelent to all
native: all
@ -221,11 +229,13 @@ distclean:
$(PLUG_PREFIX)ffmpeg$(PLUG_NATIVE_EXT): $(AV_DEP) $(AVPLUG_OBJS)
$(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -s -o $@ -shared $(PLUG_CFLAGS) $(AV_CFLAGS) $(AVPLUG_OBJS) $(PLUG_DEFFILE) $(PLUG_LDFLAGS) $(AV_LDFLAGS)
$(call EMBEDMETA,ffmpeg,$@,FFMPEG Video Decoding Plugin,Provides support for more audio formats as well as video playback and better capture support.)
else # NIX
$(PLUG_PREFIX)ffmpeg$(PLUG_NATIVE_EXT):
$(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -s -o $@ -shared $(PLUG_CFLAGS) $(AV_CFLAGS) $(AVPLUG_OBJS) $(PLUG_DEFFILE) $(PLUG_LDFLAGS) $(AV_LDFLAGS)
$(call EMBEDMETA,ffmpeg,$@,FFMPEG Video Decoding Plugin,Provides support for more audio formats as well as video playback and better capture support.)
endif
######################################
@ -252,6 +262,7 @@ $(ODE_LIB): $(OUT_DIR)/../ode-$(ODE_VER).tar.gz
ODE_FILES=../engine/common/com_phys_ode.c ../engine/common/mathlib.c plugin.c $(ODE_LIB)
$(PLUG_PREFIX)ode$(PLUG_NATIVE_EXT): $(ODE_FILES)
$(CC) -flto -s $(BASE_CFLAGS) $(CFLAGS) -Os -DFTEPLUGIN -DODE_STATIC -o $@ -shared $(PLUG_CFLAGS) -I$(ODE_BASE)ode-$(ODE_VER)/include $(ODE_FILES) $(PLUG_DEFFILE) $(PLUG_LDFLAGS) -static-libgcc `$(CC) -print-file-name=libstdc++.a` -lpthread
$(call EMBEDMETA,ode,$@,ODE Physics,Provides Rigid Body Physics behaviours.)
#NATIVE_PLUGINS+=ode
######################################
@ -297,6 +308,7 @@ $(BULLET_LIB): $(OUT_DIR)/../bullet3-$(BULLET_VER).tar.gz $(CMAKERULES)
$(PLUG_PREFIX)bullet$(PLUG_NATIVE_EXT): bullet/bulletplug.cpp plugin.c $(BULLET_LIBS)
$(CXX) $(BASE_CXXFLAGS) $(CFLAGS) -DFTEPLUGIN -o $@ -shared $(PLUG_CFLAGS) $^ $(PLUG_DEFFILE) $(PLUG_LDFLAGS) $(BULLET_CFLAGS)
$(call EMBEDMETA,bullet,$@,Bullet Physics Plugin,Provides Rigid Body Physics.)
#NATIVE_PLUGINS+=bullet
######################################
@ -312,10 +324,10 @@ ifeq ($(FTE_TARGET),win64)
CEF_ARCH=windows64
endif
ifeq ($(FTE_TARGET),linux32)
#CEF_ARCH=linux32
CEF_ARCH=linux32
endif
ifeq ($(FTE_TARGET),linux64)
#CEF_ARCH=linux64
CEF_ARCH=linux64
endif
#ifeq ($(FTE_TARGET),macosx64)
#CEF_ARCH=macosx64
@ -337,11 +349,12 @@ $(OUT_DIR)/cef_$(CEF_VER).zip: cef/$(CEF_NAME)/rel.zip
CEF_SOURCES=cef/cef.c plugin.c
$(PLUG_PREFIX)cef$(PLUG_NATIVE_EXT): $(CEF_SOURCES) $(OUT_DIR)/cef_$(CEF_VER).zip cef/$(CEF_NAME)/include/cef_version.h
$(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -o $(PLUG_PREFIX)cef$(PLUG_NATIVE_EXT) -shared $(PLUG_CFLAGS) -Icef/$(CEF_NAME) $(CEF_SOURCES) $(PLUG_DEFFILE) $(PLUG_LDFLAGS) -Wl,-rpath,. $(PLUG_LDFLAGS_DL)
$(call EMBEDMETA,cef,$@,libcef Browser Plugin,This plugin provides support for an in-game web browser.)
#NATIVE_PLUGINS+=cef
else
.PHONEY: $(PLUG_PREFIX)cef$(PLUG_NATIVE_EXT)
$(PLUG_PREFIX)cef$(PLUG_NATIVE_EXT):
echo cef plugin not supported on this arch
echo cef plugin not supported on this arch - $(FTE_TARGET) - $(CEF_ARCH)
endif
######################################
@ -352,25 +365,30 @@ endif
$(PLUG_PREFIX)mpq$(PLUG_NATIVE_EXT): mpq/fs_mpq.c mpq/blast.c plugin.c
$(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -o $@ -shared $(PLUG_CFLAGS) -Impq $^ $(PLUG_DEFFILE) $(PLUG_LDFLAGS_ZLIB) $(PLUG_LDFLAGS)
$(call EMBEDMETA,mpq,$@)
NATIVE_PLUGINS+=mpq
$(PLUG_PREFIX)xmpp$(PLUG_NATIVE_EXT): jabber/jabberclient.c jabber/jingle.c jabber/sift.c jabber/xml.c plugin.c ../engine/common/sha1.c ../engine/common/sha2.c emailnot/md5.c
$(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -o $@ -shared $(PLUG_CFLAGS) -Ijabber $^ $(PLUG_DEFFILE) $(PLUG_LDFLAGS) $(LIBRESOLV)
$(call EMBEDMETA,xmpp,$@)
NATIVE_PLUGINS+=xmpp
$(PLUG_PREFIX)qi$(PLUG_NATIVE_EXT): qi/qi.c jabber/xml.c plugin.c
$(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -o $@ -shared $(PLUG_CFLAGS) -Ijabber $^ $(PLUG_DEFFILE) $(PLUG_LDFLAGS)
$(call EMBEDMETA,qi,$@)
NATIVE_PLUGINS+=qi
$(PLUG_PREFIX)irc$(PLUG_NATIVE_EXT): irc/ircclient.c plugin.c
$(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -o $@ -shared $(PLUG_CFLAGS) -Iirc $^ $(PLUG_DEFFILE) $(PLUG_LDFLAGS)
$(call EMBEDMETA,irc,$@)
NATIVE_PLUGINS+=irc
#OpenXR plugin...
$(PLUG_PREFIX)openxr$(PLUG_NATIVE_EXT): openxr.c plugin.c
$(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -o $@ -shared $(PLUG_CFLAGS) $^ $(PLUG_DEFFILE) $(PLUG_LDFLAGS) -DXR_NO_PROTOTYPES `$(PKGCONFIG) --cflags openxr` -DGLQUAKE -DVKQUAKE -DD3D11QUAKE
$(call EMBEDMETA,openxr,$@)
ifeq ($(shell $(PKGCONFIG) --exists openxr && echo 1),1)
NATIVE_PLUGINS+=openxr
endif
@ -378,16 +396,19 @@ endif
#for compat with ezquake
$(PLUG_PREFIX)ezhud$(PLUG_NATIVE_EXT): ezhud/ezquakeisms.c ezhud/hud.c ezhud/hud_common.c ezhud/hud_editor.c plugin.c
$(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -o $@ -shared $(PLUG_CFLAGS) -Iezhud $^ $(PLUG_DEFFILE) $(PLUG_LDFLAGS)
$(call EMBEDMETA,ezhud,$@,EzHud Plugin,Provides compat with ezquake's hud scripts.)
NATIVE_PLUGINS+=ezhud
#not really relevant now that gltf was made an internal plugin
$(PLUG_PREFIX)models$(PLUG_NATIVE_EXT): models/gltf.c models/exportiqm.c models/models.c plugin.c
$(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -o $@ -shared $(PLUG_CFLAGS) -Imodels $^ $(PLUG_DEFFILE) $(PLUG_LDFLAGS)
$(call EMBEDMETA,models,$@,Models Plugin,Kinda redundant now that the engine has gltf2 loading)
#NATIVE_PLUGINS+=models
#Openssl crypto plugin, to replace microsoft's shoddy dtls implementation. could also be useful on the BSDs, yay system components?
$(PLUG_PREFIX)openssl$(PLUG_NATIVE_EXT): net_ssl_openssl.c plugin.c
$(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -o $@ -shared $(PLUG_CFLAGS) $^ $(PLUG_DEFFILE) $(PLUG_LDFLAGS) `$(PKGCONFIG) --libs --cflags openssl`
$(call EMBEDMETA,openssl,$@,OpenSSL,Provides OpenSSL support for dtls/tls/https support. The crypto library that is actually used is controlled via the tls_provider cvar.)
#ifeq ($(shell $(PKGCONFIG) --exists openssl && echo 1),1)
#Disabled due to licensing issues #NATIVE_PLUGINS+=openssl
#endif