From f2a0f9f61ae014120d3b34ba459575b51247929a Mon Sep 17 00:00:00 2001 From: Kingcom Date: Sat, 10 Sep 2016 15:29:11 +0200 Subject: [PATCH] Fix memory view scrolling, keep window start aligned to row size, and retain focus upon positioning it to the address accessed by an opcode --- pcsx2/gui/Debugger/CtrlMemView.cpp | 11 ++++++++--- pcsx2/gui/Debugger/DisassemblyDialog.cpp | 5 ++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pcsx2/gui/Debugger/CtrlMemView.cpp b/pcsx2/gui/Debugger/CtrlMemView.cpp index 86b86c0de3..899b9cc90d 100644 --- a/pcsx2/gui/Debugger/CtrlMemView.cpp +++ b/pcsx2/gui/Debugger/CtrlMemView.cpp @@ -612,11 +612,11 @@ void CtrlMemView::scrollCursor(int bytes) if (curAddress < windowStart) { - windowStart = (curAddress / rowSize) * curAddress; + windowStart = (curAddress / rowSize) * rowSize; } else if (curAddress >= windowEnd) { windowStart = curAddress - (visibleRows - 1)*rowSize; - windowStart = (windowStart / rowSize) * windowStart; + windowStart = (windowStart / rowSize) * rowSize; } updateStatusBarText(); @@ -642,7 +642,12 @@ void CtrlMemView::gotoAddress(u32 addr, bool pushInHistory) curAddress = addr; selectedNibble = 0; - windowStart = curAddress; + + int visibleRows = GetClientSize().y/rowHeight; + u32 windowEnd = windowStart+visibleRows*rowSize; + + if (curAddress < windowStart || curAddress >= windowEnd) + windowStart = (curAddress / rowSize) * rowSize; updateStatusBarText(); redraw(); diff --git a/pcsx2/gui/Debugger/DisassemblyDialog.cpp b/pcsx2/gui/Debugger/DisassemblyDialog.cpp index 0e962b8407..182b1cae5e 100644 --- a/pcsx2/gui/Debugger/DisassemblyDialog.cpp +++ b/pcsx2/gui/Debugger/DisassemblyDialog.cpp @@ -502,9 +502,8 @@ void DisassemblyDialog::onDebuggerEvent(wxCommandEvent& evt) { currentCpu->showMemoryView(); - CtrlMemView *memview = currentCpu->getMemoryView(); - memview->gotoAddress(evt.GetInt(), true); - memview->SetFocus(); + currentCpu->getMemoryView()->gotoAddress(evt.GetInt(), true); + currentCpu->getDisassembly()->SetFocus(); } } else if (type == debEVT_RUNTOPOS) {