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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
|
using System;
using System.Collections.Generic;
using System.Text;
namespace libLSL
{
enum lslVarType
{
VARTYPE_VOID = 0,
VARTYPE_INTEGER = 1,
VARTYPE_FLOAT = 2,
VARTYPE_STRING = 3,
VARTYPE_KEY = 4,
VARTYPE_VECTOR = 5,
VARTYPE_ROTATION = 6,
VARTYPE_LIST = 7
}
enum lslEventType
{
EVENT_STATE_ENTRY = 0,
EVENT_STATE_EXIT = 1,
EVENT_TOUCH_START = 2,
EVENT_TOUCH = 3,
EVENT_TOUCH_END = 4,
EVENT_COLLISION_START = 5,
EVENT_COLLISION = 6,
EVENT_COLLISION_END = 7,
EVENT_LAND_COLLISION_START = 8,
EVENT_LAND_COLLISION = 9,
EVENT_LAND_COLLISION_END = 10,
EVENT_TIMER = 11,
EVENT_LISTEN = 12,
EVENT_ON_REZ = 13,
EVENT_SENSOR = 14,
EVENT_NO_SENSOR = 15,
EVENT_CONTROL = 16,
EVENT_MONEY = 17,
EVENT_EMAIL = 18,
EVENT_AT_TARGET = 19,
EVENT_NOT_AT_TARGET = 20,
EVENT_AT_ROT_TARGET = 21,
EVENT_NOT_AT_ROT_TARGET = 22,
EVENT_RUN_TIME_PERMISSIONS = 23,
EVENT_CHANGED = 24,
EVENT_ATTACH = 25,
EVENT_DATASERVER = 26,
EVENT_LINK_MESSAGE = 27,
EVENT_MOVING_START = 28,
EVENT_MOVING_END = 29,
EVENT_OBJECT_REZ = 30,
EVENT_REMOTE_DATA = 31,
EVENT_HTTP_RESPONSE = 32
}
enum lslOpcodes
{
// No Operation
OP_NOOP = 0x00,
// Pops
OP_POP = 0x01,
OP_POPS = 0x02,
OP_POPL = 0x03,
OP_POPV = 0x04,
OP_POPQ = 0x05,
OP_POPARG = 0x06,
OP_POPIP = 0x07,
OP_POPBP = 0x08,
OP_POPSP = 0x09,
OP_POPSLR = 0x0A,
// Dupes
OP_DUP = 0x20,
OP_DUPS = 0x21,
OP_DUPL = 0x22,
OP_DUPV = 0x23,
OP_DUPQ = 0x24,
// Stores
OP_STORE = 0x30,
OP_STORES = 0x31,
OP_STOREL = 0x32,
OP_STOREV = 0x33,
OP_STOREQ = 0x34,
OP_STOREG = 0x35,
OP_STOREGS = 0x36,
OP_STOREGL = 0x37,
OP_STOREGV = 0x38,
OP_STOREGQ = 0x39,
// Loads
OP_LOADP = 0x3A,
OP_LOADSP = 0x3B,
OP_LOADLP = 0x3C,
OP_LOADVP = 0x3D,
OP_LOADQP = 0x3E,
OP_LOADGP = 0x3F,
OP_LOADGSP = 0x40,
OP_LOADGLP = 0x41,
OP_LOADGVP = 0x42,
OP_LOADGQP = 0x43,
// Pushes
OP_PUSH = 0x50,
OP_PUSHS = 0x51,
OP_PUSHL = 0x52,
OP_PUSHV = 0x53,
OP_PUSHQ = 0x54,
OP_PUSHG = 0x55,
OP_PUSHGS = 0x56,
OP_PUSHGL = 0x57,
OP_PUSHGV = 0x58,
OP_PUSHGQ = 0x59,
OP_PUSHIP = 0x5A,
OP_PUSHBP = 0x5B,
OP_PUSHSP = 0x5C,
OP_PUSHARGB = 0x5D,
OP_PUSHARGI = 0x5E,
OP_PUSHARGF = 0x5F,
OP_PUSHARGS = 0x60,
OP_PUSHARGV = 0x61,
OP_PUSHARGQ = 0x62,
OP_PUSHE = 0x63,
OP_PUSHEV = 0x64,
OP_PUSHEQ = 0x65,
OP_PUSHARGE = 0x66,
// Numerics
OP_ADD = 0x70,
OP_SUB = 0x71,
OP_MUL = 0x72,
OP_DIV = 0x73,
OP_MOD = 0x74,
OP_EQ = 0x75,
OP_NEQ = 0x76,
OP_LEQ = 0x77,
OP_GEQ = 0x78,
OP_LESS = 0x79,
OP_GREATER = 0x7A,
OP_BITAND = 0x7B,
OP_BITOR = 0x7C,
OP_BITXOR = 0x7D,
OP_BOOLAND = 0x7E,
OP_BOOLOR = 0x7F,
OP_NEG = 0x80,
OP_BITNOT = 0x81,
OP_BOOLNOT = 0x82,
// Sequence
OP_JUMP = 0x90,
OP_JUMPIF = 0x91,
OP_JUMPNIF = 0x92,
OP_STATE = 0x93,
OP_CALL = 0x94,
OP_RETURN = 0x95,
// Cast
OP_CAST = 0xA0,
// Stack
OP_STACKTOS = 0xB0,
OP_STACKTOL = 0xB1,
// Debug
OP_PRINT = 0xC0,
// Library
OP_CALLLIB = 0xD0,
OP_CALLLIB_TWO_BYTE = 0xD1,
// More Numerics
OP_SHL = 0xE0,
OP_SHR = 0xE1
}
class lslHeader
{
int TM; // Top of memory
int IP; // Instruction pointer
int VN; // Version Number (0x00000200)
int BP; // Base Pointer
int SP; // Stack Pointer
int HR; // Heap Register
int HP; // Heap Pointer
int CS; // Current State
int NS; // Next State
int CE; // Current Events (Which events need running still?)
int IE; // In Event
int ER; // Event Register
int FR; // Fault Register
int SLR; // Sleep Register
int GVR; // Global Variable Register (Pointer)
int GFR; // Global Function Register (Pointer)
int PR; // Parameter Register - OnRez Int?
int ESR; // Energy Supply Register
int SR; // State Register
long NCE; // Extended Current Events
long NIE; // Extended In Event
long NER; // Extended Event Register
public void readFromBytes(byte[] data)
{
}
}
class lslStaticBlock
{
int length; // Length (bytes)
lslVarType varType;// Variable Type
byte unknown; // Unknown
Object varObject; // Variable Object
public void readFromBytes(byte[] data)
{
}
}
class lslHeapBlock
{
int length;
lslVarType varType;
short referenceCount;
Object varObject;
public void readFromBytes(byte[] data)
{
}
}
class lslStatePointer
{
int location;
long eventMask;
public void readFromBytes(byte[] data)
{
}
}
class lslStateFrameBlock
{
int number;
lslStatePointer[] pointers;
public void readFromBytes(byte[] data)
{
}
}
class lslStateBlockElement
{
int pointerToCode;
int callFrameSize;
public void readFromBytes(byte[] data)
{
}
}
class lslStateBlock
{
int length;
byte unknown;
lslStateBlockElement[] handlers; // ?
public void readFromBytes(byte[] data)
{
}
}
class lslFunctioBlock
{
int number;
int[] pointers; // Relative to this -> codechunk
public void readFromBytes(byte[] data)
{
}
}
class lslCodeArgument
{
lslVarType type;
byte empty;
public void readFromBytes(byte[] data)
{
}
}
class lslCodeChunkHeader
{
int length;
string comment;
lslVarType returnType;
lslCodeArgument[] arguments;
byte empty;
public void readFromBytes(byte[] data)
{
}
}
class lslCodeChunk
{
lslCodeChunkHeader header;
byte[] bytecode;
public void readFromBytes(byte[] data)
{
}
}
}
|