latest, d2s stuff

This commit is contained in:
Hash Borgir
2022-07-03 04:13:50 -06:00
parent e51e40175e
commit f3b24de2a8
11 changed files with 393 additions and 239 deletions

View File

@@ -64,10 +64,21 @@ class D2ByteReader {
$this->data[$pos] = pack('H*', $byte);
}
}
public function insertBytes(int $offset, string $bytes) {
if ($offset < 0 || $offset > strlen($this->data) || $bytes == '')
return false;
$data = bin2hex($this->data); // convert to hex bytes string
$newData = substr_replace($data, $bytes, $offset, 0);
$this->data = hex2bin($newData);
}
public function getData() {
return $this->data ? $this->data : false;
}
public function setData($data){
$this->data = $data;
}
public function getOffset(): int {
return $this->offset;