Subversion Repositories Kolibri OS

Rev

Rev 5582 | Rev 5591 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. //CODED by Veliant, Leency, Nable. GNU GPL licence.
  2.  
  3. #define INCLUDE_KOLIBRI_H
  4.  
  5. #startaddress 0
  6. #code32 TRUE
  7.  
  8. char   os_name[8]   = {'M','E','N','U','E','T','0','1'};
  9. dword  os_version   = 0x00000001;
  10. dword  start_addr   = #load_init_main;
  11. dword  final_addr   = #stop+32;
  12. dword  alloc_mem    = MEMSIZE;
  13. dword  x86esp_reg   = MEMSIZE;
  14. dword  I_Param      = #param;
  15. dword  I_Path       = #program_path;
  16. char param[4096];
  17. char program_path[4096];
  18.  
  19. #define NULL      0
  20. #define OLD      -1
  21. #define true      1
  22. #define false     0
  23.  
  24. //Events
  25. #define evReDraw  1
  26. #define evKey     2
  27. #define evButton  3
  28. #define evDesktop 5
  29. #define evMouse   6
  30. #define evIPC     7
  31. #define evNetwork 8
  32. #define evDebug   9
  33.  
  34. //Button options
  35. #define BT_DEL      0x80000000
  36. #define BT_HIDE     0x40000000
  37. #define BT_NOFRAME  0x20000000
  38.  
  39. //Button mouse
  40. #define MOUSE_LEFT   001b
  41. #define MOUSE_RIGHT  010b
  42. #define MOUSE_LR     011b
  43. #define MOUSE_CENTER 100b
  44.  
  45. //ASCII KEYS
  46. #define ASCII_KEY_BS    008
  47. #define ASCII_KEY_TAB   009
  48. #define ASCII_KEY_ENTER 013
  49. #define ASCII_KEY_ESC   027
  50. #define ASCII_KEY_DEL   182
  51. #define ASCII_KEY_INS   185
  52. #define ASCII_KEY_SPACE 032
  53.  
  54. #define ASCII_KEY_LEFT  176
  55. #define ASCII_KEY_RIGHT 179
  56. #define ASCII_KEY_DOWN  177
  57. #define ASCII_KEY_UP    178
  58. #define ASCII_KEY_HOME  180
  59. #define ASCII_KEY_END   181
  60. #define ASCII_KEY_PGDN  183
  61. #define ASCII_KEY_PGUP  184
  62.  
  63. //allow event mask
  64. #define EVENT_MASK_REDRAW   000000001b
  65. #define EVENT_MASK_KEYBOARD 000000010b
  66. #define EVENT_MASK_BUTTONS  000000100b
  67. #define EVENT_MASK_DESKTOP  000010000b
  68. #define EVENT_MASK_MOUSE    000100000b
  69. #define EVENT_MASK_IPC      001000000b
  70. #define EVENT_MASK_NETWORK  010000000b
  71. #define EVENT_MASK_DEBUG    100000000b
  72.  
  73. //ARGS FUNCTION
  74. #define END_ARGS 0xFF00FF
  75. //-------------------------------------------------------------------------
  76.  
  77. :struct raw_image {
  78.         dword w, h, data;
  79. };
  80.  
  81. /**
  82.  *  The structure of the mouse
  83.  *  x - coordinate X
  84.  *  y - coordinate Y
  85.  *  xx and yy - time coordinates
  86.  *  lkm - left mouse button
  87.  *  pkm - right mouse button
  88.  *  mkm - mouse wheel
  89.  *  key - keycode button
  90.  *  tmp - time keycode
  91.  *  down - key event press
  92.  *  up - key release events
  93.  *  move - event mouse movements
  94.  *  click - when clicked
  95.  *  dblclick - double-click the default 50 (500 ms)
  96.  */
  97.  
  98. :dword __TMP_TIME,MOUSE_TIME;
  99. :struct mouse
  100. {
  101.         signed x,y,xx,yy,lkm,mkm,pkm,key,tmp,tmp_time,hor,vert,down,up,move,click,dblclick,left,top;
  102.         dword handle,_;
  103.         byte cmd;
  104.         void clearTime();
  105.         void get();
  106.         void set();
  107.         void center();
  108.         dword hide();
  109.         void slider();
  110.         void show();
  111. };
  112. :void mouse::clearTime()
  113. {
  114.         tmp_time = GetStartTime()+MOUSE_TIME;
  115. }
  116. :void mouse::show()
  117. {
  118.         if(!handle)return;
  119.         ECX = handle;
  120.         EAX = 37;
  121.         EBX = 5;
  122.         $int 0x40;
  123. }
  124. :dword mouse::hide()
  125. {
  126.         if(!_)
  127.         {
  128.                 EAX = 68;
  129.                 EBX = 12;
  130.                 ECX = 32*32*4;
  131.                 $int 0x40
  132.                 ECX = EAX;
  133.                 _ = EAX;
  134.         } else ECX = _;
  135.         EAX = 37;
  136.         EBX = 4;
  137.         DX  = 2;
  138.         $int 0x40;
  139.         handle = EAX;
  140.         ECX = EAX;
  141.         EAX = 37;
  142.         EBX = 5;
  143.         $int 0x40;
  144.         handle = EAX;
  145. }
  146.  
  147. //set new attributes mouse
  148. :void mouse::set()
  149. {
  150.         if((xx!=x)||(yy!=y))
  151.         {
  152.                 EAX = 18;
  153.                 EBX = 19;
  154.                 ECX = 4;
  155.                 EDX = (x<<16)+y;
  156.                 $int 0x40
  157.                 //move = true;
  158.         }
  159.         if((key)||(lkm|mkm|pkm))&&(down|up|click|dblclick|move)
  160.         {
  161.                 if(lkm|mkm|pkm)key=(lkm)|(pkm<<1)|(2<<mkm);
  162.                 EAX = 18;
  163.                 EBX = 19;
  164.                 ECX = key;
  165.                 EDX = (x<<16)+y;
  166.                 $int 0x40
  167.         }
  168. }
  169.  
  170. :void mouse::center()
  171. {
  172.         EAX = 18;
  173.         EBX = 15;
  174.         $int 0x40
  175. }
  176.  
  177. //get new attributes mouse
  178. :void mouse::get()
  179. {
  180.         EAX = 37;
  181.         EBX = 1;
  182.         $int    0x40
  183.         $mov    ebx, eax
  184.         $shr    eax, 16
  185.         $and    ebx,0x0000FFFF
  186.         x = EAX;
  187.         y = EBX;
  188.         if (x>6000) x-=65535;
  189.         if (y>6000) y-=65535;
  190.         EAX = 37;
  191.         EBX = 2;
  192.         $int    0x40
  193.         $mov    ebx, eax
  194.         $mov    ecx, eax
  195.         key = EAX;
  196.         $and    eax, 0x00000001
  197.         $shr    ebx, 1
  198.         $and    ebx, 0x00000001
  199.         $shr    ecx, 2
  200.         $and    ecx, 0x00000001
  201.         lkm = EAX;
  202.         pkm = EBX;
  203.         mkm = ECX;
  204.        
  205.         //when you release the mouse button
  206.         // Mouse Up Event
  207.         if((cmd)&&!(key)){
  208.                 up = true;
  209.                 down = false;
  210.                 if(!move) click = true;
  211.                 move = false;
  212.                 __TMP_TIME = GetStartTime();
  213.                 if(__TMP_TIME-tmp_time<=MOUSE_TIME){ dblclick = true;click = false; }
  214.                 tmp_time = __TMP_TIME;
  215.                 //returns the key code
  216.                 key = tmp;
  217.                 lkm = 1&tmp;
  218.                 pkm = 2&tmp;
  219.                 pkm >>= 1;
  220.                 mkm = 4&tmp;
  221.                 mkm >>= 2;
  222.                 cmd = false;
  223.         }
  224.        
  225.         //when you press the mouse button
  226.         // Mouse Down Event/Move Event
  227.         else {
  228.             up       = false;
  229.                 click    = false;
  230.                 dblclick = false;
  231.                 down     = false;
  232.                 // Mouse Move Event
  233.                 if((xx!=x)||(yy!=y))
  234.                 {
  235.                         move = true;
  236.                         xx = x;
  237.                         yy = y;
  238.                 }
  239.                 else move = false;
  240.                 if(key)if(!cmd) {down = true;cmd = true;tmp=key;}
  241.         }
  242.        
  243.         //scroll
  244.         EAX = 37;
  245.         EBX = 7;
  246.         $int    0x40
  247.         $mov    ebx, eax
  248.         $shr    eax, 16
  249.         $and    ebx,0x0000FFFF
  250.         //hor = EAX;
  251.         vert = EBX;
  252. }
  253.  
  254. :void mouse::slider()
  255. {
  256.         signed _x,_y;
  257.         if(!handle)hide();
  258.         get();
  259.         _x = x;_y = y;
  260.         pause(5);
  261.         get();
  262.         left = _x - x;
  263.         top  = _y - y;
  264.         center();
  265.         get();
  266.         _x = x;_y = y;
  267.         pause(5);
  268. }
  269.  
  270. :struct keyboard
  271. {
  272.         signed key;
  273.         byte down,up,press;
  274.         void get(void);
  275. };
  276.  
  277. :void keyboard::get(void)
  278. {
  279.        
  280. }
  281.  
  282. :struct system_colors
  283. {
  284.         dword frame,grab,grab_button,grab_button_text,grab_text,
  285.               work,work_button,work_button_text,work_text,work_graph;
  286.         void get();
  287. };
  288.  
  289. :void system_colors::get()
  290. {
  291.         EAX = 48;
  292.         EBX = 3;
  293.         ECX = #frame;
  294.         EDX = 40;
  295.         $int 0x40
  296. }
  297.  
  298. //------------------------------------------------------------------------------
  299. :dword wait_event_code;
  300. inline fastcall dword WaitEvent()
  301. {
  302.         $mov eax,10
  303.         $int 0x40
  304.         wait_event_code = EAX;
  305. }
  306.  
  307. inline fastcall dword CheckEvent()
  308. {
  309.         $mov eax,11
  310.         $int 0x40
  311. }
  312.  
  313. inline fastcall dword WaitEventTimeout(EBX)
  314. {
  315.         $mov eax,23
  316.         $int 0x40
  317. }
  318.  
  319. inline fastcall SetEventMask(EBX)
  320. {
  321.         $mov eax,40
  322.         $int 0x40
  323. }
  324.  
  325. inline fastcall ScancodesGeting(){
  326.         $mov eax,66
  327.         $mov ebx,1
  328.         $mov ecx,1 //᪠­ª®¤ë
  329.         $int 0x40
  330. }
  331.  
  332. inline fastcall word GetKey()  //+Gluk fix
  333. {
  334.                 $push edx
  335. GETKEY:
  336.                 $mov  eax,2
  337.                 $int  0x40
  338.                 $cmp eax,1
  339.                 $jne GETKEYI
  340.                 $mov ah,dh
  341.                 $jmp GETKEYII //jz?
  342. GETKEYI:
  343.                 $mov dh,ah
  344.                 $jmp GETKEY
  345. GETKEYII:
  346.                 $pop edx
  347.                 $shr eax,8
  348. }
  349.  
  350. inline fastcall int GetFullKey()
  351. {
  352.         $mov  eax,2
  353.         $int  0x40
  354. }
  355.  
  356.  
  357. inline fastcall pause(EBX)
  358. {
  359.         $mov eax, 5
  360.         $int 0x40
  361. }
  362.  
  363. inline fastcall word GetButtonID()
  364. {
  365.         $mov eax,17
  366.         $int  0x40
  367.         $shr eax,8
  368. }
  369.  
  370. inline fastcall dword GetFreeRAM()
  371. {
  372.         $mov eax, 18
  373.         $mov ebx, 16
  374.         $int 0x40
  375.         //return eax = ðàçìåð ñâîáîäíîé ïàìÿòè â êèëîáàéòàõ
  376. }
  377.  
  378. inline void draw_line(dword x1,y1,x2,y2,color)
  379. {
  380.         x2--;y2--;y1--;
  381.         $mov EAX,38
  382.         EBX = x1<<16;
  383.         EBX |= x2;
  384.         ECX = y1<<16;
  385.         ECX |= y2;
  386.         $mov EDX,color
  387.         $int 0x40
  388. }
  389.  
  390. inline fastcall dword LoadDriver(ECX) //ECX - èìÿ äðàéâåðà
  391. {
  392.         $mov eax, 68
  393.         $mov ebx, 16
  394.         $int 0x40
  395.         //return 0 - íåóäà÷à, èíà÷å eax = õýíäë äðàéâåðà
  396. }
  397.  
  398. inline fastcall dword RuleDriver(ECX) //óêàçàòåëü íà óïðàâëÿþùóþ ñòðóêòóðó
  399. {
  400.         $mov eax, 68
  401.         $mov ebx, 17
  402.         $int 0x40
  403.         //return eax = îïðåäåëÿåòñÿ äðàéâåðîì
  404. }
  405.  
  406. struct proc_info
  407. {
  408.         #define SelfInfo -1
  409.         dword   use_cpu;
  410.         word    pos_in_stack,num_slot,rezerv1;
  411.         unsigned char name[11];
  412.         char    rezerv2;
  413.         dword   adress,use_memory,ID,left,top,width,height;
  414.         word    status_slot,rezerv3;
  415.         dword   work_left,work_top,work_width,work_height;
  416.         char    status_window;
  417.         dword   cwidth,cheight;
  418.         byte    reserved[1024-71-8];
  419. };
  420.  
  421. inline fastcall void GetProcessInfo(EBX, ECX)
  422. {
  423.         $mov eax,9;
  424.         $int  0x40
  425.         DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth
  426.         DSDWORD[EBX+75] = DSDWORD[EBX+46] - GetSkinHeight() - 4; //set cheight
  427. }
  428.  
  429. inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y
  430. {
  431.         $mov eax,34
  432.         $int 0x40
  433. }
  434.  
  435. inline fastcall int GetProcessSlot( ECX)
  436. {
  437.         EAX = 18;
  438.         EBX = 21;
  439.         $int 0x40
  440. }
  441.  
  442. inline fastcall int GetActiveProcess()
  443. {
  444.         EAX = 18;
  445.         EBX = 7;
  446.         $int 0x40
  447. }
  448.  
  449. :int CheckActiveProcess(int Form_ID)
  450. {
  451.         int id9=GetProcessSlot(Form_ID);
  452.         if (id9==GetActiveProcess()) return 1;
  453.         return 0;
  454. }
  455.  
  456. inline fastcall void ActivateWindow( ECX)
  457. {
  458.         EAX = 18;
  459.         EBX = 3;
  460.         $int 0x40
  461. }
  462.  
  463. inline fastcall int MinimizeWindow()
  464. {
  465.         EAX = 18;
  466.         EBX = 10;
  467.         $int 0x40
  468. }
  469.  
  470. inline fastcall int CreateThread(ECX,EDX)
  471. {
  472.         $mov eax,51
  473.         $mov ebx,1
  474.         $int 0x40
  475. }
  476.  
  477. inline fastcall void SwitchToAnotherThread()
  478. {
  479.         $mov eax,68
  480.         $mov ebx,1
  481.         $int 0x40
  482. }
  483.  
  484. inline fastcall int SendWindowMessage( ECX, EDX)
  485. {
  486.         $mov eax, 72
  487.         $mov ebx, 1
  488.         $int 0x40
  489. }
  490.  
  491. inline fastcall int KillProcess( ECX)
  492. {
  493.         $mov eax,18;
  494.         $mov ebx,18;
  495.         $int 0x40
  496. }
  497.  
  498. #define TURN_OFF 2
  499. #define REBOOT 3
  500. #define KERNEL 4
  501. inline fastcall int ExitSystem( ECX)
  502. {
  503.         $mov eax, 18
  504.         $mov ebx, 9
  505.         $int 0x40
  506. }
  507.  
  508. inline fastcall ExitProcess()
  509. {
  510.         $mov eax,-1;
  511.         $int 0x40
  512. }
  513.  
  514. //------------------------------------------------------------------------------
  515.  
  516. //eax = ÿçûê ñèñòåìû (1=eng, 2=fi, 3=ger, 4=rus)
  517. inline fastcall int GetSystemLanguage()
  518. {
  519.         EAX = 26;
  520.         EBX = 5;
  521.         $int 0x40
  522. }
  523.  
  524. inline fastcall GetSkinHeight()
  525. {
  526.         $push ebx
  527.         $mov  eax,48
  528.         $mov  ebx,4
  529.         $int 0x40
  530.         $pop  ebx
  531. }
  532.  
  533. inline fastcall void SetSystemSkin( ECX)
  534. {
  535.         EAX = 48;
  536.         EBX = 8;
  537.         $int 0x40
  538. }
  539.  
  540. inline fastcall int GetScreenWidth()
  541. {
  542.         $mov eax, 14
  543.         $int 0x40
  544.         $shr eax, 16
  545. }
  546.  
  547. inline fastcall int GetScreenHeight()
  548. {
  549.         $mov eax, 14
  550.         $int 0x40
  551.         $and eax,0x0000FFFF
  552. }
  553.  
  554. inline fastcall int GetClientTop()
  555. {
  556.         $mov eax, 48
  557.         $mov ebx, 5
  558.         $int 0x40
  559.     $mov eax, ebx
  560.     $shr eax, 16
  561. }
  562.  
  563. inline fastcall int GetClientHeight()
  564. {
  565.         $mov eax, 48
  566.         $mov ebx, 5
  567.         $int 0x40
  568.     $mov eax, ebx
  569. }
  570.  
  571.  
  572. inline fastcall dword LoadLibrary( ECX)
  573. {
  574.         $mov eax, 68
  575.         $mov ebx, 19
  576.         $int  0x40
  577. }
  578.  
  579. inline fastcall int TestBit( EAX, CL)
  580. {
  581.         $shr eax,cl
  582.         $and eax,1
  583. }
  584.  
  585. inline fastcall int PlaySpeaker( ESI)
  586. {
  587.         $mov eax, 55
  588.         $mov ebx, 55
  589.         $int 0x40
  590. }
  591.  
  592. inline fastcall void debugln( EDX)
  593. {
  594.         $push eax
  595.         $push ebx
  596.         $push ecx
  597.         $mov eax, 63
  598.         $mov ebx, 1
  599. NEXT_CHAR:
  600.         $mov ecx, DSDWORD[edx]
  601.         $or      cl, cl
  602.         $jz  DONE
  603.         $int 0x40
  604.         $inc edx
  605.         $jmp NEXT_CHAR
  606. DONE:
  607.         $mov cl, 13
  608.         $int 0x40
  609.         $mov cl, 10
  610.         $int 0x40
  611.         $pop ecx
  612.         $pop ebx
  613.         $pop eax
  614. }
  615.  
  616. inline fastcall void debug( EDX)
  617. {
  618.         $push eax
  619.         $push ebx
  620.         $push ecx
  621.         $mov eax, 63
  622.         $mov ebx, 1
  623. NEXT_CHAR:
  624.         $mov ecx, DSDWORD[edx]
  625.         $or      cl, cl
  626.         $jz  DONE
  627.         $int 0x40
  628.         $inc edx
  629.         $jmp NEXT_CHAR
  630. DONE:
  631.         $pop ecx
  632.         $pop ebx
  633.         $pop eax
  634. }
  635.  
  636.  
  637. inline fastcall void debugch( ECX)
  638. {
  639.         $push eax
  640.         $push ebx
  641.         $mov eax,63
  642.         $mov ebx,1
  643.         $int 0x40
  644.         $pop ebx
  645.         $pop eax
  646. }
  647. //------------------------------------------------------------------------------
  648.  
  649. void DefineAndDrawWindow(dword x, y, size_w, size_h, byte WindowType,dword WindowAreaColor, EDI, ESI)
  650. {
  651.         EAX = 12;              // function 12:tell os about windowdraw
  652.         EBX = 1;
  653.         $int 0x40
  654.        
  655.         $xor EAX,EAX
  656.         EBX = x << 16 + size_w;
  657.         ECX = y << 16 + size_h;
  658.  
  659.         EDX = WindowType << 24 | WindowAreaColor;
  660.         $int 0x40
  661.  
  662.         EAX = 12;              // function 12:tell os about windowdraw
  663.         EBX = 2;
  664.         $int 0x40
  665. }
  666.  
  667. inline fastcall MoveSize( EBX,ECX,EDX,ESI)
  668. {
  669.         $mov eax, 67
  670.         $int 0x40
  671. }
  672.  
  673. inline fastcall void DrawTitle( ECX)
  674. {
  675.         EAX = 71;
  676.         EBX = 1;
  677.         $int 0x40;
  678. }
  679.  
  680. void WriteTextB(dword x,y,byte fontType, dword color, EDX)
  681. {
  682.         EAX = 4;
  683.         EBX = x<<16+y;
  684.         ECX = fontType<<24+color;
  685.         ESI = 0;
  686.         $int 0x40;
  687.         $add ebx, 1<<16
  688.         $int 0x40
  689. }
  690.  
  691. void WriteText(dword x,y,byte fontType, dword color, EDX)
  692. {
  693.         EAX = 4;
  694.         EBX = x<<16+y;
  695.         ECX = fontType<<24+color;
  696.         $int 0x40;
  697. }
  698.  
  699. dword WriteBufText(dword x,y,byte fontType, dword color, EDX, EDI)
  700. {
  701.         EAX = 4;
  702.         EBX = x<<16+y;
  703.         ECX = fontType<<24+color;
  704.         $int 0x40;
  705. }
  706.  
  707. void WriteNumber(dword x,y,byte fontType, dword color, count, ECX)
  708. {
  709.         EAX = 47;
  710.         EBX = count<<16;
  711.         EDX = x<<16+y;
  712.         ESI = fontType<<24+color;
  713.         $int 0x40;
  714. }
  715.  
  716. void CopyScreen(dword EBX, x, y, w, h)
  717. {
  718.   EAX = 36;
  719.   ECX = w << 16 + h;
  720.   EDX = x << 16 + y;
  721.   $int  0x40;
  722. }
  723.  
  724. :dword GetPixelColor(dword x, x_size, y)
  725. {
  726.         $mov eax, 35
  727.         EBX= y*x_size+x;
  728.         $int 0x40
  729. }
  730.  
  731.  
  732. void _PutImage(dword x,y, w,h, EBX)
  733. {
  734.         EAX = 7;
  735.         ECX = w<<16+h;
  736.         EDX = x<<16+y;
  737.         $int 0x40
  738. }
  739.  
  740. void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI)
  741. {
  742.         EAX = 65;
  743.         ECX = w<<16+h;
  744.         EDX = x<<16+y;
  745.         EBP = 0;
  746.         $int 0x40
  747. }
  748.  
  749. inline fastcall void PutPixel( EBX,ECX,EDX)
  750. {
  751.   EAX=1;
  752.   $int 0x40
  753. }
  754.  
  755. void DrawBar(dword x,y,w,h,EDX)
  756. {
  757.         if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :)
  758.         EAX = 13;
  759.         EBX = x<<16+w;
  760.         ECX = y<<16+h;
  761.         $int 0x40
  762. }
  763.  
  764. void DefineButton(dword x,y,w,h,EDX,ESI)
  765. {
  766.         EAX = 8;
  767.         $push edx
  768.         EDX += BT_DEL;
  769.         $int 0x40;
  770.         $pop edx
  771.         EBX = x<<16+w;
  772.         ECX = y<<16+h;
  773.         $int 0x40
  774. }
  775.  
  776. inline RefreshWindow(dword ID_REFRESH,ID_ACTIVE)
  777. {
  778.         EAX = 18;
  779.         EBX = 22;
  780.         ECX = 3;
  781.         EDX = ID_REFRESH;
  782.         $int 0x40
  783.         EAX = 18;
  784.         EBX = 3;
  785.         EDX = ID_ACTIVE;
  786.         $int 0x40
  787. }
  788.  
  789. void UnsafeDefineButton(dword x,y,w,h,EDX,ESI)
  790. {
  791.         EAX = 8;
  792.         EBX = x<<16+w;
  793.         ECX = y<<16+h;
  794.         $int 0x40
  795. }
  796.  
  797. inline fastcall void DeleteButton( EDX)
  798. {
  799.         EAX = 8;
  800.         EDX += BT_DEL;
  801.         $int 0x40;
  802. }
  803.  
  804. inline fastcall dword GetStartTime()
  805. {
  806.         $mov eax,26
  807.         $mov ebx,9
  808.         $int 0x40
  809. }
  810.  
  811. :dword ALERT_TEXT;
  812. :void dialog_alert()
  813. {
  814.         byte id;
  815.         loop()switch(WaitEvent())
  816.         {
  817.                 case evReDraw:
  818.                         DefineAndDrawWindow(215,100,250,200,0x34,0xFFFFFF,"Alert");
  819.                         WriteTextB(5,5,0x90,0x0,ALERT_TEXT);
  820.                 break;
  821.                 case evButton:
  822.                         id=GetButtonID();
  823.                         if (id==1) ExitProcess();
  824.                 break;
  825.         }
  826. }
  827.  
  828. :dword alert(dword text)
  829. {
  830.         dword mem = malloc(4096);
  831.         ALERT_TEXT = text;
  832.         CreateThread(#dialog_alert,mem+4092);
  833.         return mem;
  834. }
  835.  
  836. :struct _screen
  837. {
  838.         dword width,height;
  839. } screen;
  840.  
  841. :struct _skin
  842. {
  843.         dword width,height;
  844. } SKIN;
  845.  
  846. dword __generator;  // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë
  847.  
  848. :dword program_path_length;
  849.  
  850. //The initialization of the initial data before running
  851. void load_init_main()
  852. {
  853.         SKIN.height   = GetSkinHeight();
  854.        
  855.         screen.width  = GetScreenWidth();
  856.         screen.height = GetScreenHeight();
  857.        
  858.         //program_path_length = strlen(I_Path);
  859.         MOUSE_TIME = 50; //Default 500 ms.
  860.         __generator = GetStartTime();
  861.         //mem_Init();
  862.         main();
  863. }