Subversion Repositories Kolibri OS

Rev

Rev 485 | Go to most recent revision | 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.  .lp:
  177.    movzx eax,word[esi]
  178.    btr  eax,15
  179.    jc   .ex2
  180.    lea  esi,[esi+eax+2]
  181.    inc  ebx
  182.    loop .lp
  183.    xor  ebx,ebx
  184.  .ex2:
  185.    pop  ecx
  186.  .ex:
  187.    pop  eax
  188.    ret
  189.  
  190. PL_clearsel:
  191.    pusha
  192.    mov  ebx,not FL_MULSEL
  193.    xor  eax,eax
  194.    mov  esi,[pl_ptr]
  195.    movzx ecx,[list_count]
  196.    jecxz .flg
  197.  .loop:
  198.    and  word[esi],bx
  199.    lodsw
  200.    add  esi,eax
  201.    loop .loop
  202.  .flg:
  203.    and  [flag],not FL_MULSEL
  204.    popa
  205.    ret
  206.  
  207. PL_shiftsel:
  208.    pusha
  209.    xor  eax,eax
  210. ;   mov  esi,[pl_ptr]
  211. ;   movzx ecx,[list_count]
  212.  .loop:
  213.    lodsw
  214.    or   word[esi-2],FL_MULSEL
  215.    add  esi,eax
  216.    loop .loop
  217.    jmp  PL_clearsel.flg
  218.  
  219. PL_invsel:
  220.    pusha
  221.    mov  ebx,not FL_MULSEL
  222.    xor  eax,eax
  223.    mov  esi,[pl_ptr]
  224.    movzx ecx,[list_count]
  225.    jecxz .ex
  226.  .loop:
  227.    xor  word[esi],FL_MULSEL
  228.    lodsw
  229.    and  eax,ebx
  230.    add  esi,eax
  231.    loop .loop
  232.  .ex:
  233.    jmp  PL_clearsel.flg
  234.  
  235. PL_load:
  236.    and  [list_count],0
  237.    mov  [pl_ptr],playlist
  238.    mov  ebx,PL_info
  239.    mov  dword[ebx+16],playlist
  240.    and  dword[ebx],0
  241.    mov  dword[ebx+12],20*512
  242.    mov  eax,70
  243.    mcall
  244.    test eax,eax
  245.    jz   .ok1     ; ebx- filesize
  246.    cmp  eax,6
  247.    jne  .ex
  248.  .ok1:
  249.    mov  eax,0x0a0d
  250.    cmp  word[playlist],ax
  251.    je   .ok
  252.    sub  [pl_ptr],2
  253.  .ok:
  254.    mov  edi,[pl_ptr]
  255.    add  ebx,edi
  256.    mov  word[ebx],ax
  257.    add  edi,2
  258.  .loo:
  259.    mov  edx,edi
  260.  .loo2:
  261.    mov  ecx,256
  262.    repne scasb
  263.    cmp  edi,ebx
  264.    jb   .ok2
  265.    lea  edi,[ebx+1]
  266.  .ok2:
  267.    mov  ecx,edi
  268.    sub  ecx,edx
  269.    dec  ecx
  270.    inc  edi
  271.    jecxz .shift
  272.    mov  [edx-2],cx
  273.    inc  [list_count]
  274.    cmp  edi,ebx
  275.    jb   .loo
  276.  .ex1:
  277.    sub  ebx,2
  278.    mov  [play_limit],ebx
  279.  .ex:
  280.    ret
  281.  
  282.  .shift:
  283.    mov  ecx,ebx
  284.    sub  ecx,edi
  285.    jecxz .ex1
  286.    sub  ebx,2
  287.    mov  esi,edi
  288.    sub  edi,2
  289.    push edi
  290.    rep  movsb
  291.    pop  edi
  292.    jmp  .loo
  293.  
  294. PL_save:
  295.    movzx ecx,byte[list_count]
  296.    jecxz .ex
  297.    mov  eax,0x0a0d
  298.    mov  edi,[pl_ptr]
  299.    lea  edx,[edi+2]
  300.    mov  [PL_info+16],edx
  301.  .savl:
  302.    movzx ebx,word[edi]
  303.    and  bx,not FL_MULSEL
  304.    stosw
  305.    add  edi,ebx
  306.    loop .savl
  307.    stosw
  308.    sub  edi,[pl_ptr]
  309.    mov  ebx,PL_info
  310.    mov  [ebx+12],edi
  311.    mov  byte[ebx],2
  312.    mov  eax,70
  313.    mcall
  314.  .ex:
  315.    ret
  316.  
  317. PL_swap:  ; swap [ebx] with [ebx+1]
  318.     mov  eax,ebx
  319.     call PL_getbyindex
  320.     add  ecx,2
  321.     sub  esi,2
  322.     push ecx esi ; save begin & length of 1st fname
  323.     mov  edi,fnbuf
  324.     rep  movsb
  325.     movzx ecx,word[esi]
  326.     and  cx,not FL_MULSEL
  327.     add  ecx,2
  328.     pop  edi
  329.     rep  movsb
  330.     pop  ecx
  331.     mov  esi,fnbuf
  332.     rep  movsb
  333.     cmp  ebx,[play_num]
  334.     jne  .nosel1
  335.     inc  [play_num]
  336.     ret
  337.   .nosel1:
  338.     inc  ebx
  339.     cmp  ebx,[play_num]
  340.     jne  .nosel2
  341.     dec  [play_num]
  342.   .nosel2:
  343.     ret
  344.  
  345. PL_info:
  346.  .mode  dd 0
  347.         dd 0
  348.         dd 0
  349.  .bytes dd 20*512
  350.         dd 0
  351.         db PLAYLIST_PATH,0
  352.