2013-03-31 04:21:08 +00:00
# include "quakedef.h"
2004-08-23 00:15:46 +00:00
# ifdef SV_MASTER
# ifdef _WIN32
# include "winquake.h"
# ifdef _MSC_VER
# include "wsipx.h"
# endif
# endif
2005-11-29 13:22:58 +00:00
# include "netinc.h"
2004-08-23 00:15:46 +00:00
2018-12-28 00:04:36 +00:00
//quakeworld protocol
// heartbeat: "a"
// query: "c\n%i<sequence>\n%i<numplayers>\n"
//queryresponse: "d\naaaappaaaapp"
2004-08-23 00:15:46 +00:00
//quake2 protocol
2018-12-28 00:04:36 +00:00
// heartbeat: "heartbeat\n%s<serverinfo>\n%i<frags> %i<ping> \"%s\"<name>\n<repeat>"
// query: "query\0"
//queryresponse: "servers\naaaappaaaapp"
2004-08-23 00:15:46 +00:00
2018-12-28 00:04:36 +00:00
//quake3/dpmaster protocol
// heartbeat: "heartbeat DarkPlaces\n"
// query: "getservers[Ext<ipv6>] [%s<game>] %u<version> [empty] [full] [ipv6]"
//queryresponse: "getservers[Ext]Response\\aaaapp/aaaaaaaaaaaapp\\EOF"
2004-08-23 00:15:46 +00:00
2018-12-28 00:04:36 +00:00
enum gametypes_e
{
GT_FFA = 0 ,
GT_TOURNEY = 1 ,
GT_TEAM = 3 ,
GT_CTF = 4 ,
} ;
2004-08-23 00:15:46 +00:00
typedef struct svm_server_s {
netadr_t adr ;
2020-02-11 18:06:10 +00:00
const char * brokerid ; //from rtc broker, for ICE connections (persistent until killed).
2018-12-28 00:04:36 +00:00
int protover ;
unsigned int clients ;
unsigned int maxclients ;
char hostname [ 48 ] ; //just for our own listings.
char mapname [ 16 ] ; //just for our own listings.
char gamedir [ 16 ] ; //again...
unsigned short gametype ;
2004-08-23 00:15:46 +00:00
float expiretime ;
2018-12-28 00:04:36 +00:00
2020-02-11 18:06:10 +00:00
bucket_t bucket ; //for faster address lookups.
2018-12-28 00:04:36 +00:00
struct svm_game_s * game ;
2004-08-23 00:15:46 +00:00
struct svm_server_s * next ;
} svm_server_t ;
2018-12-28 00:04:36 +00:00
typedef struct svm_game_s {
struct svm_game_s * next ;
svm_server_t * firstserver ;
size_t numservers ;
2020-02-11 18:06:10 +00:00
qboolean persistent ;
2018-12-28 00:04:36 +00:00
char name [ 1 ] ;
} svm_game_t ;
2004-08-23 00:15:46 +00:00
typedef struct {
float time ;
2018-12-28 00:04:36 +00:00
svm_game_t * firstgame ;
size_t numgames ;
hashtable_t serverhash ;
size_t numservers ;
struct rates_s
{
double timestamp ;
size_t heartbeats ;
size_t queries ;
size_t junk ;
size_t drops ;
size_t adds ;
} total , stamps [ 60 ] ;
size_t stampring ;
double nextstamp ;
2004-08-23 00:15:46 +00:00
} masterserver_t ;
2018-12-28 00:04:36 +00:00
static masterserver_t svm ;
ftenet_connections_t * svm_sockets ;
2004-08-23 00:15:46 +00:00
2018-12-28 00:04:36 +00:00
static void QDECL SVM_Tcpport_Callback ( struct cvar_s * var , char * oldvalue )
2004-08-23 00:15:46 +00:00
{
2018-12-28 00:04:36 +00:00
FTENET_AddToCollection ( svm_sockets , var - > name , var - > string , NA_IP , NP_STREAM ) ;
}
static void QDECL SVM_Port_Callback ( struct cvar_s * var , char * oldvalue )
{
FTENET_AddToCollection ( svm_sockets , var - > name , var - > string , NA_IP , NP_DGRAM ) ;
}
static cvar_t sv_heartbeattimeout = CVARD ( " sv_heartbeattimeout " , " 600 " , " How many seconds a server should remain listed after its latest heartbeat. Larger values can avoid issues from packetloss, but can also make dos attacks easier. " ) ;
2020-02-11 18:06:10 +00:00
static cvar_t sv_masterport = CVARC ( " sv_masterport " , STRINGIFY ( PORT_QWMASTER ) " " STRINGIFY ( PORT_ICEBROKER ) , SVM_Port_Callback ) ;
static cvar_t sv_masterport_tcp = CVARC ( " sv_masterport_tcp " , STRINGIFY ( PORT_ICEBROKER ) , SVM_Tcpport_Callback ) ;
2018-12-28 00:04:36 +00:00
static cvar_t sv_maxgames = CVARD ( " sv_maxgames " , " 100 " , " Limits the number of games that may be known. This is to reduce denial of service attacks. " ) ;
static cvar_t sv_maxservers = CVARD ( " sv_maxservers " , " 1000 " , " Limits the number of servers (total from all games) that may be known. This is to reduce denial of service attacks. " ) ;
2020-02-11 18:06:10 +00:00
static unsigned int SVM_GenerateBrokerKey ( const char * brokerid )
{
return Hash_Key ( brokerid , svm . serverhash . numbuckets ) ;
}
2018-12-28 00:04:36 +00:00
//returns a hash key for a server's address.
static unsigned int SVM_GenerateAddressKey ( const netadr_t * adr )
{
unsigned int key ;
switch ( adr - > type )
{
case NA_IP :
key = * ( const unsigned int * ) adr - > address . ip ;
key ^ = 0xffff0000 ; //match ipv6's ipv4-mapped addresses.
key ^ = adr - > port ;
break ;
case NA_IPV6 :
key = * ( const unsigned int * ) ( adr - > address . ip6 + 0 ) ;
key ^ = * ( const unsigned int * ) ( adr - > address . ip6 + 4 ) ;
key ^ = * ( const unsigned int * ) ( adr - > address . ip6 + 8 ) ;
key ^ = * ( const unsigned int * ) ( adr - > address . ip6 + 12 ) ;
key ^ = adr - > port ;
break ;
default :
key = 0 ;
break ;
}
return key ;
}
static svm_server_t * SVM_GetServer ( netadr_t * adr )
{
svm_server_t * server ;
unsigned int key = SVM_GenerateAddressKey ( adr ) ;
server = Hash_GetKey ( & svm . serverhash , key ) ;
2020-02-11 18:06:10 +00:00
while ( server )
2004-08-23 00:15:46 +00:00
{
2020-02-11 18:06:10 +00:00
if ( ! server - > brokerid ) //don't report brokered servers by address.
if ( NET_CompareAdr ( & server - > adr , adr ) )
return server ;
2018-12-28 00:04:36 +00:00
server = Hash_GetNextKey ( & svm . serverhash , key , server ) ;
}
2020-02-11 18:06:10 +00:00
return NULL ;
2018-12-28 00:04:36 +00:00
}
2020-02-11 18:06:10 +00:00
static svm_game_t * SVM_FindGame ( const char * game , int create )
2018-12-28 00:04:36 +00:00
{
2020-02-11 18:06:10 +00:00
svm_game_t * g , * * link ;
const char * sanitise ;
2018-12-28 00:04:36 +00:00
for ( g = svm . firstgame ; g ; g = g - > next )
{
if ( ! Q_strcasecmp ( game , g - > name ) )
return g ;
}
if ( create )
{
if ( svm . numgames > = sv_maxgames . ival )
{
Con_DPrintf ( " game limit exceeded \n " ) ;
return NULL ;
}
//block some chars that may cause issues/exploits. sorry.
2020-02-11 18:06:10 +00:00
for ( sanitise = game ; * sanitise ; sanitise + + )
{
if ( ( * sanitise > = ' a ' & & * sanitise < = ' z ' ) | | //allow lowercase
( * sanitise > = ' A ' & & * sanitise < = ' Z ' ) | | //allow uppercase
( * sanitise > = ' 0 ' & & * sanitise < = ' 9 ' ) | | //allow numbers (but not leeding, see below)
( * sanitise = = ' - ' | | * sanitise = = ' _ ' ) ) //allow a little punctuation, to make up for the lack of spaces.
continue ;
2018-12-28 00:04:36 +00:00
return NULL ;
2020-02-11 18:06:10 +00:00
}
2018-12-28 00:04:36 +00:00
if ( ! * game | | ( * game > = ' 0 ' & & * game < = ' 9 ' ) )
return NULL ; //must not start with a number either.
g = ZF_Malloc ( sizeof ( * g ) + strlen ( game ) ) ;
if ( g )
2004-08-23 00:15:46 +00:00
{
2018-12-28 00:04:36 +00:00
strcpy ( g - > name , game ) ;
2020-02-11 18:06:10 +00:00
g - > persistent = create = = 2 ;
g - > next = NULL ;
//add it at the end.
for ( link = & svm . firstgame ; * link ; link = & ( * link ) - > next )
;
* link = g ;
2018-12-28 00:04:36 +00:00
svm . numgames + + ;
Con_DPrintf ( " Creating game \" %s \" \n " , g - > name ) ;
}
}
return g ;
}
static void SVM_RemoveOldServers ( void )
{
svm_game_t * * gamelink , * g ;
svm_server_t * * serverlink , * s ;
for ( gamelink = & svm . firstgame ; ( g = * gamelink ) ; )
{
for ( serverlink = & g - > firstserver ; ( s = * serverlink ) ; )
{
2020-02-11 18:06:10 +00:00
//brokered servers don't time out (they drop when their tcp connection dies)
if ( ! s - > brokerid & & s - > expiretime < svm . time )
2018-12-28 00:04:36 +00:00
{
if ( developer . ival )
{
char buf [ 256 ] ;
Con_Printf ( " timeout: %s \n " , NET_AdrToString ( buf , sizeof ( buf ) , & s - > adr ) ) ;
}
Hash_RemoveDataKey ( & svm . serverhash , SVM_GenerateAddressKey ( & s - > adr ) , s ) ;
svm . total . drops + + ;
* serverlink = s - > next ;
BZ_Free ( s ) ;
g - > numservers - - ;
svm . numservers - - ;
}
2004-08-23 00:15:46 +00:00
else
2018-12-28 00:04:36 +00:00
serverlink = & s - > next ;
}
2020-02-11 18:06:10 +00:00
if ( ! g - > firstserver & & ! g - > persistent )
2018-12-28 00:04:36 +00:00
{
Con_DPrintf ( " game \" %s \" has no active servers \n " , g - > name ) ;
* gamelink = g - > next ;
Z_Free ( g ) ;
svm . numgames - - ;
2004-08-23 00:15:46 +00:00
}
else
2018-12-28 00:04:36 +00:00
gamelink = & g - > next ;
2004-08-23 00:15:46 +00:00
}
}
2020-02-11 18:06:10 +00:00
int SVM_AddIPAddresses ( sizebuf_t * sb , int first , int ver , const char * gamename , int v4 , int v6 , qboolean empty , qboolean full , qboolean prefixes , int gametype )
2004-08-23 00:15:46 +00:00
{
int number = 0 ;
svm_server_t * server ;
2018-12-28 00:04:36 +00:00
int prefix ;
int len ;
svm_game_t * game = SVM_FindGame ( gamename , false ) ;
if ( game )
2004-08-23 00:15:46 +00:00
{
2018-12-28 00:04:36 +00:00
for ( server = game - > firstserver ; server ; server = server - > next )
{
if ( number = = first )
break ;
2004-08-23 00:15:46 +00:00
2018-12-28 00:04:36 +00:00
first - - ;
}
for ( ; server ; server = server - > next )
{
2020-02-11 18:06:10 +00:00
if ( server - > protover ! = ver )
continue ;
if ( server - > clients = = 0 & & ! empty )
continue ;
if ( server - > clients > = server - > maxclients & & ! full )
continue ;
if ( gametype ! = - 1 & & server - > gametype ! = gametype )
continue ;
2018-12-28 00:04:36 +00:00
switch ( server - > adr . type )
{
case NA_IP :
if ( ! v4 )
continue ;
prefix = ' \\ ' ;
len = 4 ;
break ;
case NA_IPV6 :
if ( ! v6 )
continue ;
prefix = ' / ' ;
len = 16 ;
break ;
default :
continue ;
}
if ( prefixes )
2019-01-29 19:41:31 +00:00
MSG_WriteByte ( sb , prefix ) ;
2018-12-28 00:04:36 +00:00
SZ_Write ( sb , server - > adr . address . ip , len ) ;
MSG_WriteShort ( sb , server - > adr . port ) ;
number + + ;
}
2004-08-23 00:15:46 +00:00
}
2018-12-28 00:04:36 +00:00
return number ;
}
2004-08-23 00:15:46 +00:00
2020-02-11 18:06:10 +00:00
static char * QuakeCharsToHTML ( char * outhtml , size_t outsize , const char * quake )
{
char * ret = outhtml ;
conchar_t chars [ 8192 ] , * c = chars , * end ;
unsigned int codeflags , codepoint , oldflags = CON_WHITEMASK ;
unsigned int b ;
const char * htmlnames [ 16 ] = {
" #000000 " , //black
" #0000AA " , //dark blue
" #00AA00 " , //dark green
" #00AAAA " , //dark cyan
" #AA0000 " , //dark red
" #AA00AA " , //dark magenta
" #AA5500 " , //brown
" #AAAAAA " , //grey
" #555555 " , //dark grey
" #5555FF " , //blue
" #55FF55 " , //green
" #55FFFF " , //cyan
" #FF5555 " , //red
" #FF55FF " , //magenta
" #FFFF55 " , //yellow
" #FFFFFF " , //white
} ;
if ( ! outsize - - )
return NULL ; //no space for the null
end = COM_ParseFunString ( oldflags , quake , chars , sizeof ( chars ) , false ) ;
while ( c < end )
{
c = Font_Decode ( c , & codeflags , & codepoint ) ;
if ( codeflags & CON_HIDDEN )
continue ; //erk...?
if ( codeflags & CON_RICHFORECOLOUR ) //fixme...?
codeflags = CON_WHITEMASK ;
if ( ( codeflags & CON_FGMASK ) ! = ( oldflags & CON_FGMASK ) )
{
if ( oldflags ! = CON_WHITEMASK )
{
Q_strncpyz ( outhtml , " </span> " , outsize ) ;
b = strlen ( outhtml ) ;
outhtml + = b ;
outsize - = b ;
}
if ( codeflags ! = CON_WHITEMASK )
{
Q_snprintfz ( outhtml , outsize , " <span style= \" color:%s \" > " , htmlnames [ ( codeflags & CON_FGMASK ) > > CON_FGSHIFT ] ) ;
b = strlen ( outhtml ) ;
outhtml + = b ;
outsize - = b ;
}
oldflags = codeflags ;
}
if ( codepoint = = ' < ' )
{
Q_strncpyz ( outhtml , " < " , outsize ) ;
b = strlen ( outhtml ) ;
}
else if ( codepoint = = ' > ' )
{
Q_strncpyz ( outhtml , " > " , outsize ) ;
b = strlen ( outhtml ) ;
}
else if ( codepoint = = ' & ' )
{
Q_strncpyz ( outhtml , " & " , outsize ) ;
b = strlen ( outhtml ) ;
}
else if ( codepoint = = ' \" ' )
{
Q_strncpyz ( outhtml , " " " , outsize ) ;
b = strlen ( outhtml ) ;
}
else if ( codepoint = = ' \' ' )
{
Q_strncpyz ( outhtml , " ' " , outsize ) ;
b = strlen ( outhtml ) ;
}
else
b = utf8_encode ( outhtml , codepoint , outsize ) ;
if ( b > 0 )
{
outhtml + = b ;
outsize - = b ;
}
}
* outhtml = 0 ;
return ret ;
}
vfsfile_t * SVM_GenerateIndex ( const char * requesthost , const char * fname )
2018-12-28 00:04:36 +00:00
{
static const char * thecss =
" <style type= \" text/css \" > "
" body { "
" background-color: #303030; "
" color: #998080; "
" font-family: verdanah, trebuchet ms, arial, sans-serif; "
" } "
" a { text-decoration: none; } "
" a:link { color: #308090; } "
" a:visited { color: #308090; } "
" a:hover { color: #308090; text-decoration: underline; } "
" .header { text-align: center; } "
" .footer { text-align: center; } "
" .main { width: 1024px; margin: 0 auto; } "
" H1 { "
" text-align: center; "
" background-color: #202020; "
" color: #808080; "
" } "
" table { width: 100%; border-collapse: collapse; } "
" th { text-align: left; } "
" tr:hover { background-color: #202020; } "
" </style> " ;
char tmpbuf [ 256 ] ;
2020-02-11 18:06:10 +00:00
char hostname [ 1024 ] ;
const char * url ;
2018-12-28 00:04:36 +00:00
svm_game_t * game ;
svm_server_t * server ;
vfsfile_t * f = NULL ;
2020-02-11 18:06:10 +00:00
unsigned clients = 0 , maxclients = 0 , totalclients = 0 ;
2018-12-28 00:04:36 +00:00
if ( ! strcmp ( fname , " index.html " ) )
2004-08-23 00:15:46 +00:00
{
2018-12-28 00:04:36 +00:00
f = VFSPIPE_Open ( 1 , false ) ;
VFS_PRINTF ( f , " %s " , thecss ) ;
VFS_PRINTF ( f , " <h1>FTE-Master</h1> \n " ) ;
VFS_PRINTF ( f , " <table border=1> \n " ) ;
2020-02-11 18:06:10 +00:00
VFS_PRINTF ( f , " <tr><th>Active Games</th><th>Players</th><th>Server Count</th></tr> \n " ) ;
2018-12-28 00:04:36 +00:00
for ( game = svm . firstgame ; game ; game = game - > next )
{
2020-02-11 18:06:10 +00:00
for ( clients = 0 , server = game - > firstserver ; server ; server = server - > next )
clients + = server - > clients ;
if ( game - > numservers ) //only show active servers
VFS_PRINTF ( f , " <tr><td><a href= \" game/%s \" >%s</a></td><td>%u player(s)</td><td>%u server(s)</td></tr> \n " , game - > name , game - > name , clients , ( unsigned ) game - > numservers ) ;
totalclients + = clients ;
2018-12-28 00:04:36 +00:00
}
VFS_PRINTF ( f , " </table> \n " ) ;
2020-02-11 18:06:10 +00:00
VFS_PRINTF ( f , " %u game(s), %u player(s), %u server(s) \n " , ( unsigned ) svm . numgames , totalclients , ( unsigned ) svm . numservers ) ;
2018-12-28 00:04:36 +00:00
}
else if ( ! strncmp ( fname , " server/ " , 7 ) )
{
netadr_t adr [ 64 ] ;
int count ;
2004-08-23 00:15:46 +00:00
2018-12-28 00:04:36 +00:00
f = VFSPIPE_Open ( 1 , false ) ;
VFS_PRINTF ( f , " %s " , thecss ) ;
2019-01-29 19:41:31 +00:00
VFS_PRINTF ( f , " <h1>Single Server Info</h1> \n " ) ;
2004-08-23 00:15:46 +00:00
2018-12-28 00:04:36 +00:00
VFS_PRINTF ( f , " <table border=1> \n " ) ;
VFS_PRINTF ( f , " <tr><th>Game</th><th>Address</th><th>Hostname</th><th>Mod dir</th><th>Mapname</th><th>Players</th></tr> \n " ) ;
2020-02-11 18:06:10 +00:00
//FIXME: block dns lookups here?
count = NET_StringToAdr2 ( fname + 7 , 0 , adr , countof ( adr ) , NULL ) ;
2018-12-28 00:04:36 +00:00
while ( count - - > 0 )
{
server = SVM_GetServer ( & adr [ count ] ) ;
if ( server )
VFS_PRINTF ( f , " <tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%u/%u</td></tr> \n " , server - > game ? server - > game - > name : " Unknown " , NET_AdrToString ( tmpbuf , sizeof ( tmpbuf ) , & server - > adr ) , server - > hostname , server - > gamedir , server - > mapname , server - > clients , server - > maxclients ) ;
else
VFS_PRINTF ( f , " <tr><td>?</td><td>%s</td><td>?</td><td>?</td><td>?</td><td>?/?</td></tr> \n " , NET_AdrToString ( tmpbuf , sizeof ( tmpbuf ) , & adr [ count ] ) ) ;
}
VFS_PRINTF ( f , " </table> \n " ) ;
2004-08-23 00:15:46 +00:00
}
2018-12-28 00:04:36 +00:00
else if ( ! strncmp ( fname , " game/ " , 5 ) )
{
2020-02-11 18:06:10 +00:00
const char * gamename = fname + 5 ;
game = SVM_FindGame ( gamename , false ) ;
2004-08-23 00:15:46 +00:00
2018-12-28 00:04:36 +00:00
f = VFSPIPE_Open ( 1 , false ) ;
VFS_PRINTF ( f , " %s " , thecss ) ;
2020-02-11 18:06:10 +00:00
VFS_PRINTF ( f , " <h1>Servers for %s</h1> \n " , gamename ) ;
2018-12-28 00:04:36 +00:00
if ( game )
{
VFS_PRINTF ( f , " <table border=1> \n " ) ;
VFS_PRINTF ( f , " <tr><th>Address</th><th>Hostname</th><th>Gamedir</th><th>Mapname</th><th>Players</th></tr> \n " ) ;
for ( server = game - > firstserver ; server ; server = server - > next )
{
2020-02-11 18:06:10 +00:00
if ( server - > brokerid )
{
url = tmpbuf ;
Q_snprintfz ( tmpbuf , sizeof ( tmpbuf ) , " rtc://%s/%s " , requesthost , server - > brokerid ) ;
}
else
url = NET_AdrToString ( tmpbuf , sizeof ( tmpbuf ) , & server - > adr ) ;
QuakeCharsToHTML ( hostname , sizeof ( hostname ) , server - > hostname ) ;
VFS_PRINTF ( f , " <tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%u/%u</td></tr> \n " , url , hostname , server - > gamedir , server - > mapname , server - > clients , server - > maxclients ) ;
2018-12-28 00:04:36 +00:00
clients + = server - > clients ;
maxclients + = server - > maxclients ;
}
VFS_PRINTF ( f , " </table> \n " ) ;
VFS_PRINTF ( f , " %u server(s), %u/%u client(s) \n " , ( unsigned ) game - > numservers , clients , maxclients ) ;
}
else
2020-02-11 18:06:10 +00:00
VFS_PRINTF ( f , " Protocol '%s' is not known \n " , gamename ) ;
2018-12-28 00:04:36 +00:00
}
else if ( ! strncmp ( fname , " raw/ " , 4 ) )
{ //just spews all
COM_StripExtension ( fname + 4 , tmpbuf , sizeof ( tmpbuf ) ) ;
game = SVM_FindGame ( tmpbuf , false ) ;
f = VFSPIPE_Open ( 1 , false ) ;
2020-02-11 18:06:10 +00:00
VFS_PRINTF ( f , " #Server list for \" %s \" \n " , tmpbuf ) ;
2018-12-28 00:04:36 +00:00
for ( server = ( game ? game - > firstserver : NULL ) ; server ; server = server - > next )
2020-02-11 18:06:10 +00:00
{
if ( server - > brokerid )
VFS_PRINTF ( f , " rtc:///%s \\ maxclients \\ %u \\ clients \\ %u \\ hostname \\ %s \\ modname \\ %s \\ mapname \\ %s \n " , server - > brokerid , server - > maxclients , server - > clients , server - > hostname , server - > gamedir , server - > mapname ) ;
else
VFS_PRINTF ( f , " %s \n " , NET_AdrToString ( tmpbuf , sizeof ( tmpbuf ) , & server - > adr ) ) ;
}
2018-12-28 00:04:36 +00:00
}
return f ;
2004-08-23 00:15:46 +00:00
}
2020-02-11 18:06:10 +00:00
static svm_game_t * SVM_GameFromBrokerID ( const char * * brokerid )
{
size_t l ;
char name [ 128 ] ;
const char * in = * brokerid ;
if ( * in = = ' / ' )
in + + ;
for ( l = 0 ; * in & & * in ! = ' / ' & & * in ! = ' ? ' & & * in ! = ' # ' ; in + + )
if ( l < countof ( name ) - 1 )
name [ l + + ] = * in ;
name [ l ] = 0 ;
if ( * in = = ' / ' )
in + + ;
else
return NULL ; //only one? no game specified? get lost.
* brokerid = in ;
return SVM_FindGame ( name , true ) ;
}
static svm_server_t * SVM_FindBrokerHost ( const char * brokerid )
{
svm_server_t * server ;
unsigned int key = SVM_GenerateBrokerKey ( brokerid ) ;
server = Hash_GetKey ( & svm . serverhash , key ) ;
while ( server )
{
if ( server - > brokerid ) //don't report brokered servers by address.
if ( server - > brokerid = = brokerid )
return server ;
server = Hash_GetNextKey ( & svm . serverhash , key , server ) ;
}
return NULL ;
}
void SVM_RemoveBrokerGame ( const char * brokerid )
{
svm_server_t * s , * * link ;
svm_game_t * game = SVM_GameFromBrokerID ( & brokerid ) ;
if ( ! game )
{
Con_Printf ( " SVM_RemoveBrokerGame: failed to find game for brokered server: %s \n " , brokerid ) ;
return ;
}
for ( link = & game - > firstserver ; ( s = * link ) ; )
{
if ( s - > brokerid = = brokerid )
{
* link = s - > next ;
Z_Free ( s ) ;
game - > numservers - - ;
svm . numservers - - ;
return ;
}
else
link = & ( * link ) - > next ;
}
Con_Printf ( " SVM_RemoveBrokerGame: failed to remove brokered server: %s \n " , brokerid ) ;
}
void SVM_AddBrokerGame ( const char * brokerid , const char * info )
{
svm_game_t * game = SVM_GameFromBrokerID ( & brokerid ) ;
svm_server_t * server = SVM_FindBrokerHost ( brokerid ) ;
if ( ! server )
{
if ( ! game )
return ;
if ( svm . numservers > = sv_maxservers . ival )
{
Con_DPrintf ( " server limit exceeded \n " ) ;
return ;
}
Con_DPrintf ( " heartbeat(new - %s): /%s \n " , game - > name , brokerid ) ;
server = Z_Malloc ( sizeof ( svm_server_t ) ) ;
server - > game = game ;
server - > brokerid = brokerid ;
server - > next = game - > firstserver ;
game - > firstserver = server ;
game - > numservers + + ;
svm . numservers + + ;
svm . total . adds + + ;
Hash_AddKey ( & svm . serverhash , SVM_GenerateBrokerKey ( brokerid ) , server , & server - > bucket ) ;
}
else
Con_DPrintf ( " heartbeat(update - %s): /%s \n " , game - > name , brokerid ) ;
server - > protover = atoi ( Info_ValueForKey ( info , " protocol " ) ) ;
server - > maxclients = atoi ( Info_ValueForKey ( info , " maxclients " ) ) ;
server - > clients = atoi ( Info_ValueForKey ( info , " clients " ) ) ;
Q_strncpyz ( server - > hostname , Info_ValueForKey ( info , " hostname " ) , sizeof ( server - > hostname ) ) ;
Q_strncpyz ( server - > gamedir , Info_ValueForKey ( info , " modname " ) , sizeof ( server - > gamedir ) ) ;
Q_strncpyz ( server - > mapname , Info_ValueForKey ( info , " mapname " ) , sizeof ( server - > mapname ) ) ;
}
2018-12-28 00:04:36 +00:00
static svm_server_t * SVM_Heartbeat ( const char * gamename , netadr_t * adr , int numclients , float validuntil )
2004-08-23 00:15:46 +00:00
{
2018-12-28 00:04:36 +00:00
svm_server_t * server = SVM_GetServer ( adr ) ;
svm_game_t * game = SVM_FindGame ( gamename , true ) ;
if ( ! game )
return NULL ;
2004-08-23 00:15:46 +00:00
2018-12-28 00:04:36 +00:00
if ( server & & server - > game ! = game )
2004-08-23 00:15:46 +00:00
{
2018-12-28 00:04:36 +00:00
server - > expiretime = realtime - 1 ;
server = NULL ;
2004-08-23 00:15:46 +00:00
}
2018-12-28 00:04:36 +00:00
2004-08-23 00:15:46 +00:00
if ( ! server ) //not found
{
2018-12-28 00:04:36 +00:00
if ( svm . numservers > = sv_maxservers . ival )
{
Con_DPrintf ( " server limit exceeded \n " ) ;
return NULL ;
}
if ( developer . ival )
{
char buf [ 256 ] ;
Con_Printf ( " heartbeat(new - %s): %s \n " , game - > name , NET_AdrToString ( buf , sizeof ( buf ) , adr ) ) ;
}
2004-08-23 00:15:46 +00:00
server = Z_Malloc ( sizeof ( svm_server_t ) ) ;
2018-12-28 00:04:36 +00:00
server - > game = game ;
server - > next = game - > firstserver ;
game - > firstserver = server ;
game - > numservers + + ;
svm . numservers + + ;
2004-08-23 00:15:46 +00:00
server - > adr = * adr ;
2018-12-28 00:04:36 +00:00
svm . total . adds + + ;
Hash_AddKey ( & svm . serverhash , SVM_GenerateAddressKey ( adr ) , server , & server - > bucket ) ;
}
else
{
if ( developer . ival )
{
char buf [ 256 ] ;
Con_Printf ( " heartbeat(refresh): %s \n " , NET_AdrToString ( buf , sizeof ( buf ) , & server - > adr ) ) ;
}
2004-08-23 00:15:46 +00:00
}
server - > clients = numclients ;
server - > expiretime = validuntil ;
2018-12-28 00:04:36 +00:00
return server ;
2004-08-23 00:15:46 +00:00
}
2020-02-11 18:06:10 +00:00
# ifdef TCPCONNECT
void tobase64 ( unsigned char * out , int outlen , unsigned char * in , int inlen ) ;
# endif
void SVM_GenChallenge ( char * out , size_t outsize , netadr_t * foradr )
{ //this function needs to return some sort of unguessable string so that you can't spoof the server with fake responses
char adr [ 64 ] ;
const unsigned char * strings [ ] = { " somethingrandom " , ( const unsigned char * ) NET_AdrToString ( adr , sizeof ( adr ) , foradr ) } ;
size_t lengths [ ] = { strlen ( strings [ 0 ] ) , strlen ( strings [ 1 ] ) } ;
char digest [ 4 * 5 ] ;
int digestsize = SHA1_m ( digest , sizeof ( digest ) , countof ( lengths ) , strings , lengths ) ;
# ifdef TCPCONNECT
tobase64 ( out , outsize , digest , min ( 16 , digestsize ) ) ; //truncate it, so its not excessive
# else
Q_snprintfz ( out , outsize , " %08x " , * ( int * ) digest ) ;
( void ) digestsize ;
# endif
}
2018-12-28 00:04:36 +00:00
void SVM_Think ( int port )
2004-08-23 00:15:46 +00:00
{
2018-12-28 00:04:36 +00:00
char * s ;
int cookie = 0 ;
int giveup = 500 ;
2004-08-23 00:15:46 +00:00
2018-12-28 00:04:36 +00:00
while ( giveup - - > 0 & & ( cookie = NET_GetPacket ( svm_sockets , cookie ) ) > = 0 )
2005-10-01 03:09:17 +00:00
{
2018-12-28 00:04:36 +00:00
net_message . data [ net_message . cursize ] = ' \0 ' ; //null term all strings.
2020-02-11 18:06:10 +00:00
//well that's annoying. why is our networking code not doing this? LAME!
if ( net_from . type = = NA_IPV6 & &
! * ( int * ) & net_from . address . ip6 [ 0 ] & &
! * ( int * ) & net_from . address . ip6 [ 4 ] & &
! * ( short * ) & net_from . address . ip6 [ 8 ] & &
* ( short * ) & net_from . address . ip6 [ 10 ] = = ( short ) 0xffff )
{ //convert this ipv4-mapped-ipv6 address back to actual ipv4, so we don't get confused about stuff.
net_from . type = NA_IP ;
* ( int * ) & net_from . address . ip [ 0 ] = * ( int * ) & net_from . address . ip6 [ 12 ] ;
//and null it out, just in case.
* ( int * ) & net_from . address . ip6 [ 8 ] = 0 ;
* ( int * ) & net_from . address . ip6 [ 12 ] = 0 ;
}
if ( NET_WasSpecialPacket ( svm_sockets ) )
continue ;
2018-12-28 00:04:36 +00:00
svm . time = Sys_DoubleTime ( ) ;
MSG_BeginReading ( msg_nullnetprim ) ;
if ( MSG_ReadLong ( ) ! = - 1 | | msg_badread )
{ //go back to start...
MSG_BeginReading ( msg_nullnetprim ) ;
}
s = MSG_ReadStringLine ( ) ;
s = COM_Parse ( s ) ;
if ( ! strcmp ( com_token , " getservers " ) | | ! strcmp ( com_token , " getserversExt " ) )
{ //q3
sizebuf_t sb ;
int ver ;
char * eos ;
char game [ 64 ] ;
qboolean ext = ! strcmp ( com_token , " getserversExt " ) ;
2020-02-11 18:06:10 +00:00
const char * resp = ext ? " getserversExtResponse " : " getserversResponse " ;
2018-12-28 00:04:36 +00:00
qboolean empty = false ;
qboolean full = false ;
qboolean ipv4 = ! ext ;
qboolean ipv6 = false ;
int gametype = - 1 ;
s = COM_ParseOut ( s , game , sizeof ( game ) ) ;
ver = strtol ( game , & eos , 0 ) ;
if ( * eos )
2020-02-11 18:06:10 +00:00
{ //not a number, must have been a game name.
2018-12-28 00:04:36 +00:00
s = COM_Parse ( s ) ;
ver = strtol ( com_token , NULL , 0 ) ;
}
2020-02-11 18:06:10 +00:00
else //first arg was a number. that means its vanilla quake3.
2018-12-28 00:04:36 +00:00
Q_strncpyz ( game , " Quake3 " , sizeof ( game ) ) ;
for ( ; s & & * s ; )
{
s = COM_Parse ( s ) ;
if ( ! strcmp ( com_token , " empty " ) )
empty = true ;
else if ( ! strcmp ( com_token , " full " ) )
full = true ;
else if ( ! strcmp ( com_token , " ipv4 " ) )
ipv4 = true ;
else if ( ! strcmp ( com_token , " ipv6 " ) )
ipv6 = true ;
else if ( ! strcmp ( com_token , " ffa " ) )
gametype = GT_FFA ;
else if ( ! strcmp ( com_token , " tourney " ) )
gametype = GT_TOURNEY ;
else if ( ! strcmp ( com_token , " team " ) )
gametype = GT_TEAM ;
else if ( ! strcmp ( com_token , " ctf " ) )
gametype = GT_CTF ;
else if ( ! strncmp ( com_token , " gametype= " , 9 ) )
gametype = atoi ( com_token + 9 ) ;
2019-01-29 19:41:31 +00:00
else
{
char buf [ 256 ] ;
Con_DPrintf ( " Unknown request filter: %s \n " , COM_QuotedString ( com_token , buf , sizeof ( buf ) , false ) ) ;
}
2018-12-28 00:04:36 +00:00
}
2020-02-11 18:06:10 +00:00
if ( ! ipv4 & & ! ipv6 )
ipv4 = ipv6 = true ; //neither specified? use both
2018-12-28 00:04:36 +00:00
svm . total . queries + + ;
memset ( & sb , 0 , sizeof ( sb ) ) ;
sb . maxsize = sizeof ( net_message_buffer ) - 2 ;
sb . data = net_message_buffer ;
MSG_WriteLong ( & sb , - 1 ) ;
2020-02-11 18:06:10 +00:00
SZ_Write ( & sb , resp , strlen ( resp ) ) ; //WriteString, but without the null.
SVM_AddIPAddresses ( & sb , 0 , ver , game , ipv4 , ipv6 , empty , full , true , gametype ) ;
2018-12-28 00:04:36 +00:00
sb . maxsize + = 2 ;
MSG_WriteByte ( & sb , ' \\ ' ) ; //otherwise the last may be considered invalid and ignored.
2020-02-11 18:06:10 +00:00
MSG_WriteByte ( & sb , ' E ' ) ;
MSG_WriteByte ( & sb , ' O ' ) ;
MSG_WriteByte ( & sb , ' T ' ) ;
2018-12-28 00:04:36 +00:00
NET_SendPacket ( svm_sockets , sb . cursize , sb . data , & net_from ) ;
}
else if ( ! strcmp ( com_token , " heartbeat " ) )
{ //quake2 heartbeat. Serverinfo and players should follow.
if ( * s = = ' \n ' & & s [ 1 ] = = ' \\ ' )
{ //there's some serverinfo there, must be q2...
svm . total . heartbeats + + ;
SVM_Heartbeat ( " Quake2 " , & net_from , 0 , svm . time + sv_heartbeattimeout . ival ) ;
}
else
{ //dp/q3/etc are annoying, but we can query from an emphemerial socket to check NAT rules.
sizebuf_t sb ;
2020-02-11 18:06:10 +00:00
char ourchallenge [ 256 ] ;
SVM_GenChallenge ( ourchallenge , sizeof ( ourchallenge ) , & net_from ) ;
2018-12-28 00:04:36 +00:00
svm . total . queries + + ;
memset ( & sb , 0 , sizeof ( sb ) ) ;
sb . maxsize = sizeof ( net_message_buffer ) ;
sb . data = net_message_buffer ;
MSG_WriteLong ( & sb , - 1 ) ;
2020-02-11 18:06:10 +00:00
MSG_WriteString ( & sb , va ( " getinfo %s \n " , ourchallenge ) ) ;
2018-12-28 00:04:36 +00:00
sb . cursize - - ;
NET_SendPacket ( svm_sockets , sb . cursize , sb . data , & net_from ) ;
}
}
else if ( ! strcmp ( com_token , " infoResponse " ) )
{
2020-02-11 18:06:10 +00:00
char ourchallenge [ 256 ] ;
2018-12-28 00:04:36 +00:00
int clients ;
const char * game , * chal ;
svm_server_t * srv ;
s = MSG_ReadStringLine ( ) ;
svm . total . heartbeats + + ;
chal = Info_ValueForKey ( s , " challenge " ) ;
2020-02-11 18:06:10 +00:00
SVM_GenChallenge ( ourchallenge , sizeof ( ourchallenge ) , & net_from ) ;
if ( ! strcmp ( chal , ourchallenge ) )
2018-12-28 00:04:36 +00:00
{
clients = atoi ( Info_ValueForKey ( s , " clients " ) ) ;
game = Info_ValueForKey ( s , " gamename " ) ;
srv = SVM_Heartbeat ( game , & net_from , clients , svm . time + sv_heartbeattimeout . ival ) ;
if ( srv )
{
if ( developer . ival )
Info_Print ( s , " \t " ) ;
srv - > protover = atoi ( Info_ValueForKey ( s , " protocol " ) ) ;
srv - > maxclients = atoi ( Info_ValueForKey ( s , " sv_maxclients " ) ) ;
Q_strncpyz ( srv - > hostname , Info_ValueForKey ( s , " hostname " ) , sizeof ( srv - > hostname ) ) ;
Q_strncpyz ( srv - > gamedir , Info_ValueForKey ( s , " modname " ) , sizeof ( srv - > gamedir ) ) ;
Q_strncpyz ( srv - > mapname , Info_ValueForKey ( s , " mapname " ) , sizeof ( srv - > mapname ) ) ;
}
}
}
else if ( ! strcmp ( com_token , " query " ) )
{ //quake2 server listing request
sizebuf_t sb ;
svm . total . queries + + ;
memset ( & sb , 0 , sizeof ( sb ) ) ;
sb . maxsize = sizeof ( net_message_buffer ) ;
sb . data = net_message_buffer ;
MSG_WriteLong ( & sb , - 1 ) ;
MSG_WriteString ( & sb , " servers \n " ) ;
sb . cursize - - ;
2020-02-11 18:06:10 +00:00
SVM_AddIPAddresses ( & sb , 0 , 0 , " Quake2 " , true , false , true , true , false , - 1 ) ;
2018-12-28 00:04:36 +00:00
NET_SendPacket ( svm_sockets , sb . cursize , sb . data , & net_from ) ;
}
else if ( * com_token = = S2M_HEARTBEAT ) //sequence, players
{ //quakeworld heartbeat
int players ;
s = MSG_ReadStringLine ( ) ;
//sequence = atoi(s);
s = MSG_ReadStringLine ( ) ;
players = atoi ( s ) ;
svm . total . heartbeats + + ;
SVM_Heartbeat ( " QuakeWorld " , & net_from , players , svm . time + sv_heartbeattimeout . ival ) ;
}
else if ( * com_token = = C2M_MASTER_REQUEST )
{ //quakeworld server listing request
sizebuf_t sb ;
svm . total . queries + + ;
memset ( & sb , 0 , sizeof ( sb ) ) ;
sb . maxsize = sizeof ( net_message_buffer ) ;
sb . data = net_message_buffer ;
MSG_WriteLong ( & sb , - 1 ) ;
MSG_WriteByte ( & sb , M2C_MASTER_REPLY ) ;
MSG_WriteByte ( & sb , ' \n ' ) ;
2020-02-11 18:06:10 +00:00
SVM_AddIPAddresses ( & sb , 0 , 0 , " QuakeWorld " , true , false , true , true , false , - 1 ) ;
2018-12-28 00:04:36 +00:00
NET_SendPacket ( svm_sockets , sb . cursize , sb . data , & net_from ) ;
}
else if ( * com_token = = A2A_PING )
{ //quakeworld server listing request
sizebuf_t sb ;
svm . total . queries + + ;
memset ( & sb , 0 , sizeof ( sb ) ) ;
sb . maxsize = sizeof ( net_message_buffer ) ;
sb . data = net_message_buffer ;
MSG_WriteLong ( & sb , - 1 ) ;
MSG_WriteByte ( & sb , A2A_ACK ) ;
MSG_WriteByte ( & sb , ' \n ' ) ;
NET_SendPacket ( svm_sockets , sb . cursize , sb . data , & net_from ) ;
}
else
svm . total . junk + + ;
2005-10-01 03:09:17 +00:00
}
2018-12-28 00:04:36 +00:00
SVM_RemoveOldServers ( ) ;
2004-08-23 00:15:46 +00:00
}
2018-12-28 00:04:36 +00:00
# else
void SVM_Think ( int port ) { }
# endif
2004-08-23 00:15:46 +00:00
2018-12-28 00:04:36 +00:00
# ifdef MASTERONLY
static void SV_Quit_f ( void )
2004-08-23 00:15:46 +00:00
{
2018-12-28 00:04:36 +00:00
Con_TPrintf ( " Shutting down. \n " ) ;
Sys_Quit ( ) ;
}
static void SVM_Status_f ( void )
{
svm_game_t * g ;
svm_server_t * s ;
unsigned clients ;
struct rates_s * s1 , * s2 ;
float period ;
size_t r ;
NET_PrintAddresses ( svm_sockets ) ;
NET_PrintConnectionsStatus ( svm_sockets ) ;
Con_Printf ( " Game count: %u \n " , ( unsigned ) svm . numgames ) ;
for ( g = svm . firstgame ; g ; g = g - > next )
2004-08-23 00:15:46 +00:00
{
2018-12-28 00:04:36 +00:00
clients = 0 ;
for ( s = g - > firstserver ; s ; s = s - > next )
clients + = s - > clients ;
Con_Printf ( " Game %s: %u servers, %u clients \n " , g - > name , ( unsigned ) g - > numservers , clients ) ;
2004-08-23 00:15:46 +00:00
}
2018-12-28 00:04:36 +00:00
s1 = & svm . total ;
r = ( svm . stampring > = countof ( svm . stamps ) - 1 ) ? svm . stampring - countof ( svm . stamps ) - 1 : 0 ;
s2 = & svm . stamps [ r % countof ( svm . stamps ) ] ;
period = s1 - > timestamp - s2 - > timestamp ;
period / = 60 ;
if ( ! period )
period = 1 ;
Con_Printf ( " Heartbeats/min: %f \n " , ( s1 - > heartbeats - s2 - > heartbeats ) / period ) ;
Con_Printf ( " Queries/min: %f \n " , ( s1 - > queries - s2 - > queries ) / period ) ;
}
void SV_Init ( struct quakeparms_s * parms )
{
int manarg ;
2020-02-11 18:06:10 +00:00
char * g ;
2018-12-28 00:04:36 +00:00
COM_InitArgv ( parms - > argc , parms - > argv ) ;
host_parms = * parms ;
Cvar_Init ( ) ;
Memory_Init ( ) ;
Sys_Init ( ) ;
COM_ParsePlusSets ( false ) ;
Cbuf_Init ( ) ;
Cmd_Init ( ) ;
NET_Init ( ) ;
COM_Init ( ) ;
# ifdef WEBSERVER
IWebInit ( ) ;
# endif
Cmd_AddCommand ( " quit " , SV_Quit_f ) ;
Cmd_AddCommand ( " status " , SVM_Status_f ) ;
svm_sockets = FTENET_CreateCollection ( true ) ;
Hash_InitTable ( & svm . serverhash , 1024 , Z_Malloc ( Hash_BytesForBuckets ( 1024 ) ) ) ;
Cvar_Register ( & sv_masterport , " server control variables " ) ;
Cvar_Register ( & sv_masterport_tcp , " server control variables " ) ;
Cvar_Register ( & sv_heartbeattimeout , " server control variables " ) ;
Cvar_Register ( & sv_maxgames , " server control variables " ) ;
Cvar_Register ( & sv_maxservers , " server control variables " ) ;
Cvar_ParseWatches ( ) ;
host_initialized = true ;
manarg = COM_CheckParm ( " -manifest " ) ;
if ( manarg & & manarg < com_argc - 1 & & com_argv [ manarg + 1 ] )
2004-08-23 00:15:46 +00:00
{
2018-12-28 00:04:36 +00:00
char * man = FS_MallocFile ( com_argv [ manarg + 1 ] , FS_SYSTEM , NULL ) ;
FS_ChangeGame ( FS_Manifest_Parse ( NULL , man ) , true , true ) ;
BZ_Free ( man ) ;
2004-08-23 00:15:46 +00:00
}
2018-12-28 00:04:36 +00:00
else
FS_ChangeGame ( NULL , true , true ) ;
2004-08-23 00:15:46 +00:00
2018-12-28 00:04:36 +00:00
Cmd_StuffCmds ( ) ;
Cbuf_Execute ( ) ;
2004-08-23 00:15:46 +00:00
2018-12-28 00:04:36 +00:00
Cvar_ForceCallback ( & sv_masterport ) ;
Cvar_ForceCallback ( & sv_masterport_tcp ) ;
2005-10-01 03:09:17 +00:00
2020-02-11 18:06:10 +00:00
if ( fs_manifest - > protocolname )
for ( g = fs_manifest - > protocolname ; * g ; )
{
g = COM_Parse ( g ) ;
SVM_FindGame ( com_token , 2 ) ;
}
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
Con_Printf ( " Exe: %s \n " , version_string ( ) ) ;
2018-12-28 00:04:36 +00:00
Con_TPrintf ( " ======== %s Initialized ======== \n " , " FTEMaster " ) ;
}
float SV_Frame ( void )
{
realtime = Sys_DoubleTime ( ) ;
while ( 1 )
{
const char * cmd = Sys_ConsoleInput ( ) ;
if ( ! cmd )
break ;
Log_String ( LOG_CONSOLE , cmd ) ;
Cbuf_AddText ( cmd , RESTRICT_LOCAL ) ;
Cbuf_AddText ( " \n " , RESTRICT_LOCAL ) ;
2004-08-23 00:15:46 +00:00
}
2018-12-28 00:04:36 +00:00
Cbuf_Execute ( ) ;
SVM_Think ( sv_masterport . ival ) ;
//record lots of info over multiple frames, for smoother stats info.
svm . total . timestamp = realtime ;
if ( svm . nextstamp < realtime )
{
svm . stamps [ svm . stampring % countof ( svm . stamps ) ] = svm . total ;
svm . stampring + + ;
svm . nextstamp = realtime + 60 ;
2004-08-23 00:15:46 +00:00
}
2018-12-28 00:04:36 +00:00
return 4 ;
2004-08-23 00:15:46 +00:00
}
2020-02-11 18:06:10 +00:00
# endif