2005-09-24 04:48:20 +00:00
/*
Copyright ( C ) 1996 - 1997 Id Software , Inc .
This program is free software ; you can redistribute it and / or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation ; either version 2
of the License , or ( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE .
See the included ( GNU . txt ) GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program ; if not , write to the Free Software
Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
*/
2006-02-22 02:38:48 +00:00
# ifdef __GNUC__
2007-11-16 14:53:45 +00:00
# define LittleLong(x) ({ typeof(x) _x = (x); _x = (((unsigned char *)&_x)[0]|(((unsigned char *)&_x)[1]<<8)|(((unsigned char *)&_x)[2]<<16)|(((unsigned char *)&_x)[3]<<24)); _x; })
# define LittleShort(x) ({ typeof(x) _x = (x); _x = (((unsigned char *)&_x)[0]|(((unsigned char *)&_x)[1]<<8)); _x; })
2006-02-22 02:38:48 +00:00
# else
2007-11-16 14:53:45 +00:00
# define LittleLong(x) (x)
# define LittleShort(x) (x)
2006-02-22 02:38:48 +00:00
# endif
2005-09-24 04:48:20 +00:00
2006-10-07 22:29:31 +00:00
//this is for a future version
//#define COMMENTARY
2005-09-06 01:09:36 +00:00
//each server that we are connected to has it's own state.
//it should be easy enough to use one thread per server.
//mvd info is forwarded to other proxies instantly
//qwd stuff is buffered and delayed. :(
//this means that when a new proxy connects, we have to send initial state as well as a chunk of pending state, expect to need to send new data before the proxy even has all the init stuff. We may need to raise MAX_PROXY_BUFFER to be larger than on the server
2007-11-16 14:53:45 +00:00
# ifdef __GNUC__
# define PRINTFWARNING(x) __attribute__((format(printf, x, (x+1))))
# else
# define PRINTFWARNING(x) /*nothing*/
# endif
2005-10-07 02:02:15 +00:00
//how does multiple servers work
//each proxy acts as a cluster of connections to servers
//when a viewer connects, they are given a list of active server connections
//if there's only one server connection, they are given that one automatically.
2007-11-19 14:49:37 +00:00
# if defined(__APPLE__) && defined(__MACH__)
# define MACOSX
# endif
2011-04-30 17:21:10 +00:00
# include <stdio.h>
/*work around fucked MSVC functions. we use our own for these*/
2019-12-17 17:41:12 +00:00
# if _MSC_VER >= 1300 && _MSC_VER < 1900
2011-04-30 17:21:10 +00:00
# include <string.h>
# ifndef _CRT_SECURE_NO_WARNINGS
# define _CRT_SECURE_NO_WARNINGS
# endif
# define vsnprintf q_vsnprintf /*msvc doesn't null terminate. its insecute and thus useless*/
# define stricmp _stricmp /*msvc just doesn't work properly*/
# define chdir _chdir
# define gwtcwd _getcwd
# endif
2005-09-06 01:09:36 +00:00
# ifdef _WIN32
2005-09-24 04:48:20 +00:00
# include <conio.h>
2010-03-14 14:35:56 +00:00
# include <winsock2.h> //this includes windows.h and is the reason for much compiling slowness with windows builds.
# ifdef IPPROTO_IPV6
# include <ws2tcpip.h>
# else
2019-12-17 17:41:12 +00:00
# define IPPROTO_IPV6 41
# ifndef EAI_NONAME
2010-03-14 14:35:56 +00:00
# define EAI_NONAME 8
2019-12-17 17:41:12 +00:00
# endif
2010-03-14 14:35:56 +00:00
struct ip6_scope_id
{
union
{
struct
{
u_long Zone : 28 ;
u_long Level : 4 ;
} ;
u_long Value ;
} ;
} ;
struct in6_addr
{
u_char s6_addr [ 16 ] ; /* IPv6 address */
} ;
typedef struct sockaddr_in6
{
short sin6_family ;
u_short sin6_port ;
u_long sin6_flowinfo ;
struct in6_addr sin6_addr ;
union
{
u_long sin6_scope_id ;
struct ip6_scope_id sin6_scope_struct ;
} ;
} ;
2011-07-15 12:41:09 +00:00
# if !(_MSC_VER >= 1500)
struct addrinfo
{
int ai_flags ;
int ai_family ;
int ai_socktype ;
int ai_protocol ;
size_t ai_addrlen ;
char * ai_canonname ;
struct sockaddr * ai_addr ;
struct addrinfo * ai_next ;
} ;
# endif
2010-03-14 14:35:56 +00:00
# endif
2006-09-17 01:27:32 +00:00
# ifdef _MSC_VER
# pragma comment (lib, "wsock32.lib")
# endif
2005-09-06 01:09:36 +00:00
# define qerrno WSAGetLastError()
2019-02-16 19:09:07 +00:00
# define NET_EWOULDBLOCK WSAEWOULDBLOCK
# define NET_EINPROGRESS WSAEINPROGRESS
# define NET_ECONNREFUSED WSAECONNREFUSED
# define NET_ENOTCONN WSAENOTCONN
2005-09-06 01:09:36 +00:00
2006-09-17 01:27:32 +00:00
//we have special functions to properly terminate sprintf buffers in windows.
//we assume other systems are designed with even a minor thought to security.
2019-02-16 19:09:07 +00:00
# if !defined(__MINGW32__)
2006-09-17 01:27:32 +00:00
# define unlink _unlink //why do MS have to be so awkward?
2007-11-16 14:53:45 +00:00
int snprintf ( char * buffer , int buffersize , char * format , . . . ) PRINTFWARNING ( 3 ) ;
2011-04-30 17:21:10 +00:00
int vsnprintf ( char * buffer , int buffersize , const char * format , va_list argptr ) ;
2006-09-17 01:27:32 +00:00
# else
# define unlink remove //seems mingw misses something
# endif
2005-09-24 04:48:20 +00:00
# ifdef _MSC_VER
//okay, so warnings are here to help... they're ugly though.
# pragma warning(disable: 4761) //integral size mismatch in argument
# pragma warning(disable: 4244) //conversion from float to short
# pragma warning(disable: 4018) //signed/unsigned mismatch
2005-09-06 01:09:36 +00:00
# endif
# elif defined(__CYGWIN__)
2005-09-24 04:48:20 +00:00
# include <sys/time.h>
2005-09-06 01:09:36 +00:00
# include <sys/types.h>
# include <sys/socket.h>
# include <sys/errno.h>
# include <arpa/inet.h>
# include <stdarg.h>
# include <netdb.h>
2005-09-24 04:48:20 +00:00
# include <sys/ioctl.h>
# include <unistd.h>
2005-09-06 01:09:36 +00:00
# define ioctlsocket ioctl
# define closesocket close
2024-09-13 18:15:15 +00:00
# elif (defined(unix) && !defined(__CYGWIN__)) || defined(ixemul) // I hope by adding MACOSX here it doesnt stop it from being natively built on macosx
2005-09-24 04:48:20 +00:00
# include <sys/time.h>
2005-09-06 16:44:31 +00:00
# include <sys/types.h>
# include <sys/socket.h>
2006-02-22 00:48:22 +00:00
# include <netinet/in.h>
2024-07-14 18:56:31 +00:00
# include <netinet/tcp.h>
2005-10-09 09:40:26 +00:00
# include <arpa/inet.h>
2005-09-06 16:44:31 +00:00
# include <netdb.h>
# include <stdarg.h>
# include <stdlib.h>
# include <string.h>
# include <errno.h>
# include <sys/ioctl.h>
# include <unistd.h>
# define ioctlsocket ioctl
# define closesocket close
2024-07-14 18:56:31 +00:00
# if defined(__linux__) && !defined(ANDROID)
// #define HAVE_EPOLL
# endif
# ifdef HAVE_EPOLL
# include <sys/epoll.h>
# endif
2007-12-11 15:47:16 +00:00
# elif (defined(__MORPHOS__) && !defined(ixemul))
# include <stdlib.h>
# include <unistd.h>
# include <sys/socket.h>
# include <sys/ioctl.h>
# include <netinet/in.h>
2024-07-14 18:56:31 +00:00
# include <netinet/tcp.h>
2007-12-11 15:47:16 +00:00
# include <netdb.h>
# include <errno.h>
2008-01-02 13:41:57 +00:00
# define qerrno Errno()
2007-12-11 15:47:16 +00:00
# define ioctlsocket IoctlSocket
# define closesocket CloseSocket
2005-09-06 01:09:36 +00:00
# else
# error "Please insert required headers here"
//try the cygwin ones
# endif
2019-02-16 19:09:07 +00:00
# ifndef NET_EWOULDBLOCK
# define NET_EWOULDBLOCK EWOULDBLOCK
# define NET_EINPROGRESS EINPROGRESS
# define NET_ECONNREFUSED ECONNREFUSED
# define NET_ENOTCONN ENOTCONN
# endif
# ifndef NET_EAGAIN
# define NET_EAGAIN NET_EWOULDBLOCK
2006-10-22 17:16:43 +00:00
# endif
2012-09-30 05:52:03 +00:00
# ifndef IPV6_V6ONLY
# define IPV6_V6ONLY 27
# endif
2006-10-22 17:16:43 +00:00
2005-09-24 04:48:20 +00:00
# ifndef pgetaddrinfo
# ifndef _WIN32
# define pgetaddrinfo getaddrinfo
# define pfreeaddrinfo freeaddrinfo
# endif
# endif
# ifndef SOCKET
# define SOCKET int
# endif
# ifndef INVALID_SOCKET
# define INVALID_SOCKET -1
# endif
# ifndef qerrno
# define qerrno errno
# endif
2005-09-06 01:09:36 +00:00
# include <stdio.h>
2005-09-24 04:48:20 +00:00
# include <string.h>
2005-09-06 01:09:36 +00:00
2006-10-11 23:04:31 +00:00
# ifndef _WIN32
//stricmp is ansi, strcasecmp is unix.
# define stricmp strcasecmp
# define strnicmp strncasecmp
# endif
2007-07-23 10:53:59 +00:00
# define ustrlen(s) strlen((char*)(s))
# define ustrcmp(s1,s2) strcmp((char*)(s1),(char*)(s2))
# define ustrncmp(s1,s2,l) strncmp((char*)(s1),(char*)(s2),l)
2006-10-07 22:29:31 +00:00
2012-04-20 14:41:40 +00:00
size_t strlcpy ( char * dst , const char * src , size_t siz ) ;
2006-10-07 22:29:31 +00:00
2020-03-25 21:29:30 +00:00
typedef struct
{
unsigned int digestsize ;
unsigned int contextsize ; //you need to alloca(te) this much memory...
void ( * init ) ( void * context ) ;
void ( * process ) ( void * context , const void * data , size_t datasize ) ;
void ( * terminate ) ( unsigned char * digest , void * context ) ;
} hashfunc_t ;
2024-07-14 18:56:31 +00:00
extern hashfunc_t hash_md5 ;
2020-03-25 21:29:30 +00:00
extern hashfunc_t hash_sha1 ;
2023-02-20 06:13:40 +00:00
/*extern hashfunc_t hash_sha2_224;
extern hashfunc_t hash_sha2_256 ;
extern hashfunc_t hash_sha2_384 ;
extern hashfunc_t hash_sha2_512 ; */
2020-03-25 21:29:30 +00:00
size_t CalcHash ( hashfunc_t * hash , unsigned char * digest , size_t maxdigestsize , const unsigned char * string , size_t stringlen ) ;
2024-07-14 18:56:31 +00:00
unsigned int CalcHashInt ( const hashfunc_t * hash , const void * data , size_t datasize ) ;
size_t CalcHMAC ( hashfunc_t * hashfunc , unsigned char * digest , size_t maxdigestsize , const unsigned char * data , size_t datalen , const unsigned char * key , size_t keylen ) ;
2018-04-06 17:39:32 +00:00
2012-04-23 04:37:33 +00:00
# ifdef LIBQTV
2012-04-24 12:22:50 +00:00
# define Sys_Printf QTVSys_Printf
2012-04-23 04:37:33 +00:00
# endif
2019-02-16 19:09:07 +00:00
# ifndef STRINGIFY
# define STRINGIFY2(s) #s
# define STRINGIFY(s) STRINGIFY2(s)
# endif
2018-04-06 17:39:32 +00:00
# ifdef SVNREVISION
2019-02-16 19:09:07 +00:00
# define QTV_VERSION_STRING STRINGIFY(SVNREVISION)
2018-04-06 17:39:32 +00:00
# else
//#include "../engine/common/bothdefs.h"
//#define QTV_VERSION_STRING STRINGIFY(FTE_VER_MAJOR)"."STRINGIFY(FTE_VER_MINOR)
# define QTV_VERSION_STRING "v?""?""?"
# endif
2005-09-06 01:09:36 +00:00
2007-07-23 10:53:59 +00:00
# define PROX_DEFAULTSERVERPORT 27500
2005-09-06 01:09:36 +00:00
# define PROX_DEFAULTLISTENPORT 27501
# define PROX_DEFAULTSERVER "localhost:27500"
2005-09-24 04:48:20 +00:00
# define DEFAULT_HOSTNAME "FTEQTV"
2015-04-21 04:12:00 +00:00
# define PROXYWEBSITE "http: //fte.triptohell.info" //url for program
2005-09-06 01:09:36 +00:00
2005-09-24 04:48:20 +00:00
# define MAX_ENTITY_LEAFS 32
2006-09-17 01:27:32 +00:00
2007-07-23 10:53:59 +00:00
# include "protocol.h"
2005-09-24 04:48:20 +00:00
2006-09-17 01:27:32 +00:00
# ifndef __cplusplus
2005-09-06 01:09:36 +00:00
typedef enum { false , true } qboolean ;
2006-09-17 01:27:32 +00:00
# else
typedef int qboolean ;
extern " C " {
# endif
2005-09-06 01:09:36 +00:00
2012-04-20 14:41:40 +00:00
typedef struct
{
void * tcpcon ; /*value not indirected, only compared*/
char sockaddr [ 64 ] ;
2010-03-14 14:35:56 +00:00
} netadr_t ;
2005-09-06 01:09:36 +00:00
2006-09-17 01:27:32 +00:00
2006-10-07 22:29:31 +00:00
# ifdef COMMENTARY
2006-09-19 01:48:12 +00:00
typedef struct soundcapt_s {
int ( * update ) ( struct soundcapt_s * ghnd , int samplechunks , char * buffer ) ;
void ( * close ) ( struct soundcapt_s * ptr ) ;
} soundcapt_t ;
2007-03-03 18:46:43 +00:00
typedef struct soundplay_s {
int ( * update ) ( struct soundplay_s * ghnd , int samplechunks , char * buffer ) ;
void ( * close ) ( struct soundplay_s * ptr ) ;
} soundplay_t ;
2006-10-07 22:29:31 +00:00
# endif
2006-09-19 01:48:12 +00:00
2005-09-06 01:09:36 +00:00
typedef struct {
unsigned int readpos ;
unsigned int cursize ;
unsigned int maxsize ;
2007-07-23 10:53:59 +00:00
void * data ;
2005-09-06 01:09:36 +00:00
unsigned int startpos ;
qboolean overflowed ;
qboolean allowoverflow ;
} netmsg_t ;
typedef struct {
SOCKET sock ;
netadr_t remote_address ;
unsigned short qport ;
unsigned int last_received ;
unsigned int cleartime ;
2007-11-15 21:19:52 +00:00
int maxdatagramlen ;
int maxreliablelen ;
2005-09-06 01:09:36 +00:00
int reliable_length ;
qboolean drop ;
2006-02-21 19:55:12 +00:00
qboolean isclient ;
2006-09-17 01:27:32 +00:00
qboolean isnqprotocol ;
2005-09-06 01:09:36 +00:00
netmsg_t message ;
2007-11-15 21:19:52 +00:00
char message_buf [ MAX_MSGLEN ] ; //reliable message being built
char reliable_buf [ MAX_MSGLEN ] ; //reliable message that we're making sure arrives.
2005-09-06 01:09:36 +00:00
float rate ;
unsigned int incoming_acknowledged ;
unsigned int last_reliable_sequence ;
unsigned int incoming_reliable_acknowledged ;
unsigned int incoming_reliable_sequence ;
unsigned int reliable_sequence ;
unsigned int incoming_sequence ;
unsigned int outgoing_sequence ;
2006-09-17 01:27:32 +00:00
unsigned int reliable_start ;
unsigned int outgoing_unreliable ;
unsigned int incoming_unreliable ;
unsigned int in_fragment_length ;
char in_fragment_buf [ MAX_NQMSGLEN ] ;
2005-09-06 01:09:36 +00:00
} netchan_t ;
typedef struct {
# define MAX_QPATH 64
char name [ MAX_QPATH ] ;
} filename_t ;
typedef struct {
2018-04-06 17:39:32 +00:00
unsigned char frame ;
unsigned short modelindex ;
unsigned char colormap ;
unsigned char skinnum ;
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
float origin [ 3 ] ;
float angles [ 3 ] ;
2018-04-06 17:39:32 +00:00
unsigned short effects ;
unsigned char alpha ;
unsigned char scale ;
// unsigned char fatness;
// unsigned char abslight;
// unsigned char h2flags;
// unsigned char colormod[3];
// unsigned short light[4];
// unsigned char lightstyle;
// unsigned char lightpflags;
// unsigned char tagentity;
// unsigned char tagindex;
2005-09-06 01:09:36 +00:00
} entity_state_t ;
typedef struct {
unsigned char frame ;
unsigned char modelindex ;
2018-04-06 17:39:32 +00:00
//colormap
2005-09-06 01:09:36 +00:00
unsigned char skinnum ;
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
float origin [ 3 ] ;
2018-04-06 17:39:32 +00:00
float angles [ 3 ] ;
2005-09-06 01:09:36 +00:00
unsigned char effects ;
2018-04-06 17:39:32 +00:00
short velocity [ 3 ] ;
2005-09-06 01:09:36 +00:00
unsigned char weaponframe ;
} player_state_t ;
typedef struct {
unsigned int stats [ MAX_STATS ] ;
char userinfo [ MAX_USERINFO ] ;
int ping ;
2005-09-24 21:33:03 +00:00
int packetloss ;
2005-09-06 01:09:36 +00:00
int frags ;
float entertime ;
2005-09-24 04:48:20 +00:00
int leafcount ;
unsigned short leafs [ MAX_ENTITY_LEAFS ] ;
2012-04-20 14:41:40 +00:00
qboolean oldactive : 1 ;
2005-09-06 01:09:36 +00:00
qboolean active : 1 ;
qboolean gibbed : 1 ;
qboolean dead : 1 ;
player_state_t current ;
player_state_t old ;
} playerinfo_t ;
typedef struct {
entity_state_t ents [ ENTS_PER_FRAME ] ; //ouchie ouchie!
unsigned short entnum [ ENTS_PER_FRAME ] ;
int numents ;
} packet_entities_t ;
2006-04-11 22:15:09 +00:00
typedef struct {
unsigned char msec ;
2018-04-06 17:39:32 +00:00
float angles [ 3 ] ;
2006-04-11 22:15:09 +00:00
short forwardmove , sidemove , upmove ;
unsigned char buttons ;
unsigned char impulse ;
} usercmd_t ;
extern const usercmd_t nullcmd ;
2006-10-20 14:25:20 +00:00
typedef float vec3_t [ 3 ] ;
typedef struct {
float gravity ;
float maxspeed ;
float spectatormaxspeed ;
float accelerate ;
float airaccelerate ;
float waterfriction ;
float entgrav ;
float stopspeed ;
float wateraccelerate ;
float friction ;
} movevars_t ;
typedef struct {
//in / out
vec3_t origin ;
vec3_t velocity ;
//in
usercmd_t cmd ;
movevars_t movevars ;
//internal
vec3_t angles ;
float frametime ;
vec3_t forward , right , up ;
} pmove_t ;
2018-04-06 17:39:32 +00:00
# define MBTN_UP (1u<<0)
# define MBTN_DOWN (1u<<1)
# define MBTN_LEFT (1u<<2)
# define MBTN_RIGHT (1u<<3)
# define MBTN_ENTER (1u<<4)
2005-09-06 01:09:36 +00:00
# define MAX_BACK_BUFFERS 16
2005-10-07 02:02:15 +00:00
typedef struct sv_s sv_t ;
typedef struct cluster_s cluster_t ;
2005-09-06 01:09:36 +00:00
typedef struct viewer_s {
2018-04-06 17:39:32 +00:00
//viewers are regular clients connected over udp.
//they may be watching a communal stream, or they might themselves be playing through the proxy, directly controlling the stream.
2005-09-06 01:09:36 +00:00
qboolean drop ;
2006-09-17 01:27:32 +00:00
unsigned int timeout ;
unsigned int nextpacket ; //for nq clients
2005-09-06 01:09:36 +00:00
netchan_t netchan ;
qboolean maysend ;
qboolean chokeme ;
qboolean thinksitsconnected ;
2006-10-07 22:29:31 +00:00
qboolean conmenussupported ;
2007-03-18 05:07:10 +00:00
qboolean isproxy ;
2019-03-01 22:39:30 +00:00
unsigned int pext1 , pext2 ;
2005-09-06 01:09:36 +00:00
2005-10-07 02:02:15 +00:00
int servercount ;
2005-09-06 01:09:36 +00:00
netmsg_t backbuf [ MAX_BACK_BUFFERS ] ; //note data is malloced!
int backbuffered ;
unsigned int currentstats [ MAX_STATS ] ;
2006-04-11 22:15:09 +00:00
int trackplayer ;
int thisplayer ;
2006-11-03 15:53:04 +00:00
int userid ;
2005-09-06 01:09:36 +00:00
packet_entities_t frame [ ENTITY_FRAMES ] ;
2007-09-08 20:15:59 +00:00
int delta_frames [ ENTITY_FRAMES ] ;
2005-09-06 01:09:36 +00:00
struct viewer_s * next ;
2006-11-03 15:53:04 +00:00
struct viewer_s * commentator ;
2005-09-06 01:09:36 +00:00
2005-09-24 04:48:20 +00:00
char name [ 32 ] ;
2006-10-20 14:25:20 +00:00
char userinfo [ 1024 ] ;
2006-04-11 22:15:09 +00:00
int lost ; //packets
usercmd_t ucmds [ 3 ] ;
2012-04-23 04:37:33 +00:00
unsigned int lasttime ;
2018-04-06 17:39:32 +00:00
unsigned int menubuttons ;
2005-09-24 04:48:20 +00:00
int settime ; //the time that we last told the client.
2006-10-20 14:25:20 +00:00
vec3_t velocity ;
vec3_t origin ;
2005-10-07 02:02:15 +00:00
2006-02-20 01:33:13 +00:00
int isadmin ;
char expectcommand [ 16 ] ;
2005-10-07 02:02:15 +00:00
sv_t * server ;
2007-03-18 05:07:10 +00:00
int menuspamtime ;
2005-10-07 02:02:15 +00:00
int menunum ;
int menuop ;
int fwdval ; //for scrolling up/down the menu using +forward/+back :)
2008-10-06 05:38:19 +00:00
int firstconnect ;
2005-09-06 01:09:36 +00:00
} viewer_t ;
2012-04-20 14:41:40 +00:00
typedef struct
{
qboolean websocket ; //true if we need to use special handling
unsigned char wsbuf [ 16 ] ;
int wsbuflen ;
int wspushed ;
int wsbits ;
} wsrbuf_t ;
2006-09-17 01:27:32 +00:00
//'other proxy', these are mvd stream clients.
2005-09-06 01:09:36 +00:00
typedef struct oproxy_s {
2006-09-17 01:27:32 +00:00
int authkey ;
unsigned int droptime ;
2005-09-06 01:09:36 +00:00
qboolean flushing ;
qboolean drop ;
2005-09-24 04:48:20 +00:00
2006-09-17 01:27:32 +00:00
sv_t * defaultstream ;
2007-07-23 10:53:59 +00:00
sv_t * stream ;
2006-09-17 01:27:32 +00:00
2007-03-16 04:05:01 +00:00
FILE * srcfile ; //buffer is padded with data from this file when its empty
FILE * file ; //recording a demo (written to)
2006-09-17 01:27:32 +00:00
SOCKET sock ; //playing to a proxy
2012-04-20 14:41:40 +00:00
wsrbuf_t websocket ;
2006-09-17 01:27:32 +00:00
unsigned char inbuffer [ MAX_PROXY_INBUFFER ] ;
unsigned int inbuffersize ; //amount of data available.
2005-09-24 04:48:20 +00:00
2005-09-06 01:09:36 +00:00
unsigned char buffer [ MAX_PROXY_BUFFER ] ;
unsigned int buffersize ; //use cyclic buffering.
unsigned int bufferpos ;
struct oproxy_s * next ;
} oproxy_t ;
2012-04-20 14:41:40 +00:00
typedef struct tcpconnect_s
{
struct tcpconnect_s * next ;
SOCKET sock ;
wsrbuf_t websocket ;
netadr_t peeraddr ;
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
char * initialstreamname ;
2012-04-20 14:41:40 +00:00
unsigned char inbuffer [ MAX_PROXY_INBUFFER ] ;
unsigned int inbuffersize ; //amount of data available.
unsigned char outbuffer [ MAX_PROXY_INBUFFER ] ;
unsigned int outbuffersize ; //amount of data available.
} tcpconnect_t ;
2005-09-06 01:09:36 +00:00
typedef struct {
2018-04-06 17:39:32 +00:00
float origin [ 3 ] ;
unsigned short soundindex ;
2005-09-06 01:09:36 +00:00
unsigned char volume ;
unsigned char attenuation ;
} staticsound_t ;
2005-09-24 04:48:20 +00:00
typedef struct bsp_s bsp_t ;
typedef struct {
entity_state_t baseline ;
2006-12-26 21:26:10 +00:00
// entity_state_t current;
// entity_state_t old;
// unsigned int updatetime; //to stop lerping when it's an old entity (bodies, stationary grenades, ...)
2005-09-24 04:48:20 +00:00
int leafcount ;
unsigned short leafs [ MAX_ENTITY_LEAFS ] ;
} entity_t ;
2006-10-07 22:29:31 +00:00
# define MAX_ENTITY_FRAMES 64
typedef struct {
2006-12-26 21:26:10 +00:00
int oldframe ;
2006-10-07 22:29:31 +00:00
int numents ;
int maxents ;
2006-12-26 21:26:10 +00:00
entity_state_t * ents ; //dynamically allocated
unsigned short * entnums ; //dynamically allocated
2006-10-07 22:29:31 +00:00
} frame_t ;
2006-02-21 19:55:12 +00:00
typedef struct {
2006-04-11 22:15:09 +00:00
unsigned char number ;
char bits [ 6 ] ;
} nail_t ;
2006-02-21 19:55:12 +00:00
2007-01-06 09:46:32 +00:00
typedef struct {
float pos [ 3 ] ;
float angle [ 3 ] ;
} intermission_t ;
2007-07-23 10:53:59 +00:00
typedef enum {
SRC_BAD ,
SRC_DEMO ,
2014-11-21 18:10:29 +00:00
SRC_DEMODIR ,
2007-07-23 10:53:59 +00:00
SRC_UDP ,
SRC_TCP
} sourcetype_t ;
2007-12-12 11:17:18 +00:00
typedef enum {
ERR_NONE , //stream is fine
2009-07-07 23:40:06 +00:00
ERR_PAUSED ,
2007-12-12 11:17:18 +00:00
ERR_RECONNECT , //stream needs to reconnect
ERR_PERMANENT , //permanent error, transitioning to disabled next frame
ERR_DISABLED , //stream is disabled, can be set to reconnect by admin
ERR_DROP //stream _will_ be forgotten about next frame
} errorstate_t ;
2007-01-09 05:24:03 +00:00
struct sv_s { //details about a server connection (also known as stream)
2006-09-17 01:27:32 +00:00
char connectpassword [ 64 ] ; //password given to server
2005-09-06 01:09:36 +00:00
netadr_t serveraddress ;
2006-02-21 19:55:12 +00:00
netchan_t netchan ;
2007-03-03 21:39:06 +00:00
qboolean serverquery ;
2005-09-06 01:09:36 +00:00
2007-07-23 10:53:59 +00:00
sourcetype_t sourcetype ;
2007-03-18 05:07:10 +00:00
//proxy chaining
qboolean serverisproxy ;
qboolean proxyisselected ;
2007-07-23 10:53:59 +00:00
qboolean upstreamacceptschat ;
qboolean upstreamacceptsdownload ;
2007-03-18 05:07:10 +00:00
//
2006-09-17 01:27:32 +00:00
qboolean parsingqtvheader ;
unsigned char upstreambuffer [ 2048 ] ;
int upstreambuffersize ;
2005-09-06 01:09:36 +00:00
unsigned int parsetime ;
2007-07-23 10:53:59 +00:00
unsigned int parsespeed ;
2005-09-06 01:09:36 +00:00
2006-04-11 22:15:09 +00:00
FILE * downloadfile ;
char downloadname [ 256 ] ;
char status [ 64 ] ;
2007-05-28 02:31:48 +00:00
qboolean silentstream ;
2007-07-23 10:53:59 +00:00
qboolean usequakeworldprotocols ;
2018-04-06 17:39:32 +00:00
unsigned int pext1 ;
unsigned int pext2 ;
2024-07-14 18:56:31 +00:00
unsigned int pexte ;
2006-02-21 19:55:12 +00:00
int challenge ;
unsigned short qport ;
int isconnected ;
int clservercount ;
unsigned int nextsendpings ;
2009-07-07 23:40:06 +00:00
2006-02-21 23:25:54 +00:00
unsigned int timeout ;
unsigned int packetratelimiter ;
2007-01-09 05:24:03 +00:00
2006-04-11 22:15:09 +00:00
viewer_t * controller ;
2007-01-09 05:24:03 +00:00
int controllersquencebias ;
2006-09-17 01:27:32 +00:00
qboolean proxyplayer ; //a player is actually playing on the proxy.
usercmd_t proxyplayerucmds [ 3 ] ;
int proxyplayerucmdnum ;
int proxyplayerbuttons ;
float proxyplayerangles [ 3 ] ;
float proxyplayerimpulse ;
2006-04-11 23:26:39 +00:00
qboolean maysend ;
2005-09-06 01:09:36 +00:00
2006-10-22 19:18:15 +00:00
FILE * sourcefile ;
2005-09-06 01:09:36 +00:00
unsigned int filelength ;
SOCKET sourcesock ;
2014-11-21 18:10:29 +00:00
int last_random_number ; // for demo directories randomizing stuff
2005-09-06 01:09:36 +00:00
2007-01-09 05:24:03 +00:00
// SOCKET tcpsocket; //tcp + mvd protocol
// int tcplistenportnum;
2005-09-06 01:09:36 +00:00
oproxy_t * proxies ;
qboolean parsingconnectiondata ; //so reject any new connects for now
2012-04-23 04:37:33 +00:00
unsigned int mapstarttime ;
2005-09-24 04:48:20 +00:00
unsigned int physicstime ; //the last time all the ents moved.
2006-02-21 23:25:54 +00:00
unsigned int simtime ;
2005-09-06 01:09:36 +00:00
unsigned int curtime ;
unsigned int oldpackettime ;
unsigned int nextpackettime ;
2006-02-21 19:55:12 +00:00
unsigned int nextconnectattempt ;
2007-12-12 11:17:18 +00:00
errorstate_t errored ;
2010-03-14 14:35:56 +00:00
enum autodisconnect_e {
AD_NO ,
AD_WHENEMPTY ,
AD_REVERSECONNECT ,
AD_STATUSPOLL
} autodisconnect ;
2006-02-21 19:55:12 +00:00
unsigned int numviewers ;
2005-09-06 01:09:36 +00:00
2005-10-07 02:02:15 +00:00
cluster_t * cluster ;
sv_t * next ; //next proxy->server connection
2005-09-24 04:48:20 +00:00
2006-10-07 22:29:31 +00:00
# ifdef COMMENTARY
2006-09-19 01:48:12 +00:00
//audio stuff
soundcapt_t * comentrycapture ;
2006-10-07 22:29:31 +00:00
# endif
2006-09-19 01:48:12 +00:00
2005-09-06 01:09:36 +00:00
//options:
2005-10-07 02:02:15 +00:00
char server [ MAX_QPATH ] ;
2006-09-17 01:27:32 +00:00
int streamid ;
2009-07-07 23:40:06 +00:00
struct mapstate_s
{
//this structure is freed+memset in QTV_CleanupMap
bsp_t * bsp ;
int numinlines ;
nail_t nails [ 32 ] ;
int nailcount ;
char gamedir [ MAX_QPATH ] ;
2020-02-11 18:06:10 +00:00
char mapname [ 256 ] ; //world.message
2009-07-07 23:40:06 +00:00
movevars_t movevars ;
int cdtrack ;
entity_t entity [ MAX_ENTITIES ] ;
frame_t frame [ MAX_ENTITY_FRAMES ] ;
// int maxents;
staticsound_t staticsound [ MAX_STATICSOUNDS ] ;
int staticsound_count ;
entity_state_t spawnstatic [ MAX_STATICENTITIES ] ;
int spawnstatic_count ;
filename_t lightstyle [ MAX_LIGHTSTYLES ] ;
char serverinfo [ MAX_SERVERINFO_STRING ] ;
char hostname [ MAX_QPATH ] ;
playerinfo_t players [ MAX_CLIENTS ] ;
filename_t modellist [ MAX_MODELS ] ;
filename_t soundlist [ MAX_SOUNDS ] ;
int modelindex_spike ; // qw is wierd.
int modelindex_player ; // qw is wierd.
int trackplayer ;
int thisplayer ;
qboolean ispaused ;
} map ;
2018-04-06 17:39:32 +00:00
unsigned char buffer [ MAX_PROXY_BUFFER ] ; //this doesn't cycle.
int buffersize ; //it memmoves down
int forwardpoint ; //the point in the stream that we've forwarded up to.
2005-10-09 09:40:26 +00:00
} ;
2005-10-07 02:02:15 +00:00
2007-03-03 18:46:43 +00:00
typedef struct {
2018-04-06 17:39:32 +00:00
char name [ 128 ] ;
2007-03-03 18:46:43 +00:00
int size ;
int time , smalltime ;
} availdemo_t ;
2019-02-16 19:09:07 +00:00
enum
{
SG_IPV4 ,
SG_IPV6 ,
SG_UNIX ,
SOCKETGROUPS
} ;
2024-07-14 18:56:31 +00:00
typedef struct turnclient_s turnclient_t ;
2005-10-09 09:40:26 +00:00
struct cluster_s {
2019-02-16 19:09:07 +00:00
SOCKET qwdsocket [ SOCKETGROUPS ] ; //udp + quakeworld protocols
SOCKET tcpsocket [ SOCKETGROUPS ] ; //tcp listening socket (for mvd and listings and stuff)
2012-04-20 14:41:40 +00:00
tcpconnect_t * tcpconnects ; //'tcpconnect' qizmo-compatible quakeworld-over-tcp connection
2005-10-07 02:02:15 +00:00
char commandinput [ 512 ] ;
int inputlength ;
unsigned int mastersendtime ;
unsigned int mastersequence ;
unsigned int curtime ;
2024-07-14 18:56:31 +00:00
# ifdef HAVE_EPOLL
int epfd ;
# endif
unsigned int numrelays ;
turnclient_t * turns ;
char chalkey [ 64 ] ; //to identify the master properly. probably kinda pointless. base64 encoded.
unsigned char turnkey [ 32 ] ; //raw key shared with broker to prove TURN identity was given by broker. NOTE: we are not verifying each, so we depend on clockskew to prevent any longterm abuse. there's no accounts anywhere though so anyone can get a key if they ask properly.
qboolean turnenabled ;
unsigned short turn_minport , turn_maxport ; //set to 0 to let the OS decide.
char * protocolname ;
int protocolver ;
unsigned char turn_ipv4 [ 4 ] ;
unsigned char turn_ipv6 [ 16 ] ;
unsigned int numpeers ;
struct relaypeer_s * relaypeer ;
unsigned int relay_lastping ;
unsigned int relay_lastquery ;
qboolean relayenabled ;
qboolean pingtreeenabled ;
2005-10-07 02:02:15 +00:00
viewer_t * viewers ;
int numviewers ;
sv_t * servers ;
int numservers ;
2006-09-17 01:27:32 +00:00
int nextstreamid ;
2006-11-03 15:53:04 +00:00
int nextuserid ;
2005-10-07 02:02:15 +00:00
2006-12-26 21:26:10 +00:00
sv_t * viewserver ;
2005-10-07 02:02:15 +00:00
//options
2012-04-23 04:37:33 +00:00
char autojoinadr [ 128 ] ; //new clients automatically .join this server
2005-10-07 02:02:15 +00:00
int qwlistenportnum ;
2006-09-17 01:27:32 +00:00
int tcplistenportnum ;
char adminpassword [ 256 ] ; //password required for rcon etc
char qtvpassword [ 256 ] ; //password required to connect a proxy
2005-09-24 04:48:20 +00:00
char hostname [ 256 ] ;
char master [ MAX_QPATH ] ;
2007-07-23 10:53:59 +00:00
char demodir [ MAX_QPATH ] ;
2008-05-25 22:02:52 +00:00
char downloaddir [ MAX_QPATH ] ; //must be slash terminated, or empty.
2011-01-04 02:56:16 +00:00
char plugindatasource [ 256 ] ; //sued by the http server for use with npfte
char mapsource [ 256 ] ; //sued by the http server for use with npfte
2005-10-07 02:02:15 +00:00
qboolean chokeonnotupdated ;
qboolean lateforward ;
qboolean notalking ;
2005-09-24 04:48:20 +00:00
qboolean nobsp ;
2006-10-07 22:29:31 +00:00
qboolean allownqclients ; //nq clients require no challenge
qboolean nouserconnects ; //prohibit users from connecting to new streams.
2020-02-11 18:06:10 +00:00
qboolean reverseallowed ; //demos can be submitted from servers via 'qtvreverse' without needing to keep idle connections live.
2012-04-20 14:41:40 +00:00
int anticheattime ; //intial connection buffer delay (set high to block specing enemies)
int tooslowdelay ; //if stream ran out of data, stop parsing for this long
2006-09-17 01:27:32 +00:00
2005-09-25 20:50:57 +00:00
int maxviewers ;
2006-09-17 01:27:32 +00:00
int numproxies ;
2005-09-25 20:50:57 +00:00
int maxproxies ;
2005-09-06 01:09:36 +00:00
2005-10-09 09:40:26 +00:00
qboolean wanttoexit ;
2005-10-07 02:02:15 +00:00
2006-09-17 01:27:32 +00:00
oproxy_t * pendingproxies ;
2007-03-03 18:46:43 +00:00
availdemo_t availdemos [ 2048 ] ;
int availdemoscount ;
2005-10-09 09:40:26 +00:00
} ;
2005-09-06 01:09:36 +00:00
2007-01-09 05:24:03 +00:00
# define MENU_NONE 0
2007-03-18 05:07:10 +00:00
# define MENU_MAIN 1 //MENU_SERVERS
# define MENU_SERVERS 2
# define MENU_CLIENTS 3
# define MENU_ADMIN 4
# define MENU_ADMINSERVER 5
# define MENU_DEMOS 6
# define MENU_FORWARDING 7
2007-08-03 19:57:56 +00:00
# define MENU_SERVERBROWSER 8
# define MENU_HELP 9
2007-03-18 05:07:10 +00:00
# define MENU_DEFAULT MENU_MAIN
2005-09-06 01:09:36 +00:00
2007-03-18 05:07:10 +00:00
enum {
MENU_MAIN_STREAMS ,
MENU_MAIN_NEWSTREAM ,
2007-08-03 19:57:56 +00:00
MENU_MAIN_SERVERBROWSER ,
2007-03-18 05:07:10 +00:00
MENU_MAIN_PREVPROX ,
2007-08-03 19:57:56 +00:00
MENU_MAIN_HELP ,
2005-09-06 01:09:36 +00:00
2007-03-18 05:07:10 +00:00
MENU_MAIN_CLIENTLIST ,
MENU_MAIN_DEMOS ,
MENU_MAIN_ADMIN ,
MENU_MAIN_NEXTPROX ,
MENU_MAIN_ITEMCOUNT
} ;
2005-09-06 01:09:36 +00:00
unsigned char ReadByte ( netmsg_t * b ) ;
unsigned short ReadShort ( netmsg_t * b ) ;
2024-07-14 18:56:31 +00:00
unsigned short ReadBigShort ( netmsg_t * b ) ;
2005-09-06 01:09:36 +00:00
unsigned int ReadLong ( netmsg_t * b ) ;
2024-07-14 18:56:31 +00:00
unsigned int ReadBigLong ( netmsg_t * b ) ;
2005-09-06 01:09:36 +00:00
float ReadFloat ( netmsg_t * b ) ;
void ReadString ( netmsg_t * b , char * string , int maxlen ) ;
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
float ReadCoord ( netmsg_t * b , unsigned int pext ) ;
float ReadAngle ( netmsg_t * b , unsigned int pext ) ;
2005-09-06 01:09:36 +00:00
2006-09-17 02:35:23 +00:00
unsigned int SwapLong ( unsigned int val ) ;
unsigned int BigLong ( unsigned int val ) ;
2005-09-06 01:09:36 +00:00
2006-09-17 01:27:32 +00:00
//flags for where a message can be sent, for easy broadcasting
# define Q1 (NQ|QW)
# define QW 1
# define NQ 2
2006-09-19 01:48:12 +00:00
# define CONNECTING 4
2007-07-23 10:53:59 +00:00
# include "cmd.h"
2005-09-06 01:09:36 +00:00
2007-07-23 10:53:59 +00:00
void InitNetMsg ( netmsg_t * b , void * buffer , int bufferlength ) ;
2005-09-06 01:09:36 +00:00
unsigned char ReadByte ( netmsg_t * b ) ;
unsigned short ReadShort ( netmsg_t * b ) ;
unsigned int ReadLong ( netmsg_t * b ) ;
float ReadFloat ( netmsg_t * b ) ;
void ReadString ( netmsg_t * b , char * string , int maxlen ) ;
void WriteByte ( netmsg_t * b , unsigned char c ) ;
void WriteShort ( netmsg_t * b , unsigned short l ) ;
2024-07-14 18:56:31 +00:00
void WriteBigShort ( netmsg_t * b , unsigned short l ) ;
2005-09-06 01:09:36 +00:00
void WriteLong ( netmsg_t * b , unsigned int l ) ;
2024-07-14 18:56:31 +00:00
void WriteBigLong ( netmsg_t * b , unsigned int l ) ;
2005-09-06 01:09:36 +00:00
void WriteFloat ( netmsg_t * b , float f ) ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
void WriteCoord ( netmsg_t * b , float c , unsigned int pext ) ;
void WriteAngle ( netmsg_t * b , float a , unsigned int pext ) ;
2005-09-06 01:09:36 +00:00
void WriteString2 ( netmsg_t * b , const char * str ) ;
void WriteString ( netmsg_t * b , const char * str ) ;
2007-07-23 10:53:59 +00:00
void WriteData ( netmsg_t * b , const void * data , int length ) ;
2005-09-06 01:09:36 +00:00
2007-07-23 10:53:59 +00:00
void Multicast ( sv_t * tv , void * buffer , int length , int to , unsigned int playermask , int suitablefor ) ;
void Broadcast ( cluster_t * cluster , void * buffer , int length , int suitablefor ) ;
void ParseMessage ( sv_t * tv , void * buffer , int length , int to , int mask ) ;
2006-11-03 15:53:04 +00:00
void BuildServerData ( sv_t * tv , netmsg_t * msg , int servercount , viewer_t * spectatorflag ) ;
2006-09-17 01:27:32 +00:00
void BuildNQServerData ( sv_t * tv , netmsg_t * msg , qboolean mvd , int servercount ) ;
2005-10-07 02:02:15 +00:00
void QW_UpdateUDPStuff ( cluster_t * qtv ) ;
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
void QW_TCPConnection ( cluster_t * cluster , oproxy_t * sock , char * initialstringname /*strduped*/ ) ;
2005-09-24 04:48:20 +00:00
unsigned int Sys_Milliseconds ( void ) ;
void Prox_SendInitialEnts ( sv_t * qtv , oproxy_t * prox , netmsg_t * msg ) ;
2012-04-23 04:37:33 +00:00
qboolean QTV_ConnectStream ( sv_t * qtv , char * serverurl ) ;
void QTV_ShutdownStream ( sv_t * qtv ) ;
2006-04-11 22:15:09 +00:00
qboolean NET_StringToAddr ( char * s , netadr_t * sadr , int defaultport ) ;
2007-11-16 14:53:45 +00:00
void QTV_Printf ( sv_t * qtv , char * format , . . . ) PRINTFWARNING ( 2 ) ;
2019-02-16 19:09:07 +00:00
void QTV_UpdatedServerInfo ( sv_t * tv ) ;
void QTV_CleanupMap ( sv_t * qtv ) ;
2005-09-24 04:48:20 +00:00
void SendBufferToViewer ( viewer_t * v , const char * buffer , int length , qboolean reliable ) ;
2007-11-16 14:53:45 +00:00
void QW_PrintfToViewer ( viewer_t * v , char * format , . . . ) PRINTFWARNING ( 2 ) ;
void QW_StuffcmdToViewer ( viewer_t * v , char * format , . . . ) PRINTFWARNING ( 2 ) ;
2007-07-23 10:53:59 +00:00
void QW_StreamPrint ( cluster_t * cluster , sv_t * server , viewer_t * allbut , char * message ) ;
2007-11-16 14:53:45 +00:00
void QW_StreamStuffcmd ( cluster_t * cluster , sv_t * server , char * fmt , . . . ) PRINTFWARNING ( 3 ) ;
2007-07-23 10:53:59 +00:00
void QTV_SayCommand ( cluster_t * cluster , sv_t * qtv , viewer_t * v , char * fullcommand ) ; //execute a command from a view
2019-02-16 19:09:07 +00:00
void QW_SetViewersServer ( cluster_t * cluster , viewer_t * viewer , sv_t * sv ) ;
void QW_SetMenu ( viewer_t * v , int menunum ) ;
void QW_SetCommentator ( cluster_t * cluster , viewer_t * v , viewer_t * commentator ) ;
void QW_FreeViewer ( cluster_t * cluster , viewer_t * viewer ) ;
void QW_ClearViewerState ( viewer_t * viewer ) ;
2005-09-24 04:48:20 +00:00
2006-10-20 14:25:20 +00:00
void PM_PlayerMove ( pmove_t * pmove ) ;
2006-02-21 19:55:12 +00:00
void Netchan_Setup ( SOCKET sock , netchan_t * chan , netadr_t adr , int qport , qboolean isclient ) ;
2012-04-20 15:20:45 +00:00
void Netchan_OutOfBandPrint ( cluster_t * cluster , netadr_t adr , char * format , . . . ) PRINTFWARNING ( 3 ) ;
2013-03-31 04:21:08 +00:00
//int Netchan_IsLocal (netadr_t adr);
2019-03-01 22:39:30 +00:00
void NET_InitUDPSocket ( cluster_t * cluster , int port , int socketid ) ;
2007-07-23 10:53:59 +00:00
void NET_SendPacket ( cluster_t * cluster , SOCKET sock , int length , void * data , netadr_t adr ) ;
2023-12-22 09:34:45 +00:00
SOCKET NET_ChooseSocket ( SOCKET sock [ SOCKETGROUPS ] , netadr_t * toadr , netadr_t in ) ;
2005-09-24 04:48:20 +00:00
qboolean Net_CompareAddress ( netadr_t * s1 , netadr_t * s2 , int qp1 , int qp2 ) ;
qboolean Netchan_Process ( netchan_t * chan , netmsg_t * msg ) ;
2006-09-17 02:35:23 +00:00
qboolean NQNetchan_Process ( cluster_t * cluster , netchan_t * chan , netmsg_t * msg ) ;
2007-07-23 10:53:59 +00:00
void Netchan_Transmit ( cluster_t * cluster , netchan_t * chan , int length , const void * data ) ;
2015-04-21 04:12:00 +00:00
void Netchan_OutOfBandSocket ( cluster_t * cluster , SOCKET sock , netadr_t * adr , int length , void * data ) ;
void Netchan_OutOfBand ( cluster_t * cluster , netadr_t adr , int length , void * data ) ;
2006-10-22 20:31:57 +00:00
qboolean Netchan_CanPacket ( netchan_t * chan ) ;
2012-04-20 14:41:40 +00:00
int NET_WebSocketRecv ( SOCKET sock , wsrbuf_t * ws , unsigned char * out , unsigned int outlen , int * wslen ) ;
2006-10-22 20:31:57 +00:00
2005-10-07 02:02:15 +00:00
int SendList ( sv_t * qtv , int first , const filename_t * list , int svc , netmsg_t * msg ) ;
2006-04-11 22:15:09 +00:00
int Prespawn ( sv_t * qtv , int curmsgsize , netmsg_t * msg , int bufnum , int thisplayer ) ;
2005-09-24 04:48:20 +00:00
2005-10-07 02:02:15 +00:00
bsp_t * BSP_LoadModel ( cluster_t * cluster , char * gamedir , char * bspname ) ;
2005-09-24 04:48:20 +00:00
void BSP_Free ( bsp_t * bsp ) ;
int BSP_LeafNum ( bsp_t * bsp , float x , float y , float z ) ;
2006-02-21 23:25:54 +00:00
unsigned int BSP_Checksum ( bsp_t * bsp ) ;
2005-09-24 04:48:20 +00:00
int BSP_SphereLeafNums ( bsp_t * bsp , int maxleafs , unsigned short * list , float x , float y , float z , float radius ) ;
qboolean BSP_Visible ( bsp_t * bsp , int leafcount , unsigned short * list ) ;
void BSP_SetupForPosition ( bsp_t * bsp , float x , float y , float z ) ;
2007-01-06 09:46:32 +00:00
const intermission_t * BSP_IntermissionSpot ( bsp_t * bsp ) ;
2007-07-23 10:53:59 +00:00
unsigned short QCRC_Block ( void * start , int count ) ;
2006-09-17 01:27:32 +00:00
unsigned short QCRC_Value ( unsigned short crcvalue ) ;
2006-06-10 22:15:24 +00:00
void WriteDeltaUsercmd ( netmsg_t * m , const usercmd_t * from , usercmd_t * move ) ;
2007-11-16 14:53:45 +00:00
void SendClientCommand ( sv_t * qtv , char * fmt , . . . ) PRINTFWARNING ( 2 ) ;
2006-06-10 22:15:24 +00:00
void QTV_Run ( sv_t * qtv ) ;
2005-09-24 04:48:20 +00:00
char * COM_ParseToken ( char * data , char * out , int outsize , const char * punctuation ) ;
char * Info_ValueForKey ( char * s , const char * key , char * buffer , int buffersize ) ;
void Info_SetValueForStarKey ( char * s , const char * key , const char * value , int maxsize ) ;
2006-06-10 22:15:24 +00:00
void ReadDeltaUsercmd ( netmsg_t * m , const usercmd_t * from , usercmd_t * move ) ;
unsigned Com_BlockChecksum ( void * buffer , int length ) ;
2006-09-17 01:27:32 +00:00
void Com_BlockFullChecksum ( void * buffer , int len , unsigned char * outbuf ) ;
2007-03-16 04:05:01 +00:00
void Cluster_BuildAvailableDemoList ( cluster_t * cluster ) ;
2005-09-24 04:48:20 +00:00
2007-11-16 14:53:45 +00:00
void Sys_Printf ( cluster_t * cluster , char * fmt , . . . ) PRINTFWARNING ( 2 ) ;
2019-02-16 19:09:07 +00:00
//void Sys_mkdir(char *path);
void QTV_mkdir ( char * path ) ;
2005-10-07 02:02:15 +00:00
2007-07-23 10:53:59 +00:00
void Net_ProxySend ( cluster_t * cluster , oproxy_t * prox , void * buffer , int length ) ;
2006-09-17 01:27:32 +00:00
oproxy_t * Net_FileProxy ( sv_t * qtv , char * filename ) ;
2010-03-14 14:35:56 +00:00
sv_t * QTV_NewServerConnection ( cluster_t * cluster , int streamid , char * server , char * password , qboolean force , enum autodisconnect_e autodisconnect , qboolean noduplicates , qboolean query ) ;
2019-02-16 19:09:07 +00:00
void Net_TCPListen ( cluster_t * cluster , int port , int socketid ) ;
2005-10-07 02:02:15 +00:00
qboolean Net_StopFileProxy ( sv_t * qtv ) ;
2006-09-17 01:27:32 +00:00
void SV_FindProxies ( SOCKET sock , cluster_t * cluster , sv_t * defaultqtv ) ;
qboolean SV_ReadPendingProxy ( cluster_t * cluster , oproxy_t * pend ) ;
2007-07-23 10:53:59 +00:00
void SV_ForwardStream ( sv_t * qtv , void * buffer , int length ) ;
2007-09-08 20:15:59 +00:00
int SV_SayToUpstream ( sv_t * qtv , char * message ) ;
2019-02-16 19:09:07 +00:00
void SV_SayToViewers ( sv_t * qtv , char * message ) ;
2006-09-17 01:27:32 +00:00
unsigned char * FS_ReadFile ( char * gamedir , char * filename , unsigned int * size ) ;
void ChooseFavoriteTrack ( sv_t * tv ) ;
void DemoViewer_Update ( sv_t * svtest ) ;
2019-02-16 19:09:07 +00:00
void Fwd_SayToDownstream ( sv_t * qtv , char * message ) ;
2006-09-17 01:27:32 +00:00
2007-03-16 04:05:01 +00:00
//httpsv.c
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
char * HTTPSV_GetMethod ( cluster_t * cluster , oproxy_t * pend ) ; //if a websocket request, return value is the stream name
2007-03-16 04:05:01 +00:00
void HTTPSV_PostMethod ( cluster_t * cluster , oproxy_t * pend , char * postdata ) ;
2021-10-05 05:06:04 +00:00
void tobase64 ( unsigned char * out , int outlen , unsigned char * in , int inlen ) ;
2007-03-16 04:05:01 +00:00
2019-02-16 19:09:07 +00:00
//menu.c
void Menu_Enter ( cluster_t * cluster , viewer_t * viewer , int buttonnum ) ;
void Menu_Draw ( cluster_t * cluster , viewer_t * viewer ) ;
2024-07-14 18:56:31 +00:00
//relay.c
void TURN_CheckFDs ( cluster_t * cluster ) ;
void TURN_AddFDs ( cluster_t * cluster , fd_set * set , int * m ) ;
qboolean TURN_IsRequest ( cluster_t * cluster , netmsg_t * m , netadr_t * from ) ; //handles both TURN/STUN packets, and relays inbound qwfwd connections too.
void Fwd_NewQWFwd ( cluster_t * cluster , netadr_t * from , char * targ ) ; //creates a new qwfwd context.
void TURN_RelayStatus ( cmdctxt_t * ctx ) ;
void Fwd_PingStatus ( cluster_t * cluster , netadr_t * from , qboolean ext ) ;
void Fwd_ParseServerList ( cluster_t * cluster , netmsg_t * m , int af ) ;
void Fwd_PingResponse ( cluster_t * cluster , netadr_t * from ) ;
2007-03-16 04:05:01 +00:00
2006-09-17 01:27:32 +00:00
# ifdef __cplusplus
}
# endif
2007-11-16 14:53:45 +00:00