- UT2004 master server support, needs qstat from CVS
git-svn-id: http://svn.code.sf.net/p/xqf/code/trunk@667 d2ac09be-c843-0410-8b1f-f8a84130e0ec
This commit is contained in:
parent
41196e9185
commit
9602178875
@ -1,3 +1,6 @@
|
||||
Oct 17, 2004: Ludwig Nussel <l-n@users.sourceforge.net>
|
||||
- UT2004 master server support, needs qstat from CVS
|
||||
|
||||
Oct 14, 2004: Ludwig Nussel <l-n@users.sourceforge.net>
|
||||
- add descent3 server listing from d3.descent.cx. Thanks Esa for providing a
|
||||
format suitable for XQF!
|
||||
|
@ -154,6 +154,8 @@ static struct quake_private cod_private;
|
||||
static struct quake_private jk3_private;
|
||||
static struct quake_private doom3_private;
|
||||
|
||||
static void ut2004_cmd_or_dir_changed(struct game* g);
|
||||
|
||||
#include "games.c"
|
||||
|
||||
struct gsname2type_s
|
||||
@ -3568,4 +3570,43 @@ out:
|
||||
g_free(verinfo);
|
||||
}
|
||||
|
||||
static void ut2004_cmd_or_dir_changed(struct game* g)
|
||||
{
|
||||
FILE* f;
|
||||
char* keyfile = NULL;
|
||||
|
||||
debug(2, "cmd: %s, dir: %s, home: %s", g->cmd, g->real_dir, g->real_home);
|
||||
|
||||
keyfile = file_in_dir (g->real_home, "System/cdkey");
|
||||
if(keyfile)
|
||||
{
|
||||
f = fopen(keyfile, "r");
|
||||
if(!f)
|
||||
{
|
||||
g_free(keyfile);
|
||||
keyfile = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if(!keyfile)
|
||||
{
|
||||
if(f) fclose(f);
|
||||
keyfile = file_in_dir (g->real_dir, "System/cdkey");
|
||||
if(keyfile)
|
||||
{
|
||||
f = fopen(keyfile, "r");
|
||||
if(!f)
|
||||
{
|
||||
g_free(keyfile);
|
||||
keyfile = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(keyfile || (!keyfile && game_get_attribute(g->type,"cdkey")))
|
||||
game_set_attribute(g->type, "cdkey", keyfile);
|
||||
|
||||
if(f) fclose(f);
|
||||
}
|
||||
|
||||
// vim: sw=2
|
||||
|
@ -41,6 +41,7 @@ enum {
|
||||
GAME_QUAKE1_SKIN = 0x0200,
|
||||
GAME_QUAKE3_MASTERPROTOCOL = 0x0400, // master server protocol version is in games_data["masterprotocol"]
|
||||
GAME_LAUNCH_HOSTPORT = 0x0800, // use hostport rule as port when launching
|
||||
GAME_MASTER_CDKEY = 0x1000, // master server requires CD key
|
||||
};
|
||||
|
||||
struct game {
|
||||
|
@ -454,17 +454,20 @@ struct game games[] = {
|
||||
save_info : quake_save_info,
|
||||
init_maps : unreal_init_maps,
|
||||
has_map : unreal_has_map,
|
||||
default_home : "~/.ut2003",
|
||||
pd : &ut2_private,
|
||||
command : stringlist019,
|
||||
},
|
||||
{
|
||||
type : UT2004_SERVER,
|
||||
flags : GAME_CONNECT | GAME_SPECTATE | GAME_PASSWORD | GAME_LAUNCH_HOSTPORT,
|
||||
flags : GAME_CONNECT | GAME_SPECTATE | GAME_PASSWORD | GAME_LAUNCH_HOSTPORT | GAME_MASTER_CDKEY,
|
||||
name : "UT 2004",
|
||||
default_port : 7777,
|
||||
default_master_port : 28902,
|
||||
id : "UT2004S",
|
||||
qstat_str : "UT2S",
|
||||
qstat_option : "-ut2s",
|
||||
qstat_master_option : "-ut2004m",
|
||||
icon : "ut2004_xpm",
|
||||
parse_player : un_parse_player,
|
||||
parse_server : quake_parse_server,
|
||||
@ -474,6 +477,8 @@ struct game games[] = {
|
||||
save_info : quake_save_info,
|
||||
init_maps : unreal_init_maps,
|
||||
has_map : unreal_has_map,
|
||||
cmd_or_dir_changed : ut2004_cmd_or_dir_changed,
|
||||
default_home : "~/.ut2004",
|
||||
pd : &ut2004_private,
|
||||
command : stringlist020,
|
||||
},
|
||||
|
@ -369,19 +369,24 @@
|
||||
<icon>ut2_xpm</icon>
|
||||
<command>ut2003_demo</command>
|
||||
<command>ut2003</command>
|
||||
<default_home>~/.ut2003</default_home>
|
||||
<pd>ut2_private</pd>
|
||||
</game>
|
||||
<game>
|
||||
<base>UN_SERVER</base>
|
||||
<type>UT2004_SERVER</type>
|
||||
<name>UT 2004</name>
|
||||
<flags>GAME_CONNECT | GAME_SPECTATE | GAME_PASSWORD | GAME_LAUNCH_HOSTPORT</flags>
|
||||
<flags>GAME_CONNECT | GAME_SPECTATE | GAME_PASSWORD | GAME_LAUNCH_HOSTPORT | GAME_MASTER_CDKEY</flags>
|
||||
<default_master_port>28902</default_master_port>
|
||||
<id>UT2004S</id>
|
||||
<qstat_str>UT2S</qstat_str>
|
||||
<qstat_option>-ut2s</qstat_option>
|
||||
<qstat_master_option>-ut2004m</qstat_master_option>
|
||||
<icon>ut2004_xpm</icon>
|
||||
<command>ut2004demo</command>
|
||||
<command>ut2004</command>
|
||||
<cmd_or_dir_changed>ut2004_cmd_or_dir_changed</cmd_or_dir_changed>
|
||||
<default_home>~/.ut2004</default_home>
|
||||
<pd>ut2004_private</pd>
|
||||
</game>
|
||||
<game>
|
||||
|
@ -1129,6 +1129,8 @@ static char *builtin_masters_update_info[] = {
|
||||
|
||||
"ADD JK3S master://masterjk3.ravensoft.com:29060 Ravensoft",
|
||||
|
||||
"ADD UT2004S master://ut2004master1.epicgames.com:28902 Epic",
|
||||
|
||||
"ADD QS lan://255.255.255.255 LAN",
|
||||
"ADD QWS lan://255.255.255.255 LAN",
|
||||
"ADD Q2S lan://255.255.255.255 LAN",
|
||||
|
@ -1364,6 +1364,58 @@ static struct stat_conn *stat_update_master_qstat (struct stat_job *job,
|
||||
filter->filter_not_full?"notfull":"",
|
||||
NULL);
|
||||
}
|
||||
else if( m->type == UT2004_SERVER )
|
||||
{
|
||||
GString* str = NULL;
|
||||
const char* cdkey = game_get_attribute(m->type,"cdkey");
|
||||
if(!cdkey)
|
||||
{
|
||||
xqf_error(_("UT2004 CD Key not found, cannot query master '%s'.\n"
|
||||
"Make sure the working directory is set correctly."), m->name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
str = g_string_new(NULL);
|
||||
g_string_sprintf(str, "%s,outfile,cdkey=%s", master_qstat_option(m), cdkey);
|
||||
|
||||
if(current_server_filter > 0 && (cur_filter & FILTER_SERVER_MASK))
|
||||
{
|
||||
struct server_filter_vars* filter =
|
||||
g_array_index (server_filters, struct server_filter_vars*, current_server_filter-1);
|
||||
|
||||
if(filter)
|
||||
{
|
||||
GString* status = g_string_new(NULL);
|
||||
|
||||
if(filter->filter_not_empty)
|
||||
status = g_string_append(status, "notempty");
|
||||
|
||||
if(filter->filter_not_full)
|
||||
status = g_string_append(status, "notfull");
|
||||
|
||||
if(filter->filter_no_password)
|
||||
status = g_string_append(status, "nopassword");
|
||||
|
||||
if(filter->game_contains&&*filter->game_contains)
|
||||
{
|
||||
g_string_sprintfa(str, ",gametype=%s", filter->game_contains);
|
||||
}
|
||||
|
||||
if(status->str && *status->str)
|
||||
{
|
||||
g_string_sprintfa(str, ",status=%s", status->str);
|
||||
}
|
||||
g_string_free(status, TRUE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
str = g_string_append(str, ",status=nostandard");
|
||||
}
|
||||
|
||||
arg_type = str->str;
|
||||
g_string_free(str, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
arg_type = g_strdup_printf ("%s,outfile", master_qstat_option(m));
|
||||
@ -1401,6 +1453,7 @@ static struct stat_conn *stat_update_master_qstat (struct stat_job *job,
|
||||
g_free (file);
|
||||
}
|
||||
|
||||
out:
|
||||
g_free (cmd);
|
||||
g_free (arg_type);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user