mirror of
https://github.com/PabloMK7/citra.git
synced 2024-11-24 07:40:21 +01:00
Run screenshot capture function in paused state by capturing next frame (#116)
* Allow screenshot capture in paused state by unpausing to capture next frame * Change `QMessageBox::No` to `QMessageBox::Yes` * Fix formatting * Fix formatting
This commit is contained in:
parent
54aee70e68
commit
e15d4c0d4a
@ -974,7 +974,7 @@ void GMainWindow::UpdateMenuState() {
|
|||||||
action->setEnabled(emulation_running);
|
action->setEnabled(emulation_running);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->action_Capture_Screenshot->setEnabled(emulation_running && !is_paused);
|
ui->action_Capture_Screenshot->setEnabled(emulation_running);
|
||||||
|
|
||||||
if (emulation_running && is_paused) {
|
if (emulation_running && is_paused) {
|
||||||
ui->action_Pause->setText(tr("&Continue"));
|
ui->action_Pause->setText(tr("&Continue"));
|
||||||
@ -2412,15 +2412,25 @@ void GMainWindow::OnSaveMovie() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnCaptureScreenshot() {
|
void GMainWindow::OnCaptureScreenshot() {
|
||||||
if (!emu_thread || !emu_thread->IsRunning()) [[unlikely]] {
|
if (!emu_thread) [[unlikely]] {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool was_running = emu_thread->IsRunning();
|
||||||
|
|
||||||
|
if (was_running ||
|
||||||
|
(QMessageBox::question(
|
||||||
|
this, tr("Game will unpause"),
|
||||||
|
tr("The game will be unpaused, and the next frame will be captured. Is this okay?"),
|
||||||
|
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes)) {
|
||||||
|
if (was_running) {
|
||||||
OnPauseGame();
|
OnPauseGame();
|
||||||
|
}
|
||||||
std::string path = UISettings::values.screenshot_path.GetValue();
|
std::string path = UISettings::values.screenshot_path.GetValue();
|
||||||
if (!FileUtil::IsDirectory(path)) {
|
if (!FileUtil::IsDirectory(path)) {
|
||||||
if (!FileUtil::CreateFullPath(path)) {
|
if (!FileUtil::CreateFullPath(path)) {
|
||||||
QMessageBox::information(this, tr("Invalid Screenshot Directory"),
|
QMessageBox::information(
|
||||||
|
this, tr("Invalid Screenshot Directory"),
|
||||||
tr("Cannot create specified screenshot directory. Screenshot "
|
tr("Cannot create specified screenshot directory. Screenshot "
|
||||||
"path is set back to its default value."));
|
"path is set back to its default value."));
|
||||||
path = FileUtil::GetUserPath(FileUtil::UserPath::UserDir);
|
path = FileUtil::GetUserPath(FileUtil::UserPath::UserDir);
|
||||||
@ -2431,15 +2441,19 @@ void GMainWindow::OnCaptureScreenshot() {
|
|||||||
|
|
||||||
static QRegularExpression expr(QStringLiteral("[\\/:?\"<>|]"));
|
static QRegularExpression expr(QStringLiteral("[\\/:?\"<>|]"));
|
||||||
const std::string filename = game_title.remove(expr).toStdString();
|
const std::string filename = game_title.remove(expr).toStdString();
|
||||||
const std::string timestamp =
|
const std::string timestamp = QDateTime::currentDateTime()
|
||||||
QDateTime::currentDateTime().toString(QStringLiteral("dd.MM.yy_hh.mm.ss.z")).toStdString();
|
.toString(QStringLiteral("dd.MM.yy_hh.mm.ss.z"))
|
||||||
|
.toStdString();
|
||||||
path.append(fmt::format("/{}_{}.png", filename, timestamp));
|
path.append(fmt::format("/{}_{}.png", filename, timestamp));
|
||||||
|
|
||||||
auto* const screenshot_window = secondary_window->HasFocus() ? secondary_window : render_window;
|
auto* const screenshot_window =
|
||||||
screenshot_window->CaptureScreenshot(UISettings::values.screenshot_resolution_factor.GetValue(),
|
secondary_window->HasFocus() ? secondary_window : render_window;
|
||||||
|
screenshot_window->CaptureScreenshot(
|
||||||
|
UISettings::values.screenshot_resolution_factor.GetValue(),
|
||||||
QString::fromStdString(path));
|
QString::fromStdString(path));
|
||||||
OnStartGame();
|
OnStartGame();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GMainWindow::OnDumpVideo() {
|
void GMainWindow::OnDumpVideo() {
|
||||||
if (DynamicLibrary::FFmpeg::LoadFFmpeg()) {
|
if (DynamicLibrary::FFmpeg::LoadFFmpeg()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user