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