Rev 589 | Rev 8984 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
183 | diamond | 1 | ; int __stdcall GenericBox(DLGTEMPLATE* dlg, void* DlgProc); |
2 | ; int __stdcall DlgProc(DLGTEMPLATE* dlg, int msg, int param1, int param2); |
||
180 | heavyiron | 3 | |
4 | virtual at 0 |
||
5 | dlgtemplate: |
||
314 | diamond | 6 | ; Флаги: |
7 | ; бит 0: использовать стандартные цвета диалога |
||
8 | ; бит 1: использовать стандартные цвета предупреждения/ошибки |
||
9 | ; (если любой из этих битов установлен, поля main_color,border_color,header_color |
||
10 | ; игнорируются) |
||
814 | diamond | 11 | ; бит 2: не рисовать тень |
180 | heavyiron | 12 | .flags dd ? |
13 | .x dd ? |
||
14 | .y dd ? |
||
15 | .width dd ? |
||
16 | .height dd ? |
||
17 | .border_size_x dd ? |
||
18 | .border_size_y dd ? |
||
19 | .title dd ? |
||
20 | .main_color db ? |
||
21 | .border_color db ? |
||
22 | .header_color db ? |
||
23 | db ? ; align |
||
814 | diamond | 24 | .dataptr dd ? ; used internally, ignored on input |
183 | diamond | 25 | .size = $ |
180 | heavyiron | 26 | end virtual |
27 | |||
183 | diamond | 28 | GenericBox: |
814 | diamond | 29 | push [cursor_x] |
30 | push [cursor_y] |
||
31 | push dword [esp+8+8] |
||
32 | push dword [esp+8+8] |
||
33 | call ShowGenericBox |
||
34 | test eax, eax |
||
35 | jz @f |
||
36 | pop [cursor_y] |
||
37 | pop [cursor_x] |
||
38 | ret |
||
39 | @@: |
||
180 | heavyiron | 40 | pushad |
814 | diamond | 41 | ; message loop |
42 | .event: |
||
43 | push 10 |
||
44 | pop eax |
||
45 | int 40h |
||
46 | dec eax |
||
47 | jz .redraw |
||
48 | dec eax |
||
49 | jz .key |
||
50 | jmp exit |
||
51 | .redraw: |
||
52 | call draw_window |
||
53 | jmp .event |
||
54 | .key: |
||
55 | mov al, 2 |
||
56 | int 40h |
||
57 | shr eax, 8 |
||
58 | cmp al, 0xE0 |
||
59 | jnz @f |
||
60 | mov [bWasE0], 1 |
||
61 | jmp .event |
||
62 | @@: |
||
63 | xchg ah, [bWasE0] |
||
64 | cmp al, 0x1D |
||
65 | jz .ctrl_down |
||
66 | cmp al, 0x9D |
||
67 | jz .ctrl_up |
||
68 | cmp al, 0x2A |
||
69 | jz .lshift_down |
||
70 | cmp al, 0xAA |
||
71 | jz .lshift_up |
||
72 | cmp al, 0x36 |
||
73 | jz .rshift_down |
||
74 | cmp al, 0xB6 |
||
75 | jz .rshift_up |
||
76 | cmp al, 0x38 |
||
77 | jz .alt_down |
||
78 | cmp al, 0xB8 |
||
79 | jz .alt_up |
||
80 | mov ebx, [esp+24h+8] |
||
81 | mov ecx, [esp+28h+8] |
||
82 | push 0 |
||
83 | push eax |
||
84 | push 2 |
||
85 | push ebx |
||
86 | call ecx |
||
87 | test eax, eax |
||
88 | jz .event |
||
89 | mov [esp+28], eax |
||
90 | jmp .exit |
||
91 | .ctrl_down: |
||
92 | test ah, ah |
||
93 | jnz .rctrl_down |
||
94 | or [ctrlstate], 4 |
||
95 | jmp .event |
||
96 | .rctrl_down: |
||
97 | or [ctrlstate], 8 |
||
98 | jmp .event |
||
99 | .ctrl_up: |
||
100 | test ah, ah |
||
101 | jnz .rctrl_up |
||
102 | and [ctrlstate], not 4 |
||
103 | jmp .event |
||
104 | .rctrl_up: |
||
105 | and [ctrlstate], not 8 |
||
106 | jmp .event |
||
107 | .lshift_down: |
||
108 | test ah, ah |
||
109 | jnz @f |
||
110 | or [ctrlstate], 1 |
||
111 | @@: jmp .event |
||
112 | .lshift_up: |
||
113 | test ah, ah |
||
114 | jnz @b |
||
115 | and [ctrlstate], not 1 |
||
116 | jmp @b |
||
117 | .rshift_down: |
||
118 | or [ctrlstate], 2 |
||
119 | jmp .event |
||
120 | .rshift_up: |
||
121 | and [ctrlstate], not 2 |
||
122 | jmp .event |
||
123 | .alt_down: |
||
124 | test ah, ah |
||
125 | jnz .ralt_down |
||
126 | or [ctrlstate], 0x10 |
||
127 | jmp .event |
||
128 | .ralt_down: |
||
129 | or [ctrlstate], 0x20 |
||
130 | jmp .event |
||
131 | .alt_up: |
||
132 | test ah, ah |
||
133 | jnz .ralt_up |
||
134 | and [ctrlstate], not 0x10 |
||
135 | jmp .event |
||
136 | .ralt_up: |
||
137 | and [ctrlstate], not 0x20 |
||
138 | jmp .event |
||
139 | .exit: |
||
140 | popad |
||
141 | push eax |
||
142 | push 0 |
||
143 | push dword [esp+12+8] |
||
144 | call HideGenericBox |
||
145 | pop eax |
||
146 | pop [cursor_y] |
||
147 | pop [cursor_x] |
||
148 | pushad |
||
149 | call draw_image |
||
150 | popad |
||
151 | ret 8 |
||
152 | |||
153 | ; int __stdcall ShowGenericBox(DLGTEMPLATE* dlg, void* DlgProc); |
||
154 | ShowGenericBox: |
||
155 | pushad |
||
183 | diamond | 156 | mov ebx, [esp+20h+4] |
157 | ; center window if required |
||
474 | diamond | 158 | push [ebx+dlgtemplate.x] |
159 | push [ebx+dlgtemplate.y] |
||
183 | diamond | 160 | cmp [ebx+dlgtemplate.x], -1 |
161 | jnz @f |
||
162 | mov eax, [cur_width] |
||
163 | sub eax, [ebx+dlgtemplate.width] |
||
164 | shr eax, 1 |
||
165 | mov [ebx+dlgtemplate.x], eax |
||
166 | @@: |
||
167 | cmp [ebx+dlgtemplate.y], -1 |
||
168 | jnz @f |
||
169 | mov eax, [cur_height] |
||
170 | sub eax, [ebx+dlgtemplate.height] |
||
171 | shr eax, 1 |
||
172 | mov [ebx+dlgtemplate.y], eax |
||
173 | @@: |
||
180 | heavyiron | 174 | ; some checks |
175 | mov eax, [ebx+dlgtemplate.x] |
||
176 | cmp eax, 1 |
||
177 | jl .sizeerr |
||
178 | add eax, [ebx+dlgtemplate.width] |
||
179 | cmp eax, [cur_width] |
||
180 | jge .sizeerr |
||
181 | mov eax, [ebx+dlgtemplate.y] |
||
182 | cmp eax, 1 |
||
183 | jl .sizeerr |
||
184 | add eax, [ebx+dlgtemplate.height] |
||
185 | cmp eax, [cur_height] |
||
186 | jge .sizeerr |
||
187 | cmp [ebx+dlgtemplate.border_size_x], 1 |
||
188 | jl .sizeerr |
||
189 | cmp [ebx+dlgtemplate.border_size_y], 1 |
||
190 | jge .sizeok |
||
191 | .sizeerr: |
||
474 | diamond | 192 | pop [ebx+dlgtemplate.y] |
193 | pop [ebx+dlgtemplate.x] |
||
180 | heavyiron | 194 | popad |
195 | or eax, -1 |
||
196 | ret 8 |
||
197 | .sizeok: |
||
314 | diamond | 198 | ; set color if required |
199 | test byte [ebx+dlgtemplate.flags], 1 |
||
200 | jz @f |
||
201 | mov edi, dialog_colors |
||
202 | jmp .setcolor |
||
203 | @@: |
||
204 | test byte [ebx+dlgtemplate.flags], 2 |
||
205 | jz @f |
||
206 | mov edi, warning_colors |
||
207 | .setcolor: |
||
474 | diamond | 208 | mov al, [edi + dialog_main_color-dialog_colors] |
314 | diamond | 209 | mov [ebx+dlgtemplate.main_color], al |
474 | diamond | 210 | mov al, [edi + dialog_border_color-dialog_colors] |
314 | diamond | 211 | mov [ebx+dlgtemplate.border_color], al |
474 | diamond | 212 | mov al, [edi + dialog_header_color-dialog_colors] |
314 | diamond | 213 | mov [ebx+dlgtemplate.header_color], al |
214 | @@: |
||
180 | heavyiron | 215 | ; allocate memory for data under dialog |
314 | diamond | 216 | ; for 'No memory' dialog use static data area |
814 | diamond | 217 | mov eax, nomem_dlgsavearea |
314 | diamond | 218 | cmp ebx, nomem_dlgdata |
219 | jz .allocated |
||
180 | heavyiron | 220 | mov eax, [ebx+dlgtemplate.width] |
221 | add eax, [ebx+dlgtemplate.border_size_x] |
||
222 | add eax, [ebx+dlgtemplate.border_size_x] |
||
223 | inc eax |
||
224 | inc eax |
||
225 | mov edx, [ebx+dlgtemplate.height] |
||
226 | add edx, [ebx+dlgtemplate.border_size_y] |
||
227 | add edx, [ebx+dlgtemplate.border_size_y] |
||
228 | inc edx |
||
229 | mul edx |
||
814 | diamond | 230 | lea ecx, [eax*2+8] |
474 | diamond | 231 | call xpgalloc |
180 | heavyiron | 232 | test eax, eax |
233 | jnz @f |
||
474 | diamond | 234 | pop [ebx+dlgtemplate.y] |
235 | pop [ebx+dlgtemplate.x] |
||
180 | heavyiron | 236 | popad |
237 | or eax, -1 |
||
238 | ret 8 |
||
239 | @@: |
||
314 | diamond | 240 | .allocated: |
814 | diamond | 241 | mov [ebx+dlgtemplate.dataptr], eax |
242 | pop dword [eax+4] |
||
243 | pop dword [eax] |
||
244 | lea ebp, [eax+8] |
||
180 | heavyiron | 245 | ; save data |
246 | mov eax, [ebx+dlgtemplate.y] |
||
247 | add eax, [ebx+dlgtemplate.height] |
||
248 | add eax, [ebx+dlgtemplate.border_size_y] |
||
249 | inc eax |
||
250 | push eax |
||
251 | mov eax, [ebx+dlgtemplate.x] |
||
252 | add eax, [ebx+dlgtemplate.width] |
||
253 | add eax, [ebx+dlgtemplate.border_size_x] |
||
254 | inc eax |
||
255 | inc eax |
||
256 | push eax |
||
257 | mov eax, [ebx+dlgtemplate.y] |
||
258 | sub eax, [ebx+dlgtemplate.border_size_y] |
||
259 | push eax |
||
260 | mov eax, [ebx+dlgtemplate.x] |
||
261 | sub eax, [ebx+dlgtemplate.border_size_x] |
||
262 | push eax |
||
263 | call save_console_data |
||
264 | ; draw shadow |
||
814 | diamond | 265 | test byte [ebx+dlgtemplate.flags], 4 |
266 | jnz .noshadow |
||
180 | heavyiron | 267 | mov eax, [ebx+dlgtemplate.x] |
268 | sub eax, [ebx+dlgtemplate.border_size_x] |
||
269 | ja @f |
||
270 | xor eax, eax |
||
271 | @@: |
||
272 | inc eax |
||
273 | inc eax |
||
274 | mov edx, [ebx+dlgtemplate.y] |
||
275 | sub edx, [ebx+dlgtemplate.border_size_y] |
||
276 | ja @f |
||
277 | xor edx, edx |
||
278 | @@: |
||
279 | inc edx |
||
280 | call get_console_ptr |
||
281 | mov ecx, [ebx+dlgtemplate.y] |
||
282 | add ecx, [ebx+dlgtemplate.height] |
||
283 | add ecx, [ebx+dlgtemplate.border_size_y] |
||
284 | inc ecx |
||
285 | cmp ecx, [cur_height] |
||
286 | jb @f |
||
287 | mov ecx, [cur_height] |
||
288 | @@: |
||
289 | sub ecx, edx |
||
290 | mov edx, ecx |
||
291 | mov ecx, [ebx+dlgtemplate.x] |
||
292 | add ecx, [ebx+dlgtemplate.width] |
||
293 | add ecx, [ebx+dlgtemplate.border_size_x] |
||
294 | inc ecx |
||
295 | inc ecx |
||
296 | cmp ecx, [cur_width] |
||
297 | jb @f |
||
298 | mov ecx, [cur_width] |
||
299 | @@: |
||
300 | sub ecx, eax |
||
301 | mov eax, ecx |
||
302 | .shadow_loop: |
||
303 | mov ecx, eax |
||
304 | push edi |
||
305 | .sl1: |
||
306 | inc edi |
||
307 | test byte [edi], 0x0F |
||
308 | jnz @f |
||
309 | or byte [edi], 8 |
||
310 | @@: |
||
311 | and byte [edi], 0x0F |
||
312 | inc edi |
||
313 | loop .sl1 |
||
314 | pop edi |
||
315 | add edi, [cur_width] |
||
316 | add edi, [cur_width] |
||
317 | dec edx |
||
318 | jnz .shadow_loop |
||
814 | diamond | 319 | .noshadow: |
320 | popad |
||
321 | push dword [esp+8] |
||
322 | push dword [esp+8] |
||
323 | call DrawGenericBox |
||
324 | xor eax, eax |
||
325 | ret 8 |
||
326 | |||
327 | ; void __stdcall DrawGenericBox(DLGDATA* dlg, void* DlgProc) |
||
328 | DrawGenericBox: |
||
329 | pushad |
||
330 | mov ebx, [esp+24h] |
||
180 | heavyiron | 331 | ; draw area background |
814 | diamond | 332 | mov eax, [ebx+dlgtemplate.x] |
333 | sub eax, [ebx+dlgtemplate.border_size_x] |
||
334 | ja @f |
||
335 | xor eax, eax |
||
336 | @@: |
||
337 | mov edx, [ebx+dlgtemplate.y] |
||
338 | sub edx, [ebx+dlgtemplate.border_size_y] |
||
339 | ja @f |
||
340 | xor edx, edx |
||
341 | @@: |
||
180 | heavyiron | 342 | call get_console_ptr |
343 | mov ecx, [ebx+dlgtemplate.x] |
||
344 | add ecx, [ebx+dlgtemplate.width] |
||
345 | add ecx, [ebx+dlgtemplate.border_size_x] |
||
346 | cmp ecx, [cur_width] |
||
347 | jb @f |
||
348 | mov ecx, [cur_width] |
||
349 | @@: |
||
350 | sub ecx, eax |
||
351 | mov esi, ecx |
||
352 | mov ecx, [ebx+dlgtemplate.y] |
||
353 | add ecx, [ebx+dlgtemplate.height] |
||
354 | add ecx, [ebx+dlgtemplate.border_size_y] |
||
355 | cmp ecx, [cur_height] |
||
356 | jb @f |
||
357 | mov ecx, [cur_height] |
||
358 | @@: |
||
359 | sub ecx, edx |
||
360 | mov edx, ecx |
||
361 | mov al, ' ' |
||
362 | mov ah, [ebx+dlgtemplate.border_color] |
||
363 | .1: |
||
364 | mov ecx, esi |
||
365 | push edi |
||
366 | rep stosw |
||
367 | pop edi |
||
368 | add edi, [cur_width] |
||
369 | add edi, [cur_width] |
||
370 | dec edx |
||
371 | jnz .1 |
||
372 | ; draw border |
||
373 | mov eax, [ebx+dlgtemplate.x] |
||
374 | dec eax |
||
375 | mov edx, [ebx+dlgtemplate.y] |
||
376 | dec edx |
||
377 | call get_console_ptr |
||
378 | mov edx, [ebx+dlgtemplate.height] |
||
379 | inc edx |
||
380 | inc edx |
||
381 | mov ah, [ebx+dlgtemplate.border_color] |
||
382 | push ebx |
||
383 | mov ebx, [ebx+dlgtemplate.width] |
||
384 | inc ebx |
||
385 | inc ebx |
||
386 | call draw_border |
||
387 | pop ebx |
||
388 | ; draw header |
||
389 | mov esi, [ebx+dlgtemplate.title] |
||
390 | test esi, esi |
||
391 | jz .noheader |
||
392 | cmp byte [esi], 0 |
||
393 | jz .noheader |
||
394 | push esi |
||
395 | @@: lodsb |
||
396 | test al, al |
||
397 | jnz @b |
||
398 | mov eax, esi |
||
399 | pop esi |
||
400 | sub eax, esi |
||
283 | diamond | 401 | inc eax ; eax = длина заголовка + 2 |
180 | heavyiron | 402 | mov ecx, [ebx+dlgtemplate.width] |
403 | cmp eax, ecx |
||
404 | jbe .fullhea |
||
405 | sub ecx, 5 |
||
406 | jb .noheader |
||
407 | xor edx, edx |
||
408 | jmp .drawhea |
||
409 | .fullhea: |
||
410 | mov edx, ecx |
||
411 | sub edx, eax |
||
412 | shr edx, 1 |
||
413 | .drawhea: |
||
414 | mov eax, [ebx+dlgtemplate.x] |
||
415 | add eax, edx |
||
416 | mov edx, [ebx+dlgtemplate.y] |
||
417 | dec edx |
||
418 | call get_console_ptr |
||
419 | mov ah, [ebx+dlgtemplate.header_color] |
||
420 | mov al, ' ' |
||
421 | stosw |
||
283 | diamond | 422 | .2: |
180 | heavyiron | 423 | dec ecx |
283 | diamond | 424 | jz .3 |
180 | heavyiron | 425 | lodsb |
426 | test al, al |
||
427 | jz .4 |
||
428 | stosw |
||
429 | jmp .2 |
||
430 | .3: |
||
431 | mov al, '.' |
||
432 | stosw |
||
433 | stosw |
||
434 | stosw |
||
435 | .4: |
||
436 | mov al, ' ' |
||
437 | stosw |
||
438 | .noheader: |
||
439 | ; draw window background |
||
440 | mov eax, [ebx+dlgtemplate.x] |
||
441 | mov edx, [ebx+dlgtemplate.y] |
||
442 | call get_console_ptr |
||
443 | mov ah, [ebx+dlgtemplate.main_color] |
||
444 | mov al, ' ' |
||
445 | mov edx, [ebx+dlgtemplate.height] |
||
446 | @@: |
||
447 | mov ecx, [ebx+dlgtemplate.width] |
||
448 | push edi |
||
449 | rep stosw |
||
450 | pop edi |
||
451 | add edi, [cur_width] |
||
452 | add edi, [cur_width] |
||
453 | dec edx |
||
454 | jnz @b |
||
455 | ; send redraw message |
||
814 | diamond | 456 | mov eax, [esp+28h] |
180 | heavyiron | 457 | push 0 |
458 | push 0 |
||
459 | push 1 |
||
183 | diamond | 460 | push ebx |
180 | heavyiron | 461 | call eax |
462 | call draw_image |
||
814 | diamond | 463 | popad |
464 | ret 8 |
||
465 | |||
466 | ; void __stdcall HideGenericBox(DLGTEMPLATE* dlg, int bRedrawWindow); |
||
467 | HideGenericBox: |
||
468 | ; void __stdcall HideDialogBox(DLGDATA* dlg, int bRedrawWindow); |
||
469 | HideDialogBox: |
||
470 | pushad |
||
471 | mov ebx, [esp+24h] |
||
472 | mov ebp, [ebx+dlgtemplate.dataptr] |
||
473 | add ebp, 8 |
||
180 | heavyiron | 474 | ; restore data |
475 | mov eax, [ebx+dlgtemplate.y] |
||
476 | add eax, [ebx+dlgtemplate.height] |
||
477 | add eax, [ebx+dlgtemplate.border_size_y] |
||
478 | inc eax |
||
479 | push eax |
||
480 | mov eax, [ebx+dlgtemplate.x] |
||
481 | add eax, [ebx+dlgtemplate.width] |
||
482 | add eax, [ebx+dlgtemplate.border_size_x] |
||
483 | inc eax |
||
484 | inc eax |
||
485 | push eax |
||
486 | mov eax, [ebx+dlgtemplate.y] |
||
487 | sub eax, [ebx+dlgtemplate.border_size_y] |
||
488 | push eax |
||
489 | mov eax, [ebx+dlgtemplate.x] |
||
490 | sub eax, [ebx+dlgtemplate.border_size_x] |
||
491 | push eax |
||
492 | call restore_console_data |
||
493 | call draw_keybar |
||
814 | diamond | 494 | lea ecx, [ebp-8] |
495 | push dword [ecx] |
||
496 | push dword [ecx+4] |
||
497 | pop [ebx+dlgtemplate.y] |
||
498 | pop [ebx+dlgtemplate.x] |
||
314 | diamond | 499 | cmp ebx, nomem_dlgdata |
500 | jz @f |
||
474 | diamond | 501 | call pgfree |
314 | diamond | 502 | @@: |
283 | diamond | 503 | or [cursor_x], -1 |
504 | or [cursor_y], -1 |
||
814 | diamond | 505 | cmp dword [esp+28h], 0 |
506 | jz @f |
||
180 | heavyiron | 507 | call draw_image |
814 | diamond | 508 | @@: |
180 | heavyiron | 509 | popad |
510 | ret 8 |
||
511 | |||
512 | save_console_data: |
||
513 | cmp dword [esp+4], 0 |
||
514 | jge @f |
||
515 | and dword [esp+4], 0 |
||
516 | @@: |
||
517 | cmp dword [esp+8], 0 |
||
518 | jge @f |
||
519 | and dword [esp+8], 0 |
||
520 | @@: |
||
521 | mov eax, [esp+12] |
||
522 | cmp eax, [cur_width] |
||
523 | jbe @f |
||
524 | mov eax, [cur_width] |
||
525 | @@: |
||
526 | sub eax, [esp+4] |
||
527 | ja @f |
||
528 | ret 16 |
||
529 | @@: |
||
530 | mov [esp+12], eax |
||
531 | mov eax, [esp+16] |
||
532 | cmp eax, [cur_height] |
||
533 | jbe @f |
||
534 | mov eax, [cur_height] |
||
535 | @@: |
||
536 | sub eax, [esp+8] |
||
537 | ja @f |
||
538 | ret 16 |
||
539 | @@: |
||
540 | mov [esp+16], eax |
||
541 | mov eax, [esp+4] |
||
542 | mov edx, [esp+8] |
||
543 | call get_console_ptr |
||
544 | mov esi, edi |
||
545 | mov edi, ebp |
||
546 | .l: |
||
547 | mov ecx, [esp+12] |
||
548 | push esi |
||
549 | shr ecx, 1 |
||
550 | rep movsd |
||
551 | adc ecx, ecx |
||
552 | rep movsw |
||
553 | pop esi |
||
554 | add esi, [cur_width] |
||
555 | add esi, [cur_width] |
||
556 | dec dword [esp+16] |
||
557 | jnz .l |
||
558 | ret 16 |
||
559 | |||
560 | restore_console_data: |
||
561 | cmp dword [esp+4], 0 |
||
562 | jge @f |
||
563 | and dword [esp+4], 0 |
||
564 | @@: |
||
565 | cmp dword [esp+8], 0 |
||
566 | jge @f |
||
567 | and dword [esp+8], 0 |
||
568 | @@: |
||
569 | mov eax, [esp+12] |
||
570 | cmp eax, [cur_width] |
||
571 | jbe @f |
||
572 | mov eax, [cur_width] |
||
573 | @@: |
||
574 | sub eax, [esp+4] |
||
575 | ja @f |
||
576 | ret 16 |
||
577 | @@: |
||
578 | mov [esp+12], eax |
||
579 | mov eax, [esp+16] |
||
580 | cmp eax, [cur_height] |
||
581 | jbe @f |
||
582 | mov eax, [cur_height] |
||
583 | @@: |
||
584 | sub eax, [esp+8] |
||
585 | ja @f |
||
586 | ret 16 |
||
587 | @@: |
||
588 | mov [esp+16], eax |
||
589 | mov eax, [esp+4] |
||
590 | mov edx, [esp+8] |
||
591 | call get_console_ptr |
||
592 | mov esi, ebp |
||
593 | .l: |
||
594 | mov ecx, [esp+12] |
||
595 | push edi |
||
596 | shr ecx, 1 |
||
597 | rep movsd |
||
598 | adc ecx, ecx |
||
599 | rep movsw |
||
600 | pop edi |
||
601 | add edi, [cur_width] |
||
602 | add edi, [cur_width] |
||
603 | dec dword [esp+16] |
||
604 | jnz .l |
||
605 | ret 16 |
||
606 | |||
607 | ; int __stdcall menu(void* variants, const char* title, unsigned flags); |
||
608 | ; variants указывает на текущий элемент в двусвязном линейном списке |
||
609 | menu: |
||
610 | pop eax |
||
611 | push [cur_height] |
||
612 | push [cur_width] |
||
613 | push 0 |
||
614 | push 0 |
||
615 | push eax |
||
616 | |||
617 | ; int __stdcall menu_centered_in(unsigned left, unsigned top, unsigned width, unsigned height, |
||
618 | ; void* variants, const char* title, unsigned flags); |
||
619 | menu_centered_in: |
||
620 | pushad |
||
814 | diamond | 621 | mov ecx, 60 |
622 | ; 40 bytes for dlgtemplate + additional: |
||
623 | ; +40: dd cur_variant |
||
624 | ; +44: dd num_variants |
||
625 | ; +48: dd begin_variant |
||
626 | ; +52: dd end_variant |
||
627 | ; +56: dd cur_variant_idx |
||
474 | diamond | 628 | call xpgalloc |
180 | heavyiron | 629 | test eax, eax |
630 | jnz @f |
||
631 | .ret_bad: |
||
632 | popad |
||
633 | or eax, -1 |
||
634 | ret 28 |
||
635 | @@: |
||
636 | mov ebx, eax |
||
637 | mov eax, 1 |
||
638 | test byte [esp+20h+28], 1 |
||
639 | jz @f |
||
640 | mov al, 3 |
||
641 | @@: |
||
642 | mov [ebx+dlgtemplate.border_size_x], eax |
||
643 | inc eax |
||
644 | shr eax, 1 |
||
645 | mov [ebx+dlgtemplate.border_size_y], eax |
||
646 | ; Находим ширину и высоту окна |
||
647 | xor eax, eax |
||
648 | xor ecx, ecx |
||
649 | mov esi, [esp+20h+20] |
||
814 | diamond | 650 | mov [ebx+40], esi |
651 | and dword [ebx+56], 0 |
||
180 | heavyiron | 652 | @@: |
653 | cmp dword [esi+4], 0 |
||
654 | jz .find_width |
||
655 | mov esi, [esi+4] |
||
814 | diamond | 656 | inc dword [ebx+56] |
180 | heavyiron | 657 | jmp @b |
658 | .find_width: |
||
814 | diamond | 659 | mov [ebx+48], esi |
180 | heavyiron | 660 | add esi, 8 |
661 | push esi |
||
662 | xor edx, edx |
||
663 | .fw1: |
||
664 | cmp byte [esi], '&' |
||
665 | jnz @f |
||
666 | mov dl, 1 |
||
667 | @@: |
||
668 | inc esi |
||
669 | cmp byte [esi-1], 0 |
||
670 | jnz .fw1 |
||
671 | sub esi, [esp] |
||
672 | sub esi, edx |
||
673 | dec esi |
||
674 | cmp eax, esi |
||
675 | ja @f |
||
676 | mov eax, esi |
||
677 | @@: |
||
678 | inc ecx |
||
679 | pop esi |
||
680 | mov esi, [esi-8] |
||
681 | test esi, esi |
||
682 | jnz .find_width |
||
683 | add eax, 3 |
||
684 | add eax, [ebx+dlgtemplate.border_size_x] |
||
685 | add eax, [ebx+dlgtemplate.border_size_x] |
||
686 | cmp eax, [cur_width] |
||
687 | jb @f |
||
688 | mov eax, [cur_width] |
||
689 | @@: |
||
690 | sub eax, [ebx+dlgtemplate.border_size_x] |
||
691 | sub eax, [ebx+dlgtemplate.border_size_x] |
||
692 | mov [ebx+dlgtemplate.width], eax |
||
693 | mov [ebx+dlgtemplate.height], ecx |
||
814 | diamond | 694 | mov [ebx+44], ecx |
180 | heavyiron | 695 | sub eax, [esp+20h+12] |
696 | neg eax |
||
697 | sar eax, 1 |
||
698 | add eax, [esp+20h+4] |
||
699 | cmp eax, [ebx+dlgtemplate.border_size_x] |
||
700 | jge @f |
||
701 | mov eax, [ebx+dlgtemplate.border_size_x] |
||
702 | @@: |
||
703 | push eax |
||
704 | add eax, [ebx+dlgtemplate.width] |
||
705 | add eax, [ebx+dlgtemplate.border_size_x] |
||
706 | cmp eax, [cur_width] |
||
707 | jbe @f |
||
708 | pop eax |
||
709 | mov eax, [cur_width] |
||
710 | sub eax, [ebx+dlgtemplate.width] |
||
711 | sub eax, [ebx+dlgtemplate.border_size_x] |
||
712 | push eax |
||
713 | @@: |
||
714 | pop [ebx+dlgtemplate.x] |
||
715 | sub ecx, [esp+20h+16] |
||
716 | neg ecx |
||
717 | sar ecx, 1 |
||
718 | add ecx, [esp+20h+8] |
||
719 | cmp ecx, [ebx+dlgtemplate.border_size_y] |
||
720 | jge @f |
||
721 | mov ecx, [ebx+dlgtemplate.border_size_y] |
||
722 | @@: |
||
723 | push ecx |
||
724 | add ecx, [ebx+dlgtemplate.height] |
||
725 | add ecx, [ebx+dlgtemplate.border_size_y] |
||
726 | cmp ecx, [cur_height] |
||
727 | jbe @f |
||
728 | pop ecx |
||
729 | mov ecx, [cur_height] |
||
730 | sub ecx, [ebx+dlgtemplate.height] |
||
731 | sub ecx, [ebx+dlgtemplate.border_size_y] |
||
732 | push ecx |
||
733 | @@: |
||
734 | pop [ebx+dlgtemplate.y] |
||
735 | mov eax, [cur_height] |
||
736 | sub eax, 6 |
||
737 | cmp [ebx+dlgtemplate.height], eax |
||
738 | jbe .small_height |
||
739 | mov [ebx+dlgtemplate.height], eax |
||
740 | mov [ebx+dlgtemplate.y], 3 |
||
741 | .small_height: |
||
742 | mov ecx, [ebx+dlgtemplate.height] |
||
814 | diamond | 743 | mov eax, [ebx+40] |
744 | mov [ebx+48], eax |
||
180 | heavyiron | 745 | dec ecx |
746 | jz .skip |
||
747 | push ecx |
||
748 | @@: |
||
749 | cmp dword [eax+4], 0 |
||
750 | jz @f |
||
751 | mov eax, [eax+4] |
||
752 | loop @b |
||
753 | @@: |
||
814 | diamond | 754 | mov [ebx+48], eax |
180 | heavyiron | 755 | pop ecx |
756 | .loop: |
||
757 | mov eax, [eax] |
||
758 | loop .loop |
||
759 | .skip: |
||
814 | diamond | 760 | mov [ebx+52], eax |
180 | heavyiron | 761 | mov eax, [esp+20h+24] |
762 | mov [ebx+dlgtemplate.title], eax |
||
763 | mov al, [menu_normal_color] |
||
764 | mov [ebx+dlgtemplate.main_color], al |
||
765 | mov al, [menu_border_color] |
||
766 | mov [ebx+dlgtemplate.border_color], al |
||
767 | mov al, [menu_header_color] |
||
768 | mov [ebx+dlgtemplate.header_color], al |
||
769 | push MenuDlgProc |
||
770 | push ebx |
||
183 | diamond | 771 | call GenericBox |
180 | heavyiron | 772 | mov [esp+28], eax |
474 | diamond | 773 | mov ecx, ebx |
774 | call pgfree |
||
180 | heavyiron | 775 | popad |
776 | ret 28 |
||
777 | |||
778 | MenuDlgProc: |
||
183 | diamond | 779 | mov eax, [esp+8] |
180 | heavyiron | 780 | cmp al, 1 |
781 | jz .draw |
||
782 | cmp al, 2 |
||
783 | jz .key |
||
183 | diamond | 784 | ret 16 |
180 | heavyiron | 785 | .draw: |
786 | call .dodraw |
||
183 | diamond | 787 | ret 16 |
474 | diamond | 788 | .prev: |
814 | diamond | 789 | mov eax, [ebx+40] |
474 | diamond | 790 | cmp dword [eax+4], 0 |
791 | jz .end |
||
792 | call .line_prev |
||
793 | .posret: |
||
814 | diamond | 794 | mov [ebx+40], eax |
474 | diamond | 795 | .redraw: |
796 | call .dodraw |
||
797 | call draw_image |
||
798 | xor eax, eax |
||
799 | ret 16 |
||
800 | .next: |
||
814 | diamond | 801 | mov eax, [ebx+40] |
474 | diamond | 802 | cmp dword [eax], 0 |
803 | jz .home |
||
804 | call .line_next |
||
805 | jmp .posret |
||
806 | .pgdn: |
||
814 | diamond | 807 | mov eax, [ebx+40] |
474 | diamond | 808 | mov ecx, [ebx+dlgtemplate.height] |
809 | .pgdnl: |
||
810 | cmp dword [eax], 0 |
||
811 | jz .posret |
||
812 | call .line_next |
||
813 | loop .pgdnl |
||
814 | jmp .posret |
||
180 | heavyiron | 815 | .key: |
183 | diamond | 816 | mov al, [esp+12] |
180 | heavyiron | 817 | cmp al, 0x48 |
818 | jz .prev |
||
819 | cmp al, 0x4B |
||
820 | jz .prev |
||
821 | cmp al, 0x4D |
||
822 | jz .next |
||
823 | cmp al, 0x50 |
||
824 | jz .next |
||
825 | cmp al, 0x1C |
||
826 | jz .enter |
||
827 | cmp al, 1 |
||
828 | jz .esc |
||
829 | cmp al, 0x47 |
||
830 | jz .home |
||
831 | cmp al, 0x4F |
||
832 | jz .end |
||
833 | cmp al, 0x51 |
||
834 | jz .pgdn |
||
835 | cmp al, 0x49 |
||
836 | jz .pgup |
||
589 | diamond | 837 | cmp al, 0x52 |
838 | jz .ins |
||
839 | cmp al, 0x53 |
||
840 | jz .del |
||
814 | diamond | 841 | mov edx, [ebx+40] |
180 | heavyiron | 842 | @@: |
843 | cmp dword [edx+4], 0 |
||
844 | jz @f |
||
845 | mov edx, [edx+4] |
||
846 | jmp @b |
||
847 | @@: |
||
848 | .l: |
||
849 | lea esi, [edx+7] |
||
850 | @@: |
||
851 | inc esi |
||
852 | cmp byte [esi], 0 |
||
853 | jz .n |
||
854 | cmp byte [esi], '&' |
||
855 | jnz @b |
||
856 | movzx ecx, byte [esi+1] |
||
857 | cmp [ascii2scan+ecx], al |
||
858 | jnz .n |
||
859 | mov eax, edx |
||
183 | diamond | 860 | ret 16 |
180 | heavyiron | 861 | .n: |
862 | mov edx, [edx] |
||
863 | test edx, edx |
||
864 | jnz .l |
||
865 | .ret: |
||
866 | xor eax, eax |
||
183 | diamond | 867 | ret 16 |
180 | heavyiron | 868 | .pgup: |
814 | diamond | 869 | mov eax, [ebx+40] |
180 | heavyiron | 870 | mov ecx, [ebx+dlgtemplate.height] |
871 | .pgupl: |
||
872 | cmp dword [eax+4], 0 |
||
873 | jz .posret |
||
874 | call .line_prev |
||
875 | loop .pgupl |
||
876 | jmp .posret |
||
877 | .home: |
||
814 | diamond | 878 | mov eax, [ebx+40] |
180 | heavyiron | 879 | @@: |
880 | cmp dword [eax+4], 0 |
||
881 | jz @f |
||
882 | mov eax, [eax+4] |
||
883 | jmp @b |
||
884 | @@: |
||
814 | diamond | 885 | mov [ebx+48], eax |
180 | heavyiron | 886 | push eax |
887 | mov ecx, [ebx+dlgtemplate.height] |
||
888 | dec ecx |
||
889 | jz .h1 |
||
890 | .h2: |
||
891 | mov eax, [eax] |
||
892 | loop .h2 |
||
893 | .h1: |
||
814 | diamond | 894 | mov [ebx+52], eax |
180 | heavyiron | 895 | pop eax |
814 | diamond | 896 | and dword [ebx+56], 0 |
180 | heavyiron | 897 | jmp .posret |
898 | .end: |
||
814 | diamond | 899 | mov eax, [ebx+40] |
180 | heavyiron | 900 | @@: |
901 | cmp dword [eax], 0 |
||
902 | jz @f |
||
903 | mov eax, [eax] |
||
904 | jmp @b |
||
905 | @@: |
||
814 | diamond | 906 | mov [ebx+52], eax |
180 | heavyiron | 907 | push eax |
908 | mov ecx, [ebx+dlgtemplate.height] |
||
909 | dec ecx |
||
910 | jz .e1 |
||
911 | .e2: |
||
912 | mov eax, [eax+4] |
||
913 | loop .e2 |
||
914 | .e1: |
||
814 | diamond | 915 | mov [ebx+48], eax |
916 | mov eax, [ebx+44] |
||
180 | heavyiron | 917 | dec eax |
814 | diamond | 918 | mov [ebx+56], eax |
180 | heavyiron | 919 | pop eax |
920 | jmp .posret |
||
921 | .esc: |
||
922 | or eax, -1 |
||
183 | diamond | 923 | ret 16 |
180 | heavyiron | 924 | .enter: |
814 | diamond | 925 | mov eax, [ebx+40] |
183 | diamond | 926 | ret 16 |
589 | diamond | 927 | .ins: |
928 | push 5 |
||
929 | pop edx |
||
930 | jmp @f |
||
931 | .del: |
||
932 | push 4 |
||
933 | pop edx |
||
934 | @@: |
||
814 | diamond | 935 | mov eax, [ebx+40] |
589 | diamond | 936 | cmp byte [eax+8], '/' |
937 | jnz @f |
||
938 | cmp word [eax+9], 'cd' |
||
939 | jnz @f |
||
940 | movzx ecx, byte [eax+11] |
||
941 | sub ecx, '0' |
||
942 | push 24 |
||
943 | pop eax |
||
944 | mov ebx, edx |
||
945 | int 40h |
||
946 | @@: |
||
947 | xor eax, eax |
||
948 | ret 16 |
||
180 | heavyiron | 949 | |
950 | .line_prev: |
||
814 | diamond | 951 | cmp eax, [ebx+48] |
180 | heavyiron | 952 | jnz @f |
953 | mov edx, [ebx+48] |
||
954 | mov edx, [edx+4] |
||
955 | mov [ebx+48], edx |
||
814 | diamond | 956 | mov edx, [ebx+52] |
957 | mov edx, [edx+4] |
||
958 | mov [ebx+52], edx |
||
180 | heavyiron | 959 | @@: |
960 | mov eax, [eax+4] |
||
814 | diamond | 961 | dec dword [ebx+56] |
180 | heavyiron | 962 | ret |
963 | .line_next: |
||
814 | diamond | 964 | cmp eax, [ebx+52] |
180 | heavyiron | 965 | jnz @f |
966 | mov edx, [ebx+48] |
||
967 | mov edx, [edx] |
||
968 | mov [ebx+48], edx |
||
814 | diamond | 969 | mov edx, [ebx+52] |
970 | mov edx, [edx] |
||
971 | mov [ebx+52], edx |
||
180 | heavyiron | 972 | @@: |
973 | mov eax, [eax] |
||
814 | diamond | 974 | inc dword [ebx+56] |
180 | heavyiron | 975 | ret |
976 | |||
977 | .dodraw: |
||
978 | mov eax, [ebx+dlgtemplate.x] |
||
979 | mov edx, [ebx+dlgtemplate.y] |
||
980 | call get_console_ptr |
||
814 | diamond | 981 | mov esi, [ebx+48] |
180 | heavyiron | 982 | .0: |
983 | xor edx, edx |
||
984 | mov ah, [menu_selected_color] |
||
814 | diamond | 985 | cmp esi, [ebx+40] |
180 | heavyiron | 986 | jz @f |
987 | mov ah, [menu_normal_color] |
||
988 | @@: |
||
989 | push edi |
||
990 | mov ecx, [ebx+dlgtemplate.width] |
||
991 | mov al, ' ' |
||
992 | stosw |
||
993 | dec ecx |
||
994 | stosw |
||
995 | dec ecx |
||
996 | dec ecx |
||
997 | push esi |
||
998 | add esi, 8 |
||
999 | @@: |
||
1000 | lodsb |
||
1001 | test al, al |
||
1002 | jz @f |
||
1003 | cmp al, '&' |
||
1004 | jnz .noamp |
||
1005 | test dl, dl |
||
1006 | jnz .noamp |
||
1007 | mov dl, 1 |
||
1008 | lodsb |
||
1009 | push eax |
||
1010 | mov ah, [menu_selected_highlight_color] |
||
1011 | push ecx |
||
1012 | mov ecx, [esp+8] |
||
814 | diamond | 1013 | cmp ecx, [ebx+40] |
180 | heavyiron | 1014 | pop ecx |
1015 | jz .amp1 |
||
1016 | mov ah, [menu_highlight_color] |
||
1017 | .amp1: |
||
1018 | stosw |
||
1019 | pop eax |
||
1020 | jmp .amp2 |
||
1021 | .noamp: |
||
1022 | stosw |
||
1023 | .amp2: |
||
1024 | loop @b |
||
1025 | mov al, ' ' |
||
1026 | cmp byte [esi], 0 |
||
1027 | jnz .1 |
||
1028 | lodsb |
||
1029 | jmp .1 |
||
1030 | @@: |
||
1031 | mov al, ' ' |
||
1032 | .1: |
||
1033 | stosw |
||
1034 | mov al, ' ' |
||
1035 | rep stosw |
||
1036 | pop esi edi |
||
1037 | add edi, [cur_width] |
||
1038 | add edi, [cur_width] |
||
814 | diamond | 1039 | cmp esi, [ebx+52] |
180 | heavyiron | 1040 | jz @f |
1041 | mov esi, [esi] |
||
1042 | test esi, esi |
||
1043 | jnz .0 |
||
1044 | @@: |
||
1045 | ; Линейка прокрутки |
||
1046 | mov ecx, [ebx+dlgtemplate.height] |
||
814 | diamond | 1047 | cmp ecx, [ebx+44] |
180 | heavyiron | 1048 | jz .noscrollbar |
1049 | sub ecx, 2 |
||
1050 | jbe .noscrollbar |
||
814 | diamond | 1051 | mov eax, [ebx+56] |
180 | heavyiron | 1052 | mul ecx |
814 | diamond | 1053 | div dword [ebx+44] |
180 | heavyiron | 1054 | push eax |
1055 | mov eax, [ebx+dlgtemplate.x] |
||
1056 | add eax, [ebx+dlgtemplate.width] |
||
1057 | mov edx, [ebx+dlgtemplate.y] |
||
1058 | call get_console_ptr |
||
1059 | pop edx |
||
1060 | inc edx |
||
1061 | mov al, 0x1E |
||
1062 | mov ah, [menu_scrollbar_color] |
||
1063 | mov [edi], ax |
||
1064 | add edi, [cur_width] |
||
1065 | add edi, [cur_width] |
||
1066 | .2: |
||
1067 | mov al, 0xB2 |
||
1068 | dec edx |
||
1069 | jz @f |
||
1070 | mov al, 0xB0 |
||
1071 | @@: |
||
1072 | mov [edi], ax |
||
1073 | add edi, [cur_width] |
||
1074 | add edi, [cur_width] |
||
1075 | loop .2 |
||
1076 | mov al, 0x1F |
||
1077 | stosw |
||
1078 | .noscrollbar: |
||
1079 | ret |
||
183 | diamond | 1080 | |
814 | diamond | 1081 | get_ascii_char: |
1082 | ; query keyboard layout |
||
1083 | pushad |
||
1084 | mov al, [ctrlstate] |
||
1085 | and al, 3 |
||
1086 | xor ecx, ecx |
||
1087 | cmp al, 1 |
||
1088 | sbb ecx, -2 |
||
1089 | push 26 |
||
1090 | pop eax |
||
1091 | push 2 |
||
1092 | pop ebx |
||
1093 | mov edx, layout |
||
1094 | int 0x40 |
||
1095 | popad |
||
1096 | ; translate scancode to ASCII |
||
1097 | movzx eax, byte [layout+eax] |
||
1098 | ret |
||
1099 | |||
183 | diamond | 1100 | virtual at 0 |
1101 | dlgitemtemplate: |
||
1102 | ; Элементы: |
||
1103 | ; 1 = статический текст |
||
283 | diamond | 1104 | ; 2 = кнопка |
1105 | ; 3 = поле редактирования |
||
183 | diamond | 1106 | .type dd ? |
1107 | .x1 dd ? |
||
1108 | .y1 dd ? |
||
1109 | .x2 dd ? |
||
1110 | .y2 dd ? |
||
283 | diamond | 1111 | ; Данные: |
1112 | ; для текста: const char* data - ASCIIZ-строка |
||
1113 | ; для кнопки: const char* data - заголовок |
||
1114 | ; для редактора: struct {unsigned maxlength; unsigned pos; unsigned start; |
||
1115 | ; char data[maxlength+1];}* data; |
||
183 | diamond | 1116 | .data dd ? |
1117 | .flags dd ? |
||
1118 | ; Флаги: |
||
1119 | ; 0 = выравнивание влево |
||
1120 | ; 1 = выравнивание по центру |
||
1121 | ; 2 = выравнивание вправо |
||
1122 | ; 4 = элемент имеет фокус ввода |
||
283 | diamond | 1123 | ; 8 = элемент может иметь фокус ввода |
1124 | ; 10h: для кнопки = кнопка по умолчанию (Enter на не-кнопке) |
||
1125 | ; для поля ввода = данные были модифицированы |
||
589 | diamond | 1126 | ; 20h: для поля ввода = не отображать вводимые данные (показывать '*') |
183 | diamond | 1127 | .size = $ |
1128 | end virtual |
||
1129 | ; struct DLGDATA |
||
1130 | ; { |
||
1131 | ; DLGTEMPLATE dialog; /* window description */ |
||
1132 | ; void* DlgProc; /* dialog procedure */ |
||
1133 | ; /* int __stdcall DlgProc(DLGDATA* dlg, int msg, int param1, int param2); */ |
||
1134 | ; void* user_data; /* arbitrary user data */ |
||
1135 | ; unsigned num_items; /* number of items in the following array */ |
||
1136 | ; DLGITEMTEMPLATE items[]; /* array of dialog items */ |
||
1137 | ; } |
||
1138 | ; int __stdcall DialogBox(DLGDATA* dlg); |
||
1139 | DialogBox: |
||
1140 | push ManagerDlgProc |
||
1141 | push dword [esp+8] |
||
1142 | call GenericBox |
||
314 | diamond | 1143 | ret 4 |
183 | diamond | 1144 | |
814 | diamond | 1145 | ; int __stdcall ShowDialogBox(DLGDATA* dlg); |
1146 | ShowDialogBox: |
||
1147 | push ManagerDlgProc |
||
1148 | push dword [esp+8] |
||
1149 | call ShowGenericBox |
||
1150 | ret 4 |
||
1151 | |||
1152 | ; void __stdcall DrawDialogBox(DLGDATA* dlg); |
||
1153 | DrawDialogBox: |
||
1154 | push ManagerDlgProc |
||
1155 | push dword [esp+8] |
||
1156 | call DrawGenericBox |
||
1157 | ret 4 |
||
1158 | |||
183 | diamond | 1159 | ManagerDlgProc: |
314 | diamond | 1160 | mov ebp, ebx |
183 | diamond | 1161 | mov eax, [esp+8] |
1162 | dec eax |
||
1163 | jz .draw |
||
1164 | dec eax |
||
1165 | jz .key |
||
1166 | xor eax, eax |
||
1167 | ret 16 |
||
1168 | .draw: |
||
1169 | call .dodraw |
||
1170 | ret 16 |
||
1171 | .key: |
||
1172 | ; find item with focus |
||
1173 | add ebx, dlgtemplate.size+12 |
||
1174 | mov ecx, [ebx-4] |
||
1175 | jecxz .nobtns |
||
1176 | @@: |
||
1177 | test [ebx+dlgitemtemplate.flags], 4 |
||
1178 | jnz @f |
||
1179 | add ebx, dlgitemtemplate.size |
||
1180 | loop @b |
||
1181 | @@: |
||
1182 | .nobtns: |
||
1183 | mov al, [esp+12] |
||
1184 | cmp al, 1 |
||
1185 | jz .esc |
||
1186 | cmp al, 0x1C |
||
1187 | jz .enter |
||
1188 | cmp al, 0xF |
||
1189 | jz .tab |
||
1190 | cmp al, 0x48 |
||
1191 | jz .up |
||
283 | diamond | 1192 | cmp al, 0x50 |
1193 | jz .down |
||
1194 | jecxz @f |
||
1195 | cmp [ebx+dlgitemtemplate.type], 3 |
||
1196 | jz .key_edit |
||
1197 | @@: |
||
183 | diamond | 1198 | cmp al, 0x4B |
1199 | jz .left |
||
1200 | cmp al, 0x4D |
||
1201 | jz .right |
||
1202 | .ret0: |
||
1203 | xor eax, eax |
||
1204 | ret 16 |
||
1205 | .esc: |
||
1206 | or eax, -1 |
||
1207 | ret 16 |
||
1208 | .enter: |
||
283 | diamond | 1209 | cmp [ebx+dlgitemtemplate.type], 2 |
1210 | jnz @f |
||
1211 | .enter_found: |
||
183 | diamond | 1212 | mov eax, ebx |
1213 | ret 16 |
||
283 | diamond | 1214 | @@: |
314 | diamond | 1215 | lea ebx, [ebp+dlgtemplate.size+12] |
474 | diamond | 1216 | mov ecx, [ebx-4] |
283 | diamond | 1217 | .enter_find: |
1218 | cmp [ebx+dlgitemtemplate.type], 2 |
||
1219 | jnz @f |
||
1220 | test [ebx+dlgitemtemplate.flags], 0x10 |
||
1221 | jnz .enter_found |
||
1222 | @@: |
||
1223 | add ebx, dlgitemtemplate.size |
||
474 | diamond | 1224 | loop .enter_find |
1225 | jmp .enter_found |
||
183 | diamond | 1226 | .tab: |
1227 | test [ctrlstate], 3 |
||
1228 | jnz .shift_tab |
||
1229 | .right: |
||
1230 | .down: |
||
1231 | jecxz .ret0 |
||
1232 | and byte [ebx+dlgitemtemplate.flags], not 4 |
||
1233 | dec ecx |
||
1234 | jz .find_first_btn |
||
1235 | @@: |
||
1236 | add ebx, dlgitemtemplate.size |
||
283 | diamond | 1237 | test [ebx+dlgitemtemplate.flags], 8 |
1238 | jnz .btn_found |
||
183 | diamond | 1239 | loop @b |
1240 | .find_first_btn: |
||
314 | diamond | 1241 | lea ebx, [ebp+dlgtemplate.size+12] |
183 | diamond | 1242 | @@: |
283 | diamond | 1243 | test [ebx+dlgitemtemplate.flags], 8 |
1244 | jnz .btn_found |
||
183 | diamond | 1245 | add ebx, dlgitemtemplate.size |
1246 | jmp @b |
||
1247 | .btn_found: |
||
1248 | or byte [ebx+dlgitemtemplate.flags], 4 |
||
283 | diamond | 1249 | .ret_draw: |
314 | diamond | 1250 | mov ebx, ebp |
183 | diamond | 1251 | call .dodraw |
1252 | call draw_image |
||
1253 | xor eax, eax |
||
1254 | ret 16 |
||
1255 | .shift_tab: |
||
1256 | .left: |
||
1257 | .up: |
||
1258 | jecxz .ret0 |
||
1259 | and byte [ebx+dlgitemtemplate.flags], not 4 |
||
314 | diamond | 1260 | sub ecx, [ebp+dlgtemplate.size+8] |
183 | diamond | 1261 | neg ecx |
1262 | jz .find_last_btn |
||
1263 | @@: |
||
1264 | sub ebx, dlgitemtemplate.size |
||
283 | diamond | 1265 | test [ebx+dlgitemtemplate.flags], 8 |
1266 | loopz @b |
||
1267 | jnz .btn_found |
||
183 | diamond | 1268 | .find_last_btn: |
314 | diamond | 1269 | mov ebx, [ebp+dlgtemplate.size+8] |
183 | diamond | 1270 | imul ebx, dlgitemtemplate.size |
314 | diamond | 1271 | lea ebx, [ebx+ebp+dlgtemplate.size+12] |
183 | diamond | 1272 | @@: |
1273 | sub ebx, dlgitemtemplate.size |
||
283 | diamond | 1274 | test [ebx+dlgitemtemplate.flags], 8 |
1275 | jz @b |
||
1276 | jmp .btn_found |
||
1277 | .key_edit: |
||
1278 | ; обработка клавиш в поле ввода |
||
1279 | test al, 0x80 |
||
1280 | jnz .ret0 |
||
1281 | or [ebx+dlgitemtemplate.flags], 0x10 |
||
1282 | mov edx, [ebx+dlgitemtemplate.data] |
||
1283 | cmp al, 0x4B |
||
1284 | jz .editor_left |
||
1285 | cmp al, 0x4D |
||
1286 | jz .editor_right |
||
1287 | cmp al, 0x47 |
||
1288 | jz .editor_home |
||
1289 | cmp al, 0x4F |
||
1290 | jz .editor_end |
||
1291 | cmp al, 0x0E |
||
1292 | jz .editor_backspace |
||
1293 | cmp al, 0x53 |
||
474 | diamond | 1294 | jnz .editor_char |
1295 | .editor_del: |
||
1296 | mov ecx, [edx+4] |
||
1297 | lea edi, [ecx+edx+12] |
||
1298 | lea esi, [edi+1] |
||
1299 | cmp byte [edi], 0 |
||
1300 | jz .ret_test |
||
1301 | jmp .copy_and_ret_test |
||
283 | diamond | 1302 | .editor_left: |
1303 | mov ecx, [edx+4] |
||
1304 | jecxz @f |
||
1305 | dec dword [edx+4] |
||
1306 | @@: jmp .ret_test |
||
1307 | .editor_right: |
||
1308 | mov ecx, [edx+4] |
||
1309 | cmp byte [edx+ecx+12], 0 |
||
1310 | jz @b |
||
1311 | inc dword [edx+4] |
||
1312 | jmp @b |
||
1313 | .editor_home: |
||
1314 | and dword [edx+4], 0 |
||
1315 | jmp @b |
||
1316 | .editor_end: |
||
1317 | lea edi, [edx+12] |
||
1318 | xor eax, eax |
||
1319 | or ecx, -1 |
||
1320 | repnz scasb |
||
1321 | not ecx |
||
1322 | dec ecx |
||
1323 | mov [edx+4], ecx |
||
1324 | .ret_test: |
||
1325 | mov eax, [edx+4] |
||
1326 | cmp [edx+8], eax |
||
1327 | jl .ret_test.l1 |
||
1328 | mov [edx+8], eax |
||
1329 | jmp .ret_test.l2 |
||
1330 | .ret_test.l1: |
||
1331 | add eax, [ebx+dlgitemtemplate.x1] |
||
1332 | sub eax, [ebx+dlgitemtemplate.x2] |
||
1333 | cmp [edx+8], eax |
||
1334 | jge .ret_test.l2 |
||
1335 | mov [edx+8], eax |
||
1336 | .ret_test.l2: |
||
1337 | jmp .ret_draw |
||
1338 | .editor_backspace: |
||
1339 | mov ecx, [edx+4] |
||
1340 | jecxz .ret_test |
||
1341 | dec dword [edx+4] |
||
1342 | lea esi, [edx+ecx+12] |
||
1343 | lea edi, [esi-1] |
||
1344 | .copy_and_ret_test: |
||
1345 | @@: |
||
1346 | lodsb |
||
1347 | stosb |
||
1348 | test al, al |
||
183 | diamond | 1349 | jnz @b |
283 | diamond | 1350 | jmp .ret_test |
474 | diamond | 1351 | .editor_char: |
1352 | test [ctrlstate], 0x3C |
||
1353 | jnz .ret_draw |
||
1354 | movzx eax, al |
||
814 | diamond | 1355 | call get_ascii_char |
474 | diamond | 1356 | push eax |
1357 | ; insert entered symbol |
||
1358 | xor eax, eax |
||
1359 | lea edi, [edx+12] |
||
1360 | or ecx, -1 |
||
1361 | repnz scasb |
||
1362 | not ecx |
||
1363 | pop eax |
||
1364 | cmp ecx, [edx] |
||
1365 | ja .ret_test ; buffer capacity exceeded |
||
1366 | lea edi, [edx+ecx+12-1] |
||
1367 | mov esi, [edx+4] |
||
1368 | lea esi, [edx+esi+12] |
||
1369 | @@: |
||
1370 | mov cl, [edi] |
||
1371 | mov [edi+1], cl |
||
1372 | dec edi |
||
1373 | cmp edi, esi |
||
1374 | jae @b |
||
1375 | mov [esi], al |
||
1376 | inc dword [edx+4] |
||
1377 | @@: jmp .ret_test |
||
183 | diamond | 1378 | |
1379 | .dodraw: |
||
283 | diamond | 1380 | or [cursor_x], -1 |
1381 | or [cursor_y], -1 |
||
183 | diamond | 1382 | add ebx, dlgtemplate.size+8 |
1383 | mov ecx, [ebx] |
||
1384 | add ebx, 4 |
||
1385 | jecxz .done_draw |
||
1386 | .draw_loop: |
||
1387 | push ecx |
||
1388 | mov eax, [ebx+dlgitemtemplate.type] |
||
1389 | dec eax |
||
1390 | jz .draw_text |
||
1391 | dec eax |
||
283 | diamond | 1392 | jz .draw_button |
1393 | dec eax |
||
183 | diamond | 1394 | jnz .draw_loop_continue |
283 | diamond | 1395 | call draw_editbox |
1396 | jmp .draw_loop_continue |
||
1397 | .draw_button: |
||
183 | diamond | 1398 | call draw_button |
1399 | jmp .draw_loop_continue |
||
1400 | .draw_text: |
||
1401 | call draw_static_text |
||
1402 | .draw_loop_continue: |
||
1403 | pop ecx |
||
1404 | add ebx, dlgitemtemplate.size |
||
1405 | loop .draw_loop |
||
1406 | .done_draw: |
||
1407 | ret |
||
1408 | |||
1409 | draw_static_text: |
||
1410 | ; рисуем статический текст |
||
1411 | mov ah, [dialog_main_color] |
||
314 | diamond | 1412 | test byte [ebp+dlgtemplate.flags], 2 |
1413 | jz draw_text |
||
1414 | mov ah, [warning_main_color] |
||
183 | diamond | 1415 | draw_text: |
1416 | ; определяем длину строки |
||
1417 | mov esi, [ebx+dlgitemtemplate.data] |
||
283 | diamond | 1418 | draw_text_esi: |
183 | diamond | 1419 | test esi, esi |
1420 | jz .ret |
||
589 | diamond | 1421 | push -1 |
1422 | pop ecx |
||
183 | diamond | 1423 | @@: |
1424 | inc ecx |
||
1425 | cmp byte [ecx+esi], 0 |
||
1426 | jnz @b |
||
1427 | ; в ecx длина строки |
||
1428 | push eax |
||
1429 | xor eax, eax |
||
1430 | mov edx, [ebx+dlgitemtemplate.x2] |
||
1431 | sub edx, [ebx+dlgitemtemplate.x1] |
||
1432 | inc edx |
||
1433 | cmp ecx, edx |
||
1434 | jae .text_draw |
||
1435 | mov al, byte [ebx+dlgitemtemplate.flags] |
||
1436 | and al, 3 |
||
1437 | jz .text_align_left |
||
1438 | cmp al, 1 |
||
1439 | jz .text_align_center |
||
1440 | ; текст выровнен вправо |
||
1441 | mov eax, edx |
||
1442 | sub eax, ecx |
||
1443 | jmp .text_draw |
||
1444 | .text_align_center: |
||
1445 | mov eax, edx |
||
1446 | sub eax, ecx |
||
1447 | shr eax, 1 |
||
1448 | jmp .text_draw |
||
1449 | .text_align_left: |
||
1450 | xor eax, eax |
||
1451 | .text_draw: |
||
1452 | push ecx |
||
1453 | push eax |
||
1454 | mov eax, [ebx+dlgitemtemplate.x1] |
||
314 | diamond | 1455 | add eax, [ebp+dlgtemplate.x] |
183 | diamond | 1456 | push edx |
1457 | mov edx, [ebx+dlgitemtemplate.y1] |
||
314 | diamond | 1458 | add edx, [ebp+dlgtemplate.y] |
183 | diamond | 1459 | call get_console_ptr |
1460 | pop edx |
||
1461 | pop ecx |
||
1462 | mov ah, [esp+5] |
||
1463 | mov al, ' ' |
||
1464 | rep stosw |
||
1465 | pop ecx |
||
1466 | cmp ecx, edx |
||
1467 | jbe .text_copy |
||
283 | diamond | 1468 | cmp [ebx+dlgitemtemplate.type], 3 |
1469 | jnz @f |
||
1470 | mov ecx, edx |
||
1471 | jmp .text_copy |
||
1472 | @@: |
||
183 | diamond | 1473 | cmp edx, 3 |
1474 | jb .ret |
||
1475 | mov al, '.' |
||
1476 | stosw |
||
1477 | stosw |
||
1478 | stosw |
||
1479 | add esi, ecx |
||
1480 | mov ecx, edx |
||
1481 | sub ecx, 3 |
||
1482 | sub esi, ecx |
||
1483 | .text_copy: |
||
1484 | jecxz .ret |
||
589 | diamond | 1485 | ; check for password editboxes |
1486 | cmp [ebx+dlgitemtemplate.type], 3 |
||
1487 | jnz @f |
||
1488 | test [ebx+dlgitemtemplate.flags], 20h |
||
1489 | jz @f |
||
1490 | mov al, '*' |
||
1491 | rep stosw |
||
1492 | jmp .ret |
||
183 | diamond | 1493 | @@: |
1494 | lodsb |
||
1495 | stosw |
||
1496 | loop @b |
||
1497 | .ret: |
||
314 | diamond | 1498 | mov eax, [ebp+dlgtemplate.x] |
1499 | mov edx, [ebp+dlgtemplate.y] |
||
183 | diamond | 1500 | add eax, [ebx+dlgitemtemplate.x2] |
1501 | inc eax |
||
1502 | add edx, [ebx+dlgitemtemplate.y1] |
||
1503 | mov ecx, edi |
||
1504 | call get_console_ptr |
||
1505 | xchg ecx, edi |
||
1506 | sub ecx, edi |
||
1507 | shr ecx, 1 |
||
1508 | pop eax |
||
1509 | mov al, ' ' |
||
1510 | rep stosw |
||
1511 | ret |
||
1512 | |||
1513 | draw_button: |
||
314 | diamond | 1514 | mov ecx, dialog_colors |
1515 | test byte [ebp+dlgtemplate.flags], 2 |
||
1516 | jz @f |
||
1517 | mov ecx, warning_colors |
||
1518 | @@: |
||
1519 | mov ah, [dialog_normal_btn_color-dialog_colors+ecx] |
||
183 | diamond | 1520 | test [ebx+dlgitemtemplate.flags], 4 |
1521 | jz @f |
||
314 | diamond | 1522 | mov ah, [dialog_selected_btn_color-dialog_colors+ecx] |
183 | diamond | 1523 | @@: |
1524 | jmp draw_text |
||
283 | diamond | 1525 | |
1526 | draw_editbox: |
||
1527 | mov edx, [ebx+dlgitemtemplate.data] |
||
1528 | test [ebx+dlgitemtemplate.flags], 4 |
||
1529 | jz @f |
||
1530 | mov eax, [ebx+dlgitemtemplate.x1] |
||
1531 | add eax, [edx+4] |
||
1532 | sub eax, [edx+8] |
||
314 | diamond | 1533 | add eax, [ebp+dlgtemplate.x] |
283 | diamond | 1534 | mov [cursor_x], eax |
1535 | mov eax, [ebx+dlgitemtemplate.y1] |
||
314 | diamond | 1536 | add eax, [ebp+dlgtemplate.y] |
283 | diamond | 1537 | mov [cursor_y], eax |
1538 | @@: |
||
314 | diamond | 1539 | mov ecx, dialog_colors |
1540 | test byte [ebp+dlgtemplate.flags], 2 |
||
1541 | jz @f |
||
1542 | mov ecx, warning_colors |
||
1543 | @@: |
||
1544 | mov ah, [dialog_edit_color-dialog_colors+ecx] |
||
283 | diamond | 1545 | test [ebx+dlgitemtemplate.flags], 10h |
1546 | jnz @f |
||
314 | diamond | 1547 | mov ah, [dialog_unmodified_edit_color-dialog_colors+ecx] |
283 | diamond | 1548 | @@: |
1549 | mov esi, [ebx+dlgitemtemplate.data] |
||
1550 | add esi, [edx+8] |
||
1551 | add esi, 12 |
||
1552 | jmp draw_text_esi |
||
314 | diamond | 1553 | |
1554 | ; void __stdcall SayNoMem(void); |
||
1555 | SayNoMem: |
||
1556 | or dword [nomem_dlgdata+4], -1 |
||
1557 | or dword [nomem_dlgdata+8], -1 |
||
1558 | push nomem_dlgdata |
||
1559 | call DialogBox |
||
1560 | ret |
||
1561 | |||
589 | diamond | 1562 | ; int __stdcall SayErr(int num_strings, const char* strings[], |
1563 | ; int num_buttons, const char* buttons[]); |
||
474 | diamond | 1564 | SayErr: |
589 | diamond | 1565 | pop eax |
1566 | push aError |
||
1567 | push eax |
||
814 | diamond | 1568 | ; int __stdcall SayErrTitle(const char* title, |
1569 | ; int num_strings, const char* strings[], |
||
1570 | ; int num_buttons, const char* buttons[]); |
||
1571 | SayErrTitle: |
||
474 | diamond | 1572 | push 2 |
1573 | jmp @f |
||
1574 | |||
589 | diamond | 1575 | ; int __stdcall Message(const char* title, |
474 | diamond | 1576 | ; int num_strings, const char* strings[], |
1577 | ; int num_buttons, const char* buttons[]); |
||
1578 | Message: |
||
1579 | push 1 |
||
1580 | @@: |
||
589 | diamond | 1581 | pop eax |
314 | diamond | 1582 | ; [esp+4] = title |
589 | diamond | 1583 | ; [esp+8] = num_strings |
1584 | ; [esp+12] = strings |
||
1585 | ; [esp+16] = num_buttons |
||
1586 | ; [esp+20] = buttons |
||
474 | diamond | 1587 | pushad |
589 | diamond | 1588 | mov ecx, [esp+32+8] |
1589 | add ecx, [esp+32+16] |
||
474 | diamond | 1590 | imul ecx, dlgitemtemplate.size |
1591 | add ecx, dlgtemplate.size+12 |
||
1592 | call xpgalloc |
||
314 | diamond | 1593 | test eax, eax |
1594 | jnz @f |
||
474 | diamond | 1595 | popad |
314 | diamond | 1596 | or eax, -1 |
1597 | ret 28 |
||
1598 | @@: |
||
1599 | mov ebx, eax |
||
1600 | mov edi, eax |
||
474 | diamond | 1601 | mov eax, [esp+28] |
314 | diamond | 1602 | stosd ; dlgtemplate.flags |
589 | diamond | 1603 | or eax, -1 |
314 | diamond | 1604 | stosd ; dlgtemplate.x |
1605 | stosd ; dlgtemplate.y |
||
1606 | ; calculate width |
||
589 | diamond | 1607 | mov ecx, [esp+32+8] |
1608 | mov esi, [esp+32+12] |
||
314 | diamond | 1609 | xor edx, edx |
1610 | .calcwidth: |
||
1611 | lodsd |
||
1612 | @@: |
||
1613 | inc eax |
||
1614 | cmp byte [eax-1], 0 |
||
1615 | jnz @b |
||
1616 | sub eax, [esi-4] |
||
1617 | inc eax |
||
1618 | cmp edx, eax |
||
1619 | ja @f |
||
1620 | mov edx, eax |
||
1621 | @@: |
||
1622 | loop .calcwidth |
||
589 | diamond | 1623 | mov ecx, [esp+32+16] |
1624 | mov esi, [esp+32+20] |
||
314 | diamond | 1625 | xor ebp, ebp |
1626 | .calcwidth2: |
||
1627 | lodsd |
||
1628 | @@: |
||
1629 | inc eax |
||
1630 | cmp byte [eax-1], 0 |
||
1631 | jnz @b |
||
1632 | sub eax, [esi-4] |
||
1633 | inc eax |
||
1634 | add ebp, eax |
||
1635 | loop .calcwidth2 |
||
1636 | inc ebp |
||
1637 | inc ebp |
||
1638 | cmp edx, ebp |
||
1639 | ja @f |
||
1640 | mov edx, ebp |
||
1641 | @@: |
||
1642 | mov eax, [cur_width] |
||
1643 | sub eax, 8 |
||
1644 | cmp edx, eax |
||
1645 | jb @f |
||
1646 | mov edx, eax |
||
1647 | @@: |
||
1648 | mov eax, edx |
||
1649 | stosd ; dlgtemplate.width |
||
589 | diamond | 1650 | mov eax, [esp+32+8] |
314 | diamond | 1651 | inc eax |
1652 | stosd ; dlgtemplate.height |
||
1653 | mov eax, 3 |
||
1654 | stosd ; dlgtemplate.border_size_x |
||
1655 | mov al, 2 |
||
1656 | stosd ; dlgtemplate.border_size_y |
||
1657 | mov eax, [esp+32+4] |
||
1658 | stosd ; dlgtemplate.title |
||
1659 | xor eax, eax |
||
1660 | stosd ; (ignored) |
||
814 | diamond | 1661 | stosd ; (ignored) |
314 | diamond | 1662 | stosd ; DlgProc |
1663 | stosd ; userdata |
||
589 | diamond | 1664 | mov eax, [esp+32+8] |
1665 | add eax, [esp+32+16] |
||
314 | diamond | 1666 | stosd ; num_items |
1667 | ; fill strings |
||
1668 | xor ecx, ecx |
||
589 | diamond | 1669 | mov esi, [esp+32+12] |
314 | diamond | 1670 | @@: |
1671 | mov eax, 1 |
||
1672 | stosd ; dlgitemtemplate.type |
||
1673 | dec eax |
||
1674 | stosd ; dlgitemtemplate.x1 |
||
1675 | mov eax, ecx |
||
1676 | stosd ; dlgitemtemplate.y1 |
||
1677 | lea eax, [edx-1] |
||
1678 | stosd ; dlgitemtemplate.x2 |
||
1679 | mov eax, ecx |
||
1680 | stosd ; dlgitemtemplate.y2 |
||
1681 | movsd ; dlgitemtemplate.data |
||
1682 | mov eax, 1 |
||
1683 | stosd ; dlgitemtemplate.flags |
||
1684 | inc ecx |
||
589 | diamond | 1685 | cmp ecx, [esp+32+8] |
314 | diamond | 1686 | jb @b |
1687 | ; fill buttons |
||
589 | diamond | 1688 | mov ecx, [esp+32+16] |
1689 | mov esi, [esp+32+20] |
||
314 | diamond | 1690 | sub edx, ebp |
1691 | jc .big |
||
1692 | shr edx, 1 |
||
1693 | inc edx |
||
1694 | jmp .fillbtns |
||
1695 | .big: |
||
1696 | xor edx, edx |
||
1697 | .fillbtns: |
||
1698 | mov eax, 2 |
||
1699 | stosd ; dlgitemtemplate.type |
||
1700 | mov eax, edx |
||
1701 | stosd ; dlgitemtemplate.x1 |
||
1702 | mov eax, [ebx+dlgtemplate.height] |
||
1703 | dec eax |
||
1704 | stosd ; dlgitemtemplate.y1 |
||
1705 | push eax |
||
1706 | lodsd |
||
1707 | sub eax, edx |
||
1708 | @@: |
||
1709 | inc edx |
||
1710 | cmp byte [eax+edx-1], 0 |
||
1711 | jnz @b |
||
1712 | mov eax, edx |
||
1713 | inc edx |
||
1714 | stosd ; dlgitemtemplate.x2 |
||
1715 | pop eax |
||
1716 | stosd ; dlgitemtemplate.y2 |
||
1717 | mov eax, [esi-4] |
||
1718 | stosd ; dlgitemtemplate.data |
||
1719 | mov eax, 9 |
||
589 | diamond | 1720 | cmp ecx, [esp+32+16] |
314 | diamond | 1721 | jnz @f |
1722 | or al, 4 |
||
1723 | @@: |
||
1724 | stosd ; dlgitemtemplate.flags |
||
1725 | loop .fillbtns |
||
1726 | push ebx |
||
1727 | call DialogBox |
||
1728 | cmp eax, -1 |
||
1729 | jz @f |
||
1730 | sub eax, ebx |
||
1731 | sub eax, dlgtemplate.size+12 |
||
1732 | xor edx, edx |
||
1733 | mov ecx, dlgitemtemplate.size |
||
1734 | div ecx |
||
589 | diamond | 1735 | sub eax, [esp+32+8] |
314 | diamond | 1736 | @@: |
1737 | mov [esp+28], eax |
||
474 | diamond | 1738 | mov ecx, ebx |
1739 | call pgfree |
||
314 | diamond | 1740 | popad |
589 | diamond | 1741 | ret 20 |