void DataWidget::highlightCurrentLine() { if (moveable) { if (!highlights.isEmpty()) { highlights.removeLast(); } addHighlight(QColor(Qt::yellow).lighter(160)); setExtraSelections(highlights); if (QApplication::keyboardModifiers().testFlag(Qt::ControlModifier)) { bool ok = true; QTextCursor cursor = textCursor(); cursor.select(QTextCursor::WordUnderCursor); if (cursor.selectedText().isEmpty()) { return; } QString weird(QStringLiteral("[]()\",./\\-=")); if (weird.contains(cursor.selectedText().at(0))) { cursor.movePosition(QTextCursor::WordLeft); cursor.movePosition(QTextCursor::WordLeft); cursor.select(QTextCursor::WordUnderCursor); } setTextCursor(cursor); QString equ = getAddressOfEquate(cursor.selectedText().toUpper().toStdString()); uint32_t address; if (!equ.isEmpty()) { address = hex2int(equ); } else { address = textCursor().selectedText().toUInt(&ok, 16); } if (ok) { if (QApplication::keyboardModifiers().testFlag(Qt::ShiftModifier)) { emit gotoMemoryAddress(address); } else { emit gotoDisasmAddress(address); } } } } }
void Manager::onFirstActivation() { // Setup our windows addWindow(WindowID::InfoWindow, new InfoWindow { "Info" }); addWindow(WindowID::DisassemblyWindow, new DisassemblyWindow { "Disassembly", mAnalyseDatabase }, { KeyboardKey::LeftControl, KeyboardKey::I }); addWindow(WindowID::MemoryWindow, new MemoryWindow { "Memory" }, { KeyboardKey::LeftControl, KeyboardKey::M }); addWindow(WindowID::RegistersWindow, new RegistersWindow { "Registers" }, { KeyboardKey::LeftControl, KeyboardKey::R }); addWindow(WindowID::SegmentsWindow, new SegmentsWindow { "Segments" }, { KeyboardKey::LeftControl, KeyboardKey::S }); addWindow(WindowID::StackWindow, new StackWindow { "Stack" }, { KeyboardKey::LeftControl, KeyboardKey::E }); addWindow(WindowID::StatsWindow, new StatsWindow { "Stats" }, { KeyboardKey::LeftControl, KeyboardKey::Q }); addWindow(WindowID::ThreadsWindow, new ThreadsWindow { "Threads" }, { KeyboardKey::LeftControl, KeyboardKey::T }); addWindow(WindowID::VoicesWindow, new VoicesWindow { "Voices" }, { KeyboardKey::LeftControl, KeyboardKey::P }); addWindow(WindowID::PerformanceWindow, PerformanceWindow::create("Performance"), { KeyboardKey::LeftControl, KeyboardKey::O }); // Try find good addresses to focus on auto moduleInfo = decaf::debug::CafeModuleInfo { }; auto disassemblyStartAddress = 0x02000000u; auto memoryStartAddress = 0x10000000u; if (decaf::debug::getLoadedModuleInfo(moduleInfo)) { disassemblyStartAddress = moduleInfo.textAddr; memoryStartAddress = moduleInfo.dataAddr; decaf::debug::analyseLoadedModules(mAnalyseDatabase); decaf::debug::analyseCode(mAnalyseDatabase, moduleInfo.textAddr, moduleInfo.textAddr + moduleInfo.textSize); } // Place the views somewhere sane to start in case pausing did not place it somewhere if (!mPaused) { gotoDisassemblyAddress(disassemblyStartAddress); gotoMemoryAddress(memoryStartAddress); } }