This commit is contained in:
2022-04-11 19:44:03 +08:00
parent ca9f19d7c7
commit 191fcd3da9
5 changed files with 56 additions and 9 deletions

View File

@@ -29,6 +29,39 @@ void hook::H_Register_Pack(void* Ecx)
}
std::map<wchar_t*, int> bufferm;
static SqPushRootFunc* yuancall;
uint32_t ThFunc(uint32_t v)
{
int a = yuancall(v);
//std::cout << u8"参数个数" << params << std::endl;
//SQ_Get(v, -2);
//std::cout <<u8"参数个数为" << ParameterNum - 1 << std::endl;
for (int i = -3; i < 3; ++i)
{
if (SQ_GetType(v, i) == 134217744)
{
wchar_t* Name;
SQGetString(v, i, &Name);
if (bufferm.count(Name) == 0)
{
bufferm[Name] == 1;
std::wcout << u8"参数为" << Name << std::endl;
}
}
}
//SQPrintFunc(v);
return a;
}
int hook::RegisterHook()
{
@@ -37,23 +70,33 @@ int hook::RegisterHook()
MH_CreateHook((void*)INIT_NUT_ADDRESS, &H_Register_Nut, reinterpret_cast<void**>(&MLnewclosure));
MH_CreateHook((void*)0x1358C50, &ThFunc, reinterpret_cast<void**>(&yuancall));
MH_EnableHook((void*)INIT_PACK_ADDRESS);
MH_EnableHook((void*)INIT_NUT_ADDRESS);
//MH_EnableHook((void*)0x1358C50);
return 0;
}
int hook::InitGameScript()
{
MH_EnableHook((void*)0x1359280);
/*
uint32_t v = GetSqVm();
SQPushRootTable(v);
SQPushString(v, L"SetHudUI", -1);
SQ_Get(v, -2);
SQPushRootTable(v);
//SQPushString(v, L"1.cpp", -1);
SQPushString(v, L"1.cpp", -1);
SQ_Call(v, 2, 1, 0);
SQPop(v, 2);
std::cout << u8"调用成功" << std::endl;
*/
return 0;
}