implement status command for nq clients that expect something to be printed. IP addresses are withheld.

fix stats issue.
support menuqc-based loading screens.
fixed 2d render-to-texture issues.
(finally) throttle 'connection lost or aborted' messages. report the ip address too, because we can.
begun work on nq-style player ip-logging. ip addresses are collected now, but there's still no actual database code yet.
rewrote engine auto-update. now part of the updates menu instead of system-specific special-case code. Still requires a system function to actually invoke the updated engine however.
added sdl audio capture support (requires sdl 2.0.5).
treat q_version like f_version etc. respond to both.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5046 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2017-01-24 10:27:39 +00:00
parent 9055d674eb
commit c68cbfec24
36 changed files with 855 additions and 631 deletions

View file

@ -325,6 +325,89 @@ void SV_Fraglogfile_f (void)
}
*/
static qboolean IPLog_Merge_File(const char *fname)
{
char ip[MAX_ADR_SIZE];
char name[256];
char line[1024];
vfsfile_t *f;
if (!*fname)
fname = "iplog.txt";
f = FS_OpenVFS(fname, "rb", FS_GAME);
if (!f)
return false;
if (!Q_strcasecmp(COM_FileExtension(fname, name, sizeof(name)), ".dat"))
{ //we don't write this format because of it being limited to ipv4, as well as player name lengths
while (VFS_READ(f, line, 20) == 20)
{
Q_snprintfz(ip, sizeof(ip), "%i.%i.%i.%i", (qbyte)line[0], (qbyte)line[1], (qbyte)line[2], (qbyte)line[3]);
memcpy(name, line+4, 20-4);
name[20-4] = 0;
IPLog_Add(ip, name);
}
}
else
{
while (VFS_GETS(f, line, sizeof(line)-1))
{
//whether the name contains quotes or what is an awkward one.
//we always write quotes (including string markup to avoid issues)
//dp doesn't, and our parser is lazy, so its possible we'll get gibberish that way
if (COM_ParseOut(COM_ParseOut(line, ip, sizeof(ip)), name, sizeof(name)))
IPLog_Add(ip, name);
}
}
VFS_CLOSE(f);
return true;
}
void IPLog_Add(const char *ipstr, const char *name)
{
if (*ipstr != '[' && *ipstr < '0' && *ipstr > '9')
return;
//might be x.y.z.w:port
//might be x.y.z.FUCKED
//might be x.y.z.0/24
//might be [::]:port
//might be [::]/bits
//or other ways to express an ip address
//note that ipv4 addresses should be converted to ipv6 ::ffff:x.y.z.w format for internal use or something, then this code only needs to deal with a single 128bit address format.
//ipv6 addresses generally only need 64bits to identify a user's home router, the other 64bits are generally 'just' to avoid nats.
//ignore ipx addresses, I doubt anyone will ever actually use it, and even if they do its just lans.
}
static void IPLog_Identify_f(void)
{
// const char *nameorip = Cmd_Argv(1);
Con_Printf("Not yet implemented\n");
//if *, use a mask that includes all ips
//try to parse as an ip
//if server is active, walk players to see if there's a name match to get their address and guess an address mask
//else if client is active, walk players to see if there's a name match, to get their address+mask if known via nq hacks
//look for matches
}
static void IPLog_Dump_f(void)
{
const char *fname = Cmd_Argv(1);
if (!*fname)
fname = "iplog.txt";
#if 1
Con_Printf("Not yet implemented\n");
#else
vfsfile_t *f = FS_OpenVFS(fname, "wb", FS_GAMEONLY);
VFS_PRINTF(f, "//generated by "FULLENGINENAME"\n", foo->ip, foo->name);
for (foo = first; foo; foo = foo->next)
{
char buf[1024];
VFS_PRINTF(f, "%s %s\n", foo->ip, COM_QuotedString(foo->name, buf, sizeof(buf), false));
}
VFS_CLOSE(f);
#endif
}
static void IPLog_Merge_f(void)
{
const char *fname = Cmd_Argv(1);
if (!IPLog_Merge_File(fname))
Con_Printf("unable to read %s\n", fname);
}
void Log_Init(void)
{
@ -346,6 +429,10 @@ void Log_Init(void)
Cmd_AddCommand("logfile", Log_Logfile_f);
Cmd_AddCommand("identify", IPLog_Identify_f);
Cmd_AddCommand("ipmerge", IPLog_Merge_f);
Cmd_AddCommand("ipdump", IPLog_Dump_f);
// cmd line options, debug options
#ifdef CRAZYDEBUGGING
Cvar_ForceSet(&log_enable[LOG_CONSOLE], "1");