Subversion Repositories Kolibri OS

Rev

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

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