DNF_DLL/test/pch.h

165 lines
4.9 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// pch.h: 这是预编译标头文件。
// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
#ifndef PCH_H
#define PCH_H
// 添加要在此处预编译的标头
#include "framework.h"
//-------------------------------------------------------------------------------------------Squirrel
// PushRoot
typedef int(SqPushRootFunc)(uint32_t v);
static SqPushRootFunc* SQPushRootTable = (SqPushRootFunc*)0x1358C50;
// 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;
//GetInt
typedef int(SqGetIntFunc)(uint32_t v, uint32_t stackIndex, int* sint);
static SqGetIntFunc* SQGetInt = (SqGetIntFunc*)0x1358D70;
//GetFloat
typedef int(SqGetFloatFunc)(uint32_t v, uint32_t stackIndex, float* sfloat);
static SqGetFloatFunc* SQGetFloat = (SqGetFloatFunc*)0x1358DD0;
//GetBool
typedef int(SqGetBoolFunc)(uint32_t v, uint32_t stackIndex, bool* sbool);
static SqGetBoolFunc* SQGetBool = (SqGetBoolFunc*)0x1358E30;
//GetString
typedef int(SqGetStringFunc)(uint32_t v, uint32_t stackIndex, wchar_t** sstring);
static SqGetStringFunc* SQGetString = (SqGetStringFunc*)0x1358E70;
//GetUserdata
typedef int(SqGetUserdataFunc)(uint32_t v, uint32_t stackIndex, DWORD* up, DWORD* up1);
static SqGetUserdataFunc* SQGetUserdata = (SqGetUserdataFunc*)0x1358EC0;
//GetObjtypetag
typedef int(SqGetObjtypetagFunc)(uint32_t v, DWORD* up);
static SqGetObjtypetagFunc* SQGetObjtypetag = (SqGetObjtypetagFunc*)0x1358F20;
//GetUserpointer
typedef int(SqGetUserpointerFunc)(uint32_t v, uint32_t idx ,DWORD* up);
static SqGetUserpointerFunc* SQGetUserpointer = (SqGetUserpointerFunc*)0x1358F80;
//GetTop
typedef int(SqGetTopFunc)(uint32_t v);
static SqGetTopFunc* SQGetTop = (SqGetTopFunc*)0x1358FC0;
//PushString
typedef int(SqPushStringFunc)(uint32_t v, const wchar_t* s, int len);
static SqPushStringFunc* SQPushString = (SqPushStringFunc*)0x1358A60;
//PushInt
typedef int(SqPushIntFunc)(uint32_t v, int sint);
static SqPushIntFunc* SQPushInt = (SqPushIntFunc*)0x1358AD0;
//PushBool
typedef int(SqPushBoolFunc)(uint32_t v, bool sbool);
static SqPushBoolFunc* SQPushBool = (SqPushBoolFunc*)0x1358B10;
//PushFloat
typedef int(SqPushFloatFunc)(uint32_t v, float sfloat);
static SqPushFloatFunc* SQPushFloat = (SqPushFloatFunc*)0x1358B60;
//获取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);
//写EXE使用头 号位数据
void SetExeNutWrtNum(int Pos, int num);
//获取Nut头 号位数据
int GetNutArrNum(int Nut头地址, int Pos);
//写Nut头 号位数据
void SetNutArrNum(int Nut头地址, int Pos, int num);
//读内存偏移地址
int GetHook(int Addr, std::string );
//发包函数 地址
typedef DWORD SendPacks();
static SendPacks* _SendPacks = (SendPacks*)0x1127EC0;
//发包Class this地址
typedef DWORD SendClass;
static SendClass* _SendClass = (SendClass*)0x1AEB6E4;
//发包类型 地址
typedef int(__fastcall* SendPacksType)(DWORD thisc, int Seat, int Parm);
static SendPacksType _SendpacksType = (SendPacksType)0x1127D60;
//发包参数 BYTE
typedef int(__fastcall* SendPacksByte)(DWORD thisc, int Seat, int Parm);
static SendPacksByte _SendPacksByte = (SendPacksByte)0x1128550;
//发包参数 WORD
typedef int(__fastcall* SendPacksWORD)(DWORD thisc, int Seat, int Parm);
static SendPacksWORD _SendPacksWord = (SendPacksWORD)0x1128580;
//发包参数 DWORD
typedef int(__fastcall* SendPacksDWORD)(DWORD thisc, int Seat, int Parm);
static SendPacksDWORD _SendPacksDWord = (SendPacksDWORD)0x11285B0;
#endif //PCH_H