Optimize far-jump patches
This commit is contained in:
@ -131,4 +131,16 @@ namespace Utils
|
||||
{
|
||||
Hook::SetString(reinterpret_cast<void*>(place), string);
|
||||
}
|
||||
|
||||
void Hook::RedirectJump(void* place, void* stub)
|
||||
{
|
||||
char* operandPtr = static_cast<char*>(place) + 2;
|
||||
int newOperand = reinterpret_cast<int>(stub) - (reinterpret_cast<int>(place) + 6);
|
||||
Utils::Hook::Set<int>(operandPtr, newOperand);
|
||||
}
|
||||
|
||||
void Hook::RedirectJump(DWORD place, void* stub)
|
||||
{
|
||||
Hook::RedirectJump(reinterpret_cast<void*>(place), stub);
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,9 @@ namespace Utils
|
||||
static void Nop(void* place, size_t length);
|
||||
static void Nop(DWORD place, size_t length);
|
||||
|
||||
static void RedirectJump(void* place, void* stub);
|
||||
static void RedirectJump(DWORD place, void* stub);
|
||||
|
||||
template <typename T> static void Set(void* place, T value)
|
||||
{
|
||||
*static_cast<T*>(place) = value;
|
||||
|
Reference in New Issue
Block a user