From b8f467b45a670eaf88bb0a746844608f0437b3ec Mon Sep 17 00:00:00 2001 From: Kingcom Date: Fri, 28 Jun 2013 00:26:04 +0200 Subject: [PATCH] -don't step while the core is active -reset the counter before starting the core (so that it actually counts the execution time of the last run) --- Windows/Debugger/Debugger_Disasm.cpp | 11 ++++++++++- Windows/Debugger/Debugger_Disasm.h | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Windows/Debugger/Debugger_Disasm.cpp b/Windows/Debugger/Debugger_Disasm.cpp index ba4400ccea..c453fb9e9b 100644 --- a/Windows/Debugger/Debugger_Disasm.cpp +++ b/Windows/Debugger/Debugger_Disasm.cpp @@ -71,6 +71,7 @@ static LRESULT CALLBACK BreakpointListProc(HWND hDlg, UINT message, WPARAM wPara CDisasm::CDisasm(HINSTANCE _hInstance, HWND _hParent, DebugInterface *_cpu) : Dialog((LPCSTR)IDD_DISASM, _hInstance, _hParent) { cpu = _cpu; + lastTicks = CoreTiming::GetTicks(); SetWindowText(m_hDlg,_cpu->GetName()); #ifdef THEMES @@ -468,6 +469,7 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) case IDC_GO: { + lastTicks = CoreTiming::GetTicks(); SetDebugMode(false); Core_EnableStepping(false); } @@ -475,6 +477,9 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) case IDC_STEP: { + if (Core_IsActive()) break; + lastTicks = CoreTiming::GetTicks(); + Core_DoSingleStep(); Sleep(1); _dbg_update_(); @@ -486,6 +491,9 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) case IDC_STEPOVER: { + if (Core_IsActive()) break; + lastTicks = CoreTiming::GetTicks(); + const char* dis = cpu->disasm(cpu->GetPC(),4); const char* pos = strstr(dis,"->$"); const char* reg = strstr(dis,"->"); @@ -677,6 +685,7 @@ BOOL CDisasm::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) break; case WM_USER+3: // run to wparam { + lastTicks = CoreTiming::GetTicks(); CtrlDisAsmView *ptr = CtrlDisAsmView::getFrom(GetDlgItem(m_hDlg,IDC_DISASMVIEW)); ptr->setDontRedraw(true); SetDebugMode(false); @@ -831,7 +840,7 @@ void CDisasm::UpdateDialog(bool _bComplete) rl->redraw(); // Update Debug Counter char tempTicks[24]; - sprintf(tempTicks, "%lld", CoreTiming::GetTicks()); + sprintf(tempTicks, "%lld", CoreTiming::GetTicks()-lastTicks); SetDlgItemText(m_hDlg, IDC_DEBUG_COUNT, tempTicks); // Update Register Dialog diff --git a/Windows/Debugger/Debugger_Disasm.h b/Windows/Debugger/Debugger_Disasm.h index 66f8a54bd9..644e2a7ea2 100644 --- a/Windows/Debugger/Debugger_Disasm.h +++ b/Windows/Debugger/Debugger_Disasm.h @@ -21,7 +21,8 @@ private: RECT breakpointRect; DebugInterface *cpu; - + u64 lastTicks; + BOOL DlgProc(UINT message, WPARAM wParam, LPARAM lParam); void UpdateSize(WORD width, WORD height); void SavePosition();