Optimize far-jump patches
This commit is contained in:
parent
4f458b40c3
commit
02b6dd2f19
2
deps/protobuf
vendored
2
deps/protobuf
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 028d59fccda7a94c3fd39095261caceb77456af3
|
Subproject commit caf1fb7197ee94c07108fc7cfbca07432b185a28
|
@ -110,6 +110,7 @@ workspace "iw4x"
|
|||||||
}
|
}
|
||||||
buildoptions {
|
buildoptions {
|
||||||
"/wd4100", -- "Unused formal parameter"
|
"/wd4100", -- "Unused formal parameter"
|
||||||
|
"/wd6011", -- "Dereferencing NULL pointer"
|
||||||
}
|
}
|
||||||
defines {
|
defines {
|
||||||
"_SCL_SECURE_NO_WARNINGS",
|
"_SCL_SECURE_NO_WARNINGS",
|
||||||
|
@ -242,7 +242,7 @@ namespace Components
|
|||||||
Utils::Hook(0x5AA709, Network::PacketInterceptionHandler, HOOK_CALL).Install()->Quick();
|
Utils::Hook(0x5AA709, Network::PacketInterceptionHandler, HOOK_CALL).Install()->Quick();
|
||||||
|
|
||||||
// Install packet deploy hook
|
// Install packet deploy hook
|
||||||
Utils::Hook::Set<int>(0x5AA715, (DWORD)Network::DeployPacketStub - 0x5AA713 - 6);
|
Utils::Hook::RedirectJump(0x5AA713, Network::DeployPacketStub);
|
||||||
}
|
}
|
||||||
|
|
||||||
Network::~Network()
|
Network::~Network()
|
||||||
|
@ -122,7 +122,7 @@ namespace Components
|
|||||||
UIScript::UIScript()
|
UIScript::UIScript()
|
||||||
{
|
{
|
||||||
// Install handler
|
// Install handler
|
||||||
Utils::Hook::Set<int>(0x45EC5B, (DWORD)UIScript::RunMenuScriptStub - 0x45EC59 - 6);
|
Utils::Hook::RedirectJump(0x45EC59, UIScript::RunMenuScriptStub);
|
||||||
|
|
||||||
// Install ownerdraw handler
|
// Install ownerdraw handler
|
||||||
Utils::Hook(0x63D233, UIScript::OwnerDrawHandleKeyStub, HOOK_CALL).Install()->Quick();
|
Utils::Hook(0x63D233, UIScript::OwnerDrawHandleKeyStub, HOOK_CALL).Install()->Quick();
|
||||||
|
@ -2,7 +2,8 @@ syntax = "proto3";
|
|||||||
|
|
||||||
package Proto;
|
package Proto;
|
||||||
|
|
||||||
message NodePacket {
|
message NodePacket
|
||||||
|
{
|
||||||
bytes challenge = 1;
|
bytes challenge = 1;
|
||||||
bytes signature = 2;
|
bytes signature = 2;
|
||||||
bytes publicKey = 3;
|
bytes publicKey = 3;
|
||||||
|
@ -131,4 +131,16 @@ namespace Utils
|
|||||||
{
|
{
|
||||||
Hook::SetString(reinterpret_cast<void*>(place), string);
|
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(void* place, size_t length);
|
||||||
static void Nop(DWORD 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)
|
template <typename T> static void Set(void* place, T value)
|
||||||
{
|
{
|
||||||
*static_cast<T*>(place) = value;
|
*static_cast<T*>(place) = value;
|
||||||
|
Loading…
Reference in New Issue
Block a user