MCPcopy Create free account
hub / github.com/CE-Programming/CEmu / autotesterRefreshCRC

Method autotesterRefreshCRC

gui/qt/mainwindow.cpp:2265–2297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2263}
2264
2265void MainWindow::autotesterRefreshCRC() {
2266 QLineEdit *startCRC = ui->startCRC;
2267 QLineEdit *sizeCRC = ui->sizeCRC;
2268
2269 startCRC->setText(startCRC->text().trimmed());
2270 sizeCRC->setText(sizeCRC->text().trimmed());
2271
2272 if (startCRC->text().isEmpty() || sizeCRC->text().isEmpty()) {
2273 QMessageBox::critical(this, MSG_ERROR, tr("Make sure you have entered a valid start/size pair or preset."));
2274 return;
2275 }
2276
2277 // Get GUI values
2278 bool ok1, ok2; // catch conversion issues
2279 uint32_t tmp_start = startCRC->text().toUInt(&ok1, 0);
2280 int32_t crc_size = sizeCRC->text().toInt(&ok2, 0);
2281 if (!ok1 || !ok2) {
2282 QMessageBox::critical(this, MSG_ERROR, tr("Could not convert those values into numbers"));
2283 return;
2284 }
2285
2286 // Get real start pointer
2287 void* start = virt_mem_dup(tmp_start, crc_size);
2288 if (!start) {
2289 QMessageBox::critical(this, MSG_ERROR, tr("Could not retrieve this memory chunk"));
2290 return;
2291 }
2292
2293 // Compute and display CRC
2294 ui->valueCRC->setText(int2hex(crc32(start, static_cast<size_t>(crc_size)), 8));
2295 ui->valueCRC->repaint();
2296 free(start);
2297}
2298
2299void MainWindow::resetEmu() {
2300 guiReset = true;

Callers

nothing calls this directly

Calls 3

virt_mem_dupFunction · 0.85
int2hexFunction · 0.85
crc32Function · 0.85

Tested by

no test coverage detected