if noptemplate then unregisterAutoAssemblerTemplate(noptemplate) noptemplate=nil end noptemplate=registerAutoAssemblerTemplate("NOP Injection", function(script, form) local mv=getMemoryViewForm() local address=mv.DisassemblerView.SelectedAddress local size=getInstructionSize(address) local originalBytes=readBytes(address,size, true) local oldcase=script.CaseSensitive local enable=script.indexOf('[enable]') local disable=script.indexOf('[disable]'); script.CaseSensitive=oldcase local nopscript=createStringlist() local disablescript=createStringlist() nopscript.add(getNameFromAddress(address)..":") disablescript.add(getNameFromAddress(address)..":") nopscript.add("nop "..size) for i = 1,size do disablescript.add(string.format("db %x", originalBytes[i])) end if enable==-1 and disable==-1 then script.addText(nopscript.Text) return end if enable~=-1 and disable~=-1 then for i=0,nopscript.Count-1 do script.insert(disable-1+i,nopscript[i]) end script.addText(disablescript.Text) return end --messed up if enable~=-1 then for i=0,nopscript.Count-1 do script.insert(disable-1+i,nopscript[i]) end else for i=0,nopscript.Count-1 do script.insert(0+i,nopscript[i]) end end if disable~=-1 then script.addText(disablescript.Text) end end, textToShortCut("Ctrl+Alt+N"))