This commit is contained in:
Yosin-Lenheart
2022-02-10 14:14:08 +08:00
parent 87aa13d231
commit b67d7b8414
10 changed files with 1166 additions and 12 deletions

View File

@@ -14,6 +14,81 @@
//-------------------------------------------------------------------------------------------Squirrel
// Push 根表
typedef int(SqPushRootT)(uint32_t v);
static SqPushRootT* SQPushRootTable = (SqPushRootT*)0x1358C50;
// Push 函数名
typedef int(realSqPushString)(uint32_t v, const wchar_t* funcName, int a);
static realSqPushString* RealSqPushString = (realSqPushString*)0x1358A60;
// Push 函数绑定闭包
typedef int(realSqNewClosure)(uint32_t v, void* funcAddr, int a);
static realSqNewClosure* RealSqNewClosure = (realSqNewClosure*)0x135B850;
// New槽
typedef int(SqNewSlot)(uint32_t v, int a, bool b);
static SqNewSlot* SQNewSlot = (SqNewSlot*)0x135AA80;
// 平栈
typedef int(SqPopTop)(uint32_t v);
static SqPopTop* SQPopTop = (SqPopTop*)0x1358FF0;
//获取Squirrel v 基址
inline uint32_t GetSqVm();
//新增nut接口funcName绑定C语言函数funcAddr
void RegisterNutApi(const wchar_t* funcName, void* funcAddr, uint32_t v = NULL);
//注册Nut函数
void RegisterNut();
//新增Nut接口绑定C函数 返回值必须为 SQInteger
// 示例如下
/*
static SQInteger math_abs(HSQUIRRELVM v)
{
SQInteger n;
const SQChar* str;
//获取nut脚本传来的第一个参数, 索引为2
//索引为1的参数是this指针
//sq_getinteger(v, 2, &n);
//获取字符串
//sq_getstring(v, 2, &str);
//返回一个整数给nut脚本
//sq_pushinteger(v, (SQInteger)(n));
//返回一个字符串给nut脚本 参数3为大小
sq_pushstring(v, str, 5);
//return 1 表示该函数有返回值传给nut脚本
return 1;
}
*/
//-------------------------------------------------------------------------------------------Squirrel
//获取EXE使用头 号位数据
int GetExeNutWrtNum(int Pos);