-
Notifications
You must be signed in to change notification settings - Fork 3
/
CLEO.h
130 lines (103 loc) · 3.93 KB
/
CLEO.h
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
CLEO 4.3 header file;
Copyright (c) 2014 Alien, Deji;
*/
#pragma once
#include <wtypes.h>
#define CLEO_VERSION 0x04031300
#define CLEO_VERSIONTEXT "4.3"
//result of CLEO_GetGameVersion()
#define GV_US10 0 //1.0 us
#define GV_US11 1 //1.01 us - not supported
#define GV_EU10 2 //1.0 eu
#define GV_EU11 3 //1.01 eu
#define GV_UNK -1 //any other
typedef union
{
DWORD dwParam;
int nParam;
float fParam;
void * pParam;
char * szParam;
} SCRIPT_VAR;
//operand types
#define globalVar 2 //$
#define localVar 3 //@
#define globalArr 7 //$(,)
#define localArr 8 //@(,)
#define imm8 4 //char
#define imm16 5 //short
#define imm32 6 //long, unsigned long
#define imm32f 1 //float
#define vstring 0x0E //""
#define sstring 9 //''
#define globalVarVString 0x10 //v$
#define localVarVString 0x11 //@v
#define globalVarSString 0x0A //s$
#define localVarSString 0x0B //@s
typedef int SCRIPT_HANDLE;
typedef SCRIPT_HANDLE HANDLE_ACTOR, ACTOR, HACTOR, PED, HPED, HANDLE_PED;
typedef SCRIPT_HANDLE HANDLE_CAR, CAR, HCAR, VEHICLE, HVEHICLE, HANDLE_VEHICLE;
typedef SCRIPT_HANDLE HANDLE_OBJECT, OBJECT, HOBJECT;
typedef struct CScriptThread CScriptThread;
#pragma pack(push,1)
struct CScriptThread
{
CScriptThread *next; //next script in queue
CScriptThread *prev; //previous script in queue
char threadName[8]; //name of thread, given by 03A4 opcode
BYTE *baseIp; //pointer to begin of script in memory
BYTE *ip; //current index pointer
BYTE *stack[8]; //return stack for 0050, 0051
WORD sp; //current item in stack
WORD _f3A; //padding
SCRIPT_VAR tls[34]; //thread's local variables
BYTE isActive; //is current thread active
char condResult; //condition result (true or false)
char missionCleanupFlag; //clean mission
char external; //is thread external (from script.img)
BYTE _fC8; //unknown
BYTE _fC9; //unknown
BYTE _fCA; //unknown
BYTE _fCB; //unknown
DWORD wakeTime; //time, when script starts again after 0001 opcode
WORD logicalOp; //00D6 parameter
BYTE notFlag; //opcode & 0x8000 != 0
BYTE wbCheckEnabled; //wasted_or_busted check flag
BYTE wastedOrBusted; //is player wasted or busted
BYTE _fD5; //unknown
WORD _fD6; //unknown
DWORD sceneSkip; //scene skip label ptr
BYTE missionFlag; //is mission thread
BYTE _fDD[3]; //padding
};
#pragma pack(pop)
#define OR_CONTINUE 0
#define OR_INTERRUPT 1
typedef int OpcodeResult;
typedef OpcodeResult (CALLBACK* _pOpcodeHandler)(CScriptThread*);
#ifdef __cplusplus
extern "C" {
#endif //__cplusplus
DWORD WINAPI CLEO_GetVersion();
int WINAPI CLEO_GetGameVersion();
BOOL WINAPI CLEO_RegisterOpcode(WORD opcode, _pOpcodeHandler callback);
DWORD WINAPI CLEO_GetIntOpcodeParam(CScriptThread* thread);
float WINAPI CLEO_GetFloatOpcodeParam(CScriptThread* thread);
void WINAPI CLEO_SetIntOpcodeParam(CScriptThread* thread, DWORD value);
void WINAPI CLEO_SetFloatOpcodeParam(CScriptThread* thread, float value);
LPSTR WINAPI CLEO_ReadStringOpcodeParam(CScriptThread* thread, LPSTR buf, int size);
void WINAPI CLEO_WriteStringOpcodeParam(CScriptThread* thread, LPCSTR str);
void WINAPI CLEO_SetThreadCondResult(CScriptThread* thread, BOOL result);
void WINAPI CLEO_SkipOpcodeParams(CScriptThread* thread, int count);
void WINAPI CLEO_ThreadJumpAtLabelPtr(CScriptThread* thread, int labelPtr);
int WINAPI CLEO_GetOperandType(CScriptThread* thread);
SCRIPT_VAR *opcodeParams;
SCRIPT_VAR *missionLocals;
//intermediate data is stored in opcodeParams array
void WINAPI CLEO_RetrieveOpcodeParams(CScriptThread *thread, int count);
void WINAPI CLEO_RecordOpcodeParams(CScriptThread *thread, int count);
SCRIPT_VAR * WINAPI CLEO_GetPointerToScriptVariable(CScriptThread *thread);
#ifdef __cplusplus
}
#endif //__cplusplus