Rindro-Plugins/Include/Hook.hpp

2162 lines
58 KiB
C++
Raw Normal View History

2024-09-16 17:08:48 +08:00
#pragma once
#include <cwchar>
#include "MinHook.h"
#include "inlinehook.h"
#include "RegisterSquirrel.hpp"
2025-04-28 23:02:20 +08:00
#include "IO_Ex.hpp"
2024-09-16 17:08:48 +08:00
//<2F><>Ϸ<EFBFBD><CFB7>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Flag
static bool InitGameFlag = false;
2025-04-28 23:02:20 +08:00
//<2F><><EFBFBD><EFBFBD><EFBFBD>ټ<EFBFBD>UI
static bool Yosin<EFBFBD>ټ<EFBFBD>UIFlag = false;
2024-09-16 17:08:48 +08:00
2024-11-08 11:30:08 +08:00
//StringBin<69>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
extern std::vector<std::string> StringBin;
2024-09-16 17:08:48 +08:00
//<2F>ű<EFBFBD><C5B1>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>󵽵<EFBFBD>Flag
extern bool jiaoben;
//<2F>ű<EFBFBD><C5B1>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
extern std::vector<std::string> BaseData;
2024-11-08 11:30:08 +08:00
struct BufState {
const wchar_t* buf;
int ptr;
int size;
};
2024-09-16 17:08:48 +08:00
//<2F><><EFBFBD>ؽű<D8BD><C5B1><EFBFBD><EFBFBD>߼<EFBFBD>
2024-11-08 11:30:08 +08:00
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);
}
2025-04-28 23:02:20 +08:00
2024-09-16 17:08:48 +08:00
void Suxn() {
2025-04-28 23:02:20 +08:00
2024-09-16 17:08:48 +08:00
size_t Ds = BaseData.size();
for (size_t i = 0; i < Ds; i++)
{
std::string filenamebuf = "BaseData" + std::to_string(i);
std::string strbuf = BaseData[i];
wchar_t* filename = DNFTOOL::charTowchar_t((char*)filenamebuf.c_str());
wchar_t* str = DNFTOOL::charTowchar_t((char*)strbuf.c_str());
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
2024-11-08 11:30:08 +08:00
SQInteger Top = Sq_gettop(v);
2024-09-16 17:08:48 +08:00
#ifdef SELL
//std::cout << strbuf << std::endl;
2024-11-08 11:30:08 +08:00
if (Sq_mycompilebuffer(v, str, wcslen(str), L"interactive console", false) >= 0) {
2024-09-16 17:08:48 +08:00
Sq_pushroottable(v);
2024-11-08 11:30:08 +08:00
Sq_call(v, 1, SQFalse, SQTrue);
2024-09-16 17:08:48 +08:00
Sq_pop(v, 1);
2024-11-08 11:30:08 +08:00
//std::cout << "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: " << strbuf.substr(0, 100) << std::endl;
2024-09-16 17:08:48 +08:00
}
#else
2024-11-08 11:30:08 +08:00
if (Sq_mycompilebuffer(v, str, wcslen(str), filename, false) >= 0) {
2024-09-16 17:08:48 +08:00
Sq_pushroottable(v);
2024-11-08 11:30:08 +08:00
Sq_call(v, 1, SQFalse, SQTrue);
2024-09-16 17:08:48 +08:00
Sq_pop(v, 1);
}
#endif // SELL
2024-11-08 11:30:08 +08:00
Sq_settop(v, Top);
2024-09-16 17:08:48 +08:00
delete[] filename;
delete[] str;
}
BaseData.clear();
jiaoben = false;
}
typedef struct REG
{
DWORD EAX;
DWORD EBX;
DWORD ECX;
DWORD EDX;
DWORD ESI;
DWORD EDI;
DWORD ESP;
DWORD EBP;
DWORD VmAddress;
BYTE Cl;
} REG;
REG PlayerEach = { 0 };
void __declspec(naked)PlayerEach2() {
static int address = 0x11B34E0;
static int address1 = 0x001004B59;
_asm
{
pushad
pushfd
mov PlayerEach.ECX, ecx
mov PlayerEach.EDI, edi
}
if (PlayerEach.EDI == 2) {
PlayerEach.VmAddress = Sq_gettop(*(HSQUIRRELVM*)0x1AF3544);
Sq_pushroottable(*(HSQUIRRELVM*)0x1AF3544);
Sq_pushstring(*(HSQUIRRELVM*)0x1AF3544, L"Sq_PlayerEachPos", -1);
if (SQ_SUCCEEDED(Sq_get(*(HSQUIRRELVM*)0x1AF3544, -2)))
{
Sq_pushroottable(*(HSQUIRRELVM*)0x1AF3544);
Sq_pushinteger(*(HSQUIRRELVM*)0x1AF3544, *(int*)(PlayerEach.ECX + 0x14));
Sq_pushinteger(*(HSQUIRRELVM*)0x1AF3544, *(int*)(PlayerEach.ECX + 0x18));
Sq_call(*(HSQUIRRELVM*)0x1AF3544, 3, 0, 1);
}
Sq_settop(*(HSQUIRRELVM*)0x1AF3544, PlayerEach.VmAddress);
}
_asm {
popfd
popad
call address
test al, al
jmp address1
}
}
REG MouseAsm = { 0 };
void __declspec(naked)MouseWheelUp() {
static int address = 0x11BDE12;
static int address1 = 0x0011BDEEE;
static int address2 = 0x0011BDEDF;
static int address3 = 0x0011BDECE;
_asm
{
pushad
pushfd
mov MouseAsm.EDI, edi
mov MouseAsm.ECX, ecx
}
if ((int)*(BYTE*)0x1B46886 == 0) {
_asm {
popfd
popad
jmp address
}
}
else {
if (MouseAsm.EDI == 0x20A) {
if (MouseAsm.ECX == 0x780000) {
_asm {
popfd
popad
jmp address3
}
}
else {
_asm {
popfd
popad
jmp address2
}
}
}
else {
_asm {
popfd
popad
jmp address1
}
}
}
}
REG DrawWindow_BAsm = { 0 };
void __declspec(naked)DrawWindow_B_Hook() {
static int address = 0xFFDA10;
static int address1 = 0x66BEA1;
_asm
{
pushad
pushfd
}
if (InitGameFlag)
{
DrawWindow_BAsm.VmAddress = Sq_gettop(*(HSQUIRRELVM*)0x1AF3544);
Sq_pushroottable(*(HSQUIRRELVM*)0x1AF3544);
Sq_pushstring(*(HSQUIRRELVM*)0x1AF3544, L"L_DrawWindow_B", -1);
if (SQ_SUCCEEDED(Sq_get(*(HSQUIRRELVM*)0x1AF3544, -2)))
{
Sq_pushroottable(*(HSQUIRRELVM*)0x1AF3544);
Sq_call(*(HSQUIRRELVM*)0x1AF3544, 1, 0, 1);
}
Sq_settop(*(HSQUIRRELVM*)0x1AF3544, DrawWindow_BAsm.VmAddress);
}
_asm {
popfd
popad
mov ecx, eax
call address
jmp address1
}
}
REG BuffIconHookAsm = { 0 };
void __declspec(naked)BuffIcon_Hook() {
static int address = 0x4C8C1D;
static int address2 = 0x4C8C5B;
_asm
{
pushad
pushfd
}
_asm {
popfd
popad
add esi,0x88
sub edi,eax
mov BuffIconHookAsm.Cl, cl
pushad
pushfd
}
if (BuffIconHookAsm.Cl == 1) {
_asm {
popfd
popad
jmp address
}
}
else {
_asm {
popfd
popad
jmp address2
}
}
}
REG BuffIconHookBAsm = { 0 };
void __declspec(naked)BuffIcon_Hook_B() {
static int address = 0x4BF566;
//static int address2 = 0x4C8C5B;
_asm
{
pushad
pushfd
}
_asm {
popfd
popad
sub edi,eax
add esi, 0x88
mov [ebp-40],esi
jmp address
}
}
void __declspec(naked)HudBloodBackground() {
2024-11-08 11:30:08 +08:00
static int address = 0x4CA03D;
2024-09-16 17:08:48 +08:00
_asm
{
pushad
pushfd
}
if (InitGameFlag)
{
DrawWindow_BAsm.VmAddress = Sq_gettop(*(HSQUIRRELVM*)0x1AF3544);
Sq_pushroottable(*(HSQUIRRELVM*)0x1AF3544);
Sq_pushstring(*(HSQUIRRELVM*)0x1AF3544, L"L_HUD_BloodBackground", -1);
if (SQ_SUCCEEDED(Sq_get(*(HSQUIRRELVM*)0x1AF3544, -2)))
{
Sq_pushroottable(*(HSQUIRRELVM*)0x1AF3544);
Sq_call(*(HSQUIRRELVM*)0x1AF3544, 1, 0, 1);
}
Sq_settop(*(HSQUIRRELVM*)0x1AF3544, DrawWindow_BAsm.VmAddress);
}
_asm {
popfd
popad
2024-11-08 11:30:08 +08:00
mov ecx,[esi+0xa94]
push 0
2024-09-16 17:08:48 +08:00
jmp address
}
}
REG Damage_HookAsm = { 0 };
void __declspec(naked)Damage_Hook() {
static int address = 0xE5A2E5;
_asm
{
pushad
pushfd
mov Damage_HookAsm.EDI, edi
mov Damage_HookAsm.EBX, ebx
mov Damage_HookAsm.EBP, ebp
}
Damage_HookAsm.EAX = *(int*)0x1AB7CDC;
if (InitGameFlag)
{
2025-04-28 23:02:20 +08:00
int Address = Damage_HookAsm.EBX;//ֻҪ<D6BB><D2AA><EFBFBD><EFBFBD> read <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>0 <20><>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>˺<EFBFBD>
2024-09-16 17:08:48 +08:00
int Damage = *(DWORD*)(Damage_HookAsm.EBP - 0x17c);
Damage_HookAsm.VmAddress = Sq_gettop(*(HSQUIRRELVM*)0x1AF3544);
Sq_pushroottable(*(HSQUIRRELVM*)0x1AF3544);
Sq_pushstring(*(HSQUIRRELVM*)0x1AF3544, L"Sq_PushDamageData", -1);
if (SQ_SUCCEEDED(Sq_get(*(HSQUIRRELVM*)0x1AF3544, -2)))
{
Sq_pushroottable(*(HSQUIRRELVM*)0x1AF3544);
Sq_pushinteger(*(HSQUIRRELVM*)0x1AF3544, Address);
Sq_pushinteger(*(HSQUIRRELVM*)0x1AF3544, Damage_HookAsm.EAX);
Sq_pushinteger(*(HSQUIRRELVM*)0x1AF3544, Damage);
Sq_call(*(HSQUIRRELVM*)0x1AF3544, 4, 0, 1);
}
Sq_settop(*(HSQUIRRELVM*)0x1AF3544, Damage_HookAsm.VmAddress);
Damage_HookAsm.EBX = 0;
Damage_HookAsm.EBP = 0;
}
_asm {
popfd
popad
mov eax, Damage_HookAsm.EAX
xor ecx,ecx
jmp address
}
}
2025-04-28 23:02:20 +08:00
typedef struct REG1
{
DWORD EAX;
DWORD EBX;
DWORD ECX;
DWORD EDX;
DWORD ESI;
DWORD EDI;
DWORD ESP;
DWORD EBP;
DWORD VmAddress;
BYTE Cl;
SQBool flag;
int vm_data1;
} REG1;
REG1 DiscardItem_HookAsm = { 0 };
void __declspec(naked)DiscardItem_Hook() {
static int address = 0xE71EAB;
static int func = 0xE6E070;
_asm
{
pushad
pushfd
mov DiscardItem_HookAsm.ESI, esi
mov DiscardItem_HookAsm.EBX, ebx
}
if (InitGameFlag)
{
DiscardItem_HookAsm.VmAddress = Sq_gettop(*(HSQUIRRELVM*)0x1AF3544);
Sq_pushroottable(*(HSQUIRRELVM*)0x1AF3544);
Sq_pushstring(*(HSQUIRRELVM*)0x1AF3544, L"Sq_DiscardItem", -1);
if (SQ_SUCCEEDED(Sq_get(*(HSQUIRRELVM*)0x1AF3544, -2)))
{
Sq_pushroottable(*(HSQUIRRELVM*)0x1AF3544);
Sq_pushinteger(*(HSQUIRRELVM*)0x1AF3544, DiscardItem_HookAsm.ESI);
Sq_call(*(HSQUIRRELVM*)0x1AF3544, 2, 1, 1);
Sq_getbool(*(HSQUIRRELVM*)0x1AF3544, -1, &DiscardItem_HookAsm.flag);
}
Sq_settop(*(HSQUIRRELVM*)0x1AF3544, DiscardItem_HookAsm.VmAddress);
if (!DiscardItem_HookAsm.flag) {
_asm {
popfd
popad
mov eax,0
jmp address
}
}
}
_asm {
popfd
popad
push 1
push DiscardItem_HookAsm.ESI
push 0xFB
mov ecx, DiscardItem_HookAsm.EBX
call func
jmp address
}
}
REG1 DiscardItem_HookBAsm = { 0 };
void __declspec(naked)DiscardItemB_Hook() {
static int address = 0xE71E95;
static int func = 0x10086C0;
_asm
{
pushad
pushfd
mov DiscardItem_HookBAsm.EAX, eax
mov DiscardItem_HookBAsm.ESI, esi
mov DiscardItem_HookBAsm.ECX, ecx
}
if (InitGameFlag)
{
DiscardItem_HookBAsm.VmAddress = Sq_gettop(*(HSQUIRRELVM*)0x1AF3544);
Sq_pushroottable(*(HSQUIRRELVM*)0x1AF3544);
Sq_pushstring(*(HSQUIRRELVM*)0x1AF3544, L"Sq_DiscardItem", -1);
if (SQ_SUCCEEDED(Sq_get(*(HSQUIRRELVM*)0x1AF3544, -2)))
{
Sq_pushroottable(*(HSQUIRRELVM*)0x1AF3544);
Sq_pushinteger(*(HSQUIRRELVM*)0x1AF3544, DiscardItem_HookBAsm.ESI);
Sq_call(*(HSQUIRRELVM*)0x1AF3544, 2, 1, 1);
Sq_getbool(*(HSQUIRRELVM*)0x1AF3544, -1, &DiscardItem_HookBAsm.flag);
}
Sq_settop(*(HSQUIRRELVM*)0x1AF3544, DiscardItem_HookBAsm.VmAddress);
if (!DiscardItem_HookBAsm.flag) {
_asm {
popfd
popad
mov eax, 0
jmp address
}
}
}
_asm {
popfd
popad
push 0
push 0
push 0
push 0x1C
push DiscardItem_HookBAsm.EAX
push 0
push 0
call func
jmp address
}
}
2024-09-16 17:08:48 +08:00
void __declspec(naked)SelectCharacter_Hook() {
static int address = 0x10F79D1;
_asm
{
imul edx,edx,0x7a
xor eax, eax
add edx, 0xA1
pushad
pushfd
}
_asm {
popfd
popad
jmp address
}
}
void __declspec(naked)SelectCharacter_Hook1() {
static int address = 0x10F7B4B;
_asm
{
imul eax, eax, 0x7a
xor edx, edx
add eax, 0xA1
pushad
pushfd
}
_asm {
popfd
popad
jmp address
}
}
void __declspec(naked)SelectCharacter_Hook2() {
static int address = 0x10F7F91;
_asm
{
imul ecx, ecx, 0x7a
add ecx, 0xA1
xor edx, edx
pushad
pushfd
}
_asm {
popfd
popad
jmp address
}
}
void __declspec(naked)SelectCharacter_Hook3() {
static int address = 0x10F8319;
_asm
{
imul edx, edx, 0x7a
xor eax, eax
add edx, 0xA1
pushad
pushfd
}
_asm {
popfd
popad
jmp address
}
}
void __declspec(naked)SelectCharacter_Hook4() {
static int address = 0x10F843E;
_asm
{
imul eax, eax, 0x7a
xor ecx, ecx
add eax, 0xA1
pushad
pushfd
}
_asm {
popfd
popad
jmp address
}
}
void __declspec(naked)SelectCharacter_Hook5() {
static int address = 0x10F85F2;
_asm
{
imul eax, eax, 0x7a
xor ecx, ecx
add eax, 0xA1
pushad
pushfd
}
_asm {
popfd
popad
jmp address
}
}
void __declspec(naked)SelectCharacter_Hook6() {
static int address = 0x10F2C74;
_asm
{
imul eax, eax, 0x7a
add eax, 0xA1
pushad
pushfd
}
_asm {
popfd
popad
jmp address
}
}
void __declspec(naked)SelectCharacter_Hook7() {
static int address = 0x10F3480;
_asm
{
imul eax, eax, 0x7a
xor edx, edx
add eax, 0xA1
pushad
pushfd
}
_asm {
popfd
popad
jmp address
}
}
2024-11-08 11:30:08 +08:00
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
}
2024-09-16 17:08:48 +08:00
2024-11-08 11:30:08 +08:00
InserBinStr((char*)ReadStringBin_HookAsm.ESI, ReadStringBin_HookAsm.EBX);
2024-09-16 17:08:48 +08:00
2024-11-08 11:30:08 +08:00
_asm {
popfd
popad
mov eax,[ebp + 450]
add eax,ebx
jmp address
}
}
2024-09-16 17:08:48 +08:00
2025-04-28 23:02:20 +08:00
REG1 MonsetrRace_HookAsm = { 0 };
void __declspec(naked)MonsetrRace_Hook() {
static int address = 0x43A8BA;
static int address1 = 0x43A86A;
_asm
{
mov MonsetrRace_HookAsm.EBX, ebx
mov MonsetrRace_HookAsm.EDX, edx
xor ebx, ebx
push edi
mov edi, [ebp + 0x8]
test eax, eax
pushad
pushfd
mov MonsetrRace_HookAsm.ESI, esi
mov MonsetrRace_HookAsm.vm_data1, 34
}
MonsetrRace_HookAsm.VmAddress = Sq_gettop(*(HSQUIRRELVM*)0x1AF3544);
Sq_pushroottable(*(HSQUIRRELVM*)0x1AF3544);
Sq_pushstring(*(HSQUIRRELVM*)0x1AF3544, L"L_Rindro_MonsterEXControl_Race", -1);
if (SQ_SUCCEEDED(Sq_get(*(HSQUIRRELVM*)0x1AF3544, -2)))
{
Sq_pushroottable(*(HSQUIRRELVM*)0x1AF3544);
Sq_pushinteger(*(HSQUIRRELVM*)0x1AF3544, MonsetrRace_HookAsm.ESI);
Sq_pushinteger(*(HSQUIRRELVM*)0x1AF3544, MonsetrRace_HookAsm.EBX);
Sq_pushinteger(*(HSQUIRRELVM*)0x1AF3544, MonsetrRace_HookAsm.EDX);
Sq_call(*(HSQUIRRELVM*)0x1AF3544, 4, 1, 1);
Sq_getinteger(*(HSQUIRRELVM*)0x1AF3544, -1, &MonsetrRace_HookAsm.vm_data1);
}
else {
Sq_settop(*(HSQUIRRELVM*)0x1AF3544, MonsetrRace_HookAsm.VmAddress);
_asm {
popfd
popad
jmp address1
}
}
Sq_settop(*(HSQUIRRELVM*)0x1AF3544, MonsetrRace_HookAsm.VmAddress);
_asm {
popfd
popad
mov edi, MonsetrRace_HookAsm.vm_data1
jmp address
}
}
2024-09-16 17:08:48 +08:00
//<2F><><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>¼<EFBFBD>Hook
2025-04-28 23:02:20 +08:00
typedef void(__fastcall _OpenWindow)(DWORD thisc, DWORD Seat, DWORD a1, DWORD a2, DWORD a3);
2024-09-16 17:08:48 +08:00
static _OpenWindow* OldOpenWindow;
2025-04-28 23:02:20 +08:00
void __fastcall NewOpenWindow(DWORD thisc, DWORD Seat, DWORD a1, DWORD a2, DWORD a3) {
if (InitGameFlag) {
if (*(DWORD*)0x1A5FB20 == thisc) {
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
2024-09-16 17:08:48 +08:00
Sq_pushroottable(v);
2025-04-28 23:02:20 +08:00
Sq_pushstring(v, L"L_OpenOldWindowCallBack", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushinteger(v, a1);
Sq_call(v, 2, SQFalse, SQTrue);
}
Sq_settop(v, Top);
2024-09-16 17:08:48 +08:00
}
}
2025-04-28 23:02:20 +08:00
2024-09-16 17:08:48 +08:00
OldOpenWindow(thisc, 0, a1, a2, a3);
}
//<2F><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
typedef void(_11BDC90)(int a1, unsigned int a2, int a3);
static _11BDC90* Old11BDC90;
void New11BDC90(int a1, unsigned int a2, int a3) {
if (InitGameFlag) {
int X = *(int*)0x1B4686C;
int Y = *(int*)0x1B46870;
if ((X | Y) >= 0) {
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
Sq_pushroottable(v);
Sq_pushstring(v, L"L_MouseCallBack", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushinteger(v, a1);
Sq_pushinteger(v, a2);
Sq_pushinteger(v, X);
Sq_pushinteger(v, Y);
Sq_call(v, 5, SQFalse, SQTrue);
}
Sq_settop(v, Top);
}
}
Old11BDC90(a1, a2, a3);
return;
}
//N<><4E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ
typedef int(_fastcall _1030C30)(int a1, int a2, BYTE* a3);
static _1030C30* Old1030C30;
int _fastcall New1030C30(int a1, int a2, BYTE* a3)
{
int ret = Old1030C30(a1, a2, a3);
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
Sq_pushroottable(v);
Sq_pushstring(v, L"Sq_DrawMiniMapUI", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushinteger(v, 111);
Sq_call(v, 2, SQFalse, SQTrue);
}
Sq_settop(v, Top);
return ret;
}
//<2F>ٷ<EFBFBD><D9B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>NutHook
typedef int(_fastcall _674030)(wchar_t* thisc, DWORD Seat, wchar_t* a2, int a3);
static _674030* Old674030;
int _fastcall New674030(wchar_t* thisc, DWORD Seat, wchar_t* a2, int a3)
{
int ret = Old674030(thisc, Seat, a2, a3);
return ret;
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϢHook
typedef int(_fastcall _FA42D0)(int a1, int seat, int a2, int a3);
static _FA42D0* OldFA42D0;
int _fastcall NewFA42D0(int a1, int seat, int a2, int a3)
{
//OtherPlayerInfoType = a2 + 1;
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
SQBool Flag;
Sq_pushroottable(v);
Sq_pushstring(v, L"L_Other_Character_Info_Window", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushinteger(v, *(int*)(a1 + 0xc));
Sq_call(v, 2, SQTrue, SQTrue);
Sq_getbool(v, -1, &Flag);
}
Sq_settop(v, Top);
if (!Flag)return OldFA42D0(a1, seat, a2, a3);
return 0;
}
//<2F>˺<EFBFBD><CBBA><EFBFBD><EFBFBD><EFBFBD> HOOK
typedef DWORD(_cdecl _7EEED0)(DWORD a1, DWORD a2, DWORD a3, DWORD a4, DWORD a5, DWORD a6);
static _7EEED0* Old7EEED0;
DWORD _cdecl New7EEED0(DWORD a1, DWORD a2, DWORD a3, DWORD a4, DWORD a5, DWORD a6)
{
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
SQBool Flag;
Sq_pushroottable(v);
Sq_pushstring(v, L"Sq_PushDamageFontData", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushinteger(v, a1);
Sq_pushinteger(v, a2);
Sq_pushinteger(v, a3);
Sq_pushinteger(v, a4);
Sq_pushinteger(v, a5);
Sq_pushinteger(v, a6);
Sq_pushinteger(v, Damage_HookAsm.EDI);
Sq_pushinteger(v, Damage_HookAsm.EBX);
Sq_call(v, 9, SQTrue, SQTrue);
Sq_getbool(v, -1, &Flag);
}
Sq_settop(v, Top);
if (Flag) {
return Old7EEED0(a1, a2, a3, a4, a5, a6);
}
return 0;
}
//ע<><D7A2><EFBFBD>հ<EFBFBD>
typedef void(__fastcall* init_pack_handler_t)(void* Ecx);
static init_pack_handler_t Lpfn_Init = nullptr;
typedef void(__cdecl* pack_handler_t)(int idx, int err, void*, void*);
typedef void(__cdecl* register_pack_handler_t)(int idx, pack_handler_t handler, int zero);
typedef bool(__cdecl* _Net_Get_Dword)(DWORD*);
static _Net_Get_Dword Net_Get_Dword = reinterpret_cast<_Net_Get_Dword>(0x011AEA60);
typedef bool(__cdecl* _Net_Get_Buffer)(char*, int);
static _Net_Get_Buffer Net_Get_Buffer = reinterpret_cast<_Net_Get_Buffer>(0x011AEA90);
//130<33><30><EFBFBD>հ<EFBFBD>
void Pack_Control(int idx, int code, void* p3, void* p4)
{
if (InitGameFlag)
{
DWORD Size;
Net_Get_Dword(&Size);
char* Buffer = new char[Size + 1];
Net_Get_Buffer(Buffer, Size);
Buffer[Size] = '\0';
wchar_t* ss = DNFTOOL::charTowchar_t(Buffer);
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
Sq_pushroottable(v);
2025-04-28 23:02:20 +08:00
#if defined(SELL) || defined(EXPRESS)
2024-09-16 17:08:48 +08:00
Sq_pushstring(v, L"Sq_Pack_Control", -1);
#else
Sq_pushstring(v, L"Sq_Pack_ControlLocal", -1);
#endif // SELL
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushstring(v, ss, -1);
Sq_call(v, 2, SQFalse, SQTrue);
}
Sq_settop(v, Top);
delete[]ss;
}
}
void H_Register_Pack(void* Ecx)
{
Lpfn_Init(Ecx);
auto Registerfunc = reinterpret_cast<register_pack_handler_t>(0x7186D0);
Registerfunc(130, Pack_Control, 0);
}
2024-11-08 11:30:08 +08:00
//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();
//ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ܶ<EFBFBD>ɷ<EFBFBD>ʵ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD>ʼע<CABC>
auto Registerfunc = reinterpret_cast<register_pack_handler_t>(0x7186D0);
Registerfunc(130, Pack_Control, 0);
}
static bool mouseInit = false;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>
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;
}
2024-09-16 17:08:48 +08:00
2025-04-28 23:02:20 +08:00
static void InitBin() {
void* buf = malloc(81443744);
int readsize;
typedef bool(_59E3D0)(wchar_t* path, void* buffer, int a3, int* a4);
_59E3D0* SUB_59E3D0 = (_59E3D0*)0x59E3D0;
bool a = SUB_59E3D0(L"stringtable.bin", buf, 81443744, &readsize);
if (a) {
IO_Ex pvf((char*)buf, readsize);
int Count = pvf.GetInt();
int CurrentIndex = 0;
for (int i = 0; i < Count; i++) {
pvf.seek(CurrentIndex * 4 + 4);
int StartPos = pvf.GetInt();
int EndPos = pvf.GetInt();
int Len = EndPos - StartPos;
pvf.seek(StartPos + 4);
std::string Str = pvf.GetString(Len);
StringBin.push_back(Str);
CurrentIndex++;
}
}
free(buf);
}
2024-09-16 17:08:48 +08:00
2025-04-28 23:02:20 +08:00
void PFunc(HSQUIRRELVM v, const SQChar* s, ...) {
va_list vl;
va_start(vl, s);
// ʹ<><CAB9>_vsnwprintf<74><66>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>ַ<EFBFBD><D6B7>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int len = _vsnwprintf(nullptr, 0, s, vl);
va_end(vl);
va_start(vl, s);
// <20><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E3B9BB><EFBFBD>ڴ<EFBFBD><DAB4>ռ䣬ע<E4A3AC><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>ǿ<EFBFBD><C7BF>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>ռ2<D5BC>ֽڻ<D6BD><DABB><EFBFBD><EFBFBD>࣬ȡ<E0A3AC><C8A1><EFBFBD><EFBFBD>ƽ̨<C6BD>ͱ<EFBFBD><CDB1>
wchar_t* buffer = new wchar_t[len + 1];
// <20><><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>ַ<EFBFBD><D6B7>ַ<EFBFBD><D6B7><EFBFBD>ƴ<EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>
_vsnwprintf(buffer, len + 1, s, vl);
va_end(vl);
std::wofstream outFile("test.txt", std::ios::out | std::ios::app | std::ios::binary); // <20>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>ģʽ<C4A3><CABD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>׷<EFBFBD><D7B7>д<EFBFBD><D0B4>
if (outFile) {
outFile << buffer << std::endl; // <20><><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>ַ<EFBFBD><D6B7><EFBFBD>д<EFBFBD><D0B4><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӻ<EFBFBD><D3BB>з<EFBFBD>
outFile.close(); // <20>ر<EFBFBD><D8B1>ļ<EFBFBD><C4BC><EFBFBD>
std::wcout << L"<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѳɹ<EFBFBD>׷<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>" << std::endl;
}
else {
std::wcerr << L"<EFBFBD>޷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׷<EFBFBD><EFBFBD>д<EFBFBD>" << std::endl;
}
2024-09-16 17:08:48 +08:00
2025-04-28 23:02:20 +08:00
std::wcout << buffer << std::endl; // ʹ<><CAB9>std::wcout<75><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>ַ<EFBFBD><D6B7><EFBFBD>
delete[] buffer;
}
2024-09-16 17:08:48 +08:00
//HookNut<75><74><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
typedef void(__cdecl _Register_Nut)();
static _Register_Nut* Register_Nut_Old;
void __cdecl H_Register_Nut()
{
2025-04-28 23:02:20 +08:00
InitBin();
2024-09-16 17:08:48 +08:00
Register_Nut_Old();
2025-04-28 23:02:20 +08:00
2024-09-16 17:08:48 +08:00
static bool Init = false;
if (!Init) {
Init = true;
2025-04-28 23:02:20 +08:00
//sq_setprintfunc(*(HSQUIRRELVM*)0x1AF3544, PFunc);
2024-09-16 17:08:48 +08:00
R_Register_Nut();
2025-04-28 23:02:20 +08:00
2024-09-16 17:08:48 +08:00
std::string BaseFile = "YosinBaseC";
std::string Base = R"(
2024-11-08 11:30:08 +08:00
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;
2024-09-16 17:08:48 +08:00
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) {}
function Sq_UpgradeCallBack (x,y) {}
function Sq_RecoveryCallBack (x,y) {}
function Sq_RecoveryTypeSetCallBack (Type) {}
function Sq_DrawMainMaxLayerCustomUI (pack) {}
function Lenheart (VmTop) {}
function Sq_MouseEventCallBack (Lb, Rb, Mb) {}
function Sq_SelectCharacter (Chunk) {}
function Sq_DrawMainTopLayerCustomUI (pack) {}
function Sq_GetExeStr_Event (StrIndex) {return StrIndex;}
function Sq_CreatChr (chunk) {}
function Sq_SendPackType_Event (Type) {}
function Sq_SendPackByte_Event (Parm) {}
function Sq_SendPackWord_Event (Parm) {}
function Sq_SendPackDWord_Event (Parm) {}
function Sq_SendPackChar_Event (Parm) {}
function Sq_SendPack_Event () {}
function Sq_DrawItemBack (Xpos, Ypos, Image) {}
function Sq_DrawItemFront (Xpos, Ypos, Image) {}
function Sq_GetDrawMonBloodSw () {return false;}
function Sq_DrawMonsterBlood (Object, X, Y) {}
function Sq_Set_Inventory_M_Pos (This) {}
function Sq_Get_Ex_IntData (SkillAddress, Idx, objAddress) {return 0;}
function Sq_Get_Ex_SkillCoolTime (SkillAddress, Idx, objAddress) {return 0;}
function Sq_Get_Ex_LevelData (SkillAddress, Idx, objAddress) {return 0;}
function Sq_PlayerEachPos (x, y) {}
function Sq_DrawMainMaxLayerCustomUI (pack) {}
function Sq_PushDamageFontData (ObjAddress, X, Y, Z, Value, Type,A8,A9) { return true;}
function Sq_PushDamageData(ObjAddress, MySelfAddress, Value);
function Sq_Pack_Control (chunk) {}
function Sq_MessageWindowDraw (a,c) {}
function Sq_Get_Event_Pos_X () {return 1;}
function Sq_Get_Event_Pos_Y () {return 1;}
function Sq_L_OtherPlayerInfo (x, y, Type, Value, ImgBuf) {local str = Value.tostring(); local lenght = L_sq_GetStringDrawLength(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() {}
function L_OpenOldWindowCallBack(WindowIndex) {}
function L_Old_Window_Get(WindowObject) {}
function L_Character_Info_Window(WindowObject) { return false;}
function L_Other_Character_Info_Window(WindowObject) {return false;}
function L_Old_Window_Visible(WindowObject,Flag) {}
getroottable().LenheartBaseFuncTab <- {};
getroottable().LenheartFuncTab <- {};
getroottable().Rindro_Scr_Width <- L_sq_RA(0x4D848E);
getroottable().Rindro_Scr_High <- L_sq_RA(0x4D8495);
2025-04-28 23:02:20 +08:00
2024-09-16 17:08:48 +08:00
)";
2025-04-28 23:02:20 +08:00
2024-09-16 17:08:48 +08:00
//<2F>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
FILE* file = fopen("sqr/DofileList.nut", "rb");
if (file)
{
Base += "RINDROLOCAL <- true";
fclose(file);
}
else {
Base += "RINDROLOCAL <- false";
}
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
wchar_t* filename = DNFTOOL::charTowchar_t((char*)BaseFile.c_str());
wchar_t* str = DNFTOOL::charTowchar_t((char*)Base.c_str());
if (sq_mycompilebuffer(v, str, wcslen(str), filename, false) >= 0) {
Sq_pushroottable(v);
Sq_call(v, 1, SQTrue, SQFalse);
Sq_pop(v, 1);
}
delete[]filename;
delete[]str;
2025-04-28 23:02:20 +08:00
2024-09-16 17:08:48 +08:00
#ifndef SELL//<2F><><EFBFBD><EFBFBD>ģʽҪ<CABD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD>
2025-04-28 23:02:20 +08:00
#ifndef EXPRESS//<2F><><EFBFBD><EFBFBD>ģʽҪ<CABD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD>
2024-09-16 17:08:48 +08:00
Sq_pushroottable(v);
Sq_pushstring(v, L"dofile", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushstring(v, L"sqr/DofileList.nut", -1);
Sq_call(v, 2, SQFalse, SQTrue);
}
Sq_pop(v, 2);
#endif // !SELL
2025-04-28 23:02:20 +08:00
#endif // !SELL
2024-09-16 17:08:48 +08:00
}
}
//HOOK<4F><4B><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
typedef void(__fastcall* DrawCode)(DWORD thisc, int Seat, int a3, int a4, int a5, int a6);
static DrawCode DrawCodeF;
typedef int(_fastcall _DrawOtherPlayer_Img)(int thisc, void*, int X, int Y, int Img);
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)
{
2024-11-08 11:30:08 +08:00
//std::cout << std::hex << a6 << std::endl;
2024-09-16 17:08:48 +08:00
wchar_t* strbuffer = (wchar_t*)a6;
if (strbuffer == NULL)return;
wchar_t* clone = new wchar_t[wcslen(strbuffer) + 2];
wcscpy(clone, strbuffer);
std::string GameStr;
DNFTOOL::Wchar_tToString(GameStr, clone);
delete[]clone;
2025-04-28 23:02:20 +08:00
if (GameStr.find("<EFBFBD><EFBFBD><EFBFBD>ʺŽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>") != std::string::npos) {
2024-11-08 11:30:08 +08:00
std::cout << GameStr << std::endl;
}
2024-09-16 17:08:48 +08:00
return DrawCodeF(thisc, Seat, a3, a4, a5, a6);
}
//HOOK Item<65><6D>ɫ
extern std::map< int, int>ItemColorMap;
typedef DWORD(_cdecl _OldHookEquNameColor)(int rarity);
static _OldHookEquNameColor* OldHookEquNameColor;
DWORD _cdecl HookEquNameColor(int rarity)
{
DWORD OldColor = OldHookEquNameColor(rarity);
switch (rarity)
{
case 6:
return 0xFF0055FF;
case 7:
return 0xFF9314FF;
case 8:
return 0xFF1CBC0C;
case 9:
return 0xFFACFF08;
}
return OldColor;
}
typedef DWORD(_fastcall _OldHookItemColor)(DWORD thisc, DWORD Seat);
static _OldHookItemColor* OldHookItemColor;
DWORD _fastcall HookItemColor(DWORD thisc, DWORD Seat)
{
int ItemCode = *(int*)(thisc + 0x1C);
if (ItemColorMap.count(ItemCode) == 1)
{
return ItemColorMap[ItemCode];
}
//<2F><><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>ɫmap<61><70><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4>ԭ<EFBFBD><D4AD>ɫ<EFBFBD><C9AB>ȡ
int Rarity = *(int*)(thisc + 0xF4);
int color = HookEquNameColor(Rarity);
return color;
}
//Hook<6F><6B><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
static SendPacksType _OldSendPackType;
int __fastcall NewSendPacksType(DWORD thisc, int Seat, int Parm)
{
if (InitGameFlag)
{
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
Sq_pushroottable(v);
Sq_pushstring(v, L"Sq_SendPackType_Event", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushinteger(v, Parm);
Sq_call(v, 2, SQFalse, SQTrue);
}
Sq_settop(v, Top);
return _OldSendPackType(thisc, 0, Parm);
}
return _OldSendPackType(thisc, 0, Parm);
}
static SendPacksByte _OldSendPackByte;
int __fastcall NewSendPacksByte(DWORD thisc, int Seat, int Parm)
{
if (InitGameFlag)
{
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
Sq_pushroottable(v);
Sq_pushstring(v, L"Sq_SendPackByte_Event", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushinteger(v, Parm);
Sq_call(v, 2, SQFalse, SQTrue);
}
Sq_settop(v, Top);
}
return _OldSendPackByte(thisc, 0, Parm);
}
static SendPacksWORD _OldSendPackWord;
int __fastcall NewSendPacksWord(DWORD thisc, int Seat, int Parm)
{
if (InitGameFlag)
{
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
Sq_pushroottable(v);
Sq_pushstring(v, L"Sq_SendPackWord_Event", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushinteger(v, Parm);
Sq_call(v, 2, SQFalse, SQTrue);
}
Sq_settop(v, Top);
}
return _OldSendPackWord(thisc, 0, Parm);
}
static SendPacksDWORD _OldSendPackDWord;
int __fastcall NewSendPacksDWord(DWORD thisc, int Seat, int Parm)
{
if (InitGameFlag)
{
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
Sq_pushroottable(v);
Sq_pushstring(v, L"Sq_SendPackDWord_Event", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushinteger(v, Parm);
Sq_call(v, 2, SQFalse, SQTrue);
}
Sq_settop(v, Top);
}
return _OldSendPackDWord(thisc, 0, Parm);
}
static SendPacksChar _OldSendPackChar;
int __fastcall NewSendPacksChar(DWORD thisc, int Seat, char* Parm, int Size)
{
if (InitGameFlag)
{
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
Sq_pushroottable(v);
Sq_pushstring(v, L"Sq_SendPackChar_Event", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushstring(v, (SQChar*)Parm, Size);
Sq_call(v, 2, SQFalse, SQTrue);
}
Sq_settop(v, Top);
}
return _OldSendPackChar(thisc, 0, Parm, Size);
}
static SendPacks* _OldSend;
int NewSend()
{
if (InitGameFlag)
{
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
Sq_pushroottable(v);
Sq_pushstring(v, L"Sq_SendPack_Event", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_call(v, 1, SQFalse, SQTrue);
}
Sq_settop(v, Top);
}
return _OldSend();
}
//Exe<78><65><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Hook
typedef int(_cdecl _sub1220590)(int a1);
static _sub1220590* sub1220590 = (_sub1220590*)0x1220590;
int _cdecl Newsub1220590(int a1)
{
if (InitGameFlag)
{
SQInteger StrIndex = a1;
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
Sq_pushroottable(v);
Sq_pushstring(v, L"Sq_GetExeStr_Event", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushinteger(v, a1);
Sq_call(v, 2, SQTrue, SQTrue);
Sq_getinteger(v, -1, &StrIndex);
}
Sq_settop(v, Top);
return sub1220590(StrIndex);
}
return sub1220590(a1);
}
//<2F><><EFBFBD><EFBFBD>Item_ͼ<5F><CDBC>
typedef int(_fastcall _sub11A8F60)(DWORD a1, DWORD Seat, int a2, int a3, int a4);
static _sub11A8F60* sub11A8F60;
int _fastcall newsub11A8F60(DWORD a1, DWORD Seat, int a2, int a3, int a4)
{
if (InitGameFlag)
{
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
Sq_pushroottable(v);
Sq_pushstring(v, L"Sq_DrawItemBack", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushinteger(v, a2);
Sq_pushinteger(v, a3);
Sq_pushinteger(v, a4);
Sq_call(v, 4, SQFalse, SQTrue);
}
Sq_settop(v, Top);
int ret = sub11A8F60(a1, 0, a2, a3, a4);
Top = Sq_gettop(v);
Sq_pushroottable(v);
Sq_pushstring(v, L"Sq_DrawItemFront", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushinteger(v, a2);
Sq_pushinteger(v, a3);
Sq_pushinteger(v, a4);
Sq_call(v, 4, SQFalse, SQTrue);
}
Sq_settop(v, Top);
return ret;
}
return sub11A8F60(a1, 0, a2, a3, a4);
}
//<2F>ͼ<EEB6AF><CDBC>
typedef DWORD** (_fastcall _Event)(DWORD thisc, DWORD Seat, DWORD a2, DWORD** a3, char a4);
static _Event* OldEvent;
DWORD** _fastcall NewEvent(DWORD thisc, DWORD Seat, DWORD a2, DWORD** a3, char a4)
{
if ((int)a4 == 1 && (int)a3 == 96527 /*&& a2 <= 536 && ((a2 - 456)%20 == 0)*/)//<2F><><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD><DEB8>˻ͼ<EEB6AF><CDBC><EFBFBD><EFBFBD>Y<EFBFBD><59> <20>ڽ<EFBFBD><DABD><EFBFBD>HOOK<4F>Ա<EFBFBD><D4B1>޸<EFBFBD>
{
int X, Y;
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
Sq_pushroottable(v);
Sq_pushstring(v, L"Sq_Get_Event_Pos_X", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_call(v, 1, SQTrue, SQTrue);
Sq_getinteger(v, -1, &X);
}
Sq_settop(v, Top);
Sq_pushroottable(v);
Sq_pushstring(v, L"Sq_Get_Event_Pos_Y", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_call(v, 1, SQTrue, SQTrue);
Sq_getinteger(v, -1, &Y);
}
Sq_settop(v, Top);
a2 += X;
a3 = (DWORD**)Y;
}
return OldEvent(thisc, Seat, a2, a3, a4);
}
//ѡ<><D1A1>Ƶ<EFBFBD><C6B5>
typedef void(_fastcall _10F2700)(DWORD thisc, DWORD Seat, int a2);
static _10F2700* Old10F2700;
void _fastcall New10F2700(DWORD thisc, DWORD Seat, int a2)
{
Old10F2700(thisc, Seat, a2);
static bool Flag = false;
if (!Flag && thisc) {
2024-11-08 11:30:08 +08:00
for (size_t i = 0; i < 28; i++)
2024-09-16 17:08:48 +08:00
{
int addr = *(int*)(thisc + (0x4 * i) + 0x1c);
int value = *(int*)(addr + 0x14);
*(int*)(addr + 0x14) = value + 133;
}
Flag = true;
}
return;
}
//ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
typedef void (_fastcall _FC9440)(DWORD thisc, DWORD Seat,int a2);
static _FC9440* OldFC9440;
void _fastcall NewFC9440(DWORD thisc, DWORD Seat,int a2)
{
OldFC9440(thisc, Seat, a2);
//<2F><>Ϸ<EFBFBD><CFB7>ʼ<EFBFBD><CABC>ť
*(int*)((*(int*)(thisc + 0x1c0)) + 0x14) = 470;
return;
}
//ѡ<><D1A1><EFBFBD><EFBFBD>ɫ
typedef void(_fastcall _10F7660)(DWORD thisc, DWORD Seat,int a3);
static _10F7660* Old10F7660;
void _fastcall New10F7660(DWORD thisc, DWORD Seat, int a3)
{
Old10F7660(thisc, Seat, a3);
static bool Flag = false;
if (!Flag && thisc) {
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť
for (size_t i = 0; i < 5; i++)
{
int addr = *(int*)(thisc + (0x4 * i) + 0x70);
int value = *(int*)(addr + 0x14);
*(int*)(addr + 0x14) = value + 133;
}
//ѡ<><D1A1>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>ť
{
int addr = *(int*)(thisc + 0x15c);
int value = *(int*)(addr + 0x14);
*(int*)(addr + 0x14) = value + 133;
}
//<2F><><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>
for (size_t i = 0; i < 8; i++)
{
int addr = *(int*)(thisc + (0x4 * i) + 0xA0);
int value = *(int*)(addr + 0x14);
*(int*)(addr + 0x14) = value + 133;
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>°<EFBFBD>ť
for (size_t i = 0; i < 2; i++)
{
int addr = *(int*)(thisc + (0x4 * i) + 0x16c);
int value = *(int*)(addr + 0x14);
*(int*)(addr + 0x14) = value + 133;
}
//ð<><C3B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͽ<EFBFBD><CDBD><EFBFBD> <20><>ť
{
int addr = *(int*)(thisc + 0x34c);
int value = *(int*)(addr + 0x14);
*(int*)(addr + 0x14) = value + 133;
addr = *(int*)(addr + 0x2c0);
value = *(int*)(addr + 0x14);
*(int*)(addr + 0x14) = value + 133;
}
Flag = true;
}
return ;
}
//HOOK PushString
typedef uint32_t(__cdecl* LSqPushStringFunc)(uint32_t v, const wchar_t* s, uint32_t l);
LSqPushStringFunc LrealSqPushString;
uint32_t __cdecl LMySqPushString(uint32_t v, const wchar_t* s, uint32_t l)
{
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD>ܹ<EFBFBD><DCB9><EFBFBD><EFBFBD><EFBFBD>
if (!wcscmp(s, L"getCurrentModuleDamageRate")) {
return LrealSqPushString(v, L"L_getCurrentModuleDamageRate", l);
}
return LrealSqPushString(v, s, l);
}
//GetIntData
typedef DWORD(_fastcall _908510)(DWORD thisc, DWORD Seat, DWORD a2, int a3);
static _908510* Old908510;
DWORD _fastcall New908510(DWORD thisc, DWORD Seat, DWORD a2, int a3)
{
if (a3 != *(int*)0x1AB7CDC)return Old908510(thisc, Seat, a2, a3);
SQInteger NutAddValue = 0;
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
Sq_pushroottable(v);
Sq_pushstring(v, L"Sq_Get_Ex_IntData", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushinteger(v, thisc);
Sq_pushinteger(v, a2);
Sq_pushinteger(v, a3);
Sq_call(v, 4, SQTrue, SQTrue);
Sq_getinteger(v, -1, &NutAddValue);
}
Sq_settop(v, Top);
return NutAddValue + Old908510(thisc, Seat, a2, a3);
}
//<2F><>ȡ<EFBFBD><C8A1>ȴ
typedef DWORD(_fastcall _909020)(DWORD thisc, DWORD Seat, DWORD a2, int a3);
static _908510* Old909020;
DWORD _fastcall New909020(DWORD thisc, DWORD Seat, DWORD a2, int a3)
{
if (a3 != *(int*)0x1AB7CDC)return Old909020(thisc, Seat, a2, a3);
SQInteger NutAddValue = 0;
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
Sq_pushroottable(v);
Sq_pushstring(v, L"Sq_Get_Ex_IntData", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushinteger(v, thisc);
Sq_pushinteger(v, a2);
Sq_pushinteger(v, a3);
Sq_call(v, 4, SQTrue, SQTrue);
Sq_getinteger(v, -1, &NutAddValue);
}
Sq_settop(v, Top);
return NutAddValue + Old909020(thisc, Seat, a2, a3);
}
//ԭ<><D4AD><EFBFBD><EFBFBD>ɫGet
typedef DWORD(_fastcall _90A4A0)(DWORD thisc, DWORD Seat, DWORD a2, int a3);
static _90A4A0* Old90A4A0;
DWORD _fastcall New90A4A0(DWORD thisc, DWORD Seat, DWORD a2, int a3) {
if (!InitGameFlag)return Old90A4A0(thisc, Seat, a2, a3);
if (a3 != *(int*)0x1AB7CDC)return Old90A4A0(thisc, Seat, a2, a3);
SQInteger NutAddValue = 0;
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
Sq_pushroottable(v);
Sq_pushstring(v, L"Sq_Get_Ex_IntData", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushinteger(v, thisc);
Sq_pushinteger(v, a2);
Sq_pushinteger(v, a3);
Sq_call(v, 4, SQTrue, SQTrue);
Sq_getinteger(v, -1, &NutAddValue);
}
Sq_settop(v, Top);
int ret = NutAddValue + Old90A4A0(thisc, Seat, a2, a3);
return ret;
}
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD>ܶ<EFBFBD><DCB6><EFBFBD>
typedef int __fastcall sub_TTTTTT(int a1, int a2, int a3);
static sub_TTTTTT* TFuncsub_GetSkillAddress = (sub_TTTTTT*)0x8406C0;
//Nut<75><74>ɫGet1
typedef DWORD(_fastcall _BA89D0)(DWORD thisc, DWORD Seat, DWORD a2, DWORD a3, DWORD a4);
static _BA89D0* OldBA89D0;
DWORD _fastcall NewBA89D0(DWORD thisc, DWORD Seat, DWORD a2, DWORD a3, DWORD a4) {
if (!InitGameFlag)return OldBA89D0(thisc, Seat, a2, a3, a4);
if (a3 != *(int*)0x1AB7CDC)return OldBA89D0(thisc, Seat, a2, a3, a4);
DWORD ADDRESS = TFuncsub_GetSkillAddress(thisc, 0, a3);
SQInteger NutAddValue = 0;
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
Sq_pushroottable(v);
Sq_pushstring(v, L"Sq_Get_Ex_LevelData", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushinteger(v, ADDRESS);
Sq_pushinteger(v, a2);
Sq_pushinteger(v, thisc);
Sq_call(v, 4, SQTrue, SQTrue);
Sq_getinteger(v, -1, &NutAddValue);
}
Sq_settop(v, Top);
int ret = NutAddValue + OldBA89D0(thisc, Seat, a2, a3, a4);
return ret;
}
//Nut<75><74>ɫGet2
typedef DWORD(_5A40E0)(DWORD a1, DWORD a2, DWORD a3, DWORD a4);
static _5A40E0* Old5A40E0;
DWORD New5A40E0(DWORD a1, DWORD a2, DWORD a3, DWORD a4) {
if (!InitGameFlag)return Old5A40E0(a1, a2, a3, a4);
if (a3 != *(int*)0x1AB7CDC)return Old5A40E0(a1, a2, a3, a4);
DWORD ADDRESS = TFuncsub_GetSkillAddress(a1, 0, a2);
SQInteger NutAddValue = 0;
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
Sq_pushroottable(v);
Sq_pushstring(v, L"Sq_Get_Ex_LevelData", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushinteger(v, ADDRESS);
Sq_pushinteger(v, a3);
Sq_pushinteger(v, a1);
Sq_call(v, 4, SQTrue, SQTrue);
Sq_getinteger(v, -1, &NutAddValue);
}
Sq_settop(v, Top);
int ret = NutAddValue + Old5A40E0(a1, a2, a3, a4);
return ret;
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>HOOK
typedef struct LevelDataBuffer
{
DWORD SkillAddresss;
DWORD SkillIdx;
DWORD ObjectAddress;
} RELevelDataBufferG;
LevelDataBuffer _LevelDataBuffer = { 0 };
typedef DWORD(_75D1F0)(DWORD thisc);
static _75D1F0* Old75D1F0;
DWORD New75D1F0(DWORD thisc) {
if (!InitGameFlag)return Old75D1F0(thisc);
if (_LevelDataBuffer.ObjectAddress != *(int*)0x1AB7CDC)return Old75D1F0(thisc);
SQInteger NutAddValue = 0;
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
Sq_pushroottable(v);
Sq_pushstring(v, L"Sq_Get_Ex_LevelData", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushinteger(v, _LevelDataBuffer.SkillAddresss);
Sq_pushinteger(v, _LevelDataBuffer.SkillIdx);
Sq_pushinteger(v, _LevelDataBuffer.ObjectAddress);
Sq_call(v, 4, SQTrue, SQTrue);
Sq_getinteger(v, -1, &NutAddValue);
}
Sq_settop(v, Top);
if (NutAddValue != 0) {
int ret = NutAddValue + Old75D1F0(thisc);
_LevelDataBuffer.SkillAddresss = 0;
_LevelDataBuffer.SkillIdx = 0;
_LevelDataBuffer.ObjectAddress = 0;
return ret;
}
return Old75D1F0(thisc);
}
typedef DWORD(__fastcall _44E620)(void* thisc,DWORD Seat);
static _44E620* Old44E620;
DWORD __fastcall New44E620(void* thisc, DWORD Seat) {
//*(int*)((char*)thisc + 0xC) = 256;
DWORD Ret = Old44E620(thisc, Seat);
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
Sq_pushroottable(v);
Sq_pushstring(v, L"L_Old_Window_Get", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushinteger(v, (int)thisc);
Sq_call(v, 2, SQFalse, SQTrue);
}
Sq_settop(v, Top);
return Ret;
}
typedef char(__fastcall _11B3B70)(void* thisc, DWORD Seat,char Flag);
static _11B3B70* Old11B3B70;
char __fastcall New11B3B70(void* thisc, DWORD Seat, char Flag) {
char Ret = Old11B3B70(thisc, Seat, Flag);
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
Sq_pushroottable(v);
Sq_pushstring(v, L"L_Old_Window_Visible", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushinteger(v, (int)thisc);
Sq_pushinteger(v, (int)Flag);
Sq_call(v, 3, SQFalse, SQTrue);
}
Sq_settop(v, Top);
return Ret;
}
typedef char(__fastcall _11D43A0)(void* thisc, DWORD Seat);
static _11D43A0* Old11D43A0;
char __fastcall New11D43A0(void* thisc, DWORD Seat) {
//char Ret = Old11D43A0(thisc, Seat);
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
SQBool Flag;
Sq_pushroottable(v);
Sq_pushstring(v, L"L_Character_Info_Window", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushinteger(v, (int)thisc);
Sq_call(v, 2, SQTrue, SQTrue);
Sq_getbool(v, -1, &Flag);
}
Sq_settop(v, Top);
if(!Flag)return Old11D43A0(thisc, Seat);
return 0;
}
typedef DWORD(__fastcall _7CDA30)(void* thisc, DWORD Seat, DWORD*a2, DWORD a3, DWORD a4, DWORD a5, DWORD a6);
static _7CDA30* Old7CDA30;
DWORD __fastcall New7CDA30(void* thisc, DWORD Seat, DWORD* a2, DWORD a3, DWORD a4, DWORD a5, DWORD a6) {
DWORD Ret = Old7CDA30(thisc, Seat, a2, a3, a4, a5, a6);
//std::cout << "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: " << *(int*)((int)thisc + 0x638) << std::endl;
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
SQBool Flag;
Sq_pushroottable(v);
Sq_pushstring(v, L"L_Sync_Camera_Pos", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
2024-11-08 11:30:08 +08:00
Sq_pushinteger(v,(int)thisc);
2024-09-16 17:08:48 +08:00
Sq_call(v, 2, SQFalse, SQTrue);
}
Sq_settop(v, Top);
return Ret;
}
typedef int(_fastcall _Get_Img)(int thisc, void*, int a2);
static _Get_Img* OldGet_Img;
int _fastcall NewGet_Img(int thisc, void*, int a2) {
2024-11-08 11:30:08 +08:00
2024-09-16 17:08:48 +08:00
return OldGet_Img(thisc, 0, a2);
}
2024-11-08 11:30:08 +08:00
2024-09-16 17:08:48 +08:00
typedef int(_fastcall _4294A0)(int thisc, void*,int a2);
static _4294A0* Old4294A0;
int _fastcall New4294A0(int thisc, void*,int a2) {
return 0;
return Old4294A0(thisc, 0,a2);
}
2024-11-08 11:30:08 +08:00
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);
}
2024-09-16 17:08:48 +08:00
2025-04-28 23:02:20 +08:00
//<2F><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>HOOK
typedef int(__fastcall _43A1B0)(DWORD thisc, DWORD Seat, int Xpos , int Ypos);
static _43A1B0* Old43A1B0;
int __fastcall New43A1B0(DWORD thisc, DWORD Seat, int Xpos, int Ypos) {
SQBool Flag = true;
HSQUIRRELVM v = *(HSQUIRRELVM*)0x1AF3544;
SQInteger Top = Sq_gettop(v);
Sq_pushroottable(v);
Sq_pushstring(v, L"L_Rindro_MonsterEXControl_Face", -1);
if (SQ_SUCCEEDED(Sq_get(v, -2))) {
Sq_pushroottable(v);
Sq_pushinteger(v, *(DWORD*)(thisc + 8));
Sq_pushinteger(v, Xpos);
Sq_pushinteger(v, Ypos);
Sq_call(v, 4, SQTrue, SQTrue);
Sq_getbool(v, -1, &Flag);
}
Sq_settop(v, Top);
if(Flag)return Old43A1B0(thisc, Seat, Xpos, Ypos);
return 0;
}
2024-09-16 17:08:48 +08:00
void RegisterHook() {
2025-04-28 23:02:20 +08:00
#ifdef EXPRESS
InitGameFlag = true;
MH_Initialize();
//Hook<6F>հ<EFBFBD>
MH_CreateHook((void*)0x721EA0, &H_Register_Pack, reinterpret_cast<void**>(&Lpfn_Init));
MH_EnableHook((void*)0x721EA0);
//HookNut<75><74><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
MH_CreateHook((void*)0x67B910, &H_Register_Nut, reinterpret_cast<void**>(&Register_Nut_Old));
MH_EnableHook((void*)0x67B910);
return;
#endif // EXPRESS
2024-09-16 17:08:48 +08:00
//InlineHook///
//<2F><><EFBFBD>Ҳ˵<D2B2>ѡ<EFBFBD><D1A1>HOOK <20>лص<D0BB>
inlinehook SSS(0x001004B52, (int)&PlayerEach2);
SSS.Motify_address();
//<2F>޸<EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>
//inlinehook MMM(0x011BDE05, (int)&MouseWheelUp);
//MMM.Motify_address();
//<2F><><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD>HOOK
inlinehook WindowDrawHook(0x066BE9A, (int)&DrawWindow_B_Hook);
WindowDrawHook.Motify_address();
//<2F>˺<EFBFBD>HOOK
inlinehook DamageHook(0xE5A2DE, (int)&Damage_Hook);
DamageHook.Motify_address();
2025-04-28 23:02:20 +08:00
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD>HOOK
inlinehook DiscardItemHook(0xE71E9C, (int)&DiscardItem_Hook);
DiscardItemHook.Motify_address();
inlinehook DiscardItemHookB(0xE71E83, (int)&DiscardItemB_Hook);
DiscardItemHookB.Motify_address();
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>HOOK
inlinehook MonsetrRaceHook(0x43A862, (int)&MonsetrRace_Hook);
MonsetrRaceHook.Motify_address();
2024-09-16 17:08:48 +08:00
2025-04-28 23:02:20 +08:00
////<2F><>ȡStringBin<69>ļ<EFBFBD>
//inlinehook ReadStringBinHookA(0x119F2F8, (int)&ReadStringBin_HookA);
//ReadStringBinHookA.Motify_address();
//inlinehook ReadStringBinHookB(0x119F2C0, (int)&ReadStringBin_HookB);
//ReadStringBinHookB.Motify_address();
2024-11-08 11:30:08 +08:00
2024-09-16 17:08:48 +08:00
//Fundction Hook//
MH_Initialize();
//<2F>ر<EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD>̳<EFBFBD>
//MH_CreateHook((void*)0x4294A0, &New4294A0, reinterpret_cast<void**>(&Old4294A0));
//MH_EnableHook((void*)0x4294A0);
2024-11-08 11:30:08 +08:00
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
MH_CreateHook((void*)0xFFDC60, &NewFFDC60, reinterpret_cast<void**>(&OldFFDC60));
MH_EnableHook((void*)0xFFDC60);
2024-09-16 17:08:48 +08:00
//MH_CreateHook((void*)0x11AA190, &NewGet_Img, reinterpret_cast<void**>(&OldGet_Img));
//MH_EnableHook((void*)0x11AA190);
//<2F><>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>HOOK
MH_CreateHook((void*)0x7CDA30, &New7CDA30, reinterpret_cast<void**>(&Old7CDA30));
MH_EnableHook((void*)0x7CDA30);
//<2F><><EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD><EFBFBD>¼<EFBFBD>
MH_CreateHook((void*)0x44E620, &New44E620, reinterpret_cast<void**>(&Old44E620));
MH_EnableHook((void*)0x44E620);
//<2F><><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>¼<EFBFBD>Hook Ϊ<><CEAA>дUI<55><49><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD>ڽ<EFBFBD><DABD><EFBFBD>Ⱦ<EFBFBD><C8BE><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD>Ϊ<EFBFBD>²<EFBFBD>
MH_CreateHook((void*)0xE6E070, &NewOpenWindow, reinterpret_cast<void**>(&OldOpenWindow));
MH_EnableHook((void*)0xE6E070);
//<2F><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>HOOK
MH_CreateHook((void*)0x11BDC90, &New11BDC90, reinterpret_cast<void**>(&Old11BDC90));
MH_EnableHook((void*)0x11BDC90);
//N<><4E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ
MH_CreateHook((void*)0x1030C30, &New1030C30, reinterpret_cast<void**>(&Old1030C30));
MH_EnableHook((void*)0x1030C30);
//<2F>ٷ<EFBFBD><D9B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>NutHook
MH_CreateHook((void*)0x674030, &New674030, reinterpret_cast<void**>(&Old674030));
MH_EnableHook((void*)0x674030);
//DrawMain HOOK
MH_CreateHook((void*)0x4C61F0, &New4C61F0, reinterpret_cast<void**>(&Old4C61F0));
MH_EnableHook((void*)0x4C61F0);
//<2F>˺<EFBFBD><CBBA><EFBFBD><EFBFBD><EFBFBD> HOOK
MH_CreateHook((void*)0x7EEED0, &New7EEED0, reinterpret_cast<void**>(&Old7EEED0));
MH_EnableHook((void*)0x7EEED0);
//Hook<6F>հ<EFBFBD>
MH_CreateHook((void*)0x721EA0, &H_Register_Pack, reinterpret_cast<void**>(&Lpfn_Init));
MH_EnableHook((void*)0x721EA0);
//HookNut<75><74><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
MH_CreateHook((void*)0x67B910, &H_Register_Nut, reinterpret_cast<void**>(&Register_Nut_Old));
MH_EnableHook((void*)0x67B910);
//Hook<6F><6B><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>
2024-11-08 11:30:08 +08:00
//MH_CreateHook((void*)0x1206BD0, &H_Register_DrawCode, reinterpret_cast<void**>(&DrawCodeF));
//MH_EnableHook((void*)0x1206BD0);
2024-09-16 17:08:48 +08:00
//HOOK<4F><4B>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
MH_CreateHook((void*)0x7AB080, &HookItemColor, reinterpret_cast<void**>(&OldHookItemColor));
MH_EnableHook((void*)0x7AB080);
//HOOK<4F><4B><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ɫ
MH_CreateHook((void*)0x7AAD00, &HookEquNameColor, reinterpret_cast<void**>(&OldHookEquNameColor));
MH_EnableHook((void*)0x7AAD00);
//Hook<6F><6B><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//HOOK<4F><4B><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2025-04-28 23:02:20 +08:00
MH_CreateHook((void*)0x1127D60, &NewSendPacksType, reinterpret_cast<void**>(&_OldSendPackType));
MH_EnableHook((void*)0x1127D60);
2024-09-16 17:08:48 +08:00
//MH_CreateHook((void*)0x1128550, &NewSendPacksByte, reinterpret_cast<void**>(&_OldSendPackByte));
//MH_EnableHook((void*)0x1128550);
//MH_CreateHook((void*)0x1128580, &NewSendPacksWord, reinterpret_cast<void**>(&_OldSendPackWord));
//MH_EnableHook((void*)0x1128580);
//MH_CreateHook((void*)0x11285B0, &NewSendPacksDWord, reinterpret_cast<void**>(&_OldSendPackDWord));
//MH_EnableHook((void*)0x11285B0);
//MH_CreateHook((void*)0x11285E0, &NewSendPacksChar, reinterpret_cast<void**>(&_OldSendPackChar));
//MH_EnableHook((void*)0x11285E0);
2024-11-08 11:30:08 +08:00
//MH_CreateHook((void*)0x1127EC0, &NewSend, reinterpret_cast<void**>(&_OldSend));
//MH_EnableHook((void*)0x1127EC0);
2024-09-16 17:08:48 +08:00
//exe<78>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
MH_CreateHook((void*)0x1220590, &Newsub1220590, reinterpret_cast<void**>(&sub1220590));
MH_EnableHook((void*)0x1220590);
//<2F><><EFBFBD><EFBFBD>Item_ͼ<5F><CDBC>
MH_CreateHook((void*)0x11A8F60, &newsub11A8F60, reinterpret_cast<void**>(&sub11A8F60));
MH_EnableHook((void*)0x11A8F60);
2024-11-08 11:30:08 +08:00
//Ѫ<>۱<EFBFBD><DBB1><EFBFBD><EFBFBD><EFBFBD>Hook <20><>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD><EFBFBD>
inlinehook HudBloodBackgroundHook(0x04CA035, (int)&HudBloodBackground);
HudBloodBackgroundHook.Motify_address();
2024-09-16 17:08:48 +08:00
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˰ټ<CBB0>UI
FILE* file = fopen("ImagePacks2/!HUD_Yosin<69>ټ<EFBFBD>UI.NPK", "rb");
if (file) {
2025-04-28 23:02:20 +08:00
Yosin<EFBFBD>ټ<EFBFBD>UIFlag = true;
2024-09-16 17:08:48 +08:00
//BUFFͼ<46><CDBC> <20><>ʾ
inlinehook BuffIconHook(0x04C8C14, (int)&BuffIcon_Hook);
BuffIconHook.Motify_address();
//BUFFͼ<46><CDBC> <20><><EFBFBD>ֱ<EFBFBD>ʶ
inlinehook BuffIconHookB(0x04BF55E, (int)&BuffIcon_Hook_B);
BuffIconHookB.Motify_address();
//<2F>ͼ<EEB6AF><CDBC>
MH_CreateHook((void*)0x11B4030, &NewEvent, reinterpret_cast<void**>(&OldEvent));
MH_EnableHook((void*)0x11B4030);
//ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//MH_CreateHook((void*)0xFC9440, &NewFC9440, reinterpret_cast<void**>(&OldFC9440));
//MH_EnableHook((void*)0xFC9440);
//ѡ<><D1A1>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
MH_CreateHook((void*)0x10F2700, &New10F2700, reinterpret_cast<void**>(&Old10F2700));
MH_EnableHook((void*)0x10F2700);
//ѡ<><D1A1><EFBFBD><EFBFBD>ɫ
MH_CreateHook((void*)0x10F7660, &New10F7660, reinterpret_cast<void**>(&Old10F7660));
MH_EnableHook((void*)0x10F7660);
inlinehook SelectCharacter(0x10F79C9, (int)&SelectCharacter_Hook);
SelectCharacter.Motify_address();
inlinehook SelectCharacter1(0x10F7B43, (int)&SelectCharacter_Hook1);
SelectCharacter1.Motify_address();
inlinehook SelectCharacter2(0x10F7F89, (int)&SelectCharacter_Hook2);
SelectCharacter2.Motify_address();
inlinehook SelectCharacter3(0x10F8311, (int)&SelectCharacter_Hook3);
SelectCharacter3.Motify_address();
inlinehook SelectCharacter4(0x10F8436, (int)&SelectCharacter_Hook4);
SelectCharacter4.Motify_address();
inlinehook SelectCharacter5(0x10F85EA, (int)&SelectCharacter_Hook5);
SelectCharacter5.Motify_address();
inlinehook SelectCharacter6(0x10F2C6E, (int)&SelectCharacter_Hook6);
SelectCharacter6.Motify_address();
inlinehook SelectCharacter7(0x10F3478, (int)&SelectCharacter_Hook7);
SelectCharacter7.Motify_address();
2024-11-08 11:30:08 +08:00
2024-09-16 17:08:48 +08:00
fclose(file);
}
//HOOK PushString
MH_CreateHook((void*)0x1358A60, &LMySqPushString, reinterpret_cast<void**>(&LrealSqPushString));
MH_EnableHook((void*)0x1358A60);
//<2F><>ȡ<EFBFBD><C8A1>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>
MH_CreateHook((void*)0x908510, &New908510, reinterpret_cast<void**>(&Old908510));
MH_EnableHook((void*)0x908510);
//<2F><>ȡ<EFBFBD><C8A1>ȴ
MH_CreateHook((void*)0x909020, &New909020, reinterpret_cast<void**>(&Old909020));
MH_EnableHook((void*)0x909020);
//<2F><>ȡ<EFBFBD><C8A1>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>
MH_CreateHook((void*)0x090A4A0, &New90A4A0, reinterpret_cast<void**>(&Old90A4A0));
MH_EnableHook((void*)0x090A4A0);
MH_CreateHook((void*)0x0BA89D0, &NewBA89D0, reinterpret_cast<void**>(&OldBA89D0));
MH_EnableHook((void*)0x0BA89D0);
MH_CreateHook((void*)0x05A40E0, &New5A40E0, reinterpret_cast<void**>(&Old5A40E0));
MH_EnableHook((void*)0x05A40E0);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>HOOK
MH_CreateHook((void*)0x075D1F0, &New75D1F0, reinterpret_cast<void**>(&Old75D1F0));
MH_EnableHook((void*)0x075D1F0);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
MH_CreateHook((void*)0x11B3B70, &New11B3B70, reinterpret_cast<void**>(&Old11B3B70));
MH_EnableHook((void*)0x11B3B70);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
2024-11-08 11:30:08 +08:00
//MH_CreateHook((void*)0x11D43A0, &New11D43A0, reinterpret_cast<void**>(&Old11D43A0));
//MH_EnableHook((void*)0x11D43A0);
2024-09-16 17:08:48 +08:00
2025-04-28 23:02:20 +08:00
//<2F><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Hook
MH_CreateHook((void*)0x43A1B0, &New43A1B0, reinterpret_cast<void**>(&Old43A1B0));
MH_EnableHook((void*)0x43A1B0);
2024-09-16 17:08:48 +08:00
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϢHook <20><>ֵ
MH_CreateHook((void*)0xFA42D0, &NewFA42D0, reinterpret_cast<void**>(&OldFA42D0));
MH_EnableHook((void*)0xFA42D0);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϢHook ͼ<><CDBC>
//MH_CreateHook((void*)0xFA8230, &NewFA8230, reinterpret_cast<void**>(&OldFA8230));
//MH_EnableHook((void*)0xFA8230);
}