Subversion Repositories Kolibri OS

Rev

Rev 485 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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