diff --git a/src/platform/qt/MemorySearch.cpp b/src/platform/qt/MemorySearch.cpp index 82dae23be..d52cdf3c3 100644 --- a/src/platform/qt/MemorySearch.cpp +++ b/src/platform/qt/MemorySearch.cpp @@ -9,6 +9,7 @@ #include #include "GameController.h" +#include "MemoryView.h" using namespace QGBA; @@ -24,6 +25,7 @@ MemorySearch::MemorySearch(GameController* controller, QWidget* parent) connect(m_ui.refresh, &QPushButton::clicked, this, &MemorySearch::refresh); connect(m_ui.numHex, &QPushButton::clicked, this, &MemorySearch::refresh); connect(m_ui.numDec, &QPushButton::clicked, this, &MemorySearch::refresh); + connect(m_ui.viewMem, &QPushButton::clicked, this, &MemorySearch::openMemory); } MemorySearch::~MemorySearch() { @@ -185,3 +187,19 @@ void MemorySearch::refresh() { } m_ui.results->sortItems(0); } + +void MemorySearch::openMemory() { + auto items = m_ui.results->selectedItems(); + if (items.empty()) { + return; + } + QTableWidgetItem* item = items[0]; + uint32_t address = item->text().toUInt(nullptr, 16); + + MemoryView* memView = new MemoryView(m_controller); + memView->jumpToAddress(address); + + connect(m_controller, &GameController::gameStopped, memView, &QWidget::close); + memView->setAttribute(Qt::WA_DeleteOnClose); + memView->show(); +} diff --git a/src/platform/qt/MemorySearch.h b/src/platform/qt/MemorySearch.h index 3ca37c34c..65f365f44 100644 --- a/src/platform/qt/MemorySearch.h +++ b/src/platform/qt/MemorySearch.h @@ -28,6 +28,9 @@ public slots: void search(); void searchWithin(); +private slots: + void openMemory(); + private: bool createParams(mCoreMemorySearchParams*); diff --git a/src/platform/qt/MemorySearch.ui b/src/platform/qt/MemorySearch.ui index 9b8e57460..ccd7a05e9 100644 --- a/src/platform/qt/MemorySearch.ui +++ b/src/platform/qt/MemorySearch.ui @@ -28,6 +28,9 @@ 0 + + QAbstractItemView::NoEditTriggers + QAbstractItemView::SelectRows @@ -194,11 +197,8 @@ - - false - - View in Memory View + Open in Memory Viewer diff --git a/src/platform/qt/MemoryView.h b/src/platform/qt/MemoryView.h index 9882ce32b..04a492ca9 100644 --- a/src/platform/qt/MemoryView.h +++ b/src/platform/qt/MemoryView.h @@ -22,6 +22,7 @@ public: public slots: void update(); + void jumpToAddress(uint32_t address) { m_ui.hexfield->jumpToAddress(address); } private slots: void setIndex(int);