Subversion Repositories Kolibri OS

Rev

Rev 7659 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. use32
  2.         org 0
  3.         db  'MENUET01'
  4.         dd  0x01,start,i_end,e_end,e_end,0,0
  5.  
  6. include 'proc32.inc'
  7. include 'macros.inc'
  8. include 'dll.inc'
  9. include 'debug-fdo.inc'
  10.  
  11. __DEBUG__ = 1
  12. __DEBUG_LEVEL__ = 1
  13.  
  14. DEFAULT_TIMEOUT_MINS = 15
  15.  
  16. start:
  17.         mcall   68, 11
  18.         mcall   40, EVM_KEY + EVM_BACKGROUND + EVM_MOUSE
  19.  
  20.         stdcall dll.Load,@IMPORT
  21.         test    eax, eax
  22.         jnz     exit
  23.  
  24.         invoke  ini.get_str, ini_file, ini_section, ini_key_program, ini_program_buf, ini_program_buf.size, 0
  25.         cmp     [ini_program_buf], 0          ; if nothing set then exit
  26.         je      exit
  27.  
  28.         invoke  ini.get_int, ini_file, ini_section, ini_key_timeout, DEFAULT_TIMEOUT_MINS
  29.         imul    eax, 60*100     ; cs
  30.         mov     [timeout], eax
  31.  
  32.         ; r1647 by Nasarus
  33. ;        mcall   66, 4, 57, 0    ; hot key for {Space}
  34. ;        mcall   66, 4, 28, 0    ; hot key for {Enter}
  35.  
  36. still:
  37.         mcall   23, [timeout]
  38.         test    eax, eax
  39.         jz      run_saver
  40.         cmp     eax, 2  ; key
  41.         jnz     still
  42.         mcall
  43.         ; r1647 by Nasarus
  44. ;        cmp     al, 2           ; hot key?
  45. ;        jnz     still           ; no hotkey, evenets handling go on
  46. ;        movzx   edx, ah
  47. ;        mcall   72, 1, 2        ; transfer key code to active window after interception
  48.         jmp     still
  49. run_saver:
  50.         invoke  ini.get_str, ini_file, ini_section, ini_key_program, ini_program_buf, ini_program_buf.size, ini_program_default
  51.         ; run actual screensaver
  52.         mcall   70, f70
  53.         cmp     eax, 0
  54.         jg      exit
  55.         neg     eax
  56.         DEBUGF 1, 'Screen saver not found: %d: %s\n', eax, ini_program_buf
  57. exit:
  58.         mcall   -1
  59.  
  60.  
  61. sz ini_file, '/sys/settings/system.ini',0
  62. sz ini_section, 'screensaver',0
  63. sz ini_key_timeout, 'timeout',0
  64. timeout dd ?
  65. sz ini_key_program, 'program',0
  66. sz ini_program_default, '/sys/demos/spiral',0
  67. sz program_params, '@ss',0
  68.  
  69. f70:    ; run
  70.         dd 7, 0, program_params, 0, 0
  71.         db 0
  72.         dd ini_program_buf
  73.  
  74. align 4
  75. @IMPORT:
  76.  
  77. library \
  78.         libini , 'libini.obj'
  79.  
  80. import  libini, \
  81.         ini.get_str, 'ini_get_str', \
  82.         ini.get_int, 'ini_get_int'
  83.  
  84. include_debug_strings
  85. i_end:
  86.  
  87. align 4
  88. sz ini_program_buf, 1024 dup(?)
  89. rb 0x100
  90. e_end:
  91.