move Movie::DoFrameStep to Core::DoFrameStep

This commit is contained in:
Michael M 2017-07-01 13:17:18 -07:00
parent 030dc11c6e
commit d217e797f2
6 changed files with 29 additions and 27 deletions

View File

@ -103,6 +103,7 @@ static StoppedCallbackFunc s_on_stopped_callback;
static std::thread s_cpu_thread;
static bool s_request_refresh_info = false;
static bool s_is_throttler_temp_disabled = false;
static bool s_frame_step = false;
struct HostJob
{
@ -473,6 +474,7 @@ static void EmuThread(std::unique_ptr<BootParameters> boot)
// For a time this acts as the CPU thread...
DeclareAsCPUThread();
s_frame_step = false;
Movie::Init(*boot);
Common::ScopeGuard movie_guard{Movie::Shutdown};
@ -859,6 +861,12 @@ void Callback_VideoCopiedToXFB(bool video_update)
s_drawn_frame++;
Movie::FrameUpdate();
if (s_frame_step)
{
s_frame_step = false;
CPU::Break();
}
}
void UpdateTitle()
@ -1024,4 +1032,21 @@ void HostDispatchJobs()
}
}
// NOTE: Host Thread
void DoFrameStep()
{
if (GetState() == State::Paused)
{
// if already paused, frame advance for 1 frame
s_frame_step = true;
RequestRefreshInfo();
SetState(State::Running);
}
else if (!s_frame_step)
{
// if not paused yet, pause immediately instead
SetState(State::Paused);
}
}
} // Core

View File

@ -105,4 +105,6 @@ void QueueHostJob(std::function<void()> job, bool run_during_stop = false);
// WM_USER_JOB_DISPATCH will be sent when something is added to the queue.
void HostDispatchJobs();
void DoFrameStep();
} // namespace

View File

@ -63,7 +63,6 @@
namespace Movie
{
static bool s_bFrameStep = false;
static bool s_bReadOnly = true;
static u32 s_rerecords = 0;
static PlayMode s_playMode = MODE_NONE;
@ -192,11 +191,6 @@ void FrameUpdate()
s_totalFrames = s_currentFrame;
s_totalLagCount = s_currentLagCount;
}
if (s_bFrameStep)
{
s_bFrameStep = false;
CPU::Break();
}
s_bPolled = false;
}
@ -215,7 +209,6 @@ void Init(const BootParameters& boot)
s_current_file_name.clear();
s_bPolled = false;
s_bFrameStep = false;
s_bSaveConfig = false;
if (IsPlayingInput())
{
@ -274,23 +267,6 @@ void SetPolledDevice()
s_bPolled = true;
}
// NOTE: Host Thread
void DoFrameStep()
{
if (Core::GetState() == Core::State::Paused)
{
// if already paused, frame advance for 1 frame
s_bFrameStep = true;
Core::RequestRefreshInfo();
Core::SetState(Core::State::Running);
}
else if (!s_bFrameStep)
{
// if not paused yet, pause immediately instead
Core::SetState(Core::State::Paused);
}
}
// NOTE: Host Thread
void SetReadOnly(bool bEnabled)
{

View File

@ -148,7 +148,6 @@ bool IsUsingBongo(int controller);
void ChangePads(bool instantly = false);
void ChangeWiiPads(bool instantly = false);
void DoFrameStep();
void SetReadOnly(bool bEnabled);
bool BeginRecordingInput(int controllers);

View File

@ -450,7 +450,7 @@ void MainWindow::Reset()
void MainWindow::FrameAdvance()
{
Movie::DoFrameStep();
Core::DoFrameStep();
EmulationPaused();
}

View File

@ -446,7 +446,7 @@ void CFrame::OnFrameStep(wxCommandEvent& event)
{
bool wasPaused = Core::GetState() == Core::State::Paused;
Movie::DoFrameStep();
Core::DoFrameStep();
bool isPaused = Core::GetState() == Core::State::Paused;
if (isPaused && !wasPaused) // don't update on unpause, otherwise the status would be wrong when