mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2024-11-30 04:26:03 +00:00
D2S/Item parser in progress. Still need to debug cubemain.txt doc generator output colulmns. Saving code for now
This commit is contained in:
parent
521dfe12c6
commit
822e3dcbd8
189
CharEditor.php
189
CharEditor.php
@ -7,130 +7,103 @@ ini_set('max_execution_time', '0');
|
||||
session_start();
|
||||
ob_start();
|
||||
|
||||
echo "<pre>";
|
||||
require_once './config.php';
|
||||
require_once './_pdo.php';
|
||||
|
||||
require_once './src/D2Functions.php';
|
||||
require_once './src/D2BitReader.php';
|
||||
//require_once './src/D2Item.php';
|
||||
|
||||
|
||||
define('DB_FILE', $_SESSION['modname'] . ".db");
|
||||
PDO_Connect("sqlite:" . DB_FILE);
|
||||
|
||||
|
||||
$sql = "SELECT * FROM strings";
|
||||
$strings = PDO_FetchAssoc($sql);
|
||||
|
||||
|
||||
$sql = "SELECT code,namestr
|
||||
FROM armor
|
||||
UNION SELECT code,namestr
|
||||
FROM misc
|
||||
UNION SELECT code,namestr
|
||||
FROM weapons
|
||||
";
|
||||
$namestr = PDO_FetchAssoc($sql);
|
||||
|
||||
|
||||
//ddump($namestr);
|
||||
|
||||
//$filePath = "D:\Diablo II\MODS\ironman-dev\save\Aldur.d2s";
|
||||
$filePath = "D:\Diablo II\MODS\ironman-dev\save\Sorc.d2s";
|
||||
$fp = fopen($filePath, "rb");
|
||||
//$filePath = "D:\Diablo II\MODS\MedianXL2012\save\Lok.d2s";
|
||||
//$filePath = "D:\Diablo II\MODS\MedianXL2012\save\Pal.d2s";
|
||||
|
||||
$fp = fopen($filePath, 'r+b');
|
||||
$data = file_get_contents($filePath);
|
||||
|
||||
$i_offset = strpos($data, "JM");
|
||||
|
||||
function strtobits(string $str): string {
|
||||
$ret = "";
|
||||
for ($i = 0; $i < strlen($str); ++$i) {
|
||||
$ord = ord($str[$i]);
|
||||
for ($bitnum = 7; $bitnum >= 0; --$bitnum) {
|
||||
if ($ord & (1 << $bitnum)) {
|
||||
$ret .= "1";
|
||||
} else {
|
||||
$ret .= "0";
|
||||
}
|
||||
}
|
||||
fseek($fp, $i_offset + 2);
|
||||
$i_total = unpack('S*', (fread($fp, 2)))[1];
|
||||
|
||||
$items = null;
|
||||
|
||||
$offset = $i_offset + 4; // JM00
|
||||
|
||||
$first_item_offset = strposX($data, "JM", 2);
|
||||
$second_item_offset = strposX($data, "JM", 3);
|
||||
|
||||
$item_size = $second_item_offset - $first_item_offset;
|
||||
|
||||
for ($i = 2; $i <= $i_total; $i++) {
|
||||
fseek($fp, strposX($data, 'JM', $i));
|
||||
$_items[] = unpack('C*', fread($fp, 21));
|
||||
}
|
||||
|
||||
foreach ($_items as $_item) {
|
||||
$item = null;
|
||||
foreach ($_item as $i_bytes) {
|
||||
$item .= strrev(str_pad(decbin($i_bytes), 8, 0, STR_PAD_LEFT));
|
||||
// $item .= (str_pad(dechex($i_bytes), 2, 0, STR_PAD_LEFT));
|
||||
}
|
||||
return $ret;
|
||||
$items[] = $item;
|
||||
}
|
||||
|
||||
foreach ($qNorm as $k => $v) {
|
||||
fseek($fp, $k);
|
||||
$questsNorm[$k] = fread($fp, 2);
|
||||
}
|
||||
// ddump($items);
|
||||
|
||||
foreach ($qNM as $k => $v) {
|
||||
fseek($fp, $k);
|
||||
$questsNM[$k] = fread($fp, 2);
|
||||
}
|
||||
foreach ($items as $_item) {
|
||||
|
||||
foreach ($qHell as $k => $v) {
|
||||
fseek($fp, $k);
|
||||
$questsHell[$k] = fread($fp, 2);
|
||||
}
|
||||
// dump($_item[19]);
|
||||
// dump($_item);
|
||||
// dump(strtoupper(implode(" ", str_split($_item, 8))));
|
||||
// dump((($_item[36])));
|
||||
|
||||
foreach ($offsets as $k => $v) {
|
||||
fseek($fp, $k);
|
||||
$data[$k] = fread($fp, $v);
|
||||
}
|
||||
$b = new D2BitReader($_item);
|
||||
|
||||
//$b->bseek(27);
|
||||
//dump($b->bread(1));
|
||||
|
||||
|
||||
$b->seek(76);
|
||||
// dump($b->bread(32));
|
||||
$codeBits = str_split($b->read(32), 8);
|
||||
|
||||
$charData['Identifier'] = bin2hex($data[0]);
|
||||
$itemCode = '';
|
||||
foreach ($codeBits as $byte) {
|
||||
|
||||
$charData['VersionID'] = unpack('l', $data[4])[1]; // 96 is v1.10+ - check out
|
||||
// dump(strrev($byte));
|
||||
//dump(sprintf('%c', bindec($byte)));
|
||||
|
||||
$charData['Filesize'] = round(unpack('l', $data[8])[1] / 1024, 2) . " KB"; // 1.41 KB (1,447 bytes) - checks out
|
||||
// $charData['Checksum'] = bin2hex($data['12']);
|
||||
// $charData['Activeweapon'] = unpack('l', $data['16']);
|
||||
|
||||
$charData['CharacterName'] = ($data[20]);
|
||||
|
||||
// $charData['CharacterStatus'] = array_filter(str_split(strtobits($data[36])));
|
||||
|
||||
foreach ($charData['CharacterStatus'] as $k => $v) {
|
||||
$str .= ($characterStatus[$k]) . " ";
|
||||
}
|
||||
|
||||
$charData['CharacterStatus'] = $str;
|
||||
|
||||
// $charData['Characterprogression'] = bindec($data['37']);
|
||||
|
||||
$charData['CharacterClass'] = $class[unpack('C', $data[40])[1]];
|
||||
|
||||
$charData['CharacterLevel'] = unpack('C', $data[43])[1];
|
||||
|
||||
$charData['Lastplayed'] = gmdate("Y-m-d\TH:i:s\Z", unpack('I', $data[48])[0]);
|
||||
|
||||
// $charData['Assignedskills'] = (unpack('i16', $data['56']));
|
||||
|
||||
$charData['LeftmousebuttonskillID'] = $skills[unpack('i', $data[120])[1]];
|
||||
$charData['RightmousebuttonskillID'] = $skills[unpack('i', $data[124])[1]];
|
||||
$charData['LeftswapmousebuttonskillID'] = $skills[unpack('i', $data[128])[1]];
|
||||
$charData['RightswapmousebuttonskillID'] = $skills[unpack('i', $data[132])[1]];
|
||||
|
||||
// $charData['Charactermenuappearance'] = unpack('i', $data[136]);
|
||||
|
||||
$x = str_split(strtobits($data[168]), 8);
|
||||
|
||||
$onDifficulty['Norm'] = $x[0][0];
|
||||
$onDifficulty['NM'] = $x[1][0];
|
||||
$onDifficulty['Hell'] = $x[2][0];
|
||||
|
||||
$charData['Difficulty'] = array_filter($onDifficulty);
|
||||
|
||||
//$charData['MapID'] = $data['171'];
|
||||
//$charData['Mercenarydead'] = unpack('i', $data['177']);
|
||||
//$charData['MercenaryID'] = $data['179'];
|
||||
//$charData['MercenaryNameID'] = $data['183'];
|
||||
//$charData['Mercenarytype'] = $data['185'];
|
||||
//$charData['Mercenaryexperience'] = $data['187'];
|
||||
|
||||
|
||||
foreach ($questsNorm as $k => $v) {
|
||||
$x = array_filter(str_split(strtobits($v), 8));
|
||||
if ($x[0][0]) {
|
||||
$quests[] = ($qNorm[$k] . " => " . (($x[0][0])) . "<br>");
|
||||
}
|
||||
}
|
||||
foreach ($questsNM as $k => $v) {
|
||||
$x = array_filter(str_split(strtobits($v), 8));
|
||||
if ($x[0][0]) {
|
||||
$quests[] = ($qNM[$k] . " => " . (($x[0][0])) . "<br>");
|
||||
}
|
||||
}
|
||||
foreach ($questsHell as $k => $v) {
|
||||
$x = array_filter(str_split(strtobits($v), 8));
|
||||
if ($x[0][0]) {
|
||||
$quests[] = ($qHell[$k] . " => " . (($x[0][0])) . "<br>");
|
||||
$itemCode .= chr(bindec(strrev($byte)));
|
||||
}
|
||||
|
||||
$itemCode = trim($itemCode);
|
||||
|
||||
dump($namestr[$itemCode]);
|
||||
dump($strings[$namestr[$itemCode]]);
|
||||
|
||||
// dump($strings[trim($itemCode)]);
|
||||
}
|
||||
|
||||
$charData['Quests'] = $quests;
|
||||
|
||||
$charData['Waypoints'] = $data[633];
|
||||
$charData['NPCIntroductions'] = $data[714];
|
||||
|
||||
print_r($charData);
|
||||
|
||||
// $charData['Unknown'] = $data['44'];
|
||||
// $charData['Unknown'] = $data['52'];
|
||||
// $charData['Unknown'] = $data['175'];
|
||||
// $charData['Unknown'] = $data['191'];
|
||||
|
||||
|
||||
|
BIN
bin/d2scs.exe
BIN
bin/d2scs.exe
Binary file not shown.
BIN
bin/d2sgcs.exe
Normal file
BIN
bin/d2sgcs.exe
Normal file
Binary file not shown.
BIN
bin/sqldiff.exe
Normal file
BIN
bin/sqldiff.exe
Normal file
Binary file not shown.
BIN
bin/sqlite3.exe
BIN
bin/sqlite3.exe
Binary file not shown.
BIN
bin/sqlite3_analyzer.exe
Normal file
BIN
bin/sqlite3_analyzer.exe
Normal file
Binary file not shown.
312
checksum.php
312
checksum.php
@ -1,314 +1,14 @@
|
||||
<?php
|
||||
|
||||
$xorTableHex = [
|
||||
"00" => 0x0,
|
||||
"01" => 0x77073096,
|
||||
"02" => 0xEE0E612C,
|
||||
"03" => 0x990951BA,
|
||||
"04" => 0x076DC419,
|
||||
"05" => 0x706AF48F,
|
||||
"06" => 0xE963A535,
|
||||
"07" => 0x9E6495A3,
|
||||
"08" => 0x0EDB8832,
|
||||
"09" => 0x79DCB8A4,
|
||||
"0A" => 0xE0D5E91E,
|
||||
"0B" => 0x97D2D988,
|
||||
"0C" => 0x09B64C2B,
|
||||
"0D" => 0x7EB17CBD,
|
||||
"0E" => 0xE7B82D07,
|
||||
"0F" => 0x90BF1D91,
|
||||
"10" => 0x1DB71064,
|
||||
"11" => 0x6AB020F2,
|
||||
"12" => 0xF3B97148,
|
||||
"13" => 0x84BE41DE,
|
||||
"14" => 0x1ADAD47D,
|
||||
"15" => 0x6DDDE4EB,
|
||||
"16" => 0xF4D4B551,
|
||||
"17" => 0x83D385C7,
|
||||
"18" => 0x136C9856,
|
||||
"19" => 0x646BA8C0,
|
||||
"1A" => 0xFD62F97A,
|
||||
"1B" => 0x8A65C9EC,
|
||||
"1C" => 0x14015C4F,
|
||||
"1D" => 0x63066CD9,
|
||||
"1E" => 0xFA0F3D63,
|
||||
"1F" => 0x8D080DF5,
|
||||
"20" => 0x3B6E20C8,
|
||||
"21" => 0x4C69105E,
|
||||
"22" => 0xD56041E4,
|
||||
"23" => 0xA2677172,
|
||||
"24" => 0x3C03E4D1,
|
||||
"25" => 0x4B04D447,
|
||||
"26" => 0xD20D85FD,
|
||||
"27" => 0xA50AB56B,
|
||||
"28" => 0x35B5A8FA,
|
||||
"29" => 0x42B2986C,
|
||||
"2A" => 0xDBBBC9D6,
|
||||
"2B" => 0xACBCF940,
|
||||
"2C" => 0x32D86CE3,
|
||||
"2D" => 0x45DF5C75,
|
||||
"2E" => 0xDCD60DCF,
|
||||
"2F" => 0xABD13D59,
|
||||
"30" => 0x26D930AC,
|
||||
"31" => 0x51DE003A,
|
||||
"32" => 0xC8D75180,
|
||||
"33" => 0xBFD06116,
|
||||
"34" => 0x21B4F4B5,
|
||||
"35" => 0x56B3C423,
|
||||
"36" => 0xCFBA9599,
|
||||
"37" => 0xB8BDA50F,
|
||||
"38" => 0x2802B89E,
|
||||
"39" => 0x5F058808,
|
||||
"3A" => 0xC60CD9B2,
|
||||
"3B" => 0xB10BE924,
|
||||
"3C" => 0x2F6F7C87,
|
||||
"3D" => 0x58684C11,
|
||||
"3E" => 0xC1611DAB,
|
||||
"3F" => 0xB6662D3D,
|
||||
"40" => 0x76DC4190,
|
||||
"41" => 0x01DB7106,
|
||||
"42" => 0x98D220BC,
|
||||
"43" => 0xEFD5102A,
|
||||
"44" => 0x71B18589,
|
||||
"45" => 0x06B6B51F,
|
||||
"46" => 0x9FBFE4A5,
|
||||
"47" => 0xE8B8D433,
|
||||
"48" => 0x7807C9A2,
|
||||
"49" => 0x0F00F934,
|
||||
"4A" => 0x9609A88E,
|
||||
"4B" => 0xE10E9818,
|
||||
"4C" => 0x7F6A0DBB,
|
||||
"4D" => 0x086D3D2D,
|
||||
"4E" => 0x91646C97,
|
||||
"4F" => 0xE6635C01,
|
||||
"50" => 0x6B6B51F4,
|
||||
"51" => 0x1C6C6162,
|
||||
"52" => 0x856530D8,
|
||||
"53" => 0xF262004E,
|
||||
"54" => 0x6C0695ED,
|
||||
"55" => 0x1B01A57B,
|
||||
"56" => 0x8208F4C1,
|
||||
"57" => 0xF50FC457,
|
||||
"58" => 0x65B0D9C6,
|
||||
"59" => 0x12B7E950,
|
||||
"5A" => 0x8BBEB8EA,
|
||||
"5B" => 0xFCB9887C,
|
||||
"5C" => 0x62DD1DDF,
|
||||
"5D" => 0x15DA2D49,
|
||||
"5E" => 0x8CD37CF3,
|
||||
"5F" => 0xFBD44C65,
|
||||
"60" => 0x4DB26158,
|
||||
"61" => 0x3AB551CE,
|
||||
"62" => 0xA3BC0074,
|
||||
"63" => 0xD4BB30E2,
|
||||
"64" => 0x4ADFA541,
|
||||
"65" => 0x3DD895D7,
|
||||
"66" => 0xA4D1C46D,
|
||||
"67" => 0xD3D6F4FB,
|
||||
"68" => 0x4369E96A,
|
||||
"69" => 0x346ED9FC,
|
||||
"6A" => 0xAD678846,
|
||||
"6B" => 0xDA60B8D0,
|
||||
"6C" => 0x44042D73,
|
||||
"6D" => 0x33031DE5,
|
||||
"6E" => 0xAA0A4C5F,
|
||||
"6F" => 0xDD0D7CC9,
|
||||
"70" => 0x5005713C,
|
||||
"71" => 0x270241AA,
|
||||
"72" => 0xBE0B1010,
|
||||
"73" => 0xC90C2086,
|
||||
"74" => 0x5768B525,
|
||||
"75" => 0x206F85B3,
|
||||
"76" => 0xB966D409,
|
||||
"77" => 0xCE61E49F,
|
||||
"78" => 0x5EDEF90E,
|
||||
"79" => 0x29D9C998,
|
||||
"7A" => 0xB0D09822,
|
||||
"7B" => 0xC7D7A8B4,
|
||||
"7C" => 0x59B33D17,
|
||||
"7D" => 0x2EB40D81,
|
||||
"7E" => 0xB7BD5C3B,
|
||||
"7F" => 0xC0BA6CAD,
|
||||
"80" => 0xEDB88320,
|
||||
"81" => 0x9ABFB3B6,
|
||||
"82" => 0x03B6E20C,
|
||||
"83" => 0x74B1D29A,
|
||||
"84" => 0xEAD54739,
|
||||
"85" => 0x9DD277AF,
|
||||
"86" => 0x04DB2615,
|
||||
"87" => 0x73DC1683,
|
||||
"88" => 0xE3630B12,
|
||||
"89" => 0x94643B84,
|
||||
"8A" => 0x0D6D6A3E,
|
||||
"8B" => 0x7A6A5AA8,
|
||||
"8C" => 0xE40ECF0B,
|
||||
"8D" => 0x9309FF9D,
|
||||
"8E" => 0x0A00AE27,
|
||||
"8F" => 0x7D079EB1,
|
||||
"90" => 0xF00F9344,
|
||||
"91" => 0x8708A3D2,
|
||||
"92" => 0x1E01F268,
|
||||
"93" => 0x6906C2FE,
|
||||
"94" => 0xF762575D,
|
||||
"95" => 0x806567CB,
|
||||
"96" => 0x196C3671,
|
||||
"97" => 0x6E6B06E7,
|
||||
"98" => 0xFED41B76,
|
||||
"99" => 0x89D32BE0,
|
||||
"9A" => 0x10DA7A5A,
|
||||
"9B" => 0x67DD4ACC,
|
||||
"9C" => 0xF9B9DF6F,
|
||||
"9D" => 0x8EBEEFF9,
|
||||
"9E" => 0x17B7BE43,
|
||||
"9F" => 0x60B08ED5,
|
||||
"A0" => 0xD6D6A3E8,
|
||||
"A1" => 0xA1D1937E,
|
||||
"A2" => 0x38D8C2C4,
|
||||
"A3" => 0x4FDFF252,
|
||||
"A4" => 0xD1BB67F1,
|
||||
"A5" => 0xA6BC5767,
|
||||
"A6" => 0x3FB506DD,
|
||||
"A7" => 0x48B2364B,
|
||||
"A8" => 0xD80D2BDA,
|
||||
"A9" => 0xAF0A1B4C,
|
||||
"AA" => 0x36034AF6,
|
||||
"AB" => 0x41047A60,
|
||||
"AC" => 0xDF60EFC3,
|
||||
"AD" => 0xA867DF55,
|
||||
"AE" => 0x316E8EEF,
|
||||
"AF" => 0x4669BE79,
|
||||
"B0" => 0xCB61B38C,
|
||||
"B1" => 0xBC66831A,
|
||||
"B2" => 0x256FD2A0,
|
||||
"B3" => 0x5268E236,
|
||||
"B4" => 0xCC0C7795,
|
||||
"B5" => 0xBB0B4703,
|
||||
"B6" => 0x220216B9,
|
||||
"B7" => 0x5505262F,
|
||||
"B8" => 0xC5BA3BBE,
|
||||
"B9" => 0xB2BD0B28,
|
||||
"BA" => 0x2BB45A92,
|
||||
"BB" => 0x5CB36A04,
|
||||
"BC" => 0xC2D7FFA7,
|
||||
"BD" => 0xB5D0CF31,
|
||||
"BE" => 0x2CD99E8B,
|
||||
"BF" => 0x5BDEAE1D,
|
||||
"C0" => 0x9B64C2B0,
|
||||
"C1" => 0xEC63F226,
|
||||
"C2" => 0x756AA39C,
|
||||
"C3" => 0x026D930A,
|
||||
"C4" => 0x9C0906A9,
|
||||
"C5" => 0xEB0E363F,
|
||||
"C6" => 0x72076785,
|
||||
"C7" => 0x05005713,
|
||||
"C8" => 0x95BF4A82,
|
||||
"C9" => 0xE2B87A14,
|
||||
"CA" => 0x7BB12BAE,
|
||||
"CB" => 0x0CB61B38,
|
||||
"CC" => 0x92D28E9B,
|
||||
"CD" => 0xE5D5BE0D,
|
||||
"CE" => 0x7CDCEFB7,
|
||||
"CF" => 0x0BDBDF21,
|
||||
"D0" => 0x86D3D2D4,
|
||||
"D1" => 0xF1D4E242,
|
||||
"D2" => 0x68DDB3F8,
|
||||
"D3" => 0x1FDA836E,
|
||||
"D4" => 0x81BE16CD,
|
||||
"D5" => 0xF6B9265B,
|
||||
"D6" => 0x6FB077E1,
|
||||
"D7" => 0x18B74777,
|
||||
"D8" => 0x88085AE6,
|
||||
"D9" => 0xFF0F6A70,
|
||||
"DA" => 0x66063BCA,
|
||||
"DB" => 0x11010B5C,
|
||||
"DC" => 0x8F659EFF,
|
||||
"DD" => 0xF862AE69,
|
||||
"DE" => 0x616BFFD3,
|
||||
"DF" => 0x166CCF45,
|
||||
"E0" => 0xA00AE278,
|
||||
"E1" => 0xD70DD2EE,
|
||||
"E2" => 0x4E048354,
|
||||
"E3" => 0x3903B3C2,
|
||||
"E4" => 0xA7672661,
|
||||
"E5" => 0xD06016F7,
|
||||
"E6" => 0x4969474D,
|
||||
"E7" => 0x3E6E77DB,
|
||||
"E8" => 0xAED16A4A,
|
||||
"E9" => 0xD9D65ADC,
|
||||
"EA" => 0x40DF0B66,
|
||||
"EB" => 0x37D83BF0,
|
||||
"EC" => 0xA9BCAE53,
|
||||
"ED" => 0xDEBB9EC5,
|
||||
"EE" => 0x47B2CF7F,
|
||||
"EF" => 0x30B5FFE9,
|
||||
"F0" => 0xBDBDF21C,
|
||||
"F1" => 0xCABAC28A,
|
||||
"F2" => 0x53B39330,
|
||||
"F3" => 0x24B4A3A6,
|
||||
"F4" => 0xBAD03605,
|
||||
"F5" => 0xCDD70693,
|
||||
"F6" => 0x54DE5729,
|
||||
"F7" => 0x23D967BF,
|
||||
"F8" => 0xB3667A2E,
|
||||
"F9" => 0xC4614AB8,
|
||||
"FA" => 0x5D681B02,
|
||||
"FB" => 0x2A6F2B94,
|
||||
"FC" => 0xB40BBE37,
|
||||
"FD" => 0xC30C8EA1,
|
||||
"FE" => 0x5A05DF1B,
|
||||
"FF" => 0x2D02EF8D
|
||||
];
|
||||
|
||||
require_once './src/D2Functions.php';
|
||||
|
||||
$filename = "D:\Diablo II\MODS\ironman-dev\save\Sorc.d2s";
|
||||
$fp = fopen($filename, "rb+");
|
||||
$filesize = filesize($filename);
|
||||
$pucData = file_get_contents($filename);
|
||||
|
||||
ddump(unpack('C*', $pucData));
|
||||
|
||||
// pucData - pointer to the byte stream of the .d2s file
|
||||
// iSize - number of bytes in the stream ( filesize )
|
||||
function checksum($fp, $pucData, $iSize, $xorTableHex) {
|
||||
// delete old checksum at offset 0x0C - byte 12
|
||||
fseek($fp, 12);
|
||||
// (I) unsigned integer (machine dependent size and byte order)
|
||||
fwrite($fp, pack('I', 0)); // produces 4 bytes
|
||||
|
||||
$uVar = 0xFFFFFFFF;
|
||||
for($i=0;$i<$iSize;$i++) {
|
||||
// $hex = strtoupper(bin2hex($pucData[$i]));
|
||||
// getting correct bytes here, matches file in hex editor
|
||||
// dump((strtoupper(dechex($xorTableHex[$hex]))));
|
||||
|
||||
// uVar1 = uVar1 >> 8 ^ DWORD_ARRAY_6fd2a248[(uint)*param_1 ^ uVar1 & 0xff];
|
||||
// $xorTableHex = $xorTableHex = [
|
||||
// "00" => 0x0,
|
||||
// "01" => 0x77073096,
|
||||
// "02" => 0xEE0E612C] etc.
|
||||
|
||||
// uVar1 >> 8 ^ *(uint *)(&DAT_6fd2a248 + ((uint)*param_1 ^ uVar1 & 0xff) * 4);
|
||||
|
||||
$dec = hexdec(dechex(unpack('C', $pucData[$i])[1]));
|
||||
|
||||
$uVar = (($uVar << 1)|( $uVar >> 31)) + $dec;
|
||||
|
||||
// $uVar = $uVar >> 8 ^ ($xorTableHex[$hex] ^ ($uVar & 0xFF) * 4);
|
||||
// yeah, it was producing wrong val cuz I there is no * 4
|
||||
}
|
||||
|
||||
dump(swapEndianness(dechex($uVar)));
|
||||
|
||||
//fseek($fp, 12);
|
||||
//fwrite($fp, pack('I', $uiCS));
|
||||
}
|
||||
|
||||
//fseek($fp, 347);
|
||||
//fwrite($fp, pack('C', 0xFD));
|
||||
//fseek($fp, 348);
|
||||
//fwrite($fp, pack('C', 0x9F));
|
||||
|
||||
checksum($fp, $pucData, $filesize, $xorTableHex);
|
||||
|
||||
fseek($fp, 12);
|
||||
fwrite($fp, pack('I', 0)); // produces 4 bytes
|
||||
$fileData = unpack('C*', file_get_contents($filename));
|
||||
fseek($fp, 12);
|
||||
fwrite($fp, pack('H8', checksum($fileData)));
|
||||
dump(checksum($fileData));
|
||||
fclose($fp);
|
20
genDocs.php
20
genDocs.php
@ -267,9 +267,19 @@ EOT;
|
||||
// get all cube rows
|
||||
// changed enabled=1 to enabled > 0 for CubeOps.dll users
|
||||
|
||||
$sql = "SELECT * FROM cubemain WHERE enabled > 0";
|
||||
$sql = "
|
||||
SELECT *
|
||||
FROM cubemain
|
||||
WHERE enabled > 0
|
||||
AND `input 1` <> 'ib3'
|
||||
AND `description` NOT LIKE '%Stone x%'
|
||||
AND `description` NOT LIKE '%Unstacker%'
|
||||
";
|
||||
|
||||
$res = PDO_FetchAll($sql);
|
||||
|
||||
// ddump($res);
|
||||
|
||||
|
||||
// process each cube row here
|
||||
foreach ($res as $r) {
|
||||
@ -350,7 +360,8 @@ EOT;
|
||||
]
|
||||
);
|
||||
|
||||
// dump($output_codes);
|
||||
|
||||
// ddump($output_codes);
|
||||
foreach ($output_codes as $outputNum => $value) {
|
||||
|
||||
if (str_contains($value, ',')) {
|
||||
@ -483,7 +494,10 @@ EOT;
|
||||
|
||||
$output['mods'][$k]["str"] = $idesc->getDesc($params);
|
||||
}
|
||||
// var_dump($output);
|
||||
|
||||
// dump($output);
|
||||
|
||||
// var_dump($output);
|
||||
// At this point, $output contains raw accurte data
|
||||
// TODO: build output correctly
|
||||
// input1-input7,output a,b,c item codes can be found in $strings
|
||||
|
@ -484,6 +484,9 @@ $(document).ready(function () {
|
||||
|
||||
}
|
||||
|
||||
|
||||
$('.a-select, .w-select, .m-select').removeAttr('required');
|
||||
|
||||
|
||||
/*
|
||||
* THIS LINE BREAKS hidden fields and set them to blank.
|
||||
|
@ -41,9 +41,9 @@ $filePath = str_replace("\\", "\\\\", $filePath);
|
||||
$fp = fopen($filePath, "rb+");
|
||||
|
||||
// delete old checksum at offset 0x0C - byte 12
|
||||
fseek($fp, 12);
|
||||
//fseek($fp, 12);
|
||||
// (I) unsigned integer (machine dependent size and byte order)
|
||||
fwrite($fp, pack('I', 0)); // produces 4 bytes
|
||||
//fwrite($fp, pack('I', 0)); // produces 4 bytes
|
||||
|
||||
// edit quests which are checked, to Just finished FE FF
|
||||
foreach ($q as $k => $v) {
|
||||
@ -128,9 +128,9 @@ if ($p['wp_all'] == "1") {
|
||||
$checksum = (shell_exec("bin\d2scs.exe \"$filePath\""));
|
||||
|
||||
// write NEW checksum at offset 0x0C - byte 12
|
||||
fseek($fp, 12);
|
||||
//fseek($fp, 12);
|
||||
// (I) unsigned integer (machine dependent size and byte order)
|
||||
fwrite($fp, pack('H*', $checksum)); // produces 4 bytes
|
||||
//fwrite($fp, pack('H*', $checksum)); // produces 4 bytes
|
||||
|
||||
|
||||
fclose($fp);
|
||||
|
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
|
||||
|
||||
// uniqu eitem editor saver,, needs more work
|
||||
|
||||
error_reporting(E_ERROR | E_PARSE);
|
||||
set_time_limit(-1);
|
||||
ini_set('max_input_time', '-1');
|
||||
|
66
src/D2BitReader.php
Normal file
66
src/D2BitReader.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
class D2BitReader {
|
||||
|
||||
private string $bits;
|
||||
private int $offset = 0;
|
||||
|
||||
public function __construct(string $bits = '') {
|
||||
$this->bits = $bits;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function skip(int $numBits): int {
|
||||
$this->offset += $numBits;
|
||||
return $this->offset;
|
||||
}
|
||||
|
||||
/* read X number of bits, like fread */
|
||||
|
||||
public function read(int $numBits = 0, bool $str = true) {
|
||||
$bits = null;
|
||||
for ($i = $this->offset; $i < $this->offset + $numBits; $i++) {
|
||||
$str ? $bits .= $this->bits[$i] : $bits[] = $this->bits[$i];
|
||||
}
|
||||
$this->offset += $numBits;
|
||||
return $bits;
|
||||
}
|
||||
|
||||
/* seek to offset (like fseek) */
|
||||
|
||||
public function seek(int $pos): bool {
|
||||
if ($pos < 0 || $pos > strlen($this->bits)) {
|
||||
return false;
|
||||
}
|
||||
$this->offset = $pos;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* rewind offset to 0 */
|
||||
|
||||
public function rewind(): bool {
|
||||
$this->offset = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Get Bit */
|
||||
|
||||
public function getBit(string $bitNum): int {
|
||||
if ($bitNum < 0 || $bitNum > strlen($this->bits)) {
|
||||
|
||||
return false;
|
||||
}
|
||||
return ((int) $this->bits[$bitNum] ? 1 : 0 );
|
||||
}
|
||||
|
||||
/* Set Bit */
|
||||
|
||||
public function setBit(int $bitNum, int $bitVal): bool {
|
||||
if ($bitVal < 0 || $bitVal > 1) {
|
||||
return false;
|
||||
}
|
||||
$this->bits[$bitNum] = $bitVal;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -75,11 +75,75 @@ function strtobits(string $str): string {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function swapEndianness($hex) {
|
||||
function swapEndianness(string $hex) {
|
||||
return implode('', array_reverse(str_split($hex, 2)));
|
||||
}
|
||||
|
||||
|
||||
function modifyBit(int $n, int $p, bool $b){
|
||||
function setBit(int $n, int $p, bool $b){
|
||||
return ($b ? ($n | (1 << $p)) : ($n & ~(1 << $p)) );
|
||||
}
|
||||
|
||||
function getBit(int $b, int $p){
|
||||
return intval(($b & (1 << $p)) != 0);
|
||||
}
|
||||
|
||||
function checksum($fileData) {
|
||||
$nSignature = 0;
|
||||
foreach($fileData as $byte){
|
||||
$nSignature = ((($nSignature << 1) | ($nSignature >> 31)) + $byte) & 0xFFFFFFFF;
|
||||
}
|
||||
return swapEndianness(dechex($nSignature));
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the position of the Xth occurrence of a substring in a string
|
||||
* @param $haystack
|
||||
* @param $needle
|
||||
* @param $number integer > 0
|
||||
* @return int
|
||||
*/
|
||||
function strposX($haystack, $needle, $number) {
|
||||
if ($number == 1) {
|
||||
return strpos($haystack, $needle);
|
||||
} elseif ($number > 1) {
|
||||
return strpos($haystack, $needle, strposX($haystack, $needle, $number - 1) + strlen($needle));
|
||||
} else {
|
||||
return error_log('Error: Value for parameter $number is out of range');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function isBit(string $bit): int {
|
||||
return ((int) $bit ? 1 : 0 );
|
||||
}
|
||||
|
||||
function toBits($input): string {
|
||||
$output = '';
|
||||
if (is_string($input)){
|
||||
foreach(str_split($input) as $i){
|
||||
$output .= str_pad(decbin(ord($i)), 8, 0, STR_PAD_LEFT);
|
||||
}
|
||||
return $output;
|
||||
} else if (is_int($input)){
|
||||
return str_pad(decbin($input), 8, 0, STR_PAD_LEFT);
|
||||
} else if (is_array($input)){
|
||||
foreach ($input as $i) {
|
||||
$output .= tobits($i);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function print_mem()
|
||||
{
|
||||
/* Currently used memory */
|
||||
$mem_usage = memory_get_usage();
|
||||
|
||||
/* Peak memory usage */
|
||||
$mem_peak = memory_get_peak_usage();
|
||||
|
||||
echo 'The script is now using: <strong>' . round($mem_usage / 1024) . 'KB</strong> of memory.<br>';
|
||||
echo 'Peak usage: <strong>' . round($mem_peak / 1024) . 'KB</strong> of memory.<br><br>';
|
||||
}
|
105
src/D2Item.php
Normal file
105
src/D2Item.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
require_once 'D2BitReader.php';
|
||||
|
||||
class D2Item {
|
||||
|
||||
private string $_bits;
|
||||
public $basename = ''; //name of the base item
|
||||
public $item_name = ''; //name string
|
||||
public $item_rank = ''; //normal/exceptional/elite
|
||||
public $item_type = ''; //basic type: armor/weapon/misc
|
||||
//flags
|
||||
public $identified = 0;
|
||||
public $sockets = 0;
|
||||
public $ear = 0;
|
||||
public $starter = 0;
|
||||
public $compact = 0;
|
||||
public $ethereal;
|
||||
public $personalized;
|
||||
public $runeword;
|
||||
public $version;
|
||||
public $runeword_name = '';
|
||||
public $runes_title = '';
|
||||
//placement
|
||||
public $location = 0;
|
||||
public $body = 0;
|
||||
public $col = 0;
|
||||
public $row = 0;
|
||||
public $container = 0;
|
||||
public $parent;
|
||||
public $storage;
|
||||
public $bodypart;
|
||||
public $invH = 0;
|
||||
public $invW = 0;
|
||||
public $beltrows = 1;
|
||||
//features
|
||||
public $item_code = ''; //3 letter code from txt
|
||||
public $SocketsFilled = 0;
|
||||
public $SocketsNum = 0;
|
||||
public $socketable = false; //gem, rune, jewel
|
||||
public $fingerprint = '';
|
||||
public $itemlvl = 0; //item level
|
||||
public $quality = 0;
|
||||
public $isCharm = false;
|
||||
public $isJewel = false;
|
||||
public $magic_rank = 'Normal'; //normal/magic/rare/crafted/set/unique
|
||||
public $set_id = 0; //set item id from txt
|
||||
public $set_item = '';
|
||||
public $set_name = 0; //set name, if it is set item,
|
||||
public $personname = '';
|
||||
public $questdif = -1;
|
||||
public $gold;
|
||||
public $GUID = '';
|
||||
public $defense = 0;
|
||||
public $mindam = 0;
|
||||
public $maxdam = 0;
|
||||
public $mindam2 = 0;
|
||||
public $maxdam2 = 0;
|
||||
public $mindammi = 0;
|
||||
public $maxdammi = 0;
|
||||
public $MaxDur = 0;
|
||||
public $CurDur = 0;
|
||||
public $reqlvl = 0;
|
||||
public $reqstr = 0;
|
||||
public $reqdex = 0;
|
||||
public $speed = 0;
|
||||
public $throwing = 0;
|
||||
public $stackable = 0;
|
||||
public $charName = ''; //ear's name
|
||||
public $gfx; //graphic file name
|
||||
public $baseTrans = -1; //transform indexes for colour remap base item
|
||||
public $magicTrans = -1; //transform indexes for colour remap magic item
|
||||
public $type; //type column from txt
|
||||
public $spelldesc = ''; //desc for potions
|
||||
public $ditem; //link to item properties from txt
|
||||
//mods
|
||||
public $dammult = 100; //damage multiply
|
||||
public $damminadd = 0; //damage add
|
||||
public $dammaxadd = 0; //damage add
|
||||
public $defmult = 100; //defense multiply
|
||||
public $defadd = 0; //defense multiply
|
||||
public $resist = array(0, 0, 0, 0, 0, 0); //phy, mag, fire, light, cold, poison
|
||||
public $attributes = array(0, 0, 0, 0); //str, dex, vit, ene
|
||||
|
||||
//arrays
|
||||
|
||||
//socketed items, collected in above function,
|
||||
//because item has only data for itselt, and
|
||||
//gems/runes/jewels are standalone
|
||||
public $SocketItems = array();
|
||||
public $properties = array(); //item variable properties
|
||||
public $propids = array(); //properties ids list
|
||||
|
||||
|
||||
public function __construct(string $bits){
|
||||
if ($bit == '') return false;
|
||||
$this->bits = $bits;
|
||||
|
||||
$this->parseItem();
|
||||
}
|
||||
|
||||
public function parseItem(){}
|
||||
|
||||
|
||||
}
|
@ -814,6 +814,28 @@ class D2ItemData {
|
||||
"min" => $return['min' . $counter],
|
||||
"max" => $return['max' . $counter],
|
||||
];
|
||||
} else if ($v['prop1'] == 'sock' ||
|
||||
$v['prop2'] == 'sock' ||
|
||||
$v['prop3'] == 'sock' ||
|
||||
$v['prop4'] == 'sock' ||
|
||||
$v['prop5'] == 'sock' ||
|
||||
$v['prop6'] == 'sock' ||
|
||||
$v['prop7'] == 'sock') {
|
||||
$params = [
|
||||
'string1' => "Sockets",
|
||||
'string2' => "",
|
||||
'gstring1' => "",
|
||||
'gstring2' => "",
|
||||
'descfunc' => "9",
|
||||
'descval' => "1",
|
||||
'dgrp' => "",
|
||||
'dgrpfunc' => "",
|
||||
'dgrpval' => "",
|
||||
"prop" => $return['prop' . $counter],
|
||||
"par" => $return['par' . $counter],
|
||||
"min" => $return['min' . $counter],
|
||||
"max" => $return['max' . $counter],
|
||||
];
|
||||
} else {
|
||||
$params = [
|
||||
'string1' => $v['desc']['string1'],
|
||||
|
@ -297,268 +297,7 @@ class D2SaveFileStructureData {
|
||||
public $_qNM;
|
||||
public $_qHell;
|
||||
|
||||
public $xorTable = [
|
||||
"00" => 0x0,
|
||||
"01" => 0x77073096,
|
||||
"02" => 0xEE0E612C,
|
||||
"03" => 0x990951BA,
|
||||
"04" => 0x076DC419,
|
||||
"05" => 0x706AF48F,
|
||||
"06" => 0xE963A535,
|
||||
"07" => 0x9E6495A3,
|
||||
"08" => 0x0EDB8832,
|
||||
"09" => 0x79DCB8A4,
|
||||
"0A" => 0xE0D5E91E,
|
||||
"0B" => 0x97D2D988,
|
||||
"0C" => 0x09B64C2B,
|
||||
"0D" => 0x7EB17CBD,
|
||||
"0E" => 0xE7B82D07,
|
||||
"0F" => 0x90BF1D91,
|
||||
"10" => 0x1DB71064,
|
||||
"11" => 0x6AB020F2,
|
||||
"12" => 0xF3B97148,
|
||||
"13" => 0x84BE41DE,
|
||||
"14" => 0x1ADAD47D,
|
||||
"15" => 0x6DDDE4EB,
|
||||
"16" => 0xF4D4B551,
|
||||
"17" => 0x83D385C7,
|
||||
"18" => 0x136C9856,
|
||||
"19" => 0x646BA8C0,
|
||||
"1A" => 0xFD62F97A,
|
||||
"1B" => 0x8A65C9EC,
|
||||
"1C" => 0x14015C4F,
|
||||
"1D" => 0x63066CD9,
|
||||
"1E" => 0xFA0F3D63,
|
||||
"1F" => 0x8D080DF5,
|
||||
"20" => 0x3B6E20C8,
|
||||
"21" => 0x4C69105E,
|
||||
"22" => 0xD56041E4,
|
||||
"23" => 0xA2677172,
|
||||
"24" => 0x3C03E4D1,
|
||||
"25" => 0x4B04D447,
|
||||
"26" => 0xD20D85FD,
|
||||
"27" => 0xA50AB56B,
|
||||
"28" => 0x35B5A8FA,
|
||||
"29" => 0x42B2986C,
|
||||
"2A" => 0xDBBBC9D6,
|
||||
"2B" => 0xACBCF940,
|
||||
"2C" => 0x32D86CE3,
|
||||
"2D" => 0x45DF5C75,
|
||||
"2E" => 0xDCD60DCF,
|
||||
"2F" => 0xABD13D59,
|
||||
"30" => 0x26D930AC,
|
||||
"31" => 0x51DE003A,
|
||||
"32" => 0xC8D75180,
|
||||
"33" => 0xBFD06116,
|
||||
"34" => 0x21B4F4B5,
|
||||
"35" => 0x56B3C423,
|
||||
"36" => 0xCFBA9599,
|
||||
"37" => 0xB8BDA50F,
|
||||
"38" => 0x2802B89E,
|
||||
"39" => 0x5F058808,
|
||||
"3A" => 0xC60CD9B2,
|
||||
"3B" => 0xB10BE924,
|
||||
"3C" => 0x2F6F7C87,
|
||||
"3D" => 0x58684C11,
|
||||
"3E" => 0xC1611DAB,
|
||||
"3F" => 0xB6662D3D,
|
||||
"40" => 0x76DC4190,
|
||||
"41" => 0x01DB7106,
|
||||
"42" => 0x98D220BC,
|
||||
"43" => 0xEFD5102A,
|
||||
"44" => 0x71B18589,
|
||||
"45" => 0x06B6B51F,
|
||||
"46" => 0x9FBFE4A5,
|
||||
"47" => 0xE8B8D433,
|
||||
"48" => 0x7807C9A2,
|
||||
"49" => 0x0F00F934,
|
||||
"4A" => 0x9609A88E,
|
||||
"4B" => 0xE10E9818,
|
||||
"4C" => 0x7F6A0DBB,
|
||||
"4D" => 0x086D3D2D,
|
||||
"4E" => 0x91646C97,
|
||||
"4F" => 0xE6635C01,
|
||||
"50" => 0x6B6B51F4,
|
||||
"51" => 0x1C6C6162,
|
||||
"52" => 0x856530D8,
|
||||
"53" => 0xF262004E,
|
||||
"54" => 0x6C0695ED,
|
||||
"55" => 0x1B01A57B,
|
||||
"56" => 0x8208F4C1,
|
||||
"57" => 0xF50FC457,
|
||||
"58" => 0x65B0D9C6,
|
||||
"59" => 0x12B7E950,
|
||||
"5A" => 0x8BBEB8EA,
|
||||
"5B" => 0xFCB9887C,
|
||||
"5C" => 0x62DD1DDF,
|
||||
"5D" => 0x15DA2D49,
|
||||
"5E" => 0x8CD37CF3,
|
||||
"5F" => 0xFBD44C65,
|
||||
"60" => 0x4DB26158,
|
||||
"61" => 0x3AB551CE,
|
||||
"62" => 0xA3BC0074,
|
||||
"63" => 0xD4BB30E2,
|
||||
"64" => 0x4ADFA541,
|
||||
"65" => 0x3DD895D7,
|
||||
"66" => 0xA4D1C46D,
|
||||
"67" => 0xD3D6F4FB,
|
||||
"68" => 0x4369E96A,
|
||||
"69" => 0x346ED9FC,
|
||||
"6A" => 0xAD678846,
|
||||
"6B" => 0xDA60B8D0,
|
||||
"6C" => 0x44042D73,
|
||||
"6D" => 0x33031DE5,
|
||||
"6E" => 0xAA0A4C5F,
|
||||
"6F" => 0xDD0D7CC9,
|
||||
"70" => 0x5005713C,
|
||||
"71" => 0x270241AA,
|
||||
"72" => 0xBE0B1010,
|
||||
"73" => 0xC90C2086,
|
||||
"74" => 0x5768B525,
|
||||
"75" => 0x206F85B3,
|
||||
"76" => 0xB966D409,
|
||||
"77" => 0xCE61E49F,
|
||||
"78" => 0x5EDEF90E,
|
||||
"79" => 0x29D9C998,
|
||||
"7A" => 0xB0D09822,
|
||||
"7B" => 0xC7D7A8B4,
|
||||
"7C" => 0x59B33D17,
|
||||
"7D" => 0x2EB40D81,
|
||||
"7E" => 0xB7BD5C3B,
|
||||
"7F" => 0xC0BA6CAD,
|
||||
"80" => 0xEDB88320,
|
||||
"81" => 0x9ABFB3B6,
|
||||
"82" => 0x03B6E20C,
|
||||
"83" => 0x74B1D29A,
|
||||
"84" => 0xEAD54739,
|
||||
"85" => 0x9DD277AF,
|
||||
"86" => 0x04DB2615,
|
||||
"87" => 0x73DC1683,
|
||||
"88" => 0xE3630B12,
|
||||
"89" => 0x94643B84,
|
||||
"8A" => 0x0D6D6A3E,
|
||||
"8B" => 0x7A6A5AA8,
|
||||
"8C" => 0xE40ECF0B,
|
||||
"8D" => 0x9309FF9D,
|
||||
"8E" => 0x0A00AE27,
|
||||
"8F" => 0x7D079EB1,
|
||||
"90" => 0xF00F9344,
|
||||
"91" => 0x8708A3D2,
|
||||
"92" => 0x1E01F268,
|
||||
"93" => 0x6906C2FE,
|
||||
"94" => 0xF762575D,
|
||||
"95" => 0x806567CB,
|
||||
"96" => 0x196C3671,
|
||||
"97" => 0x6E6B06E7,
|
||||
"98" => 0xFED41B76,
|
||||
"99" => 0x89D32BE0,
|
||||
"9A" => 0x10DA7A5A,
|
||||
"9B" => 0x67DD4ACC,
|
||||
"9C" => 0xF9B9DF6F,
|
||||
"9D" => 0x8EBEEFF9,
|
||||
"9E" => 0x17B7BE43,
|
||||
"9F" => 0x60B08ED5,
|
||||
"A0" => 0xD6D6A3E8,
|
||||
"A1" => 0xA1D1937E,
|
||||
"A2" => 0x38D8C2C4,
|
||||
"A3" => 0x4FDFF252,
|
||||
"A4" => 0xD1BB67F1,
|
||||
"A5" => 0xA6BC5767,
|
||||
"A6" => 0x3FB506DD,
|
||||
"A7" => 0x48B2364B,
|
||||
"A8" => 0xD80D2BDA,
|
||||
"A9" => 0xAF0A1B4C,
|
||||
"AA" => 0x36034AF6,
|
||||
"AB" => 0x41047A60,
|
||||
"AC" => 0xDF60EFC3,
|
||||
"AD" => 0xA867DF55,
|
||||
"AE" => 0x316E8EEF,
|
||||
"AF" => 0x4669BE79,
|
||||
"B0" => 0xCB61B38C,
|
||||
"B1" => 0xBC66831A,
|
||||
"B2" => 0x256FD2A0,
|
||||
"B3" => 0x5268E236,
|
||||
"B4" => 0xCC0C7795,
|
||||
"B5" => 0xBB0B4703,
|
||||
"B6" => 0x220216B9,
|
||||
"B7" => 0x5505262F,
|
||||
"B8" => 0xC5BA3BBE,
|
||||
"B9" => 0xB2BD0B28,
|
||||
"BA" => 0x2BB45A92,
|
||||
"BB" => 0x5CB36A04,
|
||||
"BC" => 0xC2D7FFA7,
|
||||
"BD" => 0xB5D0CF31,
|
||||
"BE" => 0x2CD99E8B,
|
||||
"BF" => 0x5BDEAE1D,
|
||||
"C0" => 0x9B64C2B0,
|
||||
"C1" => 0xEC63F226,
|
||||
"C2" => 0x756AA39C,
|
||||
"C3" => 0x026D930A,
|
||||
"C4" => 0x9C0906A9,
|
||||
"C5" => 0xEB0E363F,
|
||||
"C6" => 0x72076785,
|
||||
"C7" => 0x05005713,
|
||||
"C8" => 0x95BF4A82,
|
||||
"C9" => 0xE2B87A14,
|
||||
"CA" => 0x7BB12BAE,
|
||||
"CB" => 0x0CB61B38,
|
||||
"CC" => 0x92D28E9B,
|
||||
"CD" => 0xE5D5BE0D,
|
||||
"CE" => 0x7CDCEFB7,
|
||||
"CF" => 0x0BDBDF21,
|
||||
"D0" => 0x86D3D2D4,
|
||||
"D1" => 0xF1D4E242,
|
||||
"D2" => 0x68DDB3F8,
|
||||
"D3" => 0x1FDA836E,
|
||||
"D4" => 0x81BE16CD,
|
||||
"D5" => 0xF6B9265B,
|
||||
"D6" => 0x6FB077E1,
|
||||
"D7" => 0x18B74777,
|
||||
"D8" => 0x88085AE6,
|
||||
"D9" => 0xFF0F6A70,
|
||||
"DA" => 0x66063BCA,
|
||||
"DB" => 0x11010B5C,
|
||||
"DC" => 0x8F659EFF,
|
||||
"DD" => 0xF862AE69,
|
||||
"DE" => 0x616BFFD3,
|
||||
"DF" => 0x166CCF45,
|
||||
"E0" => 0xA00AE278,
|
||||
"E1" => 0xD70DD2EE,
|
||||
"E2" => 0x4E048354,
|
||||
"E3" => 0x3903B3C2,
|
||||
"E4" => 0xA7672661,
|
||||
"E5" => 0xD06016F7,
|
||||
"E6" => 0x4969474D,
|
||||
"E7" => 0x3E6E77DB,
|
||||
"E8" => 0xAED16A4A,
|
||||
"E9" => 0xD9D65ADC,
|
||||
"EA" => 0x40DF0B66,
|
||||
"EB" => 0x37D83BF0,
|
||||
"EC" => 0xA9BCAE53,
|
||||
"ED" => 0xDEBB9EC5,
|
||||
"EE" => 0x47B2CF7F,
|
||||
"EF" => 0x30B5FFE9,
|
||||
"F0" => 0xBDBDF21C,
|
||||
"F1" => 0xCABAC28A,
|
||||
"F2" => 0x53B39330,
|
||||
"F3" => 0x24B4A3A6,
|
||||
"F4" => 0xBAD03605,
|
||||
"F5" => 0xCDD70693,
|
||||
"F6" => 0x54DE5729,
|
||||
"F7" => 0x23D967BF,
|
||||
"F8" => 0xB3667A2E,
|
||||
"F9" => 0xC4614AB8,
|
||||
"FA" => 0x5D681B02,
|
||||
"FB" => 0x2A6F2B94,
|
||||
"FC" => 0xB40BBE37,
|
||||
"FD" => 0xC30C8EA1,
|
||||
"FE" => 0x5A05DF1B,
|
||||
"FF" => 0x2D02EF8D
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Initialize Skills From Skills.txt
|
||||
*/
|
||||
|
@ -52,7 +52,7 @@
|
||||
<link rel="stylesheet" href="/res/font-awesome.min.css">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Lato:wght@300&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://bootswatch.com/4/sketchy/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://bootswatch.com/4/lumen/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/res/style.css">
|
||||
<link rel="stylesheet" href="/res/<?php echo $css ?>">
|
||||
<style>
|
||||
|
145
test.php
145
test.php
@ -1,45 +1,116 @@
|
||||
<?php
|
||||
// from unpack('H*', file_get_contents("Char.d2s")) for 3v4l.org to read d2s file here
|
||||
$data = hex2bin('55aa55aa60000000f1060000b5bc59b300000000536f72630000000000000000000000002400000001103863000000003cc7ae62ffffffffffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff0000ffff000000000000570300000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8000005e3e9b11000000008888d5f80100000035b70300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000576f6f21060000002a0101000190fd9ffe9ffd9ffe9ffd9f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000057530100000050000201ffffffff7f00000000000000000000000000000000000201ffffffff7f00000000000000000000000000000000000201ffffffff7f0000000000000000000000000000000000017734002e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000067660028083082000a06644000b10252067094c1018082800020292400480a0a0030c202008cc060dcc0f0ca3afa160a0000e03f696600000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000004a4d32004a4d100082006500069226160382af144fb080e03f4a4d1000820065000a9226260302791c00c480e03f4a4d10008000654415c076c606821c7ffff58080010a06fe034a4d1000800065008013268303827e82896086dccb000066c5bcfeffff014a4d1000820065000022f6860782b067b7ec80e03f4a4d1000820065001a922636038249b154da80a025040000c07f4a4d1000a0006500a442665363034a4d1000a0006500fe13367703024a4d1000a0006500de13362703024a4d1000a0006500be13361703024a4d1000a00065009e13360703024a4d1000a00065007e1336a707024a4d1000a00065005e13369707024a4d1000a00065003e1336f706024a4d1000a0006500c013e65606024a4d1000a00065006012d68607024a4d1000a00065000e12d60603024a4d1000a00065006412564306024a4d1000800065001e83179303029920441686e03f4a4d1000a0006500fe12d69606024a4d1000a0006500de12d68606024a4d1000a0006500be12d67606024a4d1000a00065009e12e67606024a4d1000a00065007e12e69606024a4d1000a0006500fc13e6a606024a4d1000a0006500dc13c68603024a4d1000a0006500bc13e6b606024a4d1000800065009c83272303826f9aed3186e03f4a4d1000800065007c8317730302acd0c26e86e03f4a4d1000a00065005c13560603024a4d1000a00065003c13569607024a4d1000a00065001c13464603024a4d1000a00065001212d66607024a4d1000a00865001412d66607024a4d1000a0006500fc1226f606024a4d1000a0006500dc12265607024a4d1000a0086500bc12265607024a4d1000a00865009c12265607024a4d1000a00865007c12265607024a4d1000a0086500fa13265607024a4d1000a0006500da43665363034a4d1000a0086500ba43665363034a4d1000a00065009a53468333064a4d10008000650016421616038245fc36c6822cff014a4d100080006500a032166707028c6e88690101000408052c30c0c00054e03f4a4d10008000650411c026c60602385900c78080010a08fe034a4d1000800065004632166707822c1b5e930001000498042c30c0c00054e03f4a4d1000800065007a8337130382a07c2a5786e03f4a4d1008800065000ec326c60602915c92ea8280010a07e23f4a4d100880046500b23237470612e9b107ed80104b83c140fc3776ece0f80f4a4d1000a00065180010365603024a4d00006a664a4d00006b6600');
|
||||
|
||||
error_reporting(E_ERROR | E_PARSE);
|
||||
set_time_limit(-1);
|
||||
ini_set('max_input_time', '-1');
|
||||
ini_set('max_execution_time', '0');
|
||||
session_start();
|
||||
ob_start();
|
||||
|
||||
require_once './testData.php';
|
||||
|
||||
require_once './config.php';
|
||||
require_once './_pdo.php';
|
||||
require_once "./src/D2Functions.php";
|
||||
require_once './src/D2ItemData.php';
|
||||
require_once './src/D2ItemDesc.php';
|
||||
require_once './src/D2DocGenerator.php';
|
||||
|
||||
define('DB_FILE', "ironman-dev.db");
|
||||
PDO_Connect("sqlite:" . DB_FILE);
|
||||
|
||||
$filename = "D:\Diablo II\MODS\ironman-dev\save\Test.d2s";
|
||||
$filename = str_replace("\\", "\\\\", $filename);
|
||||
$fp = fopen($filename, "rb+");
|
||||
|
||||
// delete old checksum at offset 0x0C - byte 12
|
||||
fseek($fp, 12);
|
||||
// (I) unsigned integer (machine dependent size and byte order)
|
||||
fwrite($fp, pack('I', 0)); // produces 4 bytes
|
||||
class D2ByteReader {
|
||||
private string $data;
|
||||
private int $offset = 0;
|
||||
|
||||
public function __construct(string $data){
|
||||
if (!$data) return false;
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function skip(int $numBytes): bool {
|
||||
if ($numBytes < 0 || $numBytes > strlen($this->data)) return false;
|
||||
$this->offset += $numBytes;
|
||||
return $true;
|
||||
|
||||
// edit quest test, den of evil
|
||||
fseek($fp, 347);
|
||||
fwrite($fp, pack('C', 0xFD));
|
||||
fseek($fp, 348);
|
||||
fwrite($fp, pack('C', 0x9F));
|
||||
}
|
||||
|
||||
public function seek(int $pos): bool {
|
||||
if ($pos < 0 || $pos > strlen($this->data)) return false;
|
||||
$this->offset = $pos;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function read(int $numBytes, bool $str = true){
|
||||
$bytes = null;
|
||||
for ($i = $this->offset; $i < $this->offset + $numBytes; $i++) {
|
||||
$str ? $bytes .= $this->data[$i] : $bytes[] = $this->data[$i];
|
||||
}
|
||||
return unpack('H*', $bytes);
|
||||
}
|
||||
|
||||
public function rewind() : bool {
|
||||
$this->offset = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function write8(int $offset, int $byte){
|
||||
$this->data[$offset] = pack('C', $byte);
|
||||
}
|
||||
|
||||
public function writeBytes(int $offset, string $bytes){
|
||||
if ($offset < 0 || $offset > strlen($this->data) || $bytes == '') return false;
|
||||
$_bytes = str_split($bytes, 2);
|
||||
foreach($_bytes as $k => $byte){
|
||||
$pos = $offset + $k;
|
||||
$this->data[$pos] = pack('H*', $byte);
|
||||
}
|
||||
}
|
||||
public function getData(){
|
||||
return $this->data ? $this->data : false;
|
||||
}
|
||||
public function getOffset(): int {
|
||||
return $this->offset;
|
||||
}
|
||||
|
||||
/*
|
||||
@return Byte with Nth bit set to X
|
||||
*/
|
||||
public function setBit(int $byte, int $pos, bool $bit){
|
||||
return ($bit ? ($byte | (1 << $pos)) : ($byte & ~(1 << $pos)) );
|
||||
}
|
||||
/*
|
||||
@return Bit at Nth position in Byte
|
||||
*/
|
||||
public function getBit(int $byte, int $pos) : int {
|
||||
return intval(($byte & (1 << $pos)) != 0);
|
||||
}
|
||||
}
|
||||
|
||||
$checksum = swapEndianness(shell_exec("bin\d2scs.exe \"$filename\""));
|
||||
$c = new D2ByteReader($data);
|
||||
$c->seek(12);
|
||||
$checksum = $c->read(4);
|
||||
var_dump($checksum);
|
||||
$c->write8(12, 0xFF);
|
||||
$checksum = $c->read(4);
|
||||
var_dump($checksum);
|
||||
$c->writeBytes(12, "FFC0FDA1"); // invalid checksum, but just testing write. Works!
|
||||
$checksum = $c->read(4);
|
||||
var_dump($checksum);
|
||||
$c->writeBytes(12, "b5bc59b3"); // Valid checksum, but just testing write. Works!
|
||||
$checksum = $c->read(4);
|
||||
var_dump($checksum);
|
||||
|
||||
// write NEW checksum at offset 0x0C - byte 12
|
||||
fseek($fp, 12);
|
||||
// (I) unsigned integer (machine dependent size and byte order)
|
||||
fwrite($fp, pack('H*', $checksum)); // produces 4 bytes
|
||||
/*
|
||||
|
||||
Barely any binary functions, all string manipulation on binary files. Working!
|
||||
|
||||
fclose($fp);
|
||||
To just modify bits in an aligned byte, use setBit();
|
||||
To just get which bit is set in a byte, use getBit();
|
||||
|
||||
To read X arbitary unaligned bits in bytes,
|
||||
|
||||
Seek to offset,
|
||||
Read X bytes,
|
||||
Convert X bytes to bits,
|
||||
Reverse bit order in each byte
|
||||
Load D2BitReader,
|
||||
Modify nth Bit,
|
||||
Return all bits
|
||||
Convert to bytes
|
||||
Reverse bit order in byte
|
||||
Save bytes
|
||||
|
||||
function setBit(int $n, int $p, bool $b){
|
||||
return ($b ? ($n | (1 << $p)) : ($n & ~(1 << $p)) );
|
||||
}
|
||||
|
||||
function getBit(int $b, int $p){
|
||||
return intval(($b & (1 << $p)) != 0);
|
||||
}
|
||||
|
||||
*/
|
519
testData.php
519
testData.php
@ -1,519 +0,0 @@
|
||||
<?php
|
||||
|
||||
$xorTableDec = [
|
||||
1 => 0x0,
|
||||
2 => 0x77073096,
|
||||
3 => 0xEE0E612C,
|
||||
4 => 0x990951BA,
|
||||
5 => 0x076DC419,
|
||||
6 => 0x706AF48F,
|
||||
7 => 0xE963A535,
|
||||
8 => 0x9E6495A3,
|
||||
9 => 0x0EDB8832,
|
||||
10 => 0x79DCB8A4,
|
||||
11 => 0xE0D5E91E,
|
||||
12 => 0x97D2D988,
|
||||
13 => 0x09B64C2B,
|
||||
14 => 0x7EB17CBD,
|
||||
15 => 0xE7B82D07,
|
||||
16 => 0x90BF1D91,
|
||||
17 => 0x1DB71064,
|
||||
18 => 0x6AB020F2,
|
||||
19 => 0xF3B97148,
|
||||
20 => 0x84BE41DE,
|
||||
21 => 0x1ADAD47D,
|
||||
22 => 0x6DDDE4EB,
|
||||
23 => 0xF4D4B551,
|
||||
24 => 0x83D385C7,
|
||||
25 => 0x136C9856,
|
||||
26 => 0x646BA8C0,
|
||||
27 => 0xFD62F97A,
|
||||
28 => 0x8A65C9EC,
|
||||
29 => 0x14015C4F,
|
||||
30 => 0x63066CD9,
|
||||
31 => 0xFA0F3D63,
|
||||
32 => 0x8D080DF5,
|
||||
33 => 0x3B6E20C8,
|
||||
34 => 0x4C69105E,
|
||||
35 => 0xD56041E4,
|
||||
36 => 0xA2677172,
|
||||
37 => 0x3C03E4D1,
|
||||
38 => 0x4B04D447,
|
||||
39 => 0xD20D85FD,
|
||||
40 => 0xA50AB56B,
|
||||
41 => 0x35B5A8FA,
|
||||
42 => 0x42B2986C,
|
||||
43 => 0xDBBBC9D6,
|
||||
44 => 0xACBCF940,
|
||||
45 => 0x32D86CE3,
|
||||
46 => 0x45DF5C75,
|
||||
47 => 0xDCD60DCF,
|
||||
48 => 0xABD13D59,
|
||||
49 => 0x26D930AC,
|
||||
50 => 0x51DE003A,
|
||||
51 => 0xC8D75180,
|
||||
52 => 0xBFD06116,
|
||||
53 => 0x21B4F4B5,
|
||||
54 => 0x56B3C423,
|
||||
55 => 0xCFBA9599,
|
||||
56 => 0xB8BDA50F,
|
||||
57 => 0x2802B89E,
|
||||
58 => 0x5F058808,
|
||||
59 => 0xC60CD9B2,
|
||||
60 => 0xB10BE924,
|
||||
61 => 0x2F6F7C87,
|
||||
62 => 0x58684C11,
|
||||
63 => 0xC1611DAB,
|
||||
64 => 0xB6662D3D,
|
||||
65 => 0x76DC4190,
|
||||
66 => 0x01DB7106,
|
||||
67 => 0x98D220BC,
|
||||
68 => 0xEFD5102A,
|
||||
69 => 0x71B18589,
|
||||
70 => 0x06B6B51F,
|
||||
71 => 0x9FBFE4A5,
|
||||
72 => 0xE8B8D433,
|
||||
73 => 0x7807C9A2,
|
||||
74 => 0x0F00F934,
|
||||
75 => 0x9609A88E,
|
||||
76 => 0xE10E9818,
|
||||
77 => 0x7F6A0DBB,
|
||||
78 => 0x086D3D2D,
|
||||
79 => 0x91646C97,
|
||||
80 => 0xE6635C01,
|
||||
81 => 0x6B6B51F4,
|
||||
82 => 0x1C6C6162,
|
||||
83 => 0x856530D8,
|
||||
84 => 0xF262004E,
|
||||
85 => 0x6C0695ED,
|
||||
86 => 0x1B01A57B,
|
||||
87 => 0x8208F4C1,
|
||||
88 => 0xF50FC457,
|
||||
89 => 0x65B0D9C6,
|
||||
90 => 0x12B7E950,
|
||||
91 => 0x8BBEB8EA,
|
||||
92 => 0xFCB9887C,
|
||||
93 => 0x62DD1DDF,
|
||||
94 => 0x15DA2D49,
|
||||
95 => 0x8CD37CF3,
|
||||
96 => 0xFBD44C65,
|
||||
97 => 0x4DB26158,
|
||||
98 => 0x3AB551CE,
|
||||
99 => 0xA3BC0074,
|
||||
100 => 0xD4BB30E2,
|
||||
101 => 0x4ADFA541,
|
||||
102 => 0x3DD895D7,
|
||||
103 => 0xA4D1C46D,
|
||||
104 => 0xD3D6F4FB,
|
||||
105 => 0x4369E96A,
|
||||
106 => 0x346ED9FC,
|
||||
107 => 0xAD678846,
|
||||
108 => 0xDA60B8D0,
|
||||
109 => 0x44042D73,
|
||||
110 => 0x33031DE5,
|
||||
111 => 0xAA0A4C5F,
|
||||
112 => 0xDD0D7CC9,
|
||||
113 => 0x5005713C,
|
||||
114 => 0x270241AA,
|
||||
115 => 0xBE0B1010,
|
||||
116 => 0xC90C2086,
|
||||
117 => 0x5768B525,
|
||||
118 => 0x206F85B3,
|
||||
119 => 0xB966D409,
|
||||
120 => 0xCE61E49F,
|
||||
121 => 0x5EDEF90E,
|
||||
122 => 0x29D9C998,
|
||||
123 => 0xB0D09822,
|
||||
124 => 0xC7D7A8B4,
|
||||
125 => 0x59B33D17,
|
||||
126 => 0x2EB40D81,
|
||||
127 => 0xB7BD5C3B,
|
||||
128 => 0xC0BA6CAD,
|
||||
129 => 0xEDB88320,
|
||||
130 => 0x9ABFB3B6,
|
||||
131 => 0x03B6E20C,
|
||||
132 => 0x74B1D29A,
|
||||
133 => 0xEAD54739,
|
||||
134 => 0x9DD277AF,
|
||||
135 => 0x04DB2615,
|
||||
136 => 0x73DC1683,
|
||||
137 => 0xE3630B12,
|
||||
138 => 0x94643B84,
|
||||
139 => 0x0D6D6A3E,
|
||||
140 => 0x7A6A5AA8,
|
||||
141 => 0xE40ECF0B,
|
||||
142 => 0x9309FF9D,
|
||||
143 => 0x0A00AE27,
|
||||
144 => 0x7D079EB1,
|
||||
145 => 0xF00F9344,
|
||||
146 => 0x8708A3D2,
|
||||
147 => 0x1E01F268,
|
||||
148 => 0x6906C2FE,
|
||||
149 => 0xF762575D,
|
||||
150 => 0x806567CB,
|
||||
151 => 0x196C3671,
|
||||
152 => 0x6E6B06E7,
|
||||
153 => 0xFED41B76,
|
||||
154 => 0x89D32BE0,
|
||||
155 => 0x10DA7A5A,
|
||||
156 => 0x67DD4ACC,
|
||||
157 => 0xF9B9DF6F,
|
||||
158 => 0x8EBEEFF9,
|
||||
159 => 0x17B7BE43,
|
||||
160 => 0x60B08ED5,
|
||||
161 => 0xD6D6A3E8,
|
||||
162 => 0xA1D1937E,
|
||||
163 => 0x38D8C2C4,
|
||||
164 => 0x4FDFF252,
|
||||
165 => 0xD1BB67F1,
|
||||
166 => 0xA6BC5767,
|
||||
167 => 0x3FB506DD,
|
||||
168 => 0x48B2364B,
|
||||
169 => 0xD80D2BDA,
|
||||
170 => 0xAF0A1B4C,
|
||||
171 => 0x36034AF6,
|
||||
172 => 0x41047A60,
|
||||
173 => 0xDF60EFC3,
|
||||
174 => 0xA867DF55,
|
||||
175 => 0x316E8EEF,
|
||||
176 => 0x4669BE79,
|
||||
177 => 0xCB61B38C,
|
||||
178 => 0xBC66831A,
|
||||
179 => 0x256FD2A0,
|
||||
180 => 0x5268E236,
|
||||
181 => 0xCC0C7795,
|
||||
182 => 0xBB0B4703,
|
||||
183 => 0x220216B9,
|
||||
184 => 0x5505262F,
|
||||
185 => 0xC5BA3BBE,
|
||||
186 => 0xB2BD0B28,
|
||||
187 => 0x2BB45A92,
|
||||
188 => 0x5CB36A04,
|
||||
189 => 0xC2D7FFA7,
|
||||
190 => 0xB5D0CF31,
|
||||
191 => 0x2CD99E8B,
|
||||
192 => 0x5BDEAE1D,
|
||||
193 => 0x9B64C2B0,
|
||||
194 => 0xEC63F226,
|
||||
195 => 0x756AA39C,
|
||||
196 => 0x026D930A,
|
||||
197 => 0x9C0906A9,
|
||||
198 => 0xEB0E363F,
|
||||
199 => 0x72076785,
|
||||
200 => 0x05005713,
|
||||
201 => 0x95BF4A82,
|
||||
202 => 0xE2B87A14,
|
||||
203 => 0x7BB12BAE,
|
||||
204 => 0x0CB61B38,
|
||||
205 => 0x92D28E9B,
|
||||
206 => 0xE5D5BE0D,
|
||||
207 => 0x7CDCEFB7,
|
||||
208 => 0x0BDBDF21,
|
||||
209 => 0x86D3D2D4,
|
||||
210 => 0xF1D4E242,
|
||||
211 => 0x68DDB3F8,
|
||||
212 => 0x1FDA836E,
|
||||
213 => 0x81BE16CD,
|
||||
214 => 0xF6B9265B,
|
||||
215 => 0x6FB077E1,
|
||||
216 => 0x18B74777,
|
||||
217 => 0x88085AE6,
|
||||
218 => 0xFF0F6A70,
|
||||
219 => 0x66063BCA,
|
||||
220 => 0x11010B5C,
|
||||
221 => 0x8F659EFF,
|
||||
222 => 0xF862AE69,
|
||||
223 => 0x616BFFD3,
|
||||
224 => 0x166CCF45,
|
||||
225 => 0xA00AE278,
|
||||
226 => 0xD70DD2EE,
|
||||
227 => 0x4E048354,
|
||||
228 => 0x3903B3C2,
|
||||
229 => 0xA7672661,
|
||||
230 => 0xD06016F7,
|
||||
231 => 0x4969474D,
|
||||
232 => 0x3E6E77DB,
|
||||
233 => 0xAED16A4A,
|
||||
234 => 0xD9D65ADC,
|
||||
235 => 0x40DF0B66,
|
||||
236 => 0x37D83BF0,
|
||||
237 => 0xA9BCAE53,
|
||||
238 => 0xDEBB9EC5,
|
||||
239 => 0x47B2CF7F,
|
||||
240 => 0x30B5FFE9,
|
||||
241 => 0xBDBDF21C,
|
||||
242 => 0xCABAC28A,
|
||||
243 => 0x53B39330,
|
||||
244 => 0x24B4A3A6,
|
||||
245 => 0xBAD03605,
|
||||
246 => 0xCDD70693,
|
||||
247 => 0x54DE5729,
|
||||
248 => 0x23D967BF,
|
||||
249 => 0xB3667A2E,
|
||||
250 => 0xC4614AB8,
|
||||
251 => 0x5D681B02,
|
||||
252 => 0x2A6F2B94,
|
||||
253 => 0xB40BBE37,
|
||||
254 => 0xC30C8EA1,
|
||||
255 => 0x5A05DF1B,
|
||||
256 => 0x2D02EF8D,
|
||||
];
|
||||
|
||||
$xorTableHex = [
|
||||
"00" => 0x0,
|
||||
"01" => 0x77073096,
|
||||
"02" => 0xEE0E612C,
|
||||
"03" => 0x990951BA,
|
||||
"04" => 0x076DC419,
|
||||
"05" => 0x706AF48F,
|
||||
"06" => 0xE963A535,
|
||||
"07" => 0x9E6495A3,
|
||||
"08" => 0x0EDB8832,
|
||||
"09" => 0x79DCB8A4,
|
||||
"0A" => 0xE0D5E91E,
|
||||
"0B" => 0x97D2D988,
|
||||
"0C" => 0x09B64C2B,
|
||||
"0D" => 0x7EB17CBD,
|
||||
"0E" => 0xE7B82D07,
|
||||
"0F" => 0x90BF1D91,
|
||||
"10" => 0x1DB71064,
|
||||
"11" => 0x6AB020F2,
|
||||
"12" => 0xF3B97148,
|
||||
"13" => 0x84BE41DE,
|
||||
"14" => 0x1ADAD47D,
|
||||
"15" => 0x6DDDE4EB,
|
||||
"16" => 0xF4D4B551,
|
||||
"17" => 0x83D385C7,
|
||||
"18" => 0x136C9856,
|
||||
"19" => 0x646BA8C0,
|
||||
"1A" => 0xFD62F97A,
|
||||
"1B" => 0x8A65C9EC,
|
||||
"1C" => 0x14015C4F,
|
||||
"1D" => 0x63066CD9,
|
||||
"1E" => 0xFA0F3D63,
|
||||
"1F" => 0x8D080DF5,
|
||||
"20" => 0x3B6E20C8,
|
||||
"21" => 0x4C69105E,
|
||||
"22" => 0xD56041E4,
|
||||
"23" => 0xA2677172,
|
||||
"24" => 0x3C03E4D1,
|
||||
"25" => 0x4B04D447,
|
||||
"26" => 0xD20D85FD,
|
||||
"27" => 0xA50AB56B,
|
||||
"28" => 0x35B5A8FA,
|
||||
"29" => 0x42B2986C,
|
||||
"2A" => 0xDBBBC9D6,
|
||||
"2B" => 0xACBCF940,
|
||||
"2C" => 0x32D86CE3,
|
||||
"2D" => 0x45DF5C75,
|
||||
"2E" => 0xDCD60DCF,
|
||||
"2F" => 0xABD13D59,
|
||||
"30" => 0x26D930AC,
|
||||
"31" => 0x51DE003A,
|
||||
"32" => 0xC8D75180,
|
||||
"33" => 0xBFD06116,
|
||||
"34" => 0x21B4F4B5,
|
||||
"35" => 0x56B3C423,
|
||||
"36" => 0xCFBA9599,
|
||||
"37" => 0xB8BDA50F,
|
||||
"38" => 0x2802B89E,
|
||||
"39" => 0x5F058808,
|
||||
"3A" => 0xC60CD9B2,
|
||||
"3B" => 0xB10BE924,
|
||||
"3C" => 0x2F6F7C87,
|
||||
"3D" => 0x58684C11,
|
||||
"3E" => 0xC1611DAB,
|
||||
"3F" => 0xB6662D3D,
|
||||
"40" => 0x76DC4190,
|
||||
"41" => 0x01DB7106,
|
||||
"42" => 0x98D220BC,
|
||||
"43" => 0xEFD5102A,
|
||||
"44" => 0x71B18589,
|
||||
"45" => 0x06B6B51F,
|
||||
"46" => 0x9FBFE4A5,
|
||||
"47" => 0xE8B8D433,
|
||||
"48" => 0x7807C9A2,
|
||||
"49" => 0x0F00F934,
|
||||
"4A" => 0x9609A88E,
|
||||
"4B" => 0xE10E9818,
|
||||
"4C" => 0x7F6A0DBB,
|
||||
"4D" => 0x086D3D2D,
|
||||
"4E" => 0x91646C97,
|
||||
"4F" => 0xE6635C01,
|
||||
"50" => 0x6B6B51F4,
|
||||
"51" => 0x1C6C6162,
|
||||
"52" => 0x856530D8,
|
||||
"53" => 0xF262004E,
|
||||
"54" => 0x6C0695ED,
|
||||
"55" => 0x1B01A57B,
|
||||
"56" => 0x8208F4C1,
|
||||
"57" => 0xF50FC457,
|
||||
"58" => 0x65B0D9C6,
|
||||
"59" => 0x12B7E950,
|
||||
"5A" => 0x8BBEB8EA,
|
||||
"5B" => 0xFCB9887C,
|
||||
"5C" => 0x62DD1DDF,
|
||||
"5D" => 0x15DA2D49,
|
||||
"5E" => 0x8CD37CF3,
|
||||
"5F" => 0xFBD44C65,
|
||||
"60" => 0x4DB26158,
|
||||
"61" => 0x3AB551CE,
|
||||
"62" => 0xA3BC0074,
|
||||
"63" => 0xD4BB30E2,
|
||||
"64" => 0x4ADFA541,
|
||||
"65" => 0x3DD895D7,
|
||||
"66" => 0xA4D1C46D,
|
||||
"67" => 0xD3D6F4FB,
|
||||
"68" => 0x4369E96A,
|
||||
"69" => 0x346ED9FC,
|
||||
"6A" => 0xAD678846,
|
||||
"6B" => 0xDA60B8D0,
|
||||
"6C" => 0x44042D73,
|
||||
"6D" => 0x33031DE5,
|
||||
"6E" => 0xAA0A4C5F,
|
||||
"6F" => 0xDD0D7CC9,
|
||||
"70" => 0x5005713C,
|
||||
"71" => 0x270241AA,
|
||||
"72" => 0xBE0B1010,
|
||||
"73" => 0xC90C2086,
|
||||
"74" => 0x5768B525,
|
||||
"75" => 0x206F85B3,
|
||||
"76" => 0xB966D409,
|
||||
"77" => 0xCE61E49F,
|
||||
"78" => 0x5EDEF90E,
|
||||
"79" => 0x29D9C998,
|
||||
"7A" => 0xB0D09822,
|
||||
"7B" => 0xC7D7A8B4,
|
||||
"7C" => 0x59B33D17,
|
||||
"7D" => 0x2EB40D81,
|
||||
"7E" => 0xB7BD5C3B,
|
||||
"7F" => 0xC0BA6CAD,
|
||||
"80" => 0xEDB88320,
|
||||
"81" => 0x9ABFB3B6,
|
||||
"82" => 0x03B6E20C,
|
||||
"83" => 0x74B1D29A,
|
||||
"84" => 0xEAD54739,
|
||||
"85" => 0x9DD277AF,
|
||||
"86" => 0x04DB2615,
|
||||
"87" => 0x73DC1683,
|
||||
"88" => 0xE3630B12,
|
||||
"89" => 0x94643B84,
|
||||
"8A" => 0x0D6D6A3E,
|
||||
"8B" => 0x7A6A5AA8,
|
||||
"8C" => 0xE40ECF0B,
|
||||
"8D" => 0x9309FF9D,
|
||||
"8E" => 0x0A00AE27,
|
||||
"8F" => 0x7D079EB1,
|
||||
"90" => 0xF00F9344,
|
||||
"91" => 0x8708A3D2,
|
||||
"92" => 0x1E01F268,
|
||||
"93" => 0x6906C2FE,
|
||||
"94" => 0xF762575D,
|
||||
"95" => 0x806567CB,
|
||||
"96" => 0x196C3671,
|
||||
"97" => 0x6E6B06E7,
|
||||
"98" => 0xFED41B76,
|
||||
"99" => 0x89D32BE0,
|
||||
"9A" => 0x10DA7A5A,
|
||||
"9B" => 0x67DD4ACC,
|
||||
"9C" => 0xF9B9DF6F,
|
||||
"9D" => 0x8EBEEFF9,
|
||||
"9E" => 0x17B7BE43,
|
||||
"9F" => 0x60B08ED5,
|
||||
"A0" => 0xD6D6A3E8,
|
||||
"A1" => 0xA1D1937E,
|
||||
"A2" => 0x38D8C2C4,
|
||||
"A3" => 0x4FDFF252,
|
||||
"A4" => 0xD1BB67F1,
|
||||
"A5" => 0xA6BC5767,
|
||||
"A6" => 0x3FB506DD,
|
||||
"A7" => 0x48B2364B,
|
||||
"A8" => 0xD80D2BDA,
|
||||
"A9" => 0xAF0A1B4C,
|
||||
"AA" => 0x36034AF6,
|
||||
"AB" => 0x41047A60,
|
||||
"AC" => 0xDF60EFC3,
|
||||
"AD" => 0xA867DF55,
|
||||
"AE" => 0x316E8EEF,
|
||||
"AF" => 0x4669BE79,
|
||||
"B0" => 0xCB61B38C,
|
||||
"B1" => 0xBC66831A,
|
||||
"B2" => 0x256FD2A0,
|
||||
"B3" => 0x5268E236,
|
||||
"B4" => 0xCC0C7795,
|
||||
"B5" => 0xBB0B4703,
|
||||
"B6" => 0x220216B9,
|
||||
"B7" => 0x5505262F,
|
||||
"B8" => 0xC5BA3BBE,
|
||||
"B9" => 0xB2BD0B28,
|
||||
"BA" => 0x2BB45A92,
|
||||
"BB" => 0x5CB36A04,
|
||||
"BC" => 0xC2D7FFA7,
|
||||
"BD" => 0xB5D0CF31,
|
||||
"BE" => 0x2CD99E8B,
|
||||
"BF" => 0x5BDEAE1D,
|
||||
"C0" => 0x9B64C2B0,
|
||||
"C1" => 0xEC63F226,
|
||||
"C2" => 0x756AA39C,
|
||||
"C3" => 0x026D930A,
|
||||
"C4" => 0x9C0906A9,
|
||||
"C5" => 0xEB0E363F,
|
||||
"C6" => 0x72076785,
|
||||
"C7" => 0x05005713,
|
||||
"C8" => 0x95BF4A82,
|
||||
"C9" => 0xE2B87A14,
|
||||
"CA" => 0x7BB12BAE,
|
||||
"CB" => 0x0CB61B38,
|
||||
"CC" => 0x92D28E9B,
|
||||
"CD" => 0xE5D5BE0D,
|
||||
"CE" => 0x7CDCEFB7,
|
||||
"CF" => 0x0BDBDF21,
|
||||
"D0" => 0x86D3D2D4,
|
||||
"D1" => 0xF1D4E242,
|
||||
"D2" => 0x68DDB3F8,
|
||||
"D3" => 0x1FDA836E,
|
||||
"D4" => 0x81BE16CD,
|
||||
"D5" => 0xF6B9265B,
|
||||
"D6" => 0x6FB077E1,
|
||||
"D7" => 0x18B74777,
|
||||
"D8" => 0x88085AE6,
|
||||
"D9" => 0xFF0F6A70,
|
||||
"DA" => 0x66063BCA,
|
||||
"DB" => 0x11010B5C,
|
||||
"DC" => 0x8F659EFF,
|
||||
"DD" => 0xF862AE69,
|
||||
"DE" => 0x616BFFD3,
|
||||
"DF" => 0x166CCF45,
|
||||
"E0" => 0xA00AE278,
|
||||
"E1" => 0xD70DD2EE,
|
||||
"E2" => 0x4E048354,
|
||||
"E3" => 0x3903B3C2,
|
||||
"E4" => 0xA7672661,
|
||||
"E5" => 0xD06016F7,
|
||||
"E6" => 0x4969474D,
|
||||
"E7" => 0x3E6E77DB,
|
||||
"E8" => 0xAED16A4A,
|
||||
"E9" => 0xD9D65ADC,
|
||||
"EA" => 0x40DF0B66,
|
||||
"EB" => 0x37D83BF0,
|
||||
"EC" => 0xA9BCAE53,
|
||||
"ED" => 0xDEBB9EC5,
|
||||
"EE" => 0x47B2CF7F,
|
||||
"EF" => 0x30B5FFE9,
|
||||
"F0" => 0xBDBDF21C,
|
||||
"F1" => 0xCABAC28A,
|
||||
"F2" => 0x53B39330,
|
||||
"F3" => 0x24B4A3A6,
|
||||
"F4" => 0xBAD03605,
|
||||
"F5" => 0xCDD70693,
|
||||
"F6" => 0x54DE5729,
|
||||
"F7" => 0x23D967BF,
|
||||
"F8" => 0xB3667A2E,
|
||||
"F9" => 0xC4614AB8,
|
||||
"FA" => 0x5D681B02,
|
||||
"FB" => 0x2A6F2B94,
|
||||
"FC" => 0xB40BBE37,
|
||||
"FD" => 0xC30C8EA1,
|
||||
"FE" => 0x5A05DF1B,
|
||||
"FF" => 0x2D02EF8D
|
||||
];
|
Loading…
Reference in New Issue
Block a user