all repos — mgba @ 35906b51fd30b829fe3d53a31b0b488e7b570773

mGBA Game Boy Advance Emulator

Qt: Add memory search type info
Vicki Pfau vi@endrift.com
Mon, 26 Jun 2017 11:08:27 -0700
commit

35906b51fd30b829fe3d53a31b0b488e7b570773

parent

b69cbd433d8a93d0679d9623118dfc4adff37aad

1 files changed, 22 insertions(+), 0 deletions(-)

jump to
M src/platform/qt/MemorySearch.cppsrc/platform/qt/MemorySearch.cpp

@@ -151,6 +151,7 @@ for (size_t i = 0; i < mCoreMemorySearchResultsSize(&m_results); ++i) {

mCoreMemorySearchResult* result = mCoreMemorySearchResultsGetPointer(&m_results, i); QTableWidgetItem* item = new QTableWidgetItem(QString("%1").arg(result->address, 8, 16, QChar('0'))); m_ui.results->setItem(i, 0, item); + QTableWidgetItem* type; if (m_ui.numHex->isChecked()) { switch (result->type) { case mCORE_MEMORY_SEARCH_8:

@@ -182,9 +183,30 @@ case mCORE_MEMORY_SEARCH_STRING:

item = new QTableWidgetItem("?"); // TODO } } + QString divisor; + if (result->guessDivisor > 1) { + divisor = tr(" (⅟%0×)").arg(result->guessDivisor); + } + switch (result->type) { + case mCORE_MEMORY_SEARCH_8: + type = new QTableWidgetItem(tr("1 byte%0").arg(divisor)); + break; + case mCORE_MEMORY_SEARCH_16: + type = new QTableWidgetItem(tr("2 bytes%0").arg(divisor)); + break; + case mCORE_MEMORY_SEARCH_GUESS: + case mCORE_MEMORY_SEARCH_32: + type = new QTableWidgetItem(tr("4 bytes%0").arg(divisor)); + break; + case mCORE_MEMORY_SEARCH_STRING: + item = new QTableWidgetItem("?"); // TODO + } m_ui.results->setItem(i, 1, item); + m_ui.results->setItem(i, 2, type); } m_ui.results->sortItems(0); + m_ui.results->resizeColumnsToContents(); + m_ui.results->resizeRowsToContents(); } void MemorySearch::openMemory() {