Subversion Repositories Kolibri OS

Rev

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