Rev 997 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
180 | heavyiron | 1 | virtual at 0 |
2 | viewer_data: |
||
814 | diamond | 3 | .hPlugin dd ? |
4 | .hFile dd ? |
||
180 | heavyiron | 5 | .buf_start dq ? |
6 | .cur_pos dq ? |
||
7 | .filesize dq ? |
||
8 | .buf_pos dd ? |
||
9 | .buf_size dd ? |
||
10 | .col dq ? |
||
589 | diamond | 11 | .hWorkFile dd ? |
180 | heavyiron | 12 | .encoding db ? |
13 | .flags db ? ; & 1: hex mode |
||
14 | ; & 2: unwrap |
||
474 | diamond | 15 | ; & 4: big-endian unicode |
814 | diamond | 16 | .bEofReached db ? |
180 | heavyiron | 17 | rb 1 |
997 | diamond | 18 | .selected_start dq ? |
19 | .selected_len dq ? |
||
814 | diamond | 20 | align 200h |
180 | heavyiron | 21 | .filename rb 1024 |
589 | diamond | 22 | .hostname rb 1024 |
180 | heavyiron | 23 | .buf rb 16384 |
24 | .size = $ |
||
25 | end virtual |
||
26 | |||
27 | view_file: |
||
997 | diamond | 28 | push eax ecx |
474 | diamond | 29 | mov ecx, viewer_data.size |
180 | heavyiron | 30 | mov edx, viewer_vtable |
31 | call new_screen |
||
474 | diamond | 32 | pop ecx |
180 | heavyiron | 33 | test eax, eax |
997 | diamond | 34 | pop eax |
180 | heavyiron | 35 | jnz @f |
36 | ret |
||
37 | @@: |
||
997 | diamond | 38 | test eax, eax |
39 | jz .frompanel |
||
40 | and dword [ebp+viewer_data.hPlugin], 0 |
||
41 | and dword [ebp+viewer_data.hFile], 0 |
||
42 | mov byte [ebp+viewer_data.hostname], 0 |
||
43 | lea edi, [ebp+viewer_data.filename] |
||
44 | push edi |
||
45 | @@: |
||
46 | lodsb |
||
47 | stosb |
||
48 | test al, al |
||
49 | jnz @b |
||
50 | jmp .namecopied |
||
51 | .frompanel: |
||
589 | diamond | 52 | mov eax, dword [esi+panel1_hPlugin-panel1_dir] |
53 | mov [ebp+viewer_data.hPlugin], eax |
||
54 | test eax, eax |
||
55 | jz .nocopyhostname |
||
56 | lea edi, [ebp+viewer_data.hostname] |
||
57 | push esi |
||
58 | mov eax, dword [esi+panel1_parents-panel1_dir] |
||
59 | mov esi, dword [esi+panel1_parents_sz-panel1_dir] |
||
60 | add esi, eax |
||
61 | @@: |
||
62 | dec esi |
||
63 | cmp byte [esi-1], 0 |
||
64 | jz @f |
||
65 | cmp byte [esi-1], '/' |
||
66 | jnz @b |
||
67 | @@: |
||
68 | lodsb |
||
69 | stosb |
||
70 | test al, al |
||
71 | jnz @b |
||
72 | pop esi |
||
73 | .nocopyhostname: |
||
74 | mov eax, dword [esi+panel1_hFile-panel1_dir] |
||
75 | mov [ebp+viewer_data.hFile], eax |
||
180 | heavyiron | 76 | lea edi, [ebp+viewer_data.filename] |
77 | push edi |
||
78 | @@: |
||
79 | lodsb |
||
80 | test al, al |
||
81 | jz @f |
||
82 | stosb |
||
83 | jmp @b |
||
84 | @@: |
||
85 | lea esi, [ecx+40] |
||
589 | diamond | 86 | cmp byte [edi-1], '/' |
87 | jz @f |
||
180 | heavyiron | 88 | mov al, '/' |
89 | stosb |
||
90 | @@: |
||
91 | lodsb |
||
92 | stosb |
||
93 | test al, al |
||
94 | jnz @b |
||
997 | diamond | 95 | .namecopied: |
96 | xor eax, eax |
||
97 | mov [ebp+viewer_data.encoding], al ;encodings.cp866 = 0 |
||
98 | mov [ebp+viewer_data.flags], al |
||
99 | mov dword [ebp+viewer_data.col], eax |
||
100 | mov dword [ebp+viewer_data.col+4], eax |
||
101 | call viewer_clear_selection |
||
180 | heavyiron | 102 | pop eax |
103 | mov ebx, attrinfo |
||
104 | mov [ebx+21], eax |
||
1122 | diamond | 105 | mov [readinfo.name], eax |
321 | diamond | 106 | .attr_retry: |
589 | diamond | 107 | mov edx, [ebp+viewer_data.hPlugin] |
108 | test edx, edx |
||
109 | jz .attr_native |
||
110 | push ebp |
||
111 | push dword [ebx+16] |
||
112 | push eax |
||
113 | push [ebp+viewer_data.hFile] |
||
114 | call [edx+PluginInfo.getattr] |
||
115 | pop ebp |
||
116 | jmp .attr_common |
||
117 | .attr_native: |
||
180 | heavyiron | 118 | push 70 |
119 | pop eax |
||
517 | diamond | 120 | int 40h |
589 | diamond | 121 | .attr_common: |
321 | diamond | 122 | test eax, eax |
123 | jz @f |
||
124 | lea ebx, [ebp+viewer_data.filename] |
||
125 | push ebx |
||
126 | push aCannotReadFile |
||
127 | call get_error_msg |
||
128 | push eax |
||
129 | mov eax, esp |
||
130 | push RetryOrCancelBtn |
||
131 | push 2 |
||
132 | push eax |
||
133 | push 3 |
||
134 | call SayErr |
||
135 | add esp, 3*4 |
||
136 | mov ebx, attrinfo |
||
137 | test eax, eax |
||
138 | jz .attr_retry |
||
589 | diamond | 139 | pop eax |
321 | diamond | 140 | jmp delete_active_screen |
141 | @@: |
||
180 | heavyiron | 142 | mov eax, dword [attrinfo.attr+32] |
143 | mov dword [ebp+viewer_data.filesize], eax |
||
144 | mov eax, dword [attrinfo.attr+36] |
||
145 | mov dword [ebp+viewer_data.filesize+4], eax |
||
146 | mov ebx, readinfo |
||
147 | xor eax, eax |
||
148 | mov dword [ebx+readinfo.first-readinfo], eax |
||
149 | mov dword [ebx+readinfo.first+4-readinfo], eax |
||
150 | mov dword [ebp+viewer_data.buf_start], eax |
||
151 | mov dword [ebp+viewer_data.buf_start+4], eax |
||
152 | mov dword [ebp+viewer_data.cur_pos], eax |
||
153 | mov dword [ebp+viewer_data.cur_pos+4], eax |
||
154 | mov [ebx+readinfo.size-readinfo], 16384 |
||
155 | lea eax, [ebp+viewer_data.buf] |
||
156 | mov [readinfo.data], eax |
||
157 | mov [ebp+viewer_data.buf_pos], eax |
||
589 | diamond | 158 | mov eax, [ebp+viewer_data.hPlugin] |
159 | test eax, eax |
||
160 | jz .retry |
||
161 | push ebx ebp |
||
162 | push O_READ |
||
163 | push dword [readinfo.name] |
||
164 | push [ebp+viewer_data.hFile] |
||
165 | call [eax+PluginInfo.open] |
||
166 | pop ebp ebx |
||
167 | mov [ebp+viewer_data.hWorkFile], eax |
||
168 | test eax, eax |
||
169 | jnz .retry |
||
814 | diamond | 170 | ..openerr_in_screen: |
589 | diamond | 171 | push ContinueBtn |
172 | push 1 |
||
173 | push aCannotOpenFile_ptr |
||
174 | push 1 |
||
175 | call SayErr |
||
176 | jmp delete_active_screen |
||
321 | diamond | 177 | .retry: |
589 | diamond | 178 | mov eax, [ebp+viewer_data.hPlugin] |
179 | test eax, eax |
||
180 | jz .read_native |
||
181 | push ebp |
||
182 | push 16384 |
||
183 | push [ebx+readinfo.data-readinfo] |
||
184 | push [ebp+viewer_data.hWorkFile] |
||
185 | call [eax+PluginInfo.read] |
||
186 | pop ebp |
||
187 | cmp eax, -1 |
||
188 | jz .readok ; let's hope that plugin says error itself |
||
189 | mov [ebp+viewer_data.buf_size], eax |
||
190 | mov ebx, eax |
||
191 | jmp .readok |
||
192 | .read_native: |
||
180 | heavyiron | 193 | push 70 |
194 | pop eax |
||
517 | diamond | 195 | int 40h |
180 | heavyiron | 196 | mov [ebp+viewer_data.buf_size], ebx |
321 | diamond | 197 | test eax, eax |
198 | jz .readok |
||
199 | cmp eax, 6 |
||
200 | jz .readok |
||
589 | diamond | 201 | .readerr: |
321 | diamond | 202 | lea ebx, [ebp+viewer_data.filename] |
203 | push ebx |
||
204 | push aCannotReadFile |
||
205 | call get_error_msg |
||
206 | push eax |
||
207 | mov eax, esp |
||
208 | push RetryOrCancelBtn |
||
209 | push 2 |
||
210 | push eax |
||
211 | push 3 |
||
212 | call SayErr |
||
213 | add esp, 3*4 |
||
214 | mov ebx, readinfo |
||
215 | test eax, eax |
||
216 | jz .attr_retry |
||
217 | jmp delete_active_screen |
||
218 | .readok: |
||
474 | diamond | 219 | cmp ebx, 2 |
220 | jb .nounicode |
||
221 | cmp word [ebp+viewer_data.buf], 0xFEFF |
||
222 | jz @f |
||
223 | cmp word [ebp+viewer_data.buf], 0xFFFE |
||
224 | jnz .nounicode |
||
225 | or byte [ebp+viewer_data.flags], 4 |
||
226 | @@: |
||
227 | mov [ebp+viewer_data.encoding], encodings.unicode |
||
228 | .nounicode: |
||
814 | diamond | 229 | viewer_OnRedraw: |
230 | or [cursor_x], -1 |
||
231 | or [cursor_y], -1 |
||
180 | heavyiron | 232 | call viewer_set_keybar |
233 | call viewer_draw_text |
||
234 | ret |
||
235 | |||
997 | diamond | 236 | viewer_skip_unicode_marker: |
474 | diamond | 237 | cmp [ebp+viewer_data.encoding], encodings.unicode |
238 | jnz @f |
||
239 | cmp [bForHex], 0 |
||
240 | jnz @f |
||
241 | cmp dword [ebp+viewer_data.buf_start], 0 |
||
242 | jnz @f |
||
243 | cmp dword [ebp+viewer_data.buf_start+4], 0 |
||
244 | jnz @f |
||
245 | lea eax, [ebp+viewer_data.buf] |
||
246 | cmp eax, [ebp+viewer_data.buf_pos] |
||
247 | jnz @f |
||
248 | cmp word [eax], 0xFFFE |
||
249 | jz .skip |
||
250 | cmp word [eax], 0xFEFF |
||
251 | jnz @f |
||
252 | .skip: |
||
253 | add [ebp+viewer_data.buf_pos], 2 |
||
254 | @@: |
||
997 | diamond | 255 | ret |
256 | |||
257 | viewer_load_next: |
||
180 | heavyiron | 258 | mov eax, dword [ebp+viewer_data.buf_start] |
259 | add eax, 8192 |
||
260 | mov dword [ebp+viewer_data.buf_start], eax |
||
261 | mov edx, dword [ebp+viewer_data.buf_start+4] |
||
262 | adc edx, 0 |
||
263 | mov dword [ebp+viewer_data.buf_start+4], edx |
||
264 | add eax, 16384-8192 |
||
265 | adc edx, 0 |
||
266 | mov dword [readinfo.first], eax |
||
267 | mov dword [readinfo.first+4], edx |
||
268 | mov dword [readinfo.size], 8192 |
||
269 | lea edi, [ebp+viewer_data.buf] |
||
270 | lea esi, [edi+8192] |
||
271 | mov ecx, (16384-8192)/4 |
||
272 | rep movsd |
||
273 | mov [readinfo.data], edi |
||
274 | lea eax, [ebp+viewer_data.filename] |
||
275 | mov [readinfo.name], eax |
||
321 | diamond | 276 | .readretry: |
180 | heavyiron | 277 | mov ebx, readinfo |
589 | diamond | 278 | mov eax, [ebp+viewer_data.hPlugin] |
279 | test eax, eax |
||
280 | jz .native |
||
281 | push ecx ebp |
||
282 | push 8192 |
||
283 | push [ebx+readinfo.data-readinfo] |
||
284 | push [ebp+viewer_data.hWorkFile] |
||
285 | call [eax+PluginInfo.read] |
||
286 | pop ebp ecx |
||
287 | mov ebx, eax |
||
288 | cmp eax, -1 |
||
289 | jnz .readok |
||
290 | xor ebx, ebx |
||
291 | jmp .readok |
||
292 | .native: |
||
180 | heavyiron | 293 | push 70 |
294 | pop eax |
||
517 | diamond | 295 | int 40h |
321 | diamond | 296 | test eax, eax |
297 | jz .readok |
||
298 | cmp eax, 6 |
||
299 | jz .readok |
||
589 | diamond | 300 | .readerr: |
321 | diamond | 301 | call ask_retry_ignore |
302 | jz .readretry |
||
303 | .readok: |
||
180 | heavyiron | 304 | sub [ebp+viewer_data.buf_pos], 8192 |
305 | add ebx, 16384-8192 |
||
306 | mov [ebp+viewer_data.buf_size], ebx |
||
307 | mov eax, [ebp+viewer_data.buf_pos] |
||
997 | diamond | 308 | cmp ebx, 16384-8192 |
309 | ret |
||
310 | |||
311 | viewer_get_next_char: |
||
312 | pusha |
||
313 | call viewer_skip_unicode_marker |
||
314 | mov eax, [ebp+viewer_data.buf_pos] |
||
315 | lea ecx, [ebp+viewer_data.buf] |
||
316 | add ecx, [ebp+viewer_data.buf_size] |
||
317 | cmp eax, ecx |
||
318 | jb .buffered |
||
319 | mov al, ' ' |
||
320 | sub ecx, ebp |
||
321 | cmp ecx, viewer_data.buf + 16384 |
||
322 | jb .err |
||
323 | call viewer_load_next |
||
180 | heavyiron | 324 | jnz .buffered |
325 | .err: |
||
326 | stc |
||
327 | popa |
||
328 | ret |
||
329 | .buffered: |
||
474 | diamond | 330 | cmp [ebp+viewer_data.encoding], encodings.unicode |
331 | jz .unicode |
||
180 | heavyiron | 332 | mov al, [eax] |
333 | .done: |
||
334 | mov [esp+28], al |
||
335 | inc [ebp+viewer_data.buf_pos] |
||
336 | clc |
||
337 | popa |
||
338 | ret |
||
339 | |||
474 | diamond | 340 | .unicode: |
341 | inc [ebp+viewer_data.buf_pos] |
||
342 | cmp [bForHex], 0 |
||
343 | jnz @f |
||
344 | call read_unicode_char |
||
345 | jmp .done |
||
346 | @@: |
||
347 | mov ax, [eax] |
||
348 | mov [esp+29], ah |
||
349 | jmp .done |
||
350 | |||
180 | heavyiron | 351 | viewer_get_prev_char: |
352 | pusha |
||
353 | lea ecx, [ebp+viewer_data.buf] |
||
354 | cmp [ebp+viewer_data.buf_pos], ecx |
||
355 | ja .buffered |
||
356 | mov eax, dword [ebp+viewer_data.buf_start] |
||
357 | mov edx, dword [ebp+viewer_data.buf_start+4] |
||
358 | test eax, eax |
||
359 | jnz @f |
||
360 | test edx, edx |
||
361 | jnz @f |
||
362 | stc |
||
363 | jmp .ret |
||
364 | @@: |
||
365 | sub eax, 8192 |
||
366 | sbb edx, 0 |
||
367 | jnc @f |
||
368 | xor eax, eax |
||
369 | xor edx, edx |
||
370 | @@: |
||
371 | call viewer_seek |
||
372 | add [ebp+viewer_data.buf_pos], 8192 |
||
373 | .buffered: |
||
374 | mov eax, [ebp+viewer_data.buf_pos] |
||
375 | dec eax |
||
474 | diamond | 376 | cmp [ebp+viewer_data.encoding], encodings.unicode |
377 | jz .unicode |
||
180 | heavyiron | 378 | mov [ebp+viewer_data.buf_pos], eax |
379 | mov al, [eax] |
||
380 | mov [esp+28], al |
||
474 | diamond | 381 | .done: |
180 | heavyiron | 382 | clc |
383 | .ret: |
||
384 | popa |
||
385 | ret |
||
386 | |||
474 | diamond | 387 | .unicode: |
388 | dec eax |
||
389 | mov [ebp+viewer_data.buf_pos], eax |
||
390 | call read_unicode_char |
||
391 | jmp .done |
||
392 | |||
393 | read_unicode_char: |
||
394 | mov ax, [eax] |
||
395 | uni2ansi_char: |
||
396 | test [ebp+viewer_data.flags], 4 |
||
397 | jz @f |
||
398 | xchg al, ah |
||
399 | @@: |
||
400 | cmp ax, 0x80 |
||
401 | jb .ret |
||
402 | cmp ax, 0x401 |
||
403 | jz .yo1 |
||
404 | cmp ax, 0x451 |
||
405 | jz .yo2 |
||
406 | cmp ax, 0x410 |
||
407 | jb .unk |
||
408 | cmp ax, 0x440 |
||
409 | jb .rus1 |
||
410 | cmp ax, 0x450 |
||
411 | jb .rus2 |
||
412 | .unk: |
||
413 | mov al, ' ' |
||
414 | .ret: |
||
415 | ret |
||
416 | .yo1: |
||
417 | mov al, 'Ё' |
||
418 | ret |
||
419 | .yo2: |
||
420 | mov al, 'ё' |
||
421 | ret |
||
422 | .rus1: |
||
423 | ; 0x410-0x43F -> 0x80-0xAF |
||
424 | add al, 0x70 |
||
425 | ret |
||
426 | .rus2: |
||
427 | ; 0x440-0x44F -> 0xE0-0xEF |
||
428 | add al, 0xA0 |
||
429 | ret |
||
430 | |||
997 | diamond | 431 | viewer_clear_selection: |
432 | and dword [ebp+viewer_data.selected_start], 0 |
||
433 | and dword [ebp+viewer_data.selected_start+4], 0 |
||
434 | and dword [ebp+viewer_data.selected_len], 0 |
||
435 | and dword [ebp+viewer_data.selected_len+4], 0 |
||
436 | ret |
||
437 | |||
180 | heavyiron | 438 | fld_uint64: |
439 | fild qword [eax] |
||
440 | test byte [eax+7], 80h |
||
441 | jz .ret |
||
442 | fadd [@f] |
||
443 | .ret: |
||
444 | ret |
||
445 | @@ dq 18446744073709551616.0 ;0x10000000000000000 |
||
446 | |||
447 | viewer_draw_text: |
||
448 | call viewer_seek_to_current |
||
449 | xor eax, eax |
||
450 | xor edx, edx |
||
451 | call get_console_ptr |
||
452 | mov ah, [view_status_color] |
||
453 | mov ecx, [cur_width] |
||
454 | sub ecx, 44 |
||
455 | cmp ecx, 20 |
||
814 | diamond | 456 | jae @f |
180 | heavyiron | 457 | mov cl, 20 |
458 | @@: |
||
814 | diamond | 459 | call viewedit_draw_filename |
460 | add ecx, 11 |
||
180 | heavyiron | 461 | rep stosw |
462 | movzx esi, [ebp+viewer_data.encoding] |
||
463 | lea esi, [encodings.names+esi*8] |
||
814 | diamond | 464 | push edi esi |
465 | dec edi |
||
466 | dec edi |
||
467 | std |
||
468 | add esi, 8 |
||
180 | heavyiron | 469 | @@: |
814 | diamond | 470 | dec esi |
471 | cmp byte [esi], ' ' |
||
472 | jz @b |
||
473 | @@: |
||
180 | heavyiron | 474 | lodsb |
475 | stosw |
||
814 | diamond | 476 | cmp esi, [esp] |
477 | jae @b |
||
478 | cld |
||
479 | pop esi edi |
||
180 | heavyiron | 480 | mov al, ' ' |
814 | diamond | 481 | mov cl, 13 |
180 | heavyiron | 482 | rep stosw |
483 | std |
||
484 | push edi |
||
485 | mov edx, dword [ebp+viewer_data.filesize+4] |
||
486 | mov eax, dword [ebp+viewer_data.filesize] |
||
487 | mov cl, 10 |
||
488 | @@: |
||
489 | push eax |
||
490 | mov eax, edx |
||
491 | xor edx, edx |
||
492 | div ecx |
||
493 | xchg eax, [esp] |
||
494 | div ecx |
||
495 | xchg eax, edx |
||
496 | add al, '0' |
||
497 | mov ah, [view_status_color] |
||
498 | stosw |
||
499 | xchg eax, edx |
||
500 | pop edx |
||
501 | test eax, eax |
||
502 | jnz @b |
||
503 | test edx, edx |
||
504 | jnz @b |
||
505 | mov al, ' ' |
||
506 | mov ah, [view_status_color] |
||
507 | stosw |
||
508 | cld |
||
509 | pop edi |
||
510 | inc edi |
||
511 | inc edi |
||
512 | mov al, ' ' |
||
513 | mov cl, 5 |
||
514 | rep stosw |
||
515 | if lang eq ru |
||
516 | mov al, 'К' |
||
517 | stosw |
||
518 | mov al, 'о' |
||
519 | stosw |
||
520 | mov al, 'л' |
||
521 | stosw |
||
522 | else |
||
523 | mov al, 'C' |
||
524 | stosw |
||
525 | mov al, 'o' |
||
526 | stosw |
||
527 | mov al, 'l' |
||
528 | stosw |
||
529 | end if |
||
530 | mov al, ' ' |
||
531 | stosw |
||
532 | push edi |
||
533 | mov eax, dword [ebp+viewer_data.col] |
||
534 | mov edx, dword [ebp+viewer_data.col+4] |
||
535 | test edx, edx |
||
536 | jnz .col_big |
||
537 | cmp eax, 100000 |
||
538 | jae .col_big |
||
539 | mov cl, 10 |
||
540 | push -'0' |
||
541 | @@: |
||
542 | div ecx |
||
543 | push edx |
||
544 | xor edx, edx |
||
545 | test eax, eax |
||
546 | jnz @b |
||
547 | @@: |
||
548 | pop eax |
||
549 | add eax, '0' |
||
550 | jz .col_done |
||
551 | mov ah, [view_status_color] |
||
552 | stosw |
||
553 | jmp @b |
||
554 | .col_big: |
||
555 | push eax |
||
556 | mov al, '.' |
||
557 | mov ah, [view_status_color] |
||
558 | stosw |
||
559 | stosw |
||
560 | stosw |
||
561 | xor eax, eax |
||
562 | xchg eax, edx |
||
563 | mov cl, 100 |
||
564 | div ecx |
||
565 | pop eax |
||
566 | div ecx |
||
567 | mov cl, 10 |
||
568 | xor eax, eax |
||
569 | xchg eax, edx |
||
570 | div ecx |
||
571 | add al, '0' |
||
572 | mov ah, [view_status_color] |
||
573 | stosw |
||
574 | mov al, dl |
||
575 | add al, '0' |
||
576 | stosw |
||
577 | .col_done: |
||
578 | pop ecx |
||
579 | add ecx, 10*2 |
||
580 | sub ecx, edi |
||
581 | shr ecx, 1 |
||
582 | mov al, ' ' |
||
583 | mov ah, [view_status_color] |
||
584 | rep stosw |
||
585 | finit |
||
586 | fldcw [fpu_cw] |
||
587 | mov [tmp], 100 |
||
588 | lea eax, [ebp+viewer_data.filesize] |
||
589 | cmp dword [eax], 0 |
||
590 | jnz @f |
||
591 | cmp dword [eax+4], 0 |
||
592 | jz .size_zero |
||
593 | @@: |
||
594 | call fld_uint64 |
||
595 | lea eax, [ebp+viewer_data.cur_pos] |
||
596 | call fld_uint64 |
||
597 | fdivrp |
||
598 | fimul [_100d] |
||
599 | fistp [tmp] |
||
600 | .size_zero: |
||
601 | mov byte [edi-2], '%' |
||
602 | sub edi, 4 |
||
603 | mov eax, [tmp] |
||
604 | mov cl, 10 |
||
605 | @@: |
||
606 | xor edx, edx |
||
607 | div ecx |
||
608 | xchg eax, edx |
||
609 | add al, '0' |
||
610 | mov [edi], al |
||
611 | sub edi, 2 |
||
612 | xchg eax, edx |
||
613 | test eax, eax |
||
614 | jnz @b |
||
615 | xor eax, eax |
||
616 | push 1 |
||
617 | pop edx |
||
618 | call get_console_ptr |
||
619 | test [ebp+viewer_data.flags], 1 |
||
620 | jnz .DrawHex |
||
621 | push 2 |
||
622 | pop edx |
||
623 | xor ecx, ecx |
||
624 | mov dword [scrpos], ecx |
||
625 | mov dword [scrpos+4], ecx |
||
626 | mov dword [viewer_right_side], ecx |
||
627 | mov dword [viewer_right_side+4], ecx |
||
628 | .1: |
||
629 | call viewer_get_next_char |
||
630 | jc .done |
||
631 | .2: |
||
632 | cmp al, 0xD |
||
633 | jz .newline |
||
634 | cmp al, 0xA |
||
635 | jz .newline |
||
636 | cmp ecx, [cur_width] |
||
637 | jb .no_newline |
||
638 | test [ebp+viewer_data.flags], 2 |
||
639 | jnz .no_newline |
||
640 | .newline: |
||
641 | push eax |
||
642 | mov ecx, dword [scrpos] |
||
643 | mov eax, dword [scrpos+4] |
||
644 | sub ecx, dword [ebp+viewer_data.col] |
||
645 | sbb eax, dword [ebp+viewer_data.col+4] |
||
646 | ja .line_filled |
||
647 | jb .line_full |
||
648 | cmp ecx, [cur_width] |
||
649 | ja .line_filled |
||
650 | jmp @f |
||
651 | .line_full: |
||
652 | xor ecx, ecx |
||
653 | @@: |
||
654 | test ecx, ecx |
||
655 | jnz @f |
||
656 | mov eax, dword [scrpos] |
||
657 | or eax, dword [scrpos+4] |
||
658 | jz @f |
||
659 | inc ecx |
||
660 | @@: |
||
661 | sub ecx, [cur_width] |
||
662 | neg ecx |
||
663 | mov al, ' ' |
||
664 | mov ah, [view_normal_color] |
||
665 | rep stosw |
||
666 | .line_filled: |
||
667 | mov eax, dword [scrpos] |
||
668 | sub eax, dword [viewer_right_side] |
||
669 | mov eax, dword [scrpos+4] |
||
670 | sbb eax, dword [viewer_right_side+4] |
||
671 | jb @f |
||
672 | mov eax, dword [scrpos] |
||
673 | mov dword [viewer_right_side], eax |
||
674 | mov eax, dword [scrpos+4] |
||
675 | mov dword [viewer_right_side+4], eax |
||
676 | @@: |
||
677 | xor ecx, ecx |
||
678 | mov dword [scrpos], ecx |
||
679 | mov dword [scrpos+4], ecx |
||
680 | inc edx |
||
681 | pop eax |
||
682 | cmp edx, [cur_height] |
||
683 | jae .done |
||
684 | .no_newline: |
||
685 | cmp al, 0xD |
||
686 | jz .3 |
||
687 | cmp al, 0xA |
||
688 | jz .3 |
||
689 | .4: |
||
690 | test al, al |
||
691 | jns @f |
||
692 | movzx esi, [ebp+viewer_data.encoding] |
||
474 | diamond | 693 | cmp esi, encodings.unicode |
694 | jz @f |
||
180 | heavyiron | 695 | shl esi, 7 |
696 | movzx eax, al |
||
697 | mov al, [encodings.tables-80h+esi+eax] |
||
698 | @@: |
||
699 | cmp al, 9 |
||
700 | jz .tab |
||
701 | call .write_char |
||
702 | inc ecx |
||
703 | jns .1 |
||
704 | push edx |
||
705 | mov eax, ecx |
||
706 | xor edx, edx |
||
814 | diamond | 707 | div [viewer_tabsize] |
180 | heavyiron | 708 | mov ecx, edx |
709 | pop edx |
||
710 | jmp .1 |
||
711 | .3: |
||
712 | mov bl, al |
||
713 | call viewer_get_next_char |
||
714 | jc .done |
||
715 | xor bl, al |
||
716 | cmp bl, 0xA xor 0xD |
||
717 | jz .1 |
||
718 | jmp .2 |
||
719 | .tab: |
||
720 | push edx |
||
721 | push ecx |
||
722 | mov eax, ecx |
||
814 | diamond | 723 | mov ecx, [viewer_tabsize] |
180 | heavyiron | 724 | xor edx, edx |
725 | div ecx |
||
726 | pop eax |
||
727 | sub ecx, edx |
||
997 | diamond | 728 | pop edx |
180 | heavyiron | 729 | add eax, ecx |
730 | test [ebp+viewer_data.flags], 2 |
||
731 | jnz @f |
||
732 | cmp eax, [cur_width] |
||
733 | jbe @f |
||
734 | sub eax, [cur_width] |
||
735 | sub ecx, eax |
||
736 | mov eax, [cur_width] |
||
737 | @@: |
||
738 | push eax |
||
739 | mov al, ' ' |
||
740 | @@: |
||
741 | call .write_char |
||
742 | loop @b |
||
743 | pop ecx |
||
744 | jmp .1 |
||
745 | .done: |
||
746 | setc [ebp+viewer_data.bEofReached] |
||
747 | .done2: |
||
748 | inc edx |
||
749 | cmp edx, [cur_height] |
||
750 | jnc @f |
||
751 | mov eax, dword [ebp+viewer_data.cur_pos] |
||
752 | or eax, dword [ebp+viewer_data.cur_pos+4] |
||
753 | jz @f |
||
754 | call viewer_seek_to_current |
||
755 | call viewer_prev_newline |
||
756 | jmp viewer_draw_text |
||
757 | @@: |
||
758 | push edi |
||
759 | xor eax, eax |
||
760 | mov edx, [cur_height] |
||
761 | dec edx |
||
762 | call get_console_ptr |
||
763 | mov ecx, edi |
||
764 | pop edi |
||
765 | sub ecx, edi |
||
766 | shr ecx, 1 |
||
767 | mov al, ' ' |
||
768 | mov ah, [view_normal_color] |
||
769 | rep stosw |
||
770 | cmp [ebp+viewer_data.bEofReached], 0 |
||
771 | jz @f |
||
772 | xor edx, edx |
||
773 | mov eax, [cur_width] |
||
774 | sub eax, 4 |
||
775 | call get_console_ptr |
||
776 | mov ah, [view_status_color] |
||
777 | mov al, '1' |
||
778 | stosw |
||
779 | mov al, '0' |
||
780 | stosw |
||
781 | stosw |
||
782 | @@: |
||
783 | call draw_image |
||
784 | ret |
||
785 | .DrawHex: |
||
786 | xor esi, esi |
||
787 | mov [ebp+viewer_data.bEofReached], 0 |
||
788 | .line: |
||
789 | mov al, ' ' |
||
790 | mov ah, [view_normal_color] |
||
791 | push edi |
||
792 | mov ecx, [cur_width] |
||
793 | rep stosw |
||
794 | mov ebx, edi |
||
795 | pop edi |
||
474 | diamond | 796 | mov [bForHex], 1 |
180 | heavyiron | 797 | call viewer_get_next_char |
474 | diamond | 798 | mov [bForHex], 0 |
180 | heavyiron | 799 | jc .hexdone |
800 | push eax |
||
801 | push edi |
||
802 | add edi, 36*2 |
||
803 | mov al, 0xB3 |
||
474 | diamond | 804 | mov ah, [view_normal_color] |
180 | heavyiron | 805 | call .safechar |
806 | pop edi |
||
807 | mov eax, dword [ebp+viewer_data.cur_pos] |
||
808 | mov edx, dword [ebp+viewer_data.cur_pos+4] |
||
809 | push esi |
||
810 | shl esi, 4 |
||
811 | add eax, esi |
||
812 | adc edx, 0 |
||
813 | pop esi |
||
814 | push eax |
||
815 | mov al, dl |
||
816 | shr eax, 4 |
||
817 | and al, 0xF |
||
818 | call .hex_digit |
||
819 | mov al, dl |
||
820 | and al, 0xF |
||
821 | call .hex_digit |
||
822 | pop eax |
||
823 | push 8 |
||
824 | pop ecx |
||
825 | add edi, 7*2 |
||
826 | std |
||
827 | @@: |
||
828 | push eax |
||
829 | and al, 0xF |
||
830 | call .hex_digit |
||
831 | pop eax |
||
832 | shr eax, 4 |
||
833 | loop @b |
||
834 | cld |
||
835 | add edi, 9*2 |
||
836 | mov al, ':' |
||
837 | mov ah, [view_normal_color] |
||
838 | stosw |
||
839 | mov al, ' ' |
||
840 | stosw |
||
841 | xor ecx, ecx |
||
842 | pop eax |
||
843 | jmp @f |
||
844 | .hexchar: |
||
474 | diamond | 845 | mov [bForHex], 1 |
180 | heavyiron | 846 | call viewer_get_next_char |
474 | diamond | 847 | mov [bForHex], 0 |
180 | heavyiron | 848 | jc .hexdone |
849 | @@: |
||
474 | diamond | 850 | cmp [ebp+viewer_data.encoding], encodings.unicode |
851 | jz .hexchar_unicode |
||
180 | heavyiron | 852 | push eax |
853 | shr al, 4 |
||
854 | call .hex_digit |
||
855 | pop eax |
||
856 | push eax |
||
857 | and al, 0xF |
||
858 | call .hex_digit |
||
859 | mov al, ' ' |
||
860 | call .safechar |
||
861 | pop eax |
||
862 | push edi |
||
863 | add edi, 48*2 |
||
864 | push ecx |
||
865 | shl ecx, 2 |
||
866 | sub edi, ecx |
||
867 | pop ecx |
||
868 | cmp ecx, 8 |
||
869 | jb @f |
||
870 | sub edi, 4 |
||
871 | @@: |
||
872 | test al, al |
||
873 | jns @f |
||
874 | movzx edx, [ebp+viewer_data.encoding] |
||
875 | shl edx, 7 |
||
876 | movzx eax, al |
||
877 | mov al, [encodings.tables+eax+edx-80h] |
||
878 | mov ah, [view_normal_color] |
||
879 | @@: |
||
880 | call .safechar |
||
881 | pop edi |
||
882 | inc ecx |
||
883 | cmp ecx, 8 |
||
884 | jnz @f |
||
885 | mov al, 0xB3 |
||
886 | call .safechar |
||
887 | mov al, ' ' |
||
888 | call .safechar |
||
889 | @@: |
||
890 | cmp ecx, 16 |
||
891 | jnz .hexchar |
||
474 | diamond | 892 | jmp .hexchar_nextline |
893 | .hexchar_unicode: |
||
894 | push eax |
||
895 | shr eax, 12 |
||
896 | call .hex_digit |
||
897 | pop eax |
||
898 | push eax |
||
899 | shr eax, 8 |
||
900 | and al, 0xF |
||
901 | call .hex_digit |
||
902 | pop eax |
||
903 | push eax |
||
904 | shr al, 4 |
||
905 | call .hex_digit |
||
906 | pop eax |
||
907 | push eax |
||
908 | and al, 0xF |
||
909 | call .hex_digit |
||
910 | mov al, ' ' |
||
911 | mov ah, [view_normal_color] |
||
912 | call .safechar |
||
913 | pop eax |
||
914 | push edi |
||
915 | add edi, 38*2 |
||
916 | push ecx |
||
917 | shl ecx, 3 |
||
918 | sub edi, ecx |
||
919 | pop ecx |
||
920 | cmp ecx, 4 |
||
921 | jb @f |
||
922 | sub edi, 4 |
||
923 | @@: |
||
924 | call uni2ansi_char |
||
925 | mov ah, [view_normal_color] |
||
926 | call .safechar |
||
927 | pop edi |
||
928 | inc ecx |
||
929 | cmp ecx, 4 |
||
930 | jnz @f |
||
931 | mov al, 0xB3 |
||
932 | call .safechar |
||
933 | mov al, ' ' |
||
934 | call .safechar |
||
935 | @@: |
||
936 | cmp ecx, 8 |
||
937 | jnz .hexchar |
||
938 | .hexchar_nextline: |
||
180 | heavyiron | 939 | mov edi, ebx |
940 | add esi, 3 |
||
941 | mov edx, esi |
||
942 | cmp esi, [cur_height] |
||
943 | jae .done2 |
||
944 | dec esi |
||
945 | dec esi |
||
946 | jmp .line |
||
947 | .hexdone: |
||
948 | mov [ebp+viewer_data.bEofReached], 1 |
||
949 | mov edi, ebx |
||
950 | lea edx, [esi+2] |
||
951 | jmp .done2 |
||
952 | |||
953 | .hex_digit: |
||
954 | push eax |
||
955 | cmp al, 10 |
||
956 | sbb al, 69h |
||
957 | das |
||
958 | mov ah, [view_normal_color] |
||
959 | call .safechar |
||
960 | pop eax |
||
961 | ret |
||
962 | .safechar: |
||
963 | cmp edi, ebx |
||
964 | jae @f |
||
965 | stosw |
||
966 | @@: |
||
967 | ret |
||
968 | .write_char: |
||
969 | push ecx eax |
||
970 | mov ecx, dword [scrpos] |
||
971 | mov eax, dword [scrpos+4] |
||
972 | sub ecx, dword [ebp+viewer_data.col] |
||
973 | sbb eax, dword [ebp+viewer_data.col+4] |
||
974 | jb .left |
||
975 | ja .skip |
||
976 | test ecx, ecx |
||
977 | jnz @f |
||
978 | mov eax, dword [scrpos] |
||
979 | or eax, dword [scrpos+4] |
||
980 | jnz .skip |
||
981 | @@: |
||
982 | cmp ecx, [cur_width] |
||
983 | ja .skip |
||
984 | jb .do |
||
985 | mov al, '>' |
||
986 | mov [edi-2], al |
||
987 | mov al, [view_arrows_color] |
||
988 | mov [edi-1], al |
||
989 | jmp .skip |
||
990 | .left: |
||
991 | mov eax, dword [scrpos] |
||
992 | or eax, dword [scrpos+4] |
||
993 | jnz .skip |
||
994 | mov al, '<' |
||
995 | mov ah, [view_arrows_color] |
||
996 | stosw |
||
997 | jmp .skip |
||
998 | .do: |
||
999 | mov al, [esp] |
||
1000 | mov ah, [view_normal_color] |
||
997 | diamond | 1001 | push edx |
1002 | mov ecx, [ebp+viewer_data.buf_pos] |
||
1003 | sub ecx, ebp |
||
1004 | sub ecx, viewer_data.buf + 1 |
||
1005 | xor edx, edx |
||
1006 | add ecx, dword [ebp+viewer_data.buf_start] |
||
1007 | adc edx, dword [ebp+viewer_data.buf_start+4] |
||
1008 | sub ecx, dword [ebp+viewer_data.selected_start] |
||
1009 | sbb edx, dword [ebp+viewer_data.selected_start+4] |
||
1010 | cmp edx, dword [ebp+viewer_data.selected_len+4] |
||
1011 | ja .color_ok |
||
1012 | jb @f |
||
1013 | cmp ecx, dword [ebp+viewer_data.selected_len] |
||
1014 | jae .color_ok |
||
1015 | @@: |
||
1016 | mov ah, [view_selected_color] |
||
1017 | .color_ok: |
||
1018 | pop edx |
||
180 | heavyiron | 1019 | stosw |
1020 | .skip: |
||
1021 | pop eax ecx |
||
1022 | add dword [scrpos], 1 |
||
1023 | adc dword [scrpos+4], 0 |
||
1024 | ret |
||
1025 | |||
814 | diamond | 1026 | viewedit_draw_filename: |
1027 | lea esi, [ebp+viewer_data.filename] |
||
1028 | xor edx, edx |
||
1029 | cmp [ebp+viewer_data.hPlugin], edx |
||
1030 | mov dl, 3 |
||
1031 | jz .5 |
||
1032 | mov dl, 1 |
||
1033 | .5: |
||
1034 | lodsb |
||
1035 | cmp al, '/' |
||
1036 | jnz @f |
||
1037 | dec edx |
||
1038 | jz .6 |
||
1039 | @@: |
||
1040 | stosw |
||
1041 | loop .5 |
||
1042 | .6: |
||
1043 | dec ecx |
||
1044 | stosw |
||
1045 | push esi |
||
1046 | @@: |
||
1047 | inc esi |
||
1048 | cmp byte [esi-1], 0 |
||
1049 | jnz @b |
||
1050 | sub esi, [esp] |
||
1051 | dec esi |
||
1052 | cmp ecx, esi |
||
1053 | jae .7 |
||
1054 | mov al, '.' |
||
1055 | stosw |
||
1056 | stosw |
||
1057 | stosw |
||
1058 | sub ecx, 3 |
||
1059 | sub esi, ecx |
||
1060 | add [esp], esi |
||
1061 | .7: |
||
1062 | pop esi |
||
1063 | @@: |
||
1064 | lodsb |
||
1065 | test al, al |
||
1066 | jz @f |
||
1067 | dec ecx |
||
1068 | stosw |
||
1069 | jmp @b |
||
1070 | @@: |
||
1071 | mov al, ' ' |
||
1072 | ret |
||
1073 | |||
180 | heavyiron | 1074 | viewer_seek_to_current: |
1075 | mov eax, dword [ebp+viewer_data.cur_pos] |
||
1076 | mov edx, dword [ebp+viewer_data.cur_pos+4] |
||
1077 | viewer_seek: |
||
1078 | push eax edx |
||
1079 | sub eax, dword [ebp+viewer_data.buf_start] |
||
1080 | sbb edx, dword [ebp+viewer_data.buf_start+4] |
||
1081 | jb .prev |
||
1082 | ja .next |
||
1083 | cmp eax, 16384 |
||
1084 | jae .next |
||
1085 | lea eax, [ebp+viewer_data.buf+eax] |
||
1086 | mov [ebp+viewer_data.buf_pos], eax |
||
1087 | pop edx eax |
||
1088 | ret |
||
1089 | .prev: |
||
1090 | inc edx |
||
1091 | jnz .read_full |
||
1092 | and eax, not 511 |
||
1093 | cmp eax, -16384 |
||
1094 | jbe .read_full |
||
1095 | lea edi, [ebp+viewer_data.buf+16384-4] |
||
1096 | lea esi, [edi+eax] |
||
1097 | lea ecx, [eax+16384] |
||
1098 | push ecx |
||
1099 | shr ecx, 2 |
||
1100 | std |
||
1101 | rep movsd |
||
1102 | cld |
||
1103 | pop ecx |
||
1104 | add dword [ebp+viewer_data.buf_start], eax |
||
1105 | adc dword [ebp+viewer_data.buf_start+4], -1 |
||
1106 | neg eax |
||
1107 | cmp dword [ebp+viewer_data.buf_size], ecx |
||
1108 | jb .doread |
||
1109 | mov dword [ebp+viewer_data.buf_size], ecx |
||
1110 | jmp .doread |
||
1111 | .read_full: |
||
1112 | pop edx eax |
||
1113 | push eax edx |
||
1114 | and eax, not 511 |
||
1115 | sub eax, 8192-512 |
||
1116 | sbb edx, 0 |
||
1117 | jnc @f |
||
1118 | xor eax, eax |
||
1119 | xor edx, edx |
||
1120 | @@: |
||
1121 | mov dword [ebp+viewer_data.buf_start], eax |
||
1122 | mov dword [ebp+viewer_data.buf_start+4], edx |
||
1123 | and dword [ebp+viewer_data.buf_size], 0 |
||
1124 | mov eax, 16384 |
||
1125 | .doread: |
||
1126 | mov ebx, readinfo |
||
1127 | push dword [ebp+viewer_data.buf_start] |
||
1128 | pop dword [ebx+4] |
||
1129 | push dword [ebp+viewer_data.buf_start+4] |
||
1130 | pop dword [ebx+8] |
||
1131 | mov [ebx+12], eax |
||
1132 | lea eax, [ebp+viewer_data.buf] |
||
1133 | mov [ebx+16], eax |
||
1134 | lea eax, [ebp+viewer_data.filename] |
||
1135 | mov [ebx+21], eax |
||
589 | diamond | 1136 | call .q |
180 | heavyiron | 1137 | cmp ebx, [readinfo.size] |
1138 | jnz @f |
||
1139 | add ebx, [ebp+viewer_data.buf_size] |
||
1140 | @@: |
||
1141 | .ret: |
||
1142 | mov [ebp+viewer_data.buf_size], ebx |
||
1143 | pop edx eax |
||
1144 | sub eax, dword [ebp+viewer_data.buf_start] |
||
1145 | lea eax, [ebp+eax+viewer_data.buf] |
||
1146 | mov [ebp+viewer_data.buf_pos], eax |
||
1147 | ret |
||
1148 | .next: |
||
1149 | or eax, 511 |
||
1150 | sub eax, 16384-1 |
||
1151 | sbb edx, 0 |
||
1152 | jnz .read_full |
||
1153 | cmp eax, 16384 |
||
1154 | jae .read_full |
||
1155 | cmp [ebp+viewer_data.buf_size], 16384 |
||
1156 | jb .read_full |
||
1157 | lea edi, [ebp+viewer_data.buf] |
||
1158 | lea esi, [edi+eax] |
||
1159 | mov ecx, 16384 |
||
1160 | sub ecx, eax |
||
1161 | shr ecx, 2 |
||
1162 | rep movsd |
||
1163 | add dword [ebp+viewer_data.buf_start], eax |
||
1164 | adc dword [ebp+viewer_data.buf_start+4], 0 |
||
1165 | mov ebx, readinfo |
||
1166 | mov [ebx+16], edi |
||
1167 | sub edi, ebp |
||
1168 | sub edi, viewer_data.buf |
||
1169 | mov edx, dword [ebp+viewer_data.buf_start] |
||
1170 | add edx, edi |
||
1171 | mov [ebx+4], edx |
||
1172 | mov edx, dword [ebp+viewer_data.buf_start+4] |
||
1173 | adc edx, 0 |
||
1174 | mov [ebx+8], edx |
||
1175 | mov [ebx+12], eax |
||
1176 | lea eax, [ebp+viewer_data.filename] |
||
1177 | mov [ebx+21], eax |
||
589 | diamond | 1178 | call .q |
1179 | sub ebx, [readinfo.size] |
||
1180 | add ebx, 16384 |
||
1181 | jmp .ret |
||
1182 | |||
1183 | .q: |
||
1184 | mov ebx, readinfo |
||
1185 | mov eax, [ebp+viewer_data.hPlugin] |
||
1186 | test eax, eax |
||
1187 | jz .native |
||
1188 | push ebp |
||
1189 | push dword [ebx+12] |
||
1190 | push dword [ebx+16] |
||
1191 | push [ebp+viewer_data.hWorkFile] |
||
1192 | push eax |
||
1193 | push dword [ebx+8] |
||
1194 | push dword [ebx+4] |
||
1195 | push [ebp+viewer_data.hWorkFile] |
||
1196 | call [eax+PluginInfo.setpos] |
||
1197 | pop eax |
||
1198 | call [eax+PluginInfo.read] |
||
1199 | pop ebp |
||
1200 | mov ebx, eax |
||
1201 | cmp eax, -1 |
||
1202 | jnz @f |
||
1203 | xor ebx, ebx |
||
321 | diamond | 1204 | @@: |
589 | diamond | 1205 | ret |
1206 | .native: |
||
180 | heavyiron | 1207 | push 70 |
1208 | pop eax |
||
517 | diamond | 1209 | int 40h |
321 | diamond | 1210 | test eax, eax |
589 | diamond | 1211 | jz .readok |
321 | diamond | 1212 | cmp eax, 6 |
589 | diamond | 1213 | jz .readok |
1214 | .readerr: |
||
321 | diamond | 1215 | call ask_retry_ignore |
589 | diamond | 1216 | jz .q |
1217 | .readok: |
||
1218 | ret |
||
180 | heavyiron | 1219 | |
321 | diamond | 1220 | ask_retry_ignore: |
1221 | push esi |
||
1222 | lea esi, [ebp+viewer_data.filename] |
||
1223 | push esi |
||
1224 | push aCannotReadFile |
||
1225 | call get_error_msg |
||
1226 | push eax |
||
1227 | mov eax, esp |
||
1228 | push RetryOrIgnoreBtn |
||
1229 | push 2 |
||
1230 | push eax |
||
1231 | push 3 |
||
1232 | call SayErr |
||
1233 | add esp, 3*4 |
||
1234 | pop esi |
||
1235 | test eax, eax |
||
1236 | ret |
||
1237 | |||
180 | heavyiron | 1238 | viewer_set_curpos: |
1239 | mov eax, [ebp+viewer_data.buf_pos] |
||
1240 | sub eax, ebp |
||
1241 | sub eax, viewer_data.buf |
||
1242 | xor edx, edx |
||
1243 | add eax, dword [ebp+viewer_data.buf_start] |
||
1244 | adc edx, dword [ebp+viewer_data.buf_start+4] |
||
1245 | mov dword [ebp+viewer_data.cur_pos], eax |
||
1246 | mov dword [ebp+viewer_data.cur_pos+4], edx |
||
1247 | ret |
||
1248 | |||
1249 | viewer_next_newline: |
||
1250 | test [ebp+viewer_data.flags], 1 |
||
1251 | jz .nohex |
||
474 | diamond | 1252 | push 8 |
180 | heavyiron | 1253 | pop ecx |
474 | diamond | 1254 | cmp [ebp+viewer_data.encoding], encodings.unicode |
1255 | jz @f |
||
1256 | add ecx, ecx |
||
180 | heavyiron | 1257 | @@: |
1258 | call viewer_get_next_char |
||
1259 | jc @f |
||
1260 | loop @b |
||
1261 | call viewer_set_curpos |
||
1262 | clc |
||
1263 | @@: ret |
||
1264 | .nohex: |
||
1265 | xor ecx, ecx |
||
1266 | @@: |
||
1267 | call viewer_get_next_char |
||
1268 | jc .ret |
||
1269 | cmp al, 0xD |
||
1270 | jz .1 |
||
1271 | cmp al, 0xA |
||
1272 | jz .1 |
||
1273 | cmp al, 9 |
||
1274 | jz .tab |
||
1275 | inc ecx |
||
1276 | .next: |
||
1277 | test [ebp+viewer_data.flags], 2 |
||
1278 | jnz @b |
||
1279 | cmp ecx, [cur_width] |
||
1280 | jbe @b |
||
1281 | call viewer_get_prev_char |
||
1282 | jmp .2 |
||
1283 | .tab: |
||
1284 | push ecx |
||
1285 | mov eax, ecx |
||
814 | diamond | 1286 | mov ecx, [viewer_tabsize] |
180 | heavyiron | 1287 | xor edx, edx |
1288 | div ecx |
||
1289 | sub ecx, edx |
||
1290 | add [esp], ecx |
||
1291 | pop ecx |
||
1292 | jmp .next |
||
1293 | .1: |
||
1294 | mov cl, al |
||
1295 | call viewer_get_next_char |
||
1296 | jc .ret |
||
1297 | xor cl, al |
||
1298 | cmp cl, 0xD xor 0xA |
||
1299 | jz .2 |
||
1300 | dec [ebp+viewer_data.buf_pos] |
||
474 | diamond | 1301 | cmp [ebp+viewer_data.encoding], encodings.unicode |
1302 | jnz .2 |
||
1303 | dec [ebp+viewer_data.buf_pos] |
||
180 | heavyiron | 1304 | .2: |
814 | diamond | 1305 | clc |
180 | heavyiron | 1306 | .ret: |
814 | diamond | 1307 | pushf |
180 | heavyiron | 1308 | call viewer_set_curpos |
814 | diamond | 1309 | popf |
180 | heavyiron | 1310 | ret |
1311 | |||
1312 | viewer_prev_newline: |
||
1313 | test [ebp+viewer_data.flags], 1 |
||
1314 | jz .nohex |
||
474 | diamond | 1315 | push 8 |
180 | heavyiron | 1316 | pop ecx |
474 | diamond | 1317 | cmp [ebp+viewer_data.encoding], encodings.unicode |
1318 | jz @f |
||
1319 | add ecx, ecx |
||
180 | heavyiron | 1320 | @@: |
1321 | call viewer_get_prev_char |
||
1322 | jc @f |
||
1323 | loop @b |
||
1324 | @@: call viewer_set_curpos |
||
1325 | ret |
||
1326 | .nohex: |
||
1327 | mov eax, 8192 |
||
1328 | push eax |
||
1329 | cdq |
||
1330 | div [cur_width] |
||
1331 | pop eax |
||
1332 | sub eax, edx |
||
1333 | mov edx, eax |
||
1334 | call viewer_get_prev_char |
||
1335 | jc .0 |
||
1336 | dec edx |
||
1337 | cmp al, 0xD |
||
1338 | jz .2 |
||
1339 | cmp al, 0xA |
||
1340 | jnz .3 |
||
1341 | .2: |
||
1342 | mov cl, al |
||
1343 | call viewer_get_prev_char |
||
1344 | jc .0 |
||
1345 | dec edx |
||
1346 | xor cl, al |
||
1347 | cmp cl, 0xD xor 0xA |
||
1348 | jnz .3 |
||
1349 | @@: |
||
1350 | call viewer_get_prev_char |
||
1351 | jc .0 |
||
1352 | dec edx |
||
1353 | jz .0 |
||
1354 | .3: |
||
1355 | cmp al, 0xD |
||
1356 | jz .1 |
||
1357 | cmp al, 0xA |
||
1358 | jnz @b |
||
1359 | .1: |
||
1360 | call viewer_get_next_char |
||
1361 | .0: |
||
1362 | push dword [ebp+viewer_data.cur_pos+4] |
||
1363 | push dword [ebp+viewer_data.cur_pos] |
||
1364 | call viewer_set_curpos |
||
1365 | @@: |
||
1366 | push dword [ebp+viewer_data.cur_pos+4] |
||
1367 | push dword [ebp+viewer_data.cur_pos] |
||
1368 | call viewer_next_newline |
||
1369 | jc .ret3 |
||
1370 | mov eax, dword [ebp+viewer_data.cur_pos] |
||
1371 | mov edx, dword [ebp+viewer_data.cur_pos+4] |
||
1372 | sub eax, [esp+8] |
||
1373 | sbb edx, [esp+12] |
||
1374 | jae .ret3 |
||
1375 | pop eax |
||
1376 | pop eax |
||
1377 | jmp @b |
||
1378 | .ret3: |
||
1379 | pop dword [ebp+viewer_data.cur_pos] |
||
1380 | pop dword [ebp+viewer_data.cur_pos+4] |
||
1381 | .ret: |
||
1382 | pop eax |
||
1383 | pop eax |
||
1384 | jmp viewer_seek_to_current |
||
1385 | |||
1386 | viewer_set_keybar: |
||
1387 | mov eax, keybar_viewer |
||
1388 | if lang eq ru |
||
1389 | test [ebp+viewer_data.flags], 1 |
||
1390 | jnz .hex |
||
1391 | mov dword [eax+(4-1)*6], 'Код ' |
||
1392 | mov word [eax+(4-1)*6+4], ' ' |
||
1393 | jmp @f |
||
1394 | .hex: |
||
1395 | mov dword [eax+(4-1)*6], 'Текс' |
||
1396 | mov word [eax+(4-1)*6+4], 'т ' |
||
1397 | @@: |
||
1398 | test [ebp+viewer_data.flags], 2 |
||
1399 | jnz .unwrap |
||
1400 | mov dword [eax+6], 'Разв' |
||
1401 | mov word [eax+6+4], 'ер' |
||
1402 | jmp @f |
||
1403 | .unwrap: |
||
1404 | mov dword [eax+6], 'Свер' |
||
1405 | mov word [eax+6+4], 'н ' |
||
1406 | @@: |
||
1407 | else |
||
1408 | test [ebp+viewer_data.flags], 1 |
||
1409 | jnz .hex |
||
1410 | mov dword [eax+(4-1)*6], 'Hex ' |
||
1411 | ; mov word [eax+(4-1)*6+4], ' ' |
||
1412 | jmp @f |
||
1413 | .hex: |
||
1414 | mov dword [eax+(4-1)*6], 'Text' |
||
1415 | ; mov word [eax+(4-1)*6+4], ' ' |
||
1416 | @@: |
||
1417 | test [ebp+viewer_data.flags], 2 |
||
1418 | jnz .unwrap |
||
1419 | mov dword [eax+6], 'Unwr' |
||
1420 | mov word [eax+6+4], 'ap' |
||
1421 | jmp @f |
||
1422 | .unwrap: |
||
1423 | mov dword [eax+6], 'Wrap' |
||
1424 | mov word [eax+6+4], ' ' |
||
1425 | @@: |
||
1426 | end if |
||
1427 | movzx esi, [ebp+viewer_data.encoding] |
||
474 | diamond | 1428 | dec esi |
1429 | jz @f |
||
1430 | push 1 |
||
1431 | pop esi |
||
1432 | @@: |
||
180 | heavyiron | 1433 | lea esi, [encodings.names+esi*8] |
1434 | lea edi, [eax+keybar_cp-keybar_viewer] |
||
1435 | movsd |
||
1436 | movsw |
||
1437 | jmp draw_keybar |
||
1438 | |||
589 | diamond | 1439 | viewer_OnExit: |
1440 | mov edx, [ebp+viewer_data.hPlugin] |
||
1441 | test edx, edx |
||
1442 | jz @f |
||
1443 | and [ebp+viewer_data.hPlugin], 0 |
||
1444 | push edx ebp |
||
1445 | push [ebp+viewer_data.hWorkFile] |
||
1446 | call [edx+PluginInfo.close] |
||
1447 | pop ebp edx |
||
1448 | mov ebx, [ebp+viewer_data.hFile] |
||
1449 | call close_handle_if_unused |
||
1450 | @@: |
||
1451 | ret |
||
1452 | |||
1453 | viewer_IsHandleUsed: |
||
814 | diamond | 1454 | editor_IsHandleUsed: |
589 | diamond | 1455 | cmp edx, [ebp+viewer_data.hPlugin] |
1456 | jnz @f |
||
1457 | cmp ebx, [ebp+viewer_data.hFile] |
||
1458 | @@: |
||
1459 | ret |
||
1460 | |||
180 | heavyiron | 1461 | viewer_OnKey: |
1462 | mov esi, viewer_ctrlkeys |
||
1463 | jmp process_ctrl_keys |
||
1464 | .exit: |
||
589 | diamond | 1465 | call viewer_OnExit |
1466 | jmp delete_active_screen |
||
180 | heavyiron | 1467 | .down: |
1468 | cmp [ebp+viewer_data.bEofReached], 0 |
||
1469 | jnz .ret |
||
1470 | call viewer_seek_to_current |
||
1471 | call viewer_next_newline |
||
1472 | jc .ret |
||
1473 | call viewer_draw_text |
||
1474 | ret |
||
1475 | .pgdn: |
||
1476 | cmp [ebp+viewer_data.bEofReached], 0 |
||
1477 | jnz .ret |
||
1478 | call viewer_seek_to_current |
||
1479 | mov ebx, [cur_height] |
||
1480 | sub ebx, 3 |
||
1481 | @@: |
||
1482 | call viewer_next_newline |
||
1483 | jc .ret |
||
1484 | dec ebx |
||
1485 | jnz @b |
||
1486 | call viewer_draw_text |
||
1487 | ret |
||
1488 | .up: |
||
1489 | call viewer_seek_to_current |
||
1490 | call viewer_prev_newline |
||
1491 | call viewer_draw_text |
||
1492 | ret |
||
1493 | .pgup: |
||
1494 | call viewer_seek_to_current |
||
1495 | mov ebx, [cur_height] |
||
1496 | sub ebx, 3 |
||
1497 | @@: |
||
1498 | call viewer_prev_newline |
||
1499 | dec ebx |
||
1500 | jnz @b |
||
1501 | .done_redraw: |
||
1502 | call viewer_draw_text |
||
1503 | .ret: |
||
1504 | ret |
||
1505 | .f8: |
||
1506 | movzx esi, [ebp+viewer_data.encoding] |
||
474 | diamond | 1507 | dec [ebp+viewer_data.encoding] |
1508 | jz .done_redraw_keybar |
||
1509 | mov [ebp+viewer_data.encoding], 1 |
||
1510 | jmp .done_redraw_keybar |
||
180 | heavyiron | 1511 | .f2: |
1512 | xor [ebp+viewer_data.flags], 2 |
||
474 | diamond | 1513 | .done_redraw_keybar: |
180 | heavyiron | 1514 | call viewer_set_keybar |
1515 | jmp .done_redraw |
||
1516 | .f4: |
||
1517 | xor [ebp+viewer_data.flags], 1 |
||
1518 | pushf |
||
1519 | call viewer_set_keybar |
||
1520 | popf |
||
1521 | jnz .tohex |
||
474 | diamond | 1522 | push 1 |
1523 | pop eax |
||
1524 | cmp [ebp+viewer_data.encoding], encodings.unicode |
||
1525 | jnz @f |
||
1526 | add eax, eax |
||
1527 | @@: |
||
1528 | add dword [ebp+viewer_data.cur_pos], eax |
||
180 | heavyiron | 1529 | adc dword [ebp+viewer_data.cur_pos+4], 0 |
1530 | call viewer_seek_to_current |
||
1531 | call viewer_prev_newline |
||
1532 | jmp .done_redraw |
||
1533 | .tohex: |
||
1534 | and byte [ebp+viewer_data.cur_pos], 0xF0 |
||
1535 | jmp .done_redraw |
||
1536 | .home: |
||
1537 | xor eax, eax |
||
1538 | mov dword [ebp+viewer_data.cur_pos], eax |
||
1539 | mov dword [ebp+viewer_data.cur_pos+4], eax |
||
1540 | mov dword [ebp+viewer_data.col], eax |
||
1541 | mov dword [ebp+viewer_data.col+4], eax |
||
1542 | jmp .done_redraw |
||
1543 | .end: |
||
1544 | mov eax, dword [ebp+viewer_data.filesize] |
||
1545 | mov edx, dword [ebp+viewer_data.filesize+4] |
||
1546 | and al, 0xF0 |
||
1547 | mov dword [ebp+viewer_data.cur_pos], eax |
||
1548 | mov dword [ebp+viewer_data.cur_pos+4], edx |
||
1549 | and dword [ebp+viewer_data.col], 0 |
||
1550 | and dword [ebp+viewer_data.col+4], 0 |
||
1551 | jmp .done_redraw |
||
1552 | .right: |
||
1553 | add dword [ebp+viewer_data.col], 1 |
||
1554 | adc dword [ebp+viewer_data.col+4], 0 |
||
1555 | jnc .done_redraw |
||
1556 | sub dword [ebp+viewer_data.col], 1 |
||
1557 | sbb dword [ebp+viewer_data.col+4], 0 |
||
1558 | ret |
||
1559 | .left: |
||
1560 | sub dword [ebp+viewer_data.col], 1 |
||
1561 | sbb dword [ebp+viewer_data.col+4], 0 |
||
1562 | jnc .done_redraw |
||
1563 | add dword [ebp+viewer_data.col], 1 |
||
1564 | adc dword [ebp+viewer_data.col+4], 0 |
||
1565 | ret |
||
1566 | .ctrl_left: |
||
1567 | test [ebp+viewer_data.flags], 1 |
||
1568 | jnz .ctrl_left_hex |
||
1569 | sub dword [ebp+viewer_data.col], 20 |
||
1570 | sbb dword [ebp+viewer_data.col+4], 0 |
||
1571 | jnc .done_redraw |
||
1572 | .ctrl_shift_left: |
||
1573 | and dword [ebp+viewer_data.col], 0 |
||
1574 | and dword [ebp+viewer_data.col+4], 0 |
||
1575 | jmp .done_redraw |
||
1576 | .ctrl_left_hex: |
||
1577 | call viewer_seek_to_current |
||
1578 | call viewer_get_prev_char |
||
1579 | jc @f |
||
1580 | call viewer_set_curpos |
||
1581 | jmp .done_redraw |
||
1582 | .ctrl_right: |
||
1583 | test [ebp+viewer_data.flags], 1 |
||
1584 | jnz .ctrl_right_hex |
||
1585 | add dword [ebp+viewer_data.col], 20 |
||
1586 | adc dword [ebp+viewer_data.col+4], 0 |
||
1587 | jnc .done_redraw |
||
1588 | sub dword [ebp+viewer_data.col], 20 |
||
1589 | sbb dword [ebp+viewer_data.col+4], 0 |
||
1590 | @@: ret |
||
1591 | .ctrl_right_hex: |
||
1592 | call viewer_seek_to_current |
||
1593 | call viewer_get_next_char |
||
1594 | call viewer_set_curpos |
||
1595 | jmp .done_redraw |
||
1596 | .ctrl_shift_right: |
||
1597 | test [ebp+viewer_data.flags], 1 |
||
1598 | jnz @b |
||
1599 | mov eax, dword [viewer_right_side] |
||
1600 | mov edx, dword [viewer_right_side+4] |
||
1601 | sub eax, [cur_width] |
||
1602 | sbb edx, 0 |
||
1603 | jnc @f |
||
1604 | xor eax, eax |
||
1605 | xor edx, edx |
||
1606 | @@: |
||
1607 | mov dword [ebp+viewer_data.col], eax |
||
1608 | mov dword [ebp+viewer_data.col+4], edx |
||
1609 | jmp .done_redraw |
||
474 | diamond | 1610 | .shift_f8: |
1611 | mov ecx, encodings.menu.1 |
||
1612 | mov al, [ebp+viewer_data.encoding] |
||
1613 | @@: |
||
1614 | cmp byte [ecx-1], al |
||
1615 | jz @f |
||
1616 | mov ecx, [ecx] |
||
1617 | jmp @b |
||
1618 | @@: |
||
1619 | push 1 |
||
1620 | push aTables |
||
1621 | push ecx |
||
1622 | call menu |
||
1623 | cmp eax, -1 |
||
1624 | jz .ret |
||
1625 | mov al, [eax-1] |
||
1626 | mov [ebp+viewer_data.encoding], al |
||
1627 | cmp al, encodings.unicode |
||
1628 | jnz .done_redraw_keybar |
||
1629 | add dword [ebp+viewer_data.cur_pos], 1 |
||
1630 | adc dword [ebp+viewer_data.cur_pos+4], 0 |
||
1631 | and dword [ebp+viewer_data.cur_pos], not 1 |
||
1632 | jmp .done_redraw_keybar |
||
997 | diamond | 1633 | .f7: |
1634 | call viewer_clear_selection |
||
1635 | call find_in_file_dlg |
||
1636 | jz .shift_f7 |
||
1637 | .ret2: |
||
1638 | ret |
||
1639 | .shift_f7: |
||
1640 | ; search string SearchString in file starting from current position |
||
1641 | cmp byte [SearchString], 0 |
||
1642 | jz .ret2 |
||
1643 | mov eax, dword [ebp+viewer_data.selected_start] |
||
1644 | mov edx, dword [ebp+viewer_data.selected_start+4] |
||
1645 | inc eax |
||
1646 | jnz @f |
||
1647 | inc edx |
||
1648 | @@: |
||
1649 | cmp dword [ebp+viewer_data.selected_len], 0 |
||
1650 | jnz @f |
||
1651 | cmp dword [ebp+viewer_data.selected_len+4], 0 |
||
1652 | jnz @f |
||
1653 | mov eax, dword [ebp+viewer_data.cur_pos] |
||
1654 | mov edx, dword [ebp+viewer_data.cur_pos+4] |
||
1655 | @@: |
||
1656 | call viewer_clear_selection |
||
1657 | call viewer_seek |
||
1658 | call viewer_skip_unicode_marker |
||
1659 | mov esi, tolower_table |
||
1660 | test [find_in_file_dlgdata.flags_case], 10h |
||
1661 | jz @f |
||
1662 | mov esi, identical_table |
||
1663 | @@: |
||
1664 | mov ebx, SearchString |
||
1665 | test [find_in_file_dlgdata.flags_whole], 10h |
||
1666 | setnz al |
||
1667 | push eax |
||
1668 | push dword [ebp+viewer_data.encoding] |
||
1669 | call search_string_pre |
||
1670 | mov esi, [ebp+viewer_data.buf_pos] |
||
1671 | lea ebx, [ebp+viewer_data.buf] |
||
1672 | add ebx, [ebp+viewer_data.buf_size] |
||
1673 | mov edi, edx |
||
1674 | cmp esi, ebx |
||
1675 | jb @f |
||
1676 | sub ebx, ebp |
||
1677 | cmp ebx, viewer_data.buf + 16384 |
||
1678 | jnz .f7.notfound |
||
1679 | pusha |
||
1680 | call viewer_load_next |
||
1681 | popa |
||
1682 | jz .f7.notfound |
||
1683 | mov esi, [ebp+viewer_data.buf_pos] |
||
1684 | lea ebx, [ebp+viewer_data.buf] |
||
1685 | add ebx, [ebp+viewer_data.buf_size] |
||
1686 | @@: |
||
1687 | test [find_in_file_dlgdata.flags_whole], 10h |
||
1688 | jz .search_loop |
||
1689 | cmp dword [ebp+viewer_data.buf_start], 0 |
||
1690 | jnz @f |
||
1691 | cmp dword [ebp+viewer_data.buf_start+4], 0 |
||
1692 | jnz @f |
||
1693 | lea eax, [ebp+viewer_data.buf] |
||
1694 | cmp [ebp+viewer_data.buf_pos], eax |
||
1695 | jz .f7.startspace |
||
1696 | @@: |
||
1697 | xor eax, eax |
||
1698 | call viewer_get_prev_char |
||
1699 | inc esi |
||
1700 | cmp [isspace_table+eax], 0 |
||
1701 | jz .search_loop |
||
1702 | .f7.startspace: |
||
1703 | add edi, 256 |
||
1704 | .search_loop: |
||
1705 | ; edx -> FSM, ecx = last state, edi = current state, |
||
1706 | ; esi = buf_pos, ebx = end of buffer |
||
1707 | ; get current symbol |
||
1708 | movzx eax, byte [esi] |
||
1709 | ; calculate next state |
||
1710 | movzx edi, byte [edi+eax] |
||
1711 | ; done? |
||
1712 | cmp edi, ecx |
||
1713 | jz .f7.found |
||
1714 | .search_loop_next: |
||
1715 | ; no; proceed to next symbol |
||
1716 | shl edi, 8 |
||
1717 | add esi, 1 |
||
1718 | add edi, edx |
||
1719 | cmp esi, ebx |
||
1720 | jb .search_loop |
||
1721 | sub ebx, ebp |
||
1722 | cmp ebx, viewer_data.buf + 16384 |
||
1723 | jnz .f7.notfound |
||
1724 | mov [ebp+viewer_data.buf_pos], esi |
||
1725 | pusha |
||
1726 | call viewer_load_next |
||
1727 | popa |
||
1728 | jz .f7.notfoundt |
||
1729 | mov esi, [ebp+viewer_data.buf_pos] |
||
1730 | lea ebx, [ebp+viewer_data.buf] |
||
1731 | add ebx, [ebp+viewer_data.buf_size] |
||
1732 | jmp .search_loop |
||
1733 | .f7.notfoundt: |
||
1734 | ; last chance - if we are looking for a whole word, EOF is ok for last symbol |
||
1735 | test [find_in_file_dlgdata.flags_whole], 10h |
||
1736 | jz .f7.notfound |
||
1737 | movzx edi, byte [edi+' '] |
||
1738 | inc esi |
||
1739 | cmp edi, ecx |
||
1740 | jz .f7.found |
||
1741 | .f7.notfound: |
||
1742 | call search_failed |
||
1743 | jmp .done_redraw |
||
1744 | .f7.found: |
||
1745 | push ecx |
||
1746 | mov ecx, edx |
||
1747 | call pgfree |
||
1748 | mov [ebp+viewer_data.buf_pos], esi |
||
1749 | call viewer_set_curpos |
||
1750 | pop ecx |
||
1751 | mov dword [ebp+viewer_data.selected_len], ecx |
||
1752 | and dword [ebp+viewer_data.selected_len+4], 0 |
||
1753 | dec ecx |
||
1754 | sub eax, ecx |
||
1755 | sbb edx, 0 |
||
1756 | mov dword [ebp+viewer_data.selected_start], eax |
||
1757 | mov dword [ebp+viewer_data.selected_start+4], edx |
||
1758 | inc eax |
||
1759 | jnz @f |
||
1760 | inc edx |
||
1761 | @@: |
||
1762 | test [find_in_file_dlgdata.flags_whole], 10h |
||
1763 | jz @f |
||
1764 | sub dword [ebp+viewer_data.selected_len], 2 |
||
1765 | sbb dword [ebp+viewer_data.selected_len+4], 0 |
||
1766 | mov dword [ebp+viewer_data.selected_start], eax |
||
1767 | mov dword [ebp+viewer_data.selected_start+4], edx |
||
1768 | inc eax |
||
1769 | jnz @f |
||
1770 | inc edx |
||
1771 | @@: |
||
1772 | mov dword [ebp+viewer_data.cur_pos], eax |
||
1773 | mov dword [ebp+viewer_data.cur_pos+4], edx |
||
1774 | call viewer_seek |
||
1775 | call viewer_prev_newline |
||
1776 | jmp .done_redraw |
||
180 | heavyiron | 1777 | |
997 | diamond | 1778 | search_failed: |
1779 | mov ecx, edx |
||
1780 | call pgfree |
||
1781 | mov eax, SearchString-1 |
||
1782 | push dword [eax-3] |
||
1783 | push eax |
||
1784 | mov byte [eax], '"' |
||
1785 | @@: |
||
1786 | inc eax |
||
1787 | cmp byte [eax], 0 |
||
1788 | jnz @b |
||
1789 | mov word [eax], '"' |
||
1790 | xchg eax, [esp] |
||
1791 | push eax |
||
1792 | push aStringNotFound |
||
1793 | mov eax, esp |
||
1794 | push ContinueBtn |
||
1795 | push 1 |
||
1796 | push eax |
||
1797 | push 2 |
||
1798 | push aSearch |
||
1799 | call SayErrTitle |
||
1800 | pop eax |
||
1801 | pop eax |
||
1802 | pop ecx |
||
1803 | mov byte [ecx], 0 |
||
1804 | pop dword [eax-3] |
||
1805 | ret |
||
1806 | |||
180 | heavyiron | 1807 | viewer_getname: |
1808 | if lang eq ru |
||
1809 | mov eax, 'Прос' |
||
1810 | stosd |
||
1811 | mov eax, 'мотр' |
||
1812 | stosd |
||
1813 | mov eax, ' ' |
||
1814 | stosd |
||
1815 | stosb |
||
1816 | else |
||
1817 | mov eax, 'View' |
||
1818 | stosd |
||
1819 | mov eax, ' ' |
||
1820 | stosd |
||
1821 | stosd |
||
1822 | stosb |
||
1823 | end if |
||
814 | diamond | 1824 | jmp viewedit_getname |
1825 | editor_getname: |
||
1826 | if lang eq ru |
||
1827 | mov eax, 'Реда' |
||
1828 | stosd |
||
1829 | mov eax, 'ктор' |
||
1830 | stosd |
||
1831 | mov eax, ' ' |
||
1832 | stosd |
||
1833 | stosb |
||
1834 | else |
||
1835 | mov eax, 'Edit' |
||
1836 | stosd |
||
1837 | mov eax, ' ' |
||
1838 | stosd |
||
1839 | stosd |
||
1840 | stosb |
||
1841 | end if |
||
1842 | viewedit_getname: |
||
180 | heavyiron | 1843 | sub ecx, 13 |
589 | diamond | 1844 | cmp [ebp+viewer_data.hPlugin], 0 |
1845 | jz .native |
||
1846 | lea esi, [ebp+viewer_data.hostname] |
||
1847 | push ecx edi |
||
1848 | shr ecx, 1 |
||
1849 | @@: |
||
1850 | lodsb |
||
1851 | test al, al |
||
1852 | jz @f |
||
1853 | stosb |
||
1854 | loop @b |
||
1855 | @@: |
||
1856 | sub edi, [esp] |
||
1857 | sub [esp+4], edi |
||
1858 | add [esp], edi |
||
1859 | pop edi ecx |
||
180 | heavyiron | 1860 | lea esi, [ebp+viewer_data.filename] |
589 | diamond | 1861 | jmp .main |
1862 | .native: |
||
1863 | lea esi, [ebp+viewer_data.filename] |
||
180 | heavyiron | 1864 | push 3 |
1865 | pop edx |
||
1866 | @@: |
||
1867 | lodsb |
||
1868 | stosb |
||
1869 | dec ecx |
||
589 | diamond | 1870 | test al, al |
1871 | jz .ret |
||
180 | heavyiron | 1872 | cmp al, '/' |
1873 | jnz @b |
||
1874 | dec edx |
||
1875 | jnz @b |
||
589 | diamond | 1876 | .main: |
180 | heavyiron | 1877 | push esi |
1878 | @@: |
||
1879 | lodsb |
||
1880 | test al, al |
||
1881 | jnz @b |
||
1882 | sub esi, [esp] |
||
1883 | dec esi |
||
1884 | cmp esi, ecx |
||
1885 | jbe @f |
||
1886 | mov al, '.' |
||
1887 | stosb |
||
1888 | stosb |
||
1889 | stosb |
||
1890 | sub ecx, 3 |
||
1891 | sub esi, ecx |
||
1892 | add [esp], esi |
||
1893 | @@: |
||
1894 | pop esi |
||
1895 | @@: |
||
1896 | lodsb |
||
1897 | stosb |
||
1898 | test al, al |
||
1899 | jnz @b |
||
589 | diamond | 1900 | .ret: |
180 | heavyiron | 1901 | ret' |