Subversion Repositories Kolibri OS

Rev

Rev 6746 | Rev 6751 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6746 Rev 6747
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
#print "[include ]\n"
5
#print "[include ]\n"
6
 
6
 
7
#pragma option OST
7
#pragma option OST
8
#pragma option ON
8
#pragma option ON
9
#pragma option cri-
9
#pragma option cri-
10
#pragma option -CPA
10
#pragma option -CPA
11
#initallvar 0
11
#initallvar 0
12
#jumptomain FALSE
12
#jumptomain FALSE
13
 
13
 
14
#startaddress 0
14
#startaddress 0
15
 
15
 
16
#code32 TRUE
16
#code32 TRUE
17
 
17
 
18
char   os_name[8]   = {'M','E','N','U','E','T','0','1'};
18
char   os_name[8]   = {'M','E','N','U','E','T','0','1'};
19
dword  os_version   = 0x00000001;
19
dword  os_version   = 0x00000001;
20
dword  start_addr   = #______INIT______;
20
dword  start_addr   = #______INIT______;
21
dword  final_addr   = #______STOP______+32;
21
dword  final_addr   = #______STOP______+32;
22
dword  alloc_mem    = MEMSIZE;
22
dword  alloc_mem    = MEMSIZE;
23
dword  x86esp_reg   = MEMSIZE;
23
dword  x86esp_reg   = MEMSIZE;
24
dword  I_Param      = #param;
24
dword  I_Param      = #param;
25
dword  I_Path       = #program_path;
25
dword  I_Path       = #program_path;
26
char param[4096];
26
char param[4096];
27
char program_path[4096];
27
char program_path[4096];
28
 
28
 
29
#define bool      int
29
#define bool      int
30
 
30
 
31
#define NULL      0
31
#define NULL      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 evDesktop 5
40
#define evDesktop 5
41
#define evMouse   6
41
#define evMouse   6
42
#define evIPC     7
42
#define evIPC     7
43
#define evNetwork 8
43
#define evNetwork 8
44
#define evDebug   9
44
#define evDebug   9
45
 
45
 
46
//Button options
46
//Button options
47
#define BT_DEL      0x80000000
47
#define BT_DEL      0x80000000
48
#define BT_HIDE     0x40000000
48
#define BT_HIDE     0x40000000
49
#define BT_NOFRAME  0x20000000
49
#define BT_NOFRAME  0x20000000
50
 
50
 
51
//allow event mask
51
//allow event mask
52
#define EVENT_MASK_REDRAW   000000001b
52
#define EVENT_MASK_REDRAW   000000001b
53
#define EVENT_MASK_KEYBOARD 000000010b
53
#define EVENT_MASK_KEYBOARD 000000010b
54
#define EVENT_MASK_BUTTONS  000000100b
54
#define EVENT_MASK_BUTTONS  000000100b
55
#define EVENT_MASK_DESKTOP  000010000b
55
#define EVENT_MASK_DESKTOP  000010000b
56
#define EVENT_MASK_MOUSE    000100000b
56
#define EVENT_MASK_MOUSE    000100000b
57
#define EVENT_MASK_IPC      001000000b
57
#define EVENT_MASK_IPC      001000000b
58
#define EVENT_MASK_NETWORK  010000000b
58
#define EVENT_MASK_NETWORK  010000000b
59
#define EVENT_MASK_DEBUG    100000000b
59
#define EVENT_MASK_DEBUG    100000000b
60
 
60
 
61
//ARGS FUNCTION
61
//ARGS FUNCTION
62
#define END_ARGS 0xFF00FF
62
#define END_ARGS 0xFF00FF
63
//-------------------------------------------------------------------------
63
//-------------------------------------------------------------------------
64
 
64
 
65
#include "../lib/system.h"
65
#include "../lib/system.h"
66
#include "../lib/mouse.h"
66
#include "../lib/mouse.h"
67
#include "../lib/keyboard.h"
67
#include "../lib/keyboard.h"
68
 
68
 
69
:dword calc(EAX) { return EAX; }
69
:dword calc(EAX) { return EAX; }
70
 
70
 
71
:struct raw_image {
71
:struct raw_image {
72
	dword w, h, data;
72
	dword w, h, data;
73
};
73
};
74
 
74
 
75
//------------------------------------------------------------------------------
75
//------------------------------------------------------------------------------
76
:dword wait_event_code;
76
:dword wait_event_code;
77
inline fastcall dword WaitEvent()
77
inline fastcall dword WaitEvent()
78
{
78
{
79
	$mov eax,10
79
	$mov eax,10
80
	$int 0x40
80
	$int 0x40
81
	wait_event_code = EAX;
81
	wait_event_code = EAX;
82
	//if(wait_event_code==evMouse) MOUSE.get();
82
	//if(wait_event_code==evMouse) MOUSE.get();
83
	//return wait_event_code;
83
	//return wait_event_code;
84
}
84
}
85
 
85
 
86
inline fastcall dword CheckEvent()
86
inline fastcall dword CheckEvent()
87
{
87
{
88
	$mov eax,11
88
	$mov eax,11
89
	$int 0x40
89
	$int 0x40
90
}
90
}
91
 
91
 
92
inline fastcall dword WaitEventTimeout(EBX)
92
inline fastcall dword WaitEventTimeout(EBX)
93
{
93
{
94
	$mov eax,23
94
	$mov eax,23
95
	$int 0x40
95
	$int 0x40
96
} 
96
} 
97
 
97
 
98
inline fastcall SetEventMask(EBX)
98
inline fastcall SetEventMask(EBX)
99
{
99
{
100
	$mov eax,40
100
	$mov eax,40
101
	$int 0x40
101
	$int 0x40
102
}
102
}
103
 
103
 
104
 
104
 
105
inline fastcall pause(EBX)
105
inline fastcall pause(EBX)
106
{
106
{
107
	$mov eax, 5
107
	$mov eax, 5
108
	$int 0x40
108
	$int 0x40
109
}
109
}
110
 
110
 
111
inline fastcall word GetButtonID()
111
inline fastcall word GetButtonID()
112
{
112
{
113
	$mov eax,17
113
	$mov eax,17
114
	$int  0x40
114
	$int  0x40
115
	$shr eax,8
115
	$shr eax,8
116
}
116
}
117
 
117
 
118
inline fastcall dword GetFreeRAM()
118
inline fastcall dword GetFreeRAM()
119
{
119
{
120
	$mov eax, 18
120
	$mov eax, 18
121
	$mov ebx, 16
121
	$mov ebx, 16
122
	$int 0x40
122
	$int 0x40
123
	//return eax = ðàçìåð ñâîáîäíîé ïàìÿòè â êèëîáàéòàõ
123
	//return eax = ðàçìåð ñâîáîäíîé ïàìÿòè â êèëîáàéòàõ
124
}
124
}
125
 
125
 
126
inline fastcall dword LoadDriver(ECX) //ECX - èìÿ äðàéâåðà
126
inline fastcall dword LoadDriver(ECX) //ECX - èìÿ äðàéâåðà
127
{
127
{
128
	$mov eax, 68
128
	$mov eax, 68
129
	$mov ebx, 16
129
	$mov ebx, 16
130
	$int 0x40
130
	$int 0x40
131
	//return 0 - íåóäà÷à, èíà÷å eax = õýíäë äðàéâåðà 
131
	//return 0 - íåóäà÷à, èíà÷å eax = õýíäë äðàéâåðà 
132
}
132
}
133
 
133
 
134
inline fastcall dword RuleDriver(ECX) //óêàçàòåëü íà óïðàâëÿþùóþ ñòðóêòóðó
134
inline fastcall dword RuleDriver(ECX) //óêàçàòåëü íà óïðàâëÿþùóþ ñòðóêòóðó
135
{
135
{
136
	$mov eax, 68
136
	$mov eax, 68
137
	$mov ebx, 17
137
	$mov ebx, 17
138
	$int 0x40
138
	$int 0x40
139
	//return eax = îïðåäåëÿåòñÿ äðàéâåðîì
139
	//return eax = îïðåäåëÿåòñÿ äðàéâåðîì
140
}
140
}
141
 
141
 
142
struct proc_info
142
struct proc_info
143
{
143
{
144
	#define SelfInfo -1
144
	#define SelfInfo -1
145
	dword	use_cpu;
145
	dword	use_cpu;
146
	word	pos_in_stack,num_slot,rezerv1;
146
	word	pos_in_stack,num_slot,rezerv1;
147
	unsigned char name[11];
147
	unsigned char name[11];
148
	char	rezerv2;
148
	char	rezerv2;
149
	dword	adress,use_memory,ID,left,top,width,height;
149
	dword	adress,use_memory,ID,left,top,width,height;
150
	word	status_slot,rezerv3;
150
	word	status_slot,rezerv3;
151
	dword	work_left,work_top,work_width,work_height;
151
	dword	work_left,work_top,work_width,work_height;
152
	char	status_window;
152
	char	status_window;
153
	dword   cwidth,cheight;
153
	dword   cwidth,cheight;
154
	byte    reserved[1024-71-8];
154
	byte    reserved[1024-71-8];
155
};
155
};
156
 
156
 
157
inline fastcall void GetProcessInfo(EBX, ECX)
157
inline fastcall void GetProcessInfo(EBX, ECX)
158
{
158
{
159
	$mov eax,9;
159
	$mov eax,9;
160
	$int  0x40
160
	$int  0x40
161
	DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth
161
	DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth
162
	DSDWORD[EBX+75] = DSDWORD[EBX+46] - GetSkinHeight() - 4; //set cheight
162
	DSDWORD[EBX+75] = DSDWORD[EBX+46] - GetSkinHeight() - 4; //set cheight
163
}
163
}
164
 
164
 
165
inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y
165
inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y
166
{
166
{
167
	$mov eax,34
167
	$mov eax,34
168
	$int 0x40
168
	$int 0x40
169
}
169
}
170
 
170
 
171
inline fastcall int GetProcessSlot( ECX)
171
inline fastcall int GetProcessSlot( ECX)
172
{
172
{
173
	EAX = 18;
173
	EAX = 18;
174
	EBX = 21;
174
	EBX = 21;
175
	$int 0x40
175
	$int 0x40
176
}
176
}
177
 
177
 
178
inline fastcall int GetActiveProcess()
178
inline fastcall int GetActiveProcess()
179
{
179
{
180
	EAX = 18;
180
	EAX = 18;
181
	EBX = 7;
181
	EBX = 7;
182
	$int 0x40
182
	$int 0x40
183
}
183
}
184
 
184
 
185
:int CheckActiveProcess(int Form_ID)
185
:int CheckActiveProcess(int Form_ID)
186
{
186
{
187
	int id9=GetProcessSlot(Form_ID);
187
	int id9=GetProcessSlot(Form_ID);
188
	if (id9==GetActiveProcess()) return 1;
188
	if (id9==GetActiveProcess()) return 1;
189
	return 0;
189
	return 0;
190
}
190
}
191
 
191
 
192
inline fastcall void ActivateWindow( ECX)
192
inline fastcall void ActivateWindow( ECX)
193
{
193
{
194
	EAX = 18;
194
	EAX = 18;
195
	EBX = 3;
195
	EBX = 3;
196
	$int 0x40
196
	$int 0x40
197
}
197
}
198
 
198
 
199
inline fastcall int MinimizeWindow()
199
inline fastcall int MinimizeWindow()
200
{
200
{
201
	EAX = 18;
201
	EAX = 18;
202
	EBX = 10;
202
	EBX = 10;
203
	$int 0x40
203
	$int 0x40
204
}
204
}
205
 
205
 
206
inline fastcall int CreateThread(ECX,EDX)
206
inline fastcall int CreateThread(ECX,EDX)
207
{
207
{
208
	$mov eax,51
208
	$mov eax,51
209
	$mov ebx,1
209
	$mov ebx,1
210
	$int 0x40
210
	$int 0x40
211
}
211
}
212
 
212
 
213
inline fastcall void SwitchToAnotherThread()
213
inline fastcall void SwitchToAnotherThread()
214
{
214
{
215
	$mov eax,68
215
	$mov eax,68
216
	$mov ebx,1
216
	$mov ebx,1
217
	$int 0x40
217
	$int 0x40
218
}
218
}
219
 
219
 
220
inline fastcall int SendWindowMessage( ECX, EDX)
220
inline fastcall int SendWindowMessage( ECX, EDX)
221
{
221
{
222
	$mov eax, 72
222
	$mov eax, 72
223
	$mov ebx, 1
223
	$mov ebx, 1
224
	$int 0x40
224
	$int 0x40
225
}
225
}
226
 
226
 
227
inline fastcall int KillProcess( ECX)
227
inline fastcall int KillProcess( ECX)
228
{
228
{
229
	$mov eax,18;
229
	$mov eax,18;
230
	$mov ebx,18;
230
	$mov ebx,18;
231
	$int 0x40
231
	$int 0x40
232
}
232
}
233
 
233
 
234
#define TURN_OFF 2
234
#define TURN_OFF 2
235
#define REBOOT 3
235
#define REBOOT 3
236
#define KERNEL 4
236
#define KERNEL 4
237
inline fastcall int ExitSystem( ECX)
237
inline fastcall int ExitSystem( ECX)
238
{
238
{
239
	$mov eax, 18
239
	$mov eax, 18
240
	$mov ebx, 9
240
	$mov ebx, 9
241
	$int 0x40
241
	$int 0x40
242
}
242
}
243
 
243
 
244
inline fastcall ExitProcess()
244
inline fastcall ExitProcess()
245
{
245
{
246
	$mov eax,-1;
246
	$mov eax,-1;
247
	$int 0x40
247
	$int 0x40
248
}
248
}
249
 
249
 
250
//------------------------------------------------------------------------------
250
//------------------------------------------------------------------------------
251
 
251
 
252
inline fastcall void SetCurDir( ECX)
252
inline fastcall void SetCurDir( ECX)
253
{
253
{
254
  EAX=30;
254
  EAX=30;
255
  EBX=1;
255
  EBX=1;
256
  $int 0x40
256
  $int 0x40
257
}
257
}
258
 
258
 
259
 
259
 
260
//eax = ÿçûê ñèñòåìû (1=eng, 2=fi, 3=ger, 4=rus)
260
//eax = ÿçûê ñèñòåìû (1=eng, 2=fi, 3=ger, 4=rus)
261
#define SYS_LANG_ENG 1
261
#define SYS_LANG_ENG 1
262
#define SYS_LANG_FIN 2
262
#define SYS_LANG_FIN 2
263
#define SYS_LANG_GER 3
263
#define SYS_LANG_GER 3
264
#define SYS_LANG_RUS 4
264
#define SYS_LANG_RUS 4
265
inline fastcall int GetSystemLanguage()
265
inline fastcall int GetSystemLanguage()
266
{
266
{
267
	EAX = 26;
267
	EAX = 26;
268
	EBX = 5;
268
	EBX = 5;
269
	$int 0x40
269
	$int 0x40
270
}
270
}
271
 
271
 
272
inline fastcall GetSkinHeight()
272
inline fastcall GetSkinHeight()
273
{
273
{
274
	$push ebx
274
	$push ebx
275
	$mov  eax,48
275
	$mov  eax,48
276
	$mov  ebx,4
276
	$mov  ebx,4
277
	$int 0x40
277
	$int 0x40
278
	$pop  ebx
278
	$pop  ebx
279
}
279
}
280
 
280
 
281
inline fastcall void SetSystemSkin( ECX)
281
inline fastcall void SetSystemSkin( ECX)
282
{
282
{
283
	EAX = 48;
283
	EAX = 48;
284
	EBX = 8;
284
	EBX = 8;
285
	$int 0x40
285
	$int 0x40
286
}
286
}
287
 
287
 
288
inline fastcall int GetScreenWidth()
288
inline fastcall int GetScreenWidth()
289
{
289
{
290
	$mov eax, 14
290
	$mov eax, 14
291
	$int 0x40
291
	$int 0x40
292
	$shr eax, 16
292
	$shr eax, 16
293
}
293
}
294
 
294
 
295
inline fastcall int GetScreenHeight()
295
inline fastcall int GetScreenHeight()
296
{
296
{
297
	$mov eax, 14
297
	$mov eax, 14
298
	$int 0x40
298
	$int 0x40
299
	$and eax,0x0000FFFF
299
	$and eax,0x0000FFFF
300
}
300
}
301
 
301
 
302
inline fastcall int GetClientTop()
302
inline fastcall int GetClientTop()
303
{
303
{
304
	$mov eax, 48
304
	$mov eax, 48
305
	$mov ebx, 5
305
	$mov ebx, 5
306
	$int 0x40
306
	$int 0x40
307
	$mov eax, ebx
307
	$mov eax, ebx
308
	$shr eax, 16
308
	$shr eax, 16
309
}
309
}
310
 
310
 
311
inline fastcall int GetClientHeight()
311
inline fastcall int GetClientHeight()
312
{
312
{
313
	$mov eax, 48
313
	$mov eax, 48
314
	$mov ebx, 5
314
	$mov ebx, 5
315
	$int 0x40
315
	$int 0x40
316
	$mov eax, ebx
316
	$mov eax, ebx
317
}
317
}
318
 
318
 
319
inline fastcall dword LoadLibrary( ECX)
319
inline fastcall dword LoadLibrary( ECX)
320
{
320
{
321
	$mov eax, 68 
321
	$mov eax, 68 
322
	$mov ebx, 19
322
	$mov ebx, 19
323
	$int  0x40
323
	$int  0x40
324
}
324
}
325
 
325
 
326
inline fastcall int TestBit( EAX, CL)
326
inline fastcall int TestBit( EAX, CL)
327
{
327
{
328
	$shr eax,cl
328
	$shr eax,cl
329
	$and eax,1
329
	$and eax,1
330
}
330
}
331
 
331
 
332
//------------------------------------------------------------------------------
332
//------------------------------------------------------------------------------
333
 
333
 
334
:void DefineAndDrawWindow(dword _x, _y, _w, _h, _window_type, _bgcolor, _title, _flags)
334
:void DefineAndDrawWindow(dword _x, _y, _w, _h, _window_type, _bgcolor, _title, _flags)
335
{
335
{
336
	EAX = 12;              // function 12:tell os about windowdraw
336
	EAX = 12;              // function 12:tell os about windowdraw
337
	EBX = 1;
337
	EBX = 1;
338
	$int 0x40
338
	$int 0x40
339
	
339
	
340
	$xor EAX,EAX
340
	$xor EAX,EAX
341
	EBX = _x << 16 + _w; 
341
	EBX = _x << 16 + _w; 
342
	ECX = _y << 16 + _h;
342
	ECX = _y << 16 + _h;
343
	EDX = _window_type << 24 | _bgcolor;
343
	EDX = _window_type << 24 | _bgcolor;
344
	EDI = _title;
344
	EDI = _title;
345
	ESI = _flags;
345
	ESI = _flags;
346
	$int 0x40
346
	$int 0x40
347
 
347
 
348
 
348
 
349
	EAX = 12;              // function 12:tell os about windowdraw
349
	EAX = 12;              // function 12:tell os about windowdraw
350
	EBX = 2;
350
	EBX = 2;
351
	$int 0x40
351
	$int 0x40
352
}
352
}
353
 
353
 
354
inline fastcall MoveSize( EBX,ECX,EDX,ESI)
354
inline fastcall MoveSize( EBX,ECX,EDX,ESI)
355
{
355
{
356
	$mov eax, 67
356
	$mov eax, 67
357
	$int 0x40
357
	$int 0x40
358
}
358
}
359
 
359
 
360
inline fastcall void DrawTitle( ECX)
360
inline fastcall void DrawTitle( ECX)
361
{
361
{
362
	EAX = 71;
362
	EAX = 71;
363
	EBX = 1;
363
	EBX = 1;
364
	$int 0x40;
364
	$int 0x40;
365
}
365
}
366
 
366
 
367
:void WriteTextB(dword x,y,byte fontType, dword color, str_offset)
367
:void WriteTextB(dword x,y,byte fontType, dword color, str_offset)
368
{
368
{
369
	EAX = 4;
369
	EAX = 4;
370
	EBX = x<<16+y;
370
	EBX = x<<16+y;
371
	ECX = fontType<<24+color;
371
	ECX = fontType<<24+color;
372
	EDX = str_offset;
372
	EDX = str_offset;
373
	ESI = 0;
373
	ESI = 0;
374
	$int 0x40;
374
	$int 0x40;
375
	$add ebx, 1<<16
375
	$add ebx, 1<<16
376
	$int 0x40
376
	$int 0x40
377
}
377
}
378
 
378
 
379
:void WriteText(dword x,y,byte fontType, dword color, str_offset)
379
:void WriteText(dword x,y,byte fontType, dword color, str_offset)
380
{
380
{
381
	EAX = 4;
381
	EAX = 4;
382
	EBX = x<<16+y;
382
	EBX = x<<16+y;
383
	ECX = fontType<<24+color;
383
	ECX = fontType<<24+color;
384
	EDX = str_offset;
384
	EDX = str_offset;
385
	$int 0x40;
385
	$int 0x40;
386
}
386
}
387
 
387
 
388
:dword WriteBufText(dword x,y,byte fontType, dword color, str_offset, buf_offset)
388
:dword WriteBufText(dword x,y,byte fontType, dword color, str_offset, buf_offset)
389
{
389
{
390
	EAX = 4;
390
	EAX = 4;
391
	EBX = x<<16+y;
391
	EBX = x<<16+y;
392
	ECX = fontType<<24+color;
392
	ECX = fontType<<24+color;
393
	EDX = str_offset;
393
	EDX = str_offset;
394
	EDI = buf_offset;
394
	EDI = buf_offset;
395
	$int 0x40;
395
	$int 0x40;
396
}
396
}
397
 
397
 
398
:void WriteNumber(dword x,y,byte fontType, dword color, count, number_or_offset)
398
:void WriteNumber(dword x,y,byte fontType, dword color, count, number_or_offset)
399
{
399
{
400
	EAX = 47;
400
	EAX = 47;
401
	EBX = count<<16;
401
	EBX = count<<16;
402
	ECX = number_or_offset;
402
	ECX = number_or_offset;
403
	EDX = x<<16+y;
403
	EDX = x<<16+y;
404
	ESI = fontType<<24+color;
404
	ESI = fontType<<24+color;
405
	$int 0x40;
405
	$int 0x40;
406
}
406
}
407
 
407
 
408
:void CopyScreen(dword dst_offset, x, y, w, h)
408
:void CopyScreen(dword dst_offset, x, y, w, h)
409
{
409
{
410
  EAX = 36;
410
  EAX = 36;
411
  EBX = dst_offset;
411
  EBX = dst_offset;
412
  ECX = w << 16 + h;
412
  ECX = w << 16 + h;
413
  EDX = x << 16 + y;
413
  EDX = x << 16 + y;
414
  $int  0x40;
414
  $int  0x40;
415
}
415
}
416
 
416
 
417
:dword GetPixelColor(dword x, x_size, y)
417
:dword GetPixelColor(dword x, x_size, y)
418
{
418
{
419
	$mov eax, 35
419
	$mov eax, 35
420
	EBX= y*x_size+x;
420
	EBX= y*x_size+x;
421
	$int 0x40
421
	$int 0x40
422
}
422
}
423
 
423
 
424
:void _PutImage(dword x,y, w,h, data_offset)
424
:void _PutImage(dword x,y, w,h, data_offset)
425
{
425
{
426
	EAX = 7;
426
	EAX = 7;
427
	EBX = data_offset;
427
	EBX = data_offset;
428
	ECX = w<<16+h;
428
	ECX = w<<16+h;
429
	EDX = x<<16+y;
429
	EDX = x<<16+y;
430
	$int 0x40
430
	$int 0x40
431
}
431
}
432
 
432
 
433
void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI)
433
void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI)
434
{
434
{
435
	EAX = 65;
435
	EAX = 65;
436
	ECX = w<<16+h;
436
	ECX = w<<16+h;
437
	EDX = x<<16+y;
437
	EDX = x<<16+y;
438
	EBP = 0;
438
	EBP = 0;
439
	$int 0x40
439
	$int 0x40
440
}
440
}
441
 
441
 
442
inline fastcall void PutPixel( EBX,ECX,EDX)
442
inline fastcall void PutPixel( EBX,ECX,EDX)
443
{
443
{
444
  EAX=1;
444
  EAX=1;
445
  $int 0x40
445
  $int 0x40
446
}
446
}
447
 
447
 
448
:void DrawBar(dword x,y,w,h,color)
448
:void DrawBar(dword x,y,w,h,color)
449
{
449
{
450
	if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :)
450
	if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :)
451
	EAX = 13;
451
	EAX = 13;
452
	EBX = x<<16+w;
452
	EBX = x<<16+w;
453
	ECX = y<<16+h;
453
	ECX = y<<16+h;
454
	EDX = color;
454
	EDX = color;
455
	$int 0x40
455
	$int 0x40
456
}
456
}
457
 
457
 
458
void DefineButton(dword x,y,w,h,EDX,ESI)
458
void DefineButton(dword x,y,w,h,EDX,ESI)
459
{
459
{
460
	EAX = 8;
460
	EAX = 8;
461
	$push edx
461
	$push edx
462
	EDX += BT_DEL;
462
	EDX += BT_DEL;
463
	$int 0x40;
463
	$int 0x40;
464
	$pop edx
464
	$pop edx
465
	EBX = x<<16+w;
465
	EBX = x<<16+w;
466
	ECX = y<<16+h;
466
	ECX = y<<16+h;
467
	$int 0x40
467
	$int 0x40
468
}
468
}
469
 
469
 
470
inline RefreshWindow(dword ID_REFRESH,ID_ACTIVE)
470
inline RefreshWindow(dword ID_REFRESH,ID_ACTIVE)
471
{
471
{
472
	EAX = 18;
472
	EAX = 18;
473
	EBX = 22;
473
	EBX = 22;
474
	ECX = 3;
474
	ECX = 3;
475
	EDX = ID_REFRESH;
475
	EDX = ID_REFRESH;
476
	$int 0x40
476
	$int 0x40
477
	EAX = 18;
477
	EAX = 18;
478
	EBX = 3;
478
	EBX = 3;
479
	EDX = ID_ACTIVE;
479
	EDX = ID_ACTIVE;
480
	$int 0x40
480
	$int 0x40
481
}
481
}
482
 
482
 
483
:void UnsafeDefineButton(dword x,y,w,h,id,color)
483
:void UnsafeDefineButton(dword x,y,w,h,id,color)
484
{
484
{
485
	EAX = 8;
485
	EAX = 8;
486
	EBX = x<<16+w;
486
	EBX = x<<16+w;
487
	ECX = y<<16+h;
487
	ECX = y<<16+h;
488
	EDX = id;
488
	EDX = id;
489
	ESI = color;
489
	ESI = color;
490
	$int 0x40
490
	$int 0x40
491
}
491
}
492
 
492
 
493
inline fastcall void DeleteButton( EDX)
493
inline fastcall void DeleteButton( EDX)
494
{
494
{
495
	EAX = 8;
495
	EAX = 8;
496
	EDX += BT_DEL;
496
	EDX += BT_DEL;
497
	$int 0x40
497
	$int 0x40
498
}
498
}
499
 
499
 
500
inline fastcall dword GetStartTime()
500
inline fastcall dword GetStartTime()
501
{
501
{
502
	$mov eax,26
502
	$mov eax,26
503
	$mov ebx,9
503
	$mov ebx,9
504
	$int 0x40
504
	$int 0x40
505
}
505
}
506
 
506
 
507
:dword X_EventRedrawWindow,Y_EventRedrawWindow;
507
:dword X_EventRedrawWindow,Y_EventRedrawWindow;
508
:void _EventRedrawWindow()
508
:void _EventRedrawWindow()
509
{
509
{
510
	loop()switch(WaitEvent())
510
	loop()switch(WaitEvent())
511
	{
511
	{
512
		case evReDraw:
512
		case evReDraw:
513
			DefineAndDrawWindow(X_EventRedrawWindow,Y_EventRedrawWindow,100,1,1,0x34,0xFFFFFF,"",0);
513
			DefineAndDrawWindow(X_EventRedrawWindow,Y_EventRedrawWindow,100,1,0x34,0xFFFFFF,NULL,0);
514
			pause(10);
514
			pause(10);
515
			ExitProcess();
515
			ExitProcess();
516
			break;
516
			break;
517
	}
517
	}
518
}
518
}
519
:char REDRAW_BUFF_EVENT_[4096];
519
:char REDRAW_BUFF_EVENT_[4096];
520
:void EventRedrawWindow(dword x,y)
520
:void EventRedrawWindow(dword x,y)
521
{
521
{
522
	X_EventRedrawWindow = x;
522
	X_EventRedrawWindow = x;
523
	Y_EventRedrawWindow = y;
523
	Y_EventRedrawWindow = y;
524
	CreateThread(#_EventRedrawWindow,#REDRAW_BUFF_EVENT_+4092);
524
	CreateThread(#_EventRedrawWindow,#REDRAW_BUFF_EVENT_+4092);
525
}
525
}
526
 
526
 
527
:struct obj
527
:struct obj
528
{
528
{
529
	dword x,y,w,h;
529
	dword x,y,w,h;
530
	void set_size();
530
	void set_size();
531
};
531
};
532
 
532
 
533
:void obj::set_size(dword _x, _y, _w, _h)
533
:void obj::set_size(dword _x, _y, _w, _h)
534
{
534
{
535
	x=_x; 
535
	x=_x; 
536
	y=_y;
536
	y=_y;
537
	w=_w;
537
	w=_w;
538
	h=_h;
538
	h=_h;
539
}
539
}
540
 
540
 
541
:struct _screen
541
:struct _screen
542
{
542
{
543
	dword width,height;
543
	dword width,height;
544
} screen;
544
} screen;
545
 
545
 
546
:byte skin_height;
546
:byte skin_height;
547
 
547
 
548
:void DrawDate(dword x, y, color, in_date)
548
:void DrawDate(dword x, y, color, in_date)
549
{
549
{
550
	EDI = in_date;
550
	EDI = in_date;
551
	EAX = 47;
551
	EAX = 47;
552
	EBX = 2<<16;
552
	EBX = 2<<16;
553
	EDX = x<<16+y;
553
	EDX = x<<16+y;
554
	ESI = 0x90<<24+color;
554
	ESI = 0x90<<24+color;
555
	ECX = EDI.date.day;
555
	ECX = EDI.date.day;
556
	$int 0x40;
556
	$int 0x40;
557
	EDX += 20<<16;
557
	EDX += 20<<16;
558
	ECX = EDI.date.month;
558
	ECX = EDI.date.month;
559
	$int 0x40;
559
	$int 0x40;
560
	EDX += 20<<16;
560
	EDX += 20<<16;
561
	EBX = 4<<16;
561
	EBX = 4<<16;
562
	ECX = EDI.date.year;
562
	ECX = EDI.date.year;
563
	$int 0x40;
563
	$int 0x40;
564
	DrawBar(x+17,y+10,2,2,color);
564
	DrawBar(x+17,y+10,2,2,color);
565
	DrawBar(x+37,y+10,2,2,color);
565
	DrawBar(x+37,y+10,2,2,color);
566
}
566
}
567
 
567
 
568
:void __path_name__(dword BUF,PATH)
568
:void __path_name__(dword BUF,PATH)
569
{
569
{
570
	dword beg = PATH;
570
	dword beg = PATH;
571
	dword pos = PATH;
571
	dword pos = PATH;
572
	dword sav = PATH;
572
	dword sav = PATH;
573
	dword i;
573
	dword i;
574
	while(DSBYTE[pos])
574
	while(DSBYTE[pos])
575
	{
575
	{
576
		if(DSBYTE[pos]=='/')sav = pos;
576
		if(DSBYTE[pos]=='/')sav = pos;
577
		pos++;
577
		pos++;
578
	}
578
	}
579
	i = sav-beg;
579
	i = sav-beg;
580
	while(i)
580
	while(i)
581
	{
581
	{
582
		DSBYTE[BUF] = DSBYTE[beg];
582
		DSBYTE[BUF] = DSBYTE[beg];
583
		beg++;
583
		beg++;
584
		BUF++;
584
		BUF++;
585
		i--;
585
		i--;
586
	}
586
	}
587
	/*while(DSBYTE[beg])
587
	/*while(DSBYTE[beg])
588
	{
588
	{
589
		DSBYTE[BUF1] = DSBYTE[beg];
589
		DSBYTE[BUF1] = DSBYTE[beg];
590
		beg++;
590
		beg++;
591
		BUF1++;
591
		BUF1++;
592
	}*/
592
	}*/
593
	//DSBYTE[BUF1] = 0;
593
	//DSBYTE[BUF1] = 0;
594
	DSBYTE[BUF] = 0;
594
	DSBYTE[BUF] = 0;
595
}
595
}
596
char __BUF_DIR__[4096];
596
char __BUF_DIR__[4096];
597
:struct SELF
597
:struct SELF
598
{
598
{
599
	dword dir;
599
	dword dir;
600
	dword file;
600
	dword file;
601
	dword path;
601
	dword path;
602
} self;
602
} self;
603
 
603
 
604
dword __generator;  // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë
604
dword __generator;  // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë
605
 
605
 
606
:dword program_path_length;
606
:dword program_path_length;
607
 
607
 
608
//The initialization of the initial data before running
608
//The initialization of the initial data before running
609
void ______INIT______()
609
void ______INIT______()
610
{
610
{
611
	self.dir = #__BUF_DIR__;
611
	self.dir = #__BUF_DIR__;
612
	self.file = 0;
612
	self.file = 0;
613
	self.path = I_Path;
613
	self.path = I_Path;
614
	__path_name__(#__BUF_DIR__,I_Path);
614
	__path_name__(#__BUF_DIR__,I_Path);
615
	
615
	
616
	skin_height   = GetSkinHeight();
616
	skin_height   = GetSkinHeight();
617
	screen.width  = GetScreenWidth();
617
	screen.width  = GetScreenWidth();
618
	screen.height = GetScreenHeight();
618
	screen.height = GetScreenHeight();
619
	
619
	
620
	DOUBLE_CLICK_DELAY = GetMouseDoubleClickDelay();
620
	DOUBLE_CLICK_DELAY = GetMouseDoubleClickDelay();
621
	__generator = GetStartTime();
621
	__generator = GetStartTime();
622
	
622
	
623
	mem_init();
623
	mem_init();
624
 
624
 
625
	if (program_path[0]!='/') I_Path++;
625
	if (program_path[0]!='/') I_Path++;
626
 
626
 
627
	main();
627
	main();
628
	ExitProcess();
628
	ExitProcess();
629
}
629
}
630
______STOP______:
630
______STOP______:
631
#endif
631
#endif
632
 
632
 
633
#ifndef INCLUDE_MEM_H
633
#ifndef INCLUDE_MEM_H
634
#include "../lib/mem.h"
634
#include "../lib/mem.h"
635
#endif
635
#endif
636
 
636
 
637
#ifndef INCLUDE_DEBUG_H
637
#ifndef INCLUDE_DEBUG_H
638
#include "../lib/debug.h"
638
#include "../lib/debug.h"
639
#endif
639
#endif
640
>
640
>
641
>
641
>
642
>
642
>
643
>
643
>
644
>
644
>
645
>
645
>
646
>
646
>
647
>
647
>
648
>
648
>
649
>
649
>
650
>
650
>
651
>
651
>
652
>
652
>
653
>
653
>
654
>
654
>
655
>
655
>
656
>
656
>
657
>
657
>
658
>
658
>
659
>
659
>
660
>
660
>
661
>
661
>
662
>
662
>
663
>
663
>
664
>
664
>
665
>
665
>
666
>
666
>
667
>
667
>
668
>
668
>
669
>
669
>
670
>
670
>
671
>
671
>
672
>
672
>
673
>
673
>
674
>
674
>
675
>
675
>
676
>
676
>
677
>
677
>
678
>
678
>
679
>
679
>
680
>
680
>
681
>
681
>
682
>
682
>
683
>
683
>
684
>
684
>
685
>
685
>
686
>
686
>
687
>
687
>
688
>
688
>
689
>
689
>
690
>
690
>
691
>
691
>