Subversion Repositories Kolibri OS

Rev

Rev 8946 | Rev 9089 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8946 Rev 8949
1
//CODED by Veliant, Leency, Nable, Pavelyakov. GNU GPL licence.
1
//CODED by Veliant, Leency, Nable, Pavelyakov. GNU GPL licence.
2
 
2
 
3
#ifndef INCLUDE_KOLIBRI_H
3
#ifndef INCLUDE_KOLIBRI_H
4
#define INCLUDE_KOLIBRI_H
4
#define INCLUDE_KOLIBRI_H
5
 
5
 
6
#pragma option OST
6
#pragma option OST
7
#pragma option ON
7
#pragma option ON
8
#pragma option cri-
8
#pragma option cri-
9
#pragma option -CPA
9
#pragma option -CPA
10
#initallvar 0
10
#initallvar 0
11
#jumptomain FALSE
11
#jumptomain FALSE
12
 
12
 
13
#startaddress 0
13
#startaddress 0
14
 
14
 
15
#code32 TRUE
15
#code32 TRUE
16
 
16
 
17
#ifndef ENTRY_POINT
17
#ifndef ENTRY_POINT
18
	#define ENTRY_POINT #______INIT______
18
	#define ENTRY_POINT #______INIT______
19
#endif
19
#endif
20
 
20
 
21
char   os_name[8]   = {'M','E','N','U','E','T','0','1'};
21
char   os_name[]    = "MENUET01"n;
22
dword  os_version   = 0x00000001;
22
dword  os_version   = 0x00000001;
23
dword  start_addr   = ENTRY_POINT;
23
dword  start_addr   = ENTRY_POINT;
24
dword  final_addr   = #______STOP______+32;
24
dword  final_addr   = #______STOP______+32;
25
dword  alloc_mem    = MEMSIZE;
25
dword  alloc_mem    = MEMSIZE;
26
dword  x86esp_reg   = MEMSIZE;
26
dword  x86esp_reg   = MEMSIZE;
27
dword  I_Param      = #param;
27
dword  I_Param      = #param;
28
dword  I_Path       = #program_path;
28
dword  I_Path       = #program_path;
29
char param[4096];
29
char param[4096];
30
char program_path[4096];
30
char program_path[4096];
31
 
31
 
32
#define bool      int
32
#define bool      int
33
 
33
 
34
#define NULL      0
34
#define NULL      0
35
#define OLD      -1
35
#define OLD      -1
36
#define true      1
36
#define true      1
37
#define false     0
37
#define false     0
38
 
38
 
39
//Process Events
39
//Process Events
40
#define evReDraw  1
40
#define evReDraw  1
41
#define evKey     2
41
#define evKey     2
42
#define evButton  3
42
#define evButton  3
43
#define evExit    4
43
#define evExit    4
44
#define evDesktop 5
44
#define evDesktop 5
45
#define evMouse   6
45
#define evMouse   6
46
#define evIPC     7
46
#define evIPC     7
47
#define evNetwork 8
47
#define evNetwork 8
48
#define evDebug   9
48
#define evDebug   9
49
 
49
 
50
//Event mask bits for function 40
50
//Event mask bits for function 40
51
#define EVM_REDRAW                1b
51
#define EVM_REDRAW                1b
52
#define EVM_KEY                  10b
52
#define EVM_KEY                  10b
53
#define EVM_BUTTON              100b
53
#define EVM_BUTTON              100b
54
#define EVM_EXIT               1000b
54
#define EVM_EXIT               1000b
55
#define EVM_DESKTOPBG         10000b
55
#define EVM_DESKTOPBG         10000b
56
#define EVM_MOUSE            100000b
56
#define EVM_MOUSE            100000b
57
#define EVM_IPC             1000000b
57
#define EVM_IPC             1000000b
58
#define EVM_STACK          10000000b
58
#define EVM_STACK          10000000b
59
#define EVM_DEBUG         100000000b
59
#define EVM_DEBUG         100000000b
60
#define EVM_STACK2       1000000000b
60
#define EVM_STACK2       1000000000b
61
#define EVM_MOUSE_FILTER  0x80000000
61
#define EVM_MOUSE_FILTER  0x80000000
62
#define EVM_CURSOR_FILTER 0x40000000
62
#define EVM_CURSOR_FILTER 0x40000000
63
 
63
 
64
//Button options
64
//Button options
65
#define BT_DEL      0x80000000
65
#define BT_DEL      0x80000000
66
#define BT_HIDE     0x40000000
66
#define BT_HIDE     0x40000000
67
#define BT_NOFRAME  0x20000000
67
#define BT_NOFRAME  0x20000000
68
 
68
 
69
#define CLOSE_BTN 1
69
#define CLOSE_BTN 1
70
 
70
 
71
//-------------------------------------------------------------------------
71
//-------------------------------------------------------------------------
72
 
72
 
73
#include "../lib/system.h"
73
#include "../lib/system.h"
74
#include "../lib/mouse.h"
74
#include "../lib/mouse.h"
75
#include "../lib/keyboard.h"
75
#include "../lib/keyboard.h"
76
 
76
 
77
inline fastcall dword calc(EAX) { return EAX; }
77
inline fastcall dword calc(EAX) { return EAX; }
78
 
78
 
79
 
79
 
80
:struct raw_image {
80
:struct raw_image {
81
	dword w, h, data;
81
	dword w, h, data;
82
};
82
};
83
 
83
 
84
//------------------------------------------------------------------------------
84
//------------------------------------------------------------------------------
85
inline fastcall dword WaitEvent()
85
inline fastcall dword WaitEvent()
86
{
86
{
87
	$mov eax,10
87
	$mov eax,10
88
	$int 0x40
88
	$int 0x40
89
}
89
}
90
 
90
 
91
inline fastcall dword CheckEvent()
91
inline fastcall dword CheckEvent()
92
{
92
{
93
	$mov eax,11
93
	$mov eax,11
94
	$int 0x40
94
	$int 0x40
95
}
95
}
96
 
96
 
97
inline fastcall dword WaitEventTimeout(EBX)
97
inline fastcall dword WaitEventTimeout(EBX)
98
{
98
{
99
	EAX = 23;
99
	EAX = 23;
100
	$int 0x40
100
	$int 0x40
101
} 
101
} 
102
 
102
 
103
inline fastcall dword SetEventMask(EBX)
103
inline fastcall dword SetEventMask(EBX)
104
{
104
{
105
	$mov eax,40
105
	$mov eax,40
106
	$int 0x40
106
	$int 0x40
107
}
107
}
108
 
108
 
109
 
109
 
110
inline fastcall pause(EBX)
110
inline fastcall pause(EBX)
111
{
111
{
112
	$mov eax, 5
112
	$mov eax, 5
113
	$int 0x40
113
	$int 0x40
114
}
114
}
115
 
115
 
116
inline fastcall word GetButtonID()
116
inline fastcall word GetButtonID()
117
{
117
{
118
	$mov eax,17
118
	$mov eax,17
119
	$int  0x40
119
	$int  0x40
120
	$shr eax,8
120
	$shr eax,8
121
}
121
}
122
 
122
 
123
inline fastcall int GetKernelRev()
123
inline fastcall int GetKernelRev()
124
{
124
{
125
	char buf[16];
125
	char buf[16];
126
	EAX = 18;
126
	EAX = 18;
127
	EBX = 13;
127
	EBX = 13;
128
	ECX = #buf;
128
	ECX = #buf;
129
	$int 0x40
129
	$int 0x40
130
	EAX = ESDWORD[#buf+5];
130
	EAX = ESDWORD[#buf+5];
131
}
131
}
132
 
132
 
133
inline fastcall dword GetFreeRAM()
133
inline fastcall dword GetFreeRAM()
134
{
134
{
135
	$mov eax, 18
135
	$mov eax, 18
136
	$mov ebx, 16
136
	$mov ebx, 16
137
	$int 0x40
137
	$int 0x40
138
	//return eax = free RAM size in Kb
138
	//return eax = free RAM size in Kb
139
}
139
}
140
 
140
 
141
inline fastcall dword GetTotalRAM()
141
inline fastcall dword GetTotalRAM()
142
{
142
{
143
	$mov eax, 18
143
	$mov eax, 18
144
	$mov ebx, 17
144
	$mov ebx, 17
145
	$int 0x40
145
	$int 0x40
146
	//return eax = total RAM size in Kb
146
	//return eax = total RAM size in Kb
147
}
147
}
148
 
148
 
149
inline fastcall int GetCpuIdleCount()
149
inline fastcall int GetCpuIdleCount()
150
{
150
{
151
	EAX = 18;
151
	EAX = 18;
152
	EBX = 4;
152
	EBX = 4;
153
	$int 0x40
153
	$int 0x40
154
}
154
}
155
 
155
 
156
inline fastcall int GetCpuFrequency()
156
inline fastcall int GetCpuFrequency()
157
{
157
{
158
	EAX = 18;
158
	EAX = 18;
159
	EBX = 5;
159
	EBX = 5;
160
	$int 0x40
160
	$int 0x40
161
}
161
}
162
 
162
 
163
inline fastcall dword LoadDriver(ECX) //ECX - èìÿ äðàéâåðà
163
inline fastcall dword LoadDriver(ECX) //ECX - èìÿ äðàéâåðà
164
{
164
{
165
	$mov eax, 68
165
	$mov eax, 68
166
	$mov ebx, 16
166
	$mov ebx, 16
167
	$int 0x40
167
	$int 0x40
168
	//return 0 - íåóäà÷à, èíà÷å eax = õýíäë äðàéâåðà 
168
	//return 0 - íåóäà÷à, èíà÷å eax = õýíäë äðàéâåðà 
169
}
169
}
170
 
170
 
171
inline fastcall dword RuleDriver(ECX) //óêàçàòåëü íà óïðàâëÿþùóþ ñòðóêòóðó
171
inline fastcall dword RuleDriver(ECX) //óêàçàòåëü íà óïðàâëÿþùóþ ñòðóêòóðó
172
{
172
{
173
	$mov eax, 68
173
	$mov eax, 68
174
	$mov ebx, 17
174
	$mov ebx, 17
175
	$int 0x40
175
	$int 0x40
176
	//return eax = îïðåäåëÿåòñÿ äðàéâåðîì
176
	//return eax = îïðåäåëÿåòñÿ äðàéâåðîì
177
}
177
}
178
 
178
 
179
struct proc_info
179
struct proc_info
180
{
180
{
181
	#define SelfInfo -1
181
	#define SelfInfo -1
182
	dword	use_cpu;
182
	dword	use_cpu;
183
	word	pos_in_stack,slot,rezerv1;
183
	word	pos_in_stack,slot,rezerv1;
184
	unsigned char name[11];
184
	unsigned char name[11];
185
	char	rezerv2;
185
	char	rezerv2;
186
	dword	adress,use_memory,ID,left,top,width,height;
186
	dword	adress,use_memory,ID,left,top,width,height;
187
	word	status_slot,rezerv3;
187
	word	status_slot,rezerv3;
188
	dword	cleft,ctop,cwidth,cheight;
188
	dword	cleft,ctop,cwidth,cheight;
189
	char	status_window;
189
	char	status_window;
190
	byte    reserved[1024-71-8];
190
	byte    reserved[1024-71-8];
191
};
191
};
192
 
192
 
193
:void GetProcessInfo(dword _process_struct_pointer, _process_id)
193
:void GetProcessInfo(dword _process_struct_pointer, _process_id)
194
{
194
{
195
	EAX = 9;
195
	EAX = 9;
196
	EBX = _process_struct_pointer;
196
	EBX = _process_struct_pointer;
197
	ECX = _process_id;
197
	ECX = _process_id;
198
	$int  0x40
198
	$int  0x40
199
}
199
}
200
 
200
 
201
inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y
201
inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y
202
{
202
{
203
	$mov eax,34
203
	$mov eax,34
204
	$int 0x40
204
	$int 0x40
205
}
205
}
206
 
206
 
207
inline fastcall int GetProcessSlot( ECX)
207
inline fastcall int GetProcessSlot( ECX)
208
{
208
{
209
	EAX = 18;
209
	EAX = 18;
210
	EBX = 21;
210
	EBX = 21;
211
	$int 0x40
211
	$int 0x40
212
}
212
}
213
 
213
 
214
inline fastcall int GetActiveProcess()
214
inline fastcall int GetActiveProcess()
215
{
215
{
216
	EAX = 18;
216
	EAX = 18;
217
	EBX = 7;
217
	EBX = 7;
218
	$int 0x40
218
	$int 0x40
219
}
219
}
220
 
220
 
221
:int CheckActiveProcess(int Form_ID)
221
:int CheckActiveProcess(int Form_ID)
222
{
222
{
223
	int id9=GetProcessSlot(Form_ID);
223
	int id9=GetProcessSlot(Form_ID);
224
	if (id9==GetActiveProcess()) return 1;
224
	if (id9==GetActiveProcess()) return 1;
225
	return 0;
225
	return 0;
226
}
226
}
227
 
227
 
228
inline fastcall void ActivateWindow( ECX) //ECX - slot
228
inline fastcall void ActivateWindow( ECX) //ECX - slot
229
{
229
{
230
	EAX = 18;
230
	EAX = 18;
231
	EBX = 3;
231
	EBX = 3;
232
	$int 0x40
232
	$int 0x40
233
}
233
}
234
 
234
 
235
:void RefreshWindow(dword ID_REFRESH,ID_ACTIVE)
235
:void RefreshWindow(dword ID_REFRESH,ID_ACTIVE)
236
{
236
{
237
	ActivateWindow(ID_REFRESH);
237
	ActivateWindow(ID_REFRESH);
238
	ActivateWindow(ID_ACTIVE);
238
	ActivateWindow(ID_ACTIVE);
239
}
239
}
240
 
240
 
241
inline fastcall int MinimizeWindow()
241
inline fastcall int MinimizeWindow()
242
{
242
{
243
	EAX = 18;
243
	EAX = 18;
244
	EBX = 10;
244
	EBX = 10;
245
	$int 0x40
245
	$int 0x40
246
}
246
}
247
 
247
 
248
inline fastcall int CreateThread(ECX,EDX)
248
inline fastcall int CreateThread(ECX,EDX)
249
{
249
{
250
	$mov eax,51
250
	$mov eax,51
251
	$mov ebx,1
251
	$mov ebx,1
252
	$int 0x40
252
	$int 0x40
253
}
253
}
254
 
254
 
255
inline fastcall void SwitchToAnotherThread()
255
inline fastcall void SwitchToAnotherThread()
256
{
256
{
257
	$mov eax,68
257
	$mov eax,68
258
	$mov ebx,1
258
	$mov ebx,1
259
	$int 0x40
259
	$int 0x40
260
}
260
}
261
 
261
 
262
inline fastcall int SendWindowMessage( ECX, EDX)
262
inline fastcall int SendWindowMessage( ECX, EDX)
263
{
263
{
264
	$mov eax, 72
264
	$mov eax, 72
265
	$mov ebx, 1
265
	$mov ebx, 1
266
	$int 0x40
266
	$int 0x40
267
}
267
}
268
 
268
 
269
inline fastcall int KillProcess( ECX)
269
inline fastcall int KillProcess( ECX)
270
{
270
{
271
	$mov eax,18;
271
	$mov eax,18;
272
	$mov ebx,18;
272
	$mov ebx,18;
273
	$int 0x40
273
	$int 0x40
274
}
274
}
275
 
275
 
276
#define TURN_OFF 2
276
#define TURN_OFF 2
277
#define REBOOT 3
277
#define REBOOT 3
278
#define KERNEL 4
278
#define KERNEL 4
279
inline fastcall int ExitSystem( ECX)
279
inline fastcall int ExitSystem( ECX)
280
{
280
{
281
	$mov eax, 18
281
	$mov eax, 18
282
	$mov ebx, 9
282
	$mov ebx, 9
283
	$int 0x40
283
	$int 0x40
284
}
284
}
285
 
285
 
286
inline fastcall ExitProcess()
286
inline fastcall ExitProcess()
287
{
287
{
288
	$mov eax,-1;
288
	$mov eax,-1;
289
	$int 0x40
289
	$int 0x40
290
}
290
}
291
 
291
 
292
//------------------------------------------------------------------------------
292
//------------------------------------------------------------------------------
293
 
293
 
294
//eax = ÿçûê ñèñòåìû (1=eng, 2=fi, 3=ger, 4=rus)
294
//eax = ÿçûê ñèñòåìû (1=eng, 2=fi, 3=ger, 4=rus)
295
///SYSFUNC DOESN'T WORK!!!  =>  https://bit.ly/2XNdiTD
295
///SYSFUNC DOESN'T WORK!!!  =>  https://bit.ly/2XNdiTD
296
#define SYS_LANG_ENG 1
296
#define SYS_LANG_ENG 1
297
#define SYS_LANG_FIN 2
297
#define SYS_LANG_FIN 2
298
#define SYS_LANG_GER 3
298
#define SYS_LANG_GER 3
299
#define SYS_LANG_RUS 4
299
#define SYS_LANG_RUS 4
300
inline fastcall int GetSystemLanguage()
300
inline fastcall int GetSystemLanguage()
301
{
301
{
302
	EAX = 26;
302
	EAX = 26;
303
	EBX = 5;
303
	EBX = 5;
304
	$int 0x40
304
	$int 0x40
305
}
305
}
306
 
306
 
307
#define BUTTON_STYLE_FLAT 0
307
#define BUTTON_STYLE_FLAT 0
308
#define BUTTON_STYLE_GRADIENT 1
308
#define BUTTON_STYLE_GRADIENT 1
309
inline fastcall SetButtonStyle(ECX) //ECX - button style
309
inline fastcall SetButtonStyle(ECX) //ECX - button style
310
{
310
{
311
	$mov eax,48
311
	$mov eax,48
312
	$mov ebx,1
312
	$mov ebx,1
313
	int 64
313
	int 64
314
}
314
}
315
 
315
 
316
inline fastcall GetSkinHeight()
316
inline fastcall GetSkinHeight()
317
{
317
{
318
	$push ebx
318
	$push ebx
319
	$mov  eax,48
319
	$mov  eax,48
320
	$mov  ebx,4
320
	$mov  ebx,4
321
	$int 0x40
321
	$int 0x40
322
	$pop  ebx
322
	$pop  ebx
323
}
323
}
324
 
324
 
325
inline fastcall void SetSystemSkin( ECX)
325
inline fastcall void SetSystemSkin( ECX)
326
{
326
{
327
	EAX = 48;
327
	EAX = 48;
328
	EBX = 8;
328
	EBX = 8;
329
	$int 0x40
329
	$int 0x40
330
}
330
}
331
 
331
 
332
inline fastcall int GetScreenWidth()
332
inline fastcall int GetScreenWidth()
333
{
333
{
334
	$mov eax, 14
334
	$mov eax, 14
335
	$int 0x40
335
	$int 0x40
336
	$shr eax, 16
336
	$shr eax, 16
337
}
337
}
338
 
338
 
339
inline fastcall int GetScreenHeight()
339
inline fastcall int GetScreenHeight()
340
{
340
{
341
	$mov eax, 14
341
	$mov eax, 14
342
	$int 0x40
342
	$int 0x40
343
	$and eax,0x0000FFFF
343
	$and eax,0x0000FFFF
344
}
344
}
345
 
345
 
346
inline fastcall int GetClientTop()
346
inline fastcall int GetClientTop()
347
{
347
{
348
	$mov eax, 48
348
	$mov eax, 48
349
	$mov ebx, 5
349
	$mov ebx, 5
350
	$int 0x40
350
	$int 0x40
351
	$mov eax, ebx
351
	$mov eax, ebx
352
	$shr eax, 16
352
	$shr eax, 16
353
}
353
}
354
 
354
 
355
inline fastcall int GetClientHeight()
355
inline fastcall int GetClientHeight()
356
{
356
{
357
	$mov eax, 48
357
	$mov eax, 48
358
	$mov ebx, 5
358
	$mov ebx, 5
359
	$int 0x40
359
	$int 0x40
360
	$mov eax, ebx
360
	$mov eax, ebx
361
}
361
}
362
 
362
 
363
inline fastcall dword LoadLibrary( ECX)
363
inline fastcall dword LoadLibrary( ECX)
364
{
364
{
365
	$mov eax, 68 
365
	$mov eax, 68 
366
	$mov ebx, 19
366
	$mov ebx, 19
367
	$int  0x40
367
	$int  0x40
368
}
368
}
369
 
369
 
370
inline fastcall int TestBit( EAX, CL)
370
inline fastcall int TestBit( EAX, CL)
371
{
371
{
372
	$shr eax,cl
372
	$shr eax,cl
373
	$and eax,1
373
	$and eax,1
374
}
374
}
375
 
375
 
376
:void SetClientScreenArea(dword _left, _right, _top, _bottom)
376
:void SetClientScreenArea(dword _left, _right, _top, _bottom)
377
{
377
{
378
	EAX = 48;
378
	EAX = 48;
379
	EBX = 6;
379
	EBX = 6;
380
	ECX = _left * 65536 + _right;
380
	ECX = _left * 65536 + _right;
381
	EDX = _top * 65536 + _bottom;
381
	EDX = _top * 65536 + _bottom;
382
	$int 64;
382
	$int 64;
383
}
383
}
384
 
384
 
385
//------------------------------------------------------------------------------
385
//------------------------------------------------------------------------------
386
 
386
 
387
#define ROLLED_UP 0x04
387
#define ROLLED_UP 0x04
388
:void DefineAndDrawWindow(dword _x, _y, _w, _h, _window_type, _bgcolor, _title, _flags)
388
:void DefineAndDrawWindow(dword _x, _y, _w, _h, _window_type, _bgcolor, _title, _flags)
389
{
389
{
390
	EAX = 12;              // function 12:tell os about windowdraw
390
	EAX = 12;              // function 12:tell os about windowdraw
391
	EBX = 1;
391
	EBX = 1;
392
	$int 0x40
392
	$int 0x40
393
	
393
	
394
	$xor EAX,EAX
394
	$xor EAX,EAX
395
	EBX = _x << 16 + _w; 
395
	EBX = _x << 16 + _w; 
396
	ECX = _y << 16 + _h;
396
	ECX = _y << 16 + _h;
397
	EDX = _window_type << 24 | _bgcolor;
397
	EDX = _window_type << 24 | _bgcolor;
398
	EDI = _title;
398
	EDI = _title;
399
	ESI = _flags;
399
	ESI = _flags;
400
	$int 0x40
400
	$int 0x40
401
 
401
 
402
	EAX = 12;              // function 12:tell os about windowdraw
402
	EAX = 12;              // function 12:tell os about windowdraw
403
	EBX = 2;
403
	EBX = 2;
404
	$int 0x40
404
	$int 0x40
405
}
405
}
406
 
406
 
407
inline fastcall MoveSize( EBX,ECX,EDX,ESI)
407
inline fastcall MoveSize( EBX,ECX,EDX,ESI)
408
{
408
{
409
	$mov eax, 67
409
	$mov eax, 67
410
	$int 0x40
410
	$int 0x40
411
}
411
}
412
 
412
 
413
inline fastcall void DrawTitle( ECX)
413
inline fastcall void DrawTitle( ECX)
414
{
414
{
415
	EAX = 71;
415
	EAX = 71;
416
	EBX = 1;
416
	EBX = 1;
417
	$int 0x40;
417
	$int 0x40;
418
}
418
}
419
 
419
 
420
// @EDX is a process id, -1 for self
420
// @EDX is a process id, -1 for self
421
// @ESI is a new LayerBehaviour
421
// @ESI is a new LayerBehaviour
422
// @RETURN: EAX, 0 is fail, 1 is success
422
// @RETURN: EAX, 0 is fail, 1 is success
423
#define ZPOS_DESKTOP     -2
423
#define ZPOS_DESKTOP     -2
424
#define ZPOS_ALWAYS_BACK -1
424
#define ZPOS_ALWAYS_BACK -1
425
#define ZPOS_NORMAL      0
425
#define ZPOS_NORMAL      0
426
#define ZPOS_ALWAYS_TOP  1
426
#define ZPOS_ALWAYS_TOP  1
427
inline fastcall dword SetWindowLayerBehaviour(EDX, ESI)
427
inline fastcall dword SetWindowLayerBehaviour(EDX, ESI)
428
{
428
{
429
	EAX = 18;
429
	EAX = 18;
430
	EBX = 25;
430
	EBX = 25;
431
	ECX = 2;
431
	ECX = 2;
432
	$int 64
432
	$int 64
433
}
433
}
434
 
434
 
435
:void WriteTextB(dword x,y,byte fontType, dword color, str_offset)
435
:void WriteTextB(dword x,y,byte fontType, dword color, str_offset)
436
{
436
{
437
	EAX = 4;
437
	EAX = 4;
438
	EBX = x<<16+y;
438
	EBX = x<<16+y;
439
	ECX = fontType<<24+color;
439
	ECX = fontType<<24+color;
440
	EDX = str_offset;
440
	EDX = str_offset;
441
	ESI = 0;
441
	ESI = 0;
442
	$int 0x40;
442
	$int 0x40;
443
	$add ebx, 1<<16
443
	$add ebx, 1<<16
444
	$int 0x40
444
	$int 0x40
445
}
445
}
446
 
446
 
447
:void WriteText(dword x,y,byte fontType, dword color, str_offset)
447
:void WriteText(dword x,y,byte fontType, dword color, str_offset)
448
{
448
{
449
	EAX = 4;
449
	EAX = 4;
450
	EBX = x<<16+y;
450
	EBX = x<<16+y;
451
	ECX = fontType<<24+color;
451
	ECX = fontType<<24+color;
452
	EDX = str_offset;
452
	EDX = str_offset;
453
	$int 0x40;
453
	$int 0x40;
454
}
454
}
455
 
455
 
456
:dword WriteBufText(dword x,y,byte fontType, dword color, str_offset, buf_offset)
456
:dword WriteBufText(dword x,y,byte fontType, dword color, str_offset, buf_offset)
457
{
457
{
458
	EDI = buf_offset;
458
	EDI = buf_offset;
459
	WriteText(x,y, fontType, color, str_offset);
459
	WriteText(x,y, fontType, color, str_offset);
460
}
460
}
461
 
461
 
462
:void WriteTextWithBg(dword x,y,byte fontType, dword color, str_offset, bgcolor)
462
:void WriteTextWithBg(dword x,y,byte fontType, dword color, str_offset, bgcolor)
463
{
463
{
464
	EDI = bgcolor;
464
	EDI = bgcolor;
465
	WriteText(x,y, fontType, color, str_offset);
465
	WriteText(x,y, fontType, color, str_offset);
466
}
466
}
467
 
467
 
468
:void WriteNumber(dword x,y,byte fontType, dword color, count, number_or_offset)
468
:void WriteNumber(dword x,y,byte fontType, dword color, count, number_or_offset)
469
{
469
{
470
	EAX = 47;
470
	EAX = 47;
471
	EBX = count<<16;
471
	EBX = count<<16;
472
	ECX = number_or_offset;
472
	ECX = number_or_offset;
473
	EDX = x<<16+y;
473
	EDX = x<<16+y;
474
	ESI = fontType<<24+color;
474
	ESI = fontType<<24+color;
475
	$int 0x40;
475
	$int 0x40;
476
}
476
}
477
 
477
 
478
:void CopyScreen(dword dst_offset, x, y, w, h)
478
:void CopyScreen(dword dst_offset, x, y, w, h)
479
{
479
{
480
  EAX = 36;
480
  EAX = 36;
481
  EBX = dst_offset;
481
  EBX = dst_offset;
482
  ECX = w << 16 + h;
482
  ECX = w << 16 + h;
483
  EDX = x << 16 + y;
483
  EDX = x << 16 + y;
484
  $int  0x40;
484
  $int  0x40;
485
}
485
}
486
 
486
 
487
:dword GetPixelColorFromScreen(dword _x, _y)
487
:dword GetPixelColorFromScreen(dword _x, _y)
488
{
488
{
489
	EAX = 35;
489
	EAX = 35;
490
	EBX = _y * screen.width + _x;
490
	EBX = _y * screen.width + _x;
491
	$int 64
491
	$int 64
492
}
492
}
493
 
493
 
494
#define DRAW_DESKTOP_BG_TILE 1
494
#define DRAW_DESKTOP_BG_TILE 1
495
#define DRAW_DESKTOP_BG_STRETCH 2
495
#define DRAW_DESKTOP_BG_STRETCH 2
496
:void SetBackgroundImage(dword w,h, image, mode)
496
:void SetBackgroundImage(dword w,h, image, mode)
497
{
497
{
498
	$mov     eax,15      // SF_BACKGROUND_SET 15 - work with desktop background graphics
498
	$mov     eax,15      // SF_BACKGROUND_SET 15 - work with desktop background graphics
499
	$mov     ebx,4       // SSF_MODE_BG 4 - set drawing mode for the background
499
	$mov     ebx,4       // SSF_MODE_BG 4 - set drawing mode for the background
500
	$mov     ecx,mode    // drawing mode - tile (1), stretch (2)
500
	$mov     ecx,mode    // drawing mode - tile (1), stretch (2)
501
	$int     64
501
	$int     64
502
 
502
 
503
	$mov     eax,15      // SF_BACKGROUND_SET 15 - work with desktop background graphics
503
	$mov     eax,15      // SF_BACKGROUND_SET 15 - work with desktop background graphics
504
	$mov     ebx,1       // SSF_SIZE_BG=1 - set a size of the background image
504
	$mov     ebx,1       // SSF_SIZE_BG=1 - set a size of the background image
505
	$mov     ecx,w       // width
505
	$mov     ecx,w       // width
506
	$mov     edx,h       // height
506
	$mov     edx,h       // height
507
	$int     64
507
	$int     64
508
 
508
 
509
	$mov     eax,15      // SF_BACKGROUND_SET 15 - work with desktop background graphics
509
	$mov     eax,15      // SF_BACKGROUND_SET 15 - work with desktop background graphics
510
	$mov     ebx,5       // SSF_IMAGE_BG=5 - put block of pixels on the background image
510
	$mov     ebx,5       // SSF_IMAGE_BG=5 - put block of pixels on the background image
511
	$mov     ecx,image   // pointer to the data in the format BBGGRRBBGGRR...
511
	$mov     ecx,image   // pointer to the data in the format BBGGRRBBGGRR...
512
	$mov     edx,0       // offset in data of the background image
512
	$mov     edx,0       // offset in data of the background image
513
	ESI      = 3*w*h;    // size of data in bytes = 3 * number of pixels
513
	ESI      = 3*w*h;    // size of data in bytes = 3 * number of pixels
514
	$int     64
514
	$int     64
515
 
515
 
516
	$mov     eax,15      // SF_BACKGROUND_SET 15 - work with desktop background graphics
516
	$mov     eax,15      // SF_BACKGROUND_SET 15 - work with desktop background graphics
517
	$mov     ebx,3       // SSF_REDRAW_BG=3 - redraw background
517
	$mov     ebx,3       // SSF_REDRAW_BG=3 - redraw background
518
	$int     64
518
	$int     64
519
}
519
}
520
 
520
 
521
:void _PutImage(dword x,y, w,h, data_offset)
521
:void _PutImage(dword x,y, w,h, data_offset)
522
{
522
{
523
	EAX = 7;
523
	EAX = 7;
524
	EBX = data_offset;
524
	EBX = data_offset;
525
	ECX = w<<16+h;
525
	ECX = w<<16+h;
526
	EDX = x<<16+y;
526
	EDX = x<<16+y;
527
	$int 0x40
527
	$int 0x40
528
}
528
}
529
 
529
 
530
:void PutPaletteImage(dword inbuf,w,h,x,y,bits,pal)
530
:void PutPaletteImage(dword inbuf,w,h,x,y,bits,pal)
531
{
531
{
532
	if (h<1) || (w<0) return;
532
	if (h<1) || (w<0) return;
533
	EAX = 65;
533
	EAX = 65;
534
	EBX = inbuf;
534
	EBX = inbuf;
535
	ECX = w<<16+h;
535
	ECX = w<<16+h;
536
	EDX = x<<16+y;
536
	EDX = x<<16+y;
537
	ESI = bits;
537
	ESI = bits;
538
	EDI = pal;
538
	EDI = pal;
539
	EBP = 0;
539
	EBP = 0;
540
	$int 0x40
540
	$int 0x40
541
}
541
}
542
 
542
 
543
inline fastcall void PutPixel( EBX,ECX,EDX)
543
inline fastcall void PutPixel( EBX,ECX,EDX)
544
{
544
{
545
  EAX=1;
545
  EAX=1;
546
  $int 0x40
546
  $int 0x40
547
}
547
}
548
 
548
 
549
:void DrawBar(dword x,y,w,h,color)
549
:void DrawBar(dword x,y,w,h,color)
550
{
550
{
551
	if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :)
551
	if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :)
552
	EAX = 13;
552
	EAX = 13;
553
	EBX = x<<16+w;
553
	EBX = x<<16+w;
554
	ECX = y<<16+h;
554
	ECX = y<<16+h;
555
	EDX = color;
555
	EDX = color;
556
	$int 0x40
556
	$int 0x40
557
}
557
}
558
 
558
 
559
:void DefineButton(dword x,y,w,h,id,color)
559
:void DefineButton(dword x,y,w,h,id,color)
560
{
560
{
561
	EAX = 8;
561
	EAX = 8;
562
	EDX = id + BT_DEL;
562
	EDX = id + BT_DEL;
563
	$int 0x40;
563
	$int 0x40;
564
	EDX = id;
564
	EDX = id;
565
	ESI = color;
565
	ESI = color;
566
	EBX = x<<16+w;
566
	EBX = x<<16+w;
567
	ECX = y<<16+h;
567
	ECX = y<<16+h;
568
	$int 0x40
568
	$int 0x40
569
}
569
}
570
 
570
 
571
:void UnsafeDefineButton(dword x,y,w,h,id,color)
571
:void UnsafeDefineButton(dword x,y,w,h,id,color)
572
{
572
{
573
	EAX = 8;
573
	EAX = 8;
574
	EBX = x<<16+w;
574
	EBX = x<<16+w;
575
	ECX = y<<16+h;
575
	ECX = y<<16+h;
576
	EDX = id;
576
	EDX = id;
577
	ESI = color;
577
	ESI = color;
578
	$int 0x40
578
	$int 0x40
579
}
579
}
580
 
580
 
581
:void DefineDragableWindow(dword _x, _y, _w, _h)
581
:void DefineDragableWindow(dword _x, _y, _w, _h)
582
{
582
{
583
	DefineAndDrawWindow(_x, _y, _w, _h, 0x41,0x000000,NULL,0b);
583
	DefineAndDrawWindow(_x, _y, _w, _h, 0x41,0x000000,NULL,0b);
584
}
584
}
585
 
585
 
586
:void DefineUnDragableWindow(dword _x, _y, _w, _h)
586
:void DefineUnDragableWindow(dword _x, _y, _w, _h)
587
{
587
{
588
	DefineAndDrawWindow(_x, _y, _w, _h, 0x01, 0, 0, 0x01fffFFF);
588
	DefineAndDrawWindow(_x, _y, _w, _h, 0x01, 0, 0, 0x01fffFFF);
589
}
589
}
590
 
590
 
591
:void EventDragWindow()
591
:void EventDragWindow()
592
{
592
{
593
	proc_info Form1;
593
	proc_info Form1;
594
	dword tmp_x,tmp_y;
594
	dword tmp_x,tmp_y;
595
	dword z1,z2;
595
	dword z1,z2;
596
	tmp_x = mouse.x;
596
	tmp_x = mouse.x;
597
	tmp_y = mouse.y;
597
	tmp_y = mouse.y;
598
	do {
598
	do {
599
		GetProcessInfo(#Form1, SelfInfo);
599
		GetProcessInfo(#Form1, SelfInfo);
600
		mouse.get();
600
		mouse.get();
601
		if (tmp_x!=mouse.x) || (tmp_y!=mouse.y) 
601
		if (tmp_x!=mouse.x) || (tmp_y!=mouse.y) 
602
		{
602
		{
603
			z1 = Form1.left + mouse.x - tmp_x;
603
			z1 = Form1.left + mouse.x - tmp_x;
604
			z2 = Form1.top + mouse.y - tmp_y;
604
			z2 = Form1.top + mouse.y - tmp_y;
605
			if(z1<=10) || (z1>20000) z1=0; else if(z1>screen.width-Form1.width-10)z1=screen.width-Form1.width;
605
			if(z1<=10) || (z1>20000) z1=0; else if(z1>screen.width-Form1.width-10)z1=screen.width-Form1.width;
606
			if(z2<=10) || (z2>20000) z2=0; else if(z2>screen.height-Form1.height-10)z2=screen.height-Form1.height;
606
			if(z2<=10) || (z2>20000) z2=0; else if(z2>screen.height-Form1.height-10)z2=screen.height-Form1.height;
607
			MoveSize(z1 , z2, OLD, OLD);
607
			MoveSize(z1 , z2, OLD, OLD);
608
			draw_window();
608
			draw_window();
609
		}
609
		}
610
		pause(1);
610
		pause(1);
611
	} while (mouse.lkm);
611
	} while (mouse.lkm);
612
}
612
}
613
 
613
 
614
:void DefineHiddenButton(dword _x, _y, _w, _h, _id)
614
:void DefineHiddenButton(dword _x, _y, _w, _h, _id)
615
{
615
{
616
	DefineButton(_x, _y, _w, _h, _id + BT_HIDE, 0);
616
	DefineButton(_x, _y, _w, _h, _id + BT_HIDE, 0);
617
}
617
}
618
 
618
 
619
inline fastcall void DeleteButton( EDX)
619
inline fastcall void DeleteButton( EDX)
620
{
620
{
621
	EAX = 8;
621
	EAX = 8;
622
	EDX += BT_DEL;
622
	EDX += BT_DEL;
623
	$int 0x40
623
	$int 0x40
624
}
624
}
625
 
625
 
626
inline fastcall dword GetStartTime()
626
inline fastcall dword GetStartTime()
627
{
627
{
628
	$mov eax,26
628
	$mov eax,26
629
	$mov ebx,9
629
	$mov ebx,9
630
	$int 0x40
630
	$int 0x40
631
}
631
}
632
 
632
 
633
:dword X_EventRedrawWindow,Y_EventRedrawWindow;
633
:dword X_EventRedrawWindow,Y_EventRedrawWindow;
634
:void _EventRedrawWindow()
634
:void _EventRedrawWindow()
635
{
635
{
636
	DefineAndDrawWindow(X_EventRedrawWindow,Y_EventRedrawWindow,1,1,0x34,0xFFFFFF,NULL,0);
636
	DefineAndDrawWindow(X_EventRedrawWindow,Y_EventRedrawWindow,1,1,0x34,0xFFFFFF,NULL,0);
637
	//pause(10);
637
	//pause(10);
638
	ExitProcess();
638
	ExitProcess();
639
}
639
}
640
:char REDRAW_BUFF_EVENT_[4096];
640
:char REDRAW_BUFF_EVENT_[4096];
641
:void EventRedrawWindow(dword x,y)
641
:void EventRedrawWindow(dword x,y)
642
{
642
{
643
	X_EventRedrawWindow = x;
643
	X_EventRedrawWindow = x;
644
	Y_EventRedrawWindow = y;
644
	Y_EventRedrawWindow = y;
645
	CreateThread(#_EventRedrawWindow,#REDRAW_BUFF_EVENT_+4092);
645
	CreateThread(#_EventRedrawWindow,#REDRAW_BUFF_EVENT_+4092);
646
}
646
}
647
 
647
 
648
:struct _screen
648
:struct _screen
649
{
649
{
650
	dword width,height;
650
	dword width,height;
651
} screen;
651
} screen;
652
 
652
 
653
:byte skin_height;
653
:byte skin_height;
654
 
654
 
655
dword __generator;  // random number generator init
655
dword __generator;  // random number generator init
656
 
656
 
657
//The initialization of the initial data before running
657
//The initialization of the initial data before running
658
:void ______INIT______()
658
:void ______INIT______()
659
{
659
{
660
	skin_height   = @GetSkinHeight();
660
	skin_height   = @GetSkinHeight();
661
	screen.width  = @GetScreenWidth()+1;
661
	screen.width  = @GetScreenWidth()+1;
662
	screen.height = @GetScreenHeight()+1;
662
	screen.height = @GetScreenHeight()+1;
663
	__generator = @GetStartTime();	
663
	__generator = @GetStartTime();	
664
	mem_init();
664
	mem_init();
665
	main();
665
	main();
666
}
666
}
667
______STOP______:
667
______STOP______:
668
#endif
668
#endif
669
 
669
 
670
#ifndef INCLUDE_MEM_H
670
#ifndef INCLUDE_MEM_H
671
#include "../lib/mem.h"
671
#include "../lib/mem.h"
672
#endif
672
#endif
673
 
673
 
674
#ifndef INCLUDE_DEBUG_H
674
#ifndef INCLUDE_DEBUG_H
675
#include "../lib/debug.h"
675
#include "../lib/debug.h"
676
#endif
676
#endif
677
 
677
 
678
#ifndef INCLUDE_IPC_H
678
#ifndef INCLUDE_IPC_H
679
#include "../lib/ipc.h"
679
#include "../lib/ipc.h"
680
#endif
680
#endif
681
>
681
>
682
>
682
>
683
>
683
>
684
>
684
>
685
>
685
>
686
>
686
>
687
>
687
>
688
>
688
>
689
>
689
>
690
>
690
>
691
>
691
>
692
>
692
>
693
>
693
>
694
>
694
>
695
>
695
>
696
>
696
>
697
>
697
>
698
>
698
>
699
>
699
>
700
>
700
>
701
>
701
>
702
>
702
>
703
>
703
>
704
>
704
>
705
>
705
>
706
>
706
>
707
>
707
>
708
>
708
>
709
>
709
>
710
>
710
>
711
>
711
>
712
>
712
>
713
>
713
>
714
>
714
>
715
>
715
>
716
>
716
>