Skip to content

Commit

Permalink
Killing floor & UT2004 better decryption
Browse files Browse the repository at this point in the history
  • Loading branch information
tltneon committed Dec 28, 2024
1 parent 35fae92 commit 848195c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
Binary file removed src/icons/ut2004/killing_floor.gif
Binary file not shown.
Binary file removed src/icons/ut2004/red_orchestra.gif
Binary file not shown.
16 changes: 11 additions & 5 deletions src/lgsl_protocol.php
Original file line number Diff line number Diff line change
Expand Up @@ -1515,17 +1515,21 @@ public function process() {
$buffer_s->skip(5);
$this->_data['e']['hostport'] = $buffer_s->cutByteUnpack(4, "S");
$buffer_s->skip(4);
$this->_data['s']['name'] = $buffer_s->cutString(1);
$this->_data['s']['map'] = $buffer_s->cutString(1);
$this->_data['s']['name'] = Helper::lgslParseColor($buffer_s->cutString(1), "ut2003", true);
$this->_data['s']['map'] = Helper::lgslParseColor($buffer_s->cutString(1), "ut2003", true);
$this->_data['s']['mode'] = $buffer_s->cutString(1);
$this->_data['s']['players'] = $buffer_s->cutByteUnpack(4, "S");
$this->_data['s']['playersmax'] = $buffer_s->cutByteUnpack(4, "S");

//---------------------------------------------------------+

while ($buffer_e && $buffer_e[0] != "\x00") {
$item_key = strtolower(Helper::lgslCutString($buffer_e, 1));
$item_value = Helper::lgslCutString($buffer_e, 1);
$item_key = strtolower(Helper::lgslCutString($buffer_e, 1));
if (Helper::lgslCutByte($buffer_e, 1) == "\x00") {
$item_value = LGSL::NONE;
} else {
$item_value = Helper::lgslCutString($buffer_e);
}

$item_key = str_replace("\x1B\xFF\xFF\x01", "", $item_key); // REMOVE MOD
$item_value = str_replace("\x1B\xFF\xFF\x01", "", $item_value); // GARBAGE
Expand All @@ -1548,9 +1552,10 @@ public function process() {
$this->_data['p'][$player_key]['ping'] = Helper::lgslUnpack(Helper::lgslCutByte($buffer_p, 4), "S");
$this->_data['p'][$player_key]['score'] = Helper::lgslUnpack(Helper::lgslCutByte($buffer_p, 4), "s");
$tmp = Helper::lgslCutString($buffer_p, 4);

if (strlen($tmp) > 3) {
if ($tmp[3] == "\x20") { $this->_data['p'][$player_key]['team'] = 1; }
elseif ($tmp[3] == "\x40") { $this->_data['p'][$player_key]['team'] = 2; }
}

$player_key ++;
}
Expand Down Expand Up @@ -3243,6 +3248,7 @@ static function lgslParseColor($string, $type, $needRemove = true) {
$needRemove &= !(new Config())->offsetGet('remove_colors');
switch ($type) {
case "2": return preg_replace("/\^[\x20-\x7E]/", "", $string);
case "ut2003": return preg_replace("/[^\x20-\x7E]/", "", $string);
case "doomskulltag": return preg_replace("/\\x1c./", "", $string);
case "farcry": return preg_replace("/\\$\d/", "", $string);
case "fivem":
Expand Down

0 comments on commit 848195c

Please sign in to comment.