uid) { continue; } if ($call_fix && $at[$call_fix - 1] < 0) { continue; // call target not in this script } $old = pack('C*', ...constant(PatchesVars::class . '::' . (Alis::$platform->is_little_endian ? $le_old : $be_old))); $rep = pack('C*', ...constant(PatchesVars::class . '::' . (Alis::$platform->is_little_endian ? $le_new : $be_new))); $old = str_pad($old, $len, "\0"); $rep = str_pad($rep, $len, "\0"); // unused tail is zero (never reached) if ($len > $data_sz) { continue; } $i = strpos(substr(Alis::$mem, $data, $data_sz), $old); if ($i === false) { continue; } mem_write($data + $i, $rep); if ($call_fix) { $off = $at[$call_fix - 1] + $call_to - ($i + $call_at + 2); $p = $data + $i + $call_at; if (Alis::$platform->is_little_endian) { Alis::$mem[$p] = chr($off & 0xff); Alis::$mem[$p + 1] = chr(($off >> 8) & 0xff); } else { Alis::$mem[$p] = chr(($off >> 8) & 0xff); Alis::$mem[$p + 1] = chr($off & 0xff); } } $at[$f] = $i; } }