From 4abda216991a918e89793b05b31ba46a92b9b856 Mon Sep 17 00:00:00 2001 From: Kingcom Date: Sat, 19 Oct 2013 02:45:58 +0200 Subject: [PATCH] Fix messed up logic --- Windows/Debugger/CtrlDisAsmView.h | 1 - Windows/Debugger/Debugger_Disasm.cpp | 27 +++++++++++++++------------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Windows/Debugger/CtrlDisAsmView.h b/Windows/Debugger/CtrlDisAsmView.h index 84581a5f17..f8690c5dcd 100644 --- a/Windows/Debugger/CtrlDisAsmView.h +++ b/Windows/Debugger/CtrlDisAsmView.h @@ -89,7 +89,6 @@ class CtrlDisAsmView bool searching; bool dontRedraw; bool keyTaken; - bool stepScrolling; void assembleOpcode(u32 address, std::string defaultText); void disassembleToFile(); diff --git a/Windows/Debugger/Debugger_Disasm.cpp b/Windows/Debugger/Debugger_Disasm.cpp index 1af1345e6a..e907ef91e8 100644 --- a/Windows/Debugger/Debugger_Disasm.cpp +++ b/Windows/Debugger/Debugger_Disasm.cpp @@ -168,27 +168,30 @@ void CDisasm::stepInto() // If the current PC is on a breakpoint, the user doesn't want to do nothing. CBreakPoints::SetSkipFirst(currentMIPS->pc); + u32 newAddress = currentPc+cpu->getInstructionSize(0); - MIPSAnalyst::MipsOpcodeInfo info = MIPSAnalyst::GetOpcodeInfo(cpu,cpu->GetPC()); + MIPSAnalyst::MipsOpcodeInfo info = MIPSAnalyst::GetOpcodeInfo(cpu,currentPc); if (info.isBranch) { - u32 newAddress = currentPc+cpu->getInstructionSize(0); if (newAddress == windowEnd-4) ptr->scrollWindow(1); else if (newAddress == windowEnd) ptr->scrollWindow(2); } else { - if (!currentMIPS->inDelaySlot) + bool scroll = true; + if (currentMIPS->inDelaySlot) { - MIPSAnalyst::MipsOpcodeInfo prevInfo = MIPSAnalyst::GetOpcodeInfo(cpu,cpu->GetPC()-cpu->getInstructionSize(0)); - if (!prevInfo.isBranch || (prevInfo.isConditional && !prevInfo.conditionMet)) - { - u32 newAddress = currentPc+cpu->getInstructionSize(0); - if (newAddress == windowEnd-4) - ptr->scrollWindow(1); - else if (newAddress == windowEnd) - ptr->scrollWindow(2); - } + MIPSAnalyst::MipsOpcodeInfo prevInfo = MIPSAnalyst::GetOpcodeInfo(cpu,currentPc-cpu->getInstructionSize(0)); + if (!prevInfo.isConditional || prevInfo.conditionMet) + scroll = false; + } + + if (scroll) + { + if (newAddress == windowEnd-4) + ptr->scrollWindow(1); + else if (newAddress == windowEnd) + ptr->scrollWindow(2); } }