mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-10-23 05:04:24 -05:00
D2S Parsing almost done. Todo: full item parsing, Editor GUI, NPC Intro Data, refactor code, writeQuest/writeStat function etc.
This commit is contained in:
@@ -5,7 +5,7 @@ require_once './src/D2BitReader.php';
|
||||
|
||||
class D2ByteReader {
|
||||
|
||||
private string $data;
|
||||
private string $data = '';
|
||||
private int $offset = 0;
|
||||
|
||||
public function __construct(string $data) {
|
||||
@@ -102,13 +102,18 @@ class D2ByteReader {
|
||||
}
|
||||
}
|
||||
|
||||
public function toBytes(string $bits) {
|
||||
public function toBytesR(string $bits) : string {
|
||||
foreach (str_split($bits, 8) as $byteString) {
|
||||
$bytes[] = (bindec(strrev($byteString)));
|
||||
$bytes .= strtoupper(str_pad(dechex(bindec(($byteString))), 2, 0, STR_PAD_LEFT));
|
||||
}
|
||||
foreach ($bytes as $byte) {
|
||||
dump($byte);
|
||||
return $bytes;
|
||||
}
|
||||
|
||||
public function toBytes(string $bits) : string {
|
||||
foreach (str_split($bits, 8) as $byteString) {
|
||||
$bytes .= strtoupper(str_pad(dechex(bindec(strrev($byteString))), 2, 0, STR_PAD_LEFT));
|
||||
}
|
||||
return $bytes;
|
||||
}
|
||||
|
||||
public function bitsToHexString(string $bits): string {
|
||||
|
Reference in New Issue
Block a user