Subversion Repositories Kolibri OS

Rev

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