simplification of TitanEngineEmulator

This commit is contained in:
mrexodia 2016-08-19 16:35:53 +02:00
parent 9d7e3b0c95
commit eb4262d8ec
1 changed files with 18 additions and 19 deletions

View File

@ -411,28 +411,10 @@ public:
{ {
if (!mProcess) if (!mProcess)
return false; return false;
MemoryType type;
switch (BreakPointType)
{
case UE_MEMORY:
type = MemoryType::Access;
break;
case UE_MEMORY_READ:
type = MemoryType::Read;
break;
case UE_MEMORY_WRITE:
type = MemoryType::Write;
break;
case UE_MEMORY_EXECUTE:
type = MemoryType::Execute;
break;
default:
return false;
}
return mProcess->SetMemoryBreakpoint(ptr(MemoryStart), ptr(SizeOfMemory), [bpxCallBack](const BreakpointInfo & info) return mProcess->SetMemoryBreakpoint(ptr(MemoryStart), ptr(SizeOfMemory), [bpxCallBack](const BreakpointInfo & info)
{ {
(MEMBPCALLBACK(bpxCallBack))((const void*)info.address); (MEMBPCALLBACK(bpxCallBack))((const void*)info.address);
}, type, !RestoreOnHit); }, memtypeFromTitan(BreakPointType), !RestoreOnHit);
} }
bool RemoveMemoryBPX(ULONG_PTR MemoryStart, SIZE_T SizeOfMemory) bool RemoveMemoryBPX(ULONG_PTR MemoryStart, SIZE_T SizeOfMemory)
@ -648,6 +630,23 @@ private: //functions
} }
} }
static MemoryType memtypeFromTitan(DWORD type)
{
switch (type)
{
case UE_MEMORY:
return MemoryType::Access;
case UE_MEMORY_READ:
return MemoryType::Read;
case UE_MEMORY_WRITE:
return MemoryType::Write;
case UE_MEMORY_EXECUTE:
return MemoryType::Execute;
default:
return MemoryType::Access;
}
}
private: //variables private: //variables
bool mSetDebugPrivilege = false; bool mSetDebugPrivilege = false;
typedef void(*CUSTOMHANDLER)(const void*); typedef void(*CUSTOMHANDLER)(const void*);