MCPcopy Create free account
hub / github.com/clementgallet/libTAS / slotNew

Method slotNew

src/program/ui/RamSearchWindow.cpp:273–315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

271}
272
273void RamSearchWindow::slotNew()
274{
275 if (isSearching)
276 return;
277
278 if (context->status != Context::ACTIVE)
279 return;
280
281 /* If there are results, then clear the current scan and enable all boxes */
282 if (ramSearchModel->scanSize() > 0) {
283 newButton->setText(tr("New"));
284 memGroupBox->setDisabled(false);
285 formatGroupBox->setDisabled(false);
286 ramSearchModel->clear();
287 watchCount->setText("");
288 searchProgress->reset();
289 searchButton->setDisabled(true);
290 return;
291 }
292
293 isSearching = true;
294
295 /* Disable buttons during the process */
296 newButton->setDisabled(true);
297 searchButton->setDisabled(true);
298 stopButton->setDisabled(false);
299
300 /* Build the memory region flag variable */
301 int memflags = 0;
302 if (memSpecialBox->isChecked())
303 memflags |= MemSection::MemNoSpecial;
304 if (memROBox->isChecked())
305 memflags |= MemSection::MemNoRO;
306 if (memExecBox->isChecked())
307 memflags |= MemSection::MemNoExec;
308
309 searchProgress->reset();
310 searchProgress->setMaximum(ramSearchModel->predictScanCount(memflags));
311
312 /* Start the actual scan search on a thread */
313 std::thread t(&RamSearchWindow::threadedNew, this, memflags);
314 t.detach();
315}
316
317void RamSearchWindow::threadedNew(int memflags)
318{

Callers

nothing calls this directly

Calls 4

scanSizeMethod · 0.80
predictScanCountMethod · 0.80
clearMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected