diff --git a/test/dllmain.cpp b/test/dllmain.cpp index 502fde3..3c5425f 100644 --- a/test/dllmain.cpp +++ b/test/dllmain.cpp @@ -27,6 +27,7 @@ void LenheartThread(void) if (DNFTOOL::GetHook(0x1A5FB4C, "0x14+0x28+") == 6)可开始执行判断 = 1; if (可开始执行判断 == 1)//选频道界面 游戏初始化完毕 { + //hook::InitGameScript(); while (true) { Sleep(10); diff --git a/test/hook.cpp b/test/hook.cpp index 79c1c1d..ca7628f 100644 --- a/test/hook.cpp +++ b/test/hook.cpp @@ -29,6 +29,39 @@ void hook::H_Register_Pack(void* Ecx) } +std::map 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 <(&MLnewclosure)); + + MH_CreateHook((void*)0x1358C50, &ThFunc, reinterpret_cast(&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; } diff --git a/test/hook.h b/test/hook.h index b5e78e7..602bb86 100644 --- a/test/hook.h +++ b/test/hook.h @@ -14,7 +14,7 @@ public: //HOOK static int RegisterHook(); - + static void bbbb(); //ִNut static int InitGameScript(); }; diff --git a/test/squirrel.cpp b/test/squirrel.cpp index b912ed3..4a755d7 100644 --- a/test/squirrel.cpp +++ b/test/squirrel.cpp @@ -76,10 +76,9 @@ int squirrel::sq_Test(uint32_t v) //GMNotice((char*)u"ҵ"); //WindowsNotice((char*)u"ҵ"); - - SQPopTop(v); - SQPushInt(v, 1); - return 1; + //SQPopTop(v); + //SQPushInt(v, 1); + return 0; } // װ int squirrel::GetCharacterAttribute(uint32_t v) @@ -1007,7 +1006,6 @@ int squirrel::Set_DragonModel(uint32_t v) return 1; } - //ȡSquirrel v ַ inline uint32_t GetSqVm() { diff --git a/test/squirrel.h b/test/squirrel.h index 45bd726..6e31429 100644 --- a/test/squirrel.h +++ b/test/squirrel.h @@ -2,6 +2,9 @@ //-------------------------------------------------------------------------------------------Squirrel +// printFunc ջջ +typedef int(SqPrintFunc)(uint32_t v); +static SqPrintFunc* SQPrintFunc = (SqPrintFunc*)0x1354060; // PushRoot typedef int(SqPushRootFunc)(uint32_t v); static SqPushRootFunc* SQPushRootTable = (SqPushRootFunc*)0x1358C50; @@ -22,6 +25,9 @@ static SqPop* SQPop = (SqPop*)0x1358FD0; //SQ_Get typedef int(Sq_Get)(uint32_t v, int n); static Sq_Get* SQ_Get = (Sq_Get*)0x135AE30; +//SQ_Get +typedef int(Sq_GetType)(uint32_t v, int n); +static Sq_GetType* SQ_GetType = (Sq_GetType*)0x1358CD0; //SQ_Rawget typedef int(Sq_Rawget)(uint32_t v, int n); static Sq_Rawget* SQ_Rawget = (Sq_Rawget*)0x135AEA0; @@ -184,7 +190,6 @@ public:// static int Get_DragonModel(uint32_t v);//ȡ ģʽ static int Set_DragonModel(uint32_t v);// ģʽ - public: //nutӿfuncNameCԺfuncAddr