11111
This commit is contained in:
262
Include/Hook.hpp
262
Include/Hook.hpp
@@ -7,11 +7,29 @@
|
||||
//游戏初始化完毕Flag
|
||||
static bool InitGameFlag = false;
|
||||
|
||||
|
||||
|
||||
//StringBin文件缓存
|
||||
extern std::vector<std::string> StringBin;
|
||||
|
||||
|
||||
//脚本是否请求到的Flag
|
||||
extern bool jiaoben;
|
||||
//脚本文件数组
|
||||
extern std::vector<std::string> BaseData;
|
||||
struct BufState {
|
||||
const wchar_t* buf;
|
||||
int ptr;
|
||||
int size;
|
||||
};
|
||||
//加载脚本的逻辑
|
||||
int Sq_mycompilebuffer(HSQUIRRELVM v, const wchar_t* s, int size, const wchar_t* filename, BOOL printerror) {
|
||||
BufState buf;
|
||||
buf.buf = s;
|
||||
buf.size = size;
|
||||
buf.ptr = 0;
|
||||
return SQ_Compile(v, (LSQLEXREADFUNC)0x1359AD0, &buf, filename, printerror);
|
||||
}
|
||||
void Suxn() {
|
||||
size_t Ds = BaseData.size();
|
||||
|
||||
@@ -23,21 +41,23 @@ void Suxn() {
|
||||
wchar_t* str = DNFTOOL::charTowchar_t((char*)strbuf.c_str());
|
||||
|
||||
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
|
||||
SQInteger Top = Sq_gettop(v);
|
||||
#ifdef SELL
|
||||
//std::cout << strbuf << std::endl;
|
||||
if (sq_mycompilebuffer(v, str, wcslen(str), L"interactive console", false) >= 0) {
|
||||
if (Sq_mycompilebuffer(v, str, wcslen(str), L"interactive console", false) >= 0) {
|
||||
Sq_pushroottable(v);
|
||||
Sq_call(v, 1, SQTrue, SQFalse);
|
||||
Sq_call(v, 1, SQFalse, SQTrue);
|
||||
Sq_pop(v, 1);
|
||||
//std::cout << "加载了: " << strbuf.substr(0, 100) << std::endl;
|
||||
}
|
||||
#else
|
||||
if (sq_mycompilebuffer(v, str, wcslen(str), filename, false) >= 0) {
|
||||
if (Sq_mycompilebuffer(v, str, wcslen(str), filename, false) >= 0) {
|
||||
Sq_pushroottable(v);
|
||||
Sq_call(v, 1, SQTrue, SQFalse);
|
||||
Sq_call(v, 1, SQFalse, SQTrue);
|
||||
Sq_pop(v, 1);
|
||||
}
|
||||
#endif // SELL
|
||||
|
||||
Sq_settop(v, Top);
|
||||
delete[] filename;
|
||||
delete[] str;
|
||||
}
|
||||
@@ -236,7 +256,7 @@ void __declspec(naked)BuffIcon_Hook_B() {
|
||||
}
|
||||
}
|
||||
void __declspec(naked)HudBloodBackground() {
|
||||
static int address = 0x4CA055;
|
||||
static int address = 0x4CA03D;
|
||||
_asm
|
||||
{
|
||||
pushad
|
||||
@@ -260,6 +280,8 @@ void __declspec(naked)HudBloodBackground() {
|
||||
_asm {
|
||||
popfd
|
||||
popad
|
||||
mov ecx,[esi+0xa94]
|
||||
push 0
|
||||
jmp address
|
||||
}
|
||||
}
|
||||
@@ -438,8 +460,49 @@ void __declspec(naked)SelectCharacter_Hook7() {
|
||||
jmp address
|
||||
}
|
||||
}
|
||||
REG ReadStringBin_HookAsm = { 0 };
|
||||
void InserBinStr(char* src, int size) {
|
||||
StringBin.push_back(std::string(src, size));
|
||||
}
|
||||
void __declspec(naked)ReadStringBin_HookA() {
|
||||
static int address = 0x119F303;
|
||||
_asm
|
||||
{
|
||||
pushad
|
||||
pushfd
|
||||
}
|
||||
|
||||
InserBinStr("error str",10);
|
||||
|
||||
_asm {
|
||||
popfd
|
||||
popad
|
||||
mov ecx,0xff
|
||||
lea edi,[ebp - 0x410]
|
||||
jmp address
|
||||
}
|
||||
}
|
||||
void __declspec(naked)ReadStringBin_HookB() {
|
||||
static int address = 0x119F2C8;
|
||||
_asm
|
||||
{
|
||||
pushad
|
||||
pushfd
|
||||
mov ReadStringBin_HookAsm.EBX, ebx
|
||||
mov ReadStringBin_HookAsm.ESI, esi
|
||||
mov ReadStringBin_HookAsm.ECX ,ecx
|
||||
}
|
||||
|
||||
InserBinStr((char*)ReadStringBin_HookAsm.ESI, ReadStringBin_HookAsm.EBX);
|
||||
|
||||
_asm {
|
||||
popfd
|
||||
popad
|
||||
mov eax,[ebp + 450]
|
||||
add eax,ebx
|
||||
jmp address
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -654,52 +717,6 @@ int _fastcall NewFA42D0(int a1, int seat, int a2, int a3)
|
||||
|
||||
|
||||
|
||||
//DrawMain HOOK
|
||||
typedef DWORD(_fastcall _4C61F0)(DWORD thisc, DWORD Seat);
|
||||
static _4C61F0* Old4C61F0;
|
||||
DWORD _fastcall New4C61F0(DWORD thisc, DWORD Seat)
|
||||
{
|
||||
DWORD Ret = Old4C61F0(thisc, Seat);
|
||||
if (BaseData.size() > 0 && jiaoben == true && InitGameFlag) {
|
||||
Suxn();
|
||||
}
|
||||
static bool mouseInit = false;
|
||||
|
||||
//进入角色调用
|
||||
if (DNFTOOL::GetHook(0x1A5FB4C, "0x14+0x28+", 0) == 0) {
|
||||
if (!InitGameFlag)
|
||||
{
|
||||
InitGameFlag = true;
|
||||
}
|
||||
}
|
||||
if (InitGameFlag) {
|
||||
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
|
||||
SQInteger Top = Sq_gettop(v);
|
||||
//std::cout << "A: " << Sq_gettop(v) << std::endl;
|
||||
//Old1359130(v, *(int*)((char*)0x19E364 + (4 * 5)), *(int*)((char*)0x19E364 + (4 * 6)));
|
||||
//Old1359130(v, *(int*)((char*)0x19E364 + (4 * 2)), *(int*)((char*)0x19E364 + (4 * 3)));
|
||||
//std::cout << "Q: " << Sq_gettop(v) << std::endl;
|
||||
Sq_pushroottable(v);
|
||||
Sq_pushstring(v, L"L_DrawWindow_A", -1);
|
||||
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
|
||||
Sq_pushroottable(v);
|
||||
Sq_call(v, 1, SQFalse, SQTrue);
|
||||
}
|
||||
Sq_settop(v, Top);
|
||||
|
||||
Top = Sq_gettop(v);
|
||||
Sq_pushroottable(v);
|
||||
Sq_pushstring(v, L"L_drawMainCustomUI_All", -1);
|
||||
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
|
||||
Sq_pushroottable(v);
|
||||
Sq_call(v, 1, SQFalse, SQTrue);
|
||||
}
|
||||
Sq_settop(v, Top);
|
||||
//std::cout << "H: " << Sq_gettop(v) << std::endl;
|
||||
}
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
//伤害字体 HOOK
|
||||
typedef DWORD(_cdecl _7EEED0)(DWORD a1, DWORD a2, DWORD a3, DWORD a4, DWORD a5, DWORD a6);
|
||||
@@ -781,6 +798,56 @@ void H_Register_Pack(void* Ecx)
|
||||
Registerfunc(130, Pack_Control, 0);
|
||||
}
|
||||
|
||||
//DrawMain HOOK
|
||||
typedef DWORD(_fastcall _4C61F0)(DWORD thisc, DWORD Seat);
|
||||
static _4C61F0* Old4C61F0;
|
||||
DWORD _fastcall New4C61F0(DWORD thisc, DWORD Seat)
|
||||
{
|
||||
DWORD Ret = Old4C61F0(thisc, Seat);
|
||||
if (BaseData.size() > 0 && jiaoben == true && InitGameFlag) {
|
||||
Suxn();
|
||||
|
||||
//注册包控制 (很多煞笔登录器不让开始注册)
|
||||
auto Registerfunc = reinterpret_cast<register_pack_handler_t>(0x7186D0);
|
||||
Registerfunc(130, Pack_Control, 0);
|
||||
}
|
||||
static bool mouseInit = false;
|
||||
|
||||
//进入角色调用
|
||||
if (DNFTOOL::GetHook(0x1A5FB4C, "0x14+0x28+", 0) == 0) {
|
||||
if (!InitGameFlag)
|
||||
{
|
||||
InitGameFlag = true;
|
||||
}
|
||||
}
|
||||
if (InitGameFlag) {
|
||||
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
|
||||
SQInteger Top = Sq_gettop(v);
|
||||
//std::cout << "A: " << Sq_gettop(v) << std::endl;
|
||||
//Old1359130(v, *(int*)((char*)0x19E364 + (4 * 5)), *(int*)((char*)0x19E364 + (4 * 6)));
|
||||
//Old1359130(v, *(int*)((char*)0x19E364 + (4 * 2)), *(int*)((char*)0x19E364 + (4 * 3)));
|
||||
//std::cout << "Q: " << Sq_gettop(v) << std::endl;
|
||||
Sq_pushroottable(v);
|
||||
Sq_pushstring(v, L"L_DrawWindow_A", -1);
|
||||
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
|
||||
Sq_pushroottable(v);
|
||||
Sq_call(v, 1, SQFalse, SQTrue);
|
||||
}
|
||||
Sq_settop(v, Top);
|
||||
|
||||
Top = Sq_gettop(v);
|
||||
Sq_pushroottable(v);
|
||||
Sq_pushstring(v, L"L_drawMainCustomUI_All", -1);
|
||||
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
|
||||
Sq_pushroottable(v);
|
||||
Sq_call(v, 1, SQFalse, SQTrue);
|
||||
}
|
||||
Sq_settop(v, Top);
|
||||
//std::cout << "H: " << Sq_gettop(v) << std::endl;
|
||||
}
|
||||
return Ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -797,6 +864,14 @@ void __cdecl H_Register_Nut()
|
||||
R_Register_Nut();
|
||||
std::string BaseFile = "YosinBaseC";
|
||||
std::string Base = R"(
|
||||
FFI_FIRST_ABI <- 0;
|
||||
FFI_SYSV <- 1;
|
||||
FFI_STDCALL <- 2;
|
||||
FFI_THISCALL <- 3;
|
||||
FFI_FASTCALL <- 4;
|
||||
FFI_MS_CDECL <- 5;
|
||||
FFI_PASCAL <- 6;
|
||||
FFI_REGISTER <- 7;
|
||||
Lenheart_P_Update <- true;
|
||||
function Sq_L_Medal (x,y) {}
|
||||
function Sq_SettingWindowCallBack (x,y) {}
|
||||
@@ -899,7 +974,7 @@ typedef int(_fastcall _DrawOtherPlayer_Img)(int thisc, void*, int X, int Y, int
|
||||
static _DrawOtherPlayer_Img* DrawOtherPlayer_Img = (_DrawOtherPlayer_Img*)0x11A8F60;
|
||||
void _fastcall H_Register_DrawCode(DWORD thisc, int Seat, int a3, int a4, int a5, int a6)
|
||||
{
|
||||
|
||||
//std::cout << std::hex << a6 << std::endl;
|
||||
|
||||
wchar_t* strbuffer = (wchar_t*)a6;
|
||||
if (strbuffer == NULL)return;
|
||||
@@ -912,9 +987,9 @@ void _fastcall H_Register_DrawCode(DWORD thisc, int Seat, int a3, int a4, int a5
|
||||
delete[]clone;
|
||||
|
||||
|
||||
//if (GameStr.find("1/") != std::string::npos) {
|
||||
// std::cout << GameStr << std::endl;
|
||||
//}
|
||||
if (GameStr.find("商城") != std::string::npos) {
|
||||
std::cout << GameStr << std::endl;
|
||||
}
|
||||
|
||||
return DrawCodeF(thisc, Seat, a3, a4, a5, a6);
|
||||
}
|
||||
@@ -1186,7 +1261,7 @@ void _fastcall New10F2700(DWORD thisc, DWORD Seat, int a2)
|
||||
|
||||
static bool Flag = false;
|
||||
if (!Flag && thisc) {
|
||||
for (size_t i = 0; i < 29; i++)
|
||||
for (size_t i = 0; i < 28; i++)
|
||||
{
|
||||
int addr = *(int*)(thisc + (0x4 * i) + 0x1c);
|
||||
int value = *(int*)(addr + 0x14);
|
||||
@@ -1524,7 +1599,7 @@ DWORD __fastcall New7CDA30(void* thisc, DWORD Seat, DWORD* a2, DWORD a3, DWORD a
|
||||
Sq_pushstring(v, L"L_Sync_Camera_Pos", -1);
|
||||
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
|
||||
Sq_pushroottable(v);
|
||||
Sq_pushinteger(v, *(int*)((int)thisc + 0x638));
|
||||
Sq_pushinteger(v,(int)thisc);
|
||||
Sq_call(v, 2, SQFalse, SQTrue);
|
||||
}
|
||||
Sq_settop(v, Top);
|
||||
@@ -1537,12 +1612,11 @@ typedef int(_fastcall _Get_Img)(int thisc, void*, int a2);
|
||||
static _Get_Img* OldGet_Img;
|
||||
int _fastcall NewGet_Img(int thisc, void*, int a2) {
|
||||
|
||||
if (a2 == 76) {
|
||||
std::cout << 12123123 << std::endl;
|
||||
}
|
||||
|
||||
return OldGet_Img(thisc, 0, a2);
|
||||
}
|
||||
|
||||
|
||||
typedef int(_fastcall _4294A0)(int thisc, void*,int a2);
|
||||
static _4294A0* Old4294A0;
|
||||
int _fastcall New4294A0(int thisc, void*,int a2) {
|
||||
@@ -1551,6 +1625,42 @@ int _fastcall New4294A0(int thisc, void*,int a2) {
|
||||
return Old4294A0(thisc, 0,a2);
|
||||
}
|
||||
|
||||
typedef int(_fastcall _FFDC60)(int thisc, void*, int a2,int a3 ,int a4);
|
||||
static _FFDC60* OldFFDC60;
|
||||
int _fastcall NewFFDC60(int thisc, void*, int a2, int a3, int a4) {
|
||||
//return 0;
|
||||
|
||||
int X = *(int*)0x1B4686C;
|
||||
int Y = *(int*)0x1B46870;
|
||||
SQInteger Flag = 0;
|
||||
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
|
||||
SQInteger Top = Sq_gettop(v);
|
||||
Sq_pushroottable(v);
|
||||
Sq_pushstring(v, L"SyncRindro_Cursor", -1);
|
||||
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
|
||||
Sq_pushroottable(v);
|
||||
Sq_pushinteger(v, X);
|
||||
Sq_pushinteger(v, Y);
|
||||
Sq_call(v,3, SQTrue, SQTrue);
|
||||
Sq_getinteger(v, -1, &Flag);
|
||||
}
|
||||
Sq_settop(v, Top);
|
||||
|
||||
if (Flag == 1)return 0;
|
||||
return OldFFDC60(thisc, 0, a2,a3,a4);
|
||||
}
|
||||
|
||||
|
||||
typedef int(_fastcall _4017F0)(int thisc, void* a2, char* str, int a3);
|
||||
static _4017F0* Old4017F0;
|
||||
int _fastcall New4017F0(int thisc, void* a2, char* str, int a3) {
|
||||
static int idx = 0;
|
||||
std::string Buf(str, a3);
|
||||
StringBin.push_back(Buf);
|
||||
|
||||
idx++;
|
||||
return Old4017F0(thisc, a2, str,a3);
|
||||
}
|
||||
|
||||
void RegisterHook() {
|
||||
|
||||
@@ -1569,6 +1679,12 @@ void RegisterHook() {
|
||||
inlinehook DamageHook(0xE5A2DE, (int)&Damage_Hook);
|
||||
DamageHook.Motify_address();
|
||||
|
||||
//读取StringBin文件
|
||||
inlinehook ReadStringBinHookA(0x119F2F8, (int)&ReadStringBin_HookA);
|
||||
ReadStringBinHookA.Motify_address();
|
||||
inlinehook ReadStringBinHookB(0x119F2C0, (int)&ReadStringBin_HookB);
|
||||
ReadStringBinHookB.Motify_address();
|
||||
|
||||
|
||||
|
||||
//Fundction Hook//
|
||||
@@ -1580,6 +1696,10 @@ void RegisterHook() {
|
||||
//MH_EnableHook((void*)0x4294A0);
|
||||
|
||||
|
||||
//绘制鼠标
|
||||
MH_CreateHook((void*)0xFFDC60, &NewFFDC60, reinterpret_cast<void**>(&OldFFDC60));
|
||||
MH_EnableHook((void*)0xFFDC60);
|
||||
|
||||
//MH_CreateHook((void*)0x11AA190, &NewGet_Img, reinterpret_cast<void**>(&OldGet_Img));
|
||||
//MH_EnableHook((void*)0x11AA190);
|
||||
|
||||
@@ -1627,8 +1747,8 @@ void RegisterHook() {
|
||||
MH_EnableHook((void*)0x67B910);
|
||||
|
||||
//Hook绘制字符
|
||||
MH_CreateHook((void*)0x1206BD0, &H_Register_DrawCode, reinterpret_cast<void**>(&DrawCodeF));
|
||||
MH_EnableHook((void*)0x1206BD0);
|
||||
//MH_CreateHook((void*)0x1206BD0, &H_Register_DrawCode, reinterpret_cast<void**>(&DrawCodeF));
|
||||
//MH_EnableHook((void*)0x1206BD0);
|
||||
|
||||
|
||||
//HOOK获取绘制颜色
|
||||
@@ -1651,8 +1771,8 @@ void RegisterHook() {
|
||||
//MH_EnableHook((void*)0x11285B0);
|
||||
//MH_CreateHook((void*)0x11285E0, &NewSendPacksChar, reinterpret_cast<void**>(&_OldSendPackChar));
|
||||
//MH_EnableHook((void*)0x11285E0);
|
||||
MH_CreateHook((void*)0x1127EC0, &NewSend, reinterpret_cast<void**>(&_OldSend));
|
||||
MH_EnableHook((void*)0x1127EC0);
|
||||
//MH_CreateHook((void*)0x1127EC0, &NewSend, reinterpret_cast<void**>(&_OldSend));
|
||||
//MH_EnableHook((void*)0x1127EC0);
|
||||
|
||||
//exe字符串索引
|
||||
MH_CreateHook((void*)0x1220590, &Newsub1220590, reinterpret_cast<void**>(&sub1220590));
|
||||
@@ -1662,6 +1782,10 @@ void RegisterHook() {
|
||||
MH_CreateHook((void*)0x11A8F60, &newsub11A8F60, reinterpret_cast<void**>(&sub11A8F60));
|
||||
MH_EnableHook((void*)0x11A8F60);
|
||||
|
||||
//血槽背景层Hook (图标绘制也在这里)
|
||||
inlinehook HudBloodBackgroundHook(0x04CA035, (int)&HudBloodBackground);
|
||||
HudBloodBackgroundHook.Motify_address();
|
||||
|
||||
//如果加载了百级UI
|
||||
FILE* file = fopen("ImagePacks2/!HUD_Yosin百级UI.NPK", "rb");
|
||||
if (file) {
|
||||
@@ -1671,9 +1795,6 @@ void RegisterHook() {
|
||||
//BUFF图标 文字标识
|
||||
inlinehook BuffIconHookB(0x04BF55E, (int)&BuffIcon_Hook_B);
|
||||
BuffIconHookB.Motify_address();
|
||||
//血槽背景
|
||||
inlinehook HudBloodBackgroundHook(0x04CA035, (int)&HudBloodBackground);
|
||||
HudBloodBackgroundHook.Motify_address();
|
||||
|
||||
//活动图标
|
||||
MH_CreateHook((void*)0x11B4030, &NewEvent, reinterpret_cast<void**>(&OldEvent));
|
||||
@@ -1704,6 +1825,7 @@ void RegisterHook() {
|
||||
SelectCharacter6.Motify_address();
|
||||
inlinehook SelectCharacter7(0x10F3478, (int)&SelectCharacter_Hook7);
|
||||
SelectCharacter7.Motify_address();
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
@@ -1732,8 +1854,8 @@ void RegisterHook() {
|
||||
MH_CreateHook((void*)0x11B3B70, &New11B3B70, reinterpret_cast<void**>(&Old11B3B70));
|
||||
MH_EnableHook((void*)0x11B3B70);
|
||||
//个人面板的属性信息遍历
|
||||
MH_CreateHook((void*)0x11D43A0, &New11D43A0, reinterpret_cast<void**>(&Old11D43A0));
|
||||
MH_EnableHook((void*)0x11D43A0);
|
||||
//MH_CreateHook((void*)0x11D43A0, &New11D43A0, reinterpret_cast<void**>(&Old11D43A0));
|
||||
//MH_EnableHook((void*)0x11D43A0);
|
||||
|
||||
|
||||
//他人信息Hook 数值
|
||||
|
||||
Reference in New Issue
Block a user