Rev 1016 | Rev 1080 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1016 | Rev 1040 | ||
---|---|---|---|
1 | use32 |
1 | use32 |
2 | org 0x0 |
2 | org 0x0 |
3 | 3 | ||
4 | db 'MENUET01' |
4 | db 'MENUET01' |
5 | dd 0x01, START, I_END, 0x4000, 0x4000, @PARAMS, 0x0 |
5 | dd 0x01, START, I_END, 0x4000, 0x4000, @PARAMS, 0x0 |
6 | 6 | ||
7 | ;----------------------------------------------------------------------------- |
7 | ;----------------------------------------------------------------------------- |
8 | 8 | ||
9 | FALSE = 0 |
9 | FALSE = 0 |
10 | TRUE = 1 |
10 | TRUE = 1 |
11 | 11 | ||
12 | include '../../../../../proc32.inc' |
12 | include '../../../../../proc32.inc' |
13 | include '../../../../../macros.inc' |
13 | include '../../../../../macros.inc' |
14 | include 'dll.inc' |
14 | include 'dll.inc' |
15 | 15 | ||
16 | include '../../../develop/libraries/libs-dev/libio/libio.inc' |
16 | include '../../../develop/libraries/libs-dev/libio/libio.inc' |
17 | include '../../../develop/libraries/libs-dev/libimg/libimg.inc' |
17 | include '../../../develop/libraries/libs-dev/libimg/libimg.inc' |
18 | 18 | ||
19 | ;----------------------------------------------------------------------------- |
19 | ;----------------------------------------------------------------------------- |
20 | 20 | ||
21 | START: |
21 | START: |
22 | mcall 68, 11 |
22 | mcall 68, 11 |
23 | 23 | ||
24 | stdcall dll.Load, @IMPORT |
24 | stdcall dll.Load, @IMPORT |
25 | or eax, eax |
25 | or eax, eax |
26 | jnz exit |
26 | jnz exit |
27 | 27 | ||
28 | invoke sort.START, 1 |
28 | invoke sort.START, 1 |
29 | 29 | ||
30 | mov ecx, 1 ; for 15.4: 1 = tile |
30 | mov ecx, 1 ; for 15.4: 1 = tile |
31 | cmp word [@PARAMS], '\T' |
31 | cmp word [@PARAMS], '\T' |
32 | jz set_bgr |
32 | jz set_bgr |
33 | inc ecx ; for 15.4: 2 = stretch |
33 | inc ecx ; for 15.4: 2 = stretch |
34 | cmp word [@PARAMS], '\S' |
34 | cmp word [@PARAMS], '\S' |
35 | jz set_bgr |
35 | jz set_bgr |
36 | 36 | ||
37 | cmp byte [@PARAMS], 0 |
37 | cmp byte [@PARAMS], 0 |
38 | jnz params_given |
38 | jnz params_given |
39 | 39 | ||
40 | call opendialog |
40 | call opendialog |
41 | jc exit |
41 | jc exit |
42 | mov esi, path |
42 | mov esi, path |
43 | mov edi, @PARAMS |
43 | mov edi, @PARAMS |
44 | mov ecx, 512/4 |
44 | mov ecx, 512/4 |
45 | rep movsd |
45 | rep movsd |
46 | mov byte [edi-1], 0 |
46 | mov byte [edi-1], 0 |
47 | jmp params_given |
47 | jmp params_given |
48 | 48 | ||
49 | set_bgr: |
49 | set_bgr: |
50 | mcall 15, 4 |
50 | mcall 15, 4 |
51 | mov eax, @PARAMS + 4 |
51 | mov eax, @PARAMS + 4 |
52 | call load_image |
52 | call load_image |
53 | jc exit |
53 | jc exit |
54 | 54 | ||
55 | call set_as_bgr |
55 | call set_as_bgr |
56 | jmp exit |
56 | jmp exit |
57 | 57 | ||
58 | params_given: |
58 | params_given: |
59 | 59 | ||
60 | mov eax, @PARAMS |
60 | mov eax, @PARAMS |
61 | call load_image |
61 | call load_image |
62 | jc exit |
62 | jc exit |
63 | 63 | ||
64 | ;----------------------------------------------------------------------------- |
64 | ;----------------------------------------------------------------------------- |
65 | 65 | ||
66 | red: |
66 | red: |
67 | call draw_window |
67 | call draw_window |
68 | 68 | ||
69 | still: |
69 | still: |
70 | mcall 10 |
70 | mcall 10 |
71 | dec eax |
71 | dec eax |
72 | jz red |
72 | jz red |
73 | dec eax |
73 | dec eax |
74 | jnz button |
74 | jnz button |
75 | 75 | ||
76 | key: |
76 | key: |
77 | mcall 2 |
77 | mcall 2 |
78 | jmp still |
78 | jmp still |
79 | 79 | ||
80 | button: |
80 | button: |
81 | mcall 17 |
81 | mcall 17 |
82 | shr eax, 8 |
82 | shr eax, 8 |
83 | 83 | ||
84 | ; flip horizontally |
84 | ; flip horizontally |
85 | cmp eax, 'flh' |
85 | cmp eax, 'flh' |
86 | jne @f |
86 | jne @f |
87 | 87 | ||
88 | invoke img.flip, [image], FLIP_HORIZONTAL |
88 | invoke img.flip, [image], FLIP_HORIZONTAL |
89 | jmp redraw_image |
89 | jmp redraw_image |
90 | 90 | ||
91 | ; flip vertically |
91 | ; flip vertically |
92 | @@: cmp eax, 'flv' |
92 | @@: cmp eax, 'flv' |
93 | jne @f |
93 | jne @f |
94 | 94 | ||
95 | invoke img.flip, [image], FLIP_VERTICAL |
95 | invoke img.flip, [image], FLIP_VERTICAL |
96 | jmp redraw_image |
96 | jmp redraw_image |
97 | 97 | ||
98 | ; flip both horizontally and vertically |
98 | ; flip both horizontally and vertically |
99 | @@: cmp eax, 'flb' |
99 | @@: cmp eax, 'flb' |
100 | jne @f |
100 | jne @f |
101 | 101 | ||
102 | invoke img.flip, [image], FLIP_BOTH |
102 | invoke img.flip, [image], FLIP_BOTH |
103 | jmp redraw_image |
103 | jmp redraw_image |
104 | 104 | ||
105 | ; rotate left |
105 | ; rotate left |
106 | @@: cmp eax, 'rtl' |
106 | @@: cmp eax, 'rtl' |
107 | jne @f |
107 | jne @f |
108 | 108 | ||
109 | push ROTATE_90_CCW |
109 | push ROTATE_90_CCW |
110 | .rotate_common: |
110 | .rotate_common: |
111 | invoke img.rotate, [image] |
111 | invoke img.rotate, [image] |
112 | mov eax, [image] |
112 | mov eax, [image] |
113 | test eax, eax ; clear ZF flag |
113 | test eax, eax ; clear ZF flag |
114 | call update_image_sizes |
114 | call update_image_sizes |
115 | jmp redraw_image |
115 | jmp redraw_image |
116 | 116 | ||
117 | ; rotate right |
117 | ; rotate right |
118 | @@: cmp eax, 'rtr' |
118 | @@: cmp eax, 'rtr' |
119 | jne @f |
119 | jne @f |
120 | 120 | ||
121 | push ROTATE_90_CW |
121 | push ROTATE_90_CW |
122 | jmp .rotate_common |
122 | jmp .rotate_common |
123 | 123 | ||
124 | ; open new file |
124 | ; open new file |
125 | @@: cmp eax, 'opn' |
125 | @@: cmp eax, 'opn' |
126 | jne @f |
126 | jne @f |
127 | 127 | ||
128 | call opendialog |
128 | call opendialog |
129 | jc still |
129 | jc still |
130 | push [image] |
130 | push [image] |
131 | mov eax, path |
131 | mov eax, path |
132 | call load_image |
132 | call load_image |
133 | jc .restore_old |
133 | jc .restore_old |
134 | mov esi, path |
134 | mov esi, path |
135 | mov edi, @PARAMS |
135 | mov edi, @PARAMS |
136 | mov ecx, 512/4 |
136 | mov ecx, 512/4 |
137 | rep movsd |
137 | rep movsd |
138 | mov byte [edi-1], 0 |
138 | mov byte [edi-1], 0 |
139 | invoke img.destroy |
139 | invoke img.destroy |
140 | call free_directory |
140 | call free_directory |
141 | jmp red |
141 | jmp red |
142 | .restore_old: |
142 | .restore_old: |
143 | pop [image] |
143 | pop [image] |
144 | jmp still |
144 | jmp still |
145 | 145 | ||
146 | ; set background |
146 | ; set background |
147 | @@: |
147 | @@: |
148 | cmp eax, 'bgr' |
148 | cmp eax, 'bgr' |
149 | jne @f |
149 | jne @f |
150 | 150 | ||
151 | call set_as_bgr |
151 | call set_as_bgr |
152 | jmp still |
152 | jmp still |
153 | 153 | ||
154 | @@: |
154 | @@: |
155 | 155 | ||
156 | cmp eax, 'bck' |
156 | cmp eax, 'bck' |
157 | jnz @f |
157 | jnz @f |
158 | call prev_image |
158 | call prev_image |
159 | jmp still |
159 | jmp still |
160 | @@: |
160 | @@: |
161 | cmp eax, 'fwd' |
161 | cmp eax, 'fwd' |
162 | jnz @f |
162 | jnz @f |
163 | call next_image |
163 | call next_image |
164 | jmp still |
164 | jmp still |
165 | @@: |
165 | @@: |
166 | 166 | ||
167 | cmp eax, 1 |
167 | cmp eax, 1 |
168 | jne still |
168 | jne still |
169 | 169 | ||
170 | exit: |
170 | exit: |
171 | mcall -1 |
171 | mcall -1 |
172 | 172 | ||
173 | redraw_image = red |
173 | redraw_image = red |
174 | 174 | ||
175 | load_image: |
175 | load_image: |
176 | and [img_data], 0 |
176 | and [img_data], 0 |
177 | push eax |
177 | push eax |
178 | invoke file.open, eax, O_READ |
178 | invoke file.open, eax, O_READ |
179 | or eax, eax |
179 | or eax, eax |
180 | jz .error_pop |
180 | jz .error_pop |
181 | mov [fh], eax |
181 | mov [fh], eax |
182 | invoke file.size |
182 | invoke file.size |
183 | mov [img_data_len], ebx |
183 | mov [img_data_len], ebx |
184 | stdcall mem.Alloc, ebx |
184 | stdcall mem.Alloc, ebx |
185 | test eax, eax |
185 | test eax, eax |
186 | jz .error_close |
186 | jz .error_close |
187 | mov [img_data], eax |
187 | mov [img_data], eax |
188 | invoke file.read, [fh], eax, [img_data_len] |
188 | invoke file.read, [fh], eax, [img_data_len] |
189 | cmp eax, -1 |
189 | cmp eax, -1 |
190 | jz .error_close |
190 | jz .error_close |
191 | cmp eax, [img_data_len] |
191 | cmp eax, [img_data_len] |
192 | jnz .error_close |
192 | jnz .error_close |
193 | invoke file.close, [fh] |
193 | invoke file.close, [fh] |
194 | inc eax |
194 | inc eax |
195 | jz .error |
195 | jz .error |
196 | 196 | ||
197 | ; img.decode checks for img.is_img |
197 | ; img.decode checks for img.is_img |
198 | ; invoke img.is_img, [img_data], [img_data_len] |
198 | ; invoke img.is_img, [img_data], [img_data_len] |
199 | ; or eax, eax |
199 | ; or eax, eax |
200 | ; jz exit |
200 | ; jz exit |
201 | invoke img.decode, [img_data], [img_data_len] |
201 | invoke img.decode, [img_data], [img_data_len] |
202 | or eax, eax |
202 | or eax, eax |
203 | jz .error |
203 | jz .error |
204 | cmp [image], 0 |
204 | cmp [image], 0 |
205 | mov [image], eax |
205 | mov [image], eax |
206 | call update_image_sizes |
206 | call update_image_sizes |
207 | call free_img_data |
207 | call free_img_data |
208 | clc |
208 | clc |
209 | ret |
209 | ret |
210 | 210 | ||
211 | .error_free: |
211 | .error_free: |
212 | invoke img.destroy, [image] |
212 | invoke img.destroy, [image] |
213 | jmp .error |
213 | jmp .error |
214 | 214 | ||
215 | .error_pop: |
215 | .error_pop: |
216 | pop eax |
216 | pop eax |
217 | jmp .error |
217 | jmp .error |
218 | .error_close: |
218 | .error_close: |
219 | invoke file.close, [fh] |
219 | invoke file.close, [fh] |
220 | .error: |
220 | .error: |
221 | call free_img_data |
221 | call free_img_data |
222 | stc |
222 | stc |
223 | ret |
223 | ret |
224 | 224 | ||
225 | free_img_data: |
225 | free_img_data: |
226 | mov eax, [img_data] |
226 | mov eax, [img_data] |
227 | test eax, eax |
227 | test eax, eax |
228 | jz @f |
228 | jz @f |
229 | stdcall mem.Free, eax |
229 | stdcall mem.Free, eax |
230 | @@: |
230 | @@: |
231 | ret |
231 | ret |
232 | 232 | ||
233 | update_image_sizes: |
233 | update_image_sizes: |
234 | pushf |
234 | pushf |
235 | mov edx, [eax + Image.Width] |
235 | mov edx, [eax + Image.Width] |
- | 236 | mov [draw_width], edx |
|
236 | add edx, 19 |
237 | add edx, 19 |
237 | cmp edx, 40 + 25*9 |
238 | cmp edx, 40 + 25*9 |
238 | jae @f |
239 | jae @f |
239 | mov edx, 40 + 25*9 |
240 | mov edx, 40 + 25*9 |
240 | @@: |
241 | @@: |
241 | mov [wnd_width], edx |
242 | mov [wnd_width], edx |
242 | mov esi, [eax + Image.Height] |
243 | mov esi, [eax + Image.Height] |
- | 244 | mov [draw_height], esi |
|
243 | add esi, 44 |
245 | add esi, 44 |
244 | mov [wnd_height], esi |
246 | mov [wnd_height], esi |
245 | popf |
247 | popf |
246 | jz .no_resize |
248 | jz .no_resize |
247 | mcall 48, 4 |
249 | mcall 48, 4 |
248 | add esi, eax |
250 | add esi, eax |
249 | mcall 67,-1,-1 |
251 | mcall 67,-1,-1 |
250 | .no_resize: |
252 | .no_resize: |
251 | ret |
253 | ret |
252 | 254 | ||
253 | set_as_bgr: |
255 | set_as_bgr: |
254 | mov esi, [image] |
256 | mov esi, [image] |
255 | mov ecx, [esi + Image.Width] |
257 | mov ecx, [esi + Image.Width] |
256 | mov edx, [esi + Image.Height] |
258 | mov edx, [esi + Image.Height] |
257 | mcall 15, 1 |
259 | mcall 15, 1 |
258 | 260 | ||
259 | mcall 15, 6 |
261 | mcall 15, 6 |
260 | test eax, eax |
262 | test eax, eax |
261 | jz @f |
263 | jz @f |
262 | 264 | ||
263 | push eax |
265 | push eax |
264 | invoke img.to_rgb2, esi, eax |
266 | invoke img.to_rgb2, esi, eax |
265 | pop ecx |
267 | pop ecx |
266 | mcall 15, 7 |
268 | mcall 15, 7 |
267 | 269 | ||
268 | @@: |
270 | @@: |
269 | mcall 15, 3 |
271 | mcall 15, 3 |
270 | ret |
272 | ret |
271 | 273 | ||
272 | prev_image: |
274 | prev_image: |
273 | call load_directory |
275 | call load_directory |
274 | cmp [directory_ptr], 0 |
276 | cmp [directory_ptr], 0 |
275 | jz .ret |
277 | jz .ret |
276 | mov ebx, [directory_ptr] |
278 | mov ebx, [directory_ptr] |
277 | mov eax, [cur_file_idx] |
279 | mov eax, [cur_file_idx] |
278 | cmp eax, -1 |
280 | cmp eax, -1 |
279 | jnz @f |
281 | jnz @f |
280 | mov eax, [ebx+4] |
282 | mov eax, [ebx+4] |
281 | @@: |
283 | @@: |
282 | push [image] |
284 | push [image] |
283 | .scanloop: |
285 | .scanloop: |
284 | dec eax |
286 | dec eax |
285 | jns @f |
287 | jns @f |
286 | mov eax, [ebx+4] |
288 | mov eax, [ebx+4] |
287 | dec eax |
289 | dec eax |
288 | cmp [cur_file_idx], -1 |
290 | cmp [cur_file_idx], -1 |
289 | jz .notfound |
291 | jz .notfound |
290 | @@: |
292 | @@: |
291 | cmp eax, [cur_file_idx] |
293 | cmp eax, [cur_file_idx] |
292 | jz .notfound |
294 | jz .notfound |
293 | push eax |
295 | push eax ebx |
294 | imul esi, eax, 304 |
296 | imul esi, eax, 304 |
295 | add esi, [directory_ptr] |
297 | add esi, [directory_ptr] |
296 | add esi, 32 + 40 |
298 | add esi, 32 + 40 |
297 | mov edi, curdir |
299 | mov edi, curdir |
298 | @@: |
300 | @@: |
299 | inc edi |
301 | inc edi |
300 | cmp byte [edi-1], 0 |
302 | cmp byte [edi-1], 0 |
301 | jnz @b |
303 | jnz @b |
302 | mov byte [edi-1], '/' |
304 | mov byte [edi-1], '/' |
303 | @@: |
305 | @@: |
304 | lodsb |
306 | lodsb |
305 | stosb |
307 | stosb |
306 | test al, al |
308 | test al, al |
307 | jnz @b |
309 | jnz @b |
308 | mov eax, curdir |
310 | mov eax, curdir |
309 | call load_image |
311 | call load_image |
310 | pop eax |
312 | pushf |
311 | jc .scanloop |
- | |
312 | mov [cur_file_idx], eax |
- | |
313 | invoke img.destroy |
- | |
314 | mov esi, curdir |
313 | mov esi, curdir |
- | 314 | push esi |
|
315 | mov edi, @PARAMS |
315 | mov edi, @PARAMS |
316 | mov ecx, 512/4 |
316 | mov ecx, 512/4 |
317 | rep movsd |
317 | rep movsd |
318 | mov byte [edi-1], 0 |
318 | mov byte [edi-1], 0 |
- | 319 | pop esi |
|
- | 320 | @@: |
|
- | 321 | lodsb |
|
- | 322 | test al, al |
|
- | 323 | jnz @b |
|
- | 324 | @@: |
|
- | 325 | dec esi |
|
- | 326 | cmp byte [esi], '/' |
|
- | 327 | jnz @b |
|
- | 328 | mov byte [esi], 0 |
|
- | 329 | popf |
|
- | 330 | pop ebx eax |
|
- | 331 | jc .scanloop |
|
- | 332 | mov [cur_file_idx], eax |
|
- | 333 | invoke img.destroy |
|
319 | .ret: |
334 | .ret: |
320 | ret |
335 | ret |
321 | .notfound: |
336 | .notfound: |
322 | pop [image] |
337 | pop [image] |
323 | ret |
338 | ret |
324 | 339 | ||
325 | next_image: |
340 | next_image: |
326 | call load_directory |
341 | call load_directory |
327 | cmp [directory_ptr], 0 |
342 | cmp [directory_ptr], 0 |
328 | jz .ret |
343 | jz .ret |
329 | mov ebx, [directory_ptr] |
344 | mov ebx, [directory_ptr] |
330 | mov eax, [cur_file_idx] |
345 | mov eax, [cur_file_idx] |
331 | push [image] |
346 | push [image] |
332 | .scanloop: |
347 | .scanloop: |
333 | inc eax |
348 | inc eax |
334 | cmp eax, [ebx+4] |
349 | cmp eax, [ebx+4] |
335 | jb @f |
350 | jb @f |
336 | xor eax, eax |
351 | xor eax, eax |
337 | cmp [cur_file_idx], -1 |
352 | cmp [cur_file_idx], -1 |
338 | jz .notfound |
353 | jz .notfound |
339 | @@: |
354 | @@: |
340 | cmp eax, [cur_file_idx] |
355 | cmp eax, [cur_file_idx] |
341 | jz .notfound |
356 | jz .notfound |
342 | push eax ebx |
357 | push eax ebx |
343 | imul esi, eax, 304 |
358 | imul esi, eax, 304 |
344 | add esi, [directory_ptr] |
359 | add esi, [directory_ptr] |
345 | add esi, 32 + 40 |
360 | add esi, 32 + 40 |
346 | mov edi, curdir |
361 | mov edi, curdir |
347 | @@: |
362 | @@: |
348 | inc edi |
363 | inc edi |
349 | cmp byte [edi-1], 0 |
364 | cmp byte [edi-1], 0 |
350 | jnz @b |
365 | jnz @b |
351 | mov byte [edi-1], '/' |
366 | mov byte [edi-1], '/' |
352 | @@: |
367 | @@: |
353 | lodsb |
368 | lodsb |
354 | stosb |
369 | stosb |
355 | test al, al |
370 | test al, al |
356 | jnz @b |
371 | jnz @b |
357 | mov eax, curdir |
372 | mov eax, curdir |
358 | call load_image |
373 | call load_image |
359 | pop ebx eax |
374 | pushf |
360 | jc .scanloop |
- | |
361 | mov [cur_file_idx], eax |
- | |
362 | invoke img.destroy |
- | |
363 | mov esi, curdir |
375 | mov esi, curdir |
364 | push esi |
376 | push esi |
365 | mov edi, @PARAMS |
377 | mov edi, @PARAMS |
366 | mov ecx, 512/4 |
378 | mov ecx, 512/4 |
367 | rep movsd |
379 | rep movsd |
368 | mov byte [edi-1], 0 |
380 | mov byte [edi-1], 0 |
369 | pop esi |
381 | pop esi |
370 | @@: |
382 | @@: |
371 | lodsb |
383 | lodsb |
372 | test al, al |
384 | test al, al |
373 | jnz @b |
385 | jnz @b |
374 | @@: |
386 | @@: |
375 | dec esi |
387 | dec esi |
376 | cmp byte [esi], '/' |
388 | cmp byte [esi], '/' |
377 | jnz @b |
389 | jnz @b |
378 | mov byte [esi], 0 |
390 | mov byte [esi], 0 |
- | 391 | popf |
|
- | 392 | pop ebx eax |
|
- | 393 | jc .scanloop |
|
- | 394 | mov [cur_file_idx], eax |
|
- | 395 | invoke img.destroy |
|
379 | .ret: |
396 | .ret: |
380 | ret |
397 | ret |
381 | .notfound: |
398 | .notfound: |
382 | pop [image] |
399 | pop [image] |
383 | ret |
400 | ret |
384 | 401 | ||
385 | load_directory: |
402 | load_directory: |
386 | cmp [directory_ptr], 0 |
403 | cmp [directory_ptr], 0 |
387 | jnz .ret |
404 | jnz .ret |
388 | mov esi, @PARAMS |
405 | mov esi, @PARAMS |
389 | mov ecx, esi |
406 | mov ecx, esi |
390 | @@: |
407 | @@: |
391 | lodsb |
408 | lodsb |
392 | test al, al |
409 | test al, al |
393 | jnz @b |
410 | jnz @b |
394 | @@: |
411 | @@: |
395 | dec esi |
412 | dec esi |
396 | cmp byte [esi], '/' |
413 | cmp byte [esi], '/' |
397 | jnz @b |
414 | jnz @b |
398 | mov [last_name_component], esi |
415 | mov [last_name_component], esi |
399 | sub esi, ecx |
416 | sub esi, ecx |
400 | xchg ecx, esi |
417 | xchg ecx, esi |
401 | mov edi, curdir |
418 | mov edi, curdir |
402 | rep movsb |
419 | rep movsb |
403 | mov byte [edi], 0 |
420 | mov byte [edi], 0 |
404 | mcall 68, 12, 0x1000 |
421 | mcall 68, 12, 0x1000 |
405 | test eax, eax |
422 | test eax, eax |
406 | jz .ret |
423 | jz .ret |
407 | mov ebx, readdir_fileinfo |
424 | mov ebx, readdir_fileinfo |
408 | mov dword [ebx+12], (0x1000 - 32) / 304 |
425 | mov dword [ebx+12], (0x1000 - 32) / 304 |
409 | mov dword [ebx+16], eax |
426 | mov dword [ebx+16], eax |
410 | mcall 70 |
427 | mcall 70 |
411 | cmp eax, 6 |
428 | cmp eax, 6 |
412 | jz .dirok |
429 | jz .dirok |
413 | test eax, eax |
430 | test eax, eax |
414 | jnz free_directory |
431 | jnz free_directory |
415 | mov edx, [directory_ptr] |
432 | mov edx, [directory_ptr] |
416 | mov ecx, [edx+8] |
433 | mov ecx, [edx+8] |
417 | mov [readblocks], ecx |
434 | mov [readblocks], ecx |
418 | imul ecx, 304 |
435 | imul ecx, 304 |
419 | add ecx, 32 |
436 | add ecx, 32 |
420 | mcall 68, 20 |
437 | mcall 68, 20 |
421 | test eax, eax |
438 | test eax, eax |
422 | jz free_directory |
439 | jz free_directory |
423 | mov [directory_ptr], eax |
440 | mov [directory_ptr], eax |
424 | mcall 70, readdir_fileinfo |
441 | mcall 70, readdir_fileinfo |
425 | .dirok: |
442 | .dirok: |
426 | cmp ebx, 0 |
443 | cmp ebx, 0 |
427 | jle free_directory |
444 | jle free_directory |
428 | mov eax, [directory_ptr] |
445 | mov eax, [directory_ptr] |
429 | add eax, 32 |
446 | add eax, 32 |
430 | mov edi, eax |
447 | mov edi, eax |
431 | push 0 |
448 | push 0 |
432 | .dirskip: |
449 | .dirskip: |
433 | push eax |
450 | push eax |
434 | test byte [eax], 18h |
451 | test byte [eax], 18h |
435 | jnz .nocopy |
452 | jnz .nocopy |
436 | lea esi, [eax+40] |
453 | lea esi, [eax+40] |
437 | mov ecx, esi |
454 | mov ecx, esi |
438 | @@: |
455 | @@: |
439 | lodsb |
456 | lodsb |
440 | test al, al |
457 | test al, al |
441 | jnz @b |
458 | jnz @b |
442 | @@: |
459 | @@: |
443 | dec esi |
460 | dec esi |
444 | cmp esi, ecx |
461 | cmp esi, ecx |
445 | jb .noext |
462 | jb .noext |
446 | cmp byte [esi], '.' |
463 | cmp byte [esi], '.' |
447 | jnz @b |
464 | jnz @b |
448 | inc esi |
465 | inc esi |
449 | mov ecx, [esi] |
466 | mov ecx, [esi] |
450 | or ecx, 0x202020 |
467 | or ecx, 0x202020 |
451 | cmp ecx, 'jpg' |
468 | cmp ecx, 'jpg' |
452 | jz .copy |
469 | jz .copy |
453 | cmp ecx, 'bmp' |
470 | cmp ecx, 'bmp' |
454 | jz .copy |
471 | jz .copy |
455 | cmp ecx, 'gif' |
472 | cmp ecx, 'gif' |
456 | jz .copy |
473 | jz .copy |
457 | cmp ecx, 'png' |
474 | cmp ecx, 'png' |
458 | jz .copy |
475 | jz .copy |
459 | cmp ecx, 'jpe' |
476 | cmp ecx, 'jpe' |
460 | jz .copy |
477 | jz .copy |
461 | cmp ecx, 'jpeg' |
478 | cmp ecx, 'jpeg' |
462 | jz @f |
479 | jz @f |
463 | cmp ecx, 'jpeG' |
480 | cmp ecx, 'jpeG' |
464 | jnz .nocopy |
481 | jnz .nocopy |
465 | @@: |
482 | @@: |
466 | cmp byte [esi+4], 0 |
483 | cmp byte [esi+4], 0 |
467 | jnz .nocopy |
484 | jnz .nocopy |
468 | .copy: |
485 | .copy: |
469 | mov esi, [esp] |
486 | mov esi, [esp] |
470 | mov ecx, 304 / 4 |
487 | mov ecx, 304 / 4 |
471 | rep movsd |
488 | rep movsd |
472 | inc dword [esp+4] |
489 | inc dword [esp+4] |
473 | .nocopy: |
490 | .nocopy: |
474 | .noext: |
491 | .noext: |
475 | pop eax |
492 | pop eax |
476 | add eax, 304 |
493 | add eax, 304 |
477 | dec ebx |
494 | dec ebx |
478 | jnz .dirskip |
495 | jnz .dirskip |
479 | mov eax, [directory_ptr] |
496 | mov eax, [directory_ptr] |
480 | pop ebx |
497 | pop ebx |
481 | mov [eax+4], ebx |
498 | mov [eax+4], ebx |
482 | test ebx, ebx |
499 | test ebx, ebx |
483 | jz free_directory |
500 | jz free_directory |
484 | push 0 ; sort mode |
501 | push 0 ; sort mode |
485 | push ebx |
502 | push ebx |
486 | add eax, 32 |
503 | add eax, 32 |
487 | push eax |
504 | push eax |
488 | call [SortDir] |
505 | call [SortDir] |
489 | xor eax, eax |
506 | xor eax, eax |
490 | mov edi, [directory_ptr] |
507 | mov edi, [directory_ptr] |
491 | add edi, 32 + 40 |
508 | add edi, 32 + 40 |
492 | .scan: |
509 | .scan: |
493 | mov esi, [last_name_component] |
510 | mov esi, [last_name_component] |
494 | inc esi |
511 | inc esi |
495 | push edi |
512 | push edi |
496 | invoke strcmpi |
513 | invoke strcmpi |
497 | pop edi |
514 | pop edi |
498 | jz .found |
515 | jz .found |
499 | inc eax |
516 | inc eax |
500 | add edi, 304 |
517 | add edi, 304 |
501 | dec ebx |
518 | dec ebx |
502 | jnz .scan |
519 | jnz .scan |
503 | or eax, -1 |
520 | or eax, -1 |
504 | .found: |
521 | .found: |
505 | mov [cur_file_idx], eax |
522 | mov [cur_file_idx], eax |
506 | .ret: |
523 | .ret: |
507 | ret |
524 | ret |
508 | 525 | ||
509 | free_directory: |
526 | free_directory: |
510 | mcall 68, 13, [directory_ptr] |
527 | mcall 68, 13, [directory_ptr] |
511 | and [directory_ptr], 0 |
528 | and [directory_ptr], 0 |
512 | ret |
529 | ret |
513 | 530 | ||
514 | draw_window: |
531 | draw_window: |
- | 532 | cmp [bFirstDraw], 0 |
|
- | 533 | jz .posok |
|
- | 534 | or ecx, -1 |
|
- | 535 | mcall 9, procinfo |
|
- | 536 | ||
- | 537 | cmp dword [ebx + 66], 0 |
|
- | 538 | jle .noredraw |
|
- | 539 | ||
- | 540 | mov edx, ecx |
|
- | 541 | mov esi, ecx |
|
- | 542 | cmp dword [ebx + 42], 40 + 25 * 9 |
|
- | 543 | jae @f |
|
- | 544 | mov edx, 40 + 25 * 9 |
|
- | 545 | @@: |
|
- | 546 | cmp dword [ebx + 46], 70 |
|
- | 547 | jae @f |
|
- | 548 | mov esi, 70 |
|
- | 549 | @@: |
|
- | 550 | mov eax, edx |
|
- | 551 | and eax, esi |
|
- | 552 | cmp eax, -1 |
|
- | 553 | jz @f |
|
- | 554 | mov ebx, ecx |
|
- | 555 | mcall 67 |
|
- | 556 | @@: |
|
- | 557 | ||
- | 558 | .posok: |
|
- | 559 | mcall 12, 1 |
|
515 | mcall 48, 4 |
560 | mcall 48, 4 |
516 | mov ebp, eax ; save skin height |
561 | mov ebp, eax ; save skin height |
517 | add eax, [wnd_height] |
562 | add eax, [wnd_height] |
518 | __mov ebx, 100, 0 |
563 | __mov ebx, 100, 0 |
519 | add ebx, [wnd_width] |
564 | add ebx, [wnd_width] |
520 | lea ecx, [100*65536 + eax] |
565 | lea ecx, [100*65536 + eax] |
521 | mcall 0, , , 0x73FFFFFF, , s_header |
566 | mcall 0, , , 0x73FFFFFF, , s_header |
522 | 567 | ||
523 | mcall 9, procinfo, -1 |
568 | mcall 9, procinfo, -1 |
524 | - | ||
- | 569 | mov [bFirstDraw], 1 |
|
525 | mov ebx, [procinfo + 62] |
570 | mov ebx, [procinfo + 62] |
526 | inc ebx |
571 | inc ebx |
527 | mcall 13, , <0, 35>, 0xFFFFFF |
572 | mcall 13, , <0, 35>, 0xFFFFFF |
528 | mov ecx, [procinfo + 66] |
573 | mov ecx, [procinfo + 66] |
- | 574 | inc ecx |
|
- | 575 | mov esi, [draw_height] |
|
- | 576 | add esi, 35 |
|
529 | sub ecx, 4 |
577 | sub ecx, esi |
- | 578 | jbe @f |
|
- | 579 | push esi |
|
530 | shl ecx, 16 |
580 | shl esi, 16 |
531 | mov cl, 5 |
581 | add ecx, esi |
- | 582 | pop esi |
|
532 | mcall |
583 | mcall |
533 | mov cl, 35 |
584 | xor ecx, ecx |
- | 585 | @@: |
|
534 | ror ecx, 16 |
586 | add ecx, esi |
535 | sub cx, 35 |
587 | add ecx, 35*10000h - 35 |
536 | mov ebx, 5 |
588 | __mov ebx, 0, 5 |
537 | mcall |
589 | mcall |
538 | ; 5 pixels for indentation, [image.Width] pixels for image |
- | |
539 | ; client_width - 5 - [image.Width] pixels must be white |
- | |
540 | mov ebx, [image] |
- | |
541 | mov esi, [procinfo + 62] |
590 | mov esi, [draw_width] |
542 | inc esi |
591 | add esi, ebx |
543 | push esi |
- | |
544 | mov ebx, [ebx + Image.Width] |
592 | mov ebx, [procinfo+62] |
545 | sub esi, 5 |
- | |
546 | sub esi, ebx |
- | |
547 | pop ebx |
593 | inc ebx |
548 | sub ebx, esi |
594 | sub ebx, esi |
- | 595 | jbe @f |
|
549 | shl ebx, 16 |
596 | shl esi, 16 |
550 | add ebx, esi |
597 | add ebx, esi |
551 | mcall |
598 | mcall |
- | 599 | @@: |
|
552 | 600 | ||
553 | mov ebx, [procinfo + 62] |
601 | mov ebx, [procinfo + 62] |
554 | push ebx |
602 | push ebx |
555 | mcall 38, , <30, 30>, 0x007F7F7F |
603 | mcall 38, , <30, 30>, 0x007F7F7F |
556 | mcall , <5 + 25 * 1, 5 + 25 * 1>, <0, 30> |
604 | mcall , <5 + 25 * 1, 5 + 25 * 1>, <0, 30> |
557 | mcall , <10 + 25 * 3, 10 + 25 * 3> |
605 | mcall , <10 + 25 * 3, 10 + 25 * 3> |
558 | mcall , <15 + 25 * 4, 15 + 25 * 4> |
606 | mcall , <15 + 25 * 4, 15 + 25 * 4> |
559 | pop ebx |
607 | pop ebx |
560 | sub ebx, 25 * 5 + 10 |
608 | sub ebx, 25 * 5 + 10 |
561 | push ebx |
609 | push ebx |
562 | imul ebx, 10001h |
610 | imul ebx, 10001h |
563 | mcall |
611 | mcall |
564 | 612 | ||
565 | mcall 8, <5 + 25 * 0, 20>, <5, 20>, 'opn'+40000000h |
613 | mcall 8, <5 + 25 * 0, 20>, <5, 20>, 'opn'+40000000h |
566 | mcall , <10 + 25 * 1, 20>, , 'bck'+40000000h |
614 | mcall , <10 + 25 * 1, 20>, , 'bck'+40000000h |
567 | mcall , <10 + 25 * 2, 20>, , 'fwd'+40000000h |
615 | mcall , <10 + 25 * 2, 20>, , 'fwd'+40000000h |
568 | mcall , <15 + 25 * 3, 20>, , 'bgr'+40000000h |
616 | mcall , <15 + 25 * 3, 20>, , 'bgr'+40000000h |
569 | pop ebx |
617 | pop ebx |
570 | add ebx, 5 |
618 | add ebx, 5 |
571 | shl ebx, 16 |
619 | shl ebx, 16 |
572 | mov bl, 20 |
620 | mov bl, 20 |
573 | mcall , , , 'flh'+40000000h |
621 | mcall , , , 'flh'+40000000h |
574 | add ebx, 25 * 65536 |
622 | add ebx, 25 * 65536 |
575 | mcall , , , 'flv'+40000000h |
623 | mcall , , , 'flv'+40000000h |
576 | add ebx, 30 * 65536 |
624 | add ebx, 30 * 65536 |
577 | mcall , , , 'rtr'+40000000h |
625 | mcall , , , 'rtr'+40000000h |
578 | add ebx, 25 * 65536 |
626 | add ebx, 25 * 65536 |
579 | mcall , , , 'rtl'+40000000h |
627 | mcall , , , 'rtl'+40000000h |
580 | add ebx, 25 * 65536 |
628 | add ebx, 25 * 65536 |
581 | mcall , , , 'flb'+40000000h |
629 | mcall , , , 'flb'+40000000h |
582 | 630 | ||
583 | mov ebp, (numimages-1)*20 |
631 | mov ebp, (numimages-1)*20 |
584 | 632 | ||
585 | mcall 65, buttons+openbtn*20, <20, 20>, <5 + 25 * 0, 5>, 8, palette |
633 | mcall 65, buttons+openbtn*20, <20, 20>, <5 + 25 * 0, 5>, 8, palette |
586 | mcall , buttons+backbtn*20, , <10 + 25 * 1, 5> |
634 | mcall , buttons+backbtn*20, , <10 + 25 * 1, 5> |
587 | mcall , buttons+forwardbtn*20, , <10 + 25 * 2, 5> |
635 | mcall , buttons+forwardbtn*20, , <10 + 25 * 2, 5> |
588 | mcall , buttons+bgrbtn*20, , <15 + 25 * 3, 5> |
636 | mcall , buttons+bgrbtn*20, , <15 + 25 * 3, 5> |
589 | mov edx, [procinfo + 62] |
637 | mov edx, [procinfo + 62] |
590 | sub edx, 25 * 5 + 4 |
638 | sub edx, 25 * 5 + 4 |
591 | shl edx, 16 |
639 | shl edx, 16 |
592 | mov dl, 5 |
640 | mov dl, 5 |
593 | mcall , buttons+fliphorzbtn*20 |
641 | mcall , buttons+fliphorzbtn*20 |
594 | add edx, 25 * 65536 |
642 | add edx, 25 * 65536 |
595 | mcall , buttons+flipvertbtn*20 |
643 | mcall , buttons+flipvertbtn*20 |
596 | add edx, 30 * 65536 |
644 | add edx, 30 * 65536 |
597 | mcall , buttons+rotcwbtn*20 |
645 | mcall , buttons+rotcwbtn*20 |
598 | add edx, 25 * 65536 |
646 | add edx, 25 * 65536 |
599 | mcall , buttons+rotccwbtn*20 |
647 | mcall , buttons+rotccwbtn*20 |
600 | add edx, 25 * 65536 |
648 | add edx, 25 * 65536 |
601 | mcall , buttons+rot180btn*20 |
649 | mcall , buttons+rot180btn*20 |
602 | 650 | ||
603 | mov ebx, [image] |
651 | mov ebx, [image] |
- | 652 | mov ecx, [procinfo+62] |
|
- | 653 | sub ecx, 4 |
|
604 | mov ecx, [ebx + Image.Width] |
654 | mov ebp, [ebx + Image.Width] |
- | 655 | cmp ecx, ebp |
|
- | 656 | jb @f |
|
- | 657 | mov ecx, ebp |
|
- | 658 | @@: |
|
- | 659 | sub ebp, ecx |
|
- | 660 | mov edx, [procinfo+66] |
|
- | 661 | sub edx, 34 |
|
- | 662 | cmp edx, [ebx + Image.Height] |
|
- | 663 | jb @f |
|
- | 664 | mov edx, [ebx + Image.Height] |
|
- | 665 | @@: |
|
605 | shl ecx, 16 |
666 | shl ecx, 16 |
606 | add ecx, [ebx + Image.Height] |
667 | add ecx, edx |
607 | __mov edx, 5, 35 |
668 | __mov edx, 5, 35 |
608 | mov esi, 8 |
669 | mov esi, 8 |
609 | cmp [ebx + Image.Type], Image.bpp8 |
670 | cmp [ebx + Image.Type], Image.bpp8 |
610 | jz @f |
671 | jz .bpp8 |
611 | mov esi, 24 |
- | |
612 | cmp [ebx + Image.Type], Image.bpp24 |
672 | cmp [ebx + Image.Type], Image.bpp24 |
613 | jz @f |
673 | jz .bpp24 |
614 | mov esi, 32 |
674 | mov esi, 32 |
- | 675 | shl ebp, 2 |
|
- | 676 | jmp @f |
|
- | 677 | .bpp24: |
|
- | 678 | mov esi, 24 |
|
- | 679 | lea ebp, [ebp*3] |
|
- | 680 | .bpp8: |
|
615 | @@: |
681 | @@: |
616 | mov edi, [ebx + Image.Palette] |
682 | mov edi, [ebx + Image.Palette] |
617 | mov ebx, [ebx + Image.Data] |
683 | mov ebx, [ebx + Image.Data] |
618 | xor ebp, ebp |
- | |
619 | mcall 65 |
684 | mcall 65 |
- | 685 | ||
- | 686 | mcall 12, 2 |
|
- | 687 | ||
620 | 688 | .noredraw: |
|
621 | ret |
689 | ret |
622 | 690 | ||
623 | ; void* __stdcall mem.Alloc(unsigned size); |
691 | ; void* __stdcall mem.Alloc(unsigned size); |
624 | mem.Alloc: |
692 | mem.Alloc: |
625 | push ebx ecx |
693 | push ebx ecx |
626 | mov ecx, [esp+12] |
694 | mov ecx, [esp+12] |
627 | mcall 68, 12 |
695 | mcall 68, 12 |
628 | pop ecx ebx |
696 | pop ecx ebx |
629 | ret 4 |
697 | ret 4 |
630 | 698 | ||
631 | ; void* __stdcall mem.ReAlloc(void* mptr, unsigned size); |
699 | ; void* __stdcall mem.ReAlloc(void* mptr, unsigned size); |
632 | mem.ReAlloc: |
700 | mem.ReAlloc: |
633 | push ebx ecx edx |
701 | push ebx ecx edx |
634 | mov edx, [esp+16] |
702 | mov edx, [esp+16] |
635 | mov ecx, [esp+20] |
703 | mov ecx, [esp+20] |
636 | mcall 68, 20 |
704 | mcall 68, 20 |
637 | pop edx ecx ebx |
705 | pop edx ecx ebx |
638 | ret 8 |
706 | ret 8 |
639 | 707 | ||
640 | ; void __stdcall mem.Free(void* mptr); |
708 | ; void __stdcall mem.Free(void* mptr); |
641 | mem.Free: |
709 | mem.Free: |
642 | push ebx ecx |
710 | push ebx ecx |
643 | mov ecx, [esp+12] |
711 | mov ecx, [esp+12] |
644 | mcall 68, 13 |
712 | mcall 68, 13 |
645 | pop ecx ebx |
713 | pop ecx ebx |
646 | ret 4 |
714 | ret 4 |
647 | 715 | ||
648 | ;----------------------------------------------------------------------------- |
716 | ;----------------------------------------------------------------------------- |
649 | 717 | ||
650 | s_header db 'Kolibri Image Viewer', 0 |
718 | s_header db 'Kolibri Image Viewer', 0 |
651 | 719 | ||
652 | ;----------------------------------------------------------------------------- |
720 | ;----------------------------------------------------------------------------- |
653 | 721 | ||
654 | opendialog: |
722 | opendialog: |
655 | ; |
723 | ; |
656 | ; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, |
724 | ; STEP 1 Run SYSXTREE with parametrs MYPID 4 bytes in dec, |
657 | ; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) |
725 | ; 1 byte space, 1 byte type of dialog (O - Open ,S - Save) |
658 | ; |
726 | ; |
659 | 727 | ||
660 | ;; mov esi,path |
728 | ;; mov esi,path |
661 | mov edi,path |
729 | mov edi,path |
662 | xor eax,eax |
730 | xor eax,eax |
663 | mov ecx,(1024+16)/4 |
731 | mov ecx,(1024+16)/4 |
664 | rep stosd |
732 | rep stosd |
665 | 733 | ||
666 | ;mov [get_loops],0 |
734 | ;mov [get_loops],0 |
667 | mov [dlg_pid_get],0 |
735 | mov [dlg_pid_get],0 |
668 | 736 | ||
669 | ; Get my PID in dec format 4 bytes |
737 | ; Get my PID in dec format 4 bytes |
670 | mov eax,9 |
738 | mov eax,9 |
671 | mov ebx,procinfo |
739 | mov ebx,procinfo |
672 | or ecx,-1 |
740 | or ecx,-1 |
673 | mcall |
741 | mcall |
674 | 742 | ||
675 | ; convert eax bin to param dec |
743 | ; convert eax bin to param dec |
676 | mov eax,dword [procinfo+30] ;offset of myPID |
744 | mov eax,dword [procinfo+30] ;offset of myPID |
677 | mov edi,param+4-1 ;offset to 4 bytes |
745 | mov edi,param+4-1 ;offset to 4 bytes |
678 | mov ecx,4 |
746 | mov ecx,4 |
679 | mov ebx,10 |
747 | mov ebx,10 |
680 | new_d: |
748 | new_d: |
681 | xor edx,edx |
749 | xor edx,edx |
682 | div ebx |
750 | div ebx |
683 | add dl,'0' |
751 | add dl,'0' |
684 | mov [edi],dl |
752 | mov [edi],dl |
685 | dec edi |
753 | dec edi |
686 | loop new_d |
754 | loop new_d |
687 | 755 | ||
688 | ; wirite 1 byte space to param |
756 | ; wirite 1 byte space to param |
689 | mov [param+4],byte 32 ;Space for next parametr |
757 | mov [param+4],byte 32 ;Space for next parametr |
690 | ; and 1 byte type of dialog to param |
758 | ; and 1 byte type of dialog to param |
691 | mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog) |
759 | mov [param+5],byte 'O' ;Get Open dialog (Use 'S' for Save dialog) |
692 | 760 | ||
693 | ; |
761 | ; |
694 | ; STEP2 prepare IPC area for get messages |
762 | ; STEP2 prepare IPC area for get messages |
695 | ; |
763 | ; |
696 | 764 | ||
697 | ; prepare IPC area |
765 | ; prepare IPC area |
698 | mov [path],dword 0 |
766 | mov [path],dword 0 |
699 | mov [path+4],dword 8 |
767 | mov [path+4],dword 8 |
700 | 768 | ||
701 | ; define IPC memory |
769 | ; define IPC memory |
702 | mov eax,60 |
770 | mov eax,60 |
703 | mov ebx,1 ; define IPC |
771 | mov ebx,1 ; define IPC |
704 | mov ecx,path ; offset of area |
772 | mov ecx,path ; offset of area |
705 | mov edx,1024+16 ; size |
773 | mov edx,1024+16 ; size |
706 | mcall |
774 | mcall |
707 | 775 | ||
708 | ; change wanted events list 7-bit IPC event |
776 | ; change wanted events list 7-bit IPC event |
709 | mov eax,40 |
777 | mov eax,40 |
710 | mov ebx,01000111b |
778 | mov ebx,01000111b |
711 | cmp [image], 0 |
779 | cmp [image], 0 |
712 | jnz @f |
780 | jnz @f |
713 | mov bl, 01000110b |
781 | mov bl, 01000110b |
714 | @@: |
782 | @@: |
715 | mcall |
783 | mcall |
716 | 784 | ||
717 | ; |
785 | ; |
718 | ; STEP 3 run SYSTEM XTREE with parameters |
786 | ; STEP 3 run SYSTEM XTREE with parameters |
719 | ; |
787 | ; |
720 | 788 | ||
721 | mov eax,70 |
789 | mov eax,70 |
722 | mov ebx,run_fileinfo |
790 | mov ebx,run_fileinfo |
723 | mcall |
791 | mcall |
724 | 792 | ||
725 | mov [get_loops],0 |
793 | mov [get_loops],0 |
726 | getmesloop: |
794 | getmesloop: |
727 | mov eax,23 |
795 | mov eax,23 |
728 | mov ebx,50 ;0.5 sec |
796 | mov ebx,50 ;0.5 sec |
729 | mcall |
797 | mcall |
730 | dec eax |
798 | dec eax |
731 | jz mred |
799 | jz mred |
732 | dec eax |
800 | dec eax |
733 | jz mkey |
801 | jz mkey |
734 | dec eax |
802 | dec eax |
735 | jz mbutton |
803 | jz mbutton |
736 | cmp al, 7-3 |
804 | cmp al, 7-3 |
737 | jz mgetmes |
805 | jz mgetmes |
738 | 806 | ||
739 | ; Get number of procces |
807 | ; Get number of procces |
740 | mov ebx,procinfo |
808 | mov ebx,procinfo |
741 | mov ecx,-1 |
809 | mov ecx,-1 |
742 | mov eax,9 |
810 | mov eax,9 |
743 | mcall |
811 | mcall |
744 | mov ebp,eax |
812 | mov ebp,eax |
745 | 813 | ||
746 | loox: |
814 | loox: |
747 | mov eax,9 |
815 | mov eax,9 |
748 | mov ebx,procinfo |
816 | mov ebx,procinfo |
749 | mov ecx,ebp |
817 | mov ecx,ebp |
750 | mcall |
818 | mcall |
751 | mov eax,[DLGPID] |
819 | mov eax,[DLGPID] |
752 | cmp [procinfo+30],eax ;IF Dialog find |
820 | cmp [procinfo+30],eax ;IF Dialog find |
753 | je dlg_is_work ;jmp to dlg_is_work |
821 | je dlg_is_work ;jmp to dlg_is_work |
754 | dec ebp |
822 | dec ebp |
755 | jnz loox |
823 | jnz loox |
756 | 824 | ||
757 | jmp erroff |
825 | jmp erroff |
758 | 826 | ||
759 | dlg_is_work: |
827 | dlg_is_work: |
760 | cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated |
828 | cmp [procinfo+50],word 9 ;If slot state 9 - dialog is terminated |
761 | je erroff ;TESTODP2 terminated too |
829 | je erroff ;TESTODP2 terminated too |
762 | 830 | ||
763 | cmp [dlg_pid_get],dword 1 |
831 | cmp [dlg_pid_get],dword 1 |
764 | je getmesloop |
832 | je getmesloop |
765 | inc [get_loops] |
833 | inc [get_loops] |
766 | cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated |
834 | cmp [get_loops],4 ;2 sec if DLG_PID not get, TESTOP2 terminated |
767 | jae erroff |
835 | jae erroff |
768 | jmp getmesloop |
836 | jmp getmesloop |
769 | 837 | ||
770 | mred: |
838 | mred: |
771 | cmp [image], 0 |
839 | cmp [image], 0 |
772 | jz getmesloop |
840 | jz getmesloop |
773 | call draw_window |
841 | call draw_window |
774 | jmp getmesloop |
842 | jmp getmesloop |
775 | mkey: |
843 | mkey: |
776 | mov eax,2 |
844 | mov eax,2 |
777 | mcall ; read (eax=2) |
845 | mcall ; read (eax=2) |
778 | jmp getmesloop |
846 | jmp getmesloop |
779 | mbutton: |
847 | mbutton: |
780 | mov eax,17 ; get id |
848 | mov eax,17 ; get id |
781 | mcall |
849 | mcall |
782 | cmp ah,1 ; button id=1 ? |
850 | cmp ah,1 ; button id=1 ? |
783 | jne getmesloop |
851 | jne getmesloop |
784 | mov eax,-1 ; close this program |
852 | mov eax,-1 ; close this program |
785 | mcall |
853 | mcall |
786 | mgetmes: |
854 | mgetmes: |
787 | 855 | ||
788 | ; If dlg_pid_get then second message get jmp to still |
856 | ; If dlg_pid_get then second message get jmp to still |
789 | cmp [dlg_pid_get],dword 1 |
857 | cmp [dlg_pid_get],dword 1 |
790 | je ready |
858 | je ready |
791 | 859 | ||
792 | ; First message is number of PID SYSXTREE dialog |
860 | ; First message is number of PID SYSXTREE dialog |
793 | 861 | ||
794 | ; convert PID dec to PID bin |
862 | ; convert PID dec to PID bin |
795 | movzx eax,byte [path+16] |
863 | movzx eax,byte [path+16] |
796 | sub eax,48 |
864 | sub eax,48 |
797 | imul eax,10 |
865 | imul eax,10 |
798 | movzx ebx,byte [path+16+1] |
866 | movzx ebx,byte [path+16+1] |
799 | add eax,ebx |
867 | add eax,ebx |
800 | sub eax,48 |
868 | sub eax,48 |
801 | imul eax,10 |
869 | imul eax,10 |
802 | movzx ebx,byte [path+16+2] |
870 | movzx ebx,byte [path+16+2] |
803 | add eax,ebx |
871 | add eax,ebx |
804 | sub eax,48 |
872 | sub eax,48 |
805 | imul eax,10 |
873 | imul eax,10 |
806 | movzx ebx,byte [path+16+3] |
874 | movzx ebx,byte [path+16+3] |
807 | add eax,ebx |
875 | add eax,ebx |
808 | sub eax,48 |
876 | sub eax,48 |
809 | mov [DLGPID],eax |
877 | mov [DLGPID],eax |
810 | 878 | ||
811 | ; Claear and prepare IPC area for next message |
879 | ; Claear and prepare IPC area for next message |
812 | mov [path],dword 0 |
880 | mov [path],dword 0 |
813 | mov [path+4],dword 8 |
881 | mov [path+4],dword 8 |
814 | mov [path+8],dword 0 |
882 | mov [path+8],dword 0 |
815 | mov [path+12],dword 0 |
883 | mov [path+12],dword 0 |
816 | mov [path+16],dword 0 |
884 | mov [path+16],dword 0 |
817 | 885 | ||
818 | ; Set dlg_pid_get for get next message |
886 | ; Set dlg_pid_get for get next message |
819 | mov [dlg_pid_get],dword 1 |
887 | mov [dlg_pid_get],dword 1 |
820 | cmp [image], 0 |
888 | cmp [image], 0 |
821 | jz getmesloop |
889 | jz getmesloop |
822 | call draw_window |
890 | call draw_window |
823 | jmp getmesloop |
891 | jmp getmesloop |
824 | 892 | ||
825 | ready: |
893 | ready: |
826 | ; |
894 | ; |
827 | ; The second message get |
895 | ; The second message get |
828 | ; Second message is 100 bytes path to SAVE/OPEN file |
896 | ; Second message is 100 bytes path to SAVE/OPEN file |
829 | ; shl path string on 16 bytes |
897 | ; shl path string on 16 bytes |
830 | ; |
898 | ; |
831 | mov esi,path+16 |
899 | mov esi,path+16 |
832 | mov edi,path |
900 | mov edi,path |
833 | mov ecx,1024/4 |
901 | mov ecx,1024/4 |
834 | rep movsd |
902 | rep movsd |
835 | mov [edi],byte 0 |
903 | mov [edi],byte 0 |
836 | 904 | ||
837 | openoff: |
905 | openoff: |
838 | mcall 40, 7 |
906 | mcall 40, 7 |
839 | clc |
907 | clc |
840 | ret |
908 | ret |
841 | 909 | ||
842 | erroff: |
910 | erroff: |
843 | mcall 40, 7 |
911 | mcall 40, 7 |
844 | stc |
912 | stc |
845 | ret |
913 | ret |
846 | 914 | ||
847 | ;----------------------------------------------------------------------------- |
915 | ;----------------------------------------------------------------------------- |
848 | 916 | ||
849 | align 4 |
917 | align 4 |
850 | @IMPORT: |
918 | @IMPORT: |
851 | 919 | ||
852 | library \ |
920 | library \ |
853 | libio , 'libio.obj' , \ |
921 | libio , 'libio.obj' , \ |
854 | libgfx , 'libgfx.obj' , \ |
922 | libgfx , 'libgfx.obj' , \ |
855 | libimg , 'libimg.obj' , \ |
923 | libimg , 'libimg.obj' , \ |
856 | sort , 'sort.obj' |
924 | sort , 'sort.obj' |
857 | 925 | ||
858 | import libio , \ |
926 | import libio , \ |
859 | libio.init , 'lib_init' , \ |
927 | libio.init , 'lib_init' , \ |
860 | file.size , 'file.size' , \ |
928 | file.size , 'file.size' , \ |
861 | file.open , 'file.open' , \ |
929 | file.open , 'file.open' , \ |
862 | file.read , 'file.read' , \ |
930 | file.read , 'file.read' , \ |
863 | file.close , 'file.close' |
931 | file.close , 'file.close' |
864 | 932 | ||
865 | import libgfx , \ |
933 | import libgfx , \ |
866 | libgfx.init , 'lib_init' , \ |
934 | libgfx.init , 'lib_init' , \ |
867 | gfx.open , 'gfx.open' , \ |
935 | gfx.open , 'gfx.open' , \ |
868 | gfx.close , 'gfx.close' , \ |
936 | gfx.close , 'gfx.close' , \ |
869 | gfx.pen.color , 'gfx.pen.color' , \ |
937 | gfx.pen.color , 'gfx.pen.color' , \ |
870 | gfx.line , 'gfx.line' |
938 | gfx.line , 'gfx.line' |
871 | 939 | ||
872 | import libimg , \ |
940 | import libimg , \ |
873 | libimg.init , 'lib_init' , \ |
941 | libimg.init , 'lib_init' , \ |
874 | img.is_img , 'img.is_img' , \ |
942 | img.is_img , 'img.is_img' , \ |
875 | img.to_rgb2 , 'img.to_rgb2', \ |
943 | img.to_rgb2 , 'img.to_rgb2', \ |
876 | img.decode , 'img.decode' , \ |
944 | img.decode , 'img.decode' , \ |
877 | img.flip , 'img.flip' , \ |
945 | img.flip , 'img.flip' , \ |
878 | img.rotate , 'img.rotate' , \ |
946 | img.rotate , 'img.rotate' , \ |
879 | img.destroy , 'img.destroy' |
947 | img.destroy , 'img.destroy' |
880 | 948 | ||
881 | import sort, sort.START, 'START', SortDir, 'SortDir', strcmpi, 'strcmpi' |
949 | import sort, sort.START, 'START', SortDir, 'SortDir', strcmpi, 'strcmpi' |
- | 950 | ||
882 | 951 | bFirstDraw db 0 |
|
883 | ;----------------------------------------------------------------------------- |
952 | ;----------------------------------------------------------------------------- |
884 | 953 | ||
885 | virtual at 0 |
954 | virtual at 0 |
886 | file 'kivicons.bmp':0xA,4 |
955 | file 'kivicons.bmp':0xA,4 |
887 | load offbits dword from 0 |
956 | load offbits dword from 0 |
888 | end virtual |
957 | end virtual |
889 | numimages = 9 |
958 | numimages = 9 |
890 | openbtn = 0 |
959 | openbtn = 0 |
891 | backbtn = 1 |
960 | backbtn = 1 |
892 | forwardbtn = 2 |
961 | forwardbtn = 2 |
893 | bgrbtn = 3 |
962 | bgrbtn = 3 |
894 | fliphorzbtn = 4 |
963 | fliphorzbtn = 4 |
895 | flipvertbtn = 5 |
964 | flipvertbtn = 5 |
896 | rotcwbtn = 6 |
965 | rotcwbtn = 6 |
897 | rotccwbtn = 7 |
966 | rotccwbtn = 7 |
898 | rot180btn = 8 |
967 | rot180btn = 8 |
899 | 968 | ||
900 | palette: |
969 | palette: |
901 | file 'kivicons.bmp':0x36,offbits-0x36 |
970 | file 'kivicons.bmp':0x36,offbits-0x36 |
902 | buttons: |
971 | buttons: |
903 | file 'kivicons.bmp':offbits |
972 | file 'kivicons.bmp':offbits |
904 | repeat 10 |
973 | repeat 10 |
905 | y = % - 1 |
974 | y = % - 1 |
906 | z = 20 - % |
975 | z = 20 - % |
907 | repeat numimages*5 |
976 | repeat numimages*5 |
908 | load a dword from $ - numimages*20*20 + numimages*20*y + (%-1)*4 |
977 | load a dword from $ - numimages*20*20 + numimages*20*y + (%-1)*4 |
909 | load b dword from $ - numimages*20*20 + numimages*20*z + (%-1)*4 |
978 | load b dword from $ - numimages*20*20 + numimages*20*z + (%-1)*4 |
910 | store dword a at $ - numimages*20*20 + numimages*20*z + (%-1)*4 |
979 | store dword a at $ - numimages*20*20 + numimages*20*z + (%-1)*4 |
911 | store dword b at $ - numimages*20*20 + numimages*20*y + (%-1)*4 |
980 | store dword b at $ - numimages*20*20 + numimages*20*y + (%-1)*4 |
912 | end repeat |
981 | end repeat |
913 | end repeat |
982 | end repeat |
914 | 983 | ||
915 | ; DATA AREA |
984 | ; DATA AREA |
916 | get_loops dd 0 |
985 | get_loops dd 0 |
917 | dlg_pid_get dd 0 |
986 | dlg_pid_get dd 0 |
918 | DLGPID dd 0 |
987 | DLGPID dd 0 |
919 | 988 | ||
920 | param: |
989 | param: |
921 | dd 0 ; My dec PID |
990 | dd 0 ; My dec PID |
922 | dd 0,0 ; Type of dialog |
991 | dd 0,0 ; Type of dialog |
923 | 992 | ||
924 | run_fileinfo: |
993 | run_fileinfo: |
925 | dd 7 |
994 | dd 7 |
926 | dd 0 |
995 | dd 0 |
927 | dd param |
996 | dd param |
928 | dd 0 |
997 | dd 0 |
929 | dd 0 |
998 | dd 0 |
930 | ;run_filepath |
999 | ;run_filepath |
931 | db '/sys/SYSXTREE',0 |
1000 | db '/sys/SYSXTREE',0 |
932 | 1001 | ||
933 | readdir_fileinfo: |
1002 | readdir_fileinfo: |
934 | dd 1 |
1003 | dd 1 |
935 | dd 0 |
1004 | dd 0 |
936 | dd 0 |
1005 | dd 0 |
937 | readblocks dd 0 |
1006 | readblocks dd 0 |
938 | directory_ptr dd 0 |
1007 | directory_ptr dd 0 |
939 | 1008 | ||
940 | ;----------------------------------------------------------------------------- |
1009 | ;----------------------------------------------------------------------------- |
941 | 1010 | ||
942 | I_END: |
1011 | I_END: |
943 | 1012 | ||
944 | curdir rb 1024 |
1013 | curdir rb 1024 |
945 | 1014 | ||
946 | align 4 |
1015 | align 4 |
947 | img_data dd ? |
1016 | img_data dd ? |
948 | img_data_len dd ? |
1017 | img_data_len dd ? |
949 | fh dd ? |
1018 | fh dd ? |
950 | image dd ? |
1019 | image dd ? |
951 | wnd_width dd ? |
1020 | wnd_width dd ? |
952 | wnd_height dd ? |
1021 | wnd_height dd ? |
- | 1022 | draw_width dd ? |
|
- | 1023 | draw_height dd ? |
|
953 | last_name_component dd ? |
1024 | last_name_component dd ? |
954 | cur_file_idx dd ? |
1025 | cur_file_idx dd ? |
955 | 1026 | ||
956 | ctx dd ? |
1027 | ctx dd ? |
957 | 1028 | ||
958 | procinfo: rb 1024 |
1029 | procinfo: rb 1024 |
959 | path: rb 1024+16 |
1030 | path: rb 1024+16 |
960 | 1031 | ||
961 | @PARAMS rb 51215>10>10>5>20,>15>10>10>5,>5>15>10>0,>5>30,>0,> |
1032 | @PARAMS rb 51215>10>10>5>20,>15>10>10>5,>5>15>10>0,>5>30,>0,> |