Compare commits
No commits in common. "main" and "backup" have entirely different histories.
|
|
@ -1,371 +0,0 @@
|
|||
/*
|
||||
文件名:Hacker_RegApi.nut
|
||||
路径:Base/_Tool/Hacker_RegApi.nut
|
||||
创建日期:2024-09-25 18:31
|
||||
文件用途:注册API
|
||||
*/
|
||||
//工具类
|
||||
class R_Utils {
|
||||
|
||||
String = {
|
||||
FindLastSubstring = function(str, substring) {
|
||||
local strLen = str.len();
|
||||
local subLen = substring.len();
|
||||
local lastIndex = -1;
|
||||
for (local i = 0; i <= strLen - subLen; i++) {
|
||||
local found = true;
|
||||
for (local j = 0; j< subLen; j++) {
|
||||
if (str[i + j] != substring[j]) {
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
lastIndex = i;
|
||||
}
|
||||
}
|
||||
return lastIndex;
|
||||
}
|
||||
}
|
||||
//播放音效
|
||||
function PlaySound(SoundName) {
|
||||
L_Sq_CallFunc(0x75BD70, "void", FFI_MS_CDECL, ["pointer", "int", "int", "int"], Memory.allocUtf8String(SoundName).C_Object, -1, 0, 0);
|
||||
}
|
||||
|
||||
//读取文件内容
|
||||
function ReadScript(Path, Size, CodePage) {
|
||||
local ReadPath = L_sq_P2I(Memory.allocUtf8String(Path).C_Object);
|
||||
local Reader = Memory.alloc(Size);
|
||||
local ReadBuffer = L_sq_P2I(Reader.C_Object);
|
||||
L_Sq_CallFunc(0x11A2030, "int", FFI_FASTCALL, ["int", "int", "int", "int", "int", "int"], 0x1D17638, 0, ReadPath, ReadBuffer, 0x100000, 0x19DAF4);
|
||||
|
||||
|
||||
if (CodePage == "utf8")
|
||||
return Reader.readUtf8String();
|
||||
if (CodePage == "unicode")
|
||||
return Reader.readUnicodeString();
|
||||
if (CodePage == "big5")
|
||||
return Reader.readBig5String();
|
||||
}
|
||||
|
||||
//读取文件
|
||||
function GetScriptFileReader(Path, ...) {
|
||||
local AllocSize = 102400;
|
||||
if (vargc > 0) AllocSize = vargv[0];
|
||||
//读取路径
|
||||
local ReadPath = L_sq_P2I(Memory.allocUtf8String(Path).C_Object);
|
||||
//读取缓存
|
||||
local Reader = Memory.alloc(AllocSize);
|
||||
local ReadBuffer = L_sq_P2I(Reader.C_Object);
|
||||
//实际读取大小
|
||||
local ReadSizeer = Memory.alloc(4);
|
||||
local ReadSizeBuffer = L_sq_P2I(ReadSizeer.C_Object);
|
||||
|
||||
local Flag = L_Sq_CallFunc(0x59E3D0, "bool", FFI_MS_CDECL, ["int", "int", "int", "int"], ReadPath, ReadBuffer, AllocSize, ReadSizeBuffer);
|
||||
if (Flag) {
|
||||
return {
|
||||
Buffer = Reader,
|
||||
Size = ReadSizeer.readInt()
|
||||
};
|
||||
} else return null;
|
||||
}
|
||||
|
||||
//读取配置表
|
||||
function ReadScriptConfig(Path, Size, ...) {
|
||||
local CodePage = "utf8";
|
||||
if (vargc > 0) CodePage = vargv[0];
|
||||
local Script = R_Utils.ReadScript(Path, Size, CodePage);
|
||||
local Func = compilestring("return " + Script);
|
||||
local Ret = Func();
|
||||
return Ret;
|
||||
}
|
||||
|
||||
//获取一个指定装备的角色对象
|
||||
function GetCharacByEqu(Job, GrowType, Equ) {
|
||||
local Obj = sq_CreateCharacter(Job, GrowType);
|
||||
local ObjAddress = L_Sq_GetObjectAddress(Obj);
|
||||
foreach(value in Equ) {
|
||||
local ItemObject = L_sq_GetItem(value);
|
||||
// L_Sq_CallFunc(0x825570, "void", FFI_THISCALL, ["int", "int"], ObjAddress, ItemObject);
|
||||
L_Sq_CallFunc(0x8265A0, "void", FFI_THISCALL, ["int", "int", "int"], ObjAddress, ItemObject, -1);
|
||||
}
|
||||
return sq_GetCNRDObjectToSQRCharacter(Obj);
|
||||
}
|
||||
|
||||
//获取装备编号的得文件路径
|
||||
function GetEquPath(Equ) {
|
||||
local EquPathAddress = L_Sq_CallFunc(0x1219E80, "int", FFI_THISCALL, ["int", "int"], 0x1d7993c, Equ);
|
||||
if (EquPathAddress) {
|
||||
return NativePointer(EquPathAddress).readUnicodeString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//获取Lst文件的返回Array
|
||||
function GetLstArr(Path, Header) {
|
||||
local Arr = [];
|
||||
local LstBuf = R_Utils.GetScriptFileReader(Path);
|
||||
if (LstBuf) {
|
||||
local IO = Sq_Point2Blob(L_sq_P2I(LstBuf.Buffer.C_Object), LstBuf.Size);
|
||||
local i = 2;
|
||||
while (i< LstBuf.Size) {
|
||||
if ((LstBuf.Size - i) >= 10) {
|
||||
IO.seek(i + 6); //内容指示位
|
||||
local FindKey = IO.readn('i');
|
||||
local Key = Rindro_Script.GetBinString(FindKey);
|
||||
if (Key) {
|
||||
local StrFilePath = Header + Key.tolower();
|
||||
Arr.append(StrFilePath);
|
||||
}
|
||||
} else break;
|
||||
i += 10;
|
||||
}
|
||||
}
|
||||
return Arr;
|
||||
}
|
||||
|
||||
//通过处理函数获取文件Table
|
||||
function GetFileTableByHandle(Path, Func) {
|
||||
local Data = {};
|
||||
local FileData = R_Utils.GetScriptFileReader(Path);
|
||||
if (FileData) {
|
||||
if (FileData.Size >= 7) {
|
||||
//创建Blob对象
|
||||
local IO = Sq_Point2Blob(L_sq_P2I(FileData.Buffer.C_Object), FileData.Size);
|
||||
//以5为单步从第二位开始遍历字节
|
||||
local i = 2;
|
||||
while (true) {
|
||||
if (i< FileData.Size && FileData.Size - i >= 5) {
|
||||
i = Func(Data, IO, i);
|
||||
} else break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//根据List读取文件地址
|
||||
// Rindro_Haker.LoadHook(0x1219E80, ["int", "int", "int"],
|
||||
// function(args) {
|
||||
// // print(format("%02x", args[0]));
|
||||
|
||||
// // print(args[2]);
|
||||
// return null;
|
||||
// },
|
||||
// function(args) {
|
||||
// // print(666);
|
||||
// // print(format("%02x", args.pop()));
|
||||
// // TTTAni <- args.pop();
|
||||
|
||||
|
||||
// // local Path = NativePointer(L_sq_I2P(args.pop())).readUnicodeString();
|
||||
// // if (Path != "character/swordman/weapon/katana/kat_lowkogaras.equ" && Path != "new_elvengard.twn") {
|
||||
// // print(args[0]);
|
||||
// // print(args[1]);
|
||||
// // // print(format("%02x", args[1]));
|
||||
// // print(Path);
|
||||
// // }
|
||||
// return null;
|
||||
// });
|
||||
|
||||
//可能是构造装备以及构造其他东西
|
||||
// Rindro_Haker.LoadHook(0x972220, ["int", "int", "int", "int"],
|
||||
// function(args) {
|
||||
// // print(format("%02x", args[0]));
|
||||
// // local AniPath = NativePointer(L_sq_I2P(args[0])).readUnicodeString();
|
||||
// if (args[0] == 10402) {
|
||||
// print(args[0]);
|
||||
// print(args[1]);
|
||||
// print(args[2]);
|
||||
// }
|
||||
// // print(args[2]);
|
||||
// return null;
|
||||
// },
|
||||
// function(args) {
|
||||
// // print(666);
|
||||
// // print(format("%02x", args.pop()));
|
||||
// // TTTAni <- args.pop();
|
||||
// return null;
|
||||
// });
|
||||
|
||||
//绘制字符
|
||||
getroottable().DrawCodeCallBackFunc <- {};
|
||||
getroottable().DrawCodeChangeMap <- {};
|
||||
// Rindro_Haker.LoadHook(0x1206BD0, ["int", "int", "int", "pointer", "int", "void"],
|
||||
// function(args) {
|
||||
// // print("nut:" + format("%02x", args[3]));
|
||||
|
||||
// if (args[3]) {
|
||||
// // for (local i = 0; i< 10000; i++) {
|
||||
// local DrawCode = NativePointer(args[3]).readUnicodeString();
|
||||
|
||||
// if (DrawCode.find("^1^") != null) {
|
||||
|
||||
// args[3] = Str_Ptr("AAAAAA");
|
||||
// args[2] = sq_RGBA(255, 0, 240, 255);;
|
||||
// return args;
|
||||
// }
|
||||
// else if (DrawCode.find("^2^") != null) {
|
||||
// print(DrawCode);
|
||||
|
||||
// args[3] = Str_Ptr("BBBBBB");
|
||||
// args[2] = sq_RGBA(200, 100, 20, 255);;
|
||||
// return args;
|
||||
// }
|
||||
// // if (DrawCode in DrawCodeCallBackFunc)
|
||||
// // DrawCodeCallBackFunc[DrawCode](args);
|
||||
// // }
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// function(args) {
|
||||
// // print(666);
|
||||
// // print(format("%02x", args.pop()));
|
||||
// // TTTAni <- args.pop();
|
||||
// return null;
|
||||
// });
|
||||
|
||||
|
||||
//绘制城镇回调
|
||||
getroottable().DrawTownCallBackFunc <- {};
|
||||
Rindro_Haker.LoadHook(0x1108700, ["int", "void"],
|
||||
function(args) {
|
||||
// print("nut:" + format("%02x", args[3]));
|
||||
// print(format("%02x", args[0]));
|
||||
foreach(Func in DrawTownCallBackFunc) {
|
||||
Func();
|
||||
}
|
||||
return null;
|
||||
},
|
||||
function(args) {
|
||||
// print(666);
|
||||
// print(format("%02x", args.pop()));
|
||||
// TTTAni <- args.pop();
|
||||
return null;
|
||||
});
|
||||
|
||||
|
||||
//顺图
|
||||
function Rindro_Gm_MoveMap(obj) {
|
||||
if (sq_IsKeyDown(OPTION_HOTKEY_PAUSE_IN_TOWER, ENUM_SUBKEY_TYPE_ALL) && RINDROLOCAL) {
|
||||
if (KeyPress.isKeyPress(0)) L_sq_MoveMap(2);
|
||||
if (KeyPress.isKeyPress(1)) L_sq_MoveMap(0);
|
||||
if (KeyPress.isKeyPress(2)) L_sq_MoveMap(3);
|
||||
if (KeyPress.isKeyPress(3)) L_sq_MoveMap(1);
|
||||
}
|
||||
}
|
||||
getroottable()["LenheartFuncTab"].rawset("Rindro_Gm_MoveMapFuncN", Rindro_Gm_MoveMap);
|
||||
|
||||
|
||||
//丢弃物品回调
|
||||
getroottable().DiscardItemCallBackFunc <- {};
|
||||
|
||||
function Sq_DiscardItem(Item) {
|
||||
local Flag = true;
|
||||
foreach(Func in DiscardItemCallBackFunc) {
|
||||
local Ret = Func(Item);
|
||||
if (!Ret) Flag = false;
|
||||
}
|
||||
return Flag;
|
||||
}
|
||||
|
||||
//从exe获取字符串
|
||||
getroottable()["Sq_GetExeStr_Map"] <- {};
|
||||
|
||||
function Sq_GetExeStr_Event(Index) {
|
||||
if (Index in getroottable()["Sq_GetExeStr_Map"]) {
|
||||
return getroottable()["Sq_GetExeStr_Map"][Index](Index);
|
||||
}
|
||||
return Index;
|
||||
}
|
||||
|
||||
getroottable().DrawAppendCallBackFunc <- {};
|
||||
Rindro_Haker.LoadHook(0x67C560, ["pointer", "int", "int", "int", "int", "void"],
|
||||
function(args) {
|
||||
foreach(Func in DrawAppendCallBackFunc) {
|
||||
Func(args);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
function(args) {
|
||||
|
||||
return null;
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
local Flag = L_Sq_CallFunc(0x59E3D0, "bool", FFI_MS_CDECL, ["int", "int", "int", "int"], ReadPath, ReadBuffer, AllocSize, ReadSizeBuffer);
|
||||
if (Flag) {
|
||||
return {
|
||||
Buffer = Reader,
|
||||
Size = ReadSizeer.readInt()
|
||||
};
|
||||
} else return null;
|
||||
*/
|
||||
|
||||
// HOOK读取AP脚本
|
||||
// Rindro_Haker.LoadHook(0x121A100, ["int", "int", "int", "int", "int","bool"],
|
||||
// function(args) {
|
||||
// return null;
|
||||
// },
|
||||
// function(args) {
|
||||
// print(NativePointer(L_sq_I2P(args[1])).readUnicodeString());
|
||||
// if (NativePointer(L_sq_I2P(args[1])).readUnicodeString() == "SQR/../etc/rindro/ancientrelic/ancientrelic.nut") {
|
||||
// printf("加载AP脚本");
|
||||
// local str = "function sq_AddFunctionName(appendage)\n{\n}\n print(778899);";
|
||||
// NativePointer(L_sq_I2P(args[4])).writeInt(str.len());
|
||||
// NativePointer(L_sq_I2P(args[2])).writeByteArray(str);
|
||||
// }
|
||||
// return null;
|
||||
// });
|
||||
|
||||
|
||||
// getroottable().onAttackParentCallBackFunc <- {};
|
||||
// Rindro_Haker.LoadHook(0x9CFF50, ["pointer", "int", "int", "int", "int", "int"],
|
||||
// function(args) {
|
||||
// foreach(Func in onAttackParentCallBackFunc) {
|
||||
// Func(args);
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// function(args) {
|
||||
|
||||
// return null;
|
||||
// });
|
||||
|
||||
|
||||
|
||||
// //hook打开窗口
|
||||
// Rindro_Haker.LoadHook(0xE6E070, ["int","int","int","int","void"],
|
||||
// function(args) {
|
||||
|
||||
// return null;
|
||||
// },
|
||||
// function(args) {
|
||||
// // print(666);
|
||||
// // print(format("%02x", args.pop()));
|
||||
// // TTTAni <- args.pop();
|
||||
// return null;
|
||||
// });
|
||||
|
||||
|
||||
// Rindro_Haker.LoadHook(0xE6E070, ["int", "int", "int", "int", "int"],
|
||||
// function(args) {
|
||||
// print("nut:" + format("%02x", args[0]));
|
||||
// print("nut:" + format("%02x", args[1]));
|
||||
// print("nut:" + format("%02x", args[2]));
|
||||
// print("nut:" + format("%02x", args[3]));
|
||||
// return null;
|
||||
// },
|
||||
// function(args) {
|
||||
// // print(666);
|
||||
// // print(format("%02x", args.pop()));
|
||||
// // TTTAni <- args.pop();
|
||||
// return null;
|
||||
// });
|
||||
|
|
@ -40,4 +40,4 @@ function _Hook_Register_Currency_Func_(AddressString, ArgRetArr, TableName) {
|
|||
);
|
||||
}
|
||||
|
||||
// _Hook_Register_Currency_Func_(0xE6E070, ["int", "int", "int", "int"], "Cb_OpenWindow_");
|
||||
_Hook_Register_Currency_Func_(0xE6E070, ["int", "int", "int", "int"], "Cb_OpenWindow_");
|
||||
|
|
|
|||
Loading…
Reference in New Issue