void CtrlDisAsmView::onKeyDown(WPARAM wParam, LPARAM lParam) { dontRedraw = false; u32 windowEnd = manager.getNthNextAddress(windowStart,visibleRows); keyTaken = true; if (KeyDownAsync(VK_CONTROL)) { switch (tolower(wParam & 0xFFFF)) { case 'f': case 's': search(false); break; case 'c': case VK_INSERT: copyInstructions(selectRangeStart, selectRangeEnd, true); break; case 'x': disassembleToFile(); break; case 'a': assembleOpcode(curAddress,""); break; case 'g': { u32 addr; if (executeExpressionWindow(wnd,debugger,addr) == false) return; gotoAddr(addr); } break; case 'e': // edit breakpoint editBreakpoint(); break; case 'd': // toogle breakpoint enabled toggleBreakpoint(true); break; case VK_UP: scrollWindow(-1); scanFunctions(); break; case VK_DOWN: scrollWindow(1); scanFunctions(); break; case VK_NEXT: setCurAddress(manager.getNthPreviousAddress(windowEnd,1),KeyDownAsync(VK_SHIFT)); break; case VK_PRIOR: setCurAddress(windowStart,KeyDownAsync(VK_SHIFT)); break; } } else { switch (wParam & 0xFFFF) { case VK_DOWN: setCurAddress(manager.getNthNextAddress(curAddress,1), KeyDownAsync(VK_SHIFT)); scrollAddressIntoView(); break; case VK_UP: setCurAddress(manager.getNthPreviousAddress(curAddress,1), KeyDownAsync(VK_SHIFT)); scrollAddressIntoView(); break; case VK_NEXT: if (manager.getNthNextAddress(curAddress,1) != windowEnd && curAddressIsVisible()) { setCurAddress(manager.getNthPreviousAddress(windowEnd,1), KeyDownAsync(VK_SHIFT)); scrollAddressIntoView(); } else { setCurAddress(manager.getNthNextAddress(windowEnd,visibleRows-1), KeyDownAsync(VK_SHIFT)); scrollAddressIntoView(); } break; case VK_PRIOR: if (curAddress != windowStart && curAddressIsVisible()) { setCurAddress(windowStart, KeyDownAsync(VK_SHIFT)); scrollAddressIntoView(); } else { setCurAddress(manager.getNthPreviousAddress(windowStart,visibleRows), KeyDownAsync(VK_SHIFT)); scrollAddressIntoView(); } break; case VK_LEFT: if (jumpStack.empty()) { gotoPC(); } else { u32 addr = jumpStack[jumpStack.size()-1]; jumpStack.pop_back(); gotoAddr(addr); } return; case VK_RIGHT: followBranch(); return; case VK_TAB: displaySymbols = !displaySymbols; break; case VK_SPACE: debugger->toggleBreakpoint(curAddress); break; case VK_F3: search(true); break; default: keyTaken = false; return; } } redraw(); }
void CtrlDisAsmView::onKeyDown(WPARAM wParam, LPARAM lParam) { dontRedraw = false; u32 windowEnd = windowStart+visibleRows*instructionSize; keyTaken = true; if (controlHeld) { switch (tolower(wParam & 0xFFFF)) { case 's': search(false); break; case 'c': search(true); break; case 'x': disassembleToFile(); break; case 'a': controlHeld = false; assembleOpcode(curAddress,""); break; case 'g': { u32 addr; controlHeld = false; if (executeExpressionWindow(wnd,debugger,addr) == false) return; gotoAddr(addr); } break; } } else { switch (wParam & 0xFFFF) { case VK_DOWN: setCurAddress(curAddress + instructionSize, GetAsyncKeyState(VK_SHIFT) != 0); scrollAddressIntoView(); break; case VK_UP: setCurAddress(curAddress - instructionSize, GetAsyncKeyState(VK_SHIFT) != 0); scrollAddressIntoView(); break; case VK_NEXT: if (curAddress != windowEnd - instructionSize && curAddressIsVisible()) { setCurAddress(windowEnd - instructionSize, GetAsyncKeyState(VK_SHIFT) != 0); scrollAddressIntoView(); } else { setCurAddress(curAddress + visibleRows * instructionSize, GetAsyncKeyState(VK_SHIFT) != 0); scrollAddressIntoView(); } break; case VK_PRIOR: if (curAddress != windowStart && curAddressIsVisible()) { setCurAddress(windowStart, GetAsyncKeyState(VK_SHIFT) != 0); scrollAddressIntoView(); } else { setCurAddress(curAddress - visibleRows * instructionSize, GetAsyncKeyState(VK_SHIFT) != 0); scrollAddressIntoView(); } break; case VK_LEFT: if (jumpStack.empty()) { gotoPC(); } else { u32 addr = jumpStack[jumpStack.size()-1]; jumpStack.pop_back(); gotoAddr(addr); } return; case VK_RIGHT: followBranch(); return; case VK_TAB: displaySymbols = !displaySymbols; break; case VK_CONTROL: controlHeld = true; break; case VK_SPACE: debugger->toggleBreakpoint(curAddress); break; default: keyTaken = false; return; } } redraw(); }