mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-09-18 01:22:08 +00:00
latest, d2s stuff
This commit is contained in:
47
test.php
47
test.php
@@ -156,21 +156,40 @@ class D2ByteReader {
|
||||
|
||||
}
|
||||
|
||||
$file = "D:\Diablo II\MODS\ironman-dev\save\Barb.d2s";
|
||||
$data = file_get_contents($file);
|
||||
$filename = "D:\Diablo II\MODS\ironman-dev\save\Barb.d2s";
|
||||
$fileData = unpack('C*', file_get_contents($filename)); // open file and unpack
|
||||
var_dump(checksum($fileData));
|
||||
|
||||
$c = new D2ByteReader($data);
|
||||
$bytes = $c->readh(643, 5);
|
||||
$bits = $c->toBits($bytes);
|
||||
|
||||
$bits[4] = 1;
|
||||
$bits[5] = 1;
|
||||
$bits[8] = 1;
|
||||
|
||||
$newBytes = $c->bitsToHexString($bits);
|
||||
$c->writeBytes(643, $newBytes);
|
||||
|
||||
$c->writeBytes(12, "00000000"); // zero old checksum
|
||||
$newChecksum = checksum(unpack('C*', $c->getData())); // get new checksum
|
||||
$c->writeBytes(12, $newChecksum); // write new checksum
|
||||
file_put_contents($file, $c->getData()); // write bytestream to file
|
||||
//$file = "D:\Diablo II\MODS\ironman-dev\save\Barb.d2s";
|
||||
//$data = file_get_contents($file);
|
||||
//
|
||||
//$c = new D2ByteReader($data);
|
||||
//
|
||||
//$checksum = checksum(unpack('C*', $c->getData()));
|
||||
//
|
||||
//ddump($checksum);
|
||||
|
||||
//$bytes = $c->readh(643, 5);
|
||||
//$bits = $c->toBits($bytes);
|
||||
//
|
||||
//$bits[4] = 0;
|
||||
//$bits[5] = 0;
|
||||
//$bits[8] = 0;
|
||||
|
||||
//$newBytes = $c->bitsToHexString($bits);
|
||||
//$c->writeBytes(643, $newBytes);
|
||||
//
|
||||
//$c->writeBytes(12, "00000000"); // zero old checksum
|
||||
//
|
||||
//dump($c->readh(12, 4));
|
||||
//
|
||||
//$newChecksum = checksum(unpack('C*', $c->getData())); // get new checksum
|
||||
//$c->writeBytes(12, $newChecksum); // write new checksum
|
||||
//
|
||||
//dump($c->readh(12, 4));
|
||||
//
|
||||
//file_put_contents($file, $c->getData()); // write bytestream to file
|
||||
|
||||
|
Reference in New Issue
Block a user