Add CheckMapIconVisibilityHandler
This commit is contained in:
parent
d963cb156a
commit
414defdf49
|
@ -18,6 +18,7 @@ class DLL
|
||||||
FARPROC HandleChat;
|
FARPROC HandleChat;
|
||||||
FARPROC HandleP2PRequest;
|
FARPROC HandleP2PRequest;
|
||||||
FARPROC HandleCheckInventoryFull;
|
FARPROC HandleCheckInventoryFull;
|
||||||
|
FARPROC HandleCheckMapIconVisibility;
|
||||||
|
|
||||||
DLL(std::string fileName);
|
DLL(std::string fileName);
|
||||||
HMODULE Load();
|
HMODULE Load();
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
int CheckMapIconVisibilityHandler(void* player, int a2, int a3) {
|
||||||
|
for (DLL* dll: modDLLs) {
|
||||||
|
if (dll->HandleCheckMapIconVisibility) {
|
||||||
|
if ( int result = ((int(*)(void*, int, int))dll->HandleCheckMapIconVisibility)(player, a2, a3) ){
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
void* CheckMapIconVisibilityHandler_ptr = (void*)&CheckMapIconVisibilityHandler;
|
||||||
|
|
||||||
|
void* ASMCheckMapIconVisibilityHandler_jmpback;
|
||||||
|
void* ASMCheckMapIconVisibilityHandler_ret0;
|
||||||
|
void* ASMCheckMapIconVisibilityHandler_ret1;
|
||||||
|
void no_optimize ASMCheckMapIconVisibilityHandler() {
|
||||||
|
asm(PUSH_ALL
|
||||||
|
|
||||||
|
PREPARE_STACK
|
||||||
|
"call [CheckMapIconVisibilityHandler_ptr] \n"
|
||||||
|
|
||||||
|
RESTORE_STACK
|
||||||
|
|
||||||
|
// Did the handler return 1? true
|
||||||
|
"cmp eax, 1 \n"
|
||||||
|
"je 1f \n"
|
||||||
|
|
||||||
|
// Otherwise? Do nothing
|
||||||
|
POP_ALL
|
||||||
|
|
||||||
|
// original code
|
||||||
|
"mov rdi, [rcx+0x1528] \n"
|
||||||
|
"mov esi, r8d \n"
|
||||||
|
"mov ebp, edx \n"
|
||||||
|
"test rdi, rdi \n"
|
||||||
|
"jmp [ASMCheckMapIconVisibilityHandler_jmpback] \n"
|
||||||
|
|
||||||
|
|
||||||
|
"1: \n" //not
|
||||||
|
POP_ALL
|
||||||
|
"jmp [ASMCheckMapIconVisibilityHandler_ret1] \n"
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
void SetupCheckMapIconVisibilityHandler() {
|
||||||
|
WriteFarJMP(base+0x5F4DE, (void*)&ASMCheckMapIconVisibilityHandler);
|
||||||
|
ASMCheckMapIconVisibilityHandler_jmpback = (void*)base+0x5F4ED;
|
||||||
|
ASMCheckMapIconVisibilityHandler_ret1 = (void*)base+0x5F6B4;
|
||||||
|
}
|
|
@ -52,11 +52,13 @@ void WriteFarJMP(void* source, void* destination) {
|
||||||
#include "callbacks/ChatHandler.h"
|
#include "callbacks/ChatHandler.h"
|
||||||
#include "callbacks/P2PRequestHandler.h"
|
#include "callbacks/P2PRequestHandler.h"
|
||||||
#include "callbacks/CheckInventoryFullHandler.h"
|
#include "callbacks/CheckInventoryFullHandler.h"
|
||||||
|
#include "callbacks/CheckMapIconVisibilityHandler.h"
|
||||||
|
|
||||||
void SetupHandlers() {
|
void SetupHandlers() {
|
||||||
SetupChatHandler();
|
SetupChatHandler();
|
||||||
SetupP2PRequestHandler();
|
SetupP2PRequestHandler();
|
||||||
SetupCheckInventoryFullHandler();
|
SetupCheckInventoryFullHandler();
|
||||||
|
SetupCheckMapIconVisibilityHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Popup(const char* title, char* msg ){
|
void Popup(const char* title, char* msg ){
|
||||||
|
@ -96,6 +98,7 @@ extern "C" __declspec(dllexport) BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD
|
||||||
IMPORT(dll, HandleChat);
|
IMPORT(dll, HandleChat);
|
||||||
IMPORT(dll, HandleP2PRequest);
|
IMPORT(dll, HandleP2PRequest);
|
||||||
IMPORT(dll, HandleCheckInventoryFull);
|
IMPORT(dll, HandleCheckInventoryFull);
|
||||||
|
IMPORT(dll, HandleCheckMapIconVisibility);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure version compatibility
|
// Ensure version compatibility
|
||||||
|
|
Loading…
Reference in New Issue