Subversion Repositories Kolibri OS

Rev

Rev 7373 | Rev 7590 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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