made frame advance act normal (so it advances 1 frame each time instead of waiting for further unpause commands), and did some minor improvements to the read-only command (making the UI behavior a little nicer, no actual changes to what read-only does at this point)

This commit is contained in:
nitsuja 2011-12-11 21:08:26 -08:00
parent b0ffa72e37
commit 2c2ef9a961
3 changed files with 32 additions and 7 deletions

View File

@ -77,7 +77,10 @@ void FrameUpdate()
g_lagCounter++;
if (g_bFrameStep)
{
Core::SetState(Core::CORE_PAUSE);
g_bFrameStep = false;
}
// ("framestop") the only purpose of this is to cause interpreter/jit Run() to return temporarily.
// after that we set it back to CPU_RUNNING and continue as normal.
@ -113,9 +116,19 @@ void SetPolledDevice()
g_bPolled = true;
}
void SetFrameStepping(bool bEnabled)
void DoFrameStep()
{
g_bFrameStep = bEnabled;
if(Core::GetState() == Core::CORE_PAUSE)
{
// if already paused, frame advance for 1 frame
Core::SetState(Core::CORE_RUN);
g_bFrameStep = true;
}
else
{
// if not paused yet, pause immediately instead
Core::SetState(Core::CORE_PAUSE);
}
}
void SetFrameStopping(bool bEnabled)
@ -125,6 +138,9 @@ void SetFrameStopping(bool bEnabled)
void SetReadOnly(bool bEnabled)
{
if (g_bReadOnly != bEnabled)
Core::DisplayMessage(bEnabled ? "Read-only mode." : "Read+Write mode.", 1000);
g_bReadOnly = bEnabled;
}

View File

@ -111,7 +111,7 @@ bool IsUsingWiimote(int wiimote);
void ChangePads(bool instantly = false);
void ChangeWiiPads(bool instantly = false);
void SetFrameStepping(bool bEnabled);
void DoFrameStep();
void SetFrameStopping(bool bEnabled);
void SetReadOnly(bool bEnabled);

View File

@ -145,7 +145,7 @@ void CFrame::CreateMenu()
emulationMenu->Check(IDM_RECORDREADONLY, true);
emulationMenu->AppendSeparator();
emulationMenu->Append(IDM_FRAMESTEP, GetMenuLabel(HK_FRAME_ADVANCE), wxEmptyString, wxITEM_CHECK);
emulationMenu->Append(IDM_FRAMESTEP, GetMenuLabel(HK_FRAME_ADVANCE), wxEmptyString);
wxMenu *skippingMenu = new wxMenu;
emulationMenu->AppendSubMenu(skippingMenu, _("Frame S&kipping"));
@ -704,7 +704,13 @@ void CFrame::OnTASInput(wxCommandEvent& event)
void CFrame::OnFrameStep(wxCommandEvent& event)
{
Movie::SetFrameStepping(event.IsChecked());
bool wasPaused = (Core::GetState() == Core::CORE_PAUSE);
Movie::DoFrameStep();
bool isPaused = (Core::GetState() == Core::CORE_PAUSE);
if(isPaused && !wasPaused) // don't update on unpause, otherwise the status would be wrong when pausing next frame
UpdateGUI();
}
void CFrame::OnChangeDisc(wxCommandEvent& WXUNUSED (event))
@ -718,8 +724,11 @@ void CFrame::OnRecord(wxCommandEvent& WXUNUSED (event))
if (Movie::IsReadOnly())
{
PanicAlertT("Cannot record movies in read-only mode.");
return;
//PanicAlertT("Cannot record movies in read-only mode.");
//return;
// the user just chose to record a movie, so that should take precedence
Movie::SetReadOnly(false);
GetMenuBar()->FindItem(IDM_RECORDREADONLY)->Check(false);
}
for (int i = 0; i < 4; i++) {