$fname = "_internal_database.txt"; function getPossibilities($arr, $addr) { $res = array(); foreach ($arr as $t) { if ($t["version"]["name"] == "1.16.1") { $curAddr = hexdec($t["address"]); $mod = $curAddr % 4; if ($addr >= $curAddr - $mod) { $res[$curAddr] = $t; } } } return $res; } function getActual($arr, $addr) { foreach ($arr as $t) { $adr = hexdec($t["address"]); $size = $t["size"] * 1; $length = $t["length"] * 1; $ldr = $adr + ($size * $length); if ($addr >= $adr && $addr <= $ldr) { return $t; } } foreach ($arr as $t) { $adr = hexdec($t["address"]); $size = $t["size"] * 1; $length = $t["length"] * 1; $ldr = $adr + ($size * $length); $mod = $addr % 4; if ($addr >= $adr - $mod && $addr <= $ldr) { return $t; } } // Not direct hit return false; } if (isset($_GET["findPlayerID"])) { if(isset($_GET["isHexAddress"])) { $pid = ((hexdec($_GET["findPlayerID"]) * 1) / 4) - 1452249;; } else { $pid = $_GET["findPlayerID"] * 1; } $num = 1452249; $addr = 4 * ($pid + $num); $fc = json_decode(file_get_contents($fname), true); $candidate = false; foreach ($fc as $t) { if ($t["version"]["name"] == "1.16.1") { $adr = hexdec($t["address"]); $size = $t["size"] * 1; $length = $t["length"] * 1; if ($addr >= $adr) { $offset = ($addr - $addr) / $size; if ($offset < $length) { $candidate = $t; break; } } } } if ($candidate === false) { echo "Back to main page
"; die("Unable to determine the source!"); } $offset = $addr - (hexdec($candidate["address"])); $oid = floor($offset / ($candidate["size"] * 1)); $haddr = "00000000" . strtoupper(dechex($addr)); $haddr = strrev(substr(strrev($haddr), 0, 8)); $_GET["showadditional"] = array( $pid, $haddr, $oid ); $_GET["details"] = $candidate["address"]; }