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

Method setCalcId

gui/qt/debugger.cpp:2858–2886  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2856}
2857
2858void MainWindow::setCalcId() {
2859 bool ok = true;
2860 const uint8_t *data = mem.flash.block;
2861 const uint16_t subSize = 5;
2862 const uint8_t *contents = nullptr;
2863 uint32_t offset = 0x3B0001;
2864 uint32_t size;
2865
2866 /* Outer field. */
2867 static const uint16_t path[] = { 0x0330, 0x0400 };
2868
2869 ok = !cert_field_find_path(data + offset, SIZE_FLASH_SECTOR_64K, path, 2, &contents, &size);
2870
2871 if (!ok) {
2872 QMessageBox::warning(this, MSG_WARNING, tr("Cannot locate calculator ID in the certificate. This is usually due to an improper ROM dump. Please try another ROM dump using a physical calculator."));
2873 } else {
2874 uint32_t field_offset = contents - mem.flash.block;
2875 uint8_t *ptr = mem.flash.block + field_offset;
2876 QByteArray array(reinterpret_cast<const char*>(ptr), subSize);
2877 QString str = QString(array.toHex());
2878
2879 QString id = QInputDialog::getText(this, tr("CEmu Change Certificate ID"), tr("Old ID: ") + str, QLineEdit::Normal, Q_NULLPTR, &ok);
2880
2881 if (ok && id.length() == 10) {
2882 QByteArray ba = QByteArray::fromHex(id.toLatin1());
2883 memcpy(ptr, ba.data(), subSize);
2884 }
2885 }
2886}

Callers

nothing calls this directly

Calls 3

cert_field_find_pathFunction · 0.85
QStringClass · 0.85
dataMethod · 0.45

Tested by

no test coverage detected