新增UI修改

This commit is contained in:
Lenheart 2022-03-06 09:47:55 +08:00
parent 378f4ba664
commit 2e28352b42
5 changed files with 244 additions and 64 deletions

View File

@ -38,6 +38,24 @@ uint32_t NewPushString(uint32_t v, wchar_t* f, int freeVarsCnt)
return MLSqPushString(v, f, freeVarsCnt);
}
static DrawTe* Cbuffer = NULL;
int Tihuan(DWORD thisc,int a2, int a3, int a4, int a5, int a6, __int64 a7, float a8, float a9, float a10, int a11, int a12)
{
std::cout << a2 << std::endl;
std::cout << a3 << std::endl;
std::cout << a4 << std::endl;
std::cout << a5 << std::endl;
std::cout << a6 << std::endl;
std::cout << a7 << std::endl;
std::cout << a8 << std::endl;
std::cout << a9 << std::endl;
std::cout << a10 << std::endl;
std::cout << a11 << std::endl;
std::cout << a12 << std::endl;
return Cbuffer(thisc,a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
}
@ -45,20 +63,23 @@ int HOOK()
{
std::cout << u8"开始hook" << std::endl;
if (MH_Initialize() != MH_OK)//初始化Hook
{
return 1;
}
/*
if (MH_CreateHook((void*)0x9536C0, &tihuancall,
reinterpret_cast<void**>(&BCBB)) != MH_OK)
if (MH_CreateHook((void*)0x11D07D0, &Tihuan,
reinterpret_cast<void**>(&Cbuffer)) != MH_OK)
{
return 2;
}
// Enable the hook for MessageBoxW.
if (MH_EnableHook((void*)0x9536C0) != MH_OK)
if (MH_EnableHook((void*)0x11D07D0) != MH_OK)
{
return 3;
}
*/
/*
if (MH_CreateHook((void*)0x1358A60, &NewClosure,
@ -138,7 +159,7 @@ BOOL APIENTRY DllMain( HMODULE hModule,
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
//HOOK();
Lenheart();
break;
case DLL_THREAD_ATTACH:

View File

@ -11,4 +11,4 @@
#include "squirrel.h"
#include "MinHook.h"
#pragma comment(lib, "libMinHook.x86.lib")

View File

@ -73,6 +73,8 @@ static SqGetBoolFunc* SQGetBool = (SqGetBoolFunc*)0x1358E30;
//GetString
typedef int(SqGetStringFunc)(uint32_t v, uint32_t stackIndex, wchar_t** sstring);
static SqGetStringFunc* SQGetString = (SqGetStringFunc*)0x1358E70;
typedef int(SqGetStringCFunc)(uint32_t v, uint32_t stackIndex, char** sstring);
static SqGetStringCFunc* SQGetStringc = (SqGetStringCFunc*)0x1358E70;
//GetUserdata
typedef int(SqGetUserdataFunc)(uint32_t v, uint32_t stackIndex, DWORD* up, DWORD* up1);
static SqGetUserdataFunc* SQGetUserdata = (SqGetUserdataFunc*)0x1358EC0;
@ -268,12 +270,15 @@ static SendPacksDWORD _SendPacksDWord = (SendPacksDWORD)0x11285B0;
typedef DWORD NoticeClass;
static NoticeClass* _NoticeClass = (NoticeClass*)0x1A5FB20;
//公告CALL
typedef void(__fastcall* NoticeCall)(DWORD thisc, int Seat , char* a1, DWORD a2, DWORD a3, DWORD a4, DWORD a5, DWORD a6, DWORD a7);
typedef void(__fastcall* NoticeCall)(DWORD thisc, int Seat , char* a1, DWORD a2, DWORD a3, DWORD a4, DWORD a5, DWORD a6);
static NoticeCall _Noticecall = (NoticeCall)0x9536C0;
//公告CALL
//窗口CALL
typedef void(__fastcall* NoticeTCall)(DWORD thisc, DWORD Seat, DWORD a1, char* a2, DWORD a3);
static NoticeTCall _NoticeTcall = (NoticeTCall)0xE6E070;
//绘制?//TODO
typedef int( DrawTe)(DWORD thisc, int a2, int a3, int a4, int a5, int a6, __int64 a7, float a8, float a9, float a10, int a11, int a12);
//static NoticeTCall _NoticeTcall = (NoticeTCall)0xE6E070;
#endif //PCH_H

View File

@ -104,6 +104,9 @@
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalDependencies>
</AdditionalDependencies>
<AdditionalLibraryDirectories>D:\hookDNF\DOF_DllHook\test;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -126,7 +129,8 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalDependencies>squirrel.lib;libMinHook.x86.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>libMinHook.x86.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>D:\hookDNF\DOF_DllHook\test;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">

View File

@ -343,49 +343,24 @@ static int SQdofile(uint32_t v, const wchar_t* filename, bool retval, bool print
/*
void gonggao(char* str,int ctype,int ccolor)
{
int shop, gonggao, type, color;
char*addr;
if (ctype == NULL)
ctype = 16;
if (ccolor == NULL)
ccolor = 0x65535;
shop = 0x1A5FB20;
gonggao = 0x9536c0;
type = ctype;
color = ccolor;
addr = str;
_asm
{
pushad
mov ecx, dword ptr[ebp - 0x04]
mov ecx, dword ptr[ecx]
mov ecx, dword ptr[ecx + 0x40]
push 0x00000000
push 0x00000000
push 0x00000000
push 0x00000000
push dword ptr[ebp - 0x0c]
push dword ptr[ebp - 0x10]
push dword ptr[ebp - 0x14]
call dword ptr[ebp - 0x08]
popad
}
}
*/
//´°¿Ú¹«¸æ
//窗口公告 0x10d
void WindowsNotice(char* str ,int type = 0x10d ,int b = 0x0)
{
DWORD thisc = 0x1A5FB20;
thisc = *(DWORD*)thisc;
_NoticeTcall(thisc, 0, type, str, b);
}
//GM公告
void GMNotice(char* str, int type,int color)
{
if (type == NULL)type = 14;
if (color == NULL)color = 0x65535;
DWORD thisc = 0x1A5FB20;
thisc = *(DWORD*)thisc;
thisc = *(DWORD*)(thisc + 0x40);
_Noticecall(thisc, 0, str, color, type, 0, 0, 0);
}
@ -410,24 +385,8 @@ void RegisterNutApi(const wchar_t* funcName, void* funcAddr, uint32_t v)
static int sq_Test(uint32_t v)
{
/*
DWORD thisc = 0x1A5FB20;
thisc = *(DWORD*)thisc;
thisc = *(DWORD*)(thisc + 0x40);
char *str = (char*)u"test";
_Noticecall(thisc, NULL, str, 0x66535, 14, 0, 0, 0, 0);
*/
//char* str = (char*)u"test";
//gonggao(str, 14,NULL);
WindowsNotice((char*)u"ÎÒµÄÌì");
//GMNotice((char*)u"我的天");
//WindowsNotice((char*)u"我的天");
SQPopTop(v);
SQPushInt(v, 1);
@ -706,6 +665,194 @@ static int LDofile(uint32_t v)
return 1;
}
//Lcout
static int Lcout(uint32_t v)
{
char* str = NULL;
int type = NULL;
int color = NULL;
int num = SQGetTop(v);
if (num == 2 || num == 3 || num == 4)
{
switch (num)
{
case 2:
SQGetStringc(v, 2, &str);
break;
case 3:
SQGetStringc(v, 2, &str);
SQGetInt(v, 3, &type);
break;
case 4:
SQGetStringc(v, 2, &str);
SQGetInt(v, 3, &type);
SQGetInt(v, 4, &color);
break;
}
SQPopTop(v);
GMNotice(str, type, color);
SQPushBool(v, true);
}
else
{
SQPushBool(v, false);
}
return 1;
}
//Lcout
static int NewWindows(uint32_t v)
{
char* str = NULL;
int type = NULL;
int color = NULL;
int num = SQGetTop(v);
if (num == 2 || num == 3 || num == 4)
{
switch (num)
{
case 2:
SQGetStringc(v, 2, &str);
break;
case 3:
SQGetStringc(v, 2, &str);
SQGetInt(v, 3, &type);
break;
case 4:
SQGetStringc(v, 2, &str);
SQGetInt(v, 3, &type);
SQGetInt(v, 4, &color);
break;
}
SQPopTop(v);
WindowsNotice(str, type, color);
SQPushBool(v, true);
}
else
{
SQPushBool(v, false);
}
return 1;
}
//Lcout
static int SetSlot(uint32_t v)
{
int Type = NULL;
int Index = NULL;
int Xpos = NULL;
int Ypos = NULL;
int OneAddr = NULL;
int* xpos = NULL;
int* ypos = NULL;
int ParameterNum = SQGetTop(v);
if (ParameterNum == 5)
{
SQGetInt(v, 2, &Type);
SQGetInt(v, 3, &Index);
SQGetInt(v, 4, &Xpos);
SQGetInt(v, 5, &Ypos);
SQPopTop(v);
switch (Type)
{
case 0://拓展技能栏
OneAddr = *(int*)0x1ADE0CC;
OneAddr = *(int*)(OneAddr + (0x60 + (4 * Index)));
xpos = (int*)(OneAddr + (0x14));
ypos = (int*)(OneAddr + (0x18));
*xpos = Xpos;
*ypos = Ypos;
break;
case 1://基础技能栏
OneAddr = *(int*)0x1ADE0CC;
OneAddr = *(int*)(OneAddr + (0x30 + (4 * Index)));
xpos = (int*)(OneAddr + (0x14));
ypos = (int*)(OneAddr + (0x18));
*xpos = Xpos;
*ypos = Ypos;
break;
case 2://切换技能栏
OneAddr = *(int*)0x1ADE0CC;
OneAddr = *(int*)(OneAddr + (0x124 + (4 * Index)));
xpos = (int*)(OneAddr + (0x14));
ypos = (int*)(OneAddr + (0x18));
*xpos = Xpos;
*ypos = Ypos;
break;
case 3://快捷物品栏
OneAddr = *(int*)0x1ADE0CC;
OneAddr = *(int*)(OneAddr + (0x18 + (4 * Index)));
xpos = (int*)(OneAddr + (0x14));
ypos = (int*)(OneAddr + (0x18));
*xpos = Xpos;
*ypos = Ypos;
break;
case 4://特性技能展开栏
OneAddr = *(int*)0x1ADE0CC;
OneAddr = *(int*)(OneAddr + 0xC);
OneAddr = *(int*)(OneAddr + 0x4);
OneAddr = *(int*)(OneAddr + 0x0);
OneAddr = *(int*)(OneAddr + 0x34);
OneAddr = *(int*)(OneAddr + 0x4);
OneAddr = *(int*)(OneAddr + 0x28);
OneAddr = *(int*)(OneAddr + 0x4);
xpos = (int*)(OneAddr + (0x394));
ypos = (int*)(OneAddr + (0x398));
*xpos = Xpos;
*ypos = Ypos;
break;
case 5://特性技能技能栏
OneAddr = *(int*)(0x16E95AC + 0x400000);
OneAddr = *(int*)(OneAddr + 0x68);
OneAddr = *(int*)(OneAddr + 0x0);
OneAddr = *(int*)(OneAddr + 0x8);
OneAddr = *(int*)(OneAddr + 0x64);
OneAddr = *(int*)(OneAddr + 0x0);
OneAddr = *(int*)(OneAddr + 0x1C);
OneAddr = *(int*)(OneAddr + 0x0);
xpos = (int*)(OneAddr + (0x1794));
ypos = (int*)(OneAddr + (0x1798));
*xpos = Xpos;
*ypos = Ypos;
break;
case 6://菜单栏
OneAddr = *(int*)0x1ADE0CC;
OneAddr = *(int*)(OneAddr + (0x84 + (4 * Index)));
xpos = (int*)(OneAddr + (0x14));
ypos = (int*)(OneAddr + (0x18));
*xpos = Xpos;
*ypos = Ypos;
break;
}
SQPushBool(v, true);
}
else
{
SQPushBool(v, false);
}
return 1;
}
void RegisterNut()
{
RegisterNutApi(L"L_sq_Test", sq_Test);
@ -724,6 +871,9 @@ void RegisterNut()
RegisterNutApi(L"L_sq_GivePlayerEqu", GivePlayerEqu);
RegisterNutApi(L"L_sq_GoDungeon", GoDungeon);
RegisterNutApi(L"L_sq_Dofile", LDofile);
RegisterNutApi(L"L_cout", Lcout);
RegisterNutApi(L"L_NewWindows", NewWindows);
RegisterNutApi(L"L_SetSlot", SetSlot);
}