Qt/CheatManager: Only display first 5000 search results

This commit is contained in:
Connor McLaughlin 2020-10-21 21:36:13 +10:00
parent 2f5cf91d11
commit a83439fd35
2 changed files with 16 additions and 0 deletions

View file

@ -670,6 +670,15 @@ void CheatManagerDialog::updateResults()
int row = 0; int row = 0;
for (const MemoryScan::Result& res : m_scanner.GetResults()) for (const MemoryScan::Result& res : m_scanner.GetResults())
{ {
if (row == MAX_DISPLAYED_SCAN_RESULTS)
{
QMessageBox::information(this, tr("Memory Scan"),
tr("Memory scan found %1 addresses, but only the first %2 are displayed.")
.arg(m_scanner.GetResultCount())
.arg(MAX_DISPLAYED_SCAN_RESULTS));
break;
}
m_ui.scanTable->insertRow(row); m_ui.scanTable->insertRow(row);
QTableWidgetItem* address_item = new QTableWidgetItem(formatHexValue(res.address)); QTableWidgetItem* address_item = new QTableWidgetItem(formatHexValue(res.address));
@ -706,6 +715,8 @@ void CheatManagerDialog::updateResultsValues()
} }
row++; row++;
if (row == MAX_DISPLAYED_SCAN_RESULTS)
break;
} }
} }

View file

@ -49,6 +49,11 @@ private Q_SLOTS:
void updateScanUi(); void updateScanUi();
private: private:
enum : int
{
MAX_DISPLAYED_SCAN_RESULTS = 5000
};
void setupAdditionalUi(); void setupAdditionalUi();
void connectUi(); void connectUi();
void setUpdateTimerEnabled(bool enabled); void setUpdateTimerEnabled(bool enabled);