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