mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2024-12-23 19:46:44 +00:00
citra_qt: Allow enabling frame advance before emulation start
Effectively allows starting emulation as paused.
This commit is contained in:
parent
d6b64f6b09
commit
e60e20666e
|
@ -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.
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -349,9 +349,6 @@
|
|||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable Frame Advancing</string>
|
||||
</property>
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue