111
This commit is contained in:
339
test/hook.cpp
339
test/hook.cpp
@@ -36,7 +36,9 @@ uint32_t __cdecl hook::H_Register_Nut(uint32_t v, void* f, int freeVarsCnt)
|
||||
uint32_t v = GetSqVm();
|
||||
std::string BaseFile = "YosinBaseC";
|
||||
//std::string Base = "function Sq_Get_Ex_LevelData(a,b,c) {return 0;} function Sq_Get_Ex_IntData(a,b,c) {return 0;} function Sq_Get_Ex_SkillCoolTime(a,b,c) {return 0;} function Lenheart(pack) {} function Sq_DrawMainMaxLayerCustomUI(pack) { } function Sq_DrawMainTopLayerCustomUI(pack) {} function Sq_SelectCharacter(Chunk){} function Sq_SendPackType_Event(Chunk){} function Sq_SendPackByte_Event(Chunk){} function Sq_SendPackWord_Event(Chunk){} function Sq_SendPackDWord_Event(Chunk){} function Sq_SendPackChar_Event(Chunk){} function Sq_SendPack_Event(Chunk){} function Sq_Pack_Control(Chunk){} ";
|
||||
std::string Base = R"(function Sq_L_Medal (x,y) {}
|
||||
std::string Base = R"(
|
||||
Lenheart_P_Update <- true;
|
||||
function Sq_L_Medal (x,y) {}
|
||||
function Sq_SettingWindowCallBack (x,y) {}
|
||||
function Sq_BuffSwitchingCallBack (x,y) {}
|
||||
function Sq_SwitchingCallBack (x,y) {}
|
||||
@@ -72,6 +74,11 @@ function Sq_MessageWindowDraw (a,c) {}
|
||||
function Sq_Get_Event_Pos (a) {return 1;}
|
||||
function Sq_L_OtherPlayerInfo (x, y, Type, Value, ImgBuf) {local str = Value.tostring(); local lenght = LenheartTextClass.GetStringLength(str); L_sq_DrawImg(ImgBuf, x + 70 - lenght, y + 5); return Value;}
|
||||
function Sq_DrawMiniMapUI (a) {}
|
||||
function Sq_CompleteTask(a1,a2,a3){}
|
||||
function L_drawMainCustomUI_All(){}
|
||||
function L_MouseCallBack(a, b, c,d) {}
|
||||
function L_DrawWindow_A() {}
|
||||
function L_DrawWindow_B() {}
|
||||
)";
|
||||
wchar_t* sfile = DNFTOOL::charTowchar_t((char*)BaseFile.c_str());
|
||||
wchar_t* ss = DNFTOOL::charTowchar_t((char*)Base.c_str());
|
||||
@@ -111,7 +118,7 @@ uint32_t __cdecl LMySqPushString(uint32_t v, const wchar_t* s, uint32_t l)
|
||||
|
||||
//drawmain drawMainCustomUI_ATFighter(obj)
|
||||
//if (wcsstr(s, L"drawMainCustomUI_")) {
|
||||
// return LrealSqPushString(v, L"L_drawMainCustomUI_All", l);
|
||||
// std::cout << 11 << std::endl;
|
||||
//}
|
||||
//compilestring
|
||||
|
||||
@@ -159,9 +166,6 @@ void _fastcall hook::H_Register_DrawCode(DWORD thisc, int Seat, int a3, int a4,
|
||||
DNFTOOL::Wchar_tToString(GameStr, clone);
|
||||
delete[]clone;
|
||||
|
||||
//if (GameStr.find("快捷键") != std::string::npos) {
|
||||
// std::cout << 121231 << std::endl;
|
||||
//}
|
||||
|
||||
//他人信息描述HOOK
|
||||
if (OtherPlayerInfoType != 0) {
|
||||
@@ -216,6 +220,14 @@ void _fastcall hook::H_Register_DrawCode(DWORD thisc, int Seat, int a3, int a4,
|
||||
}
|
||||
|
||||
|
||||
if (DNFTOOL::GetHook(0x1A5FB4C, "0x14+0x28+") == 6) {
|
||||
if (GameStr.find("ch20.天帷巨兽") != std::string::npos)
|
||||
{
|
||||
wchar_t* nclone = L"超时空之战-团本区域";
|
||||
return DrawCodeF(thisc, Seat, a3, a4, a5, (int)nclone);
|
||||
}
|
||||
}
|
||||
|
||||
//if (GameStr.find("天界地区") != std::string::npos)
|
||||
//{
|
||||
// std::cout << GameStr << std::endl;
|
||||
@@ -1488,8 +1500,8 @@ 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 == 6) {
|
||||
//std::cout << 12123123 << std::endl;
|
||||
if (a2 == 239) {
|
||||
std::cout << 12123123 << std::endl;
|
||||
}
|
||||
return OldGet_Img(thisc, 0, a2);
|
||||
}
|
||||
@@ -1506,9 +1518,16 @@ int _fastcall New11C0410(int* thisc, void*, int a2, wchar_t* a3)
|
||||
//}
|
||||
|
||||
char* OutPutText = DNFTOOL::wchar_tTochar(str);
|
||||
|
||||
static std::map<std::string, bool> UNN;
|
||||
std::string B = OutPutText;
|
||||
//std::cout << B << std::endl;
|
||||
if(B.find(".img") != std::string::npos )
|
||||
{
|
||||
if (!UNN[B]) {
|
||||
UNN[B] = true;
|
||||
std::cout << B << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//if (B.find("extrafeature") != std::string::npos) {
|
||||
// std::cout << B << std::endl;
|
||||
@@ -1806,6 +1825,10 @@ void __declspec(naked)TestJmp3() {
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef DWORD(_fastcall _4C61F0)(DWORD thisc, DWORD Seat);
|
||||
static _4C61F0* Old4C61F0;
|
||||
|
||||
@@ -1816,52 +1839,49 @@ extern std::vector<std::string> BaseData;
|
||||
|
||||
#include<fstream>
|
||||
#include <dinput.h>
|
||||
|
||||
void outputWcharToFile(const wchar_t* str, const wchar_t* filename) {
|
||||
std::wofstream file(filename);
|
||||
if (file.is_open()) {
|
||||
file << str;
|
||||
file.close();
|
||||
}
|
||||
else {
|
||||
std::wcerr << L"Error: Unable to open file " << filename << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void Suxn() {
|
||||
size_t Ds = BaseData.size();
|
||||
|
||||
for (size_t i = 0; i < Ds; i++)
|
||||
{
|
||||
std::string filename = "BaseData" + std::to_string(i);
|
||||
std::string str = BaseData[i];
|
||||
|
||||
|
||||
//std::cout << nutstr << std::endl;
|
||||
wchar_t* sfile = DNFTOOL::charTowchar_t((char*)filename.c_str());
|
||||
wchar_t* ss = DNFTOOL::charTowchar_t((char*)str.c_str());
|
||||
|
||||
//outputWcharToFile(ss, sfile);
|
||||
//wprintf(L"Function:%s \n", ss);
|
||||
//std::cout << i << std::endl;
|
||||
uint32_t v = GetSqVm();
|
||||
squirrel::SQdofileBuffer(v, sfile, ss);
|
||||
}
|
||||
|
||||
BaseData.clear();
|
||||
jiaoben = false;
|
||||
}
|
||||
|
||||
//DrawMain HOOK
|
||||
DWORD _fastcall New4C61F0(DWORD thisc, DWORD Seat)
|
||||
{
|
||||
static bool Init = false;
|
||||
|
||||
if (BaseData.size() > 0 && jiaoben == true && DNFTOOL::GetHook(0x1A5FB4C, "0x14+0x28+") == 1) {
|
||||
|
||||
|
||||
|
||||
size_t Ds = BaseData.size();
|
||||
|
||||
for (size_t i = 0; i < Ds; i++)
|
||||
{
|
||||
std::string filename = "BaseData" + std::to_string(i);
|
||||
std::string str = BaseData[i];
|
||||
|
||||
str = str.substr(str.find("[") + 1, str.length() - 2);
|
||||
|
||||
std::vector<std::string> Data;
|
||||
DNFTOOL::Split(str, Data, ", ");
|
||||
size_t Ds = Data.size();
|
||||
|
||||
char* nutstr = new char[Ds + 1];
|
||||
|
||||
|
||||
for (size_t s = 0; s < Ds; s++)
|
||||
{
|
||||
nutstr[s] = char(atoi(Data[s].c_str()));
|
||||
}
|
||||
nutstr[Ds] = '\0';
|
||||
|
||||
int skey[] = Skey;//定义解密数组
|
||||
Cutecode(nutstr, skey);//解密
|
||||
|
||||
//std::cout << nutstr << std::endl;
|
||||
wchar_t* sfile = DNFTOOL::charTowchar_t((char*)filename.c_str());
|
||||
wchar_t* ss = DNFTOOL::charTowchar_t((char*)nutstr);
|
||||
|
||||
//wprintf(L"Function:%s \n", sfile);
|
||||
//std::cout << i << std::endl;
|
||||
uint32_t v = GetSqVm();
|
||||
squirrel::SQdofileBuffer(v, sfile, ss);
|
||||
}
|
||||
|
||||
BaseData.clear();
|
||||
jiaoben = false;
|
||||
Suxn();
|
||||
}
|
||||
|
||||
|
||||
@@ -1876,6 +1896,13 @@ DWORD _fastcall New4C61F0(DWORD thisc, DWORD Seat)
|
||||
SQPushInt(v, 111);
|
||||
SQ_Call(v, 2, 0, 1);
|
||||
SQPop(v, 2);
|
||||
|
||||
SQPushRootTable(v);
|
||||
SQPushString(v, L"L_DrawWindow_A", -1);
|
||||
SQ_Get(v, -2);
|
||||
SQPushRootTable(v);
|
||||
SQ_Call(v, 1, 0, 1);
|
||||
SQPop(v, 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -2172,6 +2199,188 @@ int _fastcall New1030C30(int a1, int a2, BYTE* a3)
|
||||
}
|
||||
|
||||
|
||||
typedef int(_fastcall _8EE1E0)(DWORD thisc,DWORD Seat, int a2, char a3,char a4);
|
||||
static _8EE1E0* Old8EE1E0;
|
||||
int _fastcall New8EE1E0(DWORD thisc, DWORD Seat, int a2, char a3, char a4)
|
||||
{
|
||||
int ret = Old8EE1E0(thisc, Seat,a2, a3,a4);
|
||||
|
||||
uint32_t v = GetSqVm();
|
||||
SQPushRootTable(v);
|
||||
SQPushString(v, L"Sq_CompleteTask", -1);
|
||||
SQ_Get(v, -2);
|
||||
SQPushRootTable(v);
|
||||
SQPushInt(v, a2);
|
||||
SQPushInt(v, a3);
|
||||
SQPushInt(v, a4);
|
||||
SQ_Call(v, 4, 0, 1);
|
||||
SQPop(v, 2);
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
typedef int(_fastcall _674030)(wchar_t* thisc, DWORD Seat, int a2, int a3);
|
||||
static _674030* Old674030;
|
||||
int _fastcall New674030(wchar_t* thisc, DWORD Seat, int a2, int a3)
|
||||
{
|
||||
|
||||
|
||||
wchar_t* strbuffer = (wchar_t*)a2;
|
||||
wchar_t* clone = new wchar_t[wcslen(strbuffer) + 2];
|
||||
wcscpy(clone, strbuffer);
|
||||
|
||||
std::string GameStr;
|
||||
DNFTOOL::Wchar_tToString(GameStr, clone);
|
||||
delete[]clone;
|
||||
|
||||
|
||||
int ret = Old674030(thisc, Seat, a2, a3);
|
||||
|
||||
|
||||
|
||||
if (GameStr.find("drawMainCustomUI_") != std::string::npos) {
|
||||
uint32_t v = GetSqVm();
|
||||
SQPushRootTable(v);
|
||||
SQPushString(v, L"L_drawMainCustomUI_All", -1);
|
||||
SQ_Get(v, -2);
|
||||
SQPushRootTable(v);
|
||||
SQ_Call(v, 1, 0, 1);
|
||||
SQPop(v, 2);
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
|
||||
int AByteLittleToInt(unsigned char* Count)
|
||||
{
|
||||
int int1 = Count[0] & 0xff;
|
||||
int int2 = (Count[1] & 0xff) << 8;
|
||||
int int3 = (Count[2] & 0xff) << 16;
|
||||
int int4 = (Count[3] & 0xff) << 24;
|
||||
|
||||
return int1 | int2 | int3 | int4;
|
||||
}
|
||||
|
||||
typedef int(_fastcall _6FE1D0)(DWORD* thisc, DWORD Seat, int a2, int a3);
|
||||
static _6FE1D0* Old6FE1D0;
|
||||
int _fastcall New6FE1D0(DWORD* thisc, DWORD Seat, int a2, int a3)
|
||||
{
|
||||
|
||||
std::cout << "类型为: " << (int)*(unsigned __int16*)(a2 + 1) << std::endl;
|
||||
if (a2) {
|
||||
|
||||
|
||||
//std::cout << "地址为:" << std::hex << a2 << std::endl;
|
||||
|
||||
// 假设你有一个地址的指针,比如:
|
||||
char* address = (char*)a2; // 假设地址是0x1234
|
||||
|
||||
// 读取两个字节并转换为int
|
||||
unsigned char byte1 = address[0];
|
||||
unsigned char byte2 = address[1];
|
||||
|
||||
// 输出转换后的小端序int
|
||||
//std::cout << "转换后的小端序int第一位为:" << (int)byte1 << std::endl;
|
||||
//std::cout << "转换后的小端序int第二位为:" << (int)byte2 << std::endl << std::endl << std::endl;
|
||||
|
||||
if ((int)byte2 == 23) {
|
||||
for (size_t i = 0; i < 0x1f; i++)
|
||||
{
|
||||
std::cout << (int)address[i] << " ";
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
//std::cout << (*(BYTE*)(a2)) << std::endl;
|
||||
//std::cout << (*(BYTE*)(a2+1)) << std::endl;
|
||||
//std::cout << (*(BYTE*)(a2+2)) << std::endl;
|
||||
//std::cout << (*(BYTE*)(a2+3)) << std::endl;
|
||||
|
||||
int ret = Old6FE1D0(thisc, 0, a2, a3);
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
//鼠标事件
|
||||
typedef void( _11BDC90)(int a1, unsigned int a2, int a3);
|
||||
static _11BDC90* Old11BDC90;
|
||||
void New11BDC90(int a1, unsigned int a2, int a3) {
|
||||
|
||||
static bool Init = false;
|
||||
if (DNFTOOL::GetHook(0x1A5FB4C, "0x14+0x28+") == 0) {
|
||||
if (!Init)
|
||||
{
|
||||
Init = true;
|
||||
}
|
||||
}
|
||||
if (Init) {
|
||||
int X = *(int*)0x1B4686C;
|
||||
int Y = *(int*)0x1B46870;
|
||||
if ((X | Y) >= 0) {
|
||||
uint32_t v = GetSqVm();
|
||||
DWORD VmTop = SQGetTop(v);
|
||||
|
||||
SQPushRootTable(v);
|
||||
SQPushString(v, L"L_MouseCallBack", -1);
|
||||
SQ_Get(v, -2);
|
||||
SQPushRootTable(v);
|
||||
SQPushInt(v, a1);
|
||||
SQPushInt(v, a2);
|
||||
sq_pushinteger((HSQUIRRELVM)v, X);
|
||||
sq_pushinteger((HSQUIRRELVM)v, Y);
|
||||
SQ_Call(v, 5, 0, 1);
|
||||
SQPop(v, 2);
|
||||
}
|
||||
}
|
||||
|
||||
Old11BDC90(a1, a2, a3);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include "inlinehook.h"
|
||||
int hook::RegisterHook()
|
||||
@@ -2183,6 +2392,9 @@ int hook::RegisterHook()
|
||||
inlinehook MMM(0x011BDE05, (int)&MouseWheelUp);
|
||||
MMM.Motify_address();
|
||||
|
||||
//inlinehook QQQ(0x049DEDB, (int)&TestDDraw);
|
||||
//QQQ.Motify_address();
|
||||
|
||||
|
||||
//个人信息
|
||||
//inlinehook WWW(0xEDE6C5, (int)&PlayerInfo);
|
||||
@@ -2195,10 +2407,30 @@ int hook::RegisterHook()
|
||||
|
||||
MH_Initialize();
|
||||
|
||||
|
||||
//窗口绘制HOOK
|
||||
MH_CreateHook((void*)0x1183720, &New1183720, reinterpret_cast<void**>(&Old1183720));
|
||||
MH_EnableHook((void*)0x1183720);
|
||||
|
||||
|
||||
|
||||
//鼠标事件HOOK
|
||||
MH_CreateHook((void*)0x11BDC90, &New11BDC90, reinterpret_cast<void**>(&Old11BDC90));
|
||||
MH_EnableHook((void*)0x11BDC90);
|
||||
|
||||
|
||||
//N键大地图
|
||||
MH_CreateHook((void*)0x1030C30, &New1030C30, reinterpret_cast<void**>(&Old1030C30));
|
||||
MH_EnableHook((void*)0x1030C30);
|
||||
|
||||
//完成任务HOOK
|
||||
MH_CreateHook((void*)0x8EE1E0, &New8EE1E0, reinterpret_cast<void**>(&Old8EE1E0));
|
||||
MH_EnableHook((void*)0x8EE1E0);
|
||||
|
||||
//官方的组合NutHook
|
||||
MH_CreateHook((void*)0x674030, &New674030, reinterpret_cast<void**>(&Old674030));
|
||||
MH_EnableHook((void*)0x674030);
|
||||
|
||||
//MH_CreateHook((void*)0x909D70, &New909D70, reinterpret_cast<void**>(&Old909D70));
|
||||
//MH_EnableHook((void*)0x909D70);
|
||||
|
||||
@@ -2231,7 +2463,6 @@ int hook::RegisterHook()
|
||||
MH_CreateHook((void*)0x4C61F0, &New4C61F0, reinterpret_cast<void**>(&Old4C61F0));
|
||||
MH_EnableHook((void*)0x4C61F0);
|
||||
|
||||
|
||||
#ifdef FONT_BANK_SYSTEM
|
||||
//伤害字体 HOOK
|
||||
MH_CreateHook((void*)0x7EEED0, &New7EEED0, reinterpret_cast<void**>(&Old7EEED0));
|
||||
@@ -2258,6 +2489,8 @@ int hook::RegisterHook()
|
||||
//Hook收包
|
||||
MH_CreateHook((void*)INIT_PACK_ADDRESS, &H_Register_Pack, reinterpret_cast<void**>(&Lpfn_Init));
|
||||
MH_EnableHook((void*)INIT_PACK_ADDRESS);
|
||||
|
||||
|
||||
//HookNut函数注册
|
||||
MH_CreateHook((void*)INIT_NUT_ADDRESS, &H_Register_Nut, reinterpret_cast<void**>(&MLnewclosure));
|
||||
MH_EnableHook((void*)INIT_NUT_ADDRESS);
|
||||
@@ -2409,5 +2642,11 @@ int hook::RegisterHook()
|
||||
// HOOK exe 调用文本进 松鼠虚拟机
|
||||
//MH_CreateHook((void*)0x135B2C0, &NewSQ_Compilebuffer, reinterpret_cast<void**>(&OldSQ_Compilebuffer));
|
||||
//MH_EnableHook((void*)0x135B2C0);
|
||||
|
||||
//收包HOOK
|
||||
//MH_CreateHook((void*)0x06FE1D0, &New6FE1D0, reinterpret_cast<void**>(&Old6FE1D0));
|
||||
//MH_EnableHook((void*)0x06FE1D0);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user