N
nE0sIghT
Guest
I'm writting a PHP program, that detect local game-servers. So, i have some problems with parsing WC3: TFT statstring
It's easy to display gamename, since it not encoded, but mapname(actually path to map) encoded and i cann't decode it
Yep, a statstring:
A byte range 58-105(0x3a-0x69) is encoded map string
i detect, that byte range 51-end(0x33- ) consists of cycles by 8 bytes and each 1st byte is some `garbage-byte`(at least it's not a part of normal decoded map-string)
For that map-string:
There is:
g -> garbage byte
c -> encoded byte(ASCII) - 1 = decoded byte(ASCII)
N -> encoded byte(ASCII) = decoded byte(ASCII)
And problem in increased bytes(c), because i cann't understand when byte-code increased, when not
Any ideas about decode method? Mb someone have some examples in some language?
Statstring with other map:
Map: Maps\Download\(6)Risk V2.1.w3m
My parse code:
P.S.: sorry 4 my bad english , i'm from Russia
It's easy to display gamename, since it not encoded, but mapname(actually path to map) encoded and i cann't decode it
Yep, a statstring:
Code:
00000000:f7 30 90 00 50 58 33 57 14 00 00 00 03 00 00 00 ч0ђ.PX3W........
00000010:32 ad 58 0b d0 98 d0 b3 d1 80 d0 b0 20 28 4d 61 2*X.Р˜РіСЂР° (Ma
00000020:2f 5c 62 6c 4c 4c 6c 62 29 00 00 01 03 49 07 01 /\blLLlb)....I..
00000030:01 55 01 b9 75 01 8f 15 f5 59 4d 8b 61 71 73 5d .U.№u.Џ.хYM‹aqs]
00000040:47 73 6f 85 7b 65 6f 55 69 73 6f 75 6f 65 5d 53 Gso…{eoUisouoe]S
00000050:63 65 6f 1b 61 73 69 6f 5d 29 35 af 29 4d 6f 6f ceo.asio])5Ї)Moo
00000060:6f 6d 69 31 75 69 2f 77 33 79 01 0f 4d 61 2f 5d omi1ui/w3y..Ma/]
00000070:63 6d 4d 01 4d 6d 63 01 01 00 08 00 00 00 09 00 cmM.Mmc.........
00000080:00 00 01 00 00 00 04 00 00 00 03 00 00 00 e0 17 ..............а.
A byte range 58-105(0x3a-0x69) is encoded map string
Code:
Maps\FrozenThrone\Scenario\(4)Monolith.w3x
i detect, that byte range 51-end(0x33- ) consists of cycles by 8 bytes and each 1st byte is some `garbage-byte`(at least it's not a part of normal decoded map-string)
For that map-string:
Code:
COMPARE OF MAP-STRINGS:
MЛaqs]GsoЕ{eoUisouoe]Sceoasio])5п)Mooomi1ui/w3y - encoded
Maps\FrozenThrone\Scenario\(4)Monolith.w3x - decoded
N
gNcNcccN
gcNccccN
gcNcNNNc
gNcNNccc
gNNNcNcN
gcccNNc
g -> garbage byte
c -> encoded byte(ASCII) - 1 = decoded byte(ASCII)
N -> encoded byte(ASCII) = decoded byte(ASCII)
And problem in increased bytes(c), because i cann't understand when byte-code increased, when not
Any ideas about decode method? Mb someone have some examples in some language?
Statstring with other map:
Code:
00000000:f7 30 82 00 50 58 33 57 14 00 00 00 01 00 00 00 ч0‚.PX3W........
00000010:ee 37 c2 00 d0 98 d0 b3 d1 80 d0 b0 20 28 4d 61 о7В.Р˜РіСЂР° (Ma
00000020:2f 5c 62 6c 4c 4c 6c 62 29 00 00 01 03 49 07 01 /\blLLlb)....I..
00000030:01 d5 01 99 95 01 2f 7f e9 27 4d cb 61 71 73 5d .Х.™•./й'MЛaqs]
00000040:45 6f 77 19 6f 6d 6f 61 65 5d 29 75 37 29 53 69 Eow.omoae])u7)Si
00000050:73 6b 21 d1 57 33 2f 31 2f 77 33 3b 6d 01 4d 61 sk!СW3/1/w3;m.Ma
00000060:2f 5d 63 01 6d 4d 4d 6d 63 01 01 00 06 00 00 00 /]c.mMMmc.......
00000070:01 00 00 00 01 00 00 00 06 00 00 00 0e 00 00 00 ................
00000080:e0 17 а.
My parse code:
Code:
$string = ''; //Write a statstring here
if(substr($string, 0, 2) === "\xF7\x30" && substr($string, 4, 4) == "\x50\x58\x33\x57")
{
$string = substr($string, 19);
$start = strpos($string, "\x28") + 1;
$end = strpos($string, "\x00") - 1;
$gamename = substr($string, $start, $end - $start);
$string = substr($string, $end + 1 + 11); // There is a encoded map, and tail of packet
echo $gamename . "\n";
}
P.S.: sorry 4 my bad english , i'm from Russia