111
This commit is contained in:
parent
a08eb9c220
commit
c1da677abb
114
test/hook.cpp
114
test/hook.cpp
|
|
@ -1,5 +1,6 @@
|
|||
#include "pch.h"
|
||||
#include "hook.h"
|
||||
#include "inlinehook.h"
|
||||
extern int LbState;
|
||||
extern int RbState;
|
||||
extern int MbState;
|
||||
|
|
@ -8,6 +9,9 @@ extern int MbState;
|
|||
static int OtherPlayerInfoType = 0;
|
||||
static bool HookOtherPlayerInfo = false;
|
||||
static int OtherPlayerInfoImg = 0;
|
||||
|
||||
//游戏初始化完毕Flag
|
||||
static bool InitGameFlag = false;
|
||||
//注册nut
|
||||
uint32_t __cdecl hook::H_Register_Nut(uint32_t v, void* f, int freeVarsCnt)
|
||||
{
|
||||
|
|
@ -79,6 +83,7 @@ function L_drawMainCustomUI_All(){}
|
|||
function L_MouseCallBack(a, b, c,d) {}
|
||||
function L_DrawWindow_A() {}
|
||||
function L_DrawWindow_B() {}
|
||||
function L_OpenOldWindowCallBack(WindowIndex) {}
|
||||
)";
|
||||
wchar_t* sfile = DNFTOOL::charTowchar_t((char*)BaseFile.c_str());
|
||||
wchar_t* ss = DNFTOOL::charTowchar_t((char*)Base.c_str());
|
||||
|
|
@ -95,20 +100,6 @@ function L_DrawWindow_B() {}
|
|||
|
||||
typedef uint32_t(__cdecl* LSqPushStringFunc)(uint32_t v, const wchar_t* s, uint32_t l);
|
||||
LSqPushStringFunc LrealSqPushString;
|
||||
|
||||
std::string& NReplaceAll(std::string& str, const std::string& src, const std::string& dst) {
|
||||
std::string::size_type pos(0);
|
||||
while (true) {
|
||||
if ((pos = str.find(src)) != std::string::npos) {
|
||||
str.replace(pos, src.length(), dst);
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
uint32_t __cdecl LMySqPushString(uint32_t v, const wchar_t* s, uint32_t l)
|
||||
{
|
||||
//获取技能攻击力
|
||||
|
|
@ -116,13 +107,6 @@ uint32_t __cdecl LMySqPushString(uint32_t v, const wchar_t* s, uint32_t l)
|
|||
return LrealSqPushString(v, L"L_getCurrentModuleDamageRate", l);
|
||||
}
|
||||
|
||||
//drawmain drawMainCustomUI_ATFighter(obj)
|
||||
//if (wcsstr(s, L"drawMainCustomUI_")) {
|
||||
// std::cout << 11 << std::endl;
|
||||
//}
|
||||
//compilestring
|
||||
|
||||
//wprintf(L"Function:%s \n",s );
|
||||
return LrealSqPushString(v, s, l);
|
||||
}
|
||||
|
||||
|
|
@ -1921,6 +1905,7 @@ DWORD _fastcall New4C61F0(DWORD thisc, DWORD Seat)
|
|||
squirrel::InitGameScript();//调用初始化程序
|
||||
Init = true;
|
||||
mouseInit = true;
|
||||
InitGameFlag = true;
|
||||
}
|
||||
|
||||
uint32_t v = GetSqVm();
|
||||
|
|
@ -2347,42 +2332,53 @@ void New11BDC90(int a1, unsigned int a2, int a3) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
typedef int (_fastcall _1183720)(DWORD thisc, DWORD Seat,int a2);
|
||||
static _1183720* Old1183720;
|
||||
int _fastcall New1183720(DWORD thisc, DWORD Seat, int a2)
|
||||
{
|
||||
|
||||
|
||||
int ret = Old1183720(thisc, 0,a2);
|
||||
|
||||
static bool Init = false;
|
||||
if (DNFTOOL::GetHook(0x1A5FB4C, "0x14+0x28+") == 0) {
|
||||
if (!Init)
|
||||
{
|
||||
Init = true;
|
||||
}
|
||||
typedef void (__fastcall _OpenWindow)(DWORD thisc, DWORD Seat, DWORD a1, char* a2, DWORD a3);
|
||||
static _OpenWindow* OldOpenWindow;
|
||||
void __fastcall NewOpenWindow(DWORD thisc, DWORD Seat, DWORD a1, char* a2, DWORD a3) {
|
||||
if (*(DWORD*)0x1A5FB20 == thisc) {
|
||||
uint32_t v = GetSqVm();
|
||||
SQPushRootTable(v);
|
||||
SQPushString(v, L"L_OpenOldWindowCallBack", -1);
|
||||
SQ_Get(v, -2);
|
||||
SQPushRootTable(v);
|
||||
SQPushInt(v, a1);
|
||||
SQ_Call(v, 2, 0, 1);
|
||||
SQPop(v, 2);
|
||||
}
|
||||
if (Init) {
|
||||
if (a2 == 0x1a500f0) {
|
||||
uint32_t v = GetSqVm();
|
||||
|
||||
SQPushRootTable(v);
|
||||
SQPushString(v, L"L_DrawWindow_B", -1);
|
||||
SQ_Get(v, -2);
|
||||
SQPushRootTable(v);
|
||||
SQ_Call(v, 1, 0, 1);
|
||||
SQPop(v, 2);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
OldOpenWindow(thisc, 0, a1, a2, a3);
|
||||
}
|
||||
|
||||
|
||||
void __declspec(naked)DrawWindow_B_Hook() {
|
||||
static int address = 0xFFDA10;
|
||||
static int address1 = 0x66BEA1;
|
||||
_asm
|
||||
{
|
||||
pushad
|
||||
pushfd
|
||||
|
||||
}
|
||||
|
||||
if (InitGameFlag)
|
||||
{
|
||||
SQPushRootTable(*(uint32_t*)0x1AF3544);
|
||||
SQPushString(*(uint32_t*)0x1AF3544, L"L_DrawWindow_B", -1);
|
||||
SQ_Get(*(uint32_t*)0x1AF3544, -2);
|
||||
SQPushRootTable(*(uint32_t*)0x1AF3544);
|
||||
SQ_Call(*(uint32_t*)0x1AF3544, 1, 0, 1);
|
||||
SQPop(*(uint32_t*)0x1AF3544, 2);
|
||||
}
|
||||
|
||||
_asm {
|
||||
popfd
|
||||
popad
|
||||
mov ecx,eax
|
||||
call address
|
||||
jmp address1
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#include "inlinehook.h"
|
||||
int hook::RegisterHook()
|
||||
{
|
||||
//玩家菜单选项HOOK 有回调
|
||||
|
|
@ -2391,9 +2387,9 @@ int hook::RegisterHook()
|
|||
//修复滚轮
|
||||
inlinehook MMM(0x011BDE05, (int)&MouseWheelUp);
|
||||
MMM.Motify_address();
|
||||
|
||||
//inlinehook QQQ(0x049DEDB, (int)&TestDDraw);
|
||||
//QQQ.Motify_address();
|
||||
//窗口绘制HOOK
|
||||
inlinehook WindowDrawHook(0x066BE9A, (int)&DrawWindow_B_Hook);
|
||||
WindowDrawHook.Motify_address();
|
||||
|
||||
|
||||
//个人信息
|
||||
|
|
@ -2408,11 +2404,9 @@ int hook::RegisterHook()
|
|||
MH_Initialize();
|
||||
|
||||
|
||||
//´°¿Ú»æÖÆHOOK
|
||||
MH_CreateHook((void*)0x1183720, &New1183720, reinterpret_cast<void**>(&Old1183720));
|
||||
MH_EnableHook((void*)0x1183720);
|
||||
|
||||
|
||||
//窗口打开事件Hook
|
||||
MH_CreateHook((void*)0xE6E070, &NewOpenWindow, reinterpret_cast<void**>(&OldOpenWindow));
|
||||
MH_EnableHook((void*)0xE6E070);
|
||||
|
||||
//鼠标事件HOOK
|
||||
MH_CreateHook((void*)0x11BDC90, &New11BDC90, reinterpret_cast<void**>(&Old11BDC90));
|
||||
|
|
|
|||
Loading…
Reference in New Issue