fix native ut scanner
This commit is contained in:
parent
be77f19e78
commit
c4df94c900
34
mod_ut.cpp
34
mod_ut.cpp
|
@ -3,24 +3,38 @@
|
|||
#include "modhelper.h"
|
||||
#include "mod_ut.h"
|
||||
|
||||
#define UT2K4_PORT 10777
|
||||
static struct game_ports port_arr[] = {
|
||||
{ 7777, 7788, 0 },
|
||||
{ 10777, 10777, 0 },
|
||||
{ 0,0,0 }
|
||||
};
|
||||
|
||||
// there are more scans on different ports..
|
||||
static const char scanmsg[] = { 0x80, 0x00, 0x00, 0x00, 0x00 };
|
||||
static const char scanmsg_ut2k3[] = { 0x79, 0x00, 0x00, 0x00, 0x00 };
|
||||
static const char scanmsg_ut2k4[] = { 0x80, 0x00, 0x00, 0x00, 0x00 };
|
||||
|
||||
void ModUT::scan(MultiSock* msock)
|
||||
{
|
||||
ModHelper::send(msock, UT2K4_PORT, scanmsg, sizeof(scanmsg));
|
||||
ModHelper::send(msock, port_arr, scanmsg_ut2k3, sizeof(scanmsg_ut2k3));
|
||||
ModHelper::send(msock, port_arr, scanmsg_ut2k4, sizeof(scanmsg_ut2k4));
|
||||
}
|
||||
|
||||
int ModUT::parse(NetPkt* pkt, GameList* glist)
|
||||
{
|
||||
if (pkt->getPort() != UT2K4_PORT)
|
||||
/*
|
||||
int gameid;
|
||||
gameid = ModHelper::checkPorts(pkt, port_arr);
|
||||
if (!gameid)
|
||||
return PARSE_REJECT;
|
||||
*/
|
||||
if (pkt->compare(0, scanmsg_ut2k3, sizeof(scanmsg_ut2k3))) {
|
||||
glist->addGame(ID_UT2K3, pkt);
|
||||
return PARSE_ACCEPT;
|
||||
}
|
||||
|
||||
if (pkt->compare(0, scanmsg_ut2k4, sizeof(scanmsg_ut2k4))) {
|
||||
glist->addGame(ID_UT2K4, pkt);
|
||||
return PARSE_ACCEPT;
|
||||
}
|
||||
|
||||
if (!pkt->compare(0, scanmsg, sizeof(scanmsg)))
|
||||
return PARSE_REJECT;
|
||||
|
||||
glist->addGame(ID_UT2K4, pkt);
|
||||
return PARSE_ACCEPT;
|
||||
return PARSE_REJECT;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue