Subversion Repositories Kolibri OS

Rev

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

  1.  use32          
  2.         org     0x0          
  3.          
  4.         db      'MENUET01'      ; 8 byte id          
  5.         dd      38              ; required os          
  6.         dd      STARTAPP        ; program start          
  7.         dd      I_END           ; program image size          
  8.         dd      0x1000000       ; required amount of memory          
  9.         dd      0x1000000       ; stack heap          
  10.         dd      0x0
  11.         dd      0x0          
  12.                    
  13. include '../../../proc32.inc'          
  14. include '../../../macros.inc'          
  15. include '../../../dll.inc'          
  16.  
  17.          
  18. PATH_MAX equ 255          
  19.  
  20. STARTAPP:          
  21.     ; Initialize memory          
  22.     mcall   68, 11        
  23.     ; Import libraries          
  24.     stdcall dll.Load,importTable       
  25.    
  26.         ; Set button style: flat or gradient (3D)
  27.     invoke  ini_get_int, aIni, aSection, aButtonStyle, 0
  28.     mov ecx, eax
  29.     mcall 48, 1
  30.  
  31. get_bg:
  32.     invoke  ini_get_str, aIni, aSection, aBgProgram, sz_app, PATH_MAX, 0
  33.     invoke  ini_get_str, aIni, aSection, aBgParam, sz_param, PATH_MAX, 0
  34.        
  35.         cmp     byte[sz_param], '\'
  36.         jne     set_bg
  37.  
  38.         ; This is fix for KIV images located at /kolibrios and /usbhd drives
  39.         ; It checks is the file exists for 5 times with perioud 1 second
  40.         mov     edi, 0
  41. @@:
  42.         mcall   70, KivFileRead
  43.         cmp     eax,0
  44.         je      set_bg
  45.         mcall   5, 100
  46.         inc     edi
  47.         cmp     edi, 5
  48.         jle     @b
  49.         ; if not found then lets try to set bg anyway
  50.  
  51. set_bg:
  52.     mcall   70, RunApp
  53.            
  54. set_skin:
  55.     invoke  ini_get_str, aIni, aSection, aSkinPath, sz_param, PATH_MAX, 0
  56.         cmp     byte [sz_param], 0 ;no need to set skin it was not specified
  57.         je      @f
  58.     mcall   48, 8, sz_param          
  59. @@:
  60.     mcall   -1
  61.  
  62.        
  63. importTable:          
  64. library                                                 \          
  65.         libini, 'libini.obj'          
  66.          
  67. import  libini, \          
  68.         ini_get_str  ,'ini_get_str', \          
  69.         ini_get_int  ,'ini_get_int'      
  70.          
  71. RunApp:
  72.         dd      7     ; subfunction number          
  73.         dd      0     ; position in the file in bytes          
  74.         dd      sz_param     ; upper part of the position address          
  75.         dd      0     ; number of bytes to read          
  76.         dd      0     ; pointer to the buffer to write data          
  77.         db      0          
  78.         dd      sz_app     ; pointer to the filename
  79.  
  80. KivFileRead:
  81.         dd      0     ; subfunction number          
  82.         dd      0     ; position in the file in bytes          
  83.         dd      0     ; upper part of the position address          
  84.         dd      4     ; number of bytes to read          
  85.         dd      buf     ; pointer to the buffer to write data  
  86.                 db      0                      
  87.         dd      sz_param+4     ; pointer to the filename
  88. buf rb 4
  89.          
  90. aIni          db  '/sys/settings/system.ini',0          
  91. aSection      db  'style',0
  92.  
  93. aBgProgram    db  'bg_program',0
  94. aBgParam      db  'bg_param',0          
  95. aButtonStyle  db  'buttons_gradient',0
  96. aSkinPath     db  'skin',0
  97.  
  98. sz_app:
  99.     rb        PATH_MAX
  100. sz_param:          
  101.     rb        PATH_MAX
  102.          
  103. I_END:                ; End of application code and data marker          
  104.        
  105.