Please read the commented section of the code for more information.
/*
mIRC Hex-Editor Snippet
Type /hex to start
Author Notes:
- Short hex editor snippet, which uses a basic mIRC window, the script
is actually pretty short, but with limited functionality
- Leave a comment behind, also contact at mknobbout@gmail.com
KNOWN BUGS:
- If the scroll bar is used the script will think you clicked on a different byte, so dont use the scroll button. Cannot find a decent way to disable this.
Side Notes:
- If you do not know what a hex editor is or does, this snippet is not for you!
- The snippet writes directly to the file
*/
alias hex {
set %hex 0 34 22 @Hex-Editor $$sfile($mircdir $+ *.*,Hex Editor)
xhex %hex
}
menu @Hex-Editor {
dclick:{
tokenize 32 %hex
if ($mouse.y isnum 585-600) {
if (($mouse.x isnum 0-85) && ($calc($1 - $2 * $3) > 0)) set %hex $calc($1 - $2 * $3) $2-
elseif (($mouse.x isnum 90-140) && ($calc($1 + $2 * $3) <= $file($+(",$$5-,")))) set %hex $calc($1 + $2 * $3) $2-
xhex %hex
}
var &hex, %x = $int($calc($int($calc(($mouse.x - 56) / 8)) / 3 - 1)), %y = $int($calc(($mouse.y - 22) / 16)), %byte = $calc($1 + $3 * %y + %x)
if ((%x !isnum $+(0-,$calc($3 - 1))) || (%y !isnum $+(0-,$calc($2 - 1)))) return
bread $+(",$$5-,") %byte 1 &hex
var %write = $$input(Replace byte $+(',$$base($bvar(&hex,1),10,16,2),') at address $+(',$base(%byte,10,16,8),') with?,e,Replacement)
if ($base(%write,16,10) isnum 0-255) {
bset &hex 1 $v1
bwrite $+(",$5-,") %byte 1 &hex
xhex $1-
}
else return $input($base($v1,10,16,2) Erronomous Hex,o,error)
}
}
alias xhex {
;/xhex <N (start of file)> <N (loop)> <N (length)> <Window Name> <File>
if (!$window($4)) window -aCdfk0 +l $4 -1 -1 800 600 Fixedsys 9 | clear $4
echo $4 $chr(2) $+ Double-Click on a byte to edit, $chr(3) $+ 02Addresses are Blue, $chr(3) $+ 01Bytes are Black, $chr(3) $+ 04ASCII is Red
var &hex, %a = $1, %b = 1, %c = $+(",$$5-,")
if (!$isfile(%c)) return
while (%b <= $2) {
if (%a <= $file(%c)) {
.bread %c %a $3 &hex
echo $4 $+($chr(3),02,$base(%a,10,16,8),$chr(3)) $asc2(&hex).hex $+($chr(3),04,$asc2(&hex).chr)
}
else echo $4 $chr(160)
inc %a $3 | inc %b
}
:error
echo $4 $str(-,17)
echo $4 $+($chr(3),00,$chr(44),01<<Previous,$chr(3)) $+($chr(3),00,$chr(44),01Next>>,$chr(3))
}
alias asc2 {
var %a = 1, %b, %c = $chr(160)
while (%a <= $bvar($$1,0)) {
%b = $iif($prop = hex,%b $base($bvar($1,%a),10,16,2),%b $+ $iif($chr($bvar($1,%a)),$iif($v1 = $chr(32) || $v1 = $chr(9),%c,$v1),%c))
inc %a
}
return %b
}
Suggestion\'s
some thing ultra simple have the filename of the file your messing with is the @window title bar
Is there anyway you could add compare file\'s ( for snapshot\'s to make finding the changing data a little easier? )
By that I mean just checking for the differences
2024 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
203A 00 00 00 00 00 00