// pch.h: 这是预编译标头文件。
// 下方列出的文件仅编译一次，提高了将来生成的生成性能。
// 这还将影响 IntelliSense 性能，包括代码完成和许多代码浏览功能。
// 但是，如果此处列出的文件中的任何一个在生成之间有更新，它们全部都将被重新编译。
// 请勿在此处添加要频繁更新的文件，这将使得性能优势无效。

#ifndef PCH_H
#define PCH_H

// 添加要在此处预编译的标头
#include "framework.h"
#include <vector>

#include "squirrel.h"
#include "sqstdaux.h"
#include "sqstdblob.h"
#include "sqstdio.h"
#include "sqstdmath.h"
#include "sqstdstring.h"
#include "sqstdsystem.h"
#include "iconv.h"
#include<d3d9.h>
#endif //PCH_H




//# define EXPRESS "学习版"
//# define SELL "售出模式"
#define INVERSION "24112901"






# define DFCSkey	{7,2,4,3,8} 




static void Cutecode(char* pstr, int* pkey, int len = -1, int keyLength = 5);
//单个字符解密
static char CutcodeChar(char c, int key, int key2) {
    char a = (((c - 1) ^ key) ^ key2) - key;
    return a;
}

//解密
static void Cutecode(char* pstr, int* pkey, int len , int keyLength) {
    if (len == -1) len = strlen(pstr);
    for (int i = 0; i < len; i++) {
        *(pstr + i) = CutcodeChar(*(pstr + i),
            pkey[i % keyLength],
            pkey[(i + 18) % keyLength]);
    }
}


#define CONTAINS_STRING(str, substr) (str == substr)





































typedef struct SQVM* HSQUIRRELVM;
//注册 Nut API
typedef int(*LSQLEXREADFUNC)(int n);
static LSQLEXREADFUNC SQ_io_file_lexfeed_ASCII = (LSQLEXREADFUNC)0x1355F60;
static LSQLEXREADFUNC SQ_io_file_lexfeed_UCS2_BE = (LSQLEXREADFUNC)0x1356050;
static LSQLEXREADFUNC SQ_io_file_lexfeed_UCS2_LE = (LSQLEXREADFUNC)0x1356020;
static LSQLEXREADFUNC SQ_io_file_lexfeed_UTF8 = (LSQLEXREADFUNC)0x1355F90;

// PushRoot
typedef int(SqPushRootFunc)(HSQUIRRELVM v);
static SqPushRootFunc* Sq_pushroottable = (SqPushRootFunc*)0x1358C50;
// // New槽
typedef int(SqNewSlot)(HSQUIRRELVM v, int a, BOOL b);
static SqNewSlot* SQNewSlot = (SqNewSlot*)0x135AA80;
// 平栈
typedef int(SqPopTop)(HSQUIRRELVM v);
static SqPopTop* SQPopTop = (SqPopTop*)0x1358FF0;
// Push 函数绑定闭包
typedef int(realSqNewClosure)(HSQUIRRELVM v, void* funcAddr, int a);
static realSqNewClosure* RealSqNewClosure = (realSqNewClosure*)0x135B850;
//SQ_Call
typedef int (Sq_CallFunc)(HSQUIRRELVM v, int params, int retval, int raiseerror);
static Sq_CallFunc* Sq_call = (Sq_CallFunc*)0x1359280;
// 平栈
typedef int(SqPop)(HSQUIRRELVM v, int n);
static SqPop* Sq_pop = (SqPop*)0x1358FD0;
// 设置栈
typedef int(SqSetTop)(HSQUIRRELVM v, int n);
static SqSetTop* Sq_settop = (SqSetTop*)0x135AA40;
//SQ_Get
typedef int(Sq_Get)(HSQUIRRELVM v, int n);
static Sq_Get* Sq_get = (Sq_Get*)0x135AE30;
//GetTop
typedef int(SqGetTopFunc)(HSQUIRRELVM v);
static SqGetTopFunc* Sq_gettop = (SqGetTopFunc*)0x1358FC0;
//GetInt
typedef int(SqGetIntFunc)(HSQUIRRELVM v, int stackIndex, int* sint);
static SqGetIntFunc* Sq_getinteger = (SqGetIntFunc*)0x1358D70;
//GetString
typedef int(SqGetStringFunc)(HSQUIRRELVM v, uint32_t stackIndex, const SQChar** sstring);
static SqGetStringFunc* Sq_getstring = (SqGetStringFunc*)0x1358E70;
//GetFloat
typedef int(SqGetFloatFunc)(HSQUIRRELVM v, uint32_t stackIndex, FLOAT* sfloat);
static SqGetFloatFunc* Sq_getfloat = (SqGetFloatFunc*)0x1358DD0;
//GetBool
typedef int(SqGetBoolFunc)(HSQUIRRELVM v, uint32_t stackIndex, SQBool* sbool);
static SqGetBoolFunc* Sq_getbool = (SqGetBoolFunc*)0x1358E30;
//GetUserdata
typedef int(SqGetUserdataFunc)(HSQUIRRELVM v, uint32_t stackIndex, DWORD* up, DWORD* up1);
static SqGetUserdataFunc* Sq_getuserdata = (SqGetUserdataFunc*)0x1358EC0;
//GetObjtypetag
typedef int(SqGetObjtypetagFunc)(HSQUIRRELVM v, DWORD* up);
static SqGetObjtypetagFunc* Sq_getobjtypetag = (SqGetObjtypetagFunc*)0x1358F20;
//GetUserpointer
typedef int(SqGetUserpointerFunc)(HSQUIRRELVM v, uint32_t idx, SQUserPointer* up);
static SqGetUserpointerFunc* Sq_getuserpointer = (SqGetUserpointerFunc*)0x1358F80;
//SQ_Compile
typedef int(SQ_CompileFunc)(HSQUIRRELVM v, LSQLEXREADFUNC FUNC, void* file, const wchar_t* filename, BOOL printerror);
static SQ_CompileFunc* SQ_Compile = (SQ_CompileFunc*)0x135A390;


//Push
typedef int(SqPushFunc)(HSQUIRRELVM v, int idx);
static SqPushFunc* Sq_push = (SqPushFunc*)0x1358C90;
//PushString
typedef int(SqPushStringFunc)(HSQUIRRELVM v, const SQChar* s, int len);
static SqPushStringFunc* Sq_pushstring = (SqPushStringFunc*)0x1358A60;
//PushInt
typedef int(SqPushIntFunc)(HSQUIRRELVM v, int sint);
static SqPushIntFunc* Sq_pushinteger = (SqPushIntFunc*)0x1358AD0;
//PushBool
typedef int(SqPushBoolFunc)(HSQUIRRELVM v, SQBool sbool);
static SqPushBoolFunc* Sq_pushbool = (SqPushBoolFunc*)0x1358B10;
//PushFloat
typedef int(SqPushFloatFunc)(HSQUIRRELVM v, FLOAT sfloat);
static SqPushFloatFunc* Sq_pushfloat = (SqPushFloatFunc*)0x1358B60;
//PushUserpointer
typedef int(SqPushUserpointerFunc)(HSQUIRRELVM v, void* sfloat);
static SqPushUserpointerFunc* Sq_pushuserpointer = (SqPushUserpointerFunc*)0x1358BA0;

//特殊操作
typedef DWORD(_1359130)(void* thisc, DWORD a2, DWORD a3);
static  _1359130* Old1359130 = (_1359130*)0x1359130;


//键盘按键是否按下
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)

//发包类型 地址
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;

//发包参数 char
typedef int(__fastcall* SendPacksChar)(DWORD thisc, int Seat, char* Parm, int Size);
static SendPacksChar _SendPacksChar = (SendPacksChar)0x11285E0;

//发包函数 地址
typedef DWORD SendPacks();
static SendPacks* _SendPacks = (SendPacks*)0x1127EC0;