@@ -10,6 +10,15 @@ function string.tohex(str)
1010 end ))
1111end
1212
13+ function pack_uint64_le (n )
14+ local bytes = {}
15+ for i = 1 , 8 do
16+ bytes [i ] = string.char (n % 256 )
17+ n = math.floor (n / 256 )
18+ end
19+ return table.concat (bytes )
20+ end
21+
1322function handle (ctx , data )
1423
1524 -- prtocol begins with FFFFFFFF and the packedid
@@ -137,6 +146,14 @@ function handle(ctx, data)
137146 versionPrefix = get_var (" GameVersionPrefix" )
138147 serverPort = get_port (" main" )
139148
149+
150+ edfGameIdStr = get_var (" SteamAppId" )
151+ edfGameId = nil
152+ if edfGameIdStr ~= nil then
153+ edfGameId = tonumber (edfGameIdStr )
154+ end
155+
156+
140157 -- EDF & 0x80: Port
141158 -- EDF & 0x10: SteamID
142159 -- EDF & 0x20 Keywords
@@ -149,7 +166,6 @@ function handle(ctx, data)
149166 edfKeywords = get_var (" GameKeywords" ) or " ,OWNINGID:90202064633057281,OWNINGNAME:90202064633057281,NUMOPENPUBCONN:50,P2PADDR:90202064633057281,P2PPORT:" ..
150167 serverPort .. " ,LEGACY_i:0"
151168
152- edfGameId = " a00f000000000000"
153169
154170 serverinfopacket = ServeInfoPacket :new ()
155171 serverinfopacket .name = name
@@ -226,6 +242,10 @@ function Packet:appendByte(data)
226242 self .bytes = self .bytes .. string.char (data )
227243end
228244
245+ function Packet :appendRawBytes (data )
246+ self .bytes = self .bytes .. data
247+ end
248+
229249function Packet :appendShort (num )
230250 self .bytes = self .bytes .. string .fromhex (number_to_little_endian_short (num ))
231251end
@@ -318,7 +338,8 @@ function ServeInfoPacket:GetRawPacket()
318338 p :appendString (self .edfKeywords )
319339 end
320340 if self .edfGameId ~= nil then
321- p :appendHex (self .edfGameId )
341+ local bytes = pack_uint64_le (self .edfGameId )
342+ p :appendRawBytes (bytes )
322343 end
323344
324345
0 commit comments