Subversion Repositories Kolibri OS

Rev

Rev 7661 | Rev 7773 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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