aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/base/USong.pas19
-rw-r--r--src/screens/UScreenSing.pas5
2 files changed, 22 insertions, 2 deletions
diff --git a/src/base/USong.pas b/src/base/USong.pas
index 0f36662b..3679863b 100644
--- a/src/base/USong.pas
+++ b/src/base/USong.pas
@@ -129,6 +129,8 @@ type
Mult : integer;
MultBPM : integer;
+ LastError: String;
+
constructor Create (); overload;
constructor Create ( const aFileName : WideString ); overload;
function LoadSong: boolean;
@@ -159,6 +161,8 @@ begin
MultBPM := 4;
fFileName := aFileName;
+ LastError := '';
+
if fileexists( aFileName ) then
begin
self.Path := ExtractFilePath( aFileName );
@@ -195,9 +199,11 @@ var
begin
Result := false;
+ LastError := '';
if not FileExists(Path + PathDelim + FileName) then
begin
+ LastError := 'File not found';
Log.LogError('File not found: "' + Path + PathDelim + FileName + '"', 'TSong.LoadSong()');
exit;
end;
@@ -240,7 +246,7 @@ begin
begin //Song File Corrupted - No Notes
CloseFile(SongFile);
Log.LogError('Could not load txt File, no Notes found: ' + FileName);
- Result := False;
+ LastError := 'Can''t find any notes';
Exit;
end;
Read(SongFile, TempC);
@@ -361,6 +367,16 @@ begin
end;
CloseFile(SongFile);
+
+ For I := 0 to High(Lines) do
+ begin
+ If ((Both) or (I = 0)) AND (Length(Lines[I].Line) < 2) then
+ begin
+ LastError := 'Can''t find any linebreaks';
+ Log.LogError('Error Loading File, Can''t find any Linebreaks: "' + fFileName + '"');
+ exit;
+ end;
+ end;
except
try
CloseFile(SongFile);
@@ -368,6 +384,7 @@ begin
end;
+ LastError := 'Error reading line ' + inttostr(FileLineNo);
Log.LogError('Error Loading File: "' + fFileName + '" in Line ' + inttostr(FileLineNo));
exit;
end;
diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas
index e280855d..1aa9dcde 100644
--- a/src/screens/UScreenSing.pas
+++ b/src/screens/UScreenSing.pas
@@ -440,7 +440,10 @@ begin
// select new song in party mode
if ScreenSong.Mode = smPartyMode then
ScreenSong.SelectRandomSong();
- ScreenPopupError.ShowPopup(Language.Translate('ERROR_CORRUPT_SONG'));
+ if (Length(CurrentSong.LastError) > 0) then
+ ScreenPopupError.ShowPopup(Language.Translate('ERROR_CORRUPT_SONG') + '\n' + CurrentSong.LastError)
+ else
+ ScreenPopupError.ShowPopup(Language.Translate('ERROR_CORRUPT_SONG'));
// FIXME: do we need this?
CurrentSong.Path := CatSongs.Song[CatSongs.Selected].Path;
Exit;