diff --git a/Windows/Debugger/CtrlDisAsmView.cpp b/Windows/Debugger/CtrlDisAsmView.cpp index 8b28551ac7..7b46ae2402 100644 --- a/Windows/Debugger/CtrlDisAsmView.cpp +++ b/Windows/Debugger/CtrlDisAsmView.cpp @@ -206,7 +206,7 @@ CtrlDisAsmView::~CtrlDisAsmView() manager.clear(); } -COLORREF scaleColor(COLORREF color, float factor) +static COLORREF scaleColor(COLORREF color, float factor) { unsigned char r = color & 0xFF; unsigned char g = (color >> 8) & 0xFF; @@ -315,7 +315,7 @@ void CtrlDisAsmView::assembleOpcode(u32 address, std::string defaultText) // try to assemble the input if it failed } - result = MIPSAsm::MipsAssembleOpcode(op.c_str(),debugger,address); + result = MIPSAsm::MipsAssembleOpcode(op.c_str(), debugger, address); Reporting::NotifyDebugger(); if (result == true) { @@ -331,7 +331,6 @@ void CtrlDisAsmView::assembleOpcode(u32 address, std::string defaultText) } } - void CtrlDisAsmView::drawBranchLine(HDC hdc, std::map &addressPositions, const BranchLine &line) { HPEN pen; u32 windowEnd = manager.getNthNextAddress(windowStart,visibleRows); @@ -725,7 +724,7 @@ void CtrlDisAsmView::onKeyDown(WPARAM wParam, LPARAM lParam) break; case 'c': case VK_INSERT: - copyInstructions(selectRangeStart, selectRangeEnd, true); + CopyInstructions(selectRangeStart, selectRangeEnd, CopyInstructionsMode::DISASM); break; case 'x': disassembleToFile(); @@ -931,6 +930,16 @@ void CtrlDisAsmView::CopyInstructions(u32 startAddr, u32 endAddr, CopyInstructio } } +void CtrlDisAsmView::NopInstructions(u32 selectRangeStart, u32 selectRangeEnd) { + for (u32 addr = selectRangeStart; addr < selectRangeEnd; addr += 4) { + Memory::Write_U32(0, addr); + } + + if (currentMIPS) { + currentMIPS->InvalidateICache(selectRangeStart, selectRangeEnd - selectRangeStart); + } +} + void CtrlDisAsmView::onMouseUp(WPARAM wParam, LPARAM lParam, int button) { if (button == 1) @@ -962,6 +971,10 @@ void CtrlDisAsmView::onMouseUp(WPARAM wParam, LPARAM lParam, int button) case ID_DISASM_COPYINSTRUCTIONHEX: CopyInstructions(selectRangeStart, selectRangeEnd, CopyInstructionsMode::OPCODES); break; + case ID_DISASM_NOPINSTRUCTION: + NopInstructions(selectRangeStart, selectRangeEnd); + redraw(); + break; case ID_DISASM_SETPCTOHERE: debugger->setPC(curAddress); redraw(); diff --git a/Windows/Debugger/CtrlDisAsmView.h b/Windows/Debugger/CtrlDisAsmView.h index ebddca20de..c67306a76c 100644 --- a/Windows/Debugger/CtrlDisAsmView.h +++ b/Windows/Debugger/CtrlDisAsmView.h @@ -80,6 +80,7 @@ class CtrlDisAsmView void updateStatusBarText(); void drawBranchLine(HDC hdc, std::map &addressPositions, const BranchLine &line); void CopyInstructions(u32 startAddr, u32 endAddr, CopyInstructionsMode mode); + void NopInstructions(u32 startAddr, u32 endAddr); std::set getSelectedLineArguments(); void drawArguments(HDC hdc, const DisassemblyLineInfo &line, int x, int y, int textColor, const std::set ¤tArguments); diff --git a/Windows/ppsspp.rc b/Windows/ppsspp.rc index d5109b9cd0..d2a2c921d9 100644 --- a/Windows/ppsspp.rc +++ b/Windows/ppsspp.rc @@ -721,6 +721,7 @@ BEGIN MENUITEM "Rename Function...", ID_DISASM_RENAMEFUNCTION MENUITEM "Remove Function", ID_DISASM_REMOVEFUNCTION MENUITEM "Add Function Here", ID_DISASM_ADDFUNCTION + MENUITEM "NOP instruction(s)", ID_DISASM_NOPINSTRUCTION END POPUP "reglist" BEGIN diff --git a/Windows/resource.h b/Windows/resource.h index fc421b7e60..ffe653d58a 100644 --- a/Windows/resource.h +++ b/Windows/resource.h @@ -334,6 +334,7 @@ #define ID_GEDBG_COPY_IMAGE_ALPHA 40225 #define ID_GEDBG_TRACK_PIXEL 40226 #define ID_GEDBG_TRACK_PIXEL_STOP 40227 +#define ID_DISASM_NOPINSTRUCTION 40228 // Dummy option to let the buffered rendering hotkey cycle through all the options.