1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
|
unit UIni;
interface
uses IniFiles, ULog, SysUtils;
type
TIni = class
Name: array[0..11] of string;
// Templates for Names Mod
NameTeam: array[0..2] of string;
NameTemplate: array[0..11] of string;
//Filename of the opened iniFile
Filename: string;
// Game
Players: integer;
Difficulty: integer;
Language: integer;
Tabs: integer;
tabs_temp: integer;
Sorting: integer;
sorting_temp: integer;
ShuffleTime: integer;
Debug: integer;
LoadFaultySongs:integer;
LoadFaultySongs_temp: integer;
NewPartyPoints: integer;
ShowCredits: integer;
NewPartySelectionMode: integer;
// Graphics
Screens: integer;
Resolution: integer;
Depth: integer;
FullScreen: integer;
TextureSize: integer;
Oscilloscope: integer;
Spectrum: integer;
Spectrograph: integer;
MovieSize: integer;
MoviePreview: integer;
AspectCorrect: integer;
PerformanceMode:integer;
EnablePBO: integer;
// Sound
MicBoost: integer;
ClickAssist: integer;
BeatClick: integer;
SavePlayback: integer;
Threshold: integer;
Delay: integer;
LipSync: integer;
//Song Preview
PreviewVolume: integer;
PreviewFading: integer;
// Lyrics
LyricsFont: integer;
LyricsEffect: integer;
Solmization: integer;
// Themes
Theme: integer;
SkinNo: integer;
Color: integer;
// Record
Card: integer; // not saved in config.ini
CardList: array of record
Name: string;
Input: integer;
ChannelL: integer;
ChannelR: integer;
end;
EnableWebCam: integer;
WebCamID: integer;
WebCamMediaID: integer;
// Advanced
LoadAnimation: integer;
EffectSing: integer;
ScreenFade: integer;
AskbeforeDel: integer;
OnSongClick: integer;
LineBonus: integer;
PartyPopup: integer;
SumPlayers: integer;
DuelRatio: integer;
PossibleScore: integer;
LogSession: integer;
// Soundcards
SoundCard: array[0..7, 1..2] of integer;
procedure Load;
procedure Save;
procedure SaveNames;
procedure SaveLevel;
end;
var
Ini: TIni;
IResolution: array of string;
ILanguage: array of string;
ITheme: array of string;
ISkin: array of string;
ICard: array of string;
IInput: array of string;
const
IPlayers: array[0..4] of string = ('1', '2', '3', '4', '6');
IDifficulty: array[0..2] of string = ('Easy', 'Medium', 'Hard');
ITabs: array[0..1] of string = ('Off', 'On');
ISorting: array[0..9] of string = ('Edition', 'Genre', 'Language', 'Folder', 'Title', 'Artist', 'Title2', 'Artist2', 'Random', 'Year');
sEdition = 0;
sGenre = 1;
sLanguage = 2;
sFolder = 3;
sTitle = 4;
sArtist = 5;
sTitle2 = 6;
sArtist2 = 7;
sRandom = 8;
sYear = 9;
IShuffleTime: array[0..10] of string = ('Off',
'15 Sec',
'30 Sec',
'45 Sec',
'60 Sec',
'75 Sec',
'90 Sec',
'105 Sec',
'120 Sec',
'MAX',
'FULL');
IDebug: array[0..1] of string = ('Off', 'On');
ILoadFaultySongs: array[0..1] of string = ('Off', 'On');
INewPartyPoints: array[0..1] of string = ('Off', 'On');
IShowCredits: array[0..1] of string = ('Off', 'On');
INewPartySelectionMode: array[0..1] of string = ('Off', 'On');
IScreens: array[0..1] of string = ('1', '2');
IFullScreen: array[0..1] of string = ('Off', 'On');
IDepth: array[0..1] of string = ('16 bit', '32 bit');
ITextureSize: array[0..2] of string = ('128', '256', '512');
//SingBar Mod
IOscilloscope: array[0..2] of string = ('Off', 'Osci', 'Bar');
//IOscilloscope: array[0..1] of string = ('Off', 'On');
ISpectrum: array[0..1] of string = ('Off', 'On');
ISpectrograph: array[0..1] of string = ('Off', 'On');
IMovieSize: array[0..3] of string = ('Half', 'Full', 'Preview only', 'Off');
IMoviePreview: array[0..1] of string = ('Off', 'On');
IAspectCorrect: array[0..2] of String = ('Stretch', 'Crop', 'LetterBox');
IPerformanceMode:array[0..1] of string = ('Off', 'On');
IEnablePBO: array[0..1] of string = ('Off', 'On');
IEnableWebCam: array[0..1] of string = ('Off', 'On');
IMicBoost: array[0..3] of string = ('Off', '+6dB', '+12dB', '+18dB');
IClickAssist: array[0..1] of string = ('Off', 'On');
IBeatClick: array[0..1] of string = ('Off', 'On');
ISavePlayback: array[0..1] of string = ('Off', 'On');
IThreshold: array[0..3] of string = ('5%', '10%', '15%', '20%');
IDelay: array[0..9] of string = ('0ms', '10ms', '20ms', '30ms', '40ms', '50ms', '60ms', '70ms', '80ms', '90ms');
ILipSync: array[0..20] of string = ('0ms', '10ms', '20ms', '30ms', '40ms', '50ms', '60ms', '70ms', '80ms', '90ms', '100ms', '110ms', '120ms', '130ms', '140ms', '150ms', '160ms', '170ms', '180ms', '190ms', '200ms');
//Song Preview
IPreviewVolume: array[0..10] of string = ('Off', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%');
IPreviewFading: array[0..5] of string = ('Off', '1 Sec', '2 Secs', '3 Secs', '4 Secs', '5 Secs');
ILyricsFont: array[0..2] of string = ('Plain', 'OLine1', 'OLine2');
ILyricsEffect: array[0..3] of string = ('Simple', 'Zoom', 'Slide', 'Ball');
ISolmization: array[0..3] of string = ('Off', 'Euro', 'Jap', 'American');
IColor: array[0..8] of string = ('Blue', 'Green', 'Pink', 'Red', 'Violet', 'Orange', 'Yellow', 'Brown', 'Black');
// Advanced
ILoadAnimation: array[0..1] of string = ('Off', 'On');
IEffectSing: array[0..1] of string = ('Off', 'On');
IScreenFade: array[0..1] of String = ('Off', 'On');
IAskbeforeDel: array[0..1] of string = ('Off', 'On');
IOnSongClick: array[0..2] of string = ('Sing', 'Select Players', 'Open Menu');
ILineBonus: array[0..2] of string = ('Off', 'At Score', 'At Notes');
IPartyPopup: array[0..1] of string = ('Off', 'On');
ISumPlayers: array[0..2] of string = ('Never', 'Dynamic', 'Always');
IDuelRatio: array[0..9] of string = ('normal', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%');
IPossibleScore: array[0..3] of string = ('Off', 'Bar', 'Numbers', 'Name');
ILogSession: array[0..1] of string = ('Off', 'On');
IChannel: array[0..6] of string = ('Off', '1', '2', '3', '4', '5', '6');
implementation
uses UFiles, SDL, ULanguage, USkins, URecord, UCommandLine;
procedure TIni.Load;
var
IniFile: TMemIniFile;
ThemeIni: TMemIniFile;
Tekst: string;
Pet: integer;
B: boolean;
I, I2, I3: integer;
S: string;
Modes: PPSDL_Rect;
SR: TSearchRec; //Skin List Patch
found: boolean;
txt: string;
num: integer;
function GetFileName (S: String):String;
begin
//Result := copy (S,0,StrRScan (PChar(S),char('.'))+1);
Result := copy (S,0,Pos ('.ini',S)-1);
end;
begin
GamePath := ExtractFilePath(ParamStr(0));
if (Params.ConfigFile <> '') then
try
IniFile := TMemIniFile.Create(Params.ConfigFile);
except
IniFile := TMemIniFile.Create(GamePath + 'config.ini');
end
else
IniFile := TMemIniFile.Create(GamePath + 'config.ini');
// Name
for I := 0 to 11 do
Ini.Name[I] := IniFile.ReadString('Name', 'P'+IntToStr(I+1), 'Player'+IntToStr(I+1));
// Templates for Names Mod
for I := 0 to 2 do
Ini.NameTeam[I] := IniFile.ReadString('NameTeam', 'T'+IntToStr(I+1), 'Team'+IntToStr(I+1));
for I := 0 to 11 do
Ini.NameTemplate[I] := IniFile.ReadString('NameTemplate', 'Name'+IntToStr(I+1), 'Template'+IntToStr(I+1));
// Players
Tekst := IniFile.ReadString('Game', 'Players', IPlayers[0]);
for Pet := 0 to High(IPlayers) do
if Tekst = IPlayers[Pet] then Ini.Players := Pet;
// Difficulty
Tekst := IniFile.ReadString('Game', 'Difficulty', 'Easy');
for Pet := 0 to High(IDifficulty) do
if Tekst = IDifficulty[Pet] then Ini.Difficulty := Pet;
// Language
Tekst := IniFile.ReadString('Game', 'Language', 'English');
for Pet := 0 to High(ILanguage) do
if Tekst = ILanguage[Pet] then Ini.Language := Pet;
// Language.ChangeLanguage(ILanguage[Ini.Language]);
// Tabs
Tekst := IniFile.ReadString('Game', 'Tabs', ITabs[0]);
for Pet := 0 to High(ITabs) do
if Tekst = ITabs[Pet] then Ini.Tabs := Pet;
tabs_temp := Tabs;
// Sorting
Tekst := IniFile.ReadString('Game', 'Sorting', ISorting[0]);
for Pet := 0 to High(ISorting) do
if Tekst = ISorting[Pet] then Ini.Sorting := Pet;
sorting_temp := Sorting;
// ShuffleTime
Tekst := IniFile.ReadString('Game', 'ShuffleTime', 'Off');
for Pet := 0 to High(IShuffleTime) do
if Tekst = IShuffleTime[Pet] then Ini.ShuffleTime := Pet;
// Debug
Tekst := IniFile.ReadString('Game', 'Debug', IDebug[0]);
for Pet := 0 to High(IDebug) do
if Tekst = IDebug[Pet] then Ini.Debug := Pet;
// Load faulty songs
Tekst := IniFile.ReadString('Game', 'LoadFaultySongs', ILoadFaultySongs[0]);
for Pet := 0 to High(ILoadFaultySongs) do
if Tekst = ILoadFaultySongs[Pet] then Ini.LoadFaultySongs := Pet;
LoadFaultySongs_temp := LoadFaultySongs;
// NewPartyPoints
Tekst := IniFile.ReadString('Game', 'NewPartyPoints', INewPartyPoints[1]);
for Pet := 0 to High(INewPartyPoints) do
if Tekst = INewPartyPoints[Pet] then Ini.NewPartyPoints := Pet;
// ShowCredits
Tekst := IniFile.ReadString('Game', 'ShowCredits', IShowCredits[0]);
for Pet := 0 to High(IShowCredits) do
if Tekst = IShowCredits[Pet] then Ini.ShowCredits := Pet;
// NewPartySelectionMode
Tekst := IniFile.ReadString('Game', 'NewPartySelectionMode', INewPartySelectionMode[1]);
for Pet := 0 to High(INewPartySelectionMode) do
if Tekst = INewPartySelectionMode[Pet] then Ini.NewPartySelectionMode := Pet;
// Screens
Tekst := IniFile.ReadString('Graphics', 'Screens', IScreens[0]);
for Pet := 0 to High(IScreens) do
if Tekst = IScreens[Pet] then Ini.Screens := Pet;
// Resolution
SetLength(IResolution, 0);
Modes := SDL_ListModes(nil, SDL_OPENGL or SDL_FULLSCREEN); // Check if there are any modes available
//this should solve the biggest wine problem | THANKS Linnex (11.11.07)
// if no modes were set, then fallback to 800x600
// as per http://sourceforge.net/forum/message.php?msg_id=4544965
// THANKS : linnex at users.sourceforge.net
if (modes = PPSDL_Rect( 0 ) ) then
begin //NO modes available => Fallback to 800x600
SetLength(IResolution, 1);
IResolution[High(IResolution)] := '800x600';
end
{Else If (modes = PPSDL_Rect(-1)) then
begin
//All Resolutions are Available
//This may be handled, too
// to-do : for future Version
end}
Else //Add all valid Modes
begin
I := 0;
Repeat
SetLength(IResolution, I + 1);
IResolution[I] := IntToStr((modes^)^.w) + 'x' + IntToStr((modes^)^.h);
Inc(I);
Inc(modes);
Until (modes^)=nil;
end;
// reverse order
for I := 0 to (Length(IResolution) div 2) - 1 do begin
S := IResolution[I];
IResolution[I] := IResolution[High(IResolution)-I];
IResolution[High(IResolution)-I] := S;
end;
Tekst := IniFile.ReadString('Graphics', 'Resolution', '800x600');
for Pet := 0 to High(IResolution) do
if Tekst = IResolution[Pet] then Ini.Resolution := Pet;
// FullScreen
Tekst := IniFile.ReadString('Graphics', 'FullScreen', 'On');
for Pet := 0 to High(IFullScreen) do
if Tekst = IFullScreen[Pet] then Ini.FullScreen := Pet;
// Resolution
Tekst := IniFile.ReadString('Graphics', 'Depth', '32 bit');
for Pet := 0 to High(IDepth) do
if Tekst = IDepth[Pet] then Ini.Depth := Pet;
// Texture Size
Tekst := IniFile.ReadString('Graphics', 'TextureSize', ITextureSize[1]);
for Pet := 0 to High(ITextureSize) do
if Tekst = ITextureSize[Pet] then Ini.TextureSize := Pet;
// Oscilloscope
Tekst := IniFile.ReadString('Graphics', 'Oscilloscope', 'Bar');
for Pet := 0 to High(IOscilloscope) do
if Tekst = IOscilloscope[Pet] then Ini.Oscilloscope := Pet;
// Spectrum
Tekst := IniFile.ReadString('Graphics', 'Spectrum', 'Off');
for Pet := 0 to High(ISpectrum) do
if Tekst = ISpectrum[Pet] then Ini.Spectrum := Pet;
// Spectrograph
Tekst := IniFile.ReadString('Graphics', 'Spectrograph', 'Off');
for Pet := 0 to High(ISpectrograph) do
if Tekst = ISpectrograph[Pet] then Ini.Spectrograph := Pet;
// MovieSize
Tekst := IniFile.ReadString('Graphics', 'MovieSize', IMovieSize[1]);
found := false;
for Pet := 0 to High(IMovieSize) do
begin
if Tekst = IMovieSize[Pet] then
begin
Ini.MovieSize := Pet;
found := true;
end;
end;
// MoviePreview
Tekst := IniFile.ReadString('Graphics', 'MoviePreview', IMoviePreview[1]);
for Pet := 0 to High(IMoviePreview) do
if Tekst = IMoviePreview[Pet] then Ini.MoviePreview := Pet;
// AspectCorrection
Tekst := IniFile.ReadString('Graphics', 'AspectCorrect', IAspectCorrect[1]);
for Pet := 0 to High(IAspectCorrect) do
if Tekst = IAspectCorrect[Pet] then Ini.AspectCorrect := Pet;
// PerformanceMode
Tekst := IniFile.ReadString('Graphics', 'PerformanceMode', IPerformanceMode[0]);
for Pet := 0 to High(IPerformanceMode) do
if Tekst = IPerformanceMode[Pet] then Ini.PerformanceMode := Pet;
// enable Pixel Buffer Object
Tekst := IniFile.ReadString('Graphics', 'EnablePBO', IEnablePBO[0]);
for Pet := 0 to High(IEnablePBO) do
if Tekst = IEnablePBO[Pet] then Ini.EnablePBO := Pet;
// MicBoost
Tekst := IniFile.ReadString('Sound', 'MicBoost', 'Off');
for Pet := 0 to High(IMicBoost) do
if Tekst = IMicBoost[Pet] then Ini.MicBoost := Pet;
// ClickAssist
Tekst := IniFile.ReadString('Sound', 'ClickAssist', 'Off');
for Pet := 0 to High(IClickAssist) do
if Tekst = IClickAssist[Pet] then Ini.ClickAssist := Pet;
// BeatClick
Tekst := IniFile.ReadString('Sound', 'BeatClick', IBeatClick[0]);
for Pet := 0 to High(IBeatClick) do
if Tekst = IBeatClick[Pet] then Ini.BeatClick := Pet;
// SavePlayback
Tekst := IniFile.ReadString('Sound', 'SavePlayback', ISavePlayback[0]);
for Pet := 0 to High(ISavePlayback) do
if Tekst = ISavePlayback[Pet] then Ini.SavePlayback := Pet;
// Threshold
Tekst := IniFile.ReadString('Sound', 'Threshold', IThreshold[2]);
for Pet := 0 to High(IThreshold) do
if Tekst = IThreshold[Pet] then Ini.Threshold := Pet;
// Delay
Tekst := IniFile.ReadString('Sound', 'Delay', IDelay[5]);
for Pet := 0 to High(IDelay) do
if Tekst = IDelay[Pet] then Ini.Delay := Pet;
// LipSync
Tekst := IniFile.ReadString('Sound', 'LipSync', ILipSync[0]);
for Pet := 0 to High(ILipSync) do
if Tekst = ILipSync[Pet] then Ini.LipSync := Pet;
//Song Preview
Tekst := IniFile.ReadString('Sound', 'PreviewVolume', IPreviewVolume[7]);
for Pet := 0 to High(IPreviewVolume) do
if Tekst = IPreviewVolume[Pet] then Ini.PreviewVolume := Pet;
Tekst := IniFile.ReadString('Sound', 'PreviewFading', IPreviewFading[1]);
for Pet := 0 to High(IPreviewFading) do
if Tekst = IPreviewFading[Pet] then Ini.PreviewFading := Pet;
// Lyrics Font
Tekst := IniFile.ReadString('Lyrics', 'LyricsFont', ILyricsFont[2]);
for Pet := 0 to High(ILyricsFont) do
if Tekst = ILyricsFont[Pet] then Ini.LyricsFont := Pet;
// Lyrics Effect
Tekst := IniFile.ReadString('Lyrics', 'LyricsEffect', ILyricsEffect[1]);
for Pet := 0 to High(ILyricsEffect) do
if Tekst = ILyricsEffect[Pet] then Ini.LyricsEffect := Pet;
// Solmization
Tekst := IniFile.ReadString('Lyrics', 'Solmization', ISolmization[0]);
for Pet := 0 to High(ISolmization) do
if Tekst = ISolmization[Pet] then Ini.Solmization := Pet;
// Theme
//Theme List Patch
//I2 Saves the no of the (Standard-) Theme
I2 := 0;
//I counts is the cur. Theme no
I := 0;
SetLength(ITheme, 0);
FindFirst('Themes\*.ini',faAnyFile,SR);
Repeat
//Read Themename from Theme
ThemeIni := TMemIniFile.Create(SR.Name);
Tekst := UpperCase(ThemeIni.ReadString('Theme','Name',GetFileName(SR.Name)));
ThemeIni.Free;
//if Default Theme then save Themeno to I2
if (Tekst = 'BLUE SENSATION') then
I2 := I;
//Search for Skins for this Theme
for Pet := low(Skin.Skin) to high(Skin.Skin) do
begin
if UpperCase(Skin.Skin[Pet].Theme) = Tekst then
begin
SetLength(ITheme, Length(ITheme)+1);
ITheme[High(ITheme)] := GetFileName(SR.Name);
break;
end;
end;
Inc(I);
Until FindNext(SR) <> 0;
FindClose(SR);
//Theme List Patch End }
//No Theme Found
if (Length(ITheme)=0) then
begin
Log.CriticalError('Could not find any valid Themes.');
end;
Tekst := IniFile.ReadString('Themes', 'Theme', ITheme[I2]);
Ini.Theme := 0;
for Pet := 0 to High(ITheme) do
if Uppercase(Tekst) = Uppercase(ITheme[Pet]) then Ini.Theme := Pet;
// Skin
Skin.onThemeChange;
Ini.SkinNo := 0;
Tekst := IniFile.ReadString('Themes', 'Skin', ISkin[0]);
for Pet := 0 to High(ISkin) do
if Tekst = ISkin[Pet] then Ini.SkinNo := Pet;
// Color
Tekst := IniFile.ReadString('Themes', 'Color', IColor[0]);
for Pet := 0 to High(IColor) do
if Tekst = IColor[Pet] then Ini.Color := Pet;
// Record - load ini list
SetLength(CardList, 0);
I := 1;
while (IniFile.ValueExists('Record', 'DeviceName' + IntToStr(I)) = true) do begin
//Automatically Delete not Existing Sound Cards
S := IniFile.ReadString('Record', 'DeviceName' + IntToStr(I), '');
//{
B := False;
//Look for Soundcard
for I2 := 0 to High(Recording.SoundCard) do
begin
if (S = Trim(Recording.SoundCard[I2].Description)) then
begin
B := True;
Break;
end;
end;
if B then
begin //}
I3 := Length(CardList);
SetLength(CardList, I3+1);
Ini.CardList[I3].Name := S;
Ini.CardList[I3].Input := IniFile.ReadInteger('Record', 'Input' + IntToStr(I), 0);
Ini.CardList[I3].ChannelL := IniFile.ReadInteger('Record', 'ChannelL' + IntToStr(I), 0);
Ini.CardList[I3].ChannelR := IniFile.ReadInteger('Record', 'ChannelR' + IntToStr(I), 0);
end;
Inc(I);
end;
// Record - append detected soundcards
for I := 0 to High(Recording.SoundCard) do
begin
B := False;
For I2 := 0 to High(CardList) do
begin //Search for Card in List
if (CardList[I2].Name = Trim(Recording.SoundCard[I].Description)) then
begin
B := True;
Break;
end;
end;
//If not in List -> Add
If not B then
begin
I3 := Length(CardList);
SetLength(CardList, I3+1);
CardList[I3].Name := Trim(Recording.SoundCard[I].Description);
CardList[I3].Input := 0;
CardList[I3].ChannelL := 0;
CardList[I3].ChannelR := 0;
// default for new users
if (Length(CardList) = 1) then
CardList[I].ChannelL := 1;
end;
end;
// enable WebCam
Tekst := IniFile.ReadString('Record', 'EnableWebCam', IEnableWebCam[0]);
for Pet := 0 to High(IEnableWebCam) do
if Tekst = IEnableWebCam[Pet] then Ini.EnableWebCam := Pet;
// WebCamID
Tekst := IniFile.ReadString('Record', 'WebCamID', '0');
if not TryStrToInt(Tekst, Ini.WebCamID) then
Ini.WebCamID := 0;
// WebCamMediaID
Tekst := IniFile.ReadString('Record', 'WebCamMediaID', '0');
if not TryStrToInt(Tekst, Ini.WebCamMediaID) then
Ini.WebCamMediaID := 0;
//Advanced Settings
// LoadAnimation
Tekst := IniFile.ReadString('Advanced', 'LoadAnimation', 'On');
for Pet := 0 to High(ILoadAnimation) do
if Tekst = ILoadAnimation[Pet] then Ini.LoadAnimation := Pet;
// ScreenFade
Tekst := IniFile.ReadString('Advanced', 'ScreenFade', 'On');
for Pet := 0 to High(IScreenFade) do
if Tekst = IScreenFade[Pet] then Ini.ScreenFade := Pet;
// EffectSing
Tekst := IniFile.ReadString('Advanced', 'EffectSing', 'On');
for Pet := 0 to High(IEffectSing) do
if Tekst = IEffectSing[Pet] then Ini.EffectSing := Pet;
// AskbeforeDel
Tekst := IniFile.ReadString('Advanced', 'AskbeforeDel', 'On');
for Pet := 0 to High(IAskbeforeDel) do
if Tekst = IAskbeforeDel[Pet] then Ini.AskbeforeDel := Pet;
// OnSongClick
Tekst := IniFile.ReadString('Advanced', 'OnSongClick', 'Sing');
for Pet := 0 to High(IOnSongClick) do
if Tekst = IOnSongClick[Pet] then Ini.OnSongClick := Pet;
// Linebonus
Tekst := IniFile.ReadString('Advanced', 'LineBonus', 'At Score');
for Pet := 0 to High(ILineBonus) do
if Tekst = ILineBonus[Pet] then Ini.LineBonus := Pet;
// PartyPopup
Tekst := IniFile.ReadString('Advanced', 'PartyPopup', 'On');
for Pet := 0 to High(IPartyPopup) do
if Tekst = IPartyPopup[Pet] then Ini.PartyPopup := Pet;
// SumPlayers
Tekst := IniFile.ReadString('Advanced', 'SumPlayers', 'Dynamic');
for Pet := 0 to High(ISumPlayers) do
if Tekst = ISumPlayers[Pet] then Ini.SumPlayers := Pet;
// DuelRatio
Tekst := IniFile.ReadString('Advanced', 'DuelRatio', IDuelRatio[0]);
for Pet := 0 to High(IDuelRatio) do
if Tekst = IDuelRatio[Pet] then Ini.DuelRatio := Pet;
// PossibleScore
Tekst := IniFile.ReadString('Advanced', 'PossibleScore', IPossibleScore[1]);
for Pet := 0 to High(IPossibleScore) do
if Tekst = IPossibleScore[Pet] then Ini.PossibleScore := Pet;
// LogSession
Tekst := IniFile.ReadString('Advanced', 'LogSession', ILogSession[0]);
for Pet := 0 to High(ILogSession) do
if Tekst = ILogSession[Pet] then Ini.LogSession := Pet;
// SongPath
if (Params.SongPath <> '') then
SongPaths[0] := IncludeTrailingPathDelimiter(Params.SongPath)
else
begin
txt := IniFile.ReadString('Path', 'Songs', ' ');
if (DirectoryExists(txt)) then
begin
num := Length(SongPaths);
SetLength(SongPaths, num+1);
SongPaths[num] := IncludeTrailingPathDelimiter(txt);
end;
I := 1;
repeat
txt := IniFile.ReadString('Directories', 'SongDir'+IntToStr(I), ' ');
if (DirectoryExists(txt)) then
begin
num := Length(SongPaths);
SetLength(SongPaths, num+1);
SongPaths[num] := IncludeTrailingPathDelimiter(txt);
Inc(I);
end;
until (not DirectoryExists(txt));
end;
Filename := IniFile.FileName;
IniFile.Free;
if not found then
begin
Ini.MovieSize := 1;
Save;
end;
end;
procedure TIni.Save;
var
IniFile: TIniFile;
Tekst: string;
I: Integer;
S: String;
begin
//if not (FileExists(GamePath + 'config.ini') and FileIsReadOnly(GamePath + 'config.ini')) then begin
if not (FileExists(Filename) and FileIsReadOnly(Filename)) then begin
IniFile := TIniFile.Create(Filename);
// Players
Tekst := IPlayers[Ini.Players];
IniFile.WriteString('Game', 'Players', Tekst);
// Difficulty
Tekst := IDifficulty[Ini.Difficulty];
IniFile.WriteString('Game', 'Difficulty', Tekst);
// Language
Tekst := ILanguage[Ini.Language];
IniFile.WriteString('Game', 'Language', Tekst);
// Tabs
Tekst := ITabs[Ini.Tabs];
IniFile.WriteString('Game', 'Tabs', Tekst);
tabs_temp := Tabs;
// Sorting
Tekst := ISorting[Ini.Sorting];
IniFile.WriteString('Game', 'Sorting', Tekst);
sorting_temp := Sorting;
//ShuffleTime
Tekst := IShuffleTime[Ini.ShuffleTime];
IniFile.WriteString('Game', 'ShuffleTime', Tekst);
// Debug
Tekst := IDebug[Ini.Debug];
IniFile.WriteString('Game', 'Debug', Tekst);
// Load faulty songs
Tekst := ILoadFaultySongs[Ini.LoadFaultySongs];
IniFile.WriteString('Game', 'LoadFaultySongs', Tekst);
// NewPartyPoints
Tekst := INewPartyPoints[Ini.NewPartyPoints];
IniFile.WriteString('Game', 'NewPartyPoints', Tekst);
// ShowCredits
Tekst := IShowCredits[Ini.ShowCredits];
IniFile.WriteString('Game', 'ShowCredits', Tekst);
// NewPartySelectionMode
Tekst := IShowCredits[Ini.NewPartySelectionMode];
IniFile.WriteString('Game', 'NewPartySelectionMode', Tekst);
// Screens
Tekst := IScreens[Ini.Screens];
IniFile.WriteString('Graphics', 'Screens', Tekst);
// FullScreen
Tekst := IFullScreen[Ini.FullScreen];
IniFile.WriteString('Graphics', 'FullScreen', Tekst);
// Resolution
Tekst := IResolution[Ini.Resolution];
IniFile.WriteString('Graphics', 'Resolution', Tekst);
// Depth
Tekst := IDepth[Ini.Depth];
IniFile.WriteString('Graphics', 'Depth', Tekst);
// Resolution
Tekst := ITextureSize[Ini.TextureSize];
IniFile.WriteString('Graphics', 'TextureSize', Tekst);
// Oscilloscope
Tekst := IOscilloscope[Ini.Oscilloscope];
IniFile.WriteString('Graphics', 'Oscilloscope', Tekst);
// Spectrum
Tekst := ISpectrum[Ini.Spectrum];
IniFile.WriteString('Graphics', 'Spectrum', Tekst);
// Spectrograph
Tekst := ISpectrograph[Ini.Spectrograph];
IniFile.WriteString('Graphics', 'Spectrograph', Tekst);
// Movie Size
Tekst := IMovieSize[Ini.MovieSize];
IniFile.WriteString('Graphics', 'MovieSize', Tekst);
// Movie Size
Tekst := IMoviePreview[Ini.MoviePreview];
IniFile.WriteString('Graphics', 'MoviePreview', Tekst);
// AspectCorrect
Tekst := IAspectCorrect[Ini.AspectCorrect];
IniFile.WriteString('Graphics', 'AspectCorrect', Tekst);
// PerformanceMode
Tekst := IPerformanceMode[Ini.PerformanceMode];
IniFile.WriteString('Graphics', 'PerformanceMode', Tekst);
// enable Pixel Buffer Object
Tekst := IEnablePBO[Ini.EnablePBO];
IniFile.WriteString('Graphics', 'EnablePBO', Tekst);
// MicBoost
Tekst := IMicBoost[Ini.MicBoost];
IniFile.WriteString('Sound', 'MicBoost', Tekst);
// ClickAssist
Tekst := IClickAssist[Ini.ClickAssist];
IniFile.WriteString('Sound', 'ClickAssist', Tekst);
// BeatClick
Tekst := IBeatClick[Ini.BeatClick];
IniFile.WriteString('Sound', 'BeatClick', Tekst);
// Threshold
Tekst := IThreshold[Ini.Threshold];
IniFile.WriteString('Sound', 'Threshold', Tekst);
// Delay
Tekst := IDelay[Ini.Delay];
IniFile.WriteString('Sound', 'Delay', Tekst);
// LipSync
Tekst := ILipSync[Ini.LipSync];
IniFile.WriteString('Sound', 'LipSync', Tekst);
// Song Preview
Tekst := IPreviewVolume[Ini.PreviewVolume];
IniFile.WriteString('Sound', 'PreviewVolume', Tekst);
Tekst := IPreviewFading[Ini.PreviewFading];
IniFile.WriteString('Sound', 'PreviewFading', Tekst);
// SavePlayback
Tekst := ISavePlayback[Ini.SavePlayback];
IniFile.WriteString('Sound', 'SavePlayback', Tekst);
// Lyrics Font
Tekst := ILyricsFont[Ini.LyricsFont];
IniFile.WriteString('Lyrics', 'LyricsFont', Tekst);
// Lyrics Effect
Tekst := ILyricsEffect[Ini.LyricsEffect];
IniFile.WriteString('Lyrics', 'LyricsEffect', Tekst);
// Solmization
Tekst := ISolmization[Ini.Solmization];
IniFile.WriteString('Lyrics', 'Solmization', Tekst);
// Theme
Tekst := ITheme[Ini.Theme];
IniFile.WriteString('Themes', 'Theme', Tekst);
// Skin
Tekst := ISkin[Ini.SkinNo];
IniFile.WriteString('Themes', 'Skin', Tekst);
// Color
Tekst := IColor[Ini.Color];
IniFile.WriteString('Themes', 'Color', Tekst);
// Record
for I := 0 to High(CardList) do begin
S := IntToStr(I+1);
Tekst := CardList[I].Name;
IniFile.WriteString('Record', 'DeviceName' + S, Tekst);
Tekst := IntToStr(CardList[I].Input);
IniFile.WriteString('Record', 'Input' + S, Tekst);
Tekst := IntToStr(CardList[I].ChannelL);
IniFile.WriteString('Record', 'ChannelL' + S, Tekst);
Tekst := IntToStr(CardList[I].ChannelR);
IniFile.WriteString('Record', 'ChannelR' + S, Tekst);
end;
//Log.LogError(InttoStr(Length(CardList)) + ' Cards Saved');
// enable WebCam
Tekst := IEnableWebCam[Ini.EnableWebCam];
IniFile.WriteString('Record', 'EnableWebCam', Tekst);
// WebCamID
Tekst := IntToStr(Ini.WebCamID);
IniFile.WriteString('Record', 'WebCamID', Tekst);
// WebCamMediaID
Tekst := IntToStr(Ini.WebCamMediaID);
IniFile.WriteString('Record', 'WebCamMediaID', Tekst);
//Advanced Settings
//LoadAnimation
Tekst := ILoadAnimation[Ini.LoadAnimation];
IniFile.WriteString('Advanced', 'LoadAnimation', Tekst);
//EffectSing
Tekst := IEffectSing[Ini.EffectSing];
IniFile.WriteString('Advanced', 'EffectSing', Tekst);
//ScreenFade
Tekst := IScreenFade[Ini.ScreenFade];
IniFile.WriteString('Advanced', 'ScreenFade', Tekst);
//AskbeforeDel
Tekst := IAskbeforeDel[Ini.AskbeforeDel];
IniFile.WriteString('Advanced', 'AskbeforeDel', Tekst);
//OnSongClick
Tekst := IOnSongClick[Ini.OnSongClick];
IniFile.WriteString('Advanced', 'OnSongClick', Tekst);
//Line Bonus
Tekst := ILineBonus[Ini.LineBonus];
IniFile.WriteString('Advanced', 'LineBonus', Tekst);
//Party Popup
Tekst := IPartyPopup[Ini.PartyPopup];
IniFile.WriteString('Advanced', 'PartyPopup', Tekst);
//SumPlayers
Tekst := ISumPlayers[Ini.SumPlayers];
IniFile.WriteString('Advanced', 'SumPlayers', Tekst);
//DuelRatio
Tekst := IDuelRatio[Ini.DuelRatio];
IniFile.WriteString('Advanced', 'DuelRatio', Tekst);
//PossibleScore
Tekst := IPossibleScore[Ini.PossibleScore];
IniFile.WriteString('Advanced', 'PossibleScore', Tekst);
//LogSession
Tekst := ILogSession[Ini.LogSession];
IniFile.WriteString('Advanced', 'LogSession', Tekst);
// Directories (add a template if section is missing, from 1.1)
if (not IniFile.SectionExists('Path')) then
IniFile.WriteString('Path', 'Songs', ' ');
if (not IniFile.SectionExists('Directories')) then
IniFile.WriteString('Directories', 'SongDir1', ' ');
IniFile.Free;
end;
end;
procedure TIni.SaveNames;
var
IniFile: TIniFile;
I: integer;
begin
//if not FileIsReadOnly(GamePath + 'config.ini') then begin
//IniFile := TIniFile.Create(GamePath + 'config.ini');
if not FileIsReadOnly(Filename) then begin
IniFile := TIniFile.Create(Filename);
//Name
// Templates for Names Mod
for I := 1 to 12 do
IniFile.WriteString('Name', 'P' + IntToStr(I), Ini.Name[I-1]);
for I := 1 to 3 do
IniFile.WriteString('NameTeam', 'T' + IntToStr(I), Ini.NameTeam[I-1]);
for I := 1 to 12 do
IniFile.WriteString('NameTemplate', 'Name' + IntToStr(I), Ini.NameTemplate[I-1]);
IniFile.Free;
end;
end;
procedure TIni.SaveLevel;
var
IniFile: TIniFile;
begin
//if not FileIsReadOnly(GamePath + 'config.ini') then begin
//IniFile := TIniFile.Create(GamePath + 'config.ini');
if not FileIsReadOnly(Filename) then begin
IniFile := TIniFile.Create(Filename);
// Difficulty
IniFile.WriteString('Game', 'Difficulty', IDifficulty[Ini.Difficulty]);
IniFile.Free;
end;
end;
end.
|