Subversion Repositories Kolibri OS

Rev

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