void CtrlMemView::onMouseUp(WPARAM wParam, LPARAM lParam, int button) { if (button==2) { //popup menu? POINT pt; GetCursorPos(&pt); switch (TrackPopupMenuEx(GetSubMenu(g_hPopupMenus,0),TPM_RIGHTBUTTON|TPM_RETURNCMD,pt.x,pt.y,wnd,0)) { case ID_MEMVIEW_DUMP: MessageBox(wnd,"This feature has not been implemented.","Sorry",0); break; case ID_MEMVIEW_COPYVALUE: { char temp[24]; sprintf(temp,"%08x",Memory::ReadUnchecked_U32(selection)); W32Util::CopyTextToClipboard(wnd,temp); } break; } return; } int x = LOWORD(lParam); int y = HIWORD(lParam); if (x>16) { curAddress=yToAddress(y); selecting=false; ReleaseCapture(); redraw(); } }
void CtrlDisAsmView::onMouseDown(WPARAM wParam, LPARAM lParam, int button) { dontRedraw = false; int x = LOWORD(lParam); int y = HIWORD(lParam); u32 newAddress = yToAddress(y); bool extend = KeyDownAsync(VK_SHIFT); if (button == 1) { if (newAddress == curAddress && hasFocus) { toggleBreakpoint(); } } else if (button == 2) { // Maintain the current selection if right clicking into it. if (newAddress >= selectRangeStart && newAddress < selectRangeEnd) extend = true; } setCurAddress(newAddress, extend); SetFocus(wnd); redraw(); }
void CtrlDisAsmView::onMouseMove(WPARAM wParam, LPARAM lParam, int button) { if ((button & 1) != 0) { int x = LOWORD(lParam); int y = HIWORD(lParam); setCurAddress(yToAddress(y), KeyDownAsync(VK_SHIFT)); // TODO: Perhaps don't do this every time, but on a timer? redraw(); } }
void CtrlDisAsmView::mousePressEvent(QMouseEvent *e) { int x = e->pos().x(); int y = e->pos().y(); if (x>16) { oldSelection=selection; selection=yToAddress(y); bool oldselecting=selecting; selecting=true; if (!oldselecting || (selection!=oldSelection)) redraw(); } else { debugger->toggleBreakpoint(yToAddress(y)); parentWindow->Update(); redraw(); } }
void CtrlDisAsmView::onMouseDown(WPARAM wParam, LPARAM lParam, int button) { int x = LOWORD(lParam); int y = HIWORD(lParam); if (x>16) { oldSelection=selection; selection=yToAddress(y); SetCapture(wnd); bool oldselecting=selecting; selecting=true; if (!oldselecting || (selection!=oldSelection)) redraw(); } else { debugger->toggleBreakpoint(yToAddress(y)); redraw(); } }
void CtrlMemView::mousePressEvent(QMouseEvent *e) { int x = e->pos().x(); int y = e->pos().y(); if (x>16) { oldSelection=selection; selection=yToAddress(y); bool oldselecting=selecting; selecting=true; if (!oldselecting || (selection!=oldSelection)) redraw(); } }
void CtrlMemView::onMouseDown(WPARAM wParam, LPARAM lParam, int button) { int x = LOWORD(lParam); int y = HIWORD(lParam); if (x>16) { oldSelection=selection; selection=yToAddress(y); SetCapture(wnd); bool oldselecting=selecting; selecting=true; if (!oldselecting || (selection!=oldSelection)) redraw(); } }
void CtrlMemView::onMouseUp(WPARAM wParam, LPARAM lParam, int button) { if (button==2) { //popup menu? POINT pt; GetCursorPos(&pt); // TrackPopupMenuEx(GetSubMenu(g_hPopupMenus,0),TPM_RIGHTBUTTON,pt.x,pt.y,wnd,0); return; } int x = LOWORD(lParam); int y = HIWORD(lParam); if (x>16) { curAddress=yToAddress(y); selecting=false; ReleaseCapture(); redraw(); } }
void CtrlDisAsmView::onMouseUp(WPARAM wParam, LPARAM lParam, int button) { if (button == 1) { int x = LOWORD(lParam); int y = HIWORD(lParam); setCurAddress(yToAddress(y), KeyDownAsync(VK_SHIFT)); redraw(); } else if (button == 2) { //popup menu? POINT pt; GetCursorPos(&pt); switch(TrackPopupMenuEx(GetSubMenu(g_hPopupMenus,1),TPM_RIGHTBUTTON|TPM_RETURNCMD,pt.x,pt.y,wnd,0)) { case ID_DISASM_GOTOINMEMORYVIEW: SendMessage(GetParent(wnd),WM_DEB_GOTOHEXEDIT,curAddress,0); break; case ID_DISASM_ADDHLE: break; case ID_DISASM_TOGGLEBREAKPOINT: toggleBreakpoint(); redraw(); break; case ID_DISASM_ASSEMBLE: assembleOpcode(curAddress,""); break; case ID_DISASM_COPYINSTRUCTIONDISASM: copyInstructions(selectRangeStart, selectRangeEnd, true); break; case ID_DISASM_COPYADDRESS: { char temp[16]; sprintf(temp,"%08X",curAddress); W32Util::CopyTextToClipboard(wnd, temp); } break; case ID_DISASM_SETPCTOHERE: debugger->setPC(curAddress); redraw(); break; case ID_DISASM_FOLLOWBRANCH: followBranch(); break; case ID_DISASM_COPYINSTRUCTIONHEX: copyInstructions(selectRangeStart, selectRangeEnd, false); break; case ID_DISASM_RUNTOHERE: { SendMessage(GetParent(wnd), WM_COMMAND, ID_DEBUG_RUNTOLINE, 0); redraw(); } break; case ID_DISASM_RENAMEFUNCTION: { u32 funcBegin = symbolMap.GetFunctionStart(curAddress); if (funcBegin != -1) { char name[256]; std::string newname; strncpy_s(name, symbolMap.GetLabelString(funcBegin).c_str(),_TRUNCATE); if (InputBox_GetString(MainWindow::GetHInstance(), MainWindow::GetHWND(), L"New function name", name, newname)) { symbolMap.SetLabelName(newname.c_str(),funcBegin); u32 funcSize = symbolMap.GetFunctionSize(curAddress); MIPSAnalyst::RegisterFunction(funcBegin, funcSize, newname.c_str()); MIPSAnalyst::UpdateHashMap(); MIPSAnalyst::ApplyHashMap(); SendMessage(GetParent(wnd),WM_DEB_MAPLOADED,0,0); redraw(); } } else { MessageBox(MainWindow::GetHWND(), L"No symbol selected",0,0); } } break; case ID_DISASM_REMOVEFUNCTION: { char statusBarTextBuff[256]; u32 funcBegin = symbolMap.GetFunctionStart(curAddress); if (funcBegin != -1) { u32 prevBegin = symbolMap.GetFunctionStart(funcBegin-1); if (prevBegin != -1) { u32 expandedSize = symbolMap.GetFunctionSize(prevBegin)+symbolMap.GetFunctionSize(funcBegin); symbolMap.SetFunctionSize(prevBegin,expandedSize); } symbolMap.RemoveFunction(funcBegin,true); symbolMap.SortSymbols(); manager.clear(); SendMessage(GetParent(wnd), WM_DEB_MAPLOADED, 0, 0); } else { snprintf(statusBarTextBuff,256, "WARNING: unable to find function symbol here"); SendMessage(GetParent(wnd), WM_DEB_SETSTATUSBARTEXT, 0, (LPARAM) statusBarTextBuff); } redraw(); } break; case ID_DISASM_ADDFUNCTION: { char statusBarTextBuff[256]; u32 prevBegin = symbolMap.GetFunctionStart(curAddress); if (prevBegin != -1) { if (prevBegin == curAddress) { snprintf(statusBarTextBuff,256, "WARNING: There's already a function entry point at this adress"); SendMessage(GetParent(wnd), WM_DEB_SETSTATUSBARTEXT, 0, (LPARAM) statusBarTextBuff); } else { char symname[128]; u32 prevSize = symbolMap.GetFunctionSize(prevBegin); u32 newSize = curAddress-prevBegin; symbolMap.SetFunctionSize(prevBegin,newSize); newSize = prevSize-newSize; snprintf(symname,128,"u_un_%08X",curAddress); symbolMap.AddFunction(symname,curAddress,newSize); symbolMap.SortSymbols(); manager.clear(); SendMessage(GetParent(wnd), WM_DEB_MAPLOADED, 0, 0); } } else { char symname[128]; int newSize = selectRangeEnd - selectRangeStart; snprintf(symname, 128, "u_un_%08X", selectRangeStart); symbolMap.AddFunction(symname, selectRangeStart, newSize); symbolMap.SortSymbols(); SendMessage(GetParent(wnd), WM_DEB_MAPLOADED, 0, 0); } redraw(); } break; case ID_DISASM_DISASSEMBLETOFILE: disassembleToFile(); break; } return; } redraw(); }
void CtrlDisAsmView::onMouseUp(WPARAM wParam, LPARAM lParam, int button) { if (button == 1) { int x = LOWORD(lParam); int y = HIWORD(lParam); setCurAddress(yToAddress(y), GetAsyncKeyState(VK_SHIFT) != 0); redraw(); } else if (button == 2) { //popup menu? POINT pt; GetCursorPos(&pt); switch(TrackPopupMenuEx(GetSubMenu(g_hPopupMenus,1),TPM_RIGHTBUTTON|TPM_RETURNCMD,pt.x,pt.y,wnd,0)) { case ID_DISASM_GOTOINMEMORYVIEW: for (int i=0; i<numCPUs; i++) if (memoryWindow[i]) memoryWindow[i]->Goto(curAddress); break; case ID_DISASM_ADDHLE: break; case ID_DISASM_TOGGLEBREAKPOINT: toggleBreakpoint(); redraw(); break; case ID_DISASM_ASSEMBLE: assembleOpcode(curAddress,""); break; case ID_DISASM_COPYINSTRUCTIONDISASM: { int space = 256 * (selectRangeEnd - selectRangeStart) / instructionSize; char opcode[64], arguments[256]; char *temp = new char[space]; char *p = temp, *end = temp + space; for (u32 pos = selectRangeStart; pos < selectRangeEnd; pos += instructionSize) { const char *dizz = debugger->disasm(pos, instructionSize); parseDisasm(dizz, opcode, arguments); p += snprintf(p, end - p, "%s\t%s\r\n", opcode, arguments); } W32Util::CopyTextToClipboard(wnd, temp); delete [] temp; } break; case ID_DISASM_COPYADDRESS: { char temp[16]; sprintf(temp,"%08X",curAddress); W32Util::CopyTextToClipboard(wnd, temp); } break; case ID_DISASM_SETPCTOHERE: debugger->setPC(curAddress); redraw(); break; case ID_DISASM_FOLLOWBRANCH: followBranch(); break; case ID_DISASM_COPYINSTRUCTIONHEX: { int space = 24 * (selectRangeEnd - selectRangeStart) / instructionSize; char *temp = new char[space]; char *p = temp, *end = temp + space; for (u32 pos = selectRangeStart; pos < selectRangeEnd; pos += instructionSize) p += snprintf(p, end - p, "%08X\r\n", debugger->readMemory(pos)); W32Util::CopyTextToClipboard(wnd, temp); delete [] temp; } break; case ID_DISASM_RUNTOHERE: { debugger->setBreakpoint(curAddress); debugger->runToBreakpoint(); redraw(); } break; case ID_DISASM_RENAMEFUNCTION: { int sym = symbolMap.GetSymbolNum(curAddress); if (sym != -1) { char name[256]; std::string newname; strncpy_s(name, symbolMap.GetSymbolName(sym),_TRUNCATE); if (InputBox_GetString(MainWindow::GetHInstance(), MainWindow::GetHWND(), L"New function name", name, newname)) { symbolMap.SetSymbolName(sym, newname.c_str()); redraw(); SendMessage(GetParent(wnd),WM_DEB_MAPLOADED,0,0); } } else { MessageBox(MainWindow::GetHWND(), L"No symbol selected",0,0); } } break; case ID_DISASM_DISASSEMBLETOFILE: disassembleToFile(); break; } return; } redraw(); }