Subversion Repositories Kolibri OS

Rev

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

Rev 6285 Rev 6504
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
#print "[include ]\n"
5
#print "[include ]\n"
6
 
6
 
7
#pragma option OST
7
#pragma option OST
8
#pragma option ON
8
#pragma option ON
9
#pragma option cri-
9
#pragma option cri-
10
#pragma option -CPA
10
#pragma option -CPA
11
#initallvar 0
11
#initallvar 0
12
#jumptomain FALSE
12
#jumptomain FALSE
13
 
13
 
14
#startaddress 0
14
#startaddress 0
15
 
15
 
16
#code32 TRUE
16
#code32 TRUE
17
 
17
 
18
char   os_name[8]   = {'M','E','N','U','E','T','0','1'};
18
char   os_name[8]   = {'M','E','N','U','E','T','0','1'};
19
dword  os_version   = 0x00000001;
19
dword  os_version   = 0x00000001;
20
dword  start_addr   = #______INIT______;
20
dword  start_addr   = #______INIT______;
21
dword  final_addr   = #______STOP______+32;
21
dword  final_addr   = #______STOP______+32;
22
dword  alloc_mem    = MEMSIZE;
22
dword  alloc_mem    = MEMSIZE;
23
dword  x86esp_reg   = MEMSIZE;
23
dword  x86esp_reg   = MEMSIZE;
24
dword  I_Param      = #param;
24
dword  I_Param      = #param;
25
dword  I_Path       = #program_path;
25
dword  I_Path       = #program_path;
26
char param[4096];
26
char param[4096];
27
char program_path[4096];
27
char program_path[4096];
28
 
28
 
29
#define bool      char
29
#define bool      char
30
 
30
 
31
#define NULL      0
31
#define NULL      0
32
#define OLD      -1
32
#define OLD      -1
33
#define true      1
33
#define true      1
34
#define false     0
34
#define false     0
35
 
35
 
36
//Process Events
36
//Process Events
37
#define evReDraw  1
37
#define evReDraw  1
38
#define evKey     2
38
#define evKey     2
39
#define evButton  3
39
#define evButton  3
40
#define 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
//Button options
46
//Button options
47
#define BT_DEL      0x80000000
47
#define BT_DEL      0x80000000
48
#define BT_HIDE     0x40000000
48
#define BT_HIDE     0x40000000
49
#define BT_NOFRAME  0x20000000
49
#define BT_NOFRAME  0x20000000
50
 
50
 
51
//allow event mask
51
//allow event mask
52
#define EVENT_MASK_REDRAW   000000001b
52
#define EVENT_MASK_REDRAW   000000001b
53
#define EVENT_MASK_KEYBOARD 000000010b
53
#define EVENT_MASK_KEYBOARD 000000010b
54
#define EVENT_MASK_BUTTONS  000000100b
54
#define EVENT_MASK_BUTTONS  000000100b
55
#define EVENT_MASK_DESKTOP  000010000b
55
#define EVENT_MASK_DESKTOP  000010000b
56
#define EVENT_MASK_MOUSE    000100000b
56
#define EVENT_MASK_MOUSE    000100000b
57
#define EVENT_MASK_IPC      001000000b
57
#define EVENT_MASK_IPC      001000000b
58
#define EVENT_MASK_NETWORK  010000000b
58
#define EVENT_MASK_NETWORK  010000000b
59
#define EVENT_MASK_DEBUG    100000000b
59
#define EVENT_MASK_DEBUG    100000000b
60
 
60
 
61
//ARGS FUNCTION
61
//ARGS FUNCTION
62
#define END_ARGS 0xFF00FF
62
#define END_ARGS 0xFF00FF
63
//-------------------------------------------------------------------------
63
//-------------------------------------------------------------------------
64
 
64
 
65
#include "../lib/system.h"
65
#include "../lib/system.h"
66
#include "../lib/mouse.h"
66
#include "../lib/mouse.h"
67
#include "../lib/keyboard.h"
67
#include "../lib/keyboard.h"
68
 
68
 
69
:struct raw_image {
69
:struct raw_image {
70
	dword w, h, data;
70
	dword w, h, data;
71
};
71
};
72
 
72
 
73
//------------------------------------------------------------------------------
73
//------------------------------------------------------------------------------
74
:dword wait_event_code;
74
:dword wait_event_code;
75
inline fastcall dword WaitEvent()
75
inline fastcall dword WaitEvent()
76
{
76
{
77
	$mov eax,10
77
	$mov eax,10
78
	$int 0x40
78
	$int 0x40
79
	wait_event_code = EAX;
79
	wait_event_code = EAX;
80
	//if(wait_event_code==evMouse) MOUSE.get();
80
	//if(wait_event_code==evMouse) MOUSE.get();
81
	//return wait_event_code;
81
	//return wait_event_code;
82
}
82
}
83
 
83
 
84
inline fastcall dword CheckEvent()
84
inline fastcall dword CheckEvent()
85
{
85
{
86
	$mov eax,11
86
	$mov eax,11
87
	$int 0x40
87
	$int 0x40
88
}
88
}
89
 
89
 
90
inline fastcall dword WaitEventTimeout(EBX)
90
inline fastcall dword WaitEventTimeout(EBX)
91
{
91
{
92
	$mov eax,23
92
	$mov eax,23
93
	$int 0x40
93
	$int 0x40
94
} 
94
} 
95
 
95
 
96
inline fastcall SetEventMask(EBX)
96
inline fastcall SetEventMask(EBX)
97
{
97
{
98
	$mov eax,40
98
	$mov eax,40
99
	$int 0x40
99
	$int 0x40
100
}
100
}
101
 
101
 
102
 
102
 
103
inline fastcall pause(EBX)
103
inline fastcall pause(EBX)
104
{
104
{
105
	$mov eax, 5
105
	$mov eax, 5
106
	$int 0x40
106
	$int 0x40
107
}
107
}
108
 
108
 
109
inline fastcall word GetButtonID()
109
inline fastcall word GetButtonID()
110
{
110
{
111
	$mov eax,17
111
	$mov eax,17
112
	$int  0x40
112
	$int  0x40
113
	$shr eax,8
113
	$shr eax,8
114
}
114
}
115
 
115
 
116
inline fastcall dword GetFreeRAM()
116
inline fastcall dword GetFreeRAM()
117
{
117
{
118
	$mov eax, 18
118
	$mov eax, 18
119
	$mov ebx, 16
119
	$mov ebx, 16
120
	$int 0x40
120
	$int 0x40
121
	//return eax = ðàçìåð ñâîáîäíîé ïàìÿòè â êèëîáàéòàõ
121
	//return eax = ðàçìåð ñâîáîäíîé ïàìÿòè â êèëîáàéòàõ
122
}
122
}
123
 
123
 
124
inline fastcall dword LoadDriver(ECX) //ECX - èìÿ äðàéâåðà
124
inline fastcall dword LoadDriver(ECX) //ECX - èìÿ äðàéâåðà
125
{
125
{
126
	$mov eax, 68
126
	$mov eax, 68
127
	$mov ebx, 16
127
	$mov ebx, 16
128
	$int 0x40
128
	$int 0x40
129
	//return 0 - íåóäà÷à, èíà÷å eax = õýíäë äðàéâåðà 
129
	//return 0 - íåóäà÷à, èíà÷å eax = õýíäë äðàéâåðà 
130
}
130
}
131
 
131
 
132
inline fastcall dword RuleDriver(ECX) //óêàçàòåëü íà óïðàâëÿþùóþ ñòðóêòóðó
132
inline fastcall dword RuleDriver(ECX) //óêàçàòåëü íà óïðàâëÿþùóþ ñòðóêòóðó
133
{
133
{
134
	$mov eax, 68
134
	$mov eax, 68
135
	$mov ebx, 17
135
	$mov ebx, 17
136
	$int 0x40
136
	$int 0x40
137
	//return eax = îïðåäåëÿåòñÿ äðàéâåðîì
137
	//return eax = îïðåäåëÿåòñÿ äðàéâåðîì
138
}
138
}
139
 
139
 
140
struct proc_info
140
struct proc_info
141
{
141
{
142
	#define SelfInfo -1
142
	#define SelfInfo -1
143
	dword	use_cpu;
143
	dword	use_cpu;
144
	word	pos_in_stack,num_slot,rezerv1;
144
	word	pos_in_stack,num_slot,rezerv1;
145
	unsigned char name[11];
145
	unsigned char name[11];
146
	char	rezerv2;
146
	char	rezerv2;
147
	dword	adress,use_memory,ID,left,top,width,height;
147
	dword	adress,use_memory,ID,left,top,width,height;
148
	word	status_slot,rezerv3;
148
	word	status_slot,rezerv3;
149
	dword	work_left,work_top,work_width,work_height;
149
	dword	work_left,work_top,work_width,work_height;
150
	char	status_window;
150
	char	status_window;
151
	dword   cwidth,cheight;
151
	dword   cwidth,cheight;
152
	byte    reserved[1024-71-8];
152
	byte    reserved[1024-71-8];
153
};
153
};
154
 
154
 
155
inline fastcall void GetProcessInfo(EBX, ECX)
155
inline fastcall void GetProcessInfo(EBX, ECX)
156
{
156
{
157
	$mov eax,9;
157
	$mov eax,9;
158
	$int  0x40
158
	$int  0x40
159
	DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth
159
	DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth
160
	DSDWORD[EBX+75] = DSDWORD[EBX+46] - GetSkinHeight() - 4; //set cheight
160
	DSDWORD[EBX+75] = DSDWORD[EBX+46] - GetSkinHeight() - 4; //set cheight
161
}
161
}
162
 
162
 
163
inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y
163
inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y
164
{
164
{
165
	$mov eax,34
165
	$mov eax,34
166
	$int 0x40
166
	$int 0x40
167
}
167
}
168
 
168
 
169
inline fastcall int GetProcessSlot( ECX)
169
inline fastcall int GetProcessSlot( ECX)
170
{
170
{
171
	EAX = 18;
171
	EAX = 18;
172
	EBX = 21;
172
	EBX = 21;
173
	$int 0x40
173
	$int 0x40
174
}
174
}
175
 
175
 
176
inline fastcall int GetActiveProcess()
176
inline fastcall int GetActiveProcess()
177
{
177
{
178
	EAX = 18;
178
	EAX = 18;
179
	EBX = 7;
179
	EBX = 7;
180
	$int 0x40
180
	$int 0x40
181
}
181
}
182
 
182
 
183
:int CheckActiveProcess(int Form_ID)
183
:int CheckActiveProcess(int Form_ID)
184
{
184
{
185
	int id9=GetProcessSlot(Form_ID);
185
	int id9=GetProcessSlot(Form_ID);
186
	if (id9==GetActiveProcess()) return 1;
186
	if (id9==GetActiveProcess()) return 1;
187
	return 0;
187
	return 0;
188
}
188
}
189
 
189
 
190
inline fastcall void ActivateWindow( ECX)
190
inline fastcall void ActivateWindow( ECX)
191
{
191
{
192
	EAX = 18;
192
	EAX = 18;
193
	EBX = 3;
193
	EBX = 3;
194
	$int 0x40
194
	$int 0x40
195
}
195
}
196
 
196
 
197
inline fastcall int MinimizeWindow()
197
inline fastcall int MinimizeWindow()
198
{
198
{
199
	EAX = 18;
199
	EAX = 18;
200
	EBX = 10;
200
	EBX = 10;
201
	$int 0x40
201
	$int 0x40
202
}
202
}
203
 
203
 
204
inline fastcall int CreateThread(ECX,EDX)
204
inline fastcall int CreateThread(ECX,EDX)
205
{
205
{
206
	$mov eax,51
206
	$mov eax,51
207
	$mov ebx,1
207
	$mov ebx,1
208
	$int 0x40
208
	$int 0x40
209
}
209
}
210
 
210
 
211
inline fastcall void SwitchToAnotherThread()
211
inline fastcall void SwitchToAnotherThread()
212
{
212
{
213
	$mov eax,68
213
	$mov eax,68
214
	$mov ebx,1
214
	$mov ebx,1
215
	$int 0x40
215
	$int 0x40
216
}
216
}
217
 
217
 
218
inline fastcall int SendWindowMessage( ECX, EDX)
218
inline fastcall int SendWindowMessage( ECX, EDX)
219
{
219
{
220
	$mov eax, 72
220
	$mov eax, 72
221
	$mov ebx, 1
221
	$mov ebx, 1
222
	$int 0x40
222
	$int 0x40
223
}
223
}
224
 
224
 
225
inline fastcall int KillProcess( ECX)
225
inline fastcall int KillProcess( ECX)
226
{
226
{
227
	$mov eax,18;
227
	$mov eax,18;
228
	$mov ebx,18;
228
	$mov ebx,18;
229
	$int 0x40
229
	$int 0x40
230
}
230
}
231
 
231
 
232
#define TURN_OFF 2
232
#define TURN_OFF 2
233
#define REBOOT 3
233
#define REBOOT 3
234
#define KERNEL 4
234
#define KERNEL 4
235
inline fastcall int ExitSystem( ECX)
235
inline fastcall int ExitSystem( ECX)
236
{
236
{
237
	$mov eax, 18
237
	$mov eax, 18
238
	$mov ebx, 9
238
	$mov ebx, 9
239
	$int 0x40
239
	$int 0x40
240
}
240
}
241
 
241
 
242
inline fastcall ExitProcess()
242
inline fastcall ExitProcess()
243
{
243
{
244
	$mov eax,-1;
244
	$mov eax,-1;
245
	$int 0x40
245
	$int 0x40
246
}
246
}
247
 
247
 
248
//------------------------------------------------------------------------------
248
//------------------------------------------------------------------------------
-
 
249
 
-
 
250
inline fastcall void SetCurDir( ECX)
-
 
251
{
-
 
252
  EAX=30;
-
 
253
  EBX=1;
-
 
254
  $int 0x40
-
 
255
}
-
 
256
 
249
 
257
 
250
//eax = ÿçûê ñèñòåìû (1=eng, 2=fi, 3=ger, 4=rus)
258
//eax = ÿçûê ñèñòåìû (1=eng, 2=fi, 3=ger, 4=rus)
251
inline fastcall int GetSystemLanguage()
259
inline fastcall int GetSystemLanguage()
252
{
260
{
253
	EAX = 26;
261
	EAX = 26;
254
	EBX = 5;
262
	EBX = 5;
255
	$int 0x40
263
	$int 0x40
256
}
264
}
257
 
265
 
258
inline fastcall GetSkinHeight()
266
inline fastcall GetSkinHeight()
259
{
267
{
260
	$push ebx
268
	$push ebx
261
	$mov  eax,48
269
	$mov  eax,48
262
	$mov  ebx,4
270
	$mov  ebx,4
263
	$int 0x40
271
	$int 0x40
264
	$pop  ebx
272
	$pop  ebx
265
}
273
}
266
 
274
 
267
inline fastcall void SetSystemSkin( ECX)
275
inline fastcall void SetSystemSkin( ECX)
268
{
276
{
269
	EAX = 48;
277
	EAX = 48;
270
	EBX = 8;
278
	EBX = 8;
271
	$int 0x40
279
	$int 0x40
272
}
280
}
273
 
281
 
274
inline fastcall int GetScreenWidth()
282
inline fastcall int GetScreenWidth()
275
{
283
{
276
	$mov eax, 14
284
	$mov eax, 14
277
	$int 0x40
285
	$int 0x40
278
	$shr eax, 16
286
	$shr eax, 16
279
}
287
}
280
 
288
 
281
inline fastcall int GetScreenHeight()
289
inline fastcall int GetScreenHeight()
282
{
290
{
283
	$mov eax, 14
291
	$mov eax, 14
284
	$int 0x40
292
	$int 0x40
285
	$and eax,0x0000FFFF
293
	$and eax,0x0000FFFF
286
}
294
}
287
 
295
 
288
inline fastcall int GetClientTop()
296
inline fastcall int GetClientTop()
289
{
297
{
290
	$mov eax, 48
298
	$mov eax, 48
291
	$mov ebx, 5
299
	$mov ebx, 5
292
	$int 0x40
300
	$int 0x40
293
	$mov eax, ebx
301
	$mov eax, ebx
294
	$shr eax, 16
302
	$shr eax, 16
295
}
303
}
296
 
304
 
297
inline fastcall int GetClientHeight()
305
inline fastcall int GetClientHeight()
298
{
306
{
299
	$mov eax, 48
307
	$mov eax, 48
300
	$mov ebx, 5
308
	$mov ebx, 5
301
	$int 0x40
309
	$int 0x40
302
	$mov eax, ebx
310
	$mov eax, ebx
303
}
311
}
304
 
312
 
305
inline fastcall dword LoadLibrary( ECX)
313
inline fastcall dword LoadLibrary( ECX)
306
{
314
{
307
	$mov eax, 68 
315
	$mov eax, 68 
308
	$mov ebx, 19
316
	$mov ebx, 19
309
	$int  0x40
317
	$int  0x40
310
}
318
}
311
 
319
 
312
inline fastcall int TestBit( EAX, CL)
320
inline fastcall int TestBit( EAX, CL)
313
{
321
{
314
	$shr eax,cl
322
	$shr eax,cl
315
	$and eax,1
323
	$and eax,1
316
}
324
}
317
 
325
 
318
//------------------------------------------------------------------------------
326
//------------------------------------------------------------------------------
319
 
327
 
320
void DefineAndDrawWindow(dword x, y, size_w, size_h, byte WindowType,dword WindowAreaColor, EDI, ESI)
328
void DefineAndDrawWindow(dword x, y, size_w, size_h, byte WindowType,dword WindowAreaColor, EDI, ESI)
321
{
329
{
322
	EAX = 12;              // function 12:tell os about windowdraw
330
	EAX = 12;              // function 12:tell os about windowdraw
323
	EBX = 1;
331
	EBX = 1;
324
	$int 0x40
332
	$int 0x40
325
	
333
	
326
	$xor EAX,EAX
334
	$xor EAX,EAX
327
	EBX = x << 16 + size_w; 
335
	EBX = x << 16 + size_w; 
328
	ECX = y << 16 + size_h;
336
	ECX = y << 16 + size_h;
329
 
337
 
330
	EDX = WindowType << 24 | WindowAreaColor;
338
	EDX = WindowType << 24 | WindowAreaColor;
331
	$int 0x40
339
	$int 0x40
332
 
340
 
333
	EAX = 12;              // function 12:tell os about windowdraw
341
	EAX = 12;              // function 12:tell os about windowdraw
334
	EBX = 2;
342
	EBX = 2;
335
	$int 0x40
343
	$int 0x40
336
}
344
}
337
 
345
 
338
inline fastcall MoveSize( EBX,ECX,EDX,ESI)
346
inline fastcall MoveSize( EBX,ECX,EDX,ESI)
339
{
347
{
340
	$mov eax, 67
348
	$mov eax, 67
341
	$int 0x40
349
	$int 0x40
342
}
350
}
343
 
351
 
344
inline fastcall void DrawTitle( ECX)
352
inline fastcall void DrawTitle( ECX)
345
{
353
{
346
	EAX = 71;
354
	EAX = 71;
347
	EBX = 1;
355
	EBX = 1;
348
	$int 0x40;
356
	$int 0x40;
349
}
357
}
350
 
358
 
351
void WriteTextB(dword x,y,byte fontType, dword color, EDX)
359
void WriteTextB(dword x,y,byte fontType, dword color, EDX)
352
{
360
{
353
	EAX = 4;
361
	EAX = 4;
354
	EBX = x<<16+y;
362
	EBX = x<<16+y;
355
	ECX = fontType<<24+color;
363
	ECX = fontType<<24+color;
356
	ESI = 0;
364
	ESI = 0;
357
	$int 0x40;
365
	$int 0x40;
358
	$add ebx, 1<<16
366
	$add ebx, 1<<16
359
	$int 0x40
367
	$int 0x40
360
}
368
}
361
 
369
 
362
void WriteText(dword x,y,byte fontType, dword color, EDX)
370
void WriteText(dword x,y,byte fontType, dword color, EDX)
363
{
371
{
364
	EAX = 4;
372
	EAX = 4;
365
	EBX = x<<16+y;
373
	EBX = x<<16+y;
366
	ECX = fontType<<24+color;
374
	ECX = fontType<<24+color;
367
	$int 0x40;
375
	$int 0x40;
368
}
376
}
369
 
377
 
370
dword WriteBufText(dword x,y,byte fontType, dword color, EDX, EDI)
378
dword WriteBufText(dword x,y,byte fontType, dword color, EDX, EDI)
371
{
379
{
372
	EAX = 4;
380
	EAX = 4;
373
	EBX = x<<16+y;
381
	EBX = x<<16+y;
374
	ECX = fontType<<24+color;
382
	ECX = fontType<<24+color;
375
	$int 0x40;
383
	$int 0x40;
376
}
384
}
377
 
385
 
378
void WriteNumber(dword x,y,byte fontType, dword color, count, ECX)
386
void WriteNumber(dword x,y,byte fontType, dword color, count, ECX)
379
{
387
{
380
	EAX = 47;
388
	EAX = 47;
381
	EBX = count<<16;
389
	EBX = count<<16;
382
	EDX = x<<16+y;
390
	EDX = x<<16+y;
383
	ESI = fontType<<24+color;
391
	ESI = fontType<<24+color;
384
	$int 0x40;
392
	$int 0x40;
385
}
393
}
386
 
394
 
387
void CopyScreen(dword EBX, x, y, w, h)
395
void CopyScreen(dword EBX, x, y, w, h)
388
{
396
{
389
  EAX = 36;
397
  EAX = 36;
390
  ECX = w << 16 + h;
398
  ECX = w << 16 + h;
391
  EDX = x << 16 + y;
399
  EDX = x << 16 + y;
392
  $int  0x40;
400
  $int  0x40;
393
}
401
}
394
 
402
 
395
:dword GetPixelColor(dword x, x_size, y)
403
:dword GetPixelColor(dword x, x_size, y)
396
{
404
{
397
	$mov eax, 35
405
	$mov eax, 35
398
	EBX= y*x_size+x;
406
	EBX= y*x_size+x;
399
	$int 0x40
407
	$int 0x40
400
}
408
}
401
 
409
 
402
 
410
 
403
void _PutImage(dword x,y, w,h, EBX)
411
void _PutImage(dword x,y, w,h, EBX)
404
{
412
{
405
	EAX = 7;
413
	EAX = 7;
406
	ECX = w<<16+h;
414
	ECX = w<<16+h;
407
	EDX = x<<16+y;
415
	EDX = x<<16+y;
408
	$int 0x40
416
	$int 0x40
409
}
417
}
410
 
418
 
411
void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI)
419
void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI)
412
{
420
{
413
	EAX = 65;
421
	EAX = 65;
414
	ECX = w<<16+h;
422
	ECX = w<<16+h;
415
	EDX = x<<16+y;
423
	EDX = x<<16+y;
416
	EBP = 0;
424
	EBP = 0;
417
	$int 0x40
425
	$int 0x40
418
} 
426
} 
419
 
427
 
420
inline fastcall void PutPixel( EBX,ECX,EDX)
428
inline fastcall void PutPixel( EBX,ECX,EDX)
421
{
429
{
422
  EAX=1;
430
  EAX=1;
423
  $int 0x40
431
  $int 0x40
424
}
432
}
425
 
433
 
426
void DrawBar(dword x,y,w,h,EDX)
434
void DrawBar(dword x,y,w,h,EDX)
427
{
435
{
428
	if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :)
436
	if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :)
429
	EAX = 13;
437
	EAX = 13;
430
	EBX = x<<16+w;
438
	EBX = x<<16+w;
431
	ECX = y<<16+h;
439
	ECX = y<<16+h;
432
	$int 0x40
440
	$int 0x40
433
}
441
}
434
 
442
 
435
void DefineButton(dword x,y,w,h,EDX,ESI)
443
void DefineButton(dword x,y,w,h,EDX,ESI)
436
{
444
{
437
	EAX = 8;
445
	EAX = 8;
438
	$push edx
446
	$push edx
439
	EDX += BT_DEL;
447
	EDX += BT_DEL;
440
	$int 0x40;
448
	$int 0x40;
441
	$pop edx
449
	$pop edx
442
	EBX = x<<16+w;
450
	EBX = x<<16+w;
443
	ECX = y<<16+h;
451
	ECX = y<<16+h;
444
	$int 0x40
452
	$int 0x40
445
}
453
}
446
 
454
 
447
inline RefreshWindow(dword ID_REFRESH,ID_ACTIVE)
455
inline RefreshWindow(dword ID_REFRESH,ID_ACTIVE)
448
{
456
{
449
	EAX = 18;
457
	EAX = 18;
450
	EBX = 22;
458
	EBX = 22;
451
	ECX = 3;
459
	ECX = 3;
452
	EDX = ID_REFRESH;
460
	EDX = ID_REFRESH;
453
	$int 0x40
461
	$int 0x40
454
	EAX = 18;
462
	EAX = 18;
455
	EBX = 3;
463
	EBX = 3;
456
	EDX = ID_ACTIVE;
464
	EDX = ID_ACTIVE;
457
	$int 0x40
465
	$int 0x40
458
}
466
}
459
 
467
 
460
void UnsafeDefineButton(dword x,y,w,h,EDX,ESI)
468
void UnsafeDefineButton(dword x,y,w,h,EDX,ESI)
461
{
469
{
462
	EAX = 8;
470
	EAX = 8;
463
	EBX = x<<16+w;
471
	EBX = x<<16+w;
464
	ECX = y<<16+h;
472
	ECX = y<<16+h;
465
	$int 0x40
473
	$int 0x40
466
}
474
}
467
 
475
 
468
inline fastcall void DeleteButton( EDX)
476
inline fastcall void DeleteButton( EDX)
469
{
477
{
470
	EAX = 8;
478
	EAX = 8;
471
	EDX += BT_DEL;
479
	EDX += BT_DEL;
472
	$int 0x40
480
	$int 0x40
473
}
481
}
474
 
482
 
475
inline fastcall dword GetStartTime()
483
inline fastcall dword GetStartTime()
476
{
484
{
477
	$mov eax,26
485
	$mov eax,26
478
	$mov ebx,9
486
	$mov ebx,9
479
	$int 0x40
487
	$int 0x40
480
}
488
}
481
 
489
 
482
:dword X_EventRedrawWindow,Y_EventRedrawWindow;
490
:dword X_EventRedrawWindow,Y_EventRedrawWindow;
483
:void _EventRedrawWindow()
491
:void _EventRedrawWindow()
484
{
492
{
485
	loop()switch(WaitEvent())
493
	loop()switch(WaitEvent())
486
	{
494
	{
487
		case evReDraw:
495
		case evReDraw:
488
			DefineAndDrawWindow(X_EventRedrawWindow,Y_EventRedrawWindow,100,1,1,0x34,0xFFFFFF,"");
496
			DefineAndDrawWindow(X_EventRedrawWindow,Y_EventRedrawWindow,100,1,1,0x34,0xFFFFFF,"");
489
			pause(10);
497
			pause(10);
490
			ExitProcess();
498
			ExitProcess();
491
			break;
499
			break;
492
	}
500
	}
493
}
501
}
494
:char REDRAW_BUFF_EVENT_[4096];
502
:char REDRAW_BUFF_EVENT_[4096];
495
:void EventRedrawWindow(dword x,y)
503
:void EventRedrawWindow(dword x,y)
496
{
504
{
497
	X_EventRedrawWindow = x;
505
	X_EventRedrawWindow = x;
498
	Y_EventRedrawWindow = y;
506
	Y_EventRedrawWindow = y;
499
	CreateThread(#_EventRedrawWindow,#REDRAW_BUFF_EVENT_+4092);
507
	CreateThread(#_EventRedrawWindow,#REDRAW_BUFF_EVENT_+4092);
500
}
508
}
501
 
509
 
502
:struct obj
510
:struct obj
503
{
511
{
504
	dword x,y,w,h;
512
	dword x,y,w,h;
505
	void size();
513
	void size();
506
};
514
};
507
 
515
 
508
:void obj::size(dword _x, _y, _w, _h)
516
:void obj::size(dword _x, _y, _w, _h)
509
{
517
{
510
	x=_x; 
518
	x=_x; 
511
	y=_y;
519
	y=_y;
512
	w=_w;
520
	w=_w;
513
	h=_h;
521
	h=_h;
514
}
522
}
515
 
523
 
516
:struct _screen
524
:struct _screen
517
{
525
{
518
	dword width,height;
526
	dword width,height;
519
} screen;
527
} screen;
520
 
528
 
521
:byte skin_height;
529
:byte skin_height;
522
 
530
 
523
:void DrawDate(dword x, y, color, in_date)
531
:void DrawDate(dword x, y, color, in_date)
524
{
532
{
525
	EDI = in_date;
533
	EDI = in_date;
526
	EAX = 47;
534
	EAX = 47;
527
	EBX = 2<<16;
535
	EBX = 2<<16;
528
	EDX = x<<16+y;
536
	EDX = x<<16+y;
529
	ESI = 0x90<<24+color;
537
	ESI = 0x90<<24+color;
530
	ECX = EDI.date.day;
538
	ECX = EDI.date.day;
531
	$int 0x40;
539
	$int 0x40;
532
	EDX += 20<<16;
540
	EDX += 20<<16;
533
	ECX = EDI.date.month;
541
	ECX = EDI.date.month;
534
	$int 0x40;
542
	$int 0x40;
535
	EDX += 20<<16;
543
	EDX += 20<<16;
536
	EBX = 4<<16;
544
	EBX = 4<<16;
537
	ECX = EDI.date.year;
545
	ECX = EDI.date.year;
538
	$int 0x40;
546
	$int 0x40;
539
	DrawBar(x+17,y+10,2,2,color);
547
	DrawBar(x+17,y+10,2,2,color);
540
	DrawBar(x+37,y+10,2,2,color);
548
	DrawBar(x+37,y+10,2,2,color);
541
}
549
}
542
 
550
 
543
:void __path_name__(dword BUF,PATH)
551
:void __path_name__(dword BUF,PATH)
544
{
552
{
545
	dword beg = PATH;
553
	dword beg = PATH;
546
	dword pos = PATH;
554
	dword pos = PATH;
547
	dword sav = PATH;
555
	dword sav = PATH;
548
	dword i;
556
	dword i;
549
	while(DSBYTE[pos])
557
	while(DSBYTE[pos])
550
	{
558
	{
551
		if(DSBYTE[pos]=='/')sav = pos;
559
		if(DSBYTE[pos]=='/')sav = pos;
552
		pos++;
560
		pos++;
553
	}
561
	}
554
	i = sav-beg;
562
	i = sav-beg;
555
	while(i)
563
	while(i)
556
	{
564
	{
557
		DSBYTE[BUF] = DSBYTE[beg];
565
		DSBYTE[BUF] = DSBYTE[beg];
558
		beg++;
566
		beg++;
559
		BUF++;
567
		BUF++;
560
		i--;
568
		i--;
561
	}
569
	}
562
	/*while(DSBYTE[beg])
570
	/*while(DSBYTE[beg])
563
	{
571
	{
564
		DSBYTE[BUF1] = DSBYTE[beg];
572
		DSBYTE[BUF1] = DSBYTE[beg];
565
		beg++;
573
		beg++;
566
		BUF1++;
574
		BUF1++;
567
	}*/
575
	}*/
568
	//DSBYTE[BUF1] = 0;
576
	//DSBYTE[BUF1] = 0;
569
	DSBYTE[BUF] = 0;
577
	DSBYTE[BUF] = 0;
570
}
578
}
571
char __BUF_DIR__[4096];
579
char __BUF_DIR__[4096];
572
:struct SELF
580
:struct SELF
573
{
581
{
574
	dword dir;
582
	dword dir;
575
	dword file;
583
	dword file;
576
	dword path;
584
	dword path;
577
} self;
585
} self;
578
 
586
 
579
dword __generator;  // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë
587
dword __generator;  // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë
580
 
588
 
581
:dword program_path_length;
589
:dword program_path_length;
582
 
590
 
583
//The initialization of the initial data before running
591
//The initialization of the initial data before running
584
void ______INIT______()
592
void ______INIT______()
585
{
593
{
586
	self.dir = #__BUF_DIR__;
594
	self.dir = #__BUF_DIR__;
587
	self.file = 0;
595
	self.file = 0;
588
	self.path = I_Path;
596
	self.path = I_Path;
589
	__path_name__(#__BUF_DIR__,I_Path);
597
	__path_name__(#__BUF_DIR__,I_Path);
590
	
598
	
591
	skin_height   = GetSkinHeight();
599
	skin_height   = GetSkinHeight();
592
	screen.width  = GetScreenWidth();
600
	screen.width  = GetScreenWidth();
593
	screen.height = GetScreenHeight();
601
	screen.height = GetScreenHeight();
594
	
602
	
595
	//program_path_length = strlen(I_Path);
603
	//program_path_length = strlen(I_Path);
596
	DOUBLE_CLICK_DELAY = GetMouseDoubleClickDelay();
604
	DOUBLE_CLICK_DELAY = GetMouseDoubleClickDelay();
597
	__generator = GetStartTime();
605
	__generator = GetStartTime();
598
	
606
	
599
	mem_init();
607
	mem_init();
600
 
608
 
601
	main();
609
	main();
602
	ExitProcess();
610
	ExitProcess();
603
}
611
}
604
______STOP______:
612
______STOP______:
605
#endif
613
#endif
606
 
614
 
607
#ifndef INCLUDE_MEM_H
615
#ifndef INCLUDE_MEM_H
608
#include "../lib/mem.h"
616
#include "../lib/mem.h"
609
#endif
617
#endif
610
 
618
 
611
#ifndef INCLUDE_DEBUG_H
619
#ifndef INCLUDE_DEBUG_H
612
#include "../lib/debug.h"
620
#include "../lib/debug.h"
613
#endif
621
#endif
614
>
622
>
615
>
623
>
616
>
624
>
617
>
625
>
618
>
626
>
619
>
627
>
620
>
628
>
621
>
629
>
622
>
630
>
623
>
631
>
624
>
632
>
625
>
633
>
626
>
634
>
627
>
635
>
628
>
636
>
629
>
637
>
630
>
638
>
631
>
639
>
632
>
640
>
633
>
641
>
634
>
642
>
635
>
643
>
636
>
644
>
637
>
645
>
638
>
646
>
639
>
647
>
640
>
648
>
641
>
649
>
642
>
650
>
643
>
651
>
644
>
652
>
645
>
653
>
646
>
654
>
647
>
655
>
648
>
656
>
649
>
657
>
650
>
658
>
651
>
659
>
652
>
660
>
653
>
661
>
654
>
662
>
655
>
663
>
656
>
664
>
657
>
665
>
658
>
666
>
659
>
667
>
660
>
668
>
661
>
669
>
662
>
670
>
663
>
671
>
664
>
672
>
665
>
673
>