summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/patcher.h12
-rw-r--r--src/core/re3.cpp2
2 files changed, 4 insertions, 10 deletions
diff --git a/src/core/patcher.h b/src/core/patcher.h
index 3dfbb05c..2722b6fd 100644
--- a/src/core/patcher.h
+++ b/src/core/patcher.h
@@ -117,16 +117,10 @@ Nop(AT address, unsigned int nCount)
Unprotect_internal();
}
-template<typename AT, typename HT> inline void
-InjectHook(AT address, HT hook, unsigned int nType=PATCH_NOTHING)
+template <typename T> inline void
+InjectHook(uintptr_t address, T hook, unsigned int nType = PATCH_NOTHING)
{
- uint32 uiHook;
- _asm
- {
- mov eax, hook
- mov uiHook, eax
- }
- InjectHook_internal((uint32)address, uiHook, nType);
+ InjectHook_internal(address, reinterpret_cast<uintptr_t>((void *&)hook), nType);
}
inline void ExtractCall(void *dst, uint32_t a)
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 137a890c..ffb2a7a2 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -71,7 +71,7 @@ InjectHook_internal(uint32 address, uint32 hook, int type)
break;
}
- *(ptrdiff_t*)(address + 1) = hook - address - 5;
+ *(ptrdiff_t*)(address + 1) = (uintptr_t)hook - (uintptr_t)address - 5;
if(type == PATCH_NOTHING)
VirtualProtect((void*)(address + 1), 4, protect[0], &protect[1]);
else