Seems attachments are not allowed here..
so going plain text...
diff -uNr qstat2.orig/a2s.c qstat2/a2s.c
--- qstat2.orig/a2s.c 2008-10-29 04:07:08.000000000 +0200
+++ qstat2/a2s.c 2009-01-04 19:56:39.000000000 +0200
@@ -22,6 +22,8 @@
#include "packet_manip.h"
#define A2S_GETCHALLENGE "\xFF\xFF\xFF\xFF\x57"
+#define A2S_PLAYER_CHALLENGE "\xFF\xFF\xFF\xFF\x55\xFF\xFF\xFF\xFF"
+#define A2S_RULES_CHALLENGE "\xFF\xFF\xFF\xFF\x56\xFF\xFF\xFF\xFF"
#define A2S_CHALLENGERESPONSE 0x41
#define A2S_INFO "\xFF\xFF\xFF\xFF\x54Source Engine
Query"
#define A2S_INFORESPONSE_HL1 0x6D
@@ -77,7 +79,7 @@
if(!status->have_challenge)
{
debug(3, "sending challenge");
- if( SOCKET_ERROR == qserver_send_initial(server,
A2S_GETCHALLENGE, sizeof(A2S_GETCHALLENGE)-1) )
+ if( SOCKET_ERROR == qserver_send_initial(server,
A2S_PLAYER_CHALLENGE, sizeof(A2S_PLAYER_CHALLENGE)-1) )
{
return SOCKET_ERROR;
}
@@ -179,11 +181,21 @@
// 2. the index of this packet starting from 0 ( byte )
// 3. Size of the split ( short )
if(pktlen < 10) goto out_too_short;
- pkt_max = ((unsigned char)*pkt);
- pkt_index = ((unsigned char)*(pkt+1));
- debug( 3, "packetid[2]: 0x%hhx => idx: %hhu, max:
%hhu", *pkt, pkt_index, pkt_max );
- pkt+=4;
- pktlen -= 12;
+ if(server->appid < 200) // Goldsource Engine
+ {
+ pkt_max = ((unsigned char)*pkt) & 15;
+ pkt_index = ((unsigned char)*pkt) >> 4;
+ pkt++;
+ pktlen -= 9;
+ }
+ else // Source Engine
+ {
+ pkt_max = ((unsigned char)*pkt);
+ pkt_index = ((unsigned char)*(pkt+1));
+ pkt+=4;
+ pktlen -= 12;
+ }
+ debug( 3, "packetid[2]: 0x%hhx => idx: %hhu, max:
%hhu", server->appid, *pkt, pkt_index, pkt_max );
}
else
{
@@ -437,6 +449,7 @@
if(pktlen < 9) goto out_too_short;
// pkt[0], pkt[1] steam id unused
+ server->appid = *pkt;
server->num_players = (unsigned char)pkt[2];
server->max_players = (unsigned char)pkt[3];
// pkt[4] number of bots
@@ -498,7 +511,7 @@
add_rule( server, "game_port", buf, 0 );
pkt += 2;
pktlen -= 2;
- fprintf( stderr, "game port = %d\n", gameport );
+// fprintf( stderr, "game port = %d\n", gameport );
}
if ( edf & 0x40 )
diff -uNr qstat2.orig/qserver.h qstat2/qserver.h
--- qstat2.orig/qserver.h 2008-04-25 19:53:14.000000000 +0300
+++ qstat2/qserver.h 2009-01-04 16:11:35.000000000 +0200
@@ -104,6 +104,7 @@
int max_players;
int num_players;
int protocol_version;
+ unsigned short appid;
int max_spectators;
int num_spectators;
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlds_linux