2004-09-24 02:45:00 +00:00
//This file should be easily portable.
//The biggest strength of this plugin system is that ALL interactions are performed via
//named functions, this makes it *really* easy to port plugins from one engine to annother.
# include "quakedef.h"
2013-05-03 04:28:08 +00:00
# include "fs.h"
2019-09-04 07:59:40 +00:00
# define FTEENGINE
# include "../plugins/plugin.h"
2013-05-11 14:02:55 +00:00
2004-09-30 22:51:15 +00:00
# ifdef PLUGINS
2004-09-24 02:45:00 +00:00
2020-01-20 18:36:45 +00:00
# ifdef MODELFMT_GLTF
# define Q_snprintf Q_snprintfz
# define Q_strlcpy Q_strncpyz
# define Q_strlcat Q_strncatz
# include "../plugins/models/gltf.c"
# endif
2015-09-14 15:20:09 +00:00
cvar_t plug_sbar = CVARD ( " plug_sbar " , " 3 " , " Controls whether plugins are allowed to draw the hud, rather than the engine (when allowed by csqc). This is typically used to permit the ezhud plugin without needing to bother unloading it. \n =0: never use hud plugins. \n &1: Use hud plugins in deathmatch. \n &2: Use hud plugins in singleplayer/coop. \n =3: Always use hud plugins (when loaded). " ) ;
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
cvar_t plug_loaddefault = CVARD ( " plug_loaddefault " , " 1 " , " 0: Load plugins only via explicit plug_load commands \n 1: Load built-in plugins and those selected via the package manager \n 2: Scan for misc plugins, loading all that can be found, but not built-ins. \n 3: Scan for plugins, and then load any built-ins " ) ;
2005-01-15 17:46:40 +00:00
2019-09-04 07:59:40 +00:00
static struct
2015-02-02 08:01:53 +00:00
{
const char * name ;
2019-09-04 07:59:40 +00:00
qboolean ( QDECL * initfunction ) ( void ) ;
2015-02-02 08:01:53 +00:00
} staticplugins [ ] =
{
2018-07-05 16:21:44 +00:00
# if defined(USE_INTERNAL_BULLET)
2018-08-04 19:00:19 +00:00
{ " bullet_internal " , Plug_Bullet_Init } ,
2018-07-05 16:21:44 +00:00
# endif
# if defined(USE_INTERNAL_ODE)
{ " ODE_internal " , Plug_ODE_Init } ,
2020-01-20 18:36:45 +00:00
# endif
# if defined(MODELFMT_GLTF)
{ " GLTF " , Plug_GLTF_Init } ,
2015-02-02 08:01:53 +00:00
# endif
{ NULL }
} ;
2019-09-04 07:59:40 +00:00
//for internal plugins to link against
plugcorefuncs_t * plugfuncs ;
plugcvarfuncs_t * cvarfuncs ;
plugcmdfuncs_t * cmdfuncs ;
2015-02-02 08:01:53 +00:00
2009-11-04 21:16:50 +00:00
# ifdef GLQUAKE
2004-10-10 06:32:29 +00:00
# include "glquake.h"
2005-08-01 14:17:27 +00:00
# endif
2019-09-04 07:59:40 +00:00
# include "com_mesh.h"
# include "shader.h"
static void * QDECL PlugBI_GetEngineInterface ( const char * interfacename , size_t structsize ) ;
# ifdef SKELETALMODELS
static int QDECL Plug_RegisterModelFormatText ( const char * formatname , char * magictext , qboolean ( QDECL * load ) ( struct model_s * mod , void * buffer , size_t fsize ) )
{
void * module = currentplug ;
return Mod_RegisterModelFormatText ( module , formatname , magictext , load ) ;
}
static int QDECL Plug_RegisterModelFormatMagic ( const char * formatname , unsigned int magic , qboolean ( QDECL * load ) ( struct model_s * mod , void * buffer , size_t fsize ) )
{
void * module = currentplug ;
return Mod_RegisterModelFormatMagic ( module , formatname , magic , load ) ;
}
static void QDECL Plug_UnRegisterModelFormat ( int idx )
{
void * module = currentplug ;
Mod_UnRegisterModelFormat ( module , idx ) ;
}
static void QDECL Plug_UnRegisterAllModelFormats ( void )
{
void * module = currentplug ;
Mod_UnRegisterAllModelFormats ( module ) ;
}
# endif
2004-10-10 06:32:29 +00:00
2005-12-15 19:45:04 +00:00
//custom plugin builtins.
2019-09-04 07:59:40 +00:00
void Plug_RegisterBuiltin_ ( char * name , funcptr_t bi , int flags ) ;
# define Plug_RegisterBuiltin(n,bi,fl) Plug_RegisterBuiltin_(n,(funcptr_t)bi,fl)
2006-01-02 22:55:56 +00:00
# define PLUG_BIF_NEEDSRENDERER 4
2005-12-15 19:45:04 +00:00
2005-11-29 13:32:15 +00:00
# include "netinc.h"
2004-09-24 02:45:00 +00:00
typedef struct plugin_s {
char * name ;
2019-09-04 07:59:40 +00:00
char filename [ MAX_OSPATH ] ;
dllhandle_t * lib ;
2009-04-06 00:34:32 +00:00
2019-09-04 07:59:40 +00:00
void ( QDECL * tick ) ( double realtime , double gametime ) ;
qboolean ( QDECL * executestring ) ( qboolean isinsecure ) ;
2005-12-15 19:15:39 +00:00
# ifndef SERVERONLY
2019-09-04 07:59:40 +00:00
qboolean ( QDECL * consolelink ) ( void ) ;
qboolean ( QDECL * consolelinkmouseover ) ( float x , float y ) ;
int ( QDECL * conexecutecommand ) ( qboolean isinsecure ) ;
qboolean ( QDECL * menufunction ) ( int eventtype , int keyparam , int unicodeparm , float mousecursor_x , float mousecursor_y , float vidwidth , float vidheight ) ;
int ( QDECL * sbarlevel [ 3 ] ) ( int seat , float x , float y , float w , float h , unsigned int showscores ) ; //0 - main sbar, 1 - supplementry sbar sections (make sure these can be switched off), 2 - overlays (scoreboard). menus kill all.
void ( QDECL * reschange ) ( int width , int height ) ;
2004-09-24 02:45:00 +00:00
2005-08-03 23:14:59 +00:00
//protocol-in-a-plugin
2019-09-04 07:59:40 +00:00
int ( QDECL * connectionlessclientpacket ) ( const char * buffer , size_t size , netadr_t * from ) ;
2005-12-15 19:15:39 +00:00
# endif
2019-09-04 07:59:40 +00:00
qboolean ( QDECL * svmsgfunction ) ( int messagelevel ) ;
qboolean ( QDECL * chatmsgfunction ) ( int talkernum , int tpflags ) ;
qboolean ( QDECL * centerprintfunction ) ( int clientnum ) ;
qboolean ( QDECL * mayshutdown ) ( void ) ; //lets the plugin report when its safe to close it.
void ( QDECL * shutdown ) ( void ) ;
2005-11-30 05:01:43 +00:00
2004-09-24 02:45:00 +00:00
struct plugin_s * next ;
} plugin_t ;
2018-11-27 16:48:19 +00:00
int Plug_SubConsoleCommand ( console_t * con , const char * line ) ;
2005-03-10 03:55:18 +00:00
2004-09-24 02:45:00 +00:00
plugin_t * currentplug ;
2005-12-15 19:15:39 +00:00
# ifndef SERVERONLY
# include "cl_plugin.inc"
# else
void Plug_Client_Init ( void ) { }
void Plug_Client_Close ( plugin_t * plug ) { }
# endif
2005-08-03 23:14:59 +00:00
void Plug_Close ( plugin_t * plug ) ;
2004-09-24 02:45:00 +00:00
static plugin_t * plugs ;
2019-09-04 07:59:40 +00:00
# ifdef USERBE
# include "pr_common.h"
2009-07-18 20:21:02 +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
static char * Plug_CleanName ( const char * file , char * out , size_t sizeof_out )
{
size_t len ;
//"fteplug_ezhud_x86.REV.dll" gets converted into "ezhud"
//skip fteplug_
2019-06-21 03:59:46 +00:00
if ( ! Q_strncasecmp ( file , PLUGINPREFIX , strlen ( PLUGINPREFIX ) ) )
file + = strlen ( PLUGINPREFIX ) ;
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
//strip .REV.dll
COM_StripAllExtensions ( file , out , sizeof_out ) ;
//strip _x86
len = strlen ( out ) ;
if ( len > strlen ( " _ " ARCH_CPU_POSTFIX ) & & ! Q_strncasecmp ( out + len - strlen ( " _ " ARCH_CPU_POSTFIX ) , " _ " ARCH_CPU_POSTFIX , strlen ( " _ " ARCH_CPU_POSTFIX ) ) )
{
len - = strlen ( " _ " ARCH_CPU_POSTFIX ) ;
out [ len ] = 0 ;
}
return out ;
}
2019-09-04 07:59:40 +00:00
static plugin_t * Plug_Load ( const char * file )
2004-09-24 02:45:00 +00:00
{
2019-09-04 07:59:40 +00:00
static enum fs_relative prefixes [ ] =
{
FS_BINARYPATH ,
# ifndef ANDROID
FS_ROOT ,
# endif
} ;
static char * postfixes [ ] =
{
" _ " ARCH_CPU_POSTFIX ARCH_DL_POSTFIX ,
# ifndef ANDROID
ARCH_DL_POSTFIX ,
# endif
} ;
size_t i , j ;
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 temp [ MAX_OSPATH ] ;
2004-09-24 02:45:00 +00:00
plugin_t * newplug ;
2019-09-04 07:59:40 +00:00
int nlen = strlen ( file ) ;
qboolean success = false ;
qboolean ( QDECL * initfunction ) ( plugcorefuncs_t * ) ;
dllfunction_t funcs [ ] =
{
{ ( void * * ) & initfunction , " FTEPlug_Init " } ,
{ NULL , NULL } ,
} ;
2004-09-24 02:45:00 +00:00
2019-09-04 07:59:40 +00:00
//reject obviously invalid names
if ( ! * file | | strchr ( file , ' / ' ) | | strchr ( file , ' \\ ' ) )
return NULL ;
Plug_CleanName ( file , temp , sizeof ( temp ) ) ;
2004-09-24 02:45:00 +00:00
for ( newplug = plugs ; newplug ; newplug = newplug - > next )
{
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 ( ! Q_strcasecmp ( newplug - > name , temp ) )
2005-08-03 23:14:59 +00:00
return newplug ;
2004-09-24 02:45:00 +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
newplug = Z_Malloc ( sizeof ( plugin_t ) + strlen ( temp ) + 1 ) ;
2004-09-24 02:45:00 +00:00
newplug - > name = ( char * ) ( newplug + 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
strcpy ( newplug - > name , temp ) ;
2005-12-15 19:15:39 +00:00
2019-09-04 07:59:40 +00:00
//[basedir|binroot]fteplug_%s[_cpu][.so]
for ( i = 0 ; i < countof ( prefixes ) & & ! newplug - > lib ; i + + )
{
//if the name matches a postfix then just go with that
for ( j = 0 ; j < countof ( postfixes ) ; j + + )
{
int pfl = strlen ( postfixes [ j ] ) ;
if ( nlen > pfl & & ! Q_strcasecmp ( file + nlen - pfl , postfixes [ j ] ) )
break ;
}
if ( j < countof ( postfixes ) )
{ //already postfixed, don't mess with the name given
//mandate the fteplug_ prefix (don't let them load random dlls)
if ( ! Q_strncasecmp ( file , PLUGINPREFIX , strlen ( PLUGINPREFIX ) ) )
if ( FS_NativePath ( file , prefixes [ i ] , newplug - > filename , sizeof ( newplug - > filename ) ) )
newplug - > lib = Sys_LoadLibrary ( newplug - > filename , funcs ) ;
}
else
{ //otherwise scan for it
for ( j = 0 ; j < countof ( postfixes ) & & ! newplug - > lib ; j + + )
{
if ( FS_NativePath ( va ( PLUGINPREFIX " %s%s " , file , postfixes [ j ] ) , prefixes [ i ] , newplug - > filename , sizeof ( newplug - > filename ) ) )
newplug - > lib = Sys_LoadLibrary ( newplug - > filename , funcs ) ;
}
}
}
# ifdef _WIN32
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-09-04 07:59:40 +00:00
char * mssuck ;
while ( ( mssuck = strchr ( newplug - > filename , ' \\ ' ) ) )
* mssuck = ' / ' ;
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-09-04 07:59:40 +00:00
# endif
newplug - > next = plugs ;
plugs = newplug ;
if ( newplug - > lib )
2019-06-17 04:21:41 +00:00
{
2019-09-04 07:59:40 +00:00
Con_DPrintf ( " Created plugin %s \n " , file ) ;
currentplug = newplug ;
success = initfunction ( PlugBI_GetEngineInterface ( plugcorefuncs_name , sizeof ( plugcorefuncs_t ) ) ) ;
2019-06-17 04:21:41 +00:00
}
2019-09-04 07:59:40 +00:00
else
2015-02-02 08:01:53 +00:00
{
unsigned int u ;
for ( u = 0 ; staticplugins [ u ] . name ; u + + )
{
if ( ! Q_strcasecmp ( file , staticplugins [ u ] . name ) )
2019-09-04 07:59:40 +00:00
{
Con_DPrintf ( " Activated module %s \n " , file ) ;
newplug - > lib = NULL ;
2020-01-20 18:36:45 +00:00
Q_strncpyz ( newplug - > filename , staticplugins [ u ] . name , sizeof ( newplug - > filename ) ) ;
2019-09-04 07:59:40 +00:00
currentplug = newplug ;
success = staticplugins [ u ] . initfunction ( ) ;
break ;
}
2015-02-02 08:01:53 +00:00
}
}
2013-05-11 14:02:55 +00:00
2019-09-04 07:59:40 +00:00
if ( ! success )
2004-09-24 02:45:00 +00:00
{
2019-09-04 07:59:40 +00:00
Plug_Close ( newplug ) ;
return NULL ;
}
2004-09-24 02:45:00 +00:00
2004-10-10 06:32:29 +00:00
2005-12-15 19:15:39 +00:00
# ifndef SERVERONLY
2019-09-04 07:59:40 +00:00
if ( newplug - > reschange )
newplug - > reschange ( vid . width , vid . height ) ;
2005-12-15 19:15:39 +00:00
# endif
2019-09-04 07:59:40 +00:00
2004-09-24 02:45:00 +00:00
currentplug = NULL ;
return newplug ;
}
2019-09-04 07:59:40 +00:00
static void Plug_Load_Update ( const char * name )
2004-09-24 02:45:00 +00:00
{
2019-09-04 07:59:40 +00:00
Plug_Load ( name ) ;
2004-09-24 02:45:00 +00:00
}
2019-09-04 07:59:40 +00:00
2015-02-02 08:01:53 +00:00
static int QDECL Plug_EnumeratedRoot ( const char * name , qofs_t size , time_t mtime , void * param , searchpathfuncs_t * spath )
2013-05-03 04:28:08 +00:00
{
char vmname [ MAX_QPATH ] ;
int len ;
char * dot ;
2019-06-21 03:59:46 +00:00
if ( ! strncmp ( name , PLUGINPREFIX , strlen ( PLUGINPREFIX ) ) )
2013-05-11 14:02:55 +00:00
name + = 8 ;
2013-05-03 04:28:08 +00:00
Q_strncpyz ( vmname , name , sizeof ( vmname ) ) ;
len = strlen ( vmname ) ;
len - = strlen ( ARCH_CPU_POSTFIX ARCH_DL_POSTFIX ) ;
if ( ! strcmp ( vmname + len , ARCH_CPU_POSTFIX ARCH_DL_POSTFIX ) )
vmname [ len ] = 0 ;
else
{
dot = strchr ( vmname , ' . ' ) ;
if ( dot )
* dot = 0 ;
}
2015-04-14 23:12:17 +00:00
len = strlen ( vmname ) ;
if ( len > 0 & & vmname [ len - 1 ] = = ' _ ' )
vmname [ len - 1 ] = 0 ;
2019-09-04 07:59:40 +00:00
if ( ! Plug_Load ( vmname ) )
2013-05-03 04:28:08 +00:00
Con_Printf ( " Couldn't load plugin %s \n " , vmname ) ;
return true ;
}
2004-09-24 02:45:00 +00:00
2019-09-04 07:59:40 +00:00
static void QDECL Plug_Con_Print ( const char * text )
2005-03-01 15:36:23 +00:00
{
2019-09-04 07:59:40 +00:00
Con_Printf ( " %s " , text ) ;
2005-03-01 15:36:23 +00:00
}
2019-09-04 07:59:40 +00:00
static void QDECL Plug_Sys_Error ( const char * text )
2015-02-02 08:01:53 +00:00
{
2019-09-04 07:59:40 +00:00
Sys_Error ( " %s " , text ) ;
2016-07-12 00:40:13 +00:00
}
2019-09-04 07:59:40 +00:00
static quintptr_t QDECL Plug_Sys_Milliseconds ( void )
2016-07-12 00:40:13 +00:00
{
2019-09-04 07:59:40 +00:00
return Sys_DoubleTime ( ) * 1000u ;
2016-07-12 00:40:13 +00:00
}
2019-09-04 07:59:40 +00:00
qboolean VARGS PlugBI_ExportFunction ( const char * name , funcptr_t function )
2004-09-24 02:45:00 +00:00
{
2013-06-23 02:17:02 +00:00
if ( ! strcmp ( name , " Tick " ) ) //void(int realtime)
2019-09-04 07:59:40 +00:00
currentplug - > tick = function ;
2013-06-23 02:17:02 +00:00
else if ( ! strcmp ( name , " ExecuteCommand " ) ) //bool(isinsecure)
2019-09-04 07:59:40 +00:00
currentplug - > executestring = function ;
2013-06-23 02:17:02 +00:00
else if ( ! strcmp ( name , " Shutdown " ) ) //void()
2019-09-04 07:59:40 +00:00
currentplug - > shutdown = function ;
else if ( ! strcmp ( name , " MayShutdown " ) | | ! strcmp ( name , " MayUnload " ) )
currentplug - > mayshutdown = function ;
# ifdef HAVE_CLIENT
2013-06-23 02:17:02 +00:00
else if ( ! strcmp ( name , " ConsoleLink " ) )
2019-09-04 07:59:40 +00:00
currentplug - > consolelink = function ;
2013-11-21 23:02:28 +00:00
else if ( ! strcmp ( name , " ConsoleLinkMouseOver " ) )
2019-09-04 07:59:40 +00:00
currentplug - > consolelinkmouseover = function ;
2005-01-13 16:50:37 +00:00
else if ( ! strcmp ( name , " ConExecuteCommand " ) )
2019-09-04 07:59:40 +00:00
currentplug - > conexecutecommand = function ;
2004-09-26 00:30:42 +00:00
else if ( ! strcmp ( name , " MenuEvent " ) )
2019-09-04 07:59:40 +00:00
currentplug - > menufunction = function ;
2004-10-10 06:32:29 +00:00
else if ( ! strcmp ( name , " UpdateVideo " ) )
2019-09-04 07:59:40 +00:00
currentplug - > reschange = function ;
2004-10-13 07:24:59 +00:00
else if ( ! strcmp ( name , " SbarBase " ) ) //basic SBAR.
2019-09-04 07:59:40 +00:00
currentplug - > sbarlevel [ 0 ] = function ;
2004-10-13 07:24:59 +00:00
else if ( ! strcmp ( name , " SbarSupplement " ) ) //supplementry stuff - teamplay
2019-09-04 07:59:40 +00:00
currentplug - > sbarlevel [ 1 ] = function ;
2004-10-13 07:24:59 +00:00
else if ( ! strcmp ( name , " SbarOverlay " ) ) //overlay - scoreboard type stuff.
2019-09-04 07:59:40 +00:00
currentplug - > sbarlevel [ 2 ] = function ;
2005-08-03 23:14:59 +00:00
else if ( ! strcmp ( name , " ConnectionlessClientPacket " ) )
2019-09-04 07:59:40 +00:00
currentplug - > connectionlessclientpacket = function ;
2006-01-01 09:01:15 +00:00
else if ( ! strcmp ( name , " ServerMessageEvent " ) )
2019-09-04 07:59:40 +00:00
currentplug - > svmsgfunction = function ;
2006-01-01 09:01:15 +00:00
else if ( ! strcmp ( name , " ChatMessageEvent " ) )
2019-09-04 07:59:40 +00:00
currentplug - > chatmsgfunction = function ;
2006-01-01 09:01:15 +00:00
else if ( ! strcmp ( name , " CenterPrintMessage " ) )
2019-09-04 07:59:40 +00:00
currentplug - > centerprintfunction = function ;
else if ( ! strcmp ( name , " S_LoadSound " ) ) //a hook for loading extra types of sound (wav, mp3, ogg, midi, whatever you choose to support)
S_RegisterSoundInputPlugin ( currentplug , function ) ;
2005-12-15 19:15:39 +00:00
# endif
2019-09-04 07:59:40 +00:00
else if ( ! strncmp ( name , " FS_RegisterArchiveType_ " , 23 ) ) //module as in pak/pk3
FS_RegisterFileSystemType ( currentplug , name + 23 , function , true ) ;
2004-09-24 02:45:00 +00:00
else
return 0 ;
return 1 ;
}
2004-10-10 06:32:29 +00:00
2005-12-15 19:15:39 +00:00
//retrieve a plugin's name
2019-09-04 07:59:40 +00:00
static qboolean QDECL PlugBI_GetPluginName ( int plugnum , char * outname , size_t namesize )
2005-12-15 19:15:39 +00:00
{
plugin_t * plug ;
//int plugnum (0 for current), char *buffer, int bufferlen
if ( plugnum < = 0 )
{
2016-07-12 00:40:13 +00:00
if ( ! currentplug )
return false ;
2019-09-04 07:59:40 +00:00
else if ( plugnum = = - 1 & & currentplug - > lib ) //plugin file name
Q_strncpyz ( outname , currentplug - > filename , namesize ) ;
2016-07-12 00:40:13 +00:00
else //plugin name
2019-09-04 07:59:40 +00:00
Q_strncpyz ( outname , currentplug - > name , namesize ) ;
2005-12-15 19:15:39 +00:00
return true ;
}
for ( plug = plugs ; plug ; plug = plug - > next )
{
if ( - - plugnum = = 0 )
{
2019-09-04 07:59:40 +00:00
Q_strncpyz ( outname , plug - > name , namesize ) ;
2005-12-15 19:15:39 +00:00
return true ;
}
}
return false ;
}
2019-09-04 07:59:40 +00:00
static qboolean QDECL PlugBI_ExportInterface ( const char * name , void * interfaceptr , size_t structsize )
2005-11-30 01:20:53 +00:00
{
2019-09-04 07:59:40 +00:00
if ( 0 )
;
2006-01-29 03:45:00 +00:00
/*
else if ( ! strncmp ( name , " VID_DisplayDriver " ) ) //a video driver, loaded by name as given by vid_renderer
{
FS_RegisterModuleDriver ( , func ) ;
currentplug - > blockcloses + + ;
}
*/
2017-02-21 20:22:07 +00:00
# if defined(PLUGINS) && !defined(SERVERONLY)
# ifdef HAVE_MEDIA_DECODER
2012-04-24 07:59:11 +00:00
else if ( ! strcmp ( name , " Media_VideoDecoder " ) )
2019-09-04 07:59:40 +00:00
Media_RegisterDecoder ( currentplug , interfaceptr ) ;
2017-02-21 20:22:07 +00:00
# endif
# ifdef HAVE_MEDIA_ENCODER
2012-11-27 03:23:19 +00:00
else if ( ! strcmp ( name , " Media_VideoEncoder " ) )
2019-09-04 07:59:40 +00:00
Media_RegisterEncoder ( currentplug , interfaceptr ) ;
2012-04-24 07:59:11 +00:00
# endif
2005-12-15 19:15:39 +00:00
# endif
2006-01-29 03:45:00 +00:00
else
2005-11-30 01:20:53 +00:00
return 0 ;
return 1 ;
}
2019-09-04 07:59:40 +00:00
static cvar_t * QDECL Plug_Cvar_GetNVFDG ( const char * name , const char * defaultvalue , unsigned int flags , const char * description , const char * groupname )
2015-02-02 08:01:53 +00:00
{
2015-04-21 04:12:00 +00:00
if ( ! defaultvalue )
2019-09-04 07:59:40 +00:00
return Cvar_FindVar ( name ) ;
return Cvar_Get2 ( name , defaultvalue , flags & 1 , description , groupname ) ;
2015-02-02 08:01:53 +00:00
}
2004-10-10 06:32:29 +00:00
typedef struct {
//Make SURE that the engine has resolved all cvar pointers into globals before this happens.
plugin_t * plugin ;
cvar_t * var ;
} plugincvararray_t ;
2019-09-04 07:59:40 +00:00
static int plugincvararraylen ;
static plugincvararray_t * plugincvararray ;
2004-10-10 06:32:29 +00:00
//qhandle_t Cvar_Register (char *name, char *defaultval, int flags, char *grouphint);
2019-09-04 07:59:40 +00:00
static qhandle_t QDECL Plug_Cvar_Register ( const char * name , const char * defaultvalue , int flags , const char * groupname )
2004-10-10 06:32:29 +00:00
{
cvar_t * var ;
int i ;
var = Cvar_Get ( name , defaultvalue , flags & 1 , groupname ) ;
for ( i = 0 ; i < plugincvararraylen ; i + + )
{
if ( ! plugincvararray [ i ] . var )
{ //hmm... a gap...
plugincvararray [ i ] . plugin = currentplug ;
plugincvararray [ i ] . var = var ;
return i ;
}
}
2007-09-17 20:35:39 +00:00
i = plugincvararraylen ;
2004-10-10 06:32:29 +00:00
plugincvararraylen + + ;
2007-09-17 20:35:39 +00:00
plugincvararray = BZ_Realloc ( plugincvararray , ( plugincvararraylen ) * sizeof ( plugincvararray_t ) ) ;
plugincvararray [ i ] . plugin = currentplug ;
plugincvararray [ i ] . var = var ;
return i ;
2004-10-10 06:32:29 +00:00
}
//int Cvar_Update, (qhandle_t handle, int modificationcount, char *stringv, float *floatv)); //stringv is 256 chars long, don't expect this function to do anything if modification count is unchanged.
2019-09-04 07:59:40 +00:00
static qboolean QDECL Plug_Cvar_Update ( qhandle_t handle , int * modificationcount , char * outstringv , size_t stringsize , float * outfloatv )
2004-10-10 06:32:29 +00:00
{
cvar_t * var ;
if ( handle < 0 | | handle > = plugincvararraylen )
2019-09-04 07:59:40 +00:00
return false ;
2004-10-10 06:32:29 +00:00
if ( plugincvararray [ handle ] . plugin ! = currentplug )
2019-09-04 07:59:40 +00:00
return false ; //I'm not letting you know what annother plugin has registered.
2004-10-10 06:32:29 +00:00
var = plugincvararray [ handle ] . var ;
2019-09-04 07:59:40 +00:00
//if (var->modified != *modificationcount) //for future optimisation
2013-05-11 05:03:07 +00:00
{
2019-09-04 07:59:40 +00:00
//*modificationcount = var->modified;
Q_strncpyz ( outstringv , var - > string , stringsize ) ;
* outfloatv = var - > value ;
return true ;
2013-05-11 05:03:07 +00:00
}
2019-09-04 07:59:40 +00:00
return false ;
2004-10-10 06:32:29 +00:00
}
//void Cmd_Args(char *buffer, int buffersize)
2019-09-04 07:59:40 +00:00
static void QDECL Plug_Cmd_Args ( char * buffer , int maxsize )
2004-09-24 02:45:00 +00:00
{
char * args ;
args = Cmd_Args ( ) ;
2016-07-12 00:40:13 +00:00
if ( strlen ( args ) + 1 > maxsize )
{
if ( maxsize )
* buffer = 0 ;
}
2019-09-04 07:59:40 +00:00
else
strcpy ( buffer , args ) ;
2004-09-24 02:45:00 +00:00
}
2004-10-10 06:32:29 +00:00
//void Cmd_Argv(int num, char *buffer, int buffersize)
2019-09-04 07:59:40 +00:00
static void QDECL Plug_Cmd_Argv ( int argn , char * outbuffer , size_t buffersize )
2004-09-24 02:45:00 +00:00
{
char * args ;
2019-09-04 07:59:40 +00:00
args = Cmd_Argv ( argn ) ;
2016-07-12 00:40:13 +00:00
2019-09-04 07:59:40 +00:00
if ( strlen ( args ) + 1 > buffersize )
2016-07-12 00:40:13 +00:00
{
2019-09-04 07:59:40 +00:00
if ( buffersize )
* outbuffer = 0 ;
2016-07-12 00:40:13 +00:00
}
2019-09-04 07:59:40 +00:00
else
strcpy ( outbuffer , args ) ;
2004-09-24 02:45:00 +00:00
}
2004-10-10 06:32:29 +00:00
//int Cmd_Argc(void)
2019-09-04 07:59:40 +00:00
static int QDECL Plug_Cmd_Argc ( void )
2004-09-24 02:45:00 +00:00
{
return Cmd_Argc ( ) ;
}
2004-09-26 00:30:42 +00:00
2004-10-10 06:32:29 +00:00
//void Cvar_SetString (char *name, char *value);
2019-09-04 07:59:40 +00:00
static void QDECL Plug_Cvar_SetString ( const char * name , const char * value )
2004-10-10 06:32:29 +00:00
{
cvar_t * var = Cvar_Get ( name , value , 0 , " Plugin vars " ) ;
if ( var )
Cvar_Set ( var , value ) ;
}
//void Cvar_SetFloat (char *name, float value);
2019-09-04 07:59:40 +00:00
static void QDECL Plug_Cvar_SetFloat ( const char * cvarname , float newvalue )
2004-10-10 06:32:29 +00:00
{
2019-09-04 07:59:40 +00:00
cvar_t * var = Cvar_Get ( cvarname , " " , 0 , " Plugin vars " ) ; //"" because I'm lazy
2004-10-10 06:32:29 +00:00
if ( var )
2019-09-04 07:59:40 +00:00
Cvar_SetValue ( var , newvalue ) ;
2004-10-10 06:32:29 +00:00
}
//void Cvar_GetFloat (char *name);
2019-09-04 07:59:40 +00:00
static float QDECL Plug_Cvar_GetFloat ( const char * cvarname )
2004-10-10 06:32:29 +00:00
{
int ret ;
2013-06-23 02:17:02 +00:00
cvar_t * var ;
# ifndef CLIENTONLY
2019-09-04 07:59:40 +00:00
if ( ! strcmp ( cvarname , " sv.state " ) ) //ugly hack
return sv . state ;
2013-06-23 02:17:02 +00:00
else
# endif
2004-10-10 06:32:29 +00:00
{
2019-09-04 07:59:40 +00:00
var = Cvar_Get ( cvarname , " " , 0 , " Plugin vars " ) ;
2013-06-23 02:17:02 +00:00
if ( var )
2019-09-04 07:59:40 +00:00
return var - > value ;
2013-06-23 02:17:02 +00:00
else
2019-09-04 07:59:40 +00:00
return 0 ;
2004-10-10 06:32:29 +00:00
}
return ret ;
}
//qboolean Cvar_GetString (char *name, char *retstring, int sizeofretstring);
2019-09-04 07:59:40 +00:00
static qboolean QDECL Plug_Cvar_GetString ( const char * name , char * outbuffer , quintptr_t sizeofbuffer )
2004-10-10 06:32:29 +00:00
{
cvar_t * var ;
2013-06-23 02:17:02 +00:00
if ( ! strcmp ( name , " sv.mapname " ) )
{
# ifdef CLIENTONLY
2019-09-07 16:19:13 +00:00
Q_strncpyz ( outbuffer , " " , sizeofbuffer ) ;
2013-06-23 02:17:02 +00:00
# else
2019-09-04 07:59:40 +00:00
Q_strncpyz ( outbuffer , svs . name , sizeofbuffer ) ;
2013-06-23 02:17:02 +00:00
# endif
}
else
{
var = Cvar_Get ( name , " " , 0 , " Plugin vars " ) ;
2019-09-04 07:59:40 +00:00
if ( strlen ( var - > name ) + 1 > sizeofbuffer )
2013-06-23 02:17:02 +00:00
return false ;
2004-10-10 06:32:29 +00:00
2019-09-04 07:59:40 +00:00
strcpy ( outbuffer , var - > string ) ;
2013-06-23 02:17:02 +00:00
}
2004-10-10 06:32:29 +00:00
return true ;
}
//void Cmd_AddText (char *text, qboolean insert); //abort the entire engine.
2019-09-04 07:59:40 +00:00
static void QDECL Plug_Cmd_AddText ( const char * text , qboolean insert )
2004-10-10 06:32:29 +00:00
{
2019-09-04 07:59:40 +00:00
int level = RESTRICT_LOCAL ;
if ( insert )
Cbuf_InsertText ( text , level , false ) ;
2004-10-10 06:32:29 +00:00
else
2019-09-04 07:59:40 +00:00
Cbuf_AddText ( text , level ) ;
2004-09-26 00:30:42 +00:00
}
2019-09-04 07:59:40 +00:00
static int plugincommandarraylen ;
2005-01-15 17:46:40 +00:00
typedef struct {
plugin_t * plugin ;
char command [ 64 ] ;
} plugincommand_t ;
2019-09-04 07:59:40 +00:00
static plugincommand_t * plugincommandarray ;
2005-01-15 17:46:40 +00:00
void Plug_Command_f ( void )
{
int i ;
char * cmd = Cmd_Argv ( 0 ) ;
plugin_t * oldplug = currentplug ;
for ( i = 0 ; i < plugincommandarraylen ; i + + )
{
if ( ! plugincommandarray [ i ] . plugin )
continue ; //don't check commands who's owners died.
2019-10-07 04:51:17 +00:00
if ( Q_strcasecmp ( plugincommandarray [ i ] . command , cmd ) ) //not the right command
2005-01-15 17:46:40 +00:00
continue ;
currentplug = plugincommandarray [ i ] . plugin ;
if ( currentplug - > executestring )
2019-09-04 07:59:40 +00:00
currentplug - > executestring ( Cmd_IsInsecure ( ) ) ;
2005-01-15 17:46:40 +00:00
break ;
}
currentplug = oldplug ;
}
2019-09-04 07:59:40 +00:00
static qboolean QDECL Plug_Cmd_AddCommand ( const char * name )
2005-01-15 17:46:40 +00:00
{
int i ;
for ( i = 0 ; i < plugincommandarraylen ; i + + )
{
if ( ! plugincommandarray [ i ] . plugin )
break ;
if ( plugincommandarray [ i ] . plugin = = currentplug )
{
if ( ! strcmp ( name , plugincommandarray [ i ] . command ) )
2013-06-23 20:11:58 +00:00
return true ; //already registered
2005-01-15 17:46:40 +00:00
}
}
if ( i = = plugincommandarraylen )
{
plugincommandarraylen + + ;
plugincommandarray = BZ_Realloc ( plugincommandarray , plugincommandarraylen * sizeof ( plugincommand_t ) ) ;
}
Q_strncpyz ( plugincommandarray [ i ] . command , name , sizeof ( plugincommandarray [ i ] . command ) ) ;
2012-05-09 15:30:53 +00:00
if ( ! Cmd_AddCommand ( plugincommandarray [ i ] . command , Plug_Command_f ) )
2005-01-15 17:46:40 +00:00
return false ;
plugincommandarray [ i ] . plugin = currentplug ; //worked
return true ;
}
2019-09-04 07:59:40 +00:00
static void Plug_FreeConCommands ( plugin_t * plug )
2005-01-15 17:46:40 +00:00
{
int i ;
for ( i = 0 ; i < plugincommandarraylen ; i + + )
{
if ( plugincommandarray [ i ] . plugin = = plug )
{
plugincommandarray [ i ] . plugin = NULL ;
Cmd_RemoveCommand ( plugincommandarray [ i ] . command ) ;
}
}
}
2005-03-01 15:36:23 +00:00
typedef enum {
STREAM_NONE ,
STREAM_SOCKET ,
2016-07-12 00:40:13 +00:00
STREAM_VFS ,
STREAM_WEB ,
2005-03-01 15:36:23 +00:00
} plugstream_e ;
typedef struct {
plugin_t * plugin ;
plugstream_e type ;
int socket ;
2013-03-31 04:21:08 +00:00
vfsfile_t * vfs ;
2016-07-12 00:40:13 +00:00
struct dl_download * dl ;
2005-11-30 01:20:53 +00:00
struct {
char filename [ MAX_QPATH ] ;
2017-02-19 00:15:42 +00:00
// qbyte *buffer;
// int buflen;
// int curlen;
// int curpos;
2005-11-30 01:20:53 +00:00
} file ;
2005-03-01 15:36:23 +00:00
} pluginstream_t ;
2019-09-04 07:59:40 +00:00
static pluginstream_t * pluginstreamarray ;
static unsigned int pluginstreamarraylen ;
2005-03-01 15:36:23 +00:00
2012-10-08 05:10:14 +00:00
static int Plug_NewStreamHandle ( plugstream_e type )
2005-03-01 15:36:23 +00:00
{
int i ;
2013-03-31 04:21:08 +00:00
for ( i = 0 ; i < pluginstreamarraylen ; i + + )
2005-03-01 15:36:23 +00:00
{
if ( ! pluginstreamarray [ i ] . plugin )
break ;
}
2012-04-24 07:59:11 +00:00
if ( i > = pluginstreamarraylen )
2005-03-01 15:36:23 +00:00
{
2012-04-24 07:59:11 +00:00
pluginstreamarraylen = i + 16 ;
2005-03-01 15:36:23 +00:00
pluginstreamarray = BZ_Realloc ( pluginstreamarray , pluginstreamarraylen * sizeof ( pluginstream_t ) ) ;
}
memset ( & pluginstreamarray [ i ] , 0 , sizeof ( pluginstream_t ) ) ;
pluginstreamarray [ i ] . plugin = currentplug ;
pluginstreamarray [ i ] . type = type ;
pluginstreamarray [ i ] . socket = - 1 ;
2005-11-30 01:20:53 +00:00
* pluginstreamarray [ i ] . file . filename = ' \0 ' ;
2005-03-01 15:36:23 +00:00
return i ;
}
2019-09-04 07:59:40 +00:00
# ifdef HAVE_CLIENT
static qhandle_t QDECL Plug_Con_POpen ( const char * consolename )
{
int handle ;
if ( ! currentplug )
return - 3 ; //streams depend upon current plugin context. which isn't valid in a thread.
handle = Plug_NewStreamHandle ( STREAM_VFS ) ;
pluginstreamarray [ handle ] . vfs = Con_POpen ( consolename ) ;
return handle ;
}
# endif
2014-03-30 08:55:06 +00:00
# ifdef HAVE_PACKET
2005-03-01 15:36:23 +00:00
//EBUILTIN(int, NET_TCPListen, (char *ip, int port, int maxcount));
//returns a new socket with listen enabled.
2019-09-04 07:59:40 +00:00
static qhandle_t QDECL Plug_Net_TCPListen ( const char * localip , int localport , int maxcount )
2005-03-01 15:36:23 +00:00
{
int handle ;
int sock ;
struct sockaddr_qstorage address ;
int _true = 1 ;
2012-04-24 07:59:11 +00:00
int alen ;
2005-12-15 19:15:39 +00:00
2005-03-01 15:36:23 +00:00
netadr_t a ;
2014-09-12 13:14:51 +00:00
if ( ! currentplug )
return - 3 ; //streams depend upon current plugin context. which isn't valid in a thread.
2013-03-12 22:53:23 +00:00
if ( ! localip )
2018-09-23 19:35:24 +00:00
localip = " tcp://0.0.0.0 " ; //pass "[::]" for ipv6
2005-03-01 15:36:23 +00:00
2013-03-12 22:53:23 +00:00
if ( ! NET_StringToAdr ( localip , localport , & a ) )
return - 1 ;
2018-09-23 19:35:24 +00:00
if ( a . prot ! = NP_STREAM & & a . prot ! = NP_DGRAM )
return - 1 ;
alen = NetadrToSockadr ( & a , & address ) ;
2012-04-24 07:59:11 +00:00
2005-03-01 15:36:23 +00:00
if ( ( sock = socket ( ( ( struct sockaddr * ) & address ) - > sa_family , SOCK_STREAM , 0 ) ) = = - 1 )
{
Con_Printf ( " Failed to create socket \n " ) ;
return - 2 ;
}
2011-05-19 13:34:07 +00:00
if ( ioctlsocket ( sock , FIONBIO , ( u_long * ) & _true ) = = - 1 )
2005-03-01 15:36:23 +00:00
{
closesocket ( sock ) ;
return - 2 ;
}
2012-04-24 07:59:11 +00:00
setsockopt ( sock , SOL_SOCKET , SO_REUSEADDR , ( const char * ) & _true , sizeof ( _true ) ) ;
2005-03-01 15:36:23 +00:00
2012-04-24 07:59:11 +00:00
if ( bind ( sock , ( void * ) & address , alen ) = = - 1 )
2005-03-01 15:36:23 +00:00
{
closesocket ( sock ) ;
return - 2 ;
}
2012-04-24 07:59:11 +00:00
if ( listen ( sock , maxcount ) = = - 1 )
2005-03-01 15:36:23 +00:00
{
closesocket ( sock ) ;
return - 2 ;
}
handle = Plug_NewStreamHandle ( STREAM_SOCKET ) ;
pluginstreamarray [ handle ] . socket = sock ;
return handle ;
}
2019-09-04 07:59:40 +00:00
static qhandle_t QDECL Plug_Net_Accept ( qhandle_t handle , char * outaddress , int outaddresssize )
2005-03-01 15:36:23 +00:00
{
2019-09-04 07:59:40 +00:00
struct sockaddr_qstorage address ;
2005-03-01 15:36:23 +00:00
int addrlen ;
int sock ;
int _true = 1 ;
2008-06-08 14:37:57 +00:00
char adr [ MAX_ADR_SIZE ] ;
2005-03-01 15:36:23 +00:00
2014-09-12 13:14:51 +00:00
if ( ! currentplug | | handle < 0 | | handle > = pluginstreamarraylen | | pluginstreamarray [ handle ] . plugin ! = currentplug | | pluginstreamarray [ handle ] . type ! = STREAM_SOCKET )
2005-03-01 15:36:23 +00:00
return - 2 ;
sock = pluginstreamarray [ handle ] . socket ;
2012-04-24 07:59:11 +00:00
if ( sock < 0 )
return - 1 ;
2005-03-01 15:36:23 +00:00
addrlen = sizeof ( address ) ;
sock = accept ( sock , ( struct sockaddr * ) & address , & addrlen ) ;
if ( sock < 0 )
return - 1 ;
2011-05-19 13:34:07 +00:00
if ( ioctlsocket ( sock , FIONBIO , ( u_long * ) & _true ) = = - 1 ) //now make it non blocking.
2005-03-01 15:36:23 +00:00
{
closesocket ( sock ) ;
return - 1 ;
}
2019-09-04 07:59:40 +00:00
if ( outaddresssize )
2005-03-01 15:36:23 +00:00
{
netadr_t a ;
char * s ;
2019-09-04 07:59:40 +00:00
SockadrToNetadr ( & address , addrlen , & a ) ;
2013-05-03 04:28:08 +00:00
s = NET_AdrToString ( adr , sizeof ( adr ) , & a ) ;
2019-09-04 07:59:40 +00:00
Q_strncpyz ( outaddress , s , addrlen ) ;
2005-03-01 15:36:23 +00:00
}
handle = Plug_NewStreamHandle ( STREAM_SOCKET ) ;
pluginstreamarray [ handle ] . socket = sock ;
return handle ;
}
2019-09-04 07:59:40 +00:00
static qhandle_t QDECL Plug_Net_TCPConnect ( const char * remoteip , int remoteport )
{
2005-03-01 15:36:23 +00:00
int handle ;
2013-03-31 04:21:08 +00:00
vfsfile_t * stream = FS_OpenTCP ( remoteip , remoteport ) ;
2014-09-12 13:14:51 +00:00
if ( ! currentplug | | ! stream )
2005-06-18 23:54:34 +00:00
return - 1 ;
2013-03-31 04:21:08 +00:00
handle = Plug_NewStreamHandle ( STREAM_VFS ) ;
pluginstreamarray [ handle ] . vfs = stream ;
return handle ;
2005-03-01 15:36:23 +00:00
2013-03-31 04:21:08 +00:00
}
2005-03-01 15:36:23 +00:00
2013-03-31 04:21:08 +00:00
2019-09-04 07:59:40 +00:00
void Plug_Net_Close_Internal ( qhandle_t handle ) ;
static int QDECL Plug_Net_SetTLSClient ( qhandle_t handle , const char * certhostname )
2013-03-31 04:21:08 +00:00
{
2019-09-04 09:15:13 +00:00
# ifndef HAVE_SSL
return - 1 ;
# else
2013-03-31 04:21:08 +00:00
pluginstream_t * stream ;
2018-06-18 16:44:29 +00:00
if ( handle > = pluginstreamarraylen | | pluginstreamarray [ handle ] . plugin ! = currentplug )
2005-03-01 15:36:23 +00:00
{
2013-03-31 04:21:08 +00:00
Con_Printf ( " Plug_Net_SetTLSClient: socket does not belong to you (or is invalid) \n " ) ;
2005-03-01 15:36:23 +00:00
return - 2 ;
}
2013-03-31 04:21:08 +00:00
stream = & pluginstreamarray [ handle ] ;
if ( stream - > type ! = STREAM_VFS )
{ //not a socket - invalid
Con_Printf ( " Plug_Net_SetTLSClient: Not a socket handle \n " ) ;
2005-03-01 15:36:23 +00:00
return - 2 ;
}
2005-12-15 19:15:39 +00:00
2019-09-04 07:59:40 +00:00
stream - > vfs = FS_OpenSSL ( certhostname , stream - > vfs , false ) ;
2013-03-31 04:21:08 +00:00
if ( ! stream - > vfs )
2005-03-01 15:36:23 +00:00
{
2013-03-31 04:21:08 +00:00
Plug_Net_Close_Internal ( handle ) ;
2005-03-01 15:36:23 +00:00
return - 1 ;
}
2005-12-15 19:15:39 +00:00
return 0 ;
2019-09-04 09:15:13 +00:00
# endif
2005-12-15 19:15:39 +00:00
}
2017-09-20 11:27:13 +00:00
2019-09-04 07:59:40 +00:00
static int QDECL Plug_Net_GetTLSBinding ( qhandle_t handle , char * outbinddata , int * outbinddatalen )
2017-09-20 11:27:13 +00:00
{
2019-09-04 09:15:13 +00:00
# ifndef HAVE_SSL
return - 1 ;
# else
2017-09-20 11:27:13 +00:00
pluginstream_t * stream ;
size_t sz ;
int r ;
2018-06-18 16:44:29 +00:00
if ( ( size_t ) handle > = pluginstreamarraylen | | pluginstreamarray [ handle ] . plugin ! = currentplug )
2017-09-20 11:27:13 +00:00
{
Con_Printf ( " Plug_Net_GetTLSBinding: socket does not belong to you (or is invalid) \n " ) ;
return - 2 ;
}
stream = & pluginstreamarray [ handle ] ;
if ( stream - > type ! = STREAM_VFS )
{ //not a socket - invalid
Con_Printf ( " Plug_Net_GetTLSBinding: Not a socket handle \n " ) ;
return - 2 ;
}
2019-09-04 07:59:40 +00:00
sz = * outbinddatalen ;
r = TLS_GetChannelBinding ( stream - > vfs , outbinddata , & sz ) ;
* outbinddatalen = sz ;
2017-09-20 11:27:13 +00:00
return r ;
2005-12-15 19:15:39 +00:00
# endif
2019-09-04 09:15:13 +00:00
}
2012-04-09 19:12:12 +00:00
# endif
2005-12-15 19:15:39 +00:00
2016-07-12 00:40:13 +00:00
# ifdef WEBCLIENT
static void Plug_DownloadComplete ( struct dl_download * dl )
{
int handle = dl - > user_num ;
dl - > file = NULL ;
pluginstreamarray [ handle ] . dl = NULL ; //download no longer needs to be canceled.
pluginstreamarray [ handle ] . type = STREAM_VFS ; //getlen should start working now.
}
# endif
2014-10-05 20:04:11 +00:00
2017-10-12 12:02:25 +00:00
2019-09-04 07:59:40 +00:00
static qhandle_t QDECL Plug_FS_Open ( const char * fname , qhandle_t * outhandle , int modenum )
2005-11-30 01:20:53 +00:00
{
//modes:
//1: read
//2: write
//char *name, int *handle, int mode
//return value is length of the file.
int handle ;
2013-03-31 04:21:08 +00:00
//char *data;
char * mode ;
vfsfile_t * f ;
2005-11-30 01:20:53 +00:00
2019-09-04 07:59:40 +00:00
* outhandle = - 1 ;
2014-09-22 17:49:45 +00:00
if ( ! currentplug )
return - 3 ; //streams depend upon current plugin context. which isn't valid in a thread.
2005-12-15 19:15:39 +00:00
2019-09-04 07:59:40 +00:00
switch ( modenum )
2005-11-30 01:20:53 +00:00
{
2013-03-31 04:21:08 +00:00
case 1 :
mode = " rb " ;
break ;
case 2 :
mode = " wb " ;
break ;
default :
2005-11-30 01:20:53 +00:00
return - 2 ;
2013-03-31 04:21:08 +00:00
}
2013-06-23 02:17:02 +00:00
if ( ! strcmp ( fname , " **plugconfig " ) )
f = FS_OpenVFS ( va ( " %s.cfg " , currentplug - > name ) , mode , FS_ROOT ) ;
2016-07-12 00:40:13 +00:00
else if ( ! strncmp ( fname , " http:// " , 7 ) | | ! strncmp ( fname , " https:// " , 8 ) )
{
# ifndef WEBCLIENT
f = NULL ;
# else
handle = Plug_NewStreamHandle ( STREAM_WEB ) ;
pluginstreamarray [ handle ] . dl = HTTP_CL_Get ( fname , NULL , Plug_DownloadComplete ) ;
pluginstreamarray [ handle ] . dl - > user_num = handle ;
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
pluginstreamarray [ handle ] . dl - > file = pluginstreamarray [ handle ] . vfs = VFSPIPE_Open ( 2 , true ) ;
2016-07-12 00:40:13 +00:00
pluginstreamarray [ handle ] . dl - > isquery = true ;
# ifdef MULTITHREAD
DL_CreateThread ( pluginstreamarray [ handle ] . dl , NULL , NULL ) ;
# endif
2019-09-04 07:59:40 +00:00
* outhandle = handle ;
2016-07-12 00:40:13 +00:00
return VFS_GETLEN ( pluginstreamarray [ handle ] . vfs ) ;
# endif
}
2019-09-04 07:59:40 +00:00
else if ( modenum = = 2 )
2013-11-21 23:02:28 +00:00
f = FS_OpenVFS ( fname , mode , FS_GAMEONLY ) ;
2013-06-23 02:17:02 +00:00
else
f = FS_OpenVFS ( fname , mode , FS_GAME ) ;
2013-03-31 04:21:08 +00:00
if ( ! f )
return - 1 ;
handle = Plug_NewStreamHandle ( STREAM_VFS ) ;
pluginstreamarray [ handle ] . vfs = f ;
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
Q_strncpyz ( pluginstreamarray [ handle ] . file . filename , fname , sizeof ( pluginstreamarray [ handle ] . file . filename ) ) ;
2019-09-04 07:59:40 +00:00
* outhandle = handle ;
2013-03-31 04:21:08 +00:00
return VFS_GETLEN ( pluginstreamarray [ handle ] . vfs ) ;
2005-11-30 01:20:53 +00:00
}
2019-09-04 07:59:40 +00:00
static int QDECL Plug_FS_Seek ( qhandle_t handle , qofs_t offset )
2013-05-03 04:28:08 +00:00
{
pluginstream_t * stream ;
2016-07-12 00:40:13 +00:00
if ( handle > = pluginstreamarraylen )
return - 1 ;
2013-05-03 04:28:08 +00:00
stream = & pluginstreamarray [ handle ] ;
if ( stream - > type ! = STREAM_VFS )
return - 1 ;
2019-09-04 07:59:40 +00:00
VFS_SEEK ( stream - > vfs , offset ) ;
2013-05-03 04:28:08 +00:00
return VFS_TELL ( stream - > vfs ) ;
}
2005-11-30 01:20:53 +00:00
2019-09-04 07:59:40 +00:00
static qboolean QDECL Plug_FS_GetLength ( qhandle_t handle , qofs_t * outsize )
2016-07-12 00:40:13 +00:00
{
pluginstream_t * stream ;
if ( handle > = pluginstreamarraylen )
return false ;
stream = & pluginstreamarray [ handle ] ;
if ( stream - > type = = STREAM_VFS )
if ( stream - > vfs - > GetLen )
{
2019-09-04 07:59:40 +00:00
* outsize = VFS_GETLEN ( stream - > vfs ) ;
2016-07-12 00:40:13 +00:00
return true ;
}
2019-09-04 07:59:40 +00:00
* outsize = 0 ;
2016-07-12 00:40:13 +00:00
return false ;
}
2019-09-04 07:59:40 +00:00
void Plug_Net_Close_Internal ( qhandle_t handle )
2013-03-31 04:21:08 +00:00
{
switch ( pluginstreamarray [ handle ] . type )
{
case STREAM_NONE :
break ;
2016-07-12 00:40:13 +00:00
case STREAM_WEB :
# ifdef WEBCLIENT
if ( pluginstreamarray [ handle ] . dl )
{
pluginstreamarray [ handle ] . dl - > file = NULL ;
DL_Close ( pluginstreamarray [ handle ] . dl ) ;
}
# endif
//fall through
2013-03-31 04:21:08 +00:00
case STREAM_VFS :
if ( pluginstreamarray [ handle ] . vfs )
2016-07-12 00:40:13 +00:00
{
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
if ( * pluginstreamarray [ handle ] . file . filename & & pluginstreamarray [ handle ] . vfs - > WriteBytes )
2016-07-12 00:40:13 +00:00
{
VFS_CLOSE ( pluginstreamarray [ handle ] . vfs ) ;
2017-02-19 00:15:42 +00:00
FS_FlushFSHashWritten ( pluginstreamarray [ handle ] . file . filename ) ;
2016-07-12 00:40:13 +00:00
}
else
VFS_CLOSE ( pluginstreamarray [ handle ] . vfs ) ;
}
2013-03-31 04:21:08 +00:00
pluginstreamarray [ handle ] . vfs = NULL ;
break ;
case STREAM_SOCKET :
2014-03-30 08:55:06 +00:00
# ifdef HAVE_PACKET
2013-03-31 04:21:08 +00:00
closesocket ( pluginstreamarray [ handle ] . socket ) ;
# endif
break ;
}
2016-07-12 00:40:13 +00:00
pluginstreamarray [ handle ] . type = STREAM_NONE ;
2013-03-31 04:21:08 +00:00
pluginstreamarray [ handle ] . plugin = NULL ;
}
2019-09-04 07:59:40 +00:00
static int QDECL Plug_Net_Recv ( qhandle_t handle , void * dest , int destlen )
2005-03-01 15:36:23 +00:00
{
int read ;
if ( handle < 0 | | handle > = pluginstreamarraylen | | pluginstreamarray [ handle ] . plugin ! = currentplug )
return - 2 ;
switch ( pluginstreamarray [ handle ] . type )
{
2014-03-30 08:55:06 +00:00
# ifdef HAVE_PACKET
2005-03-01 15:36:23 +00:00
case STREAM_SOCKET :
read = recv ( pluginstreamarray [ handle ] . socket , dest , destlen , 0 ) ;
if ( read < 0 )
{
2014-02-07 08:38:40 +00:00
if ( neterrno ( ) = = NET_EWOULDBLOCK )
2005-03-01 15:36:23 +00:00
return - 1 ;
else
return - 2 ;
}
else if ( read = = 0 )
return - 2 ; //closed by remote connection.
return read ;
2012-04-09 19:12:12 +00:00
# endif
2016-07-12 00:40:13 +00:00
case STREAM_WEB :
2013-03-31 04:21:08 +00:00
case STREAM_VFS :
return VFS_READ ( pluginstreamarray [ handle ] . vfs , dest , destlen ) ;
2005-03-01 15:36:23 +00:00
default :
return - 2 ;
}
}
2019-09-04 07:59:40 +00:00
static int QDECL Plug_Net_Send ( qhandle_t handle , void * src , int srclen )
2005-03-01 15:36:23 +00:00
{
int written ;
if ( handle < 0 | | handle > = pluginstreamarraylen | | pluginstreamarray [ handle ] . plugin ! = currentplug )
return - 2 ;
switch ( pluginstreamarray [ handle ] . type )
{
2014-03-30 08:55:06 +00:00
# ifdef HAVE_PACKET
2005-03-01 15:36:23 +00:00
case STREAM_SOCKET :
written = send ( pluginstreamarray [ handle ] . socket , src , srclen , 0 ) ;
if ( written < 0 )
{
2014-02-07 08:38:40 +00:00
if ( neterrno ( ) = = NET_EWOULDBLOCK )
2005-03-01 15:36:23 +00:00
return - 1 ;
else
return - 2 ;
}
else if ( written = = 0 )
return - 2 ; //closed by remote connection.
return written ;
2012-04-09 19:12:12 +00:00
# endif
2013-03-31 04:21:08 +00:00
case STREAM_VFS :
return VFS_WRITE ( pluginstreamarray [ handle ] . vfs , src , srclen ) ;
2005-11-30 01:20:53 +00:00
2005-03-01 15:36:23 +00:00
default :
return - 2 ;
}
}
2019-09-04 07:59:40 +00:00
static int QDECL Plug_Net_SendTo ( qhandle_t handle , void * src , int srclen , netadr_t * address )
2005-08-03 23:14:59 +00:00
{
int written ;
struct sockaddr_qstorage sockaddr ;
if ( handle = = - 1 )
{
2018-12-28 00:04:36 +00:00
# ifdef HAVE_CLIENT
NET_SendPacket ( cls . sockets , srclen , src , address ) ;
2005-08-03 23:14:59 +00:00
return srclen ;
2018-12-28 00:04:36 +00:00
# else
return - 2 ;
# endif
2005-08-03 23:14:59 +00:00
}
NetadrToSockadr ( address , & sockaddr ) ;
if ( handle < 0 | | handle > = pluginstreamarraylen | | pluginstreamarray [ handle ] . plugin ! = currentplug )
return - 2 ;
switch ( pluginstreamarray [ handle ] . type )
{
2014-03-30 08:55:06 +00:00
# ifdef HAVE_PACKET
2005-08-03 23:14:59 +00:00
case STREAM_SOCKET :
written = sendto ( pluginstreamarray [ handle ] . socket , src , srclen , 0 , ( struct sockaddr * ) & sockaddr , sizeof ( sockaddr ) ) ;
if ( written < 0 )
{
2014-02-07 08:38:40 +00:00
if ( neterrno ( ) = = NET_EWOULDBLOCK )
2005-08-03 23:14:59 +00:00
return - 1 ;
else
return - 2 ;
}
else if ( written = = 0 )
return - 2 ; //closed by remote connection.
return written ;
2012-04-09 19:12:12 +00:00
# endif
2005-08-03 23:14:59 +00:00
default :
return - 2 ;
}
}
2019-09-04 07:59:40 +00:00
static void QDECL Plug_Net_Close ( qhandle_t handle )
2005-12-15 19:15:39 +00:00
{
if ( handle < 0 | | handle > = pluginstreamarraylen | | pluginstreamarray [ handle ] . plugin ! = currentplug )
2019-09-04 07:59:40 +00:00
return ;
2005-12-15 19:15:39 +00:00
Plug_Net_Close_Internal ( handle ) ;
2009-04-06 00:34:32 +00:00
}
2019-06-21 03:59:46 +00:00
# if defined(HAVE_SERVER) && defined(HAVE_CLIENT)
qboolean FS_PathURLCache ( const char * url , char * path , size_t pathsize ) ;
2019-09-04 07:59:40 +00:00
static qboolean QDECL Plug_MapLog_Query ( const char * packagename , const char * mapname , float * vals )
2019-06-21 03:59:46 +00:00
{
if ( ! strncmp ( packagename , " http:// " , 7 ) | | ! strncmp ( packagename , " https:// " , 8 ) )
{
char temp [ MAX_OSPATH ] ;
if ( ! FS_PathURLCache ( packagename , temp , sizeof ( temp ) ) )
return false ;
if ( Log_CheckMapCompletion ( temp , mapname , & vals [ 0 ] , & vals [ 1 ] , & vals [ 2 ] , & vals [ 3 ] ) )
return true ;
return false ;
}
return Log_CheckMapCompletion ( packagename , mapname , & vals [ 0 ] , & vals [ 1 ] , & vals [ 2 ] , & vals [ 3 ] ) ;
}
# endif
2005-01-15 17:46:40 +00:00
void Plug_CloseAll_f ( void ) ;
2005-03-01 15:36:23 +00:00
void Plug_List_f ( void ) ;
2005-01-15 20:50:45 +00:00
void Plug_Close_f ( void ) ;
2018-10-11 10:31:23 +00:00
static void Plug_Load_f ( void )
2005-01-15 17:46:40 +00:00
{
2005-06-18 23:54:34 +00:00
char * plugin ;
plugin = Cmd_Argv ( 1 ) ;
if ( ! * plugin )
{
Con_Printf ( " Loads a plugin \n " ) ;
Con_Printf ( " plug_load [pluginpath] \n " ) ;
2013-11-21 23:02:28 +00:00
Con_Printf ( " example pluginpath: blah \n " ) ;
2019-09-04 07:59:40 +00:00
Con_Printf ( " will load " PLUGINPREFIX " blah " ARCH_CPU_POSTFIX ARCH_DL_POSTFIX " \n " ) ;
2005-06-18 23:54:34 +00:00
return ;
}
2019-09-04 07:59:40 +00:00
if ( ! Plug_Load ( plugin ) )
Con_Printf ( " Couldn't load plugin %s \n " , Cmd_Argv ( 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
}
2013-05-03 04:28:08 +00:00
void Plug_Initialise ( qboolean fromgamedir )
{
char nat [ MAX_OSPATH ] ;
2019-09-04 07:59:40 +00:00
if ( ! plugfuncs )
2013-05-03 04:28:08 +00:00
{
Cvar_Register ( & plug_sbar , " plugins " ) ;
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
Cvar_Register ( & plug_loaddefault , " plugins " ) ;
2015-10-11 11:34:58 +00:00
2013-05-03 04:28:08 +00:00
Cmd_AddCommand ( " plug_closeall " , Plug_CloseAll_f ) ;
Cmd_AddCommand ( " plug_close " , Plug_Close_f ) ;
Cmd_AddCommand ( " plug_load " , Plug_Load_f ) ;
Cmd_AddCommand ( " plug_list " , Plug_List_f ) ;
2019-09-04 07:59:40 +00:00
//set up internal plugins
plugfuncs = PlugBI_GetEngineInterface ( plugcorefuncs_name , sizeof ( * plugfuncs ) ) ;
cvarfuncs = plugfuncs - > GetEngineInterface ( plugcvarfuncs_name , sizeof ( * cvarfuncs ) ) ;
cmdfuncs = plugfuncs - > GetEngineInterface ( plugcmdfuncs_name , sizeof ( * cmdfuncs ) ) ;
2013-05-03 04:28:08 +00:00
}
2005-03-01 15:36:23 +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 SUBSERVERS
if ( ! SSV_IsSubServer ( ) ) //subservers will need plug_load I guess
# endif
if ( plug_loaddefault . ival & 2 )
2005-08-03 23:14:59 +00:00
{
2014-08-03 14:47:47 +00:00
if ( ! fromgamedir )
{
FS_NativePath ( " " , FS_BINARYPATH , nat , sizeof ( nat ) ) ;
Con_DPrintf ( " Loading plugins from \" %s \" \n " , nat ) ;
2019-06-21 03:59:46 +00:00
Sys_EnumerateFiles ( nat , PLUGINPREFIX " * " ARCH_CPU_POSTFIX ARCH_DL_POSTFIX , Plug_EnumeratedRoot , NULL , NULL ) ;
2014-08-03 14:47:47 +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 ( plug_loaddefault . ival & 1 )
{
unsigned int u ;
2019-09-04 07:59:40 +00:00
PM_EnumeratePlugins ( Plug_Load_Update ) ;
2015-02-02 08:01:53 +00:00
for ( u = 0 ; staticplugins [ u ] . name ; u + + )
{
2019-09-04 07:59:40 +00:00
Plug_Load ( staticplugins [ u ] . name ) ;
2015-02-02 08:01:53 +00:00
}
2005-08-03 23:14:59 +00:00
}
2004-09-24 02:45:00 +00:00
}
void Plug_Tick ( void )
{
2005-01-15 17:46:40 +00:00
plugin_t * oldplug = currentplug ;
for ( currentplug = plugs ; currentplug ; currentplug = currentplug - > next )
2004-09-24 02:45:00 +00:00
{
2005-01-15 17:46:40 +00:00
if ( currentplug - > tick )
2004-09-24 02:45:00 +00:00
{
2019-09-04 07:59:40 +00:00
double st = 0 ;
2015-04-21 20:51:18 +00:00
# ifdef SERVERONLY
2015-04-21 21:15:01 +00:00
st = sv . time ;
2015-04-21 20:51:18 +00:00
# elif defined(CLIENTONLY)
st = cl . time ;
# else
st = sv . state ? sv . time : cl . time ;
# endif
2019-09-04 07:59:40 +00:00
currentplug - > tick ( realtime , st ) ;
2004-09-24 02:45:00 +00:00
}
}
2005-01-15 17:46:40 +00:00
currentplug = oldplug ;
2004-09-24 02:45:00 +00:00
}
2005-12-15 19:15:39 +00:00
# ifndef SERVERONLY
2004-10-10 06:32:29 +00:00
void Plug_ResChanged ( void )
{
plugin_t * oldplug = currentplug ;
for ( currentplug = plugs ; currentplug ; currentplug = currentplug - > next )
{
if ( currentplug - > reschange )
2019-09-04 07:59:40 +00:00
currentplug - > reschange ( vid . width , vid . height ) ;
2004-10-10 06:32:29 +00:00
}
currentplug = oldplug ;
}
2005-12-15 19:15:39 +00:00
# endif
2004-10-10 06:32:29 +00:00
2004-09-24 02:45:00 +00:00
qboolean Plugin_ExecuteString ( void )
{
2005-01-15 17:46:40 +00:00
plugin_t * oldplug = currentplug ;
2004-09-24 02:45:00 +00:00
if ( Cmd_Argc ( ) > 0 )
{
2005-01-15 17:46:40 +00:00
for ( currentplug = plugs ; currentplug ; currentplug = currentplug - > next )
2004-09-24 02:45:00 +00:00
{
2005-01-15 17:46:40 +00:00
if ( currentplug - > executestring )
2004-09-24 02:45:00 +00:00
{
2019-09-04 07:59:40 +00:00
if ( currentplug - > executestring ( 0 ) )
2005-01-15 20:50:45 +00:00
{
currentplug = oldplug ;
2004-09-24 02:45:00 +00:00
return true ;
2005-01-15 20:50:45 +00:00
}
2004-09-24 02:45:00 +00:00
}
}
}
2005-01-15 17:46:40 +00:00
currentplug = oldplug ;
2004-09-24 02:45:00 +00:00
return false ;
}
2005-12-15 19:15:39 +00:00
# ifndef SERVERONLY
2013-11-21 23:02:28 +00:00
qboolean Plug_ConsoleLinkMouseOver ( float x , float y , char * text , char * info )
{
qboolean result = false ;
plugin_t * oldplug = currentplug ;
for ( currentplug = plugs ; currentplug ; currentplug = currentplug - > next )
{
if ( currentplug - > consolelinkmouseover )
{
2016-07-12 00:40:13 +00:00
char buffer [ 8192 ] ;
char * ptr ;
ptr = ( char * ) COM_QuotedString ( text , buffer , sizeof ( buffer ) - 10 , false ) ;
ptr + = strlen ( ptr ) ;
2017-09-20 11:27:13 +00:00
* ptr + + = ' ' ;
2016-07-12 00:40:13 +00:00
COM_QuotedString ( info , ptr , sizeof ( buffer ) - ( ptr - buffer ) , false ) ;
2013-11-21 23:02:28 +00:00
Cmd_TokenizeString ( buffer , false , false ) ;
2019-09-04 07:59:40 +00:00
result = currentplug - > consolelinkmouseover ( x , y ) ;
2013-11-21 23:02:28 +00:00
if ( result )
break ;
}
}
currentplug = oldplug ;
return result ;
}
2016-07-12 00:40:13 +00:00
qboolean Plug_ConsoleLink ( char * text , char * info , const char * consolename )
2013-06-23 02:17:02 +00:00
{
2013-11-21 23:02:28 +00:00
qboolean result = false ;
2013-06-23 02:17:02 +00:00
plugin_t * oldplug = currentplug ;
for ( currentplug = plugs ; currentplug ; currentplug = currentplug - > next )
{
if ( currentplug - > consolelink )
{
2016-07-12 00:40:13 +00:00
char buffer [ 8192 ] ;
char * ptr , oinfo = * info ;
* info = 0 ;
ptr = ( char * ) COM_QuotedString ( text , buffer , sizeof ( buffer ) - 10 , false ) ;
ptr + = strlen ( ptr ) ;
* ptr + + = ' ' ;
* info = oinfo ;
ptr = ( char * ) COM_QuotedString ( info , ptr , sizeof ( buffer ) - ( ptr - buffer ) - 5 , false ) ;
ptr + = strlen ( ptr ) ;
* ptr + + = ' ' ;
COM_QuotedString ( consolename , ptr , sizeof ( buffer ) - ( ptr - buffer ) , false ) ;
2013-06-23 02:17:02 +00:00
Cmd_TokenizeString ( buffer , false , false ) ;
2019-09-04 07:59:40 +00:00
result = currentplug - > consolelink ( ) ;
2013-11-21 23:02:28 +00:00
if ( result )
break ;
2013-06-23 02:17:02 +00:00
}
}
currentplug = oldplug ;
2013-11-21 23:02:28 +00:00
return result ;
2013-06-23 02:17:02 +00:00
}
2018-11-27 16:48:19 +00:00
int Plug_SubConsoleCommand ( console_t * con , const char * line )
2005-03-10 03:55:18 +00:00
{
2015-04-14 23:12:17 +00:00
int ret ;
2005-03-10 03:55:18 +00:00
char buffer [ 2048 ] ;
plugin_t * oldplug = currentplug ; //shouldn't really be needed, but oh well
currentplug = con - > userdata ;
2013-06-23 02:17:02 +00:00
Q_strncpyz ( buffer , va ( " \" %s \" %s " , con - > name , line ) , sizeof ( buffer ) ) ;
2005-03-10 03:55:18 +00:00
Cmd_TokenizeString ( buffer , false , false ) ;
2019-09-04 07:59:40 +00:00
ret = currentplug - > conexecutecommand ( 0 ) ;
2005-03-10 03:55:18 +00:00
currentplug = oldplug ;
2015-04-14 23:12:17 +00:00
return ret ;
2005-03-10 03:55:18 +00:00
}
2005-12-15 19:15:39 +00:00
# endif
2005-03-10 03:55:18 +00:00
2005-12-15 19:15:39 +00:00
# ifndef SERVERONLY
2005-08-03 23:14:59 +00:00
int Plug_ConnectionlessClientPacket ( char * buffer , int size )
{
for ( currentplug = plugs ; currentplug ; currentplug = currentplug - > next )
{
if ( currentplug - > connectionlessclientpacket )
{
2019-09-04 07:59:40 +00:00
switch ( currentplug - > connectionlessclientpacket ( buffer , size , & net_from ) )
2005-08-03 23:14:59 +00:00
{
case 0 :
continue ; //wasn't handled
case 1 :
currentplug = NULL ; //was handled with no apparent result
return true ;
case 2 :
# ifndef SERVERONLY
cls . protocol = CP_PLUGIN ; //woo, the plugin wants to connect to them!
protocolclientplugin = currentplug ;
# endif
currentplug = NULL ;
return true ;
}
}
}
return false ;
}
2005-12-15 19:15:39 +00:00
# endif
# ifndef SERVERONLY
2013-06-23 02:17:02 +00:00
void Plug_SBar ( playerview_t * pv )
2004-10-13 07:24:59 +00:00
{
2015-09-01 04:45:15 +00:00
# ifdef QUAKEHUD
2017-05-28 15:42:32 +00:00
# define sb_showscores pv->sb_showscores
# define sb_showteamscores pv->sb_showteamscores
2015-09-01 04:45:15 +00:00
# else
2017-05-28 15:42:32 +00:00
# define sb_showscores 0
# define sb_showteamscores 0
2015-09-01 04:45:15 +00:00
# endif
2006-01-21 00:06:49 +00:00
2004-10-13 07:24:59 +00:00
plugin_t * oc = currentplug ;
2013-06-23 02:17:02 +00:00
int ret ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
int cleared = false ;
2015-09-14 15:20:09 +00:00
int hudmode ;
2004-10-13 07:24:59 +00:00
2017-05-28 15:42:32 +00:00
if ( ! Sbar_ShouldDraw ( pv ) )
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
{
SCR_TileClear ( 0 ) ;
2007-02-26 03:00:25 +00:00
return ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
}
2007-02-26 03:00:25 +00:00
2006-08-20 01:35:56 +00:00
ret = 0 ;
2015-09-14 15:20:09 +00:00
if ( cl . deathmatch )
hudmode = 1 ;
else
hudmode = 2 ;
2016-07-15 12:26:24 +00:00
if ( ! ( plug_sbar . ival & 4 ) & & ( ( cls . protocol ! = CP_QUAKEWORLD & & cls . protocol ! = CP_NETQUAKE ) | | M_GameType ( ) ! = MGT_QUAKE1 ) )
currentplug = NULL ; //disable the hud if we're not running quake. q2/q3/h2 must not display the hud, allowing for a simpler install-anywhere installer that can include it.
else if ( ! ( plug_sbar . ival & hudmode ) )
2005-01-15 17:46:40 +00:00
currentplug = NULL ;
else
2004-10-13 07:24:59 +00:00
{
2005-01-15 17:46:40 +00:00
for ( currentplug = plugs ; currentplug ; currentplug = currentplug - > next )
2004-10-13 07:24:59 +00:00
{
2005-01-15 17:46:40 +00:00
if ( currentplug - > sbarlevel [ 0 ] )
{
2013-06-23 02:17:02 +00:00
//if you don't use splitscreen, use a full videosize rect.
R2D_ImageColours ( 1 , 1 , 1 , 1 ) ; // ensure menu colors are reset
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
if ( ! cleared )
{
cleared = true ;
SCR_TileClear ( 0 ) ;
}
2019-09-04 07:59:40 +00:00
ret | = currentplug - > sbarlevel [ 0 ] ( pv - cl . playerview , ( int ) r_refdef . vrect . x , ( int ) r_refdef . vrect . y , ( int ) r_refdef . vrect . width , ( int ) r_refdef . vrect . height , sb_showscores + sb_showteamscores * 2 ) ;
2005-01-15 17:46:40 +00:00
break ;
2004-10-13 07:24:59 +00:00
}
}
}
2007-02-26 03:00:25 +00:00
if ( ! ( ret & 1 ) )
2004-10-13 07:24:59 +00:00
{
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
if ( ! cleared )
SCR_TileClear ( sb_lines ) ;
2013-06-23 02:17:02 +00:00
Sbar_Draw ( pv ) ;
2004-10-13 07:24:59 +00:00
}
for ( currentplug = plugs ; currentplug ; currentplug = currentplug - > next )
{
if ( currentplug - > sbarlevel [ 1 ] )
{
2013-06-23 02:17:02 +00:00
R2D_ImageColours ( 1 , 1 , 1 , 1 ) ; // ensure menu colors are reset
2019-09-04 07:59:40 +00:00
ret | = currentplug - > sbarlevel [ 1 ] ( pv - cl . playerview , r_refdef . vrect . x , r_refdef . vrect . y , r_refdef . vrect . width , r_refdef . vrect . height , sb_showscores + sb_showteamscores * 2 ) ;
2004-10-13 07:24:59 +00:00
}
}
for ( currentplug = plugs ; currentplug ; currentplug = currentplug - > next )
{
if ( currentplug - > sbarlevel [ 2 ] )
{
2013-06-23 02:17:02 +00:00
R2D_ImageColours ( 1 , 1 , 1 , 1 ) ; // ensure menu colors are reset
2019-09-04 07:59:40 +00:00
ret | = currentplug - > sbarlevel [ 2 ] ( pv - cl . playerview , r_refdef . vrect . x , r_refdef . vrect . y , r_refdef . vrect . width , r_refdef . vrect . height , sb_showscores + sb_showteamscores * 2 ) ;
2004-10-13 07:24:59 +00:00
}
}
2017-05-28 15:42:32 +00:00
if ( ! ( ret & 2 ) )
2007-02-26 03:00:25 +00:00
{
2017-05-28 15:42:32 +00:00
Sbar_DrawScoreboard ( pv ) ;
2007-02-26 03:00:25 +00:00
}
2004-10-13 07:24:59 +00:00
currentplug = oc ;
2004-09-26 00:30:42 +00:00
}
2005-12-15 19:15:39 +00:00
# endif
2004-09-26 00:30:42 +00:00
2006-01-01 09:01:15 +00:00
qboolean Plug_ServerMessage ( char * buffer , int messagelevel )
2005-11-30 05:01:43 +00:00
{
2006-01-01 09:01:15 +00:00
qboolean ret = true ;
2007-02-23 00:21:33 +00:00
Cmd_TokenizeString ( buffer , false , 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
Cmd_Args_Set ( buffer , strlen ( buffer ) ) ;
2007-02-23 00:21:33 +00:00
2006-01-01 09:01:15 +00:00
for ( currentplug = plugs ; currentplug ; currentplug = currentplug - > next )
{
if ( currentplug - > svmsgfunction )
{
2019-09-04 07:59:40 +00:00
ret & = currentplug - > svmsgfunction ( messagelevel ) ;
2006-01-01 09:01:15 +00:00
}
}
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
Cmd_Args_Set ( NULL , 0 ) ;
2007-02-23 00:21:33 +00:00
2006-01-01 09:01:15 +00:00
return ret ; // true to display message, false to supress
}
qboolean Plug_ChatMessage ( char * buffer , int talkernum , int tpflags )
{
qboolean ret = true ;
2007-02-23 00:21:33 +00:00
Cmd_TokenizeString ( buffer , false , 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
Cmd_Args_Set ( buffer , strlen ( buffer ) ) ;
2007-02-23 00:21:33 +00:00
2006-01-01 09:01:15 +00:00
for ( currentplug = plugs ; currentplug ; currentplug = currentplug - > next )
{
if ( currentplug - > chatmsgfunction )
{
2019-09-04 07:59:40 +00:00
ret & = currentplug - > chatmsgfunction ( talkernum , tpflags ) ;
2006-01-01 09:01:15 +00:00
}
}
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
Cmd_Args_Set ( NULL , 0 ) ;
2007-02-23 00:21:33 +00:00
2006-01-01 09:01:15 +00:00
return ret ; // true to display message, false to supress
}
qboolean Plug_CenterPrintMessage ( char * buffer , int clientnum )
{
qboolean ret = true ;
2007-02-23 00:21:33 +00:00
Cmd_TokenizeString ( buffer , false , 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
Cmd_Args_Set ( buffer , strlen ( buffer ) ) ;
2007-02-23 00:21:33 +00:00
2005-11-30 05:01:43 +00:00
for ( currentplug = plugs ; currentplug ; currentplug = currentplug - > next )
{
2006-01-01 09:01:15 +00:00
if ( currentplug - > centerprintfunction )
2005-11-30 05:01:43 +00:00
{
2019-09-04 07:59:40 +00:00
ret & = currentplug - > centerprintfunction ( clientnum ) ;
2005-11-30 05:01:43 +00:00
}
}
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
Cmd_Args_Set ( NULL , 0 ) ;
2007-02-23 00:21:33 +00:00
2006-01-01 09:01:15 +00:00
return ret ; // true to display message, false to supress
2005-11-30 05:01:43 +00:00
}
2004-09-24 02:45:00 +00:00
void Plug_Close ( plugin_t * plug )
{
2013-03-31 04:21:08 +00:00
int i ;
2019-09-04 07:59:40 +00:00
currentplug = plug ;
if ( plug - > mayshutdown & & ! plug - > mayshutdown ( ) )
2006-01-29 03:45:00 +00:00
{
2019-09-04 07:59:40 +00:00
currentplug = NULL ;
Con_Printf ( " Plugin %s provides driver features, and cannot safely be unloaded at this time \n " , plug - > name ) ;
2006-01-29 03:45:00 +00:00
return ;
}
2004-09-24 02:45:00 +00:00
if ( plugs = = plug )
plugs = plug - > next ;
else
{
plugin_t * prev ;
for ( prev = plugs ; prev ; prev = prev - > next )
{
if ( prev - > next = = plug )
break ;
}
if ( ! prev )
Sys_Error ( " Plug_Close: not linked \n " ) ;
prev - > next = plug - > next ;
}
2020-02-11 18:06:10 +00:00
if ( ! com_workererror & & plug - > lib )
2015-02-02 08:01:53 +00:00
Con_DPrintf ( " Closing plugin %s \n " , plug - > name ) ;
2013-08-07 14:13:18 +00:00
//ensure any active contexts provided by the plugin are closed (stuff with destroy callbacks)
2017-02-21 20:22:07 +00:00
# if defined(PLUGINS) && !defined(SERVERONLY)
# ifdef HAVE_MEDIA_DECODER
2013-08-07 14:13:18 +00:00
Media_UnregisterDecoder ( plug , NULL ) ;
2017-02-21 20:22:07 +00:00
# endif
# ifdef HAVE_MEDIA_ENCODER
2013-08-07 14:13:18 +00:00
Media_UnregisterEncoder ( plug , NULL ) ;
2017-02-21 20:22:07 +00:00
# endif
2019-09-04 07:59:40 +00:00
# endif
# ifdef HAVE_CLIENT
S_UnregisterSoundInputModule ( plug ) ;
2013-08-07 14:13:18 +00:00
# endif
FS_UnRegisterFileSystemModule ( plug ) ;
2014-05-16 01:34:58 +00:00
Mod_UnRegisterAllModelFormats ( plug ) ;
2013-08-07 14:13:18 +00:00
//tell the plugin that everything is closed and that it should free up any lingering memory/stuff
//it is still allowed to create/have open files.
2013-07-13 12:14:32 +00:00
if ( plug - > shutdown )
{
plugin_t * cp = currentplug ;
currentplug = plug ;
2019-09-04 07:59:40 +00:00
plug - > shutdown ( ) ;
2013-07-13 12:14:32 +00:00
currentplug = cp ;
}
2013-08-07 14:13:18 +00:00
2019-09-04 07:59:40 +00:00
if ( plug - > lib )
Sys_CloseLibrary ( plug - > lib ) ;
2005-01-15 17:46:40 +00:00
2013-08-07 14:13:18 +00:00
//make sure anything else that was left is unlinked (stuff without destroy callbacks).
2013-03-31 04:21:08 +00:00
for ( i = 0 ; i < pluginstreamarraylen ; i + + )
{
if ( pluginstreamarray [ i ] . plugin = = plug )
{
Plug_Net_Close_Internal ( i ) ;
}
}
2005-01-15 17:46:40 +00:00
Plug_FreeConCommands ( plug ) ;
2005-12-15 19:15:39 +00:00
Plug_Client_Close ( plug ) ;
2012-07-05 19:42:36 +00:00
Z_Free ( plug ) ;
2005-12-15 19:15:39 +00:00
2019-09-04 07:59:40 +00:00
currentplug = NULL ;
2005-01-15 20:50:45 +00:00
}
void Plug_Close_f ( void )
{
plugin_t * plug ;
char * name = Cmd_Argv ( 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
char cleaned [ MAX_OSPATH ] ;
2005-01-15 20:50:45 +00:00
if ( Cmd_Argc ( ) < 2 )
{
Con_Printf ( " Close which plugin? \n " ) ;
return ;
}
2007-02-23 00:21:33 +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
name = Plug_CleanName ( name , cleaned , sizeof ( cleaned ) ) ;
2007-02-23 00:21:33 +00:00
if ( currentplug )
Sys_Error ( " Plug_CloseAll_f called inside a plugin! \n " ) ;
2005-01-15 20:50:45 +00:00
for ( plug = plugs ; plug ; plug = plug - > next )
{
2005-01-24 23:47:32 +00:00
if ( ! strcmp ( plug - > name , name ) )
2005-01-15 20:50:45 +00:00
{
Plug_Close ( plug ) ;
return ;
}
}
2005-06-18 23:54:34 +00:00
name = va ( " plugins/%s " , name ) ;
for ( plug = plugs ; plug ; plug = plug - > next )
{
if ( ! strcmp ( plug - > name , name ) )
{
Plug_Close ( plug ) ;
return ;
}
}
Con_Printf ( " Plugin %s does not appear to be loaded \n " , Cmd_Argv ( 1 ) ) ;
2004-09-24 02:45:00 +00:00
}
2005-01-15 17:46:40 +00:00
void Plug_CloseAll_f ( void )
2004-09-24 02:45:00 +00:00
{
2006-02-02 01:13:52 +00:00
plugin_t * p ;
2005-01-15 17:46:40 +00:00
if ( currentplug )
Sys_Error ( " Plug_CloseAll_f called inside a plugin! \n " ) ;
while ( plugs )
{
2006-02-02 01:13:52 +00:00
p = plugs ;
2019-09-04 07:59:40 +00:00
while ( p - > mayshutdown & & ! p - > mayshutdown ( ) )
2006-02-02 01:13:52 +00:00
{
p = p - > next ;
if ( ! p )
return ;
}
Plug_Close ( p ) ;
2005-01-15 17:46:40 +00:00
}
}
2004-09-24 02:45:00 +00:00
2019-01-13 16:51:50 +00:00
int QDECL Plug_List_Print ( const char * fname , qofs_t fsize , time_t modtime , void * parm , searchpathfuncs_t * spath )
{
2019-02-16 19:09:07 +00:00
plugin_t * plug ;
2019-01-13 16:51:50 +00:00
char plugname [ MAX_QPATH ] ;
//lots of awkward logic so we hide modules for other cpus.
size_t nl = strlen ( fname ) ;
size_t u ;
2020-01-20 18:36:45 +00:00
char * arch_ext = ARCH_DL_POSTFIX ;
2019-02-16 19:09:07 +00:00
static const char * knownarch [ ] =
2019-01-13 16:51:50 +00:00
{
" x32 " , " x64 " , " amd64 " , " x86 " , //various x86 ABIs
" arm " , " arm64 " , " armhf " , //various arm ABIs
" ppc " , " unk " , //various misc ABIs
} ;
2019-09-04 07:59:40 +00:00
# ifdef _WIN32
char * mssuck ;
while ( ( mssuck = strchr ( fname , ' \\ ' ) ) )
* mssuck = ' / ' ;
# endif
2020-01-20 18:36:45 +00:00
if ( ! parm )
{
parm = " " ;
arch_ext = " " ; //static plugins have no extension.
}
if ( nl > = strlen ( arch_ext ) & & ! Q_strcasecmp ( fname + nl - strlen ( arch_ext ) , arch_ext ) )
2019-01-13 16:51:50 +00:00
{
2020-01-20 18:36:45 +00:00
nl - = strlen ( arch_ext ) ;
2019-01-13 16:51:50 +00:00
for ( u = 0 ; u < countof ( knownarch ) ; u + + )
{
size_t al = strlen ( knownarch [ u ] ) ;
if ( ! Q_strncasecmp ( fname + nl - al , knownarch [ u ] , al ) )
{
nl - = al ;
break ;
}
}
if ( u = = countof ( knownarch ) | | ! Q_strcasecmp ( knownarch [ u ] , ARCH_CPU_POSTFIX ) )
{
if ( nl > sizeof ( plugname ) - 1 )
nl = sizeof ( plugname ) - 1 ;
if ( nl > 0 & & fname [ nl ] = = ' _ ' )
nl - - ; //ignore the _ before the ABI name.
memcpy ( plugname , fname , nl ) ;
plugname [ nl ] = 0 ;
//don't bother printing it if its already loaded.
for ( plug = plugs ; plug ; plug = plug - > next )
{
2019-09-04 07:59:40 +00:00
if ( ! Q_strncasecmp ( plug - > filename , parm , strlen ( parm ) ) & & ! Q_strcasecmp ( plug - > filename + strlen ( parm ) , fname ) )
2019-01-13 16:51:50 +00:00
return true ;
}
2019-09-04 07:59:40 +00:00
Con_Printf ( " ^[^1%s%s \\ type \\ plug_load %s \\ ^]: not loaded \n " , ( const char * ) parm , fname , plugname + ( ( ! Q_strncasecmp ( plugname , PLUGINPREFIX , strlen ( PLUGINPREFIX ) ) ) ? strlen ( PLUGINPREFIX ) : 0 ) ) ;
2019-01-13 16:51:50 +00:00
}
}
return true ;
}
2005-03-01 15:36:23 +00:00
void Plug_List_f ( void )
{
2019-01-13 16:51:50 +00:00
char binarypath [ MAX_OSPATH ] ;
char rootpath [ MAX_OSPATH ] ;
unsigned int u ;
2005-03-01 15:36:23 +00:00
plugin_t * plug ;
2020-01-20 18:36:45 +00:00
2019-10-18 08:37:38 +00:00
Con_Printf ( " Loaded plugins: \n " ) ;
2005-03-01 15:36:23 +00:00
for ( plug = plugs ; plug ; plug = plug - > next )
2019-09-04 07:59:40 +00:00
Con_Printf ( " ^[^2%s \\ type \\ plug_close %s \\ ^]: loaded \n " , plug - > filename , plug - > name ) ;
2019-01-13 16:51:50 +00:00
2020-01-20 18:36:45 +00:00
if ( staticplugins [ 0 ] . name )
{
Con_DPrintf ( " Internal plugins: \n " ) ;
for ( u = 0 ; staticplugins [ u ] . name ; u + + )
Plug_List_Print ( staticplugins [ u ] . name , 0 , 0 , NULL , NULL ) ;
}
2019-01-13 16:51:50 +00:00
if ( FS_NativePath ( " " , FS_BINARYPATH , binarypath , sizeof ( binarypath ) ) )
{
2019-09-04 07:59:40 +00:00
# ifdef _WIN32
char * mssuck ;
2019-01-13 16:51:50 +00:00
while ( ( mssuck = strchr ( binarypath , ' \\ ' ) ) )
* mssuck = ' / ' ;
2019-09-04 07:59:40 +00:00
# endif
2020-01-20 18:36:45 +00:00
Con_DPrintf ( " Scanning for plugins at %s: \n " , binarypath ) ;
2019-06-21 03:59:46 +00:00
Sys_EnumerateFiles ( binarypath , PLUGINPREFIX " * " ARCH_DL_POSTFIX , Plug_List_Print , binarypath , NULL ) ;
2019-01-13 16:51:50 +00:00
}
if ( FS_NativePath ( " " , FS_ROOT , rootpath , sizeof ( rootpath ) ) )
{
2019-09-04 07:59:40 +00:00
# ifdef _WIN32
char * mssuck ;
2019-01-13 16:51:50 +00:00
while ( ( mssuck = strchr ( rootpath , ' \\ ' ) ) )
* mssuck = ' / ' ;
2019-09-04 07:59:40 +00:00
# endif
2019-01-13 16:51:50 +00:00
if ( strcmp ( binarypath , rootpath ) )
2019-10-18 08:37:38 +00:00
{
2020-01-20 18:36:45 +00:00
Con_DPrintf ( " Scanning for plugins at %s: \n " , rootpath ) ;
2019-06-21 03:59:46 +00:00
Sys_EnumerateFiles ( rootpath , PLUGINPREFIX " * " ARCH_DL_POSTFIX , Plug_List_Print , rootpath , NULL ) ;
2019-10-18 08:37:38 +00:00
}
2019-01-13 16:51:50 +00:00
}
2020-01-20 18:36:45 +00:00
//should probably check downloadables too.
2005-03-01 15:36:23 +00:00
}
2013-05-11 14:02:55 +00:00
void Plug_Shutdown ( qboolean preliminary )
2005-01-15 17:46:40 +00:00
{
2013-05-11 14:02:55 +00:00
plugin_t * * p ;
if ( preliminary )
2005-01-15 17:46:40 +00:00
{
2013-05-11 14:02:55 +00:00
//close the non-block-closes plugins first, before most of the rest of the subsystems are down
for ( p = & plugs ; * p ; )
{
2019-09-04 07:59:40 +00:00
if ( ( * p ) - > mayshutdown & & ! ( * p ) - > mayshutdown ( ) )
2013-05-11 14:02:55 +00:00
p = & ( * p ) - > next ;
else
2015-06-14 08:16:15 +00:00
Plug_Close ( * p ) ;
2013-05-11 14:02:55 +00:00
}
2005-01-15 17:46:40 +00:00
}
2013-05-11 14:02:55 +00:00
else
{
//now that our various handles etc are closed, its safe to terminate the various driver plugins.
while ( plugs )
{
2019-09-04 07:59:40 +00:00
plugs - > mayshutdown = NULL ;
2013-05-11 14:02:55 +00:00
Plug_Close ( plugs ) ;
}
2012-07-05 19:42:36 +00:00
2013-05-11 14:02:55 +00:00
BZ_Free ( pluginstreamarray ) ;
pluginstreamarray = NULL ;
pluginstreamarraylen = 0 ;
2013-03-31 04:21:08 +00:00
2013-05-11 14:02:55 +00:00
plugincvararraylen = 0 ;
BZ_Free ( plugincvararray ) ;
plugincvararray = NULL ;
2012-11-27 03:23:19 +00:00
2013-05-11 14:02:55 +00:00
plugincommandarraylen = 0 ;
BZ_Free ( plugincommandarray ) ;
plugincommandarray = NULL ;
2013-03-31 04:21:08 +00:00
# ifndef SERVERONLY
2013-05-11 14:02:55 +00:00
Plug_Client_Shutdown ( ) ;
2013-03-31 04:21:08 +00:00
# endif
2013-05-11 14:02:55 +00:00
}
2004-09-30 22:51:15 +00:00
}
2015-02-02 08:01:53 +00:00
2019-09-04 07:59:40 +00:00
static void * QDECL PlugBI_GetEngineInterface ( const char * interfacename , size_t structsize )
2015-02-02 08:01:53 +00:00
{
2019-09-04 07:59:40 +00:00
if ( ! strcmp ( interfacename , plugcorefuncs_name ) )
{
static plugcorefuncs_t funcs =
{
PlugBI_GetEngineInterface ,
PlugBI_ExportFunction ,
PlugBI_ExportInterface ,
PlugBI_GetPluginName ,
Plug_Con_Print ,
Plug_Sys_Error ,
Plug_Sys_Milliseconds ,
} ;
if ( structsize = = sizeof ( funcs ) )
return & funcs ;
}
if ( ! strcmp ( interfacename , plugcmdfuncs_name ) )
{
static plugcmdfuncs_t funcs =
{
Plug_Cmd_AddCommand ,
NULL , //Plug_Cmd_TokenizeString,
Plug_Cmd_Args ,
Plug_Cmd_Argv ,
Plug_Cmd_Argc ,
Plug_Cmd_AddText ,
} ;
if ( structsize = = sizeof ( funcs ) )
return & funcs ;
}
if ( ! strcmp ( interfacename , plugcvarfuncs_name ) )
{
static plugcvarfuncs_t funcs =
{
Plug_Cvar_SetString ,
Plug_Cvar_SetFloat ,
Plug_Cvar_GetString ,
Plug_Cvar_GetFloat ,
Plug_Cvar_Register ,
Plug_Cvar_Update ,
Plug_Cvar_GetNVFDG ,
} ;
if ( structsize = = sizeof ( funcs ) )
return & funcs ;
}
if ( ! strcmp ( interfacename , plugfsfuncs_name ) )
{
static plugfsfuncs_t funcs =
{
Plug_FS_Open ,
Plug_Net_Close ,
Plug_Net_Send ,
Plug_Net_Recv ,
Plug_FS_Seek ,
Plug_FS_GetLength ,
FS_OpenVFS ,
FS_NativePath ,
COM_EnumerateFiles ,
} ;
if ( structsize = = sizeof ( funcs ) )
return & funcs ;
}
if ( ! strcmp ( interfacename , plugnetfuncs_name ) )
{
static plugnetfuncs_t funcs =
{
Plug_Net_TCPConnect ,
Plug_Net_TCPListen ,
Plug_Net_Accept ,
Plug_Net_Recv ,
Plug_Net_Send ,
Plug_Net_SendTo ,
Plug_Net_Close ,
Plug_Net_SetTLSClient ,
Plug_Net_GetTLSBinding ,
} ;
if ( structsize = = sizeof ( funcs ) )
return & funcs ;
}
# ifdef HAVE_CLIENT
if ( ! strcmp ( interfacename , plug2dfuncs_name ) )
{
static plug2dfuncs_t funcs =
{
Plug_Draw_LoadImageData ,
Plug_Draw_LoadImageShader ,
Plug_Draw_LoadImagePic ,
Plug_Draw_UnloadImage ,
Plug_Draw_Image ,
Plug_Draw_ImageSize ,
Plug_Draw_Fill ,
Plug_Draw_Line ,
Plug_Draw_Character ,
Plug_Draw_String ,
Plug_Draw_CharacterH ,
Plug_Draw_StringH ,
Plug_Draw_StringWidth ,
Plug_Draw_ColourP ,
Plug_Draw_Colour4f ,
Plug_LocalSound ,
} ;
if ( structsize = = sizeof ( funcs ) )
return & funcs ;
}
if ( ! strcmp ( interfacename , plugclientfuncs_name ) )
{
static plugclientfuncs_t funcs =
{
Plug_CL_GetStats ,
Plug_GetPlayerInfo ,
Plug_GetNetworkInfo ,
Plug_GetLocalPlayerNumbers ,
Plug_GetLocationName ,
Plug_GetLastInputFrame ,
Plug_GetServerInfo ,
Plug_SetUserInfo ,
2019-09-07 16:19:13 +00:00
# if defined(HAVE_SERVER) && defined(HAVE_CLIENT)
2019-09-04 07:59:40 +00:00
Plug_MapLog_Query ,
2019-09-07 16:19:13 +00:00
# else
NULL ,
# endif
2019-09-04 09:15:13 +00:00
# ifdef QUAKEHUD
Plug_GetTeamInfo ,
Plug_GetWeaponStats ,
Plug_GetTrackerOwnFrags ,
2020-02-11 18:06:10 +00:00
Plug_GetPredInfo ,
2019-09-04 09:15:13 +00:00
# else
NULL ,
NULL ,
NULL ,
2020-02-11 18:06:10 +00:00
NULL ,
2019-09-04 09:15:13 +00:00
# endif
2019-09-04 07:59:40 +00:00
} ;
if ( structsize = = sizeof ( funcs ) )
return & funcs ;
}
if ( ! strcmp ( interfacename , pluginputfuncs_name ) )
{
static pluginputfuncs_t funcs =
{
Plug_SetMenuFocus ,
Plug_HasMenuFocus ,
//for menu input
Plug_Key_GetKeyCode ,
Plug_Key_GetKeyName ,
M_FindKeysForBind ,
Plug_Key_GetKeyBind ,
Plug_Key_SetKeyBind ,
} ;
if ( structsize = = sizeof ( funcs ) )
return & funcs ;
}
if ( ! strcmp ( interfacename , plugsubconsolefuncs_name ) )
{
static plugsubconsolefuncs_t funcs =
{
Plug_Con_POpen ,
Plug_Con_SubPrint ,
Plug_Con_RenameSub ,
Plug_Con_IsActive ,
Plug_Con_SetActive ,
Plug_Con_Destroy ,
Plug_Con_NameForNum ,
Plug_Con_GetConsoleFloat ,
Plug_Con_SetConsoleFloat ,
Plug_Con_GetConsoleString ,
Plug_Con_SetConsoleString ,
} ;
if ( structsize = = sizeof ( funcs ) )
return & funcs ;
}
if ( ! strcmp ( interfacename , plugaudiofuncs_name ) )
{
static plugaudiofuncs_t funcs =
{
Plug_LocalSound ,
Plug_S_RawAudio ,
} ;
if ( structsize = = sizeof ( funcs ) )
return & funcs ;
}
# endif
# ifdef SUPPORT_ICE
if ( ! strcmp ( interfacename , ICE_API_CURRENT ) & & structsize = = sizeof ( iceapi ) )
return & iceapi ;
# endif
# ifdef USERBE
if ( ! strcmp ( interfacename , " RBE " ) )
{
static rbeplugfuncs_t funcs =
{
RBEPLUGFUNCS_VERSION ,
2020-04-19 01:23:32 +00:00
sizeof ( wedict_t ) ,
2019-09-04 07:59:40 +00:00
World_RegisterPhysicsEngine ,
World_UnregisterPhysicsEngine ,
World_GenerateCollisionMesh ,
World_ReleaseCollisionMesh ,
World_LinkEdict ,
VectorAngles ,
AngleVectors
} ;
if ( structsize = = sizeof ( funcs ) )
return & funcs ;
}
# endif
# ifdef MULTITHREAD
2019-09-04 09:15:13 +00:00
if ( ! strcmp ( interfacename , plugthreadfuncs_name ) )
2019-09-04 07:59:40 +00:00
{
2019-09-04 09:15:13 +00:00
static plugthreadfuncs_t funcs =
2019-09-04 07:59:40 +00:00
{
Sys_CreateMutex ,
Sys_LockMutex ,
Sys_UnlockMutex ,
Sys_DestroyMutex
} ;
if ( structsize = = sizeof ( funcs ) )
return & funcs ;
}
# endif
# ifdef SKELETALMODELS
if ( ! strcmp ( interfacename , " Models " ) )
{
static plugmodfuncs_t funcs =
{
MODPLUGFUNCS_VERSION ,
Plug_RegisterModelFormatText ,
Plug_RegisterModelFormatMagic ,
Plug_UnRegisterModelFormat ,
Plug_UnRegisterAllModelFormats ,
ZG_Malloc ,
COM_StripExtension ,
R_ConcatTransforms ,
Matrix3x4_Invert_Simple ,
VectorAngles ,
AngleVectors ,
GenMatrixPosQuat4Scale ,
Alias_ForceConvertBoneData ,
# ifdef HAVE_CLIENT
Image_GetTexture ,
# else
NULL ,
# endif
Mod_AccumulateTextureVectors ,
Mod_NormaliseTextureVectors ,
Mod_ForName
} ;
if ( structsize = = sizeof ( funcs ) )
return & funcs ;
}
# endif
# ifdef TERRAIN
if ( ! strcmp ( interfacename , " Terrain " ) )
return Terr_GetTerrainFuncs ( structsize ) ;
# endif
# ifdef HAVE_SERVER
if ( ! strcmp ( interfacename , " SSQCVM " ) )
return sv . world . progs ;
# endif
# if defined(CSQC_DAT) && defined(HAVE_CLIENT)
if ( ! strcmp ( interfacename , " CSQCVM " ) )
{
extern world_t csqc_world ;
return csqc_world . progs ;
}
# endif
# if defined(MENU_DAT) && defined(HAVE_CLIENT)
if ( ! strcmp ( interfacename , " MenuQCVM " ) )
{
extern world_t menu_world ;
return menu_world . progs ;
}
# endif
return NULL ;
2015-02-02 08:01:53 +00:00
}
2004-09-30 22:51:15 +00:00
# endif