From f8e9e459fee0faf56ad55119d236e58663f0f195 Mon Sep 17 00:00:00 2001 From: OpenSauce04 Date: Tue, 6 Aug 2024 21:28:21 +0100 Subject: [PATCH] Changed how pausing the emulator is handled to allow frame advancing Where previously the emulator thread was halted, frame advancing mode is now enabled instead This commit also removes the "Enable Frame Advancing" option due to being obsolete --- src/citra_qt/main.cpp | 26 +++++++------------------- src/citra_qt/main.ui | 17 +---------------- 2 files changed, 8 insertions(+), 35 deletions(-) diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 5b7e1626f..704ab7ee6 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -636,8 +636,6 @@ void GMainWindow::InitializeHotkeys() { link_action_shortcut(ui->action_Screen_Layout_Swap_Screens, QStringLiteral("Swap Screens")); link_action_shortcut(ui->action_Screen_Layout_Upright_Screens, QStringLiteral("Rotate Screens Upright")); - link_action_shortcut(ui->action_Enable_Frame_Advancing, - QStringLiteral("Toggle Frame Advancing")); link_action_shortcut(ui->action_Advance_Frame, QStringLiteral("Advance Frame")); link_action_shortcut(ui->action_Load_from_Newest_Slot, QStringLiteral("Load from Newest Slot")); link_action_shortcut(ui->action_Save_to_Oldest_Slot, QStringLiteral("Save to Oldest Slot")); @@ -932,16 +930,8 @@ void GMainWindow::ConnectMenuEvents() { connect_menu(ui->action_Save_Movie, &GMainWindow::OnSaveMovie); connect_menu(ui->action_Movie_Read_Only_Mode, [this](bool checked) { movie.SetReadOnly(checked); }); - connect_menu(ui->action_Enable_Frame_Advancing, [this] { - if (emulation_running) { - system.frame_limiter.SetFrameAdvancing(ui->action_Enable_Frame_Advancing->isChecked()); - ui->action_Advance_Frame->setEnabled(ui->action_Enable_Frame_Advancing->isChecked()); - } - }); connect_menu(ui->action_Advance_Frame, [this] { if (emulation_running && system.frame_limiter.IsFrameAdvancing()) { - ui->action_Enable_Frame_Advancing->setChecked(true); - ui->action_Advance_Frame->setEnabled(true); system.frame_limiter.AdvanceFrame(); } }); @@ -966,7 +956,8 @@ void GMainWindow::ConnectMenuEvents() { } void GMainWindow::UpdateMenuState() { - const bool is_paused = !emu_thread || !emu_thread->IsRunning(); + const bool is_paused = + !emu_thread || !emu_thread->IsRunning() || system.frame_limiter.IsFrameAdvancing(); const std::array running_actions{ ui->action_Stop, @@ -984,6 +975,7 @@ void GMainWindow::UpdateMenuState() { } ui->action_Capture_Screenshot->setEnabled(emulation_running); + ui->action_Advance_Frame->setEnabled(emulation_running && is_paused); if (emulation_running && is_paused) { ui->action_Pause->setText(tr("&Continue")); @@ -1351,12 +1343,7 @@ void GMainWindow::BootGame(const QString& filename) { movie_playback_path.clear(); } - if (ui->action_Enable_Frame_Advancing->isChecked()) { - ui->action_Advance_Frame->setEnabled(true); - system.frame_limiter.SetFrameAdvancing(true); - } else { - ui->action_Advance_Frame->setEnabled(false); - } + ui->action_Advance_Frame->setEnabled(false); if (video_dumping_on_start) { StartVideoDumping(video_dumping_path); @@ -2234,6 +2221,7 @@ void GMainWindow::OnStartGame() { PreventOSSleep(); emu_thread->SetRunning(true); + system.frame_limiter.SetFrameAdvancing(false); graphics_api_button->setEnabled(false); qRegisterMetaType("Core::System::ResultStatus"); qRegisterMetaType("std::string"); @@ -2263,7 +2251,7 @@ void GMainWindow::OnRestartGame() { } void GMainWindow::OnPauseGame() { - emu_thread->SetRunning(false); + system.frame_limiter.SetFrameAdvancing(true); qt_cameras->PauseCameras(); play_time_manager->Stop(); @@ -2278,7 +2266,7 @@ void GMainWindow::OnPauseGame() { void GMainWindow::OnPauseContinueGame() { if (emulation_running) { - if (emu_thread->IsRunning()) { + if (emu_thread->IsRunning() && !system.frame_limiter.IsFrameAdvancing()) { OnPauseGame(); } else { OnStartGame(); diff --git a/src/citra_qt/main.ui b/src/citra_qt/main.ui index f88f67fd4..2bebdbba3 100644 --- a/src/citra_qt/main.ui +++ b/src/citra_qt/main.ui @@ -182,15 +182,8 @@ - - - Frame Advance - - - - + - @@ -404,14 +397,6 @@ Read-Only Mode - - - true - - - Enable Frame Advancing - - false