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