Rev 5646 | Rev 5651 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5646 | Rev 5648 | ||
---|---|---|---|
1 | //CODED by Veliant, Leency, Nable. GNU GPL licence. |
1 | //CODED by Veliant, Leency, Nable. GNU GPL licence. |
2 | #ifndef INCLUDE_KOLIBRI_H |
2 | #ifndef INCLUDE_KOLIBRI_H |
3 | #define INCLUDE_KOLIBRI_H |
3 | #define INCLUDE_KOLIBRI_H |
4 | 4 | ||
5 | #startaddress 0 |
5 | #startaddress 0 |
6 | #code32 TRUE |
6 | #code32 TRUE |
7 | 7 | ||
8 | char os_name[8] = {'M','E','N','U','E','T','0','1'}; |
8 | char os_name[8] = {'M','E','N','U','E','T','0','1'}; |
9 | dword os_version = 0x00000001; |
9 | dword os_version = 0x00000001; |
10 | dword start_addr = #load_init_main; |
10 | dword start_addr = #______INIT______; |
11 | dword final_addr = #stop+32; |
11 | dword final_addr = #______STOP______+32; |
12 | dword alloc_mem = MEMSIZE; |
12 | dword alloc_mem = MEMSIZE; |
13 | dword x86esp_reg = MEMSIZE; |
13 | dword x86esp_reg = MEMSIZE; |
14 | dword I_Param = #param; |
14 | dword I_Param = #param; |
15 | dword I_Path = #program_path; |
15 | dword I_Path = #program_path; |
16 | char param[4096]; |
16 | char param[4096]; |
17 | char program_path[4096]; |
17 | char program_path[4096]; |
18 | 18 | ||
19 | #define NULL 0 |
19 | #define NULL 0 |
20 | #define OLD -1 |
20 | #define OLD -1 |
21 | #define true 1 |
21 | #define true 1 |
22 | #define false 0 |
22 | #define false 0 |
23 | 23 | ||
24 | //Events |
24 | //Events |
25 | #define evReDraw 1 |
25 | #define evReDraw 1 |
26 | #define evKey 2 |
26 | #define evKey 2 |
27 | #define evButton 3 |
27 | #define evButton 3 |
28 | #define evDesktop 5 |
28 | #define evDesktop 5 |
29 | #define evMouse 6 |
29 | #define evMouse 6 |
30 | #define evIPC 7 |
30 | #define evIPC 7 |
31 | #define evNetwork 8 |
31 | #define evNetwork 8 |
32 | #define evDebug 9 |
32 | #define evDebug 9 |
33 | 33 | ||
34 | //Button options |
34 | //Button options |
35 | #define BT_DEL 0x80000000 |
35 | #define BT_DEL 0x80000000 |
36 | #define BT_HIDE 0x40000000 |
36 | #define BT_HIDE 0x40000000 |
37 | #define BT_NOFRAME 0x20000000 |
37 | #define BT_NOFRAME 0x20000000 |
38 | 38 | ||
39 | //Button MOUSE |
39 | //Button MOUSE |
40 | #define MOUSE_LEFT 001b |
40 | #define MOUSE_LEFT 001b |
41 | #define MOUSE_RIGHT 010b |
41 | #define MOUSE_RIGHT 010b |
42 | #define MOUSE_LR 011b |
42 | #define MOUSE_LR 011b |
43 | #define MOUSE_CENTER 100b |
43 | #define MOUSE_CENTER 100b |
44 | 44 | ||
45 | //ASCII KEYS |
45 | //ASCII KEYS |
46 | #define ASCII_KEY_BS 008 |
46 | #define ASCII_KEY_BS 008 |
47 | #define ASCII_KEY_TAB 009 |
47 | #define ASCII_KEY_TAB 009 |
48 | #define ASCII_KEY_ENTER 013 |
48 | #define ASCII_KEY_ENTER 013 |
49 | #define ASCII_KEY_ESC 027 |
49 | #define ASCII_KEY_ESC 027 |
50 | #define ASCII_KEY_DEL 182 |
50 | #define ASCII_KEY_DEL 182 |
51 | #define ASCII_KEY_INS 185 |
51 | #define ASCII_KEY_INS 185 |
52 | #define ASCII_KEY_SPACE 032 |
52 | #define ASCII_KEY_SPACE 032 |
53 | 53 | ||
54 | #define ASCII_KEY_LEFT 176 |
54 | #define ASCII_KEY_LEFT 176 |
55 | #define ASCII_KEY_RIGHT 179 |
55 | #define ASCII_KEY_RIGHT 179 |
56 | #define ASCII_KEY_DOWN 177 |
56 | #define ASCII_KEY_DOWN 177 |
57 | #define ASCII_KEY_UP 178 |
57 | #define ASCII_KEY_UP 178 |
58 | #define ASCII_KEY_HOME 180 |
58 | #define ASCII_KEY_HOME 180 |
59 | #define ASCII_KEY_END 181 |
59 | #define ASCII_KEY_END 181 |
60 | #define ASCII_KEY_PGDN 183 |
60 | #define ASCII_KEY_PGDN 183 |
61 | #define ASCII_KEY_PGUP 184 |
61 | #define ASCII_KEY_PGUP 184 |
62 | 62 | ||
63 | //allow event mask |
63 | //allow event mask |
64 | #define EVENT_MASK_REDRAW 000000001b |
64 | #define EVENT_MASK_REDRAW 000000001b |
65 | #define EVENT_MASK_KEYBOARD 000000010b |
65 | #define EVENT_MASK_KEYBOARD 000000010b |
66 | #define EVENT_MASK_BUTTONS 000000100b |
66 | #define EVENT_MASK_BUTTONS 000000100b |
67 | #define EVENT_MASK_DESKTOP 000010000b |
67 | #define EVENT_MASK_DESKTOP 000010000b |
68 | #define EVENT_MASK_MOUSE 000100000b |
68 | #define EVENT_MASK_MOUSE 000100000b |
69 | #define EVENT_MASK_IPC 001000000b |
69 | #define EVENT_MASK_IPC 001000000b |
70 | #define EVENT_MASK_NETWORK 010000000b |
70 | #define EVENT_MASK_NETWORK 010000000b |
71 | #define EVENT_MASK_DEBUG 100000000b |
71 | #define EVENT_MASK_DEBUG 100000000b |
72 | 72 | ||
73 | //ARGS FUNCTION |
73 | //ARGS FUNCTION |
74 | #define END_ARGS 0xFF00FF |
74 | #define END_ARGS 0xFF00FF |
75 | //------------------------------------------------------------------------- |
75 | //------------------------------------------------------------------------- |
76 | 76 | ||
77 | :struct raw_image { |
77 | :struct raw_image { |
78 | dword w, h, data; |
78 | dword w, h, data; |
79 | }; |
79 | }; |
80 | 80 | ||
81 | /** |
81 | /** |
82 | * The structure of the MOUSE |
82 | * The structure of the MOUSE |
83 | * x - coordinate X |
83 | * x - coordinate X |
84 | * y - coordinate Y |
84 | * y - coordinate Y |
85 | * xx and yy - time coordinates |
85 | * xx and yy - time coordinates |
86 | * lkm - left MOUSE button |
86 | * lkm - left MOUSE button |
87 | * pkm - right MOUSE button |
87 | * pkm - right MOUSE button |
88 | * mkm - MOUSE wheel |
88 | * mkm - MOUSE wheel |
89 | * key - keycode button |
89 | * key - keycode button |
90 | * tmp - time keycode |
90 | * tmp - time keycode |
91 | * down - key event press |
91 | * down - key event press |
92 | * up - key release events |
92 | * up - key release events |
93 | * move - event MOUSE movements |
93 | * move - event MOUSE movements |
94 | * click - when clicked |
94 | * click - when clicked |
95 | * dblclick - double-click the default 50 (500 ms) |
95 | * dblclick - double-click the default 50 (500 ms) |
96 | */ |
96 | */ |
97 | 97 | ||
98 | :dword __TMP_TIME,MOUSE_TIME; |
98 | :dword __TMP_TIME,MOUSE_TIME; |
99 | :struct MOUSE |
99 | :struct MOUSE |
100 | { |
100 | { |
101 | signed x,y,xx,yy,lkm,mkm,pkm,key,tmp,tmp_time,hor,vert,down,up,move,click,dblclick,left,top; |
101 | signed x,y,xx,yy,lkm,mkm,pkm,key,tmp,tmp_time,hor,vert,down,up,move,click,dblclick,left,top; |
102 | dword handle,_; |
102 | dword handle,_; |
103 | byte cmd; |
103 | byte cmd; |
104 | void clearTime(); |
104 | void clearTime(); |
105 | void get(); |
105 | void get(); |
106 | void set(); |
106 | void set(); |
107 | void center(); |
107 | void center(); |
108 | dword hide(); |
108 | dword hide(); |
109 | void slider(); |
109 | void slider(); |
110 | void show(); |
110 | void show(); |
111 | } mouse; |
111 | } mouse; |
112 | :void MOUSE::clearTime() |
112 | :void MOUSE::clearTime() |
113 | { |
113 | { |
114 | tmp_time = GetStartTime()+MOUSE_TIME; |
114 | tmp_time = GetStartTime()+MOUSE_TIME; |
115 | } |
115 | } |
116 | :void MOUSE::show() |
116 | :void MOUSE::show() |
117 | { |
117 | { |
118 | if(!handle)return; |
118 | if(!handle)return; |
119 | ECX = handle; |
119 | ECX = handle; |
120 | EAX = 37; |
120 | EAX = 37; |
121 | EBX = 5; |
121 | EBX = 5; |
122 | $int 0x40; |
122 | $int 0x40; |
123 | } |
123 | } |
124 | :dword MOUSE::hide() |
124 | :dword MOUSE::hide() |
125 | { |
125 | { |
126 | if(!_) |
126 | if(!_) |
127 | { |
127 | { |
128 | EAX = 68; |
128 | EAX = 68; |
129 | EBX = 12; |
129 | EBX = 12; |
130 | ECX = 32*32*4; |
130 | ECX = 32*32*4; |
131 | $int 0x40 |
131 | $int 0x40 |
132 | ECX = EAX; |
132 | ECX = EAX; |
133 | _ = EAX; |
133 | _ = EAX; |
134 | } else ECX = _; |
134 | } else ECX = _; |
135 | EAX = 37; |
135 | EAX = 37; |
136 | EBX = 4; |
136 | EBX = 4; |
137 | DX = 2; |
137 | DX = 2; |
138 | $int 0x40; |
138 | $int 0x40; |
139 | handle = EAX; |
139 | handle = EAX; |
140 | ECX = EAX; |
140 | ECX = EAX; |
141 | EAX = 37; |
141 | EAX = 37; |
142 | EBX = 5; |
142 | EBX = 5; |
143 | $int 0x40; |
143 | $int 0x40; |
144 | handle = EAX; |
144 | handle = EAX; |
145 | } |
145 | } |
146 | 146 | ||
147 | //set new attributes MOUSE |
147 | //set new attributes MOUSE |
148 | :void MOUSE::set() |
148 | :void MOUSE::set() |
149 | { |
149 | { |
150 | if((xx!=x)||(yy!=y)) |
150 | if((xx!=x)||(yy!=y)) |
151 | { |
151 | { |
152 | EAX = 18; |
152 | EAX = 18; |
153 | EBX = 19; |
153 | EBX = 19; |
154 | ECX = 4; |
154 | ECX = 4; |
155 | EDX = (x<<16)+y; |
155 | EDX = (x<<16)+y; |
156 | $int 0x40 |
156 | $int 0x40 |
157 | //move = true; |
157 | //move = true; |
158 | } |
158 | } |
159 | if((key)||(lkm|mkm|pkm))&&(down|up|click|dblclick|move) |
159 | if((key)||(lkm|mkm|pkm))&&(down|up|click|dblclick|move) |
160 | { |
160 | { |
161 | if(lkm|mkm|pkm)key=(lkm)|(pkm<<1)|(2< |
161 | if(lkm|mkm|pkm)key=(lkm)|(pkm<<1)|(2< |
162 | EAX = 18; |
162 | EAX = 18; |
163 | EBX = 19; |
163 | EBX = 19; |
164 | ECX = key; |
164 | ECX = key; |
165 | EDX = (x<<16)+y; |
165 | EDX = (x<<16)+y; |
166 | $int 0x40 |
166 | $int 0x40 |
167 | } |
167 | } |
168 | } |
168 | } |
169 | 169 | ||
170 | :void MOUSE::center() |
170 | :void MOUSE::center() |
171 | { |
171 | { |
172 | EAX = 18; |
172 | EAX = 18; |
173 | EBX = 15; |
173 | EBX = 15; |
174 | $int 0x40 |
174 | $int 0x40 |
175 | } |
175 | } |
176 | 176 | ||
177 | //get new attributes MOUSE |
177 | //get new attributes MOUSE |
178 | :void MOUSE::get() |
178 | :void MOUSE::get() |
179 | { |
179 | { |
180 | EAX = 37; |
180 | EAX = 37; |
181 | EBX = 1; |
181 | EBX = 1; |
182 | $int 0x40 |
182 | $int 0x40 |
183 | $mov ebx, eax |
183 | $mov ebx, eax |
184 | $shr eax, 16 |
184 | $shr eax, 16 |
185 | $and ebx,0x0000FFFF |
185 | $and ebx,0x0000FFFF |
186 | x = EAX; |
186 | x = EAX; |
187 | y = EBX; |
187 | y = EBX; |
188 | if (x>6000) x-=65535; |
188 | if (x>6000) x-=65535; |
189 | if (y>6000) y-=65535; |
189 | if (y>6000) y-=65535; |
190 | EAX = 37; |
190 | EAX = 37; |
191 | EBX = 2; |
191 | EBX = 2; |
192 | $int 0x40 |
192 | $int 0x40 |
193 | $mov ebx, eax |
193 | $mov ebx, eax |
194 | $mov ecx, eax |
194 | $mov ecx, eax |
195 | key = EAX; |
195 | key = EAX; |
196 | $and eax, 0x00000001 |
196 | $and eax, 0x00000001 |
197 | $shr ebx, 1 |
197 | $shr ebx, 1 |
198 | $and ebx, 0x00000001 |
198 | $and ebx, 0x00000001 |
199 | $shr ecx, 2 |
199 | $shr ecx, 2 |
200 | $and ecx, 0x00000001 |
200 | $and ecx, 0x00000001 |
201 | lkm = EAX; |
201 | lkm = EAX; |
202 | pkm = EBX; |
202 | pkm = EBX; |
203 | mkm = ECX; |
203 | mkm = ECX; |
204 | 204 | ||
205 | //when you release the MOUSE button |
205 | //when you release the MOUSE button |
206 | // Mouse Up Event |
206 | // Mouse Up Event |
207 | if((cmd)&&!(key)){ |
207 | if((cmd)&&!(key)){ |
208 | up = true; |
208 | up = true; |
209 | down = false; |
209 | down = false; |
210 | if(!move) click = true; |
210 | if(!move) click = true; |
211 | move = false; |
211 | move = false; |
212 | __TMP_TIME = GetStartTime(); |
212 | __TMP_TIME = GetStartTime(); |
213 | if(__TMP_TIME-tmp_time<=MOUSE_TIME){ dblclick = true;click = false; } |
213 | if(__TMP_TIME-tmp_time<=MOUSE_TIME){ dblclick = true;click = false; } |
214 | tmp_time = __TMP_TIME; |
214 | tmp_time = __TMP_TIME; |
215 | //returns the key code |
215 | //returns the key code |
216 | key = tmp; |
216 | key = tmp; |
217 | lkm = 1&tmp; |
217 | lkm = 1&tmp; |
218 | pkm = 2&tmp; |
218 | pkm = 2&tmp; |
219 | pkm >>= 1; |
219 | pkm >>= 1; |
220 | mkm = 4&tmp; |
220 | mkm = 4&tmp; |
221 | mkm >>= 2; |
221 | mkm >>= 2; |
222 | cmd = false; |
222 | cmd = false; |
223 | } |
223 | } |
224 | 224 | ||
225 | //when you press the MOUSE button |
225 | //when you press the MOUSE button |
226 | // Mouse Down Event/Move Event |
226 | // Mouse Down Event/Move Event |
227 | else { |
227 | else { |
228 | up = false; |
228 | up = false; |
229 | click = false; |
229 | click = false; |
230 | dblclick = false; |
230 | dblclick = false; |
231 | down = false; |
231 | down = false; |
232 | // Mouse Move Event |
232 | // Mouse Move Event |
233 | if((xx!=x)||(yy!=y)) |
233 | if((xx!=x)||(yy!=y)) |
234 | { |
234 | { |
235 | move = true; |
235 | move = true; |
236 | xx = x; |
236 | xx = x; |
237 | yy = y; |
237 | yy = y; |
238 | } |
238 | } |
239 | else move = false; |
239 | else move = false; |
240 | if(key)if(!cmd) {down = true;cmd = true;tmp=key;} |
240 | if(key)if(!cmd) {down = true;cmd = true;tmp=key;} |
241 | } |
241 | } |
242 | 242 | ||
243 | //scroll |
243 | //scroll |
244 | EAX = 37; |
244 | EAX = 37; |
245 | EBX = 7; |
245 | EBX = 7; |
246 | $int 0x40 |
246 | $int 0x40 |
247 | $mov ebx, eax |
247 | $mov ebx, eax |
248 | $shr eax, 16 |
248 | $shr eax, 16 |
249 | $and ebx,0x0000FFFF |
249 | $and ebx,0x0000FFFF |
250 | //hor = EAX; |
250 | //hor = EAX; |
251 | vert = EBX; |
251 | vert = EBX; |
252 | } |
252 | } |
253 | 253 | ||
254 | 254 | ||
255 | 255 | ||
256 | :void MOUSE::slider() |
256 | :void MOUSE::slider() |
257 | { |
257 | { |
258 | signed _x,_y; |
258 | signed _x,_y; |
259 | if(!handle)hide(); |
259 | if(!handle)hide(); |
260 | get(); |
260 | get(); |
261 | _x = x;_y = y; |
261 | _x = x;_y = y; |
262 | pause(5); |
262 | pause(5); |
263 | get(); |
263 | get(); |
264 | left = _x - x; |
264 | left = _x - x; |
265 | top = _y - y; |
265 | top = _y - y; |
266 | center(); |
266 | center(); |
267 | get(); |
267 | get(); |
268 | _x = x;_y = y; |
268 | _x = x;_y = y; |
269 | pause(5); |
269 | pause(5); |
270 | } |
270 | } |
271 | 271 | ||
272 | :struct keyboard |
272 | :struct keyboard |
273 | { |
273 | { |
274 | signed key; |
274 | signed key; |
275 | byte down,up,press; |
275 | byte down,up,press; |
276 | void get(void); |
276 | void get(void); |
277 | }; |
277 | }; |
278 | 278 | ||
279 | :void keyboard::get(void) |
279 | :void keyboard::get(void) |
280 | { |
280 | { |
281 | 281 | ||
282 | } |
282 | } |
283 | 283 | ||
284 | :struct system_colors |
284 | :struct system_colors |
285 | { |
285 | { |
286 | dword frame,grab,grab_button,grab_button_text,grab_text, |
286 | dword frame,grab,grab_button,grab_button_text,grab_text, |
287 | work,work_button,work_button_text,work_text,work_graph; |
287 | work,work_button,work_button_text,work_text,work_graph; |
288 | void get(); |
288 | void get(); |
289 | }; |
289 | }; |
290 | 290 | ||
291 | :void system_colors::get() |
291 | :void system_colors::get() |
292 | { |
292 | { |
293 | EAX = 48; |
293 | EAX = 48; |
294 | EBX = 3; |
294 | EBX = 3; |
295 | ECX = #frame; |
295 | ECX = #frame; |
296 | EDX = 40; |
296 | EDX = 40; |
297 | $int 0x40 |
297 | $int 0x40 |
298 | } |
298 | } |
299 | 299 | ||
300 | //------------------------------------------------------------------------------ |
300 | //------------------------------------------------------------------------------ |
301 | :dword wait_event_code; |
301 | :dword wait_event_code; |
302 | inline fastcall dword WaitEvent() |
302 | inline fastcall dword WaitEvent() |
303 | { |
303 | { |
304 | $mov eax,10 |
304 | $mov eax,10 |
305 | $int 0x40 |
305 | $int 0x40 |
306 | wait_event_code = EAX; |
306 | wait_event_code = EAX; |
307 | //if(wait_event_code==evMouse) MOUSE.get(); |
307 | //if(wait_event_code==evMouse) MOUSE.get(); |
308 | //return wait_event_code; |
308 | //return wait_event_code; |
309 | } |
309 | } |
310 | 310 | ||
311 | inline fastcall dword CheckEvent() |
311 | inline fastcall dword CheckEvent() |
312 | { |
312 | { |
313 | $mov eax,11 |
313 | $mov eax,11 |
314 | $int 0x40 |
314 | $int 0x40 |
315 | } |
315 | } |
316 | 316 | ||
317 | inline fastcall dword WaitEventTimeout(EBX) |
317 | inline fastcall dword WaitEventTimeout(EBX) |
318 | { |
318 | { |
319 | $mov eax,23 |
319 | $mov eax,23 |
320 | $int 0x40 |
320 | $int 0x40 |
321 | } |
321 | } |
322 | 322 | ||
323 | inline fastcall SetEventMask(EBX) |
323 | inline fastcall SetEventMask(EBX) |
324 | { |
324 | { |
325 | $mov eax,40 |
325 | $mov eax,40 |
326 | $int 0x40 |
326 | $int 0x40 |
327 | } |
327 | } |
328 | 328 | ||
329 | inline fastcall ScancodesGeting(){ |
329 | inline fastcall ScancodesGeting(){ |
330 | $mov eax,66 |
330 | $mov eax,66 |
331 | $mov ebx,1 |
331 | $mov ebx,1 |
332 | $mov ecx,1 //᪠ª®¤ë |
332 | $mov ecx,1 //᪠ª®¤ë |
333 | $int 0x40 |
333 | $int 0x40 |
334 | } |
334 | } |
335 | 335 | ||
336 | inline fastcall word GetKey() //+Gluk fix |
336 | inline fastcall word GetKey() //+Gluk fix |
337 | { |
337 | { |
338 | $push edx |
338 | $push edx |
339 | GETKEY: |
339 | GETKEY: |
340 | $mov eax,2 |
340 | $mov eax,2 |
341 | $int 0x40 |
341 | $int 0x40 |
342 | $cmp eax,1 |
342 | $cmp eax,1 |
343 | $jne GETKEYI |
343 | $jne GETKEYI |
344 | $mov ah,dh |
344 | $mov ah,dh |
345 | $jmp GETKEYII //jz? |
345 | $jmp GETKEYII //jz? |
346 | GETKEYI: |
346 | GETKEYI: |
347 | $mov dh,ah |
347 | $mov dh,ah |
348 | $jmp GETKEY |
348 | $jmp GETKEY |
349 | GETKEYII: |
349 | GETKEYII: |
350 | $pop edx |
350 | $pop edx |
351 | $shr eax,8 |
351 | $shr eax,8 |
352 | } |
352 | } |
353 | 353 | ||
354 | inline fastcall int GetFullKey() |
354 | inline fastcall int GetFullKey() |
355 | { |
355 | { |
356 | $mov eax,2 |
356 | $mov eax,2 |
357 | $int 0x40 |
357 | $int 0x40 |
358 | } |
358 | } |
359 | 359 | ||
360 | 360 | ||
361 | inline fastcall pause(EBX) |
361 | inline fastcall pause(EBX) |
362 | { |
362 | { |
363 | $mov eax, 5 |
363 | $mov eax, 5 |
364 | $int 0x40 |
364 | $int 0x40 |
365 | } |
365 | } |
366 | 366 | ||
367 | inline fastcall word GetButtonID() |
367 | inline fastcall word GetButtonID() |
368 | { |
368 | { |
369 | $mov eax,17 |
369 | $mov eax,17 |
370 | $int 0x40 |
370 | $int 0x40 |
371 | $shr eax,8 |
371 | $shr eax,8 |
372 | } |
372 | } |
373 | 373 | ||
374 | inline fastcall dword GetFreeRAM() |
374 | inline fastcall dword GetFreeRAM() |
375 | { |
375 | { |
376 | $mov eax, 18 |
376 | $mov eax, 18 |
377 | $mov ebx, 16 |
377 | $mov ebx, 16 |
378 | $int 0x40 |
378 | $int 0x40 |
379 | //return eax = ðàçìåð ñâîáîäíîé ïàìÿòè â êèëîáàéòàõ |
379 | //return eax = ðàçìåð ñâîáîäíîé ïàìÿòè â êèëîáàéòàõ |
380 | } |
380 | } |
381 | 381 | ||
382 | inline void draw_line(dword x1,y1,x2,y2,color) |
382 | inline void draw_line(dword x1,y1,x2,y2,color) |
383 | { |
383 | { |
384 | x2--;y2--;y1--; |
384 | x2--;y2--;y1--; |
385 | $mov EAX,38 |
385 | $mov EAX,38 |
386 | EBX = x1<<16; |
386 | EBX = x1<<16; |
387 | EBX |= x2; |
387 | EBX |= x2; |
388 | ECX = y1<<16; |
388 | ECX = y1<<16; |
389 | ECX |= y2; |
389 | ECX |= y2; |
390 | $mov EDX,color |
390 | $mov EDX,color |
391 | $int 0x40 |
391 | $int 0x40 |
392 | } |
392 | } |
393 | 393 | ||
394 | inline fastcall dword LoadDriver(ECX) //ECX - èìÿ äðàéâåðà |
394 | inline fastcall dword LoadDriver(ECX) //ECX - èìÿ äðàéâåðà |
395 | { |
395 | { |
396 | $mov eax, 68 |
396 | $mov eax, 68 |
397 | $mov ebx, 16 |
397 | $mov ebx, 16 |
398 | $int 0x40 |
398 | $int 0x40 |
399 | //return 0 - íåóäà÷à, èíà÷å eax = õýíäë äðàéâåðà |
399 | //return 0 - íåóäà÷à, èíà÷å eax = õýíäë äðàéâåðà |
400 | } |
400 | } |
401 | 401 | ||
402 | inline fastcall dword RuleDriver(ECX) //óêàçàòåëü íà óïðàâëÿþùóþ ñòðóêòóðó |
402 | inline fastcall dword RuleDriver(ECX) //óêàçàòåëü íà óïðàâëÿþùóþ ñòðóêòóðó |
403 | { |
403 | { |
404 | $mov eax, 68 |
404 | $mov eax, 68 |
405 | $mov ebx, 17 |
405 | $mov ebx, 17 |
406 | $int 0x40 |
406 | $int 0x40 |
407 | //return eax = îïðåäåëÿåòñÿ äðàéâåðîì |
407 | //return eax = îïðåäåëÿåòñÿ äðàéâåðîì |
408 | } |
408 | } |
409 | 409 | ||
410 | struct proc_info |
410 | struct proc_info |
411 | { |
411 | { |
412 | #define SelfInfo -1 |
412 | #define SelfInfo -1 |
413 | dword use_cpu; |
413 | dword use_cpu; |
414 | word pos_in_stack,num_slot,rezerv1; |
414 | word pos_in_stack,num_slot,rezerv1; |
415 | unsigned char name[11]; |
415 | unsigned char name[11]; |
416 | char rezerv2; |
416 | char rezerv2; |
417 | dword adress,use_memory,ID,left,top,width,height; |
417 | dword adress,use_memory,ID,left,top,width,height; |
418 | word status_slot,rezerv3; |
418 | word status_slot,rezerv3; |
419 | dword work_left,work_top,work_width,work_height; |
419 | dword work_left,work_top,work_width,work_height; |
420 | char status_window; |
420 | char status_window; |
421 | dword cwidth,cheight; |
421 | dword cwidth,cheight; |
422 | byte reserved[1024-71-8]; |
422 | byte reserved[1024-71-8]; |
423 | }; |
423 | }; |
424 | 424 | ||
425 | inline fastcall void GetProcessInfo(EBX, ECX) |
425 | inline fastcall void GetProcessInfo(EBX, ECX) |
426 | { |
426 | { |
427 | $mov eax,9; |
427 | $mov eax,9; |
428 | $int 0x40 |
428 | $int 0x40 |
429 | DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth |
429 | DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth |
430 | DSDWORD[EBX+75] = DSDWORD[EBX+46] - GetSkinHeight() - 4; //set cheight |
430 | DSDWORD[EBX+75] = DSDWORD[EBX+46] - GetSkinHeight() - 4; //set cheight |
431 | } |
431 | } |
432 | 432 | ||
433 | inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y |
433 | inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y |
434 | { |
434 | { |
435 | $mov eax,34 |
435 | $mov eax,34 |
436 | $int 0x40 |
436 | $int 0x40 |
437 | } |
437 | } |
438 | 438 | ||
439 | inline fastcall int GetProcessSlot( ECX) |
439 | inline fastcall int GetProcessSlot( ECX) |
440 | { |
440 | { |
441 | EAX = 18; |
441 | EAX = 18; |
442 | EBX = 21; |
442 | EBX = 21; |
443 | $int 0x40 |
443 | $int 0x40 |
444 | } |
444 | } |
445 | 445 | ||
446 | inline fastcall int GetActiveProcess() |
446 | inline fastcall int GetActiveProcess() |
447 | { |
447 | { |
448 | EAX = 18; |
448 | EAX = 18; |
449 | EBX = 7; |
449 | EBX = 7; |
450 | $int 0x40 |
450 | $int 0x40 |
451 | } |
451 | } |
452 | 452 | ||
453 | :int CheckActiveProcess(int Form_ID) |
453 | :int CheckActiveProcess(int Form_ID) |
454 | { |
454 | { |
455 | int id9=GetProcessSlot(Form_ID); |
455 | int id9=GetProcessSlot(Form_ID); |
456 | if (id9==GetActiveProcess()) return 1; |
456 | if (id9==GetActiveProcess()) return 1; |
457 | return 0; |
457 | return 0; |
458 | } |
458 | } |
459 | 459 | ||
460 | inline fastcall void ActivateWindow( ECX) |
460 | inline fastcall void ActivateWindow( ECX) |
461 | { |
461 | { |
462 | EAX = 18; |
462 | EAX = 18; |
463 | EBX = 3; |
463 | EBX = 3; |
464 | $int 0x40 |
464 | $int 0x40 |
465 | } |
465 | } |
466 | 466 | ||
467 | inline fastcall int MinimizeWindow() |
467 | inline fastcall int MinimizeWindow() |
468 | { |
468 | { |
469 | EAX = 18; |
469 | EAX = 18; |
470 | EBX = 10; |
470 | EBX = 10; |
471 | $int 0x40 |
471 | $int 0x40 |
472 | } |
472 | } |
473 | 473 | ||
474 | inline fastcall int CreateThread(ECX,EDX) |
474 | inline fastcall int CreateThread(ECX,EDX) |
475 | { |
475 | { |
476 | $mov eax,51 |
476 | $mov eax,51 |
477 | $mov ebx,1 |
477 | $mov ebx,1 |
478 | $int 0x40 |
478 | $int 0x40 |
479 | } |
479 | } |
480 | 480 | ||
481 | inline fastcall void SwitchToAnotherThread() |
481 | inline fastcall void SwitchToAnotherThread() |
482 | { |
482 | { |
483 | $mov eax,68 |
483 | $mov eax,68 |
484 | $mov ebx,1 |
484 | $mov ebx,1 |
485 | $int 0x40 |
485 | $int 0x40 |
486 | } |
486 | } |
487 | 487 | ||
488 | inline fastcall int SendWindowMessage( ECX, EDX) |
488 | inline fastcall int SendWindowMessage( ECX, EDX) |
489 | { |
489 | { |
490 | $mov eax, 72 |
490 | $mov eax, 72 |
491 | $mov ebx, 1 |
491 | $mov ebx, 1 |
492 | $int 0x40 |
492 | $int 0x40 |
493 | } |
493 | } |
494 | 494 | ||
495 | inline fastcall int KillProcess( ECX) |
495 | inline fastcall int KillProcess( ECX) |
496 | { |
496 | { |
497 | $mov eax,18; |
497 | $mov eax,18; |
498 | $mov ebx,18; |
498 | $mov ebx,18; |
499 | $int 0x40 |
499 | $int 0x40 |
500 | } |
500 | } |
501 | 501 | ||
502 | #define TURN_OFF 2 |
502 | #define TURN_OFF 2 |
503 | #define REBOOT 3 |
503 | #define REBOOT 3 |
504 | #define KERNEL 4 |
504 | #define KERNEL 4 |
505 | inline fastcall int ExitSystem( ECX) |
505 | inline fastcall int ExitSystem( ECX) |
506 | { |
506 | { |
507 | $mov eax, 18 |
507 | $mov eax, 18 |
508 | $mov ebx, 9 |
508 | $mov ebx, 9 |
509 | $int 0x40 |
509 | $int 0x40 |
510 | } |
510 | } |
511 | 511 | ||
512 | inline fastcall ExitProcess() |
512 | inline fastcall ExitProcess() |
513 | { |
513 | { |
514 | $mov eax,-1; |
514 | $mov eax,-1; |
515 | $int 0x40 |
515 | $int 0x40 |
516 | } |
516 | } |
517 | 517 | ||
518 | //------------------------------------------------------------------------------ |
518 | //------------------------------------------------------------------------------ |
519 | 519 | ||
520 | //eax = ÿçûê ñèñòåìû (1=eng, 2=fi, 3=ger, 4=rus) |
520 | //eax = ÿçûê ñèñòåìû (1=eng, 2=fi, 3=ger, 4=rus) |
521 | inline fastcall int GetSystemLanguage() |
521 | inline fastcall int GetSystemLanguage() |
522 | { |
522 | { |
523 | EAX = 26; |
523 | EAX = 26; |
524 | EBX = 5; |
524 | EBX = 5; |
525 | $int 0x40 |
525 | $int 0x40 |
526 | } |
526 | } |
527 | 527 | ||
528 | inline fastcall GetSkinHeight() |
528 | inline fastcall GetSkinHeight() |
529 | { |
529 | { |
530 | $push ebx |
530 | $push ebx |
531 | $mov eax,48 |
531 | $mov eax,48 |
532 | $mov ebx,4 |
532 | $mov ebx,4 |
533 | $int 0x40 |
533 | $int 0x40 |
534 | $pop ebx |
534 | $pop ebx |
535 | } |
535 | } |
536 | 536 | ||
537 | inline fastcall void SetSystemSkin( ECX) |
537 | inline fastcall void SetSystemSkin( ECX) |
538 | { |
538 | { |
539 | EAX = 48; |
539 | EAX = 48; |
540 | EBX = 8; |
540 | EBX = 8; |
541 | $int 0x40 |
541 | $int 0x40 |
542 | } |
542 | } |
543 | 543 | ||
544 | inline fastcall int GetScreenWidth() |
544 | inline fastcall int GetScreenWidth() |
545 | { |
545 | { |
546 | $mov eax, 14 |
546 | $mov eax, 14 |
547 | $int 0x40 |
547 | $int 0x40 |
548 | $shr eax, 16 |
548 | $shr eax, 16 |
549 | } |
549 | } |
550 | 550 | ||
551 | inline fastcall int GetScreenHeight() |
551 | inline fastcall int GetScreenHeight() |
552 | { |
552 | { |
553 | $mov eax, 14 |
553 | $mov eax, 14 |
554 | $int 0x40 |
554 | $int 0x40 |
555 | $and eax,0x0000FFFF |
555 | $and eax,0x0000FFFF |
556 | } |
556 | } |
557 | 557 | ||
558 | inline fastcall int GetClientTop() |
558 | inline fastcall int GetClientTop() |
559 | { |
559 | { |
560 | $mov eax, 48 |
560 | $mov eax, 48 |
561 | $mov ebx, 5 |
561 | $mov ebx, 5 |
562 | $int 0x40 |
562 | $int 0x40 |
563 | $mov eax, ebx |
563 | $mov eax, ebx |
564 | $shr eax, 16 |
564 | $shr eax, 16 |
565 | } |
565 | } |
566 | 566 | ||
567 | inline fastcall int GetClientHeight() |
567 | inline fastcall int GetClientHeight() |
568 | { |
568 | { |
569 | $mov eax, 48 |
569 | $mov eax, 48 |
570 | $mov ebx, 5 |
570 | $mov ebx, 5 |
571 | $int 0x40 |
571 | $int 0x40 |
572 | $mov eax, ebx |
572 | $mov eax, ebx |
573 | } |
573 | } |
574 | 574 | ||
575 | 575 | ||
576 | inline fastcall dword LoadLibrary( ECX) |
576 | inline fastcall dword LoadLibrary( ECX) |
577 | { |
577 | { |
578 | $mov eax, 68 |
578 | $mov eax, 68 |
579 | $mov ebx, 19 |
579 | $mov ebx, 19 |
580 | $int 0x40 |
580 | $int 0x40 |
581 | } |
581 | } |
582 | 582 | ||
583 | inline fastcall int TestBit( EAX, CL) |
583 | inline fastcall int TestBit( EAX, CL) |
584 | { |
584 | { |
585 | $shr eax,cl |
585 | $shr eax,cl |
586 | $and eax,1 |
586 | $and eax,1 |
587 | } |
587 | } |
588 | 588 | ||
589 | inline fastcall int PlaySpeaker( ESI) |
589 | inline fastcall int PlaySpeaker( ESI) |
590 | { |
590 | { |
591 | $mov eax, 55 |
591 | $mov eax, 55 |
592 | $mov ebx, 55 |
592 | $mov ebx, 55 |
593 | $int 0x40 |
593 | $int 0x40 |
594 | } |
594 | } |
595 | 595 | ||
596 | inline fastcall void debugln( EDX) |
596 | inline fastcall void debugln( EDX) |
597 | { |
597 | { |
598 | $push eax |
598 | $push eax |
599 | $push ebx |
599 | $push ebx |
600 | $push ecx |
600 | $push ecx |
601 | $mov eax, 63 |
601 | $mov eax, 63 |
602 | $mov ebx, 1 |
602 | $mov ebx, 1 |
603 | NEXT_CHAR: |
603 | NEXT_CHAR: |
604 | $mov ecx, DSDWORD[edx] |
604 | $mov ecx, DSDWORD[edx] |
605 | $or cl, cl |
605 | $or cl, cl |
606 | $jz DONE |
606 | $jz DONE |
607 | $int 0x40 |
607 | $int 0x40 |
608 | $inc edx |
608 | $inc edx |
609 | $jmp NEXT_CHAR |
609 | $jmp NEXT_CHAR |
610 | DONE: |
610 | DONE: |
611 | $mov cl, 13 |
611 | $mov cl, 13 |
612 | $int 0x40 |
612 | $int 0x40 |
613 | $mov cl, 10 |
613 | $mov cl, 10 |
614 | $int 0x40 |
614 | $int 0x40 |
615 | $pop ecx |
615 | $pop ecx |
616 | $pop ebx |
616 | $pop ebx |
617 | $pop eax |
617 | $pop eax |
618 | } |
618 | } |
619 | 619 | ||
620 | inline fastcall void debug( EDX) |
620 | inline fastcall void debug( EDX) |
621 | { |
621 | { |
622 | $push eax |
622 | $push eax |
623 | $push ebx |
623 | $push ebx |
624 | $push ecx |
624 | $push ecx |
625 | $mov eax, 63 |
625 | $mov eax, 63 |
626 | $mov ebx, 1 |
626 | $mov ebx, 1 |
627 | NEXT_CHAR: |
627 | NEXT_CHAR: |
628 | $mov ecx, DSDWORD[edx] |
628 | $mov ecx, DSDWORD[edx] |
629 | $or cl, cl |
629 | $or cl, cl |
630 | $jz DONE |
630 | $jz DONE |
631 | $int 0x40 |
631 | $int 0x40 |
632 | $inc edx |
632 | $inc edx |
633 | $jmp NEXT_CHAR |
633 | $jmp NEXT_CHAR |
634 | DONE: |
634 | DONE: |
635 | $pop ecx |
635 | $pop ecx |
636 | $pop ebx |
636 | $pop ebx |
637 | $pop eax |
637 | $pop eax |
638 | } |
638 | } |
639 | 639 | ||
640 | 640 | ||
641 | inline fastcall void debugch( ECX) |
641 | inline fastcall void debugch( ECX) |
642 | { |
642 | { |
643 | $push eax |
643 | $push eax |
644 | $push ebx |
644 | $push ebx |
645 | $mov eax,63 |
645 | $mov eax,63 |
646 | $mov ebx,1 |
646 | $mov ebx,1 |
647 | $int 0x40 |
647 | $int 0x40 |
648 | $pop ebx |
648 | $pop ebx |
649 | $pop eax |
649 | $pop eax |
650 | } |
650 | } |
651 | //------------------------------------------------------------------------------ |
651 | //------------------------------------------------------------------------------ |
652 | 652 | ||
653 | void DefineAndDrawWindow(dword x, y, size_w, size_h, byte WindowType,dword WindowAreaColor, EDI, ESI) |
653 | void DefineAndDrawWindow(dword x, y, size_w, size_h, byte WindowType,dword WindowAreaColor, EDI, ESI) |
654 | { |
654 | { |
655 | EAX = 12; // function 12:tell os about windowdraw |
655 | EAX = 12; // function 12:tell os about windowdraw |
656 | EBX = 1; |
656 | EBX = 1; |
657 | $int 0x40 |
657 | $int 0x40 |
658 | 658 | ||
659 | $xor EAX,EAX |
659 | $xor EAX,EAX |
660 | EBX = x << 16 + size_w; |
660 | EBX = x << 16 + size_w; |
661 | ECX = y << 16 + size_h; |
661 | ECX = y << 16 + size_h; |
662 | 662 | ||
663 | EDX = WindowType << 24 | WindowAreaColor; |
663 | EDX = WindowType << 24 | WindowAreaColor; |
664 | $int 0x40 |
664 | $int 0x40 |
665 | 665 | ||
666 | EAX = 12; // function 12:tell os about windowdraw |
666 | EAX = 12; // function 12:tell os about windowdraw |
667 | EBX = 2; |
667 | EBX = 2; |
668 | $int 0x40 |
668 | $int 0x40 |
669 | } |
669 | } |
670 | 670 | ||
671 | inline fastcall MoveSize( EBX,ECX,EDX,ESI) |
671 | inline fastcall MoveSize( EBX,ECX,EDX,ESI) |
672 | { |
672 | { |
673 | $mov eax, 67 |
673 | $mov eax, 67 |
674 | $int 0x40 |
674 | $int 0x40 |
675 | } |
675 | } |
676 | 676 | ||
677 | inline fastcall void DrawTitle( ECX) |
677 | inline fastcall void DrawTitle( ECX) |
678 | { |
678 | { |
679 | EAX = 71; |
679 | EAX = 71; |
680 | EBX = 1; |
680 | EBX = 1; |
681 | $int 0x40; |
681 | $int 0x40; |
682 | } |
682 | } |
683 | 683 | ||
684 | void WriteTextB(dword x,y,byte fontType, dword color, EDX) |
684 | void WriteTextB(dword x,y,byte fontType, dword color, EDX) |
685 | { |
685 | { |
686 | EAX = 4; |
686 | EAX = 4; |
687 | EBX = x<<16+y; |
687 | EBX = x<<16+y; |
688 | ECX = fontType<<24+color; |
688 | ECX = fontType<<24+color; |
689 | ESI = 0; |
689 | ESI = 0; |
690 | $int 0x40; |
690 | $int 0x40; |
691 | $add ebx, 1<<16 |
691 | $add ebx, 1<<16 |
692 | $int 0x40 |
692 | $int 0x40 |
693 | } |
693 | } |
694 | 694 | ||
695 | void WriteText(dword x,y,byte fontType, dword color, EDX) |
695 | void WriteText(dword x,y,byte fontType, dword color, EDX) |
696 | { |
696 | { |
697 | EAX = 4; |
697 | EAX = 4; |
698 | EBX = x<<16+y; |
698 | EBX = x<<16+y; |
699 | ECX = fontType<<24+color; |
699 | ECX = fontType<<24+color; |
700 | $int 0x40; |
700 | $int 0x40; |
701 | } |
701 | } |
702 | 702 | ||
703 | dword WriteBufText(dword x,y,byte fontType, dword color, EDX, EDI) |
703 | dword WriteBufText(dword x,y,byte fontType, dword color, EDX, EDI) |
704 | { |
704 | { |
705 | EAX = 4; |
705 | EAX = 4; |
706 | EBX = x<<16+y; |
706 | EBX = x<<16+y; |
707 | ECX = fontType<<24+color; |
707 | ECX = fontType<<24+color; |
708 | $int 0x40; |
708 | $int 0x40; |
709 | } |
709 | } |
710 | 710 | ||
711 | void WriteNumber(dword x,y,byte fontType, dword color, count, ECX) |
711 | void WriteNumber(dword x,y,byte fontType, dword color, count, ECX) |
712 | { |
712 | { |
713 | EAX = 47; |
713 | EAX = 47; |
714 | EBX = count<<16; |
714 | EBX = count<<16; |
715 | EDX = x<<16+y; |
715 | EDX = x<<16+y; |
716 | ESI = fontType<<24+color; |
716 | ESI = fontType<<24+color; |
717 | $int 0x40; |
717 | $int 0x40; |
718 | } |
718 | } |
719 | 719 | ||
720 | void CopyScreen(dword EBX, x, y, w, h) |
720 | void CopyScreen(dword EBX, x, y, w, h) |
721 | { |
721 | { |
722 | EAX = 36; |
722 | EAX = 36; |
723 | ECX = w << 16 + h; |
723 | ECX = w << 16 + h; |
724 | EDX = x << 16 + y; |
724 | EDX = x << 16 + y; |
725 | $int 0x40; |
725 | $int 0x40; |
726 | } |
726 | } |
727 | 727 | ||
728 | :dword GetPixelColor(dword x, x_size, y) |
728 | :dword GetPixelColor(dword x, x_size, y) |
729 | { |
729 | { |
730 | $mov eax, 35 |
730 | $mov eax, 35 |
731 | EBX= y*x_size+x; |
731 | EBX= y*x_size+x; |
732 | $int 0x40 |
732 | $int 0x40 |
733 | } |
733 | } |
734 | 734 | ||
735 | 735 | ||
736 | void _PutImage(dword x,y, w,h, EBX) |
736 | void _PutImage(dword x,y, w,h, EBX) |
737 | { |
737 | { |
738 | EAX = 7; |
738 | EAX = 7; |
739 | ECX = w<<16+h; |
739 | ECX = w<<16+h; |
740 | EDX = x<<16+y; |
740 | EDX = x<<16+y; |
741 | $int 0x40 |
741 | $int 0x40 |
742 | } |
742 | } |
743 | 743 | ||
744 | void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI) |
744 | void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI) |
745 | { |
745 | { |
746 | EAX = 65; |
746 | EAX = 65; |
747 | ECX = w<<16+h; |
747 | ECX = w<<16+h; |
748 | EDX = x<<16+y; |
748 | EDX = x<<16+y; |
749 | EBP = 0; |
749 | EBP = 0; |
750 | $int 0x40 |
750 | $int 0x40 |
751 | } |
751 | } |
752 | 752 | ||
753 | inline fastcall void PutPixel( EBX,ECX,EDX) |
753 | inline fastcall void PutPixel( EBX,ECX,EDX) |
754 | { |
754 | { |
755 | EAX=1; |
755 | EAX=1; |
756 | $int 0x40 |
756 | $int 0x40 |
757 | } |
757 | } |
758 | 758 | ||
759 | void DrawBar(dword x,y,w,h,EDX) |
759 | void DrawBar(dword x,y,w,h,EDX) |
760 | { |
760 | { |
761 | if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :) |
761 | if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :) |
762 | EAX = 13; |
762 | EAX = 13; |
763 | EBX = x<<16+w; |
763 | EBX = x<<16+w; |
764 | ECX = y<<16+h; |
764 | ECX = y<<16+h; |
765 | $int 0x40 |
765 | $int 0x40 |
766 | } |
766 | } |
767 | 767 | ||
768 | void DefineButton(dword x,y,w,h,EDX,ESI) |
768 | void DefineButton(dword x,y,w,h,EDX,ESI) |
769 | { |
769 | { |
770 | EAX = 8; |
770 | EAX = 8; |
771 | $push edx |
771 | $push edx |
772 | EDX += BT_DEL; |
772 | EDX += BT_DEL; |
773 | $int 0x40; |
773 | $int 0x40; |
774 | $pop edx |
774 | $pop edx |
775 | EBX = x<<16+w; |
775 | EBX = x<<16+w; |
776 | ECX = y<<16+h; |
776 | ECX = y<<16+h; |
777 | $int 0x40 |
777 | $int 0x40 |
778 | } |
778 | } |
779 | 779 | ||
780 | inline RefreshWindow(dword ID_REFRESH,ID_ACTIVE) |
780 | inline RefreshWindow(dword ID_REFRESH,ID_ACTIVE) |
781 | { |
781 | { |
782 | EAX = 18; |
782 | EAX = 18; |
783 | EBX = 22; |
783 | EBX = 22; |
784 | ECX = 3; |
784 | ECX = 3; |
785 | EDX = ID_REFRESH; |
785 | EDX = ID_REFRESH; |
786 | $int 0x40 |
786 | $int 0x40 |
787 | EAX = 18; |
787 | EAX = 18; |
788 | EBX = 3; |
788 | EBX = 3; |
789 | EDX = ID_ACTIVE; |
789 | EDX = ID_ACTIVE; |
790 | $int 0x40 |
790 | $int 0x40 |
791 | } |
791 | } |
792 | 792 | ||
793 | inline getIPC(ECX,EDX) |
793 | inline getIPC(ECX,EDX) |
794 | { |
794 | { |
795 | $mov EAX,60 |
795 | $mov EAX,60 |
796 | $mov EBX,2 |
796 | $mov EBX,2 |
797 | $int 0x40 |
797 | $int 0x40 |
798 | } |
798 | } |
799 | 799 | ||
800 | inline sendIPC(ECX,EDX,ESI) |
800 | inline sendIPC(ECX,EDX,ESI) |
801 | { |
801 | { |
802 | $mov EAX,60 |
802 | $mov EAX,60 |
803 | $mov EBX,1 |
803 | $mov EBX,1 |
804 | $int 0x40 |
804 | $int 0x40 |
805 | } |
805 | } |
806 | 806 | ||
807 | void UnsafeDefineButton(dword x,y,w,h,EDX,ESI) |
807 | void UnsafeDefineButton(dword x,y,w,h,EDX,ESI) |
808 | { |
808 | { |
809 | EAX = 8; |
809 | EAX = 8; |
810 | EBX = x<<16+w; |
810 | EBX = x<<16+w; |
811 | ECX = y<<16+h; |
811 | ECX = y<<16+h; |
812 | $int 0x40 |
812 | $int 0x40 |
813 | } |
813 | } |
814 | 814 | ||
815 | inline fastcall void DeleteButton( EDX) |
815 | inline fastcall void DeleteButton( EDX) |
816 | { |
816 | { |
817 | EAX = 8; |
817 | EAX = 8; |
818 | EDX += BT_DEL; |
818 | EDX += BT_DEL; |
819 | $int 0x40 |
819 | $int 0x40 |
820 | } |
820 | } |
821 | 821 | ||
822 | inline fastcall dword GetStartTime() |
822 | inline fastcall dword GetStartTime() |
823 | { |
823 | { |
824 | $mov eax,26 |
824 | $mov eax,26 |
825 | $mov ebx,9 |
825 | $mov ebx,9 |
826 | $int 0x40 |
826 | $int 0x40 |
827 | } |
827 | } |
828 | 828 | ||
829 | :dword X_EventRedrawWindow,Y_EventRedrawWindow; |
829 | :dword X_EventRedrawWindow,Y_EventRedrawWindow; |
830 | :void _EventRedrawWindow() |
830 | :void _EventRedrawWindow() |
831 | { |
831 | { |
832 | loop()switch(WaitEvent()) |
832 | loop()switch(WaitEvent()) |
833 | { |
833 | { |
834 | case evReDraw: |
834 | case evReDraw: |
835 | DefineAndDrawWindow(X_EventRedrawWindow,Y_EventRedrawWindow,100,1,1,0x34,0xFFFFFF,""); |
835 | DefineAndDrawWindow(X_EventRedrawWindow,Y_EventRedrawWindow,100,1,1,0x34,0xFFFFFF,""); |
836 | pause(10); |
836 | pause(10); |
837 | ExitProcess(); |
837 | ExitProcess(); |
838 | break; |
838 | break; |
839 | } |
839 | } |
840 | } |
840 | } |
841 | :void EventRedrawWindow(dword x,y) |
841 | :void EventRedrawWindow(dword x,y) |
842 | { |
842 | { |
843 | dword mem = malloc(4096); |
843 | dword mem = malloc(4096); |
844 | X_EventRedrawWindow = x; |
844 | X_EventRedrawWindow = x; |
845 | Y_EventRedrawWindow = y; |
845 | Y_EventRedrawWindow = y; |
846 | CreateThread(#_EventRedrawWindow,mem+4092); |
846 | CreateThread(#_EventRedrawWindow,mem+4092); |
847 | } |
847 | } |
848 | 848 | ||
849 | :dword ALERT_TEXT; |
849 | :dword ALERT_TEXT; |
850 | :void dialog_alert() |
850 | :void dialog_alert() |
851 | { |
851 | { |
852 | byte id; |
852 | byte id; |
853 | loop()switch(WaitEvent()) |
853 | loop()switch(WaitEvent()) |
854 | { |
854 | { |
855 | case evReDraw: |
855 | case evReDraw: |
856 | DefineAndDrawWindow(215,100,250,200,0x34,0xFFFFFF,"Alert"); |
856 | DefineAndDrawWindow(215,100,250,200,0x34,0xFFFFFF,"Alert"); |
857 | WriteTextB(5,5,0x90,0x0,ALERT_TEXT); |
857 | WriteTextB(5,5,0x90,0x0,ALERT_TEXT); |
858 | break; |
858 | break; |
859 | case evKey: |
859 | case evKey: |
860 | case evButton: |
860 | case evButton: |
861 | id=GetButtonID(); |
861 | id=GetButtonID(); |
862 | if (id==1) ExitProcess(); |
862 | if (id==1) ExitProcess(); |
863 | break; |
863 | break; |
864 | } |
864 | } |
865 | } |
865 | } |
866 | :dword alert(dword text) |
866 | :dword alert(dword text) |
867 | { |
867 | { |
868 | dword mem = malloc(4096); |
868 | dword mem = malloc(4096); |
869 | ALERT_TEXT = text; |
869 | ALERT_TEXT = text; |
870 | CreateThread(#dialog_alert,mem+4092); |
870 | CreateThread(#dialog_alert,mem+4092); |
871 | return mem; |
871 | return mem; |
872 | } |
872 | } |
873 | 873 | ||
874 | :struct _screen |
874 | :struct _screen |
875 | { |
875 | { |
876 | dword width,height; |
876 | dword width,height; |
877 | } screen; |
877 | } screen; |
878 | 878 | ||
879 | :struct _skin |
879 | :struct _skin |
880 | { |
880 | { |
881 | dword width,height; |
881 | dword width,height; |
882 | } SKIN; |
882 | } SKIN; |
883 | 883 | ||
884 | :void DrawDate(dword x, y, color, in_date) |
884 | :void DrawDate(dword x, y, color, in_date) |
885 | { |
885 | { |
886 | //char text[15]; |
886 | //char text[15]; |
887 | EDI = in_date; |
887 | EDI = in_date; |
888 | EAX = 47; |
888 | EAX = 47; |
889 | EBX = 2<<16; |
889 | EBX = 2<<16; |
890 | EDX = x<<16+y; |
890 | EDX = x<<16+y; |
891 | ESI = 0x80<<24+color; |
891 | ESI = 0x80<<24+color; |
892 | ECX = EDI.date.day; |
892 | ECX = EDI.date.day; |
893 | $int 0x40; |
893 | $int 0x40; |
894 | EDX += 18<<16; |
894 | EDX += 18<<16; |
895 | ECX = EDI.date.month; |
895 | ECX = EDI.date.month; |
896 | $int 0x40; |
896 | $int 0x40; |
897 | EDX += 18<<16; |
897 | EDX += 18<<16; |
898 | EBX = 4<<16; |
898 | EBX = 4<<16; |
899 | ECX = EDI.date.year; |
899 | ECX = EDI.date.year; |
900 | $int 0x40; |
900 | $int 0x40; |
901 | PutPixel(x+14,y+6,color); |
901 | PutPixel(x+14,y+6,color); |
902 | PutPixel(x+32,y+6,color); |
902 | PutPixel(x+32,y+6,color); |
903 | //sprintf(#text,"%d",EDI.date.year); |
903 | //sprintf(#text,"%d",EDI.date.year); |
904 | //WriteText(x, y, 0x80, 0x000000, #text); |
904 | //WriteText(x, y, 0x80, 0x000000, #text); |
905 | } |
905 | } |
906 | 906 | ||
907 | :void __path_name__(dword BUF,PATH) |
907 | :void __path_name__(dword BUF,PATH) |
908 | { |
908 | { |
909 | dword beg = PATH; |
909 | dword beg = PATH; |
910 | dword pos = PATH; |
910 | dword pos = PATH; |
911 | dword sav = PATH; |
911 | dword sav = PATH; |
912 | dword i; |
912 | dword i; |
913 | while(DSBYTE[pos]) |
913 | while(DSBYTE[pos]) |
914 | { |
914 | { |
915 | if(DSBYTE[pos]=='/')sav = pos; |
915 | if(DSBYTE[pos]=='/')sav = pos; |
916 | pos++; |
916 | pos++; |
917 | } |
917 | } |
918 | i = sav-beg; |
918 | i = sav-beg; |
919 | while(i) |
919 | while(i) |
920 | { |
920 | { |
921 | DSBYTE[BUF] = DSBYTE[beg]; |
921 | DSBYTE[BUF] = DSBYTE[beg]; |
922 | beg++; |
922 | beg++; |
923 | BUF++; |
923 | BUF++; |
924 | i--; |
924 | i--; |
925 | } |
925 | } |
926 | /*while(DSBYTE[beg]) |
926 | /*while(DSBYTE[beg]) |
927 | { |
927 | { |
928 | DSBYTE[BUF1] = DSBYTE[beg]; |
928 | DSBYTE[BUF1] = DSBYTE[beg]; |
929 | beg++; |
929 | beg++; |
930 | BUF1++; |
930 | BUF1++; |
931 | }*/ |
931 | }*/ |
932 | //DSBYTE[BUF1] = 0; |
932 | //DSBYTE[BUF1] = 0; |
933 | DSBYTE[BUF] = 0; |
933 | DSBYTE[BUF] = 0; |
934 | } |
934 | } |
- | 935 | char __BUF_DIR__[4096]; |
|
- | 936 | :struct SELF |
|
- | 937 | { |
|
- | 938 | dword dir; |
|
- | 939 | dword file; |
|
- | 940 | dword path; |
|
- | 941 | } self; |
|
935 | 942 | ||
936 | dword __generator; // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë |
943 | dword __generator; // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë |
937 | 944 | ||
938 | :dword program_path_length; |
945 | :dword program_path_length; |
939 | - | ||
940 | char __BUF_DIR__[4096]; |
- | |
941 | - | ||
942 | dword __DIR__; |
- | |
943 | 946 | ||
944 | //The initialization of the initial data before running |
947 | //The initialization of the initial data before running |
945 | void load_init_main() |
948 | void ______INIT______() |
946 | { |
949 | { |
947 | __DIR__ = #__BUF_DIR__; |
950 | self.dir = #__BUF_DIR__; |
- | 951 | self.file = 0; |
|
948 | 952 | self.path = I_Path; |
|
949 | __path_name__(__DIR__,I_Path); |
953 | __path_name__(#__BUF_DIR__,I_Path); |
950 | 954 | ||
951 | SKIN.height = GetSkinHeight(); |
955 | SKIN.height = GetSkinHeight(); |
952 | screen.width = GetScreenWidth(); |
956 | screen.width = GetScreenWidth(); |
953 | screen.height = GetScreenHeight(); |
957 | screen.height = GetScreenHeight(); |
954 | 958 | ||
955 | //program_path_length = strlen(I_Path); |
959 | //program_path_length = strlen(I_Path); |
956 | MOUSE_TIME = 50; //Default 500 ms. |
960 | MOUSE_TIME = 50; //Default 500 ms. |
957 | __generator = GetStartTime(); |
961 | __generator = GetStartTime(); |
958 | //mem_Init(); |
962 | //mem_Init(); |
959 | main(); |
963 | main(); |
960 | } |
964 | } |
961 | - | ||
- | 965 | ______STOP______: |
|
962 | #endif16; |
966 | #endif16; |
963 | ><16; |
967 | ><16; |
964 | >16; |
968 | >16; |
965 | ><16; |
969 | ><16; |
966 | >16; |
970 | >16; |
967 | ><16; |
971 | ><16; |
968 | >24+color; |
972 | >24+color; |
969 | ><24+color; |
973 | ><24+color; |
970 | >16+y; |
974 | >16+y; |
971 | ><16+y; |
975 | ><16+y; |
972 | >16; |
976 | >16; |
973 | ><16; |
977 | ><16; |
974 | >16+h; |
978 | >16+h; |
975 | ><16+h; |
979 | ><16+h; |
976 | >16+w; |
980 | >16+w; |
977 | ><16+w; |
981 | ><16+w; |
978 | >16+h; |
982 | >16+h; |
979 | ><16+h; |
983 | ><16+h; |
980 | >16+w; |
984 | >16+w; |
981 | ><16+w; |
985 | ><16+w; |
982 | >16+h; |
986 | >16+h; |
983 | ><16+h; |
987 | ><16+h; |
984 | >16+w; |
988 | >16+w; |
985 | ><16+w; |
989 | ><16+w; |
986 | >=0)>=0)>16+y; |
990 | >=0)>=0)>16+y; |
987 | ><16+y; |
991 | ><16+y; |
988 | >16+h; |
992 | >16+h; |
989 | ><16+h; |
993 | ><16+h; |
990 | >16+y; |
994 | >16+y; |
991 | ><16+y; |
995 | ><16+y; |
992 | >16+h; |
996 | >16+h; |
993 | ><16+h; |
997 | ><16+h; |
994 | >><>><>24+color; |
998 | >><>><>24+color; |
995 | ><24+color; |
999 | ><24+color; |
996 | >16+y; |
1000 | >16+y; |
997 | ><16+y; |
1001 | ><16+y; |
998 | >16; |
1002 | >16; |
999 | ><16; |
1003 | ><16; |
1000 | >24+color; |
1004 | >24+color; |
1001 | ><24+color; |
1005 | ><24+color; |
1002 | >16+y; |
1006 | >16+y; |
1003 | ><16+y; |
1007 | ><16+y; |
1004 | >24+color; |
1008 | >24+color; |
1005 | ><24+color; |
1009 | ><24+color; |
1006 | >16+y; |
1010 | >16+y; |
1007 | ><16+y; |
1011 | ><16+y; |
1008 | >16 |
1012 | >16 |
1009 | ><16 |
1013 | ><16 |
1010 | >24+color; |
1014 | >24+color; |
1011 | ><24+color; |
1015 | ><24+color; |
1012 | >16+y; |
1016 | >16+y; |
1013 | ><16+y; |
1017 | ><16+y; |
1014 | >><>><>><>16; |
1018 | >><>><>><>16; |
1015 | ><16; |
1019 | ><16; |
1016 | >16; |
1020 | >16; |
1017 | ><16; |
1021 | ><16; |
1018 | >=MOUSE_TIME){>16)+y; |
1022 | >=MOUSE_TIME){>16)+y; |
1019 | ><16)+y; |
1023 | ><16)+y; |
1020 | > |
1024 | > |
1021 | > |
1025 | > |
1022 | >1)|(2< |
1026 | >1)|(2< |
1023 | ><1)|(2< |
1027 | ><1)|(2< |
1024 | >16)+y; |
1028 | >16)+y; |
1025 | ><16)+y; |
1029 | ><16)+y; |
1026 | > |
1030 | > |