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

Method emuCheck

gui/qt/mainwindow.cpp:2315–2354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2313}
2314
2315void MainWindow::emuCheck(emu_state_t state, emu_data_t type) {
2316
2317 /* don't need to do anything if just loading ram */
2318 if (type == EMU_DATA_RAM && state == EMU_STATE_VALID) {
2319 guiEmuValid = true;
2320 return;
2321 }
2322
2323 /* verify emulation state */
2324 switch (state) {
2325 case EMU_STATE_VALID:
2326 break;
2327 case EMU_STATE_NOT_A_CE:
2328 if (QMessageBox::Yes == QMessageBox::question(this, MSG_WARNING, tr("Image does not appear to be from a CE. Do you want to attempt to load it anyway? "
2329 "This may cause instability."), QMessageBox::Yes|QMessageBox::No)) {
2330 state = EMU_STATE_VALID;
2331 }
2332 break;
2333 case EMU_STATE_INVALID:
2334 if (type == EMU_DATA_IMAGE) {
2335 console(QStringLiteral("[CEmu] Failed loading image, falling back to ROM.\n"), EmuThread::ConsoleErr);
2336 emu.load(EMU_DATA_ROM, m_pathRom);
2337 }
2338 break;
2339 }
2340
2341 if (state == EMU_STATE_VALID) {
2342 ui->lcd->setMain();
2343 setKeypadColor(m_config->value(SETTING_KEYPAD_COLOR, get_device_type() ? KEYPAD_WHITE : KEYPAD_BLACK).toUInt());
2344 for (const auto &dock : findChildren<DockWidget*>()) {
2345 if (dock->windowTitle() == TXT_VISUALIZER_DOCK) {
2346 static_cast<VisualizerWidget*>(dock->widget())->forceUpdate();
2347 }
2348 }
2349 emu.start();
2350 guiEmuValid = true;
2351 }
2352
2353 guiReset = false;
2354}
2355
2356void MainWindow::emuLoad(emu_data_t type) {
2357 guiEmuValid = false;

Callers

nothing calls this directly

Calls 3

loadMethod · 0.80
setMainMethod · 0.80
forceUpdateMethod · 0.80

Tested by

no test coverage detected