[Debugger] CPU Log: More UI behavior improvements

This commit is contained in:
shygoo 2019-01-19 14:14:26 -06:00
parent 557892e47e
commit 98e933be1b
2 changed files with 26 additions and 12 deletions

View File

@ -195,14 +195,14 @@ LRESULT CDebugCPULogView::OnScroll(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam,
switch (type)
{
case SB_LINEUP: newPos = scrollInfo.nPos - 1; break;
case SB_LINEDOWN: newPos = scrollInfo.nPos + 1; break;
case SB_LINEUP: newPos = max(scrollInfo.nMin, scrollInfo.nPos - 1); break;
case SB_LINEDOWN: newPos = min(scrollInfo.nMax, scrollInfo.nPos + 1); break;
case SB_THUMBTRACK: newPos = scrollInfo.nTrackPos; break;
default: return 0;
}
m_LogStartIndex = newPos;
::SetScrollPos(hScrollbar, SB_CTL, m_LogStartIndex, TRUE);
::SetScrollPos(hScrollbar, SB_CTL, newPos, TRUE);
if (scrlId == IDC_SCRL_BAR)
{
@ -218,9 +218,24 @@ void CDebugCPULogView::InterceptMouseWheel(WPARAM wParam, LPARAM lParam)
if (MouseHovering(IDC_CPU_LIST) || MouseHovering(IDC_SCRL_BAR))
{
int scrlMin, scrlMax;
m_Scrollbar.GetScrollRange(&scrlMin, &scrlMax);
int scrollPos = m_Scrollbar.GetScrollPos();
m_LogStartIndex = scrollPos + nScroll;
m_Scrollbar.SetScrollPos(m_LogStartIndex);
int newPos = scrollPos + nScroll;
if (newPos < scrlMin)
{
newPos = scrlMin;
}
else if (newPos > scrlMax)
{
newPos = scrlMax;
}
m_LogStartIndex = newPos;
m_Scrollbar.SetScrollPos(newPos, true);
RefreshList(false);
}
}
@ -283,6 +298,7 @@ void CDebugCPULogView::RefreshList(bool bUpdateBuffer)
{
m_LogStartIndex = scrollRangeMax;
m_Scrollbar.SetScrollPos(m_LogStartIndex, true);
ShowRegStates(count - 1);
}
size_t start = m_Scrollbar.GetScrollPos();
@ -324,8 +340,6 @@ void CDebugCPULogView::RefreshList(bool bUpdateBuffer)
}
m_CPUListView.SetRedraw(TRUE);
ShowRegStates(count - 1);
}
void CDebugCPULogView::ShowRegStates(size_t stateIndex)

View File

@ -658,6 +658,11 @@ void CDebuggerUI::HandleCartToRamDMA(void)
// Called from the interpreter core at the beginning of every CPU step
void CDebuggerUI::CPUStepStarted()
{
if (isStepping() && bCPULoggingEnabled())
{
Debug_RefreshCPULogWindow();
}
uint32_t pc = g_Reg->m_PROGRAM_COUNTER;
COpInfo opInfo(R4300iOp::m_Opcode);
@ -720,11 +725,6 @@ void CDebuggerUI::CPUStep()
if (bCPULoggingEnabled())
{
m_CPULog->PushState();
if (isStepping())
{
Debug_RefreshCPULogWindow();
}
}
}