Subversion Repositories Kolibri OS

Rev

Rev 1686 | Rev 1702 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1686 Rev 1688
Line 1... Line 1...
1
; kpack = Kolibri Packer
1
; kpack = Kolibri Packer
-
 
2
;---------------------------------------------------------------------
-
 
3
; version:	0.15
-
 
4
; last update:  06/11/2010
-
 
5
; changed by:   Marat Zakiyanov aka Mario79, aka Mario
-
 
6
; changes:      1) Window Y=4, B=1
-
 
7
;               2) Refresh lenght of data after Editbox editing
-
 
8
;               3) Changed format of start parameter -
-
 
9
;                    longer path (total length 255 + zero).
-
 
10
;---------------------------------------------------------------------
-
 
11
; version:	0.14
-
 
12
; last update:  03/11/2010
-
 
13
; changed by:   Marat Zakiyanov aka Mario79, aka Mario
-
 
14
; changes:      select path with OpenDialog,
-
 
15
;               using Box_Lib and Proc_Lib
-
 
16
;---------------------------------------------------------------------
-
 
17
; Kpack - Kolibri Packer
2
; Kolibri version
18
; Kolibri version
3
; Written by diamond in 2006, 2007 specially for KolibriOS
19
; Written by diamond in 2006, 2007 specially for KolibriOS
4
;
20
;
5
; Disassemled and corrected in 2010 specially for FASM
21
; Disassemled and corrected in 2010 specially for FASM
6
;            by Marat Zakiyanov aka Mario79, aka Mario
22
;            by Marat Zakiyanov aka Mario79, aka Mario
Line 14... Line 30...
14
 
30
 
15
	db 'MENUET01'
31
	db 'MENUET01'
16
	dd 1
32
	dd 1
17
	dd START
33
	dd START
18
	dd IM_END
34
	dd IM_END
19
	dd I_END		;memf
35
	dd I_END
20
	dd stacktop
36
	dd stacktop
21
	dd params
37
	dd params
22
	dd cur_dir_path
38
	dd cur_dir_path
23
;---------------------------------------------------------------------
39
;---------------------------------------------------------------------
24
include '..\..\..\macros.inc'
40
include '../../../macros.inc'
25
include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
41
include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
26
include '../../../develop/libraries/box_lib/load_lib.mac'
42
include '../../../develop/libraries/box_lib/load_lib.mac'
Line 27... Line 43...
27
  @use_library
43
  @use_library
28
 
44
 
29
START:
45
START:
Line -... Line 46...
-
 
46
	mcall	68,11
-
 
47
	mcall	40,100111b
-
 
48
 
-
 
49
load_libraries l_libs_start,load_lib_end
30
	mcall	68,11
50
	cmp eax,-1
31
	mcall	40,100111b
51
	je exit
32
 
52
 
33
	call	clear_messages
53
	call	clear_messages
34
; set default path = /RD/1/
54
; set default path = /RD/1/
35
	mov	esi,defpath
55
	mov	esi,defpath
36
	mov	edi,path
56
	mov	edi,path
37
	mov	[edi-4],dword 6
57
	mov	[edi-4],dword 6
38
	movsw
58
	movsw
39
	movsd
-
 
40
; get system window info
-
 
41
	mcall	48,3,color_table,40
-
 
42
	inc	ebx
-
 
43
	mcall
-
 
44
	mov	[skinheight],eax
-
 
45
	jmp	default
-
 
46
; check command line
59
	movsd
47
	mov	esi,params
60
; get system window info
48
	mov	[esi+100h],byte 0
-
 
49
;--------------------------------------
61
	mcall	48,3,color_table,40
50
parse_opt:
62
;--------------------------------------
Line 51... Line 63...
51
	call	skip_spaces
63
	xor	eax,eax
52
	test	al,al
64
	cmp	[params],al
53
	jz	default
65
	je	default
54
 
-
 
Line -... Line 66...
-
 
66
	
-
 
67
	mov	edi,path
-
 
68
	mov	esi,params
-
 
69
	call	copy_1
-
 
70
 
-
 
71
	sub	esi,2
-
 
72
	std
-
 
73
@@:
-
 
74
	lodsb
-
 
75
	dec	edi
-
 
76
	cmp	al,byte '/'
-
 
77
	jnz	@r
-
 
78
	
-
 
79
	mov	[edi-1],byte 0
55
	mov	edi,inname
80
	mov	edi,inname
56
	call	copy_name
81
	add	esi,2
57
	test	al,al
-
 
58
	jz	outeqin
-
 
59
 
-
 
60
	mov	edi,outname
-
 
61
	call	copy_name
-
 
62
	test	al,al
-
 
63
	jnz	default
-
 
64
;--------------------------------------
-
 
65
doit:
-
 
66
	call	draw_window
-
 
67
	call	pack
-
 
68
	jmp	still
-
 
69
;---------------------------------------------------------------------
-
 
70
clear_messages:
-
 
71
	xor	eax,eax
82
	push	esi
72
	mov	ecx,80*20/4+1
-
 
73
	mov	edi,message_mem
-
 
74
	rep	stosd
-
 
75
	ret
-
 
76
;---------------------------------------------------------------------
-
 
77
exit:
-
 
78
	xor	eax,eax
-
 
79
	dec	eax
-
 
80
	mcall
83
	call	copy_1
81
;--------------------------------------
-
 
82
outeqin:
-
 
83
	mov	ecx,256/4+1
84
	pop	esi
-
 
85
	mov	edi,outname
-
 
86
	call	copy_1
-
 
87
;---------------------------------------------------------------------
-
 
88
	call	set_editbox_position_all
84
	mov	esi,inname-4
89
;---------------------------------------------------------------------
85
	mov	edi,outname-4
-
 
86
	rep	movsd
-
 
87
	jmp	doit
-
 
88
;---------------------------------------------------------------------
-
 
89
default:
-
 
90
 
90
	call	draw_window
91
load_libraries l_libs_start,load_lib_end
91
	call	pack
92
	cmp eax,-1
92
	jmp	OD_initialization
93
	je exit
93
;*********************************************************************
94
 
94
default:
Line 109... Line 109...
109
	pop	ecx
109
	pop	ecx
110
	mov	[outnamelen],ecx
110
	mov	[outnamelen],ecx
111
	mov	edi,outname
111
	mov	edi,outname
112
	rep	movsb
112
	rep	movsb
113
;---------------------------------------------------------------------
113
;---------------------------------------------------------------------
114
;	mov	edi,fname_buf
114
	call	set_editbox_position_all
115
;	mov	esi,path4
115
;---------------------------------------------------------------------
116
;	call	copy_1
116
OD_initialization:
117
	
-
 
118
;OpenDialog	initialisation
117
;OpenDialog	initialisation
119
	push    dword OpenDialog_data
118
	push    dword OpenDialog_data
120
	call    [OpenDialog_Init]
119
	call    [OpenDialog_Init]
121
;---------------------------------------------------------------------
120
;---------------------------------------------------------------------
122
	call	set_editbox_position_all
-
 
123
;---------------------------------------------------------------------
-
 
124
red:
121
red:
125
	call	draw_window
122
	call	draw_window
126
;--------------------------------------
123
;--------------------------------------
127
still:
124
still:
128
	mcall	10
125
	mcall	10
Line 144... Line 141...
144
	push	dword edit3
141
	push	dword edit3
145
	call	[edit_box_mouse]
142
	call	[edit_box_mouse]
Line 146... Line 143...
146
 
143
 
147
	jmp	still
144
	jmp	still
-
 
145
;*********************************************************************
-
 
146
clear_messages:
-
 
147
	xor	eax,eax
-
 
148
	mov	ecx,80*20/4+1
-
 
149
	mov	edi,message_mem
-
 
150
	rep	stosd
-
 
151
	ret
-
 
152
;*********************************************************************
-
 
153
exit:
-
 
154
	xor	eax,eax
-
 
155
	dec	eax
-
 
156
	mcall
148
;*********************************************************************
157
;*********************************************************************
149
button:
158
button:
150
; button pressed
159
; button pressed
151
	mcall	17
160
	mcall	17
152
	xchg	al,ah
161
	xchg	al,ah
Line 188... Line 197...
188
 
197
 
189
	call	OpenDialog_start
198
	call	OpenDialog_start
190
	jmp	still
199
	jmp	still
191
;*********************************************************************
200
;*********************************************************************
-
 
201
OpenDialog_start:
-
 
202
	mov	esi,path
-
 
203
	mov	edi,temp_dir_pach
-
 
204
	call	copy_1	
192
OpenDialog_start:
205
 
193
	push    dword OpenDialog_data
206
	push    dword OpenDialog_data
194
	call    [OpenDialog_Start]
207
	call    [OpenDialog_Start]
195
	cmp	[OpenDialog_data.status],1
208
	cmp	[OpenDialog_data.status],1
Line 196... Line 209...
196
	jne	@f
209
	jne	@f
197
 
210
 
198
	mov	esi,filename_area
211
	mov	esi,filename_area
199
	mov	edi,inname
-
 
200
	call	copy_1
-
 
Line 201... Line 212...
201
	sub	edi,inname
212
	mov	edi,inname
202
	mov	[innamelen],edi
213
	call	copy_1
203
 
214
 
204
	mov	esi,filename_area
-
 
205
	mov	edi,outname
-
 
Line 206... Line 215...
206
	call	copy_1
215
	mov	esi,filename_area
207
	sub	edi,outname
216
	mov	edi,outname
208
	mov	[outnamelen],edi
217
	call	copy_1
209
	
-
 
210
	mov	esi,temp_dir_pach
218
	
211
	mov	edi,path
219
	mov	esi,temp_dir_pach
Line 212... Line 220...
212
	call	copy_1
220
	mov	edi,path
Line 213... Line 221...
213
	sub	edi,path
221
	call	copy_1
214
	dec	edi
222
	
Line 228... Line 236...
228
	stosb
236
	stosb
229
	test	eax,eax
237
	test	eax,eax
230
	jnz	@r
238
	jnz	@r
231
	ret
239
	ret
232
;*********************************************************************
240
;*********************************************************************
-
 
241
refresh_editbox_data:
-
 
242
	mov	esi,inname
-
 
243
	mov	edi,innamelen
-
 
244
	call	refresh_data
-
 
245
 
-
 
246
	mov	esi,outname
-
 
247
	mov	edi,outnamelen
-
 
248
	call	refresh_data
-
 
249
 
-
 
250
	mov	esi,path
-
 
251
	mov	edi,pathlen
-
 
252
	call	refresh_data
-
 
253
 
-
 
254
	ret
-
 
255
;*********************************************************************
-
 
256
refresh_data:
-
 
257
	push	esi
-
 
258
	xor	eax,eax
-
 
259
	cld	
-
 
260
@@:
-
 
261
	lodsb
-
 
262
	test	eax,eax
-
 
263
	jnz	@r
-
 
264
	pop	eax
-
 
265
	sub	esi,eax
-
 
266
	dec	esi
-
 
267
	mov	[edi],esi
-
 
268
	ret
-
 
269
;*********************************************************************
233
set_editbox_position_all:
270
set_editbox_position_all:
234
	mov	ebx,inname
271
	mov	ebx,inname
235
	mov	edi,edit1
272
	mov	edi,edit1
236
	call	set_editbox_position
273
	call	set_editbox_position
Line 256... Line 293...
256
	push	dword edit3
293
	push	dword edit3
257
	call	[edit_box_key]
294
	call	[edit_box_key]
Line 258... Line 295...
258
 
295
 
259
	jmp	still
296
	jmp	still
260
;*********************************************************************
-
 
261
onenter:
-
 
262
;	cmp	[curedit],inname
-
 
263
;	jnz	@f
-
 
264
 
-
 
265
	push	2
-
 
266
	pop	eax
-
 
267
	jmp	nounpack
-
 
268
;*********************************************************************
297
;*********************************************************************
269
get_full_name:
298
get_full_name:
270
	push	esi
299
	push	esi
271
	mov	esi,path
300
	mov	esi,path
272
	mov	ecx,[esi-4]
301
	mov	ecx,[esi-4]
Line 325... Line 354...
325
	loop	x1
354
	loop	x1
326
;--------------------------------------
355
;--------------------------------------
327
x2:
356
x2:
328
	mov	[message_cur_pos],edx
357
	mov	[message_cur_pos],edx
329
; update window
358
; update window
330
	mov	ecx,[skinheight]
-
 
331
	shl	ecx,16
-
 
332
	add	ecx,3700DEh
-
 
333
	mcall	13,<9,417>,,[color_table+20]
359
	mcall	13,<6,414>,<54,222>,[color_table+20]
334
;--------------------------------------
360
;--------------------------------------
335
draw_messages:
361
draw_messages:
336
	mov	ebx,[skinheight]
362
	mov	ebx,12 shl 16+60
337
	add	ebx,3Ch+12*10000h
-
 
338
	mov	edi,message_mem
363
	mov	edi,message_mem
339
;--------------------------------------
364
;--------------------------------------
340
@@:
365
@@:
341
	push	edi
366
	push	edi
342
	xor	eax,eax
367
	xor	eax,eax
Line 356... Line 381...
356
	ret
381
	ret
357
;*********************************************************************
382
;*********************************************************************
358
draw_window:
383
draw_window:
359
; start redraw
384
; start redraw
360
	mcall	12,1
385
	mcall	12,1
361
	mov	edi,[skinheight]
-
 
362
;--------------------------------------
386
;--------------------------------------
363
; define window
387
; define window
364
	xor	eax,eax
388
	xor	eax,eax
365
	mov	ecx,100 shl 16+286
389
	mov	ecx,100 shl 16+306
366
	add	ecx,edi
-
 
367
	mov	edx,[color_table+20]
390
	mov	edx,[color_table+20]
368
	add	edx,13000000h
391
	add	edx,34000000h
369
;	push	edi
-
 
370
	xor	esi,esi
392
	xor	esi,esi
-
 
393
	xor	edi,edi
371
	mcall	,<100,435>,,,,fullname	;temp_dir_pach	;caption_str
394
	mcall	,<100,436>,,,,caption_str
372
;	pop	edi
-
 
373
	mcall	9,procinfo,-1
395
	mcall	9,procinfo,-1
374
;--------------------------------------
396
;--------------------------------------
375
; draw lines and frame
397
; draw lines and frame
376
	call	draw_lines
398
	call	draw_lines
377
; draw buttons
399
; draw buttons
378
	call	draw_bittons
400
	call	draw_bittons
379
; infile, outfile, path strings
-
 
380
;	call	draw_strings
-
 
381
; draw messages
401
; draw messages
382
	call	draw_messages
402
	call	draw_messages
383
; draw editbox's
403
; draw editbox's
384
	mov	eax,[procinfo+42]
404
	mov	eax,[procinfo+42]
385
	sub	eax,65+72+10
405
	sub	eax,65+72+10
386
	mov	[edit1.width],eax ; óñòàíàâëèâàåì øèðèíó òåêñòîâûõ ïîëåé
406
	mov	[edit1.width],eax
387
	mov	[edit2.width],eax
407
	mov	[edit2.width],eax
388
	mov	[edit3.width],eax
408
	mov	[edit3.width],eax
Line 389... Line 409...
389
 
409
 
390
	call	draw_editbox
410
	call	draw_editbox
Line 414... Line 434...
414
	mov	[edi+48], eax  ;ed_size
434
	mov	[edi+48], eax  ;ed_size
415
	mov	[edi+52], eax  ;ed_pos
435
	mov	[edi+52], eax  ;ed_pos
416
	ret
436
	ret
417
;*********************************************************************
437
;*********************************************************************
418
draw_lines:
438
draw_lines:
419
;	mov	edi,[skinheight]
-
 
420
; lines - horizontal
-
 
421
;	mov	ebx,8 shl 16+352
-
 
422
;	mov	ecx,edi
-
 
423
;	shl	ecx,16
-
 
424
;	or	ecx,edi
-
 
425
;	add	ecx,2 shl 16+2
-
 
426
;	mcall	38,,,[color_table+36]
-
 
427
;	mov	esi,3
-
 
428
;@@:
-
 
429
;	add	ecx,12 shl 16+12
-
 
430
;	mcall
-
 
431
;	dec	esi
-
 
432
;	jnz	@r
-
 
433
;--------------------------------------
-
 
434
; lines - vertical
-
 
435
;	sub	ecx,36 shl 16
-
 
436
;	mcall	,<8,8>
-
 
437
;	add	ebx,52 shl 16+52
-
 
438
;	mcall
-
 
439
;	add	ebx,292 shl 16+292
-
 
440
;	mcall
-
 
441
;--------------------------------------
-
 
442
	mov	edi,[skinheight]
-
 
443
	mov	ecx,edi
-
 
444
	shl	ecx,16
-
 
445
	or	ecx,edi
-
 
446
	add	ecx,2 shl 16+2+12*3
439
	mov	ecx,2 shl 16+12*3
447
;	add	ecx,12*3
-
 
448
; draw frame for messages data
440
; draw frame for messages data
449
	push	ecx
441
	push	ecx
450
	add	ecx,52 shl 16+16
442
	add	ecx,50 shl 16+16
451
	mcall	38,<8,425>,,[color_table+36]
443
	mcall	38,<3,423>,,[color_table+36]
452
	add	ecx,224*(1 shl 16+1)
444
	add	ecx,224*(1 shl 16+1)
453
	mcall
445
	mcall
454
	sub	cx,224
446
	sub	cx,224
455
	mcall	,<8,8>
447
	mcall	,<3,3>
456
	mcall	,<426,426>
448
	mcall	,<423,423>
457
	pop	ecx
449
	pop	ecx
458
	ret
450
	ret
459
;*********************************************************************
451
;*********************************************************************
460
draw_bittons:
452
draw_bittons:
461
; define compress button
453
; define compress button
462
	mov	cx,18
454
	mov	cx,18
463
	mcall	8,<354,72>,,2,[color_table+36]
455
	mcall	8,<351,72>,,2,[color_table+36]
464
; uncompress button
456
; uncompress button
465
	add	ecx,18 shl 16
457
	add	ecx,18 shl 16
466
	inc	edx
458
	inc	edx
467
	mcall
459
	mcall
468
	add	ecx,-12h+0Ah+140000h
460
	add	ecx,-12h+0Ah+140000h
469
; question button
461
; question button
470
	push	esi
462
	push	esi
471
	mov	dl,7
463
	mov	dl,7
472
	mcall	,<417,9>
464
	mcall	,<414,9>
473
	shr	ecx,16
465
	shr	ecx,16
474
	lea	ebx,[ecx+1A40002h]
466
	lea	ebx,[ecx+1A10002h]
475
	mcall	4,,[color_table+28],aQuestion,1
467
	mcall	4,,[color_table+28],aQuestion,1
476
;	mov	al,8
-
 
477
	pop	esi
468
	pop	esi
478
; define settings buttons
469
; define settings buttons
479
;	mov	ebx,9 shl 16+50
-
 
480
	lea	ecx,[edi+2]
-
 
481
	add	ecx,16*2
470
	mov	ecx,16*2+2
482
	shl	ecx,16
471
	shl	ecx,16
483
	mov	cx,13
472
	mov	cx,13
484
;	push	4
-
 
485
;	pop	edx
-
 
486
;--------------------------------------
-
 
487
;@@:
-
 
488
;	mcall
-
 
489
;	add	ecx,12 shl 16
-
 
490
;	inc	edx
-
 
491
;	cmp	edx,6
-
 
492
;	jbe	@b
-
 
493
	mcall	8,<9,50>,,4
473
	mcall	8,<6,50>,,4
494
; text on settings buttons
474
; text on settings buttons
495
	lea	ebx,[edi+5+0C0000h]
475
	mov	ebx,9 shl 16+5
496
	mov	al,4
476
	mov	al,4
497
	mov	ecx,[color_table+28]
477
	mov	ecx,[color_table+28]
498
	push	buttons1names
478
	push	buttons1names
499
	pop	edx
479
	pop	edx
500
	push	8
480
	push	8
Line 505... Line 485...
505
	add	edx,esi
485
	add	edx,esi
506
	add	ebx,16
486
	add	ebx,16
507
	cmp	[edx-6],byte ' '
487
	cmp	[edx-6],byte ' '
508
	jnz	@b
488
	jnz	@b
509
; text on compress and decompress buttons
489
; text on compress and decompress buttons
510
	lea	ebx,[edi+8+1720000h]
-
 
511
	or	ecx,80000000h
490
	or	ecx,80000000h
512
	mcall	,,,aCompress
491
	mcall	,<367,7>,,aCompress
513
	lea	ebx,[edi+1Ah+16A0000h]
-
 
514
	mcall	,,,aDecompress
492
	mcall	,<359,25>,,aDecompress
515
	ret
-
 
516
;*********************************************************************
-
 
517
copy_name:
-
 
518
	lea	edx,[edi+256]
-
 
519
;--------------------------------------
-
 
520
@@:
-
 
521
	lodsb
-
 
522
	cmp	al,' '
-
 
523
	jbe	copy_name_done
-
 
524
 
-
 
525
	stosb
-
 
526
	cmp	edi,edx
-
 
527
	jb	@b
-
 
528
;--------------------------------------
-
 
529
@@:
-
 
530
	lodsb
-
 
531
	cmp	al,' '
-
 
532
	ja	@b
-
 
533
;--------------------------------------
-
 
534
copy_name_done:
-
 
535
	dec	esi
-
 
536
	sub	edx,256
-
 
537
	sub	edi,edx
-
 
538
	mov	[edx-4],edi
-
 
539
;--------------------------------------
-
 
540
skip_spaces:
-
 
541
	lodsb
-
 
542
	cmp	al,0
-
 
543
	jz	@f
-
 
544
 
-
 
545
	cmp	al,' '
-
 
546
	jbe	skip_spaces
-
 
547
;--------------------------------------
-
 
548
@@:
-
 
549
	dec	esi
-
 
550
	ret
493
	ret
551
;*********************************************************************
494
;*********************************************************************
552
;Pack procedures
495
;Pack procedures
553
include 'packpoc.inc'
496
include 'packpoc.inc'
554
;---------------------------------------------------------------------
497
;---------------------------------------------------------------------