FIFOPlayerWindow::FIFOPlayerWindow(QWidget* parent) : QDialog(parent) { setWindowTitle(tr("FIFO Player")); CreateWidgets(); ConnectWidgets(); UpdateInfo(); UpdateControls(); FifoPlayer::GetInstance().SetFileLoadedCallback( [this] { QueueOnObject(this, &FIFOPlayerWindow::OnFIFOLoaded); }); FifoPlayer::GetInstance().SetFrameWrittenCallback([this] { QueueOnObject(this, [this] { UpdateInfo(); UpdateControls(); }); }); connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this](Core::State state) { if (state == Core::State::Running) OnEmulationStarted(); else if (state == Core::State::Uninitialized) OnEmulationStopped(); }); }
void MainWindow::OnImportNANDBackup() { auto response = QMessageBox::question( this, tr("Question"), tr("Merging a new NAND over your currently selected NAND will overwrite any channels " "and savegames that already exist. This process is not reversible, so it is " "recommended that you keep backups of both NANDs. Are you sure you want to " "continue?")); if (response == QMessageBox::No) return; QString file = QFileDialog::getOpenFileName(this, tr("Select the save file"), QDir::currentPath(), tr("BootMii NAND backup file (*.bin);;" "All Files (*)")); if (file.isEmpty()) return; QProgressDialog* dialog = new QProgressDialog(this); dialog->setMinimum(0); dialog->setMaximum(0); dialog->setLabelText(tr("Importing NAND backup")); dialog->setCancelButton(nullptr); auto beginning = QDateTime::currentDateTime().toMSecsSinceEpoch(); auto result = std::async(std::launch::async, [&] { DiscIO::NANDImporter().ImportNANDBin( file.toStdString(), [&dialog, beginning] { QueueOnObject(dialog, [&dialog, beginning] { dialog->setLabelText( tr("Importing NAND backup\n Time elapsed: %1s") .arg((QDateTime::currentDateTime().toMSecsSinceEpoch() - beginning) / 1000)); }); }, [this] { return RunOnObject(this, [this] { return QFileDialog::getOpenFileName(this, tr("Select the keys file (OTP/SEEPROM dump)"), QDir::currentPath(), tr("BootMii keys file (*.bin);;" "All Files (*)")) .toStdString(); }); }); QueueOnObject(dialog, &QProgressDialog::close); }); dialog->exec(); result.wait(); m_menu_bar->UpdateToolsMenu(Core::IsRunning()); }
Settings::Settings() { qRegisterMetaType<Core::State>(); Core::SetOnStateChangedCallback([this](Core::State new_state) { QueueOnObject(this, [this, new_state] { emit EmulationStateChanged(new_state); }); }); Config::AddConfigChangedCallback( [this] { QueueOnObject(this, [this] { emit ConfigChanged(); }); }); SetCurrentUserStyle(GetCurrentUserStyle()); }
void FIFOPlayerWindow::StartRecording() { // Start recording FifoRecorder::GetInstance().StartRecording(m_frame_record_count->value(), [this] { QueueOnObject(this, [this] { OnRecordingDone(); }); }); UpdateControls(); UpdateInfo(); }
void TASInputWindow::GetButton(TASCheckBox* checkbox, UX& buttons, UX mask) { const bool pressed = (buttons & mask) != 0; if (m_use_controller->isChecked()) { if (pressed) { m_checkbox_set_by_controller[checkbox] = true; QueueOnObject(checkbox, [checkbox] { checkbox->setChecked(true); }); } else if (m_checkbox_set_by_controller.count(checkbox) && m_checkbox_set_by_controller[checkbox]) { m_checkbox_set_by_controller[checkbox] = false; QueueOnObject(checkbox, [checkbox] { checkbox->setChecked(false); }); } } if (checkbox->GetValue()) buttons |= mask; else buttons &= ~mask; }
void TASInputWindow::GetSpinBoxU16(QSpinBox* spin, u16& controller_value) { if (m_use_controller->isChecked()) { if (!m_spinbox_most_recent_values_u16.count(spin) || m_spinbox_most_recent_values_u16[spin] != controller_value) QueueOnObject(spin, [spin, controller_value] { spin->setValue(controller_value); }); m_spinbox_most_recent_values_u16[spin] = controller_value; } else { m_spinbox_most_recent_values_u16.clear(); } controller_value = spin->value(); }
void Host::RequestNotifyMapLoaded() { QueueOnObject(QApplication::instance(), [this] { emit NotifyMapLoaded(); }); }
void Host_UpdateDisasmDialog() { QueueOnObject(QApplication::instance(), [] { emit Host::GetInstance()->UpdateDisasmDialog(); }); }