Subversion Repositories Kolibri OS

Rev

Rev 9700 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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