diff --git a/pcsx2-qt/MainWindow.cpp b/pcsx2-qt/MainWindow.cpp index f451a574c6..f8191ad59e 100644 --- a/pcsx2-qt/MainWindow.cpp +++ b/pcsx2-qt/MainWindow.cpp @@ -99,6 +99,11 @@ static QString s_current_disc_serial; static quint32 s_current_disc_crc; static quint32 s_current_running_crc; +static bool record_on_start = false; +static bool filename_set = false; +static QString path_to_recording_for_record_on_start; + + MainWindow::MainWindow() { pxAssert(!g_main_window); @@ -724,7 +729,49 @@ void MainWindow::updateAdvancedSettingsVisibility() void MainWindow::onVideoCaptureToggled(bool checked) { if (!s_vm_valid) + { + if (!record_on_start) + { + QMessageBox msgbox(this); + msgbox.setIcon(QMessageBox::Question); + msgbox.setWindowIcon(QtHost::GetAppIcon()); + msgbox.setWindowTitle(tr("Record On Boot")); + msgbox.setWindowModality(Qt::WindowModal); + msgbox.setText(tr("Did you want to start recording on boot?")); + msgbox.addButton(QMessageBox::Yes); + msgbox.addButton(QMessageBox::No); + msgbox.setDefaultButton(QMessageBox::Yes); + if (msgbox.exec() == QMessageBox::Yes) + { + const QString container(QString::fromStdString( + Host::GetStringSettingValue("EmuCore/GS", "CaptureContainer", Pcsx2Config::GSOptions::DEFAULT_CAPTURE_CONTAINER))); + const QString filter(tr("%1 Files (*.%2)").arg(container.toUpper()).arg(container)); + + QString temp(QStringLiteral("%1.%2").arg(QString::fromStdString(GSGetBaseVideoFilename())).arg(container)); + temp = QDir::toNativeSeparators(QFileDialog::getSaveFileName(this, tr("Video Capture"), temp, filter)); + path_to_recording_for_record_on_start = temp; + if (path_to_recording_for_record_on_start.isEmpty()) + return; + record_on_start = true; + } + + } + else + { + QMessageBox msgbox(this); + msgbox.setIcon(QMessageBox::Question); + msgbox.setWindowIcon(QtHost::GetAppIcon()); + msgbox.setWindowTitle(tr("Record On Boot")); + msgbox.setWindowModality(Qt::WindowModal); + msgbox.setText(tr("Did you want to cancel recording on boot?")); + msgbox.addButton(QMessageBox::Yes); + msgbox.addButton(QMessageBox::No); + msgbox.setDefaultButton(QMessageBox::Yes); + if (msgbox.exec() == QMessageBox::Yes) + record_on_start = false; + } return; + } // Reset the checked state, we'll get updated by the GS thread. QSignalBlocker sb(m_ui.actionVideoCapture); @@ -736,16 +783,31 @@ void MainWindow::onVideoCaptureToggled(bool checked) return; } - const QString container(QString::fromStdString( - Host::GetStringSettingValue("EmuCore/GS", "CaptureContainer", Pcsx2Config::GSOptions::DEFAULT_CAPTURE_CONTAINER))); - const QString filter(tr("%1 Files (*.%2)").arg(container.toUpper()).arg(container)); + if (record_on_start && !path_to_recording_for_record_on_start.isEmpty()) + { + QMessageBox msgbox2(this); + msgbox2.setIcon(QMessageBox::Question); + msgbox2.setWindowIcon(QtHost::GetAppIcon()); + msgbox2.setWindowTitle(tr("Recording Notification")); + msgbox2.setText("Recording will start in a moment"); + msgbox2.setStandardButtons(QMessageBox::NoButton); + QTimer::singleShot(2000, &msgbox2, &QMessageBox::accept); + msgbox2.exec(); + g_emu_thread->beginCapture(path_to_recording_for_record_on_start); + } + else + { + const QString container(QString::fromStdString( + Host::GetStringSettingValue("EmuCore/GS", "CaptureContainer", Pcsx2Config::GSOptions::DEFAULT_CAPTURE_CONTAINER))); + const QString filter(tr("%1 Files (*.%2)").arg(container.toUpper()).arg(container)); - QString path(QStringLiteral("%1.%2").arg(QString::fromStdString(GSGetBaseVideoFilename())).arg(container)); - path = QDir::toNativeSeparators(QFileDialog::getSaveFileName(this, tr("Video Capture"), path, filter)); - if (path.isEmpty()) - return; - - g_emu_thread->beginCapture(path); + QString path(QStringLiteral("%1.%2").arg(QString::fromStdString(GSGetBaseVideoFilename())).arg(container)); + path = QDir::toNativeSeparators(QFileDialog::getSaveFileName(this, tr("Video Capture"), path, filter)); + if (path.isEmpty()) + return; + g_emu_thread->beginCapture(path); + } + } void MainWindow::onCaptureStarted(const QString& filename) @@ -890,8 +952,6 @@ void MainWindow::updateEmulationActions(bool starting, bool running, bool stoppi m_ui.actionToolbarSaveState->setEnabled(running); m_ui.actionViewGameProperties->setEnabled(running); - - m_ui.actionVideoCapture->setEnabled(running); if (!running && m_ui.actionVideoCapture->isChecked()) { QSignalBlocker sb(m_ui.actionVideoCapture); @@ -1962,6 +2022,12 @@ void MainWindow::onVMStarted() updateWindowTitle(); updateStatusBarWidgetVisibility(); updateInputRecordingActions(true); + if (record_on_start) + { + m_ui.actionVideoCapture->setEnabled(true); + m_ui.actionVideoCapture->setChecked(true); + record_on_start = false; + } } void MainWindow::onVMPaused() diff --git a/pcsx2/windows/RCa08632 b/pcsx2/windows/RCa08632 new file mode 100644 index 0000000000..905b911dc9 Binary files /dev/null and b/pcsx2/windows/RCa08632 differ diff --git a/pcsx2/windows/RCb08632 b/pcsx2/windows/RCb08632 new file mode 100644 index 0000000000..905b911dc9 Binary files /dev/null and b/pcsx2/windows/RCb08632 differ diff --git a/pcsx2/windows/RDa08632 b/pcsx2/windows/RDa08632 new file mode 100644 index 0000000000..00a61eb803 Binary files /dev/null and b/pcsx2/windows/RDa08632 differ