diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index 0607a23af..f90cc93b6 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -21,6 +21,7 @@ #include "core/3ds.h" #include "core/core.h" #include "core/frontend/scope_acquire_context.h" +#include "core/perf_stats.h" #include "core/settings.h" #include "input_common/keyboard.h" #include "input_common/main.h" @@ -55,6 +56,13 @@ void EmuThread::run() { emit LoadProgress(VideoCore::LoadCallbackStage::Complete, 0, 0); + if (Core::System::GetInstance().frame_limiter.IsFrameAdvancing()) { + // Usually the loading screen is hidden after the first frame is drawn. In this case + // we hide it immediately as we need to wait for user input to start the emulation. + emit HideLoadingScreen(); + Core::System::GetInstance().frame_limiter.WaitOnce(); + } + // Holds whether the cpu was running during the last iteration, // so that the DebugModeLeft signal can be emitted before the // next execution step. diff --git a/src/citra_qt/bootmanager.h b/src/citra_qt/bootmanager.h index 3dec9751b..38cd494ed 100644 --- a/src/citra_qt/bootmanager.h +++ b/src/citra_qt/bootmanager.h @@ -122,6 +122,8 @@ signals: void ErrorThrown(Core::System::ResultStatus, std::string); void LoadProgress(VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total); + + void HideLoadingScreen(); }; class OpenGLWindow : public QWindow { diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index aee6de481..edea64511 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -1048,6 +1048,8 @@ void GMainWindow::BootGame(const QString& filename) { connect(emu_thread.get(), &EmuThread::LoadProgress, loading_screen, &LoadingScreen::OnLoadProgress, Qt::QueuedConnection); + connect(emu_thread.get(), &EmuThread::HideLoadingScreen, loading_screen, + &LoadingScreen::OnLoadComplete); // Update the GUI registersWidget->OnDebugModeEntered(); @@ -1082,6 +1084,13 @@ void GMainWindow::BootGame(const QString& filename) { movie_record_author.clear(); } + if (ui->action_Enable_Frame_Advancing->isChecked()) { + ui->action_Advance_Frame->setEnabled(true); + Core::System::GetInstance().frame_limiter.SetFrameAdvancing(true); + } else { + ui->action_Advance_Frame->setEnabled(false); + } + if (video_dumping_on_start) { Layout::FramebufferLayout layout{ Layout::FrameLayoutFromResolutionScale(VideoCore::GetResolutionScaleFactor())}; @@ -1155,8 +1164,6 @@ void GMainWindow::ShutdownGame() { ui->action_Load_Amiibo->setEnabled(false); ui->action_Remove_Amiibo->setEnabled(false); ui->action_Report_Compatibility->setEnabled(false); - ui->action_Enable_Frame_Advancing->setEnabled(false); - ui->action_Enable_Frame_Advancing->setChecked(false); ui->action_Advance_Frame->setEnabled(false); ui->action_Capture_Screenshot->setEnabled(false); render_window->hide(); @@ -1564,7 +1571,6 @@ void GMainWindow::OnStartGame() { ui->action_Cheats->setEnabled(true); ui->action_Load_Amiibo->setEnabled(true); ui->action_Report_Compatibility->setEnabled(true); - ui->action_Enable_Frame_Advancing->setEnabled(true); ui->action_Capture_Screenshot->setEnabled(true); discord_rpc->Update(); diff --git a/src/citra_qt/main.ui b/src/citra_qt/main.ui index 5d2d4f0ca..e192f1062 100644 --- a/src/citra_qt/main.ui +++ b/src/citra_qt/main.ui @@ -349,9 +349,6 @@ true - - false - Enable Frame Advancing diff --git a/src/core/perf_stats.cpp b/src/core/perf_stats.cpp index e5b01f086..5db1df403 100644 --- a/src/core/perf_stats.cpp +++ b/src/core/perf_stats.cpp @@ -169,6 +169,10 @@ void FrameLimiter::DoFrameLimiting(microseconds current_system_time_us) { previous_walltime = now; } +bool FrameLimiter::IsFrameAdvancing() const { + return frame_advancing_enabled; +} + void FrameLimiter::SetFrameAdvancing(bool value) { const bool was_enabled = frame_advancing_enabled.exchange(value); if (was_enabled && !value) { diff --git a/src/core/perf_stats.h b/src/core/perf_stats.h index 9038e4ca2..e90c4c1ac 100644 --- a/src/core/perf_stats.h +++ b/src/core/perf_stats.h @@ -90,6 +90,7 @@ public: void DoFrameLimiting(std::chrono::microseconds current_system_time_us); + bool IsFrameAdvancing() const; /** * Sets whether frame advancing is enabled or not. * Note: The frontend must cancel frame advancing before shutting down in order