Subversion Repositories Kolibri OS

Rev

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