Subversion Repositories Kolibri OS

Rev

Rev 5924 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5849 pathoswith 1
;;;;;;;;;;;;;;;;;;;;;;;
2
;;  SYSTEM SETTINGS  ;;
3
;;;;;;;;;;;;;;;;;;;;;;;
4
 
3221 hidnplayr 5
format binary as ""
5849 pathoswith 6
use32
7
org 0
31 halyavin 8
 
5849 pathoswith 9
db 'MENUET01'
10
dd 1
11
dd START
12
dd IM_END
13
dd I_END
5924 pathoswith 14
dd I_END
5854 pathoswith 15
dd param
5849 pathoswith 16
dd 0
3221 hidnplayr 17
 
5854 pathoswith 18
include '../../../proc32.inc'
4825 gtament 19
include '../../../macros.inc'
5854 pathoswith 20
include '../../../dll.inc'
5849 pathoswith 21
;---------------------------------------------------------------
5854 pathoswith 22
BootSettings:
23
; Set system language
24
	mov	word[param],0
25
	invoke	ini.get_str, sz_ini, sz_system, sz_language, param, 2, 0
26
	mov	ax, [param]
27
	or	ax, 0x2020	; convert to lowercase
5875 pathoswith 28
	mov	ecx,8
5854 pathoswith 29
	mov	edi,langMarks
30
	repnz scasw
31
	jnz	@f
32
	neg	ecx
5875 pathoswith 33
	add	ecx,8
5854 pathoswith 34
	mcall	21,5
5849 pathoswith 35
@@:
5854 pathoswith 36
 
37
; Set font smoothing
38
	mov	dword[param],0
39
	invoke	ini.get_str, sz_ini, sz_system, sz_fontSmooth, param, 4, 0
40
	xor	ecx,ecx
41
	mov	eax,[param]
42
	or	eax,0x20202020
43
	cmp	eax,'off '
44
	jz	@f
45
	inc	ecx
46
	cmp	eax,'on  '
47
	jz	@f
48
	cmp	eax,'sbp '
49
	jnz	.skipFont
50
	inc	ecx
51
@@:
52
	mcall	48,10
53
.skipFont:
54
 
55
; Enable/disable system speaker
56
	mov	dword[param],0
57
	invoke	ini.get_str, sz_ini, sz_system, sz_speaker, param, 4, 0
58
	mov	eax,[param]
59
	or	eax,0x20202020
60
	cmp	eax,'off '
61
	jz	@f
62
	cmp	eax,'on  '
63
	jnz	.skipSpeaker
64
	inc	[speaker_mute]
65
@@:
5849 pathoswith 66
	call	_speaker_mute
5854 pathoswith 67
.skipSpeaker:
68
 
5874 pathoswith 69
; Set font size
70
	invoke	ini.get_int, sz_ini, sz_system, sz_fontSize, 9
71
	mov	ecx,eax
72
	mcall	48,12
73
 
5854 pathoswith 74
; Set mouse speed
75
	invoke	ini.get_int, sz_ini, sz_mouse, sz_speed, 1
76
	mov	edx,eax
77
	mcall	18,19,1
78
 
5973 leency 79
; Set mouse acceleration
80
	invoke	ini.get_int, sz_ini, sz_mouse, sz_acceleration, 1
5854 pathoswith 81
	mov	edx,eax
82
	mcall	18,19,3
5973 leency 83
 
84
; Set mouse double click delay
85
	invoke	ini.get_int, sz_ini, sz_mouse, sz_double_click_delay, 1
86
	mov	edx,eax
87
	mcall	18,19,7
5854 pathoswith 88
 
89
; Enable/disable LBA access for applications
90
	mov	dword[param],0
91
	invoke	ini.get_str, sz_ini, sz_low_level, sz_lba, param, 4, 0
92
	xor	ecx,ecx
93
	mov	eax,[param]
94
	or	eax,0x20202020
95
	cmp	eax,'off '
96
	jz	@f
97
	cmp	eax,'on  '
98
	jnz	.skipLBA
5849 pathoswith 99
	inc	ecx
100
@@:
5854 pathoswith 101
	mcall	21,11
102
.skipLBA:
103
 
104
; Enable/disable PCI access for applications
105
	mov	dword[param],0
106
	invoke	ini.get_str, sz_ini, sz_low_level, sz_pci, param, 4, 0
107
	xor	ecx,ecx
108
	mov	eax,[param]
109
	or	eax,0x20202020
110
	cmp	eax,'off '
111
	jz	@f
112
	cmp	eax,'on  '
113
	jnz	close
5849 pathoswith 114
	inc	ecx
5854 pathoswith 115
@@:
116
	mcall	21,12
117
	jmp	close
5849 pathoswith 118
;---------------------------------------------------------------
31 halyavin 119
START:
5854 pathoswith 120
	mcall	68,11
121
	stdcall dll.Load, @IMPORT
122
	push	eax
123
	test	eax,eax
124
	jnz	close
31 halyavin 125
 
5854 pathoswith 126
	cmp	[param],dword 'BOOT'
127
	jz	BootSettings
128
	pop	eax
5874 pathoswith 129
 
5849 pathoswith 130
; get current settings
131
	mcall	26,5
5854 pathoswith 132
	dec	eax
4825 gtament 133
	mov	[syslang],eax
127 mario79 134
 
5849 pathoswith 135
	mcall	26,11
136
	mov	[lba_read],eax
4825 gtament 137
 
5849 pathoswith 138
	mcall	26,12
139
	mov	[pci_acc],eax
4825 gtament 140
 
5849 pathoswith 141
	mcall	18,8,1
142
	mov	[speaker_mute],eax
31 halyavin 143
 
5849 pathoswith 144
	mcall	48,9
145
	mov	[fontSmoothing],eax
31 halyavin 146
 
5874 pathoswith 147
	mcall	48,11
148
	mov	[fontSize],eax
149
 
5924 pathoswith 150
loadtxt:
151
	cmp	[syslang],3
152
	jz	.ru
153
	cmp	[syslang],5
154
	jz	.et
155
	mov	[text],texteng
156
	jmp	draw_window
157
.et:
158
	mov	[text],textet
159
	jmp	draw_window
160
.ru:
161
	mov	[text],textrus
4825 gtament 162
 
5924 pathoswith 163
draw_window:
164
	mcall	12,1
165
	mov	ecx,50*65536+32*(4+stringsAmount)
166
	mcall	0,<50,700>,,0xB4111199,0,title
167
; Main buttons
168
	mov	eax,8
169
	mov	ecx,6*65536+26
170
	mov	edx,4
171
	mov	esi,0x5580c0
172
	mov	ebp,stringsAmount
173
@@:
174
	mcall	,<490,24>
175
	inc	edx
176
	mcall	,<526,24>
177
	inc	edx
178
	mcall	,<562,120>
179
	inc	edx
180
	add	ecx,32*65536
181
	dec	ebp
182
	jnz	@b
183
; APPLY ALL
184
	add	ecx,32*65536
185
	mcall	,<514,168>,,3,0x005588dd
186
; SAVE ALL
187
	add	ecx,32*65536
188
	dec	edx
189
	mcall
190
	mcall	12,2
191
 
5849 pathoswith 192
draw_infotext:
193
	mov	eax,[syslang]
194
	mov	edi,[text]
5854 pathoswith 195
	lea	esi,[eax*8+langs]
5849 pathoswith 196
	add	edi,28
197
	movsd
198
	movsd
199
	add	edi,LLL-8
31 halyavin 200
 
5849 pathoswith 201
	mov	eax,[lba_read]
202
	call	onoff
203
	mov	[edi],ebx
4825 gtament 204
 
5849 pathoswith 205
	mov	eax,[pci_acc]
206
	call	onoff
207
	mov	[edi+LLL],ebx
31 halyavin 208
 
5849 pathoswith 209
	mov	eax,[speaker_mute]
210
	call	onoff
211
	mov	[edi+LLL*2],ebx
4825 gtament 212
 
5849 pathoswith 213
	mov	ebx,'SUBP'
214
	mov	ecx,'IXEL'
215
	cmp	[fontSmoothing],2
216
	jz	@f
217
	mov	eax,[fontSmoothing]
218
	call	onoff
219
	mov	ecx,'    '
220
@@:
221
	mov	[edi+LLL*3],ebx
222
	mov	[edi+LLL*3+4],ecx
4825 gtament 223
 
5874 pathoswith 224
	mov	eax,[fontSize]
225
	mov	bl, 10
226
	div	bl
227
	add	ax, '00'
228
	mov	[edi+LLL*4],ax
5924 pathoswith 229
; draw text
230
	mcall	13,<342,96>,32*stringsAmount,80111199h
4825 gtament 231
	mov	eax,4
5849 pathoswith 232
	mov	ebx,6*65536+11
233
	mov	ecx,1ffffffh
234
	mov	edx,[text]
4825 gtament 235
	mov	esi,LLL
5849 pathoswith 236
	mov	ebp,stringsAmount
2478 mario79 237
newline:
4825 gtament 238
	mcall
5849 pathoswith 239
	add	ebx,32
4825 gtament 240
	add	edx,esi
241
	dec	ebp
242
	jnz	newline
31 halyavin 243
 
5849 pathoswith 244
	mov	ebp,2
245
	add	ebx,32
2478 mario79 246
@@:
4825 gtament 247
	mcall
5849 pathoswith 248
	add	ebx,32
4825 gtament 249
	add	edx,esi
250
	dec	ebp
251
	jnz	@b
5849 pathoswith 252
 
253
still:
254
	mcall	10
255
	cmp	eax,1
256
	jz	draw_window
257
 
258
	cmp	eax,2
259
	jz	key
260
 
261
	cmp	eax,3
262
	jz	button
263
 
264
	jmp	still
265
;---------------------------------------------------------------
266
key:
267
	mcall	2
268
	jmp	still
269
;---------------------------------------------------------------
270
button:
271
	mcall	17
272
	shr	eax,8
273
	call	dword[eax*4+buttonTab-4]
274
	jmp	draw_infotext
275
close:
276
	pop	eax
277
	mcall	-1
278
language1:
279
	dec	[syslang]
5854 pathoswith 280
	jns	@f
5875 pathoswith 281
	mov	[syslang],7
5854 pathoswith 282
	jmp	@f
5849 pathoswith 283
language2:
284
	inc	[syslang]
5875 pathoswith 285
	cmp	[syslang],8
5874 pathoswith 286
	jc	@f
5854 pathoswith 287
	mov	[syslang],0
288
@@:
5924 pathoswith 289
	pop	eax
5854 pathoswith 290
	jmp	loadtxt
5849 pathoswith 291
LBA1:
292
	btr	[lba_read],0
293
	ret
294
LBA2:
295
	bts	[lba_read],0
296
	ret
297
PCI1:
298
	btr	[pci_acc],0
299
	ret
300
PCI2:
301
	bts	[pci_acc],0
302
	ret
303
SPEAKER1:
304
	btr	[speaker_mute],0
305
	ret
306
SPEAKER2:
307
	bts	[speaker_mute],0
308
	ret
309
font1:
310
	cmp	[fontSmoothing],0
311
	jz	@f
312
	dec	[fontSmoothing]
313
	ret
314
font2:
315
	cmp	[fontSmoothing],2
316
	jz	@f
317
	inc	[fontSmoothing]
5874 pathoswith 318
	ret
319
fontSize1:
320
	cmp	[fontSize],10
321
	jc	@f
322
	dec	[fontSize]
5849 pathoswith 323
@@:
324
	ret
5874 pathoswith 325
fontSize2:
326
	inc	[fontSize]
327
	ret
5854 pathoswith 328
apply_all:
329
	call	_lba_read
330
	call	_pci_acc
331
	call	_speaker_mute
5874 pathoswith 332
	call	fontApply
333
	call	fontSizeApply
5854 pathoswith 334
_syslang:
335
	mov	ecx,[syslang]
336
	inc	ecx
337
	mcall	21,5
338
	ret
339
_lba_read:
340
	mcall	21,11,[lba_read]
341
	ret
342
_pci_acc:
343
	mcall	21,12,[pci_acc]
344
	ret
345
fontApply:
346
	mcall	48,10,[fontSmoothing]
347
	ret
5874 pathoswith 348
fontSizeApply:
349
	mcall	48,12,[fontSize]
350
	ret
5854 pathoswith 351
_speaker_mute:
352
	mcall	18,8,1
353
	cmp	[speaker_mute],eax
5874 pathoswith 354
	jz	@f
5854 pathoswith 355
	inc	ecx
356
	mcall	18
5874 pathoswith 357
@@:
5854 pathoswith 358
	ret
5849 pathoswith 359
;---------------------------------------------------------------
31 halyavin 360
onoff:
5854 pathoswith 361
	cmp	[syslang],3
362
	jz	.ru
363
	cmp	[syslang],5
364
	jz	.et
365
	mov	ebx,'OFF '
366
	test	eax,eax
367
	jz	@f
368
	mov	ebx,'ON  '
369
	ret
370
.ru:
371
	mov	ebx,'НЕТ '
372
	test	eax,eax
373
	jz	@f
4825 gtament 374
	mov	ebx,'ДА  '
375
	ret
5854 pathoswith 376
.et:
377
	mov	ebx,'V─L.'
378
	test	eax,eax
379
	jz	@f
4825 gtament 380
	mov	ebx,'SEES'
5854 pathoswith 381
@@:
4825 gtament 382
	ret
5854 pathoswith 383
;---------------------------------------------------------------
384
saveAll:
385
; system language
386
	mov	eax,[syslang]
387
	mov	ax, [eax*2+langMarks]
388
	mov	[param],eax
389
	invoke	ini.set_str, sz_ini, sz_system, sz_language, param, 2
390
 
5874 pathoswith 391
; font size
392
	invoke	ini.set_int, sz_ini, sz_system, sz_fontSize, [fontSize]
5854 pathoswith 393
 
394
; font smoothing
395
	mov	dword[param],'off'
396
	cmp	[fontSmoothing],0
397
	jz	@f
398
	mov	dword[param],'on '
399
	cmp	[fontSmoothing],1
400
	jz	@f
401
	mov	dword[param],'sbp'
402
@@:
403
	invoke	ini.set_str, sz_ini, sz_system, sz_fontSmooth, param, 3
404
 
405
; system speaker
406
	mov	dword[param],'off'
407
	cmp	[speaker_mute],0
408
	jz	@f
409
	mov	dword[param],'on '
410
@@:
411
	invoke	ini.set_str, sz_ini, sz_system, sz_speaker, param, 3
412
 
413
; LBA access for applications
414
	mov	dword[param],'off'
415
	cmp	[lba_read],0
416
	jz	@f
417
	mov	dword[param],'on '
418
@@:
419
	invoke	ini.set_str, sz_ini, sz_low_level, sz_lba, param, 3
420
 
421
; PCI access for applications
422
	mov	dword[param],'off'
423
	cmp	[pci_acc],0
424
	jz	@f
425
	mov	dword[param],'on '
426
@@:
427
	invoke	ini.set_str, sz_ini, sz_low_level, sz_pci, param, 3
4825 gtament 428
	ret
5849 pathoswith 429
;---------------------------------------------------------------
5924 pathoswith 430
; DATA
5849 pathoswith 431
align 4
432
buttonTab:	; button handler pointers: -,+,apply
433
	dd close
434
	dd saveAll
435
	dd apply_all
436
	dd language1
437
	dd language2
438
	dd _syslang
439
	dd LBA1
440
	dd LBA2
441
	dd _lba_read
442
	dd PCI1
443
	dd PCI2
444
	dd _pci_acc
445
	dd SPEAKER1
446
	dd SPEAKER2
447
	dd _speaker_mute
448
	dd font1
449
	dd font2
450
	dd fontApply
5874 pathoswith 451
	dd fontSize1
452
	dd fontSize2
453
	dd fontSizeApply
31 halyavin 454
 
5854 pathoswith 455
@IMPORT:
456
library libini, 'libini.obj'
457
import	libini, \
458
	ini.get_str, 'ini_get_str',\
459
	ini.get_int, 'ini_get_int',\
460
	ini.set_str, 'ini_set_str',\
461
	ini.set_int, 'ini_set_int'
5849 pathoswith 462
 
5854 pathoswith 463
title	db "System settings",0
464
sz_ini	db "/sys/settings/system.ini",0
5849 pathoswith 465
 
5854 pathoswith 466
sz_system	db "system",0
467
sz_language	db "language",0
5874 pathoswith 468
sz_fontSize	db "font height",0
5854 pathoswith 469
sz_fontSmooth	db "font smoothing",0
470
sz_speaker	db "speaker mute",0
471
 
472
sz_mouse	db "mouse",0
473
sz_speed	db "speed",0
5973 leency 474
sz_acceleration	db "acceleration",0
475
sz_double_click_delay	db "double_click_delay",0
5854 pathoswith 476
 
477
sz_low_level	db "low-level",0
478
sz_lba		db "LBA",0
479
sz_pci		db "PCI",0
480
 
5849 pathoswith 481
LLL = 56
482
stringsAmount = 6
483
 
484
align 4
485
langs:
5875 pathoswith 486
db 'ENGLISH FINNISH GERMAN  RUSSIAN FRENCH  ESTONIANSPANISH ITALIAN '
5854 pathoswith 487
langMarks:
5875 pathoswith 488
db	'enfiderufretspit'
5849 pathoswith 489
 
31 halyavin 490
textrus:
5849 pathoswith 491
db 'Язык системы              :              <  >  Применить'
492
db 'Включить LBA              :              -  +  Применить'
493
db 'Доступ к шине PCI         :              -  +  Применить'
494
db 'Выключить SPEAKER         :              -  +  Применить'
495
db 'Сглаживание шрифтов       :              -  +  Применить'
5874 pathoswith 496
db 'Высота шрифтов            :              -  +  Применить'
4825 gtament 497
 
5849 pathoswith 498
db 'ВНИМАНИЕ:                                  Применить все'
499
db 'НЕ ЗАБУДЬТЕ СОХРАНИТЬ НАСТРОЙКИ            Сохранить все'
500
 
31 halyavin 501
texteng:
5849 pathoswith 502
db 'System language           :              <  >    Apply  '
5854 pathoswith 503
db 'Allow LBA access          :              -  +    Apply  '
504
db 'Allow PCI access          :              -  +    Apply  '
505
db 'Disable SPEAKER           :              -  +    Apply  '
5849 pathoswith 506
db 'Font smoothing            :              -  +    Apply  '
5874 pathoswith 507
db 'Font height               :              -  +    Apply  '
31 halyavin 508
 
5849 pathoswith 509
db 'NOTE:                                        Apply all  '
510
db 'SAVE YOUR SETTINGS BEFORE QUITING KOLIBRI    Save all   '
511
 
3927 kaitz 512
textet:
5849 pathoswith 513
db 'S№steemi keel             :              <  >   Kinnita '
514
db 'LBA lugemine lubatud      :              -  +   Kinnita '
515
db 'PCI juurdepффs programm.  :              -  +   Kinnita '
5854 pathoswith 516
db 'Disable SPEAKER           :              -  +   Kinnita '
5849 pathoswith 517
db 'Font smoothing            :              -  +   Kinnita '
5874 pathoswith 518
db 'Font height               :              -  +   Kinnita '
31 halyavin 519
 
5849 pathoswith 520
db 'M─RKUS:                                    Kinnita kїik '
521
db 'SALVESTA SEADED ENNE KOLIBRIST V─LJUMIST   Salvesta kїik'
522
 
2478 mario79 523
IM_END:
5924 pathoswith 524
 
525
text	dd  ?
526
 
527
syslang 	dd  ?
528
lba_read	dd  ?
529
pci_acc 	dd  ?
530
speaker_mute	dd  ?
531
fontSmoothing	dd  ?
532
fontSize	dd  ?
533
 
5854 pathoswith 534
param:
4825 gtament 535
	rb 1024
5849 pathoswith 536
I_END: