Subversion Repositories Kolibri OS

Rev

Rev 139 | 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.    int  0x40
  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.    int  0x40
  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.    int  0x40
  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.    int  0x40
  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+12+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.    int  0x40
  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+12],playlist
  240.    mov  eax,58
  241.    int  0x40
  242.    test eax,eax
  243.    jz   .ok1     ; ebx- filesize
  244.    cmp  eax,6
  245.    jne  .ex
  246.  .ok1:
  247.    mov  eax,0x0a0d
  248.    cmp  word[playlist],ax
  249.    je   .ok
  250.    sub  [pl_ptr],2
  251.  .ok:
  252.    mov  edi,[pl_ptr]
  253.    add  ebx,edi
  254.    mov  word[ebx],ax
  255.    add  edi,2
  256.  .loo:
  257.    mov  edx,edi
  258.  .loo2:
  259.    mov  ecx,256
  260.    repne scasb
  261.    cmp  edi,ebx
  262.    jb   .ok2
  263.    lea  edi,[ebx+1]
  264.  .ok2:
  265.    mov  ecx,edi
  266.    sub  ecx,edx
  267.    dec  ecx
  268.    inc  edi
  269.    jecxz .shift
  270.    mov  [edx-2],cx
  271.    inc  [list_count]
  272.    cmp  edi,ebx
  273.    jb   .loo
  274.  .ex1:
  275.    sub  ebx,2
  276.    mov  [play_limit],ebx
  277.  .ex:
  278.    ret
  279.  
  280.  .shift:
  281.    mov  ecx,ebx
  282.    sub  ecx,edi
  283.    jecxz .ex1
  284.    sub  ebx,2
  285.    mov  esi,edi
  286.    sub  edi,2
  287.    push edi
  288.    rep  movsb
  289.    pop  edi
  290.    jmp  .loo
  291.  
  292. PL_save:
  293.    movzx ecx,byte[list_count]
  294.    jecxz .ex
  295.    mov  eax,0x0a0d
  296.    mov  edi,[pl_ptr]
  297.    lea  edx,[edi+2]
  298.    mov  [PL_info+12],edx
  299.  .savl:
  300.    movzx ebx,word[edi]
  301.    and  bx,not FL_MULSEL
  302.    stosw
  303.    add  edi,ebx
  304.    loop .savl
  305.    stosw
  306.    sub  edi,[pl_ptr]
  307.    mov  ebx,PL_info
  308.    mov  [ebx+8],edi
  309.    mov  dword[ebx],1
  310.    mov  eax,58
  311.    int  0x40
  312.  .ex:
  313.    ret
  314.  
  315. PL_swap:  ; swap [ebx] with [ebx+1]
  316.     mov  eax,ebx
  317.     call PL_getbyindex
  318.     add  ecx,2
  319.     sub  esi,2
  320.     push ecx esi ; save begin & length of 1st fname
  321.     mov  edi,fnbuf
  322.     rep  movsb
  323.     movzx ecx,word[esi]
  324.     and  cx,not FL_MULSEL
  325.     add  ecx,2
  326.     pop  edi
  327.     rep  movsb
  328.     pop  ecx
  329.     mov  esi,fnbuf
  330.     rep  movsb
  331.     cmp  ebx,[play_num]
  332.     jne  .nosel1
  333.     inc  [play_num]
  334.     ret
  335.   .nosel1:
  336.     inc  ebx
  337.     cmp  ebx,[play_num]
  338.     jne  .nosel2
  339.     dec  [play_num]
  340.   .nosel2:
  341.     ret
  342.  
  343. PL_info:
  344.  .mode  dd 0
  345.         dd 0
  346.  .bytes dd 20
  347.         dd 0
  348.         dd hash_table
  349.         db PLAYLIST_PATH,0
  350.