mirror of https://github.com/mgba-emu/mgba.git
Qt: Hook up memory search to viewer
This commit is contained in:
parent
bd9a9e445e
commit
77cf869941
|
@ -9,6 +9,7 @@
|
||||||
#include <mgba/core/core.h>
|
#include <mgba/core/core.h>
|
||||||
|
|
||||||
#include "GameController.h"
|
#include "GameController.h"
|
||||||
|
#include "MemoryView.h"
|
||||||
|
|
||||||
using namespace QGBA;
|
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.refresh, &QPushButton::clicked, this, &MemorySearch::refresh);
|
||||||
connect(m_ui.numHex, &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.numDec, &QPushButton::clicked, this, &MemorySearch::refresh);
|
||||||
|
connect(m_ui.viewMem, &QPushButton::clicked, this, &MemorySearch::openMemory);
|
||||||
}
|
}
|
||||||
|
|
||||||
MemorySearch::~MemorySearch() {
|
MemorySearch::~MemorySearch() {
|
||||||
|
@ -185,3 +187,19 @@ void MemorySearch::refresh() {
|
||||||
}
|
}
|
||||||
m_ui.results->sortItems(0);
|
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();
|
||||||
|
}
|
||||||
|
|
|
@ -28,6 +28,9 @@ public slots:
|
||||||
void search();
|
void search();
|
||||||
void searchWithin();
|
void searchWithin();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void openMemory();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool createParams(mCoreMemorySearchParams*);
|
bool createParams(mCoreMemorySearchParams*);
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="editTriggers">
|
||||||
|
<set>QAbstractItemView::NoEditTriggers</set>
|
||||||
|
</property>
|
||||||
<property name="selectionBehavior">
|
<property name="selectionBehavior">
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
</property>
|
</property>
|
||||||
|
@ -194,11 +197,8 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="viewMem">
|
<widget class="QPushButton" name="viewMem">
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>View in Memory View</string>
|
<string>Open in Memory Viewer</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -22,6 +22,7 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void update();
|
void update();
|
||||||
|
void jumpToAddress(uint32_t address) { m_ui.hexfield->jumpToAddress(address); }
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void setIndex(int);
|
void setIndex(int);
|
||||||
|
|
Loading…
Reference in New Issue