Rev 7913 | Rev 7970 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7913 | Rev 7914 | ||
---|---|---|---|
1 | //CODED by Veliant, Leency, Nable, Pavelyakov. GNU GPL licence. |
1 | //CODED by Veliant, Leency, Nable, Pavelyakov. GNU GPL licence. |
2 | 2 | ||
3 | #ifndef INCLUDE_KOLIBRI_H |
3 | #ifndef INCLUDE_KOLIBRI_H |
4 | #define INCLUDE_KOLIBRI_H |
4 | #define INCLUDE_KOLIBRI_H |
5 | 5 | ||
6 | #pragma option OST |
6 | #pragma option OST |
7 | #pragma option ON |
7 | #pragma option ON |
8 | #pragma option cri- |
8 | #pragma option cri- |
9 | #pragma option -CPA |
9 | #pragma option -CPA |
10 | #initallvar 0 |
10 | #initallvar 0 |
11 | #jumptomain FALSE |
11 | #jumptomain FALSE |
12 | 12 | ||
13 | #startaddress 0 |
13 | #startaddress 0 |
14 | 14 | ||
15 | #code32 TRUE |
15 | #code32 TRUE |
16 | 16 | ||
17 | char os_name[8] = {'M','E','N','U','E','T','0','1'}; |
17 | char os_name[8] = {'M','E','N','U','E','T','0','1'}; |
18 | dword os_version = 0x00000001; |
18 | dword os_version = 0x00000001; |
19 | dword start_addr = #______INIT______; |
19 | dword start_addr = #______INIT______; |
20 | dword final_addr = #______STOP______+32; |
20 | dword final_addr = #______STOP______+32; |
21 | dword alloc_mem = MEMSIZE; |
21 | dword alloc_mem = MEMSIZE; |
22 | dword x86esp_reg = MEMSIZE; |
22 | dword x86esp_reg = MEMSIZE; |
23 | dword I_Param = #param; |
23 | dword I_Param = #param; |
24 | dword I_Path = #program_path; |
24 | dword I_Path = #program_path; |
25 | char param[4096]; |
25 | char param[4096]; |
26 | char program_path[4096]; |
26 | char program_path[4096]; |
27 | 27 | ||
28 | #define bool int |
28 | #define bool int |
29 | 29 | ||
30 | #define NULL 0 |
30 | #define NULL 0 |
31 | #define EOS 0 |
31 | #define EOS 0 |
32 | #define OLD -1 |
32 | #define OLD -1 |
33 | #define true 1 |
33 | #define true 1 |
34 | #define false 0 |
34 | #define false 0 |
35 | 35 | ||
36 | //Process Events |
36 | //Process Events |
37 | #define evReDraw 1 |
37 | #define evReDraw 1 |
38 | #define evKey 2 |
38 | #define evKey 2 |
39 | #define evButton 3 |
39 | #define evButton 3 |
40 | #define evExit 4 |
40 | #define evExit 4 |
41 | #define evDesktop 5 |
41 | #define evDesktop 5 |
42 | #define evMouse 6 |
42 | #define evMouse 6 |
43 | #define evIPC 7 |
43 | #define evIPC 7 |
44 | #define evNetwork 8 |
44 | #define evNetwork 8 |
45 | #define evDebug 9 |
45 | #define evDebug 9 |
46 | 46 | ||
47 | //Event mask bits for function 40 |
47 | //Event mask bits for function 40 |
48 | #define EVM_REDRAW 1b |
48 | #define EVM_REDRAW 1b |
49 | #define EVM_KEY 10b |
49 | #define EVM_KEY 10b |
50 | #define EVM_BUTTON 100b |
50 | #define EVM_BUTTON 100b |
51 | #define EVM_EXIT 1000b |
51 | #define EVM_EXIT 1000b |
52 | #define EVM_DESKTOPBG 10000b |
52 | #define EVM_DESKTOPBG 10000b |
53 | #define EVM_MOUSE 100000b |
53 | #define EVM_MOUSE 100000b |
54 | #define EVM_IPC 1000000b |
54 | #define EVM_IPC 1000000b |
55 | #define EVM_STACK 10000000b |
55 | #define EVM_STACK 10000000b |
56 | #define EVM_DEBUG 100000000b |
56 | #define EVM_DEBUG 100000000b |
57 | #define EVM_STACK2 1000000000b |
57 | #define EVM_STACK2 1000000000b |
58 | #define EVM_MOUSE_FILTER 0x80000000 |
58 | #define EVM_MOUSE_FILTER 0x80000000 |
59 | #define EVM_CURSOR_FILTER 0x40000000 |
59 | #define EVM_CURSOR_FILTER 0x40000000 |
60 | 60 | ||
61 | //Button options |
61 | //Button options |
62 | #define BT_DEL 0x80000000 |
62 | #define BT_DEL 0x80000000 |
63 | #define BT_HIDE 0x40000000 |
63 | #define BT_HIDE 0x40000000 |
64 | #define BT_NOFRAME 0x20000000 |
64 | #define BT_NOFRAME 0x20000000 |
65 | 65 | ||
66 | #define CLOSE_BTN 1 |
66 | #define CLOSE_BTN 1 |
67 | 67 | ||
68 | //------------------------------------------------------------------------- |
68 | //------------------------------------------------------------------------- |
69 | 69 | ||
70 | #include "../lib/system.h" |
70 | #include "../lib/system.h" |
71 | #include "../lib/mouse.h" |
71 | #include "../lib/mouse.h" |
72 | #include "../lib/keyboard.h" |
72 | #include "../lib/keyboard.h" |
73 | 73 | ||
74 | inline fastcall dword calc(EAX) { return EAX; } |
74 | inline fastcall dword calc(EAX) { return EAX; } |
75 | - | ||
76 | inline fastcall swap(EAX, EBX) |
- | |
77 | { |
- | |
78 | $push ESDWORD[EAX] |
- | |
79 | ESDWORD[EAX] = ESDWORD[EBX]; |
- | |
80 | $pop ESDWORD[EBX]; |
- | |
81 | } |
75 | |
82 | 76 | ||
83 | :struct raw_image { |
77 | :struct raw_image { |
84 | dword w, h, data; |
78 | dword w, h, data; |
85 | }; |
79 | }; |
86 | 80 | ||
87 | //------------------------------------------------------------------------------ |
81 | //------------------------------------------------------------------------------ |
88 | inline fastcall dword WaitEvent() |
82 | inline fastcall dword WaitEvent() |
89 | { |
83 | { |
90 | $mov eax,10 |
84 | $mov eax,10 |
91 | $int 0x40 |
85 | $int 0x40 |
92 | } |
86 | } |
93 | 87 | ||
94 | inline fastcall dword CheckEvent() |
88 | inline fastcall dword CheckEvent() |
95 | { |
89 | { |
96 | $mov eax,11 |
90 | $mov eax,11 |
97 | $int 0x40 |
91 | $int 0x40 |
98 | } |
92 | } |
99 | 93 | ||
100 | inline fastcall dword WaitEventTimeout(EBX) |
94 | inline fastcall dword WaitEventTimeout(EBX) |
101 | { |
95 | { |
102 | EAX = 23; |
96 | EAX = 23; |
103 | $int 0x40 |
97 | $int 0x40 |
104 | } |
98 | } |
105 | 99 | ||
106 | inline fastcall dword SetEventMask(EBX) |
100 | inline fastcall dword SetEventMask(EBX) |
107 | { |
101 | { |
108 | $mov eax,40 |
102 | $mov eax,40 |
109 | $int 0x40 |
103 | $int 0x40 |
110 | } |
104 | } |
111 | 105 | ||
112 | 106 | ||
113 | inline fastcall pause(EBX) |
107 | inline fastcall pause(EBX) |
114 | { |
108 | { |
115 | $mov eax, 5 |
109 | $mov eax, 5 |
116 | $int 0x40 |
110 | $int 0x40 |
117 | } |
111 | } |
118 | 112 | ||
119 | inline fastcall word GetButtonID() |
113 | inline fastcall word GetButtonID() |
120 | { |
114 | { |
121 | $mov eax,17 |
115 | $mov eax,17 |
122 | $int 0x40 |
116 | $int 0x40 |
123 | $shr eax,8 |
117 | $shr eax,8 |
124 | } |
118 | } |
125 | 119 | ||
126 | inline fastcall dword GetFreeRAM() |
120 | inline fastcall dword GetFreeRAM() |
127 | { |
121 | { |
128 | $mov eax, 18 |
122 | $mov eax, 18 |
129 | $mov ebx, 16 |
123 | $mov ebx, 16 |
130 | $int 0x40 |
124 | $int 0x40 |
131 | //return eax = free RAM size in Kb |
125 | //return eax = free RAM size in Kb |
132 | } |
126 | } |
133 | 127 | ||
134 | inline fastcall dword GetTotalRAM() |
128 | inline fastcall dword GetTotalRAM() |
135 | { |
129 | { |
136 | $mov eax, 18 |
130 | $mov eax, 18 |
137 | $mov ebx, 17 |
131 | $mov ebx, 17 |
138 | $int 0x40 |
132 | $int 0x40 |
139 | //return eax = total RAM size in Kb |
133 | //return eax = total RAM size in Kb |
140 | } |
134 | } |
141 | 135 | ||
142 | inline fastcall int GetCpuIdleCount() |
136 | inline fastcall int GetCpuIdleCount() |
143 | { |
137 | { |
144 | EAX = 18; |
138 | EAX = 18; |
145 | EBX = 4; |
139 | EBX = 4; |
146 | $int 0x40 |
140 | $int 0x40 |
147 | } |
141 | } |
148 | 142 | ||
149 | inline fastcall int GetCpuFrequency() |
143 | inline fastcall int GetCpuFrequency() |
150 | { |
144 | { |
151 | EAX = 18; |
145 | EAX = 18; |
152 | EBX = 5; |
146 | EBX = 5; |
153 | $int 0x40 |
147 | $int 0x40 |
154 | } |
148 | } |
155 | 149 | ||
156 | inline fastcall dword LoadDriver(ECX) //ECX - èìÿ äðàéâåðà |
150 | inline fastcall dword LoadDriver(ECX) //ECX - èìÿ äðàéâåðà |
157 | { |
151 | { |
158 | $mov eax, 68 |
152 | $mov eax, 68 |
159 | $mov ebx, 16 |
153 | $mov ebx, 16 |
160 | $int 0x40 |
154 | $int 0x40 |
161 | //return 0 - íåóäà÷à, èíà÷å eax = õýíäë äðàéâåðà |
155 | //return 0 - íåóäà÷à, èíà÷å eax = õýíäë äðàéâåðà |
162 | } |
156 | } |
163 | 157 | ||
164 | inline fastcall dword RuleDriver(ECX) //óêàçàòåëü íà óïðàâëÿþùóþ ñòðóêòóðó |
158 | inline fastcall dword RuleDriver(ECX) //óêàçàòåëü íà óïðàâëÿþùóþ ñòðóêòóðó |
165 | { |
159 | { |
166 | $mov eax, 68 |
160 | $mov eax, 68 |
167 | $mov ebx, 17 |
161 | $mov ebx, 17 |
168 | $int 0x40 |
162 | $int 0x40 |
169 | //return eax = îïðåäåëÿåòñÿ äðàéâåðîì |
163 | //return eax = îïðåäåëÿåòñÿ äðàéâåðîì |
170 | } |
164 | } |
171 | 165 | ||
172 | struct proc_info |
166 | struct proc_info |
173 | { |
167 | { |
174 | #define SelfInfo -1 |
168 | #define SelfInfo -1 |
175 | dword use_cpu; |
169 | dword use_cpu; |
176 | word pos_in_stack,slot,rezerv1; |
170 | word pos_in_stack,slot,rezerv1; |
177 | unsigned char name[11]; |
171 | unsigned char name[11]; |
178 | char rezerv2; |
172 | char rezerv2; |
179 | dword adress,use_memory,ID,left,top,width,height; |
173 | dword adress,use_memory,ID,left,top,width,height; |
180 | word status_slot,rezerv3; |
174 | word status_slot,rezerv3; |
181 | dword work_left,work_top,work_width,work_height; |
175 | dword work_left,work_top,work_width,work_height; |
182 | char status_window; |
176 | char status_window; |
183 | dword cwidth,cheight; |
177 | dword cwidth,cheight; |
184 | byte reserved[1024-71-8]; |
178 | byte reserved[1024-71-8]; |
185 | }; |
179 | }; |
186 | 180 | ||
187 | :void GetProcessInfo(dword _process_struct_pointer, _process_id) |
181 | :void GetProcessInfo(dword _process_struct_pointer, _process_id) |
188 | { |
182 | { |
189 | EAX = 9; |
183 | EAX = 9; |
190 | EBX = _process_struct_pointer; |
184 | EBX = _process_struct_pointer; |
191 | ECX = _process_id; |
185 | ECX = _process_id; |
192 | $int 0x40 |
186 | $int 0x40 |
193 | DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth |
187 | DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth |
194 | DSDWORD[EBX+75] = DSDWORD[EBX+46] - skin_height - 4; //set cheight |
188 | DSDWORD[EBX+75] = DSDWORD[EBX+46] - skin_height - 4; //set cheight |
195 | } |
189 | } |
196 | 190 | ||
197 | inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y |
191 | inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y |
198 | { |
192 | { |
199 | $mov eax,34 |
193 | $mov eax,34 |
200 | $int 0x40 |
194 | $int 0x40 |
201 | } |
195 | } |
202 | 196 | ||
203 | inline fastcall int GetProcessSlot( ECX) |
197 | inline fastcall int GetProcessSlot( ECX) |
204 | { |
198 | { |
205 | EAX = 18; |
199 | EAX = 18; |
206 | EBX = 21; |
200 | EBX = 21; |
207 | $int 0x40 |
201 | $int 0x40 |
208 | } |
202 | } |
209 | 203 | ||
210 | inline fastcall int GetActiveProcess() |
204 | inline fastcall int GetActiveProcess() |
211 | { |
205 | { |
212 | EAX = 18; |
206 | EAX = 18; |
213 | EBX = 7; |
207 | EBX = 7; |
214 | $int 0x40 |
208 | $int 0x40 |
215 | } |
209 | } |
216 | 210 | ||
217 | :int CheckActiveProcess(int Form_ID) |
211 | :int CheckActiveProcess(int Form_ID) |
218 | { |
212 | { |
219 | int id9=GetProcessSlot(Form_ID); |
213 | int id9=GetProcessSlot(Form_ID); |
220 | if (id9==GetActiveProcess()) return 1; |
214 | if (id9==GetActiveProcess()) return 1; |
221 | return 0; |
215 | return 0; |
222 | } |
216 | } |
223 | 217 | ||
224 | inline fastcall void ActivateWindow( ECX) //ECX - slot |
218 | inline fastcall void ActivateWindow( ECX) //ECX - slot |
225 | { |
219 | { |
226 | EAX = 18; |
220 | EAX = 18; |
227 | EBX = 3; |
221 | EBX = 3; |
228 | $int 0x40 |
222 | $int 0x40 |
229 | } |
223 | } |
230 | 224 | ||
231 | :void RefreshWindow(dword ID_REFRESH,ID_ACTIVE) |
225 | :void RefreshWindow(dword ID_REFRESH,ID_ACTIVE) |
232 | { |
226 | { |
233 | ActivateWindow(ID_REFRESH); |
227 | ActivateWindow(ID_REFRESH); |
234 | ActivateWindow(ID_ACTIVE); |
228 | ActivateWindow(ID_ACTIVE); |
235 | } |
229 | } |
236 | 230 | ||
237 | inline fastcall int MinimizeWindow() |
231 | inline fastcall int MinimizeWindow() |
238 | { |
232 | { |
239 | EAX = 18; |
233 | EAX = 18; |
240 | EBX = 10; |
234 | EBX = 10; |
241 | $int 0x40 |
235 | $int 0x40 |
242 | } |
236 | } |
243 | 237 | ||
244 | inline fastcall int CreateThread(ECX,EDX) |
238 | inline fastcall int CreateThread(ECX,EDX) |
245 | { |
239 | { |
246 | $mov eax,51 |
240 | $mov eax,51 |
247 | $mov ebx,1 |
241 | $mov ebx,1 |
248 | $int 0x40 |
242 | $int 0x40 |
249 | } |
243 | } |
250 | 244 | ||
251 | inline fastcall void SwitchToAnotherThread() |
245 | inline fastcall void SwitchToAnotherThread() |
252 | { |
246 | { |
253 | $mov eax,68 |
247 | $mov eax,68 |
254 | $mov ebx,1 |
248 | $mov ebx,1 |
255 | $int 0x40 |
249 | $int 0x40 |
256 | } |
250 | } |
257 | 251 | ||
258 | inline fastcall int SendWindowMessage( ECX, EDX) |
252 | inline fastcall int SendWindowMessage( ECX, EDX) |
259 | { |
253 | { |
260 | $mov eax, 72 |
254 | $mov eax, 72 |
261 | $mov ebx, 1 |
255 | $mov ebx, 1 |
262 | $int 0x40 |
256 | $int 0x40 |
263 | } |
257 | } |
264 | 258 | ||
265 | inline fastcall int KillProcess( ECX) |
259 | inline fastcall int KillProcess( ECX) |
266 | { |
260 | { |
267 | $mov eax,18; |
261 | $mov eax,18; |
268 | $mov ebx,18; |
262 | $mov ebx,18; |
269 | $int 0x40 |
263 | $int 0x40 |
270 | } |
264 | } |
271 | 265 | ||
272 | #define TURN_OFF 2 |
266 | #define TURN_OFF 2 |
273 | #define REBOOT 3 |
267 | #define REBOOT 3 |
274 | #define KERNEL 4 |
268 | #define KERNEL 4 |
275 | inline fastcall int ExitSystem( ECX) |
269 | inline fastcall int ExitSystem( ECX) |
276 | { |
270 | { |
277 | $mov eax, 18 |
271 | $mov eax, 18 |
278 | $mov ebx, 9 |
272 | $mov ebx, 9 |
279 | $int 0x40 |
273 | $int 0x40 |
280 | } |
274 | } |
281 | 275 | ||
282 | inline fastcall ExitProcess() |
276 | inline fastcall ExitProcess() |
283 | { |
277 | { |
284 | $mov eax,-1; |
278 | $mov eax,-1; |
285 | $int 0x40 |
279 | $int 0x40 |
286 | } |
280 | } |
287 | 281 | ||
288 | //------------------------------------------------------------------------------ |
282 | //------------------------------------------------------------------------------ |
289 | 283 | ||
290 | //eax = ÿçûê ñèñòåìû (1=eng, 2=fi, 3=ger, 4=rus) |
284 | //eax = ÿçûê ñèñòåìû (1=eng, 2=fi, 3=ger, 4=rus) |
291 | ///SYSFUNC DOESN'T WORK!!! => https://bit.ly/2XNdiTD |
285 | ///SYSFUNC DOESN'T WORK!!! => https://bit.ly/2XNdiTD |
292 | #define SYS_LANG_ENG 1 |
286 | #define SYS_LANG_ENG 1 |
293 | #define SYS_LANG_FIN 2 |
287 | #define SYS_LANG_FIN 2 |
294 | #define SYS_LANG_GER 3 |
288 | #define SYS_LANG_GER 3 |
295 | #define SYS_LANG_RUS 4 |
289 | #define SYS_LANG_RUS 4 |
296 | inline fastcall int GetSystemLanguage() |
290 | inline fastcall int GetSystemLanguage() |
297 | { |
291 | { |
298 | EAX = 26; |
292 | EAX = 26; |
299 | EBX = 5; |
293 | EBX = 5; |
300 | $int 0x40 |
294 | $int 0x40 |
301 | } |
295 | } |
302 | 296 | ||
303 | #define BUTTON_STYLE_FLAT 0 |
297 | #define BUTTON_STYLE_FLAT 0 |
304 | #define BUTTON_STYLE_GRADIENT 1 |
298 | #define BUTTON_STYLE_GRADIENT 1 |
305 | inline fastcall SetButtonStyle(ECX) //ECX - button style |
299 | inline fastcall SetButtonStyle(ECX) //ECX - button style |
306 | { |
300 | { |
307 | $mov eax,48 |
301 | $mov eax,48 |
308 | $mov ebx,1 |
302 | $mov ebx,1 |
309 | int 64 |
303 | int 64 |
310 | } |
304 | } |
311 | 305 | ||
312 | inline fastcall GetSkinHeight() |
306 | inline fastcall GetSkinHeight() |
313 | { |
307 | { |
314 | $push ebx |
308 | $push ebx |
315 | $mov eax,48 |
309 | $mov eax,48 |
316 | $mov ebx,4 |
310 | $mov ebx,4 |
317 | $int 0x40 |
311 | $int 0x40 |
318 | $pop ebx |
312 | $pop ebx |
319 | } |
313 | } |
320 | 314 | ||
321 | inline fastcall void SetSystemSkin( ECX) |
315 | inline fastcall void SetSystemSkin( ECX) |
322 | { |
316 | { |
323 | EAX = 48; |
317 | EAX = 48; |
324 | EBX = 8; |
318 | EBX = 8; |
325 | $int 0x40 |
319 | $int 0x40 |
326 | } |
320 | } |
327 | 321 | ||
328 | inline fastcall int GetScreenWidth() |
322 | inline fastcall int GetScreenWidth() |
329 | { |
323 | { |
330 | $mov eax, 14 |
324 | $mov eax, 14 |
331 | $int 0x40 |
325 | $int 0x40 |
332 | $shr eax, 16 |
326 | $shr eax, 16 |
333 | } |
327 | } |
334 | 328 | ||
335 | inline fastcall int GetScreenHeight() |
329 | inline fastcall int GetScreenHeight() |
336 | { |
330 | { |
337 | $mov eax, 14 |
331 | $mov eax, 14 |
338 | $int 0x40 |
332 | $int 0x40 |
339 | $and eax,0x0000FFFF |
333 | $and eax,0x0000FFFF |
340 | } |
334 | } |
341 | 335 | ||
342 | inline fastcall int GetClientTop() |
336 | inline fastcall int GetClientTop() |
343 | { |
337 | { |
344 | $mov eax, 48 |
338 | $mov eax, 48 |
345 | $mov ebx, 5 |
339 | $mov ebx, 5 |
346 | $int 0x40 |
340 | $int 0x40 |
347 | $mov eax, ebx |
341 | $mov eax, ebx |
348 | $shr eax, 16 |
342 | $shr eax, 16 |
349 | } |
343 | } |
350 | 344 | ||
351 | inline fastcall int GetClientHeight() |
345 | inline fastcall int GetClientHeight() |
352 | { |
346 | { |
353 | $mov eax, 48 |
347 | $mov eax, 48 |
354 | $mov ebx, 5 |
348 | $mov ebx, 5 |
355 | $int 0x40 |
349 | $int 0x40 |
356 | $mov eax, ebx |
350 | $mov eax, ebx |
357 | } |
351 | } |
358 | 352 | ||
359 | inline fastcall dword LoadLibrary( ECX) |
353 | inline fastcall dword LoadLibrary( ECX) |
360 | { |
354 | { |
361 | $mov eax, 68 |
355 | $mov eax, 68 |
362 | $mov ebx, 19 |
356 | $mov ebx, 19 |
363 | $int 0x40 |
357 | $int 0x40 |
364 | } |
358 | } |
365 | 359 | ||
366 | inline fastcall int TestBit( EAX, CL) |
360 | inline fastcall int TestBit( EAX, CL) |
367 | { |
361 | { |
368 | $shr eax,cl |
362 | $shr eax,cl |
369 | $and eax,1 |
363 | $and eax,1 |
370 | } |
364 | } |
371 | 365 | ||
372 | :void SetClientScreenArea(dword _left, _right, _top, _bottom) |
366 | :void SetClientScreenArea(dword _left, _right, _top, _bottom) |
373 | { |
367 | { |
374 | EAX = 48; |
368 | EAX = 48; |
375 | EBX = 6; |
369 | EBX = 6; |
376 | ECX = _left * 65536 + _right; |
370 | ECX = _left * 65536 + _right; |
377 | EDX = _top * 65536 + _bottom; |
371 | EDX = _top * 65536 + _bottom; |
378 | $int 64; |
372 | $int 64; |
379 | } |
373 | } |
380 | 374 | ||
381 | //------------------------------------------------------------------------------ |
375 | //------------------------------------------------------------------------------ |
382 | 376 | ||
383 | :void DefineAndDrawWindow(dword _x, _y, _w, _h, _window_type, _bgcolor, _title, _flags) |
377 | :void DefineAndDrawWindow(dword _x, _y, _w, _h, _window_type, _bgcolor, _title, _flags) |
384 | { |
378 | { |
385 | EAX = 12; // function 12:tell os about windowdraw |
379 | EAX = 12; // function 12:tell os about windowdraw |
386 | EBX = 1; |
380 | EBX = 1; |
387 | $int 0x40 |
381 | $int 0x40 |
388 | 382 | ||
389 | $xor EAX,EAX |
383 | $xor EAX,EAX |
390 | EBX = _x << 16 + _w; |
384 | EBX = _x << 16 + _w; |
391 | ECX = _y << 16 + _h; |
385 | ECX = _y << 16 + _h; |
392 | EDX = _window_type << 24 | _bgcolor; |
386 | EDX = _window_type << 24 | _bgcolor; |
393 | EDI = _title; |
387 | EDI = _title; |
394 | ESI = _flags; |
388 | ESI = _flags; |
395 | $int 0x40 |
389 | $int 0x40 |
396 | 390 | ||
397 | 391 | ||
398 | EAX = 12; // function 12:tell os about windowdraw |
392 | EAX = 12; // function 12:tell os about windowdraw |
399 | EBX = 2; |
393 | EBX = 2; |
400 | $int 0x40 |
394 | $int 0x40 |
401 | } |
395 | } |
402 | 396 | ||
403 | inline fastcall MoveSize( EBX,ECX,EDX,ESI) |
397 | inline fastcall MoveSize( EBX,ECX,EDX,ESI) |
404 | { |
398 | { |
405 | $mov eax, 67 |
399 | $mov eax, 67 |
406 | $int 0x40 |
400 | $int 0x40 |
407 | } |
401 | } |
408 | 402 | ||
409 | inline fastcall void DrawTitle( ECX) |
403 | inline fastcall void DrawTitle( ECX) |
410 | { |
404 | { |
411 | EAX = 71; |
405 | EAX = 71; |
412 | EBX = 1; |
406 | EBX = 1; |
413 | $int 0x40; |
407 | $int 0x40; |
414 | } |
408 | } |
415 | 409 | ||
416 | // @EDX is a process id, -1 for self |
410 | // @EDX is a process id, -1 for self |
417 | // @ESI is a new LayerBehaviour |
411 | // @ESI is a new LayerBehaviour |
418 | // @RETURN: EAX, 0 is fail, 1 is success |
412 | // @RETURN: EAX, 0 is fail, 1 is success |
419 | #define ZPOS_DESKTOP -2 |
413 | #define ZPOS_DESKTOP -2 |
420 | #define ZPOS_ALWAYS_BACK -1 |
414 | #define ZPOS_ALWAYS_BACK -1 |
421 | #define ZPOS_NORMAL 0 |
415 | #define ZPOS_NORMAL 0 |
422 | #define ZPOS_ALWAYS_TOP 1 |
416 | #define ZPOS_ALWAYS_TOP 1 |
423 | inline fastcall dword SetWindowLayerBehaviour(EDX, ESI) |
417 | inline fastcall dword SetWindowLayerBehaviour(EDX, ESI) |
424 | { |
418 | { |
425 | EAX = 18; |
419 | EAX = 18; |
426 | EBX = 25; |
420 | EBX = 25; |
427 | ECX = 2; |
421 | ECX = 2; |
428 | $int 64 |
422 | $int 64 |
429 | } |
423 | } |
430 | 424 | ||
431 | :void WriteTextB(dword x,y,byte fontType, dword color, str_offset) |
425 | :void WriteTextB(dword x,y,byte fontType, dword color, str_offset) |
432 | { |
426 | { |
433 | EAX = 4; |
427 | EAX = 4; |
434 | EBX = x<<16+y; |
428 | EBX = x<<16+y; |
435 | ECX = fontType<<24+color; |
429 | ECX = fontType<<24+color; |
436 | EDX = str_offset; |
430 | EDX = str_offset; |
437 | ESI = 0; |
431 | ESI = 0; |
438 | $int 0x40; |
432 | $int 0x40; |
439 | $add ebx, 1<<16 |
433 | $add ebx, 1<<16 |
440 | $int 0x40 |
434 | $int 0x40 |
441 | } |
435 | } |
442 | 436 | ||
443 | :void WriteText(dword x,y,byte fontType, dword color, str_offset) |
437 | :void WriteText(dword x,y,byte fontType, dword color, str_offset) |
444 | { |
438 | { |
445 | EAX = 4; |
439 | EAX = 4; |
446 | EBX = x<<16+y; |
440 | EBX = x<<16+y; |
447 | ECX = fontType<<24+color; |
441 | ECX = fontType<<24+color; |
448 | EDX = str_offset; |
442 | EDX = str_offset; |
449 | $int 0x40; |
443 | $int 0x40; |
450 | } |
444 | } |
451 | 445 | ||
452 | :dword WriteBufText(dword x,y,byte fontType, dword color, str_offset, buf_offset) |
446 | :dword WriteBufText(dword x,y,byte fontType, dword color, str_offset, buf_offset) |
453 | { |
447 | { |
454 | EDI = buf_offset; |
448 | EDI = buf_offset; |
455 | WriteText(x,y, fontType, color, str_offset); |
449 | WriteText(x,y, fontType, color, str_offset); |
456 | } |
450 | } |
457 | 451 | ||
458 | :void WriteTextWithBg(dword x,y,byte fontType, dword color, str_offset, bgcolor) |
452 | :void WriteTextWithBg(dword x,y,byte fontType, dword color, str_offset, bgcolor) |
459 | { |
453 | { |
460 | EDI = bgcolor; |
454 | EDI = bgcolor; |
461 | WriteText(x,y, fontType, color, str_offset); |
455 | WriteText(x,y, fontType, color, str_offset); |
462 | } |
456 | } |
463 | 457 | ||
464 | :void WriteNumber(dword x,y,byte fontType, dword color, count, number_or_offset) |
458 | :void WriteNumber(dword x,y,byte fontType, dword color, count, number_or_offset) |
465 | { |
459 | { |
466 | EAX = 47; |
460 | EAX = 47; |
467 | EBX = count<<16; |
461 | EBX = count<<16; |
468 | ECX = number_or_offset; |
462 | ECX = number_or_offset; |
469 | EDX = x<<16+y; |
463 | EDX = x<<16+y; |
470 | ESI = fontType<<24+color; |
464 | ESI = fontType<<24+color; |
471 | $int 0x40; |
465 | $int 0x40; |
472 | } |
466 | } |
473 | 467 | ||
474 | :void CopyScreen(dword dst_offset, x, y, w, h) |
468 | :void CopyScreen(dword dst_offset, x, y, w, h) |
475 | { |
469 | { |
476 | EAX = 36; |
470 | EAX = 36; |
477 | EBX = dst_offset; |
471 | EBX = dst_offset; |
478 | ECX = w << 16 + h; |
472 | ECX = w << 16 + h; |
479 | EDX = x << 16 + y; |
473 | EDX = x << 16 + y; |
480 | $int 0x40; |
474 | $int 0x40; |
481 | } |
475 | } |
482 | 476 | ||
483 | :dword GetPixelColorFromScreen(dword _x, _y) |
477 | :dword GetPixelColorFromScreen(dword _x, _y) |
484 | { |
478 | { |
485 | EAX = 35; |
479 | EAX = 35; |
486 | EBX = _y * screen.width + _x; |
480 | EBX = _y * screen.width + _x; |
487 | $int 64 |
481 | $int 64 |
488 | } |
482 | } |
489 | 483 | ||
490 | #define DRAW_DESKTOP_BG_TILE 1 |
484 | #define DRAW_DESKTOP_BG_TILE 1 |
491 | #define DRAW_DESKTOP_BG_STRETCH 2 |
485 | #define DRAW_DESKTOP_BG_STRETCH 2 |
492 | :void SetBackgroundImage(dword w,h, image, mode) |
486 | :void SetBackgroundImage(dword w,h, image, mode) |
493 | { |
487 | { |
494 | $mov eax,15 // SF_BACKGROUND_SET 15 - work with desktop background graphics |
488 | $mov eax,15 // SF_BACKGROUND_SET 15 - work with desktop background graphics |
495 | $mov ebx,4 // SSF_MODE_BG 4 - set drawing mode for the background |
489 | $mov ebx,4 // SSF_MODE_BG 4 - set drawing mode for the background |
496 | $mov ecx,mode // drawing mode - tile (1), stretch (2) |
490 | $mov ecx,mode // drawing mode - tile (1), stretch (2) |
497 | $int 64 |
491 | $int 64 |
498 | 492 | ||
499 | $mov eax,15 // SF_BACKGROUND_SET 15 - work with desktop background graphics |
493 | $mov eax,15 // SF_BACKGROUND_SET 15 - work with desktop background graphics |
500 | $mov ebx,1 // SSF_SIZE_BG=1 - set a size of the background image |
494 | $mov ebx,1 // SSF_SIZE_BG=1 - set a size of the background image |
501 | $mov ecx,w // width |
495 | $mov ecx,w // width |
502 | $mov edx,h // height |
496 | $mov edx,h // height |
503 | $int 64 |
497 | $int 64 |
504 | 498 | ||
505 | $mov eax,15 // SF_BACKGROUND_SET 15 - work with desktop background graphics |
499 | $mov eax,15 // SF_BACKGROUND_SET 15 - work with desktop background graphics |
506 | $mov ebx,5 // SSF_IMAGE_BG=5 - put block of pixels on the background image |
500 | $mov ebx,5 // SSF_IMAGE_BG=5 - put block of pixels on the background image |
507 | $mov ecx,image // pointer to the data in the format BBGGRRBBGGRR... |
501 | $mov ecx,image // pointer to the data in the format BBGGRRBBGGRR... |
508 | $mov edx,0 // offset in data of the background image |
502 | $mov edx,0 // offset in data of the background image |
509 | ESI = 3*w*h; // size of data in bytes = 3 * number of pixels |
503 | ESI = 3*w*h; // size of data in bytes = 3 * number of pixels |
510 | $int 64 |
504 | $int 64 |
511 | 505 | ||
512 | $mov eax,15 // SF_BACKGROUND_SET 15 - work with desktop background graphics |
506 | $mov eax,15 // SF_BACKGROUND_SET 15 - work with desktop background graphics |
513 | $mov ebx,3 // SSF_REDRAW_BG=3 - redraw background |
507 | $mov ebx,3 // SSF_REDRAW_BG=3 - redraw background |
514 | $int 64 |
508 | $int 64 |
515 | } |
509 | } |
516 | 510 | ||
517 | :void _PutImage(dword x,y, w,h, data_offset) |
511 | :void _PutImage(dword x,y, w,h, data_offset) |
518 | { |
512 | { |
519 | EAX = 7; |
513 | EAX = 7; |
520 | EBX = data_offset; |
514 | EBX = data_offset; |
521 | ECX = w<<16+h; |
515 | ECX = w<<16+h; |
522 | EDX = x<<16+y; |
516 | EDX = x<<16+y; |
523 | $int 0x40 |
517 | $int 0x40 |
524 | } |
518 | } |
525 | 519 | ||
526 | :void PutPaletteImage(dword inbuf,w,h,x,y,bits,pal) |
520 | :void PutPaletteImage(dword inbuf,w,h,x,y,bits,pal) |
527 | { |
521 | { |
528 | if (h<1) || (w<0) return; |
522 | if (h<1) || (w<0) return; |
529 | EAX = 65; |
523 | EAX = 65; |
530 | EBX = inbuf; |
524 | EBX = inbuf; |
531 | ECX = w<<16+h; |
525 | ECX = w<<16+h; |
532 | EDX = x<<16+y; |
526 | EDX = x<<16+y; |
533 | ESI = bits; |
527 | ESI = bits; |
534 | EDI = pal; |
528 | EDI = pal; |
535 | EBP = 0; |
529 | EBP = 0; |
536 | $int 0x40 |
530 | $int 0x40 |
537 | } |
531 | } |
538 | 532 | ||
539 | inline fastcall void PutPixel( EBX,ECX,EDX) |
533 | inline fastcall void PutPixel( EBX,ECX,EDX) |
540 | { |
534 | { |
541 | EAX=1; |
535 | EAX=1; |
542 | $int 0x40 |
536 | $int 0x40 |
543 | } |
537 | } |
544 | 538 | ||
545 | :void DrawBar(dword x,y,w,h,color) |
539 | :void DrawBar(dword x,y,w,h,color) |
546 | { |
540 | { |
547 | if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :) |
541 | if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :) |
548 | EAX = 13; |
542 | EAX = 13; |
549 | EBX = x<<16+w; |
543 | EBX = x<<16+w; |
550 | ECX = y<<16+h; |
544 | ECX = y<<16+h; |
551 | EDX = color; |
545 | EDX = color; |
552 | $int 0x40 |
546 | $int 0x40 |
553 | } |
547 | } |
554 | 548 | ||
555 | :void DefineButton(dword x,y,w,h,id,color) |
549 | :void DefineButton(dword x,y,w,h,id,color) |
556 | { |
550 | { |
557 | EAX = 8; |
551 | EAX = 8; |
558 | EDX = id + BT_DEL; |
552 | EDX = id + BT_DEL; |
559 | $int 0x40; |
553 | $int 0x40; |
560 | EDX = id; |
554 | EDX = id; |
561 | ESI = color; |
555 | ESI = color; |
562 | EBX = x<<16+w; |
556 | EBX = x<<16+w; |
563 | ECX = y<<16+h; |
557 | ECX = y<<16+h; |
564 | $int 0x40 |
558 | $int 0x40 |
565 | } |
559 | } |
566 | 560 | ||
567 | :void UnsafeDefineButton(dword x,y,w,h,id,color) |
561 | :void UnsafeDefineButton(dword x,y,w,h,id,color) |
568 | { |
562 | { |
569 | EAX = 8; |
563 | EAX = 8; |
570 | EBX = x<<16+w; |
564 | EBX = x<<16+w; |
571 | ECX = y<<16+h; |
565 | ECX = y<<16+h; |
572 | EDX = id; |
566 | EDX = id; |
573 | ESI = color; |
567 | ESI = color; |
574 | $int 0x40 |
568 | $int 0x40 |
575 | } |
569 | } |
576 | 570 | ||
577 | :void DefineDragableWindow(dword _x, _y, _w, _h) |
571 | :void DefineDragableWindow(dword _x, _y, _w, _h) |
578 | { |
572 | { |
579 | DefineAndDrawWindow(_x, _y, _w, _h, 0x41,0x000000,NULL,0b); |
573 | DefineAndDrawWindow(_x, _y, _w, _h, 0x41,0x000000,NULL,0b); |
580 | } |
574 | } |
581 | 575 | ||
582 | :void DefineUnDragableWindow(dword _x, _y, _w, _h) |
576 | :void DefineUnDragableWindow(dword _x, _y, _w, _h) |
583 | { |
577 | { |
584 | DefineAndDrawWindow(_x, _y, _w, _h, 0x01, 0, 0, 0x01fffFFF); |
578 | DefineAndDrawWindow(_x, _y, _w, _h, 0x01, 0, 0, 0x01fffFFF); |
585 | } |
579 | } |
586 | 580 | ||
587 | :void EventDragWindow() |
581 | :void EventDragWindow() |
588 | { |
582 | { |
589 | proc_info Form1; |
583 | proc_info Form1; |
590 | dword tmp_x,tmp_y; |
584 | dword tmp_x,tmp_y; |
591 | dword z1,z2; |
585 | dword z1,z2; |
592 | tmp_x = mouse.x; |
586 | tmp_x = mouse.x; |
593 | tmp_y = mouse.y; |
587 | tmp_y = mouse.y; |
594 | do { |
588 | do { |
595 | GetProcessInfo(#Form1, SelfInfo); |
589 | GetProcessInfo(#Form1, SelfInfo); |
596 | mouse.get(); |
590 | mouse.get(); |
597 | if (tmp_x!=mouse.x) || (tmp_y!=mouse.y) |
591 | if (tmp_x!=mouse.x) || (tmp_y!=mouse.y) |
598 | { |
592 | { |
599 | z1 = Form1.left + mouse.x - tmp_x; |
593 | z1 = Form1.left + mouse.x - tmp_x; |
600 | z2 = Form1.top + mouse.y - tmp_y; |
594 | z2 = Form1.top + mouse.y - tmp_y; |
601 | if(z1<=10) || (z1>20000) z1=0; else if(z1>screen.width-Form1.width-10)z1=screen.width-Form1.width; |
595 | if(z1<=10) || (z1>20000) z1=0; else if(z1>screen.width-Form1.width-10)z1=screen.width-Form1.width; |
602 | if(z2<=10) || (z2>20000) z2=0; else if(z2>screen.height-Form1.height-10)z2=screen.height-Form1.height; |
596 | if(z2<=10) || (z2>20000) z2=0; else if(z2>screen.height-Form1.height-10)z2=screen.height-Form1.height; |
603 | MoveSize(z1 , z2, OLD, OLD); |
597 | MoveSize(z1 , z2, OLD, OLD); |
604 | draw_window(); |
598 | draw_window(); |
605 | } |
599 | } |
606 | pause(1); |
600 | pause(1); |
607 | } while (mouse.lkm); |
601 | } while (mouse.lkm); |
608 | } |
602 | } |
609 | 603 | ||
610 | :void DefineHiddenButton(dword _x, _y, _w, _h, _id) |
604 | :void DefineHiddenButton(dword _x, _y, _w, _h, _id) |
611 | { |
605 | { |
612 | DefineButton(_x, _y, _w, _h, _id + BT_HIDE, 0); |
606 | DefineButton(_x, _y, _w, _h, _id + BT_HIDE, 0); |
613 | } |
607 | } |
614 | 608 | ||
615 | inline fastcall void DeleteButton( EDX) |
609 | inline fastcall void DeleteButton( EDX) |
616 | { |
610 | { |
617 | EAX = 8; |
611 | EAX = 8; |
618 | EDX += BT_DEL; |
612 | EDX += BT_DEL; |
619 | $int 0x40 |
613 | $int 0x40 |
620 | } |
614 | } |
621 | 615 | ||
622 | inline fastcall dword GetStartTime() |
616 | inline fastcall dword GetStartTime() |
623 | { |
617 | { |
624 | $mov eax,26 |
618 | $mov eax,26 |
625 | $mov ebx,9 |
619 | $mov ebx,9 |
626 | $int 0x40 |
620 | $int 0x40 |
627 | } |
621 | } |
628 | 622 | ||
629 | :dword X_EventRedrawWindow,Y_EventRedrawWindow; |
623 | :dword X_EventRedrawWindow,Y_EventRedrawWindow; |
630 | :void _EventRedrawWindow() |
624 | :void _EventRedrawWindow() |
631 | { |
625 | { |
632 | DefineAndDrawWindow(X_EventRedrawWindow,Y_EventRedrawWindow,1,1,0x34,0xFFFFFF,NULL,0); |
626 | DefineAndDrawWindow(X_EventRedrawWindow,Y_EventRedrawWindow,1,1,0x34,0xFFFFFF,NULL,0); |
633 | //pause(10); |
627 | //pause(10); |
634 | ExitProcess(); |
628 | ExitProcess(); |
635 | } |
629 | } |
636 | :char REDRAW_BUFF_EVENT_[4096]; |
630 | :char REDRAW_BUFF_EVENT_[4096]; |
637 | :void EventRedrawWindow(dword x,y) |
631 | :void EventRedrawWindow(dword x,y) |
638 | { |
632 | { |
639 | X_EventRedrawWindow = x; |
633 | X_EventRedrawWindow = x; |
640 | Y_EventRedrawWindow = y; |
634 | Y_EventRedrawWindow = y; |
641 | CreateThread(#_EventRedrawWindow,#REDRAW_BUFF_EVENT_+4092); |
635 | CreateThread(#_EventRedrawWindow,#REDRAW_BUFF_EVENT_+4092); |
642 | } |
636 | } |
643 | 637 | ||
644 | :struct _screen |
638 | :struct _screen |
645 | { |
639 | { |
646 | dword width,height; |
640 | dword width,height; |
647 | } screen; |
641 | } screen; |
648 | 642 | ||
649 | :byte skin_height; |
643 | :byte skin_height; |
650 | 644 | ||
651 | dword __generator; // random number generator init |
645 | dword __generator; // random number generator init |
652 | 646 | ||
653 | //The initialization of the initial data before running |
647 | //The initialization of the initial data before running |
654 | void ______INIT______() |
648 | void ______INIT______() |
655 | { |
649 | { |
656 | skin_height = GetSkinHeight(); |
650 | skin_height = GetSkinHeight(); |
657 | screen.width = GetScreenWidth()+1; |
651 | screen.width = GetScreenWidth()+1; |
658 | screen.height = GetScreenHeight()+1; |
652 | screen.height = GetScreenHeight()+1; |
659 | __generator = GetStartTime(); |
653 | __generator = GetStartTime(); |
660 | mem_init(); |
654 | mem_init(); |
661 | main(); |
655 | main(); |
662 | } |
656 | } |
663 | ______STOP______: |
657 | ______STOP______: |
664 | #endif |
658 | #endif |
665 | 659 | ||
666 | #ifndef INCLUDE_MEM_H |
660 | #ifndef INCLUDE_MEM_H |
667 | #include "../lib/mem.h" |
661 | #include "../lib/mem.h" |
668 | #endif |
662 | #endif |
669 | 663 | ||
670 | #ifndef INCLUDE_DEBUG_H |
664 | #ifndef INCLUDE_DEBUG_H |
671 | #include "../lib/debug.h" |
665 | #include "../lib/debug.h" |
672 | #endif |
666 | #endif |
673 | 667 | ||
674 | #ifndef INCLUDE_IPC_H |
668 | #ifndef INCLUDE_IPC_H |
675 | #include "../lib/ipc.h" |
669 | #include "../lib/ipc.h" |
676 | #endif=10)>=10)>16+h; |
670 | #endif=10)>=10)>16+h; |
677 | ><16+h; |
671 | ><16+h; |
678 | >16+w; |
672 | >16+w; |
679 | ><16+w; |
673 | ><16+w; |
680 | >16+h; |
674 | >16+h; |
681 | ><16+h; |
675 | ><16+h; |
682 | >16+w; |
676 | >16+w; |
683 | ><16+w; |
677 | ><16+w; |
684 | >16+h; |
678 | >16+h; |
685 | ><16+h; |
679 | ><16+h; |
686 | >16+w; |
680 | >16+w; |
687 | ><16+w; |
681 | ><16+w; |
688 | >=0)>=0)>16+y; |
682 | >=0)>=0)>16+y; |
689 | ><16+y; |
683 | ><16+y; |
690 | >16+h; |
684 | >16+h; |
691 | ><16+h; |
685 | ><16+h; |
692 | >0)>1)>16+y; |
686 | >0)>1)>16+y; |
693 | ><16+y; |
687 | ><16+y; |
694 | >16+h; |
688 | >16+h; |
695 | ><16+h; |
689 | ><16+h; |
696 | >><>><>24+color; |
690 | >><>><>24+color; |
697 | ><24+color; |
691 | ><24+color; |
698 | >16+y; |
692 | >16+y; |
699 | ><16+y; |
693 | ><16+y; |
700 | >16; |
694 | >16; |
701 | ><16; |
695 | ><16; |
702 | >24+color; |
696 | >24+color; |
703 | ><24+color; |
697 | ><24+color; |
704 | >16+y; |
698 | >16+y; |
705 | ><16+y; |
699 | ><16+y; |
706 | >16 |
700 | >16 |
707 | ><16 |
701 | ><16 |
708 | >24+color; |
702 | >24+color; |
709 | ><24+color; |
703 | ><24+color; |
710 | >16+y; |
704 | >16+y; |
711 | ><16+y; |
705 | ><16+y; |
712 | >><>><>><> |
706 | >><>><>><> |