Rev 41 | Rev 102 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 41 | Rev 54 | ||
---|---|---|---|
1 | max_buttons=4095 |
1 | max_buttons=4095 |
2 | dececx: |
2 | dececx: |
3 | push edx |
3 | push edx |
4 | push ecx |
4 | push ecx |
5 | 5 | ||
6 | mov edx,2 |
6 | mov edx,2 |
7 | .loop: |
7 | .loop: |
8 | 8 | ||
9 | cmp byte [esp+edx],0x20 |
9 | cmp byte [esp+edx],0x20 |
10 | jae @f |
10 | jae @f |
11 | mov [esp+edx],byte 0x20 |
11 | mov [esp+edx],byte 0x20 |
12 | @@: |
12 | @@: |
13 | sub [esp+edx],byte 0x20 |
13 | sub [esp+edx],byte 0x20 |
14 | 14 | ||
15 | dec edx |
15 | dec edx |
16 | jns .loop |
16 | jns .loop |
17 | 17 | ||
18 | pop ecx |
18 | pop ecx |
19 | pop edx |
19 | pop edx |
20 | ret |
20 | ret |
21 | 21 | ||
22 | incecx: |
22 | incecx: |
23 | push edx |
23 | push edx |
24 | push ecx |
24 | push ecx |
25 | 25 | ||
26 | mov edx,2 |
26 | mov edx,2 |
27 | .loop: |
27 | .loop: |
28 | 28 | ||
29 | cmp byte [esp+edx],0xdf |
29 | cmp byte [esp+edx],0xdf |
30 | jbe @f |
30 | jbe @f |
31 | mov [esp+edx],byte 0xdf |
31 | mov [esp+edx],byte 0xdf |
32 | @@: |
32 | @@: |
33 | add [esp+edx],byte 0x20 |
33 | add [esp+edx],byte 0x20 |
34 | 34 | ||
35 | dec edx |
35 | dec edx |
36 | jns .loop |
36 | jns .loop |
37 | pop ecx |
37 | pop ecx |
38 | pop edx |
38 | pop edx |
39 | ret |
39 | ret |
40 | 40 | ||
41 | incecx2: |
41 | incecx2: |
42 | push edx |
42 | push edx |
43 | push ecx |
43 | push ecx |
44 | 44 | ||
45 | mov edx,2 |
45 | mov edx,2 |
46 | .loop: |
46 | .loop: |
47 | 47 | ||
48 | cmp byte [esp+edx],0xeb |
48 | cmp byte [esp+edx],0xeb |
49 | jbe @f |
49 | jbe @f |
50 | mov [esp+edx],byte 0xeb |
50 | mov [esp+edx],byte 0xeb |
51 | @@: |
51 | @@: |
52 | add [esp+edx],byte 0x14 |
52 | add [esp+edx],byte 0x14 |
53 | 53 | ||
54 | dec edx |
54 | dec edx |
55 | jns .loop |
55 | jns .loop |
56 | pop ecx |
56 | pop ecx |
57 | pop edx |
57 | pop edx |
58 | ret |
58 | ret |
59 | 59 | ||
60 | drawbuttonframes: |
60 | drawbuttonframes: |
61 | 61 | ||
62 | push esi |
62 | push esi |
63 | push edi |
63 | push edi |
64 | push eax |
64 | push eax |
65 | push ebx |
65 | push ebx |
66 | push ecx |
66 | push ecx |
67 | push edx |
67 | push edx |
68 | 68 | ||
69 | shr eax,16 |
69 | shr eax,16 |
70 | shr ebx,16 |
70 | shr ebx,16 |
71 | mov edx,[0x3010] |
71 | mov edx,[0x3010] |
72 | 72 | ||
73 | add eax,[edx-twdw] |
73 | add eax,[edx-twdw] |
74 | add ebx,[edx-twdw+4] |
74 | add ebx,[edx-twdw+4] |
75 | mov cx,ax |
75 | mov cx,ax |
76 | mov dx,bx |
76 | mov dx,bx |
77 | shl eax,16 |
77 | shl eax,16 |
78 | shl ebx,16 |
78 | shl ebx,16 |
79 | mov ax,cx |
79 | mov ax,cx |
80 | mov bx,dx |
80 | mov bx,dx |
81 | add ax,word [esp+12] |
81 | add ax,word [esp+12] |
82 | mov esi,ebx |
82 | mov esi,ebx |
83 | mov edi,0 |
83 | mov edi,0 |
84 | mov ecx,[esp+0] |
84 | mov ecx,[esp+0] |
85 | call incecx |
85 | call incecx |
86 | call [draw_line] |
86 | call [draw_line] |
87 | 87 | ||
88 | movzx edx,word [esp+8] |
88 | movzx edx,word [esp+8] |
89 | add ebx,edx |
89 | add ebx,edx |
90 | shl edx,16 |
90 | shl edx,16 |
91 | add ebx,edx |
91 | add ebx,edx |
92 | mov ecx,[esp+0] |
92 | mov ecx,[esp+0] |
93 | call dececx |
93 | call dececx |
94 | call [draw_line] |
94 | call [draw_line] |
95 | 95 | ||
96 | mov ebx,esi |
96 | mov ebx,esi |
97 | push edx |
97 | push edx |
98 | mov edx,eax |
98 | mov edx,eax |
99 | shr edx,16 |
99 | shr edx,16 |
100 | mov ax,dx |
100 | mov ax,dx |
101 | mov edx,ebx |
101 | mov edx,ebx |
102 | shr edx,16 |
102 | shr edx,16 |
103 | mov bx,dx |
103 | mov bx,dx |
104 | mov dx,[esp+8+4] |
104 | mov dx,[esp+8+4] |
105 | add bx,dx |
105 | add bx,dx |
106 | pop edx |
106 | pop edx |
107 | mov edi,0 |
107 | mov edi,0 |
108 | mov ecx,[esp+0] |
108 | mov ecx,[esp+0] |
109 | call incecx |
109 | call incecx |
110 | call [draw_line] |
110 | call [draw_line] |
111 | 111 | ||
112 | mov esi,edx |
112 | mov esi,edx |
113 | mov dx,[esp+12] |
113 | mov dx,[esp+12] |
114 | add ax,dx |
114 | add ax,dx |
115 | shl edx,16 |
115 | shl edx,16 |
116 | add eax,edx |
116 | add eax,edx |
117 | add ebx,1*65536 |
117 | add ebx,1*65536 |
118 | mov edx,esi |
118 | mov edx,esi |
119 | mov ecx,[esp+0] |
119 | mov ecx,[esp+0] |
120 | call dececx |
120 | call dececx |
121 | call [draw_line] |
121 | call [draw_line] |
122 | 122 | ||
123 | pop edx |
123 | pop edx |
124 | pop ecx |
124 | pop ecx |
125 | pop ebx |
125 | pop ebx |
126 | pop eax |
126 | pop eax |
127 | pop edi |
127 | pop edi |
128 | pop esi |
128 | pop esi |
129 | 129 | ||
130 | ret |
130 | ret |
131 | 131 | ||
132 | button_dececx: |
132 | button_dececx: |
133 | 133 | ||
134 | cmp [buttontype],dword 1 |
134 | cmp [buttontype],dword 1 |
135 | jne .finish |
135 | jne .finish |
136 | ; je bdece |
136 | ; je bdece |
137 | ; ret |
137 | ; ret |
138 | ; bdece: |
138 | ; bdece: |
139 | push eax |
139 | push eax |
140 | mov eax,0x01 |
140 | mov eax,0x01 |
141 | cmp edi,20 |
141 | cmp edi,20 |
142 | jg @f |
142 | jg @f |
143 | mov eax,0x02 |
143 | mov eax,0x02 |
144 | @@: |
144 | @@: |
145 | test ecx,0xff |
145 | test ecx,0xff |
146 | jz @f |
146 | jz @f |
147 | sub ecx,eax |
147 | sub ecx,eax |
148 | @@: |
148 | @@: |
149 | shl eax,8 |
149 | shl eax,8 |
150 | test ecx,0xff00 |
150 | test ecx,0xff00 |
151 | jz @f |
151 | jz @f |
152 | sub ecx,eax |
152 | sub ecx,eax |
153 | @@: |
153 | @@: |
154 | shl eax,8 |
154 | shl eax,8 |
155 | test ecx,0xff0000 |
155 | test ecx,0xff0000 |
156 | jz @f |
156 | jz @f |
157 | sub ecx,eax |
157 | sub ecx,eax |
158 | @@: |
158 | @@: |
159 | pop eax |
159 | pop eax |
160 | .finish: |
160 | .finish: |
161 | ret |
161 | ret |
162 | 162 | ||
163 | 163 | ||
164 | sys_button: |
164 | sys_button: |
165 | 165 | ||
166 | test ecx,0x80000000 |
166 | test ecx,0x80000000 |
167 | jnz remove_button |
167 | jnz remove_button |
168 | 168 | ||
169 | push esi |
169 | push esi |
170 | push edi |
170 | push edi |
171 | push eax |
171 | push eax |
172 | push ebx |
172 | push ebx |
173 | push ecx |
173 | push ecx |
174 | push edx |
174 | push edx |
- | 175 | ||
- | 176 | or ax,ax |
|
- | 177 | jle noaddbutt |
|
- | 178 | or bx,bx |
|
- | 179 | jle noaddbutt |
|
175 | 180 | ||
176 | test ecx,0x40000000 |
181 | test ecx,0x40000000 |
177 | jnz button_no_draw |
182 | jnz button_no_draw |
178 | 183 | ||
179 | pushad ; button body |
184 | pushad ; button body |
180 | push ebx |
185 | push ebx |
181 | shr eax,16 |
186 | shr eax,16 |
182 | shr ebx,16 |
187 | shr ebx,16 |
183 | mov edx,[0x3010] |
188 | mov edx,[0x3010] |
184 | mov esi,[edx-twdw] |
189 | mov esi,[edx-twdw] |
185 | mov edi,[edx-twdw+4] |
190 | mov edi,[edx-twdw+4] |
186 | add eax,esi |
191 | add eax,esi |
187 | add ebx,edi |
192 | add ebx,edi |
188 | mov cx,ax |
193 | mov cx,ax |
189 | mov dx,bx |
194 | mov dx,bx |
190 | shl eax,16 |
195 | shl eax,16 |
191 | shl ebx,16 |
196 | shl ebx,16 |
192 | mov ax,cx |
197 | mov ax,cx |
193 | mov bx,dx |
198 | mov bx,dx |
194 | movzx ecx,word [4+32+esp+12] |
199 | movzx ecx,word [4+32+esp+12] |
195 | add eax,ecx |
200 | add eax,ecx |
196 | mov ecx,[4+32+esp+0] |
201 | mov ecx,[4+32+esp+0] |
197 | cmp [buttontype],dword 0 |
202 | cmp [buttontype],dword 0 |
198 | je @f |
203 | je @f |
199 | call incecx2 |
204 | call incecx2 |
200 | @@: |
205 | @@: |
201 | movzx edi,word [esp] |
206 | movzx edi,word [esp] |
202 | 207 | ||
203 | ; |
208 | ; |
204 | pop edx |
209 | pop edx |
205 | and edx, 0xFFFF |
210 | and edx, 0xFFFF |
206 | ;;cli |
211 | ;;cli |
207 | .newline: |
212 | .newline: |
208 | call button_dececx |
213 | call button_dececx |
209 | push edi |
214 | push edi |
210 | xor edi, edi |
215 | xor edi, edi |
211 | call [draw_line] |
216 | call [draw_line] |
212 | pop edi |
217 | pop edi |
213 | add ebx,1*65536+1 ; [ y start | y end ] |
218 | add ebx,1*65536+1 ; [ y start | y end ] |
214 | dec edx |
219 | dec edx |
215 | jnz .newline |
220 | jnz .newline |
216 | ;;sti |
221 | ;;sti |
217 | ;; pop ebx |
222 | ;; pop ebx |
218 | ; |
223 | ; |
219 | popad |
224 | popad |
220 | 225 | ||
221 | call drawbuttonframes |
226 | call drawbuttonframes |
222 | 227 | ||
223 | button_no_draw: |
228 | button_no_draw: |
224 | 229 | ||
225 | and ecx,0xffff |
230 | and ecx,0xffff |
226 | 231 | ||
227 | mov edi,[0x3010] |
232 | mov edi,[0x3010] |
228 | sub edi,twdw |
233 | sub edi,twdw |
229 | 234 | ||
230 | mov edi,[0xfe88] |
235 | mov edi,[0xfe88] |
231 | movzx eax,word [edi] |
236 | movzx eax,word [edi] |
232 | cmp eax,max_buttons |
237 | cmp eax,max_buttons |
233 | jge noaddbutt |
238 | jge noaddbutt |
234 | inc eax |
239 | inc eax |
235 | mov [edi],ax |
240 | mov [edi],ax |
236 | 241 | ||
237 | shl eax,4 |
242 | shl eax,4 |
238 | add eax,edi |
243 | add eax,edi |
239 | 244 | ||
240 | mov bx,[0x3000] |
245 | mov bx,[0x3000] |
241 | mov [eax],bx |
246 | mov [eax],bx |
242 | 247 | ||
243 | add eax,2 ; save button id number |
248 | add eax,2 ; save button id number |
244 | mov ebx,[esp+4] |
249 | mov ebx,[esp+4] |
245 | mov [eax],bx ; bits 0-15 |
250 | mov [eax],bx ; bits 0-15 |
246 | shr ebx,16 |
251 | shr ebx,16 |
247 | mov [eax-2+0xc],bx; bits 16-31 |
252 | mov [eax-2+0xc],bx; bits 16-31 |
248 | add eax,2 ; x start |
253 | add eax,2 ; x start |
249 | mov bx,[esp+12+2] |
254 | mov bx,[esp+12+2] |
250 | mov [eax],bx |
255 | mov [eax],bx |
251 | add eax,2 ; x size |
256 | add eax,2 ; x size |
252 | mov bx,[esp+12+0] |
257 | mov bx,[esp+12+0] |
253 | mov [eax],bx |
258 | mov [eax],bx |
254 | add eax,2 ; y start |
259 | add eax,2 ; y start |
255 | mov bx,[esp+8+2] |
260 | mov bx,[esp+8+2] |
256 | mov [eax],bx |
261 | mov [eax],bx |
257 | add eax,2 ; y size |
262 | add eax,2 ; y size |
258 | mov bx,[esp+8+0] |
263 | mov bx,[esp+8+0] |
259 | mov [eax],bx |
264 | mov [eax],bx |
260 | 265 | ||
261 | noaddbutt: |
266 | noaddbutt: |
262 | 267 | ||
263 | pop edx |
268 | pop edx |
264 | pop ecx |
269 | pop ecx |
265 | pop ebx |
270 | pop ebx |
266 | pop eax |
271 | pop eax |
267 | pop edi |
272 | pop edi |
268 | pop esi |
273 | pop esi |
269 | 274 | ||
270 | ret |
275 | ret |
271 | 276 | ||
272 | 277 | ||
273 | remove_button: |
278 | remove_button: |
274 | 279 | ||
275 | and ecx,0x7fffffff |
280 | and ecx,0x7fffffff |
276 | 281 | ||
277 | rnewba2: |
282 | rnewba2: |
278 | 283 | ||
279 | mov edi,[0xfe88] |
284 | mov edi,[0xfe88] |
280 | mov eax,edi |
285 | mov eax,edi |
281 | movzx ebx,word [edi] |
286 | movzx ebx,word [edi] |
282 | inc bx |
287 | inc bx |
283 | 288 | ||
284 | rnewba: |
289 | rnewba: |
285 | 290 | ||
286 | dec bx |
291 | dec bx |
287 | jz rnmba |
292 | jz rnmba |
288 | 293 | ||
289 | add eax,0x10 |
294 | add eax,0x10 |
290 | 295 | ||
291 | mov dx,[0x3000] |
296 | mov dx,[0x3000] |
292 | cmp dx,[eax] |
297 | cmp dx,[eax] |
293 | jnz rnewba |
298 | jnz rnewba |
294 | 299 | ||
295 | cmp cx,[eax+2] |
300 | cmp cx,[eax+2] |
296 | jnz rnewba |
301 | jnz rnewba |
297 | 302 | ||
298 | pushad |
303 | pushad |
299 | mov ecx,ebx |
304 | mov ecx,ebx |
300 | inc ecx |
305 | inc ecx |
301 | shl ecx,4 |
306 | shl ecx,4 |
302 | mov ebx,eax |
307 | mov ebx,eax |
303 | add eax,0x10 |
308 | add eax,0x10 |
304 | call memmove |
309 | call memmove |
305 | dec dword [edi] |
310 | dec dword [edi] |
306 | popad |
311 | popad |
307 | 312 | ||
308 | jmp rnewba2 |
313 | jmp rnewba2 |
309 | 314 | ||
310 | rnmba: |
315 | rnmba: |
311 | 316 | ||
312 | ret |
317 | ret |
313 | 318 | ||
314 | find_pressed_button_frames: |
319 | find_pressed_button_frames: |
315 | 320 | ||
316 | pushad |
321 | pushad |
317 | 322 | ||
318 | movzx ebx,word [eax+0] |
323 | movzx ebx,word [eax+0] |
319 | shl ebx,5 |
324 | shl ebx,5 |
320 | add ebx,window_data |
325 | add ebx,window_data |
321 | movzx ecx,word [ebx+0] ; window x start |
326 | movzx ecx,word [ebx+0] ; window x start |
322 | movzx edx,word [eax+4] ; button x start |
327 | movzx edx,word [eax+4] ; button x start |
323 | add ecx,edx |
328 | add ecx,edx |
324 | push ecx |
329 | push ecx |
325 | 330 | ||
326 | mov dx,[eax+6] ; button x size |
331 | mov dx,[eax+6] ; button x size |
327 | add cx,dx |
332 | add cx,dx |
328 | mov esi,ecx |
333 | mov esi,ecx |
329 | inc esi |
334 | inc esi |
330 | mov cx,[ebx+4] ; window y start |
335 | mov cx,[ebx+4] ; window y start |
331 | mov dx,[eax+8] ; button y start |
336 | mov dx,[eax+8] ; button y start |
332 | add ecx,edx |
337 | add ecx,edx |
333 | mov ebx,ecx |
338 | mov ebx,ecx |
334 | mov dx,[eax+10] ; button y size |
339 | mov dx,[eax+10] ; button y size |
335 | add dx,cx |
340 | add dx,cx |
336 | inc dx |
341 | inc dx |
337 | 342 | ||
338 | pop eax |
343 | pop eax |
339 | 344 | ||
340 | ; eax x beginning |
345 | ; eax x beginning |
341 | ; ebx y beginning |
346 | ; ebx y beginning |
342 | ; esi x end |
347 | ; esi x end |
343 | ; edx y end |
348 | ; edx y end |
344 | ; ecx color |
349 | ; ecx color |
345 | 350 | ||
346 | mov [pressed_button_eax],eax |
351 | mov [pressed_button_eax],eax |
347 | mov [pressed_button_ebx],ebx |
352 | mov [pressed_button_ebx],ebx |
348 | mov [pressed_button_ecx],ecx |
353 | mov [pressed_button_ecx],ecx |
349 | mov [pressed_button_edx],edx |
354 | mov [pressed_button_edx],edx |
350 | mov [pressed_button_esi],esi |
355 | mov [pressed_button_esi],esi |
351 | 356 | ||
352 | popad |
357 | popad |
353 | ret |
358 | ret |
354 | 359 | ||
355 | uglobal |
360 | uglobal |
356 | pressed_button_eax dd 0 |
361 | pressed_button_eax dd 0 |
357 | pressed_button_ebx dd 0 |
362 | pressed_button_ebx dd 0 |
358 | pressed_button_ecx dd 0 |
363 | pressed_button_ecx dd 0 |
359 | pressed_button_edx dd 0 |
364 | pressed_button_edx dd 0 |
360 | pressed_button_esi dd 0 |
365 | pressed_button_esi dd 0 |
361 | endg |
366 | endg |
362 | 367 | ||
363 | ; negative button image |
368 | ; negative button image |
364 | 369 | ||
365 | negativebutton: |
370 | negativebutton: |
366 | ; If requested, do not display button |
371 | ; If requested, do not display button |
367 | ; boarder on press. |
372 | ; boarder on press. |
368 | test ebx,0x20000000 |
373 | test ebx,0x20000000 |
369 | jz draw_negative_button |
374 | jz draw_negative_button |
370 | ret |
375 | ret |
371 | draw_negative_button: |
376 | draw_negative_button: |
372 | 377 | ||
373 | pushad |
378 | pushad |
374 | 379 | ||
375 | mov eax,[pressed_button_eax] |
380 | mov eax,[pressed_button_eax] |
376 | mov ebx,[pressed_button_ebx] |
381 | mov ebx,[pressed_button_ebx] |
377 | mov ecx,[pressed_button_ecx] |
382 | mov ecx,[pressed_button_ecx] |
378 | mov edx,[pressed_button_edx] |
383 | mov edx,[pressed_button_edx] |
379 | mov esi,[pressed_button_esi] |
384 | mov esi,[pressed_button_esi] |
380 | mov ecx,0x01000000 |
385 | mov ecx,0x01000000 |
381 | 386 | ||
382 | dec edx |
387 | dec edx |
383 | push edx |
388 | push edx |
384 | inc edx |
389 | inc edx |
385 | dec esi |
390 | dec esi |
386 | push esi |
391 | push esi |
387 | inc esi |
392 | inc esi |
388 | 393 | ||
389 | push eax |
394 | push eax |
390 | push ebx |
395 | push ebx |
391 | push ecx |
396 | push ecx |
392 | push edx |
397 | push edx |
393 | push edi |
398 | push edi |
394 | 399 | ||
395 | call [disable_mouse] |
400 | call [disable_mouse] |
396 | 401 | ||
397 | bdbnewline: |
402 | bdbnewline: |
398 | mov edi,1 ; force |
403 | mov edi,1 ; force |
399 | cmp eax,[esp+16] |
404 | cmp eax,[esp+16] |
400 | jz bneg |
405 | jz bneg |
401 | cmp eax,[esp+20] |
406 | cmp eax,[esp+20] |
402 | jz bneg |
407 | jz bneg |
403 | cmp ebx,[esp+12] |
408 | cmp ebx,[esp+12] |
404 | jz bneg |
409 | jz bneg |
405 | cmp ebx,[esp+24] |
410 | cmp ebx,[esp+24] |
406 | jnz nbneg |
411 | jnz nbneg |
407 | ; jz bneg |
412 | ; jz bneg |
408 | ; jmp nbneg |
413 | ; jmp nbneg |
409 | 414 | ||
410 | bneg: |
415 | bneg: |
411 | 416 | ||
412 | ;;;call [disable_mouse] |
417 | ;;;call [disable_mouse] |
413 | call [putpixel] |
418 | call [putpixel] |
414 | 419 | ||
415 | nbneg: |
420 | nbneg: |
416 | 421 | ||
417 | inc eax |
422 | inc eax |
418 | cmp eax,esi |
423 | cmp eax,esi |
419 | jnz bdbnewline |
424 | jnz bdbnewline |
420 | mov eax,[esp+16] |
425 | mov eax,[esp+16] |
421 | inc ebx |
426 | inc ebx |
422 | cmp ebx,edx |
427 | cmp ebx,edx |
423 | jnz bdbnewline |
428 | jnz bdbnewline |
424 | 429 | ||
425 | add esp,28 |
430 | add esp,28 |
426 | 431 | ||
427 | popad |
432 | popad |
428 | 433 | ||
429 | ret |
434 | ret |
430 | 435 | ||
431 | ; check buttons |
436 | ; check buttons |
432 | 437 | ||
433 | 438 | ||
434 | ; 0000 word process number |
439 | ; 0000 word process number |
435 | ; 0002 word button id number : bits 0-15 |
440 | ; 0002 word button id number : bits 0-15 |
436 | ; 0004 word x start |
441 | ; 0004 word x start |
437 | ; 0006 word x size |
442 | ; 0006 word x size |
438 | ; 0008 word y start |
443 | ; 0008 word y start |
439 | ; 000A word y size |
444 | ; 000A word y size |
440 | ; 000C word button id number : bits 16-31 |
445 | ; 000C word button id number : bits 16-31 |
441 | ; |
446 | ; |
442 | ; button table in 0x10 increments |
447 | ; button table in 0x10 increments |
443 | ; |
448 | ; |
444 | ; first at 0x10 |
449 | ; first at 0x10 |
445 | 450 | ||
446 | 451 | ||
447 | checkbuttons: |
452 | checkbuttons: |
448 | 453 | ||
449 | cmp [0xfb40],byte 0 ; mouse buttons pressed |
454 | cmp [0xfb40],byte 0 ; mouse buttons pressed |
450 | jnz @f |
455 | jnz @f |
451 | ret |
456 | ret |
452 | @@: |
457 | @@: |
453 | 458 | ||
454 | pushad |
459 | pushad |
455 | 460 | ||
456 | xor esi, esi |
461 | xor esi, esi |
457 | mov edi, [0xfe88] |
462 | mov edi, [0xfe88] |
458 | movzx edx, word [edi] |
463 | movzx edx, word [edi] |
459 | test edx, edx |
464 | test edx, edx |
460 | jne @f |
465 | jne @f |
461 | popad |
466 | popad |
462 | ret |
467 | ret |
463 | 468 | ||
464 | @@: |
469 | @@: |
465 | 470 | ||
466 | push esi |
471 | push esi |
467 | inc edx |
472 | inc edx |
468 | push edx |
473 | push edx |
469 | 474 | ||
470 | buttonnewcheck: |
475 | buttonnewcheck: |
471 | 476 | ||
472 | pop edx |
477 | pop edx |
473 | pop esi |
478 | pop esi |
474 | inc esi |
479 | inc esi |
475 | cmp edx,esi |
480 | cmp edx,esi |
476 | jge bch |
481 | jge bch |
477 | 482 | ||
478 | popad ; no button pressed |
483 | popad ; no button pressed |
479 | ret |
484 | ret |
480 | 485 | ||
481 | bch: |
486 | bch: |
482 | 487 | ||
483 | push esi |
488 | push esi |
484 | push edx |
489 | push edx |
485 | mov eax,esi |
490 | mov eax,esi |
486 | shl eax,4 |
491 | shl eax,4 |
487 | add eax,edi |
492 | add eax,edi |
488 | 493 | ||
489 | ;......................start 1/2 : modified by vhanla ............................. |
494 | ;......................start 1/2 : modified by vhanla ............................. |
490 | mov [buttonid],eax |
495 | mov [buttonid],eax |
491 | ;......................end 1/2 : modified by vhanla ............................. |
496 | ;......................end 1/2 : modified by vhanla ............................. |
492 | 497 | ||
493 | ; check that button is at top of windowing stack |
498 | ; check that button is at top of windowing stack |
494 | 499 | ||
495 | movzx ebx,word [eax] |
500 | movzx ebx,word [eax] |
496 | movzx ecx,word [0xC000 + ebx * 2] |
501 | movzx ecx,word [0xC000 + ebx * 2] |
497 | cmp ecx,[0x3004] |
502 | cmp ecx,[0x3004] |
498 | jne buttonnewcheck |
503 | jne buttonnewcheck |
499 | 504 | ||
500 | ; check that button start is inside window x/y end |
505 | ; check that button start is inside window x/y end |
501 | 506 | ||
502 | movzx ebx,word [eax+0] |
507 | movzx ebx,word [eax+0] |
503 | shl ebx,5 |
508 | shl ebx,5 |
504 | 509 | ||
505 | test [ebx+window_data+WDATA.fl_wstate],WSTATE_MINIMIZED |
510 | test [ebx+window_data+WDATA.fl_wstate],WSTATE_MINIMIZED |
506 | jnz buttonnewcheck |
511 | jnz buttonnewcheck |
507 | 512 | ||
508 | ; add ebx,window_data |
513 | ; add ebx,window_data |
509 | ; mov ecx,[window_data+ebx+8] ; window end X |
514 | ; mov ecx,[window_data+ebx+8] ; window end X |
510 | movzx edx,word [eax+4] ; button start X |
515 | movzx edx,word [eax+4] ; button start X |
511 | cmp edx, [window_data+ebx+8] ;ecx |
516 | cmp edx, [window_data+ebx+8] ;ecx |
512 | jge buttonnewcheck |
517 | jge buttonnewcheck |
513 | 518 | ||
514 | ; mov ecx,[window_data+ebx+12] ; window end Y |
519 | ; mov ecx,[window_data+ebx+12] ; window end Y |
515 | movzx edx, word [eax+8] ; button start Y |
520 | movzx edx, word [eax+8] ; button start Y |
516 | cmp edx, [window_data+ebx+12] ;ecx |
521 | cmp edx, [window_data+ebx+12] ;ecx |
517 | jge buttonnewcheck |
522 | jge buttonnewcheck |
518 | 523 | ||
519 | ; check coordinates |
524 | ; check coordinates |
520 | ; mouse x >= button x ? |
525 | ; mouse x >= button x ? |
521 | movzx ebx,word [eax+0] |
526 | movzx ebx,word [eax+0] |
522 | shl ebx,5 |
527 | shl ebx,5 |
523 | add ebx,window_data |
528 | add ebx,window_data |
524 | movzx ecx,word [ebx+0] ; window x start |
529 | movzx ecx,word [ebx+0] ; window x start |
525 | movzx edx,word [eax+4] ; button x start |
530 | movzx edx,word [eax+4] ; button x start |
526 | add edx,ecx |
531 | add edx,ecx |
527 | mov cx,[0xfb0a] |
532 | mov cx,[0xfb0a] |
528 | cmp edx,ecx |
533 | cmp edx,ecx |
529 | jg buttonnewcheck |
534 | jg buttonnewcheck |
530 | 535 | ||
531 | movzx ebx,word [eax+6] ; button x size |
536 | movzx ebx,word [eax+6] ; button x size |
532 | add edx,ebx |
537 | add edx,ebx |
533 | cmp ecx,edx |
538 | cmp ecx,edx |
534 | jg buttonnewcheck |
539 | jg buttonnewcheck |
535 | 540 | ||
536 | ; mouse y >= button y ? |
541 | ; mouse y >= button y ? |
537 | movzx ebx,word [eax+0] |
542 | movzx ebx,word [eax+0] |
538 | shl ebx,5 |
543 | shl ebx,5 |
539 | add ebx,window_data |
544 | add ebx,window_data |
540 | movzx ecx,word [ebx+4] ; window y start |
545 | movzx ecx,word [ebx+4] ; window y start |
541 | movzx edx,word [eax+8] ; button y start |
546 | movzx edx,word [eax+8] ; button y start |
542 | add edx,ecx |
547 | add edx,ecx |
543 | mov cx,[0xfb0c] |
548 | mov cx,[0xfb0c] |
544 | cmp edx,ecx |
549 | cmp edx,ecx |
545 | jg buttonnewcheck |
550 | jg buttonnewcheck |
546 | 551 | ||
547 | movzx ebx,word [eax+10] ; button y size |
552 | movzx ebx,word [eax+10] ; button y size |
548 | add edx,ebx |
553 | add edx,ebx |
549 | cmp ecx,edx |
554 | cmp ecx,edx |
550 | jg buttonnewcheck |
555 | jg buttonnewcheck |
551 | 556 | ||
552 | ; mouse on button |
557 | ; mouse on button |
553 | 558 | ||
554 | pop edx |
559 | pop edx |
555 | pop esi |
560 | pop esi |
556 | 561 | ||
557 | mov bx,[eax+0xc] ; button id : bits 16-31 |
562 | mov bx,[eax+0xc] ; button id : bits 16-31 |
558 | shl ebx,16 |
563 | shl ebx,16 |
559 | mov bx,[eax+2] ; button id : bits 00-16 |
564 | mov bx,[eax+2] ; button id : bits 00-16 |
560 | push ebx |
565 | push ebx |
561 | 566 | ||
562 | mov [0xfb44],byte 1 ; no mouse down checks |
567 | mov [0xfb44],byte 1 ; no mouse down checks |
563 | call find_pressed_button_frames |
568 | call find_pressed_button_frames |
564 | call negativebutton |
569 | call negativebutton |
565 | 570 | ||
566 | pushad |
571 | pushad |
567 | cbwaitmouseup: |
572 | cbwaitmouseup: |
568 | 573 | ||
569 | call checkidle |
574 | call checkidle |
570 | 575 | ||
571 | call [draw_pointer] |
576 | call [draw_pointer] |
572 | 577 | ||
573 | pushad |
578 | pushad |
574 | call stack_handler |
579 | call stack_handler |
575 | popad |
580 | popad |
576 | 581 | ||
577 | cmp [0xfb40],byte 0 ; mouse buttons pressed ? |
582 | cmp [0xfb40],byte 0 ; mouse buttons pressed ? |
578 | jnz cbwaitmouseup |
583 | jnz cbwaitmouseup |
579 | popad |
584 | popad |
580 | 585 | ||
581 | call negativebutton |
586 | call negativebutton |
582 | mov [0xfff4],byte 0 ; no mouse background |
587 | mov [0xfff4],byte 0 ; no mouse background |
583 | mov [0xfff5],byte 0 ; draw mouse |
588 | mov [0xfff5],byte 0 ; draw mouse |
584 | ;..................................... start 2/2 : modified by vhanla ............................. |
589 | ;..................................... start 2/2 : modified by vhanla ............................. |
585 | ; check coordinates |
590 | ; check coordinates |
586 | jmp afterbuttonid |
591 | jmp afterbuttonid |
587 | buttonid dd 0x0 ;here a will backup the eax value |
592 | buttonid dd 0x0 ;here a will backup the eax value |
588 | afterbuttonid: |
593 | afterbuttonid: |
589 | 594 | ||
590 | pusha |
595 | pusha |
591 | ; mouse x >= button x ? |
596 | ; mouse x >= button x ? |
592 | movzx ebx,word [eax+0] |
597 | movzx ebx,word [eax+0] |
593 | shl ebx,5 |
598 | shl ebx,5 |
594 | add ebx,window_data |
599 | add ebx,window_data |
595 | movzx ecx,word [ebx+0] ; window x start |
600 | movzx ecx,word [ebx+0] ; window x start |
596 | movzx edx,word [eax+4] ; button x start |
601 | movzx edx,word [eax+4] ; button x start |
597 | add edx,ecx |
602 | add edx,ecx |
598 | mov cx,[0xfb0a] |
603 | mov cx,[0xfb0a] |
599 | cmp edx,ecx |
604 | cmp edx,ecx |
600 | jg no_on_button ;if we release the pointer out of the button area |
605 | jg no_on_button ;if we release the pointer out of the button area |
601 | 606 | ||
602 | movzx ebx,word [eax+6] ; button x size |
607 | movzx ebx,word [eax+6] ; button x size |
603 | add edx,ebx |
608 | add edx,ebx |
604 | cmp ecx,edx |
609 | cmp ecx,edx |
605 | jg no_on_button |
610 | jg no_on_button |
606 | 611 | ||
607 | ; mouse y >= button y ? |
612 | ; mouse y >= button y ? |
608 | movzx ebx,word [eax+0] |
613 | movzx ebx,word [eax+0] |
609 | shl ebx,5 |
614 | shl ebx,5 |
610 | add ebx,window_data |
615 | add ebx,window_data |
611 | movzx ecx,word [ebx+4] ; window y start |
616 | movzx ecx,word [ebx+4] ; window y start |
612 | movzx edx,word [eax+8] ; button y start |
617 | movzx edx,word [eax+8] ; button y start |
613 | add edx,ecx |
618 | add edx,ecx |
614 | mov cx,[0xfb0c] |
619 | mov cx,[0xfb0c] |
615 | cmp edx,ecx |
620 | cmp edx,ecx |
616 | jg no_on_button |
621 | jg no_on_button |
617 | 622 | ||
618 | movzx ebx,word [eax+10] ; button y size |
623 | movzx ebx,word [eax+10] ; button y size |
619 | add edx,ebx |
624 | add edx,ebx |
620 | cmp ecx,edx |
625 | cmp ecx,edx |
621 | jg no_on_button |
626 | jg no_on_button |
622 | popa |
627 | popa |
623 | mov [0xf500],byte 1 ; no of buttons in buffer |
628 | mov [0xf500],byte 1 ; no of buttons in buffer |
624 | pop ebx |
629 | pop ebx |
625 | mov [0xf501],ebx ; lets put the button id in buffer |
630 | mov [0xf501],ebx ; lets put the button id in buffer |
626 | push ebx |
631 | push ebx |
627 | pusha |
632 | pusha |
628 | jmp yes_on_button |
633 | jmp yes_on_button |
629 | no_on_button: |
634 | no_on_button: |
630 | mov [0xf500],byte 0 ; no of buttons in buffer |
635 | mov [0xf500],byte 0 ; no of buttons in buffer |
631 | yes_on_button: |
636 | yes_on_button: |
632 | mov [0xfb44],byte 0 ; mouse down -> do not draw |
637 | mov [0xfb44],byte 0 ; mouse down -> do not draw |
633 | popa |
638 | popa |
634 | pop ebx |
639 | pop ebx |
635 | popa |
640 | popa |
636 | ret |
641 | ret |
637 | 642 | ||
638 | ;..................................... end 2/2 : modified by vhanla ................................ |
643 | ;..................................... end 2/2 : modified by vhanla ................................ |