2022-05-07 12:25:27 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
2022-05-16 05:15:17 +00:00
|
|
|
require_once './testData.php';
|
|
|
|
|
2022-05-07 12:25:27 +00:00
|
|
|
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);
|
|
|
|
|
2022-05-15 02:14:49 +00:00
|
|
|
$filename = "D:\Diablo II\MODS\ironman-dev\save\Test.d2s";
|
2022-05-16 05:15:17 +00:00
|
|
|
$filename = str_replace("\\", "\\\\", $filename);
|
2022-05-15 02:14:49 +00:00
|
|
|
$fp = fopen($filename, "rb+");
|
|
|
|
|
2022-05-16 05:15:17 +00:00
|
|
|
// 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
|
|
|
|
|
|
|
|
// edit quest test, den of evil
|
2022-05-15 02:14:49 +00:00
|
|
|
fseek($fp, 347);
|
|
|
|
fwrite($fp, pack('C', 0xFD));
|
|
|
|
fseek($fp, 348);
|
|
|
|
fwrite($fp, pack('C', 0x9F));
|
|
|
|
|
2022-05-16 05:15:17 +00:00
|
|
|
$checksum = swapEndianness(shell_exec("bin\d2scs.exe \"$filename\""));
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
2022-05-15 02:14:49 +00:00
|
|
|
|
2022-05-07 12:25:27 +00:00
|
|
|
fclose($fp);
|