Subversion Repositories Kolibri OS

Rev

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