diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e0fc73f3..f46fb515 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -161,14 +161,14 @@ void MainWindow::initUI() this->omnibar = new Omnibar(this); ui->mainToolBar->insertWidget(ui->actionShow_Hide_mainsidebar, this->omnibar); - // Add special sepparators to the toolbar that expand to separate groups of elements + // Add special separators to the toolbar that expand to separate groups of elements QWidget *spacer2 = new QWidget(); spacer2->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); spacer2->setMinimumSize(10, 10); spacer2->setMaximumWidth(300); ui->mainToolBar->insertWidget(ui->actionShow_Hide_mainsidebar, spacer2); - // Sepparator between back/forward and undo/redo buttons + // Separator between back/forward and undo/redo buttons QWidget *spacer = new QWidget(); spacer->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); spacer->setMinimumSize(20, 20); @@ -183,7 +183,6 @@ void MainWindow::initUI() /* * Dock Widgets */ - dockWidgets.reserve(11); // Add Memory DockWidget @@ -1076,19 +1075,26 @@ void MainWindow::refreshVisibleDockWidgets() void MainWindow::on_actionRefresh_contents_triggered() { - this->refreshVisibleDockWidgets(); + refreshVisibleDockWidgets(); } void MainWindow::on_actionDisplay_Esil_triggered() { int esil = this->core->getConfig("asm.esil"); - this->core->config("asm.esil", !esil); - this->refreshVisibleDockWidgets(); + core->config("asm.esil", !esil); + refreshVisibleDockWidgets(); } void MainWindow::on_actionDisplay_Pseudocode_triggered() { int pseudo = this->core->getConfig("asm.pseudo"); - this->core->config("asm.pseudo", !pseudo); - this->refreshVisibleDockWidgets(); + core->config("asm.pseudo", !pseudo); + refreshVisibleDockWidgets(); +} + +void MainWindow::on_actionDisplay_Offsets_triggered() +{ + bool checked = ui->actionDisplay_Offsets->isChecked(); + memoryDock->showOffsets(checked); + refreshVisibleDockWidgets(); } diff --git a/src/mainwindow.h b/src/mainwindow.h index 100be9e8..dae83baa 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -178,6 +178,8 @@ private slots: void on_actionDisplay_Pseudocode_triggered(); + void on_actionDisplay_Offsets_triggered(); + private: QDockWidget *asmDock; QDockWidget *calcDock; diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 01890e85..410f0032 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -159,7 +159,7 @@ border-top: 0px; 0 0 1013 - 25 + 20 @@ -173,8 +173,8 @@ border-top: 0px; 273 136 - 156 - 182 + 148 + 167 @@ -197,7 +197,7 @@ border-top: 0px; - + View @@ -217,6 +217,7 @@ border-top: 0px; + @@ -245,7 +246,7 @@ border-top: 0px; - + Windows @@ -267,9 +268,9 @@ border-top: 0px; - - + + @@ -921,26 +922,37 @@ QToolButton .svg-icon path { - - Show ESIL rather than assembly - - - true - + + true + + + Show ESIL rather than assembly + - - Show pseudocode rather than assembly - - - true - + + true + + + Show pseudocode rather than assembly + Entry points + + + true + + + true + + + Display offsets + + diff --git a/src/widgets/memorywidget.cpp b/src/widgets/memorywidget.cpp index d8e445c9..57ad7c2e 100644 --- a/src/widgets/memorywidget.cpp +++ b/src/widgets/memorywidget.cpp @@ -470,7 +470,7 @@ void MemoryWidget::replaceTextDisasm(QString txt) bool MemoryWidget::loadMoreDisassembly() { /* - * Add more disasm as the user scrolls +z * Add more disasm as the user scrolls * Not working properly when scrolling upwards * r2 doesn't handle properly 'pd-' for archs with variable instruction size */ @@ -2020,3 +2020,13 @@ void MemoryWidget::updateViews(RVA offset) } } } + +void MemoryWidget::showOffsets(bool show) { + if (show) { + this->hexOffsetText->show(); + main->core->config("asm.offset", 1); + } else { + this->hexOffsetText->hide(); + main->core->config("asm.offset", 0); + } +} diff --git a/src/widgets/memorywidget.h b/src/widgets/memorywidget.h index c9db0219..303c5f87 100644 --- a/src/widgets/memorywidget.h +++ b/src/widgets/memorywidget.h @@ -94,6 +94,8 @@ public slots: void updateViews(RVA offset = RVA_INVALID); + void showOffsets(bool show); + protected: void resizeEvent(QResizeEvent *event) override; bool eventFilter(QObject *obj, QEvent *event) override; diff --git a/src/widgets/memorywidget.ui b/src/widgets/memorywidget.ui index 9bc79b6d..2158f8e1 100644 --- a/src/widgets/memorywidget.ui +++ b/src/widgets/memorywidget.ui @@ -937,7 +937,7 @@ QToolTip { 0 - + 0 @@ -958,7 +958,7 @@ QToolTip { font: 11pt "Monaco"; } - + about:blank @@ -1233,16 +1233,16 @@ p, li { white-space: pre-wrap; } 0 - + Qt::DefaultContextMenu - + about:blank - + 1.000000000000000 @@ -1331,7 +1331,7 @@ border-top: 0px; 0 0 256 - 887 + 868 @@ -1635,7 +1635,7 @@ QToolTip { 0 - + 0 @@ -1654,7 +1654,7 @@ QToolTip { 250 - + qrc:/html/fcn_graph.html @@ -1684,7 +1684,7 @@ QToolTip { 0 - + 0 @@ -1703,7 +1703,7 @@ QToolTip { 250 - + qrc:/html/fcn_radar.html