alias cheatupdate {
var %cs.cheat = "D:\Emulation\Arcade\Emulators\Mame 32\cheat.dat"
var %cs.cheatu = "D:\Emulation\Arcade\Emulators\Mame 32\cheatu.dat"
if ($exists(%cs.cheat) != $false) && $&
($exists(%cs.cheatu) != $false) {
var %cs.cheatulines = $lines(%cs.cheatu)
var %cs.increase = 1
write -i %cs.cheat
while (%cs.increase <= %cs.cheatulines) {
if ($read(%cs.cheatu,%cs.increase) != $null) {
if (;* iswm $read(%cs.cheatu,%cs.increase)) && $&
($read(%cs.cheat,w,$read(%cs.cheatu,%cs.increase)) == $null) {
write %cs.cheat $read(%cs.cheatu,%cs.increase)
}
elseif ($read(%cs.cheat,w,* $+ $&
$+ * $+ $gettok($read(%cs.cheatu,%cs.increase),2,58) $&
$+ * $+ $gettok($read(%cs.cheatu,%cs.increase),3,58) $&
$+ * $+ $gettok($read(%cs.cheatu,%cs.increase),4,58) $&
$+ * $+ $gettok($read(%cs.cheatu,%cs.increase),5,58) $+ *) == $null) {
write %cs.cheat $read(%cs.cheatu,%cs.increase)
}
}
else {
write -i %cs.cheat
}
inc %cs.increase
}
}
}