aboutsummaryrefslogtreecommitdiff
path: root/primedev/vscript/languages/squirrel_re/include/squirrel.h
blob: b068ff06b23296daf48baf39a4df7b0181a6bbb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#pragma once

class Mod;
struct SQBufferState;
class CBaseEntity;

struct SQVM;
struct SQObject;
struct SQTable;
struct SQArray;
struct SQString;
struct SQClosure;
struct SQFunctionProto;
struct SQStructDef;
struct SQNativeClosure;
struct SQStructInstance;
struct SQUserData;
struct SQSharedState;

typedef float SQFloat;
typedef long SQInteger;
typedef unsigned long SQUnsignedInteger;
typedef char SQChar;
typedef SQUnsignedInteger SQBool;

typedef SQVM* HSQUIRRELVM;

enum SQRESULT : SQInteger
{
	SQRESULT_ERROR = -1,
	SQRESULT_NULL = 0,
	SQRESULT_NOTNULL = 1,
};

enum class eSQReturnType
{
	Float = 0x1,
	Vector = 0x3,
	Integer = 0x5,
	Boolean = 0x6,
	Entity = 0xD,
	String = 0x21,
	Default = 0x20,
	Arrays = 0x25,
	Asset = 0x28,
	Table = 0x26,
};

struct SQBufferState
{
	const SQChar* buffer;
	const SQChar* bufferPlusLength;
	const SQChar* bufferAgain;

	SQBufferState(const SQChar* pszCode)
	{
		buffer = pszCode;
		bufferPlusLength = pszCode + strlen(pszCode);
		bufferAgain = pszCode;
	}
};

typedef SQRESULT (*SQFunction)(HSQUIRRELVM sqvm);

struct SQFuncRegistration
{
	const char* squirrelFuncName;
	const char* cppFuncName;
	const char* helpText;
	const char* returnTypeString;
	const char* argTypes;
	uint32_t unknown1;
	uint32_t devLevel;
	const char* shortNameMaybe;
	uint32_t unknown2;
	eSQReturnType returnType;
	uint32_t* externalBufferPointer;
	uint64_t externalBufferSize;
	uint64_t unknown3;
	uint64_t unknown4;
	SQFunction funcPtr;

	SQFuncRegistration()
	{
		memset(this, 0, sizeof(SQFuncRegistration));
		this->returnType = eSQReturnType::Default;
	}
};

struct alignas(8) SQStackInfos
{
	char* _name;
	char* _sourceName;
	int _line;
};