Merge pull request #4377 from aldelaro5/fix-centerPc-on-toggleBreakpoint

Fix unnecessary Center PC calls in the CodeWindow
This commit is contained in:
Anthony 2016-10-29 00:16:09 -05:00 committed by GitHub
commit 26902d89e8
3 changed files with 21 additions and 18 deletions

View File

@ -159,7 +159,8 @@ void CCodeWindow::OnHostMessage(wxCommandEvent& event)
break; break;
case IDM_UPDATE_DISASM_DIALOG: case IDM_UPDATE_DISASM_DIALOG:
Repopulate(); codeview->Center(PC);
Repopulate(false);
if (HasPanel<CRegisterWindow>()) if (HasPanel<CRegisterWindow>())
GetPanel<CRegisterWindow>()->NotifyUpdate(); GetPanel<CRegisterWindow>()->NotifyUpdate();
if (HasPanel<CWatchWindow>()) if (HasPanel<CWatchWindow>())
@ -205,12 +206,14 @@ void CCodeWindow::OnCodeStep(wxCommandEvent& event)
case IDM_SKIP: case IDM_SKIP:
PC += 4; PC += 4;
Repopulate(); codeview->Center(PC);
Repopulate(false);
break; break;
case IDM_SETPC: case IDM_SETPC:
PC = codeview->GetSelection(); PC = codeview->GetSelection();
Repopulate(); codeview->Center(PC);
Repopulate(false);
break; break;
case IDM_GOTOPC: case IDM_GOTOPC:
@ -383,11 +386,8 @@ void CCodeWindow::StepOut()
PowerPC::SetMode(old_mode); PowerPC::SetMode(old_mode);
CPU::PauseAndLock(false, false); CPU::PauseAndLock(false, false);
JumpToAddress(PC);
{
wxCommandEvent ev(wxEVT_HOST_COMMAND, IDM_UPDATE_DISASM_DIALOG); wxCommandEvent ev(wxEVT_HOST_COMMAND, IDM_UPDATE_DISASM_DIALOG);
GetEventHandler()->ProcessEvent(ev); GetEventHandler()->ProcessEvent(ev);
}
// Update all toolbars in the aui manager // Update all toolbars in the aui manager
Parent->UpdateGUI(); Parent->UpdateGUI();
@ -605,12 +605,13 @@ void CCodeWindow::PopulateToolbar(wxToolBar* toolBar)
} }
// Update GUI // Update GUI
void CCodeWindow::Repopulate() void CCodeWindow::Repopulate(bool refresh_codeview)
{ {
if (!codeview) if (!codeview)
return; return;
codeview->Center(PC); if (refresh_codeview)
codeview->Refresh();
UpdateCallstack(); UpdateCallstack();
UpdateButtonStates(); UpdateButtonStates();

View File

@ -95,7 +95,7 @@ public:
bool JITNoBlockLinking(); bool JITNoBlockLinking();
bool JumpToAddress(u32 address); bool JumpToAddress(u32 address);
void Repopulate(); void Repopulate(bool refresh_codeview = true);
void NotifyMapLoaded(); void NotifyMapLoaded();
void PopulateToolbar(wxToolBar* toolBar); void PopulateToolbar(wxToolBar* toolBar);
void UpdateButtonStates(); void UpdateButtonStates();

View File

@ -523,14 +523,16 @@ void CFrame::OnPlay(wxCommandEvent& WXUNUSED(event))
// Core is initialized and emulator is running // Core is initialized and emulator is running
if (UseDebugger) if (UseDebugger)
{ {
CPU::EnableStepping(!CPU::IsStepping()); bool was_stopped = CPU::IsStepping();
CPU::EnableStepping(!was_stopped);
wxThread::Sleep(20); // When the CPU stops it generates a IDM_UPDATE_DISASM_DIALOG which automatically refreshes
g_pCodeWindow->JumpToAddress(PC); // the UI, the UI only needs to be refreshed manually when unpausing.
if (was_stopped)
{
g_pCodeWindow->Repopulate(); g_pCodeWindow->Repopulate();
// Update toolbar with Play/Pause status
UpdateGUI(); UpdateGUI();
} }
}
else else
{ {
DoPause(); DoPause();