From f0be9b62b65499f93bea3bc445d43940bd9a782a Mon Sep 17 00:00:00 2001 From: mrexodia Date: Sun, 20 Dec 2015 06:37:42 +0100 Subject: [PATCH] stepping is now 'working' (only problem is that it becomes slower over time) --- TitanEngineEmulator/Emulator.h | 18 +++++++++--------- TitanEngineEmulator/TitanEngineEmulator.cpp | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/TitanEngineEmulator/Emulator.h b/TitanEngineEmulator/Emulator.h index 46f561a..56282da 100644 --- a/TitanEngineEmulator/Emulator.h +++ b/TitanEngineEmulator/Emulator.h @@ -109,7 +109,7 @@ public: } //Stepping - void StepOver(LPVOID CallBack) + void StepOver(LPVOID CallBack) const { //TODO StepInto(CallBack); @@ -122,24 +122,24 @@ public: _thread->StepInto([this, StepCount, CallBack]() { if (!StepCount) - ((STEPCALLBACK)CallBack)(); + { + if (CallBack) + ((STEPCALLBACK)CallBack)(); + } else SingleStep(StepCount - 1, CallBack); }); } - void StepInto(LPVOID CallBack) + void StepInto(LPVOID CallBack) const { if (!_thread || !CallBack) return; - _thread->StepInto([CallBack]() - { - ((STEPCALLBACK)CallBack)(); - }); + _thread->StepInto(STEPCALLBACK(CallBack)); } //Registers - ULONG_PTR GetContextDataEx(HANDLE hActiveThread, DWORD IndexOfRegister) + ULONG_PTR GetContextDataEx(HANDLE hActiveThread, DWORD IndexOfRegister) const { if (!_thread) return 0; @@ -208,7 +208,7 @@ protected: } private: //functions - Registers::R registerFromDword(DWORD IndexOfRegister) + static inline Registers::R registerFromDword(DWORD IndexOfRegister) { switch (IndexOfRegister) { diff --git a/TitanEngineEmulator/TitanEngineEmulator.cpp b/TitanEngineEmulator/TitanEngineEmulator.cpp index 505f20f..e95917b 100644 --- a/TitanEngineEmulator/TitanEngineEmulator.cpp +++ b/TitanEngineEmulator/TitanEngineEmulator.cpp @@ -283,15 +283,15 @@ __declspec(dllexport) bool TITCALL RemoveAllBreakPoints(DWORD RemoveOption) //Stepping __declspec(dllexport) void TITCALL StepOver(LPVOID traceCallBack) { - //TODO + emu.StepOver(traceCallBack); } __declspec(dllexport) void TITCALL SingleStep(DWORD StepCount, LPVOID StepCallBack) { - //TODO + emu.SingleStep(StepCount, StepCallBack); } __declspec(dllexport) void TITCALL StepInto(LPVOID traceCallBack) { - //TODO + emu.StepInto(traceCallBack); } \ No newline at end of file