Subversion Repositories Kolibri OS

Rev

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

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