Subversion Repositories Kolibri OS

Rev

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

  1. ; Playlist support for MIDPLAY
  2. LCOLOR  equ 0x00ff00
  3. PCOLOR  equ 0xffffff
  4.  
  5. PL_X equ 10 shl 16
  6. PL_Y equ PLY shl 16
  7. PL_XY equ 10 shl 16+PLY
  8.  
  9. PL_show:
  10.    test [flag],FL_HIDDEN
  11.    jnz   .ex
  12.    pusha
  13.    and  [counter],0
  14.    mov  ebx,PL_X+255
  15.    mov  eax,13
  16.    mov  ecx,PL_Y-1 shl 16+4+9*LISTITEMS
  17.    xor  edx,edx
  18.    mcall
  19.    movzx  ecx,byte[list_count]
  20.    test ecx,ecx
  21.    jz   .ex2
  22.    push ecx
  23.    imul ecx,9
  24.    add  ecx,PL_Y-1 shl 16-2
  25.    mov  edx,11+1 shl 29+1 shl 30
  26.    mov  eax,8
  27.    mcall
  28.    pop  ecx
  29.    mov  edi,[pl_ptr]
  30.    mov  eax,4
  31.    mov  ebx,PL_XY+2 shl 16
  32.  .sh_loop:
  33.    movzx esi,word[edi]
  34.    and  esi,not FL_MULSEL
  35.    add  edi,2
  36.    pusha
  37.    mov  edx,edi
  38.    mov  ecx,[counter]
  39.    test word[edi-2],FL_MULSEL
  40.    jz   .nosel
  41.    pusha
  42.    mov  ebx,PL_X+255+1 shl 16-2
  43.    imul ecx,9
  44.    shl  ecx,16
  45.    add  ecx,PL_Y-1 shl 16+8
  46.    mov  edx,0xc6
  47.    mov  eax,13
  48.    mcall
  49.    popa
  50.  .nosel:
  51.    pusha
  52.    mov  edx,ebx
  53.    mov  esi,0xa0a0a0;0x508cec
  54.    mcall 47,0x30000
  55.    popa
  56.    cmp  ecx,[play_num]
  57.    je   .high
  58.    mov  ecx,LCOLOR
  59.    jmp  .int
  60.  .high:
  61.    mov  ecx,PCOLOR
  62.  .int:
  63.    add  ebx,25 shl 16
  64.    mcall
  65.    popa
  66.    add  edi,esi
  67.    add  ebx,9
  68.    inc  [counter]
  69.    loop .sh_loop2
  70.    jmp  .ex2
  71.  .sh_loop2:
  72.    jmp  .sh_loop
  73.  .ex2:
  74.    popa
  75.    test [flag],FL_BOTTRED
  76.    jz   .nobott
  77.    pusha
  78.    mcall 7,hdr_raw+8+275*16*3,<275,12>,<10,(WND_HEIGHT-20)>
  79.    mov  ebp,main_coo2
  80.    mov  esi,10 shl 16
  81.    mov  edi,(WND_HEIGHT-22)shl 16
  82.    mov  ecx,1
  83.    pushd 155 shl 16+5
  84.    pushd (WND_HEIGHT-22) shl 16+5
  85.    call draw_navigation
  86.    add  esp,8
  87.    popa
  88.    call draw_bottom
  89.    and  [flag],not FL_BOTTRED
  90.  .nobott:
  91.  .ex:
  92.    ret
  93.  
  94. PL_add:
  95. ; in: esi->filename,ecx->fname_len
  96.    jecxz .ex
  97.    cmp  [list_count],LISTITEMS
  98.    jae   .ex
  99.    pusha
  100.    mov  edi,[play_limit]
  101.    mov  [edi],cx
  102.    add  edi,2
  103.    rep  movsb
  104.    mov  [play_limit],edi
  105.    inc  [list_count]
  106.    popa
  107.  .ex:
  108.    ret
  109.  
  110. PL_del:
  111.     movzx ecx,byte[list_count]
  112.     jecxz .ex
  113.     call PL_get1stsel
  114.     mov  edx,ebx
  115.   .lp:
  116.     mov  edi,esi
  117.     xor  eax,eax
  118.     lodsw
  119.     btr  eax,15
  120.     jc  .elp2
  121.     add  esi,eax
  122.     jmp  .elp
  123.   .elp2:
  124.     push esi ecx
  125.     add  esi,eax
  126.     mov  ecx,[play_limit]
  127.     sub  ecx,esi
  128.     rep  movsb
  129.     mov  [play_limit],edi
  130.     dec  [list_count]
  131.     cmp  edx,[play_num]
  132.     ja   .no
  133.     dec  [play_num]
  134.   .no:
  135.     pop  ecx esi
  136.     sub  esi,2
  137.   .elp:
  138.     inc  edx
  139.     loop .lp
  140.   .ex:
  141.     ret
  142.  
  143. PL_getitemclick:
  144. ;  out: eax- item # (0..n)
  145.    mov  ebx,1
  146.    mov  eax,37
  147.    mcall
  148.    sub  eax,PLY-1
  149.    mov  ebx,9
  150.    div  bl
  151.    movzx eax,al
  152.    ret
  153.  
  154. PL_getbyindex:
  155. ;  in:eax-index, out: esi-filename, ecx-length
  156.    mov  esi,[pl_ptr]
  157.    mov  ecx,eax
  158.  .loop:
  159.    lodsw
  160.    and  eax,not FL_MULSEL
  161.    jecxz .gbi
  162.    add  esi,eax
  163.    dec  ecx
  164.    jmp  .loop
  165.  .gbi:
  166.    movzx ecx,ax
  167.    ret
  168.  
  169. PL_get1stsel:
  170. ; out: esi- 1st selected, ebx - index
  171.    mov  esi,[pl_ptr]
  172.    xor  ebx,ebx
  173. PL_getnextsel:
  174.    push eax ecx
  175.    movzx ecx,[list_count]
  176.    test ecx, ecx
  177.    jz   .ex2
  178.  .lp:
  179.    movzx eax,word[esi]
  180.    btr  eax,15
  181.    jc   .ex2
  182.    lea  esi,[esi+eax+2]
  183.    inc  ebx
  184.    loop .lp
  185.    xor  ebx,ebx
  186.  .ex2:
  187.    pop  ecx
  188.  .ex:
  189.    pop  eax
  190.    ret
  191.  
  192. PL_clearsel:
  193.    pusha
  194.    mov  ebx,not FL_MULSEL
  195.    xor  eax,eax
  196.    mov  esi,[pl_ptr]
  197.    movzx ecx,[list_count]
  198.    jecxz .flg
  199.  .loop:
  200.    and  word[esi],bx
  201.    lodsw
  202.    add  esi,eax
  203.    loop .loop
  204.  .flg:
  205.    and  [flag],not FL_MULSEL
  206.    popa
  207.    ret
  208.  
  209. PL_shiftsel:
  210.    pusha
  211.    xor  eax,eax
  212. ;   mov  esi,[pl_ptr]
  213. ;   movzx ecx,[list_count]
  214.  .loop:
  215.    lodsw
  216.    or   word[esi-2],FL_MULSEL
  217.    add  esi,eax
  218.    loop .loop
  219.    jmp  PL_clearsel.flg
  220.  
  221. PL_invsel:
  222.    pusha
  223.    mov  ebx,not FL_MULSEL
  224.    xor  eax,eax
  225.    mov  esi,[pl_ptr]
  226.    movzx ecx,[list_count]
  227.    jecxz .ex
  228.  .loop:
  229.    xor  word[esi],FL_MULSEL
  230.    lodsw
  231.    and  eax,ebx
  232.    add  esi,eax
  233.    loop .loop
  234.  .ex:
  235.    jmp  PL_clearsel.flg
  236.  
  237. PL_load:
  238.    and  [list_count],0
  239.    mov  [pl_ptr],playlist
  240.    mov  ebx,PL_info
  241.    mov  dword[ebx+16],playlist
  242.    and  dword[ebx],0
  243.    mov  dword[ebx+12],20*512
  244.    mov  eax,70
  245.    mcall
  246.    test eax,eax
  247.    jz   .ok1     ; ebx- filesize
  248.    cmp  eax,6
  249.    jne  .ex
  250.  .ok1:
  251.    mov  eax,0x0a0d
  252.    cmp  word[playlist],ax
  253.    je   .ok
  254.    sub  [pl_ptr],2
  255.  .ok:
  256.    mov  edi,[pl_ptr]
  257.    add  ebx,edi
  258.    mov  word[ebx],ax
  259.    add  edi,2
  260.  .loo:
  261.    mov  edx,edi
  262.  .loo2:
  263.    mov  ecx,256
  264.    repne scasb
  265.    cmp  edi,ebx
  266.    jb   .ok2
  267.    lea  edi,[ebx+1]
  268.  .ok2:
  269.    mov  ecx,edi
  270.    sub  ecx,edx
  271.    dec  ecx
  272.    inc  edi
  273.    jecxz .shift
  274.    mov  [edx-2],cx
  275.    inc  [list_count]
  276.    cmp  edi,ebx
  277.    jb   .loo
  278.  .ex1:
  279.    sub  ebx,2
  280.    mov  [play_limit],ebx
  281.  .ex:
  282.    ret
  283.  
  284.  .shift:
  285.    mov  ecx,ebx
  286.    sub  ecx,edi
  287.    jecxz .ex1
  288.    sub  ebx,2
  289.    mov  esi,edi
  290.    sub  edi,2
  291.    push edi
  292.    rep  movsb
  293.    pop  edi
  294.    jmp  .loo
  295.  
  296. PL_save:
  297.    movzx ecx,byte[list_count]
  298.    jecxz .ex
  299.    mov  eax,0x0a0d
  300.    mov  edi,[pl_ptr]
  301.    lea  edx,[edi+2]
  302.    mov  [PL_info+16],edx
  303.  .savl:
  304.    movzx ebx,word[edi]
  305.    and  bx,not FL_MULSEL
  306.    stosw
  307.    add  edi,ebx
  308.    loop .savl
  309.    stosw
  310.    sub  edi,[pl_ptr]
  311.    mov  ebx,PL_info
  312.    mov  [ebx+12],edi
  313.    mov  byte[ebx],2
  314.    mov  eax,70
  315.    mcall
  316.  .ex:
  317.    ret
  318.  
  319. PL_swap:  ; swap [ebx] with [ebx+1]
  320.     mov  eax,ebx
  321.     call PL_getbyindex
  322.     add  ecx,2
  323.     sub  esi,2
  324.     push ecx esi ; save begin & length of 1st fname
  325.     mov  edi,fnbuf
  326.     rep  movsb
  327.     movzx ecx,word[esi]
  328.     and  cx,not FL_MULSEL
  329.     add  ecx,2
  330.     pop  edi
  331.     rep  movsb
  332.     pop  ecx
  333.     mov  esi,fnbuf
  334.     rep  movsb
  335.     cmp  ebx,[play_num]
  336.     jne  .nosel1
  337.     inc  [play_num]
  338.     ret
  339.   .nosel1:
  340.     inc  ebx
  341.     cmp  ebx,[play_num]
  342.     jne  .nosel2
  343.     dec  [play_num]
  344.   .nosel2:
  345.     ret
  346.  
  347. PL_info:
  348.  .mode  dd 0
  349.         dd 0
  350.         dd 0
  351.  .bytes dd 20*512
  352.         dd 0
  353.         db PLAYLIST_PATH,0
  354.