Subversion Repositories Kolibri OS

Rev

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

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