Skip to content

Commit 26b7318

Browse files
Merge pull request #1257 from dgruss/songchecking
Add startup song validation flag
2 parents d9137ff + c27ab98 commit 26b7318

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/base/UCommandLine.pas

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ TCMDParams = class
6060
Debug: boolean;
6161
Benchmark: boolean;
6262
NoLog: boolean;
63+
CheckSongs: boolean;
6364
ScreenMode: TScreenMode;
6465
Joypad: boolean;
6566
Split: TSplitMode;
@@ -89,6 +90,7 @@ TCMDParams = class
8990
const
9091
cHelp = 'help';
9192
cDebug = 'debug';
93+
cCheckSongs = 'check-songs';
9294
cMediaInterfaces = 'showinterfaces';
9395

9496

@@ -128,6 +130,7 @@ procedure TCMDParams.ShowHelp();
128130
writeln(' ----------------------------------------------------------');
129131
writeln(' '+ Fmt(cMediaInterfaces) +' : Show in-use media interfaces');
130132
writeln(' '+ Fmt(cDebug) +' : Display Debugging info');
133+
writeln(' '+ Fmt(cCheckSongs) +' : Fully validate song files during startup');
131134
writeln;
132135

133136
platform.halt;
@@ -141,6 +144,7 @@ procedure TCMDParams.ResetVariables;
141144
Debug := false;
142145
Benchmark := False;
143146
NoLog := false;
147+
CheckSongs := false;
144148
ScreenMode := scmDefault;
145149
Joypad := False;
146150
Split := spmDefault;
@@ -185,6 +189,8 @@ procedure TCMDParams.ReadParamInfo;
185189
// boolean triggers
186190
if (Command = 'debug') then
187191
Debug := True
192+
else if (Command = cCheckSongs) then
193+
CheckSongs := True
188194
else if (Command = 'benchmark') then
189195
Benchmark := True
190196
else if (Command = 'nolog') then

src/base/USongs.pas

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ implementation
168168
uses
169169
StrUtils,
170170
SDL2,
171+
UCommandLine,
171172
UFiles,
172173
UGraphic,
173174
UMain,
@@ -450,7 +451,7 @@ procedure TSongs.LoadSongFromFile(const FilePath: IPath);
450451
begin
451452
Song := TSong.Create(FilePath);
452453

453-
if Song.Analyse then
454+
if Song.Analyse(false, false, false, false, 0, Params.CheckSongs) then
454455
SongList.Add(Song)
455456
else
456457
begin

0 commit comments

Comments
 (0)