public static function parseSerializedData($string, &$numByte) { $dataType = MPQFile::readByte($string, $numByte); switch ($dataType) { case 0x2: // binary data $dataLen = MPQFile::parseVLFNumber($string, $numByte); return MPQFile::readBytes($string, $numByte, $dataLen); break; case 0x4: // simple array $array = array(); $numByte += 2; // skip 01 00 $numElements = MPQFile::parseVLFNumber($string, $numByte); while ($numElements > 0) { $array[] = MPQFile::parseSerializedData($string, $numByte); $numElements--; } return $array; break; case 0x5: // array with keys $array = array(); $numElements = MPQFile::parseVLFNumber($string, $numByte); while ($numElements > 0) { $index = MPQFile::parseVLFNumber($string, $numByte); $array[$index] = MPQFile::parseSerializedData($string, $numByte); $numElements--; } return $array; break; case 0x6: // number of one byte return MPQFile::readByte($string, $numByte); break; case 0x7: // number of four bytes return MPQFile::readUInt32($string, $numByte); break; case 0x9: // number in VLF return MPQFile::parseVLFNumber($string, $numByte); break; default: // if ($this->debug) $this->debug(sprintf("Unknown data type in function parseDetailsValue (%d)",$dataType)); return false; } }