aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Game/Code/Classes/UAudioInput_Bass.pas2
-rw-r--r--Game/Code/Classes/UCommandLine.pas6
-rw-r--r--Game/Code/Classes/UDataBase.pas17
-rw-r--r--Game/Code/Classes/UDraw.pas8
-rw-r--r--Game/Code/Classes/UFiles.pas44
-rw-r--r--Game/Code/Classes/UHooks.pas22
-rw-r--r--Game/Code/Classes/ULog.pas15
-rw-r--r--Game/Code/Classes/UMain.pas42
-rw-r--r--Game/Code/Classes/UServices.pas18
-rw-r--r--Game/Code/Classes/USingScores.pas22
-rw-r--r--Game/Code/Classes/USongs.pas26
-rw-r--r--Game/Code/Classes/UThemes.pas4
-rw-r--r--Game/Code/Classes/UTime.pas51
-rw-r--r--Game/Code/Classes/UVideo.pas35
-rw-r--r--Game/Code/Screens/UScreenCredits.pas2
-rw-r--r--Game/Code/Screens/UScreenSing.pas3
-rw-r--r--Game/Code/Screens/UScreenSong.pas81
-rw-r--r--Game/Code/switches.inc7
18 files changed, 120 insertions, 285 deletions
diff --git a/Game/Code/Classes/UAudioInput_Bass.pas b/Game/Code/Classes/UAudioInput_Bass.pas
index adc3bf3e..cfb77038 100644
--- a/Game/Code/Classes/UAudioInput_Bass.pas
+++ b/Game/Code/Classes/UAudioInput_Bass.pas
@@ -244,11 +244,9 @@ begin
Inc(SourceIndex);
end;
- //Writeln('BASS_RecordFree');
// FIXME: this call hangs in FPC (windows) every 2nd time USDX is called.
// Maybe because the sound-device was not released properly?
BASS_RecordFree;
- //Writeln('BASS_RecordFree - Done');
Inc(DeviceIndex);
end;
diff --git a/Game/Code/Classes/UCommandLine.pas b/Game/Code/Classes/UCommandLine.pas
index 92163f89..e7398b50 100644
--- a/Game/Code/Classes/UCommandLine.pas
+++ b/Game/Code/Classes/UCommandLine.pas
@@ -55,6 +55,7 @@ var
const
cHelp = 'help';
+ cDebug = 'debug';
cMediaInterfaces = 'showinterfaces';
cUseLocalPaths = 'localpaths';
@@ -72,7 +73,7 @@ uses SysUtils,
Constructor TCMDParams.Create;
begin
- if FindCmdLineSwitch( cHelp ) then
+ if FindCmdLineSwitch( cHelp ) or FindCmdLineSwitch( 'h' ) then
showhelp();
ResetVariables;
@@ -97,6 +98,9 @@ begin
writeln( ' ----------------------------------------------------------' );
writeln( ' '+s( cMediaInterfaces ) + #9 + ' : Show in-use media interfaces' );
writeln( ' '+s( cUseLocalPaths ) + #9 + ' : Use relative paths' );
+ writeln( ' '+s( cDebug ) + #9 + ' : Display Debugging info' );
+
+
writeln( '' );
diff --git a/Game/Code/Classes/UDataBase.pas b/Game/Code/Classes/UDataBase.pas
index ef3c28fe..dcf32315 100644
--- a/Game/Code/Classes/UDataBase.pas
+++ b/Game/Code/Classes/UDataBase.pas
@@ -62,7 +62,10 @@ var
implementation
-uses IniFiles, SysUtils;
+uses
+ IniFiles,
+ ULog,
+ SysUtils;
const
cUS_Scores = 'us_scores';
@@ -74,7 +77,7 @@ const
Procedure TDataBaseSystem.Init(const Filename: string);
begin
- writeln( 'TDataBaseSystem.Init ('+Filename+') @ '+ floattostr( now() ) );
+ debugWriteln( 'TDataBaseSystem.Init ('+Filename+') @ '+ floattostr( now() ) );
//Open Database
ScoreDB := TSqliteDatabase.Create( Filename );
@@ -85,13 +88,13 @@ begin
if not ScoreDB.TableExists( cUS_Scores ) then
begin
ScoreDB.execsql('CREATE TABLE `'+cUS_Scores+'` (`SongID` INT( 11 ) NOT NULL , `Difficulty` INT( 1 ) NOT NULL , `Player` VARCHAR( 150 ) NOT NULL , `Score` INT( 5 ) NOT NULL );');
- writeln( 'TDataBaseSystem.Init - CREATED US_Scores' );
+ debugWriteln( 'TDataBaseSystem.Init - CREATED US_Scores' );
end;
if not ScoreDB.TableExists( cUS_Songs ) then
begin
ScoreDB.execsql('CREATE TABLE `'+cUS_Songs+'` (`ID` INTEGER PRIMARY KEY, `Artist` VARCHAR( 255 ) NOT NULL , `Title` VARCHAR( 255 ) NOT NULL , `TimesPlayed` int(5) NOT NULL );');
- writeln( 'TDataBaseSystem.Init - CREATED US_Songs' );
+ debugWriteln( 'TDataBaseSystem.Init - CREATED US_Songs' );
end;
//Not possible because of String Limitation to 255 Chars //Need to rewrite Wrapper
@@ -100,8 +103,8 @@ begin
finally
- writeln( cUS_Songs +' Exist : ' + inttostr( integer(ScoreDB.TableExists( cUS_Songs )) ) );
- writeln( cUS_Scores +' Exist : ' + inttostr( integer(ScoreDB.TableExists( cUS_Scores )) ) );
+ debugWriteln( cUS_Songs +' Exist : ' + inttostr( integer(ScoreDB.TableExists( cUS_Songs )) ) );
+ debugWriteln( cUS_Scores +' Exist : ' + inttostr( integer(ScoreDB.TableExists( cUS_Scores )) ) );
//ScoreDB.Free;
end;
@@ -112,7 +115,7 @@ end;
//--------------------
Destructor TDataBaseSystem.Free;
begin
- writeln( 'TDataBaseSystem.Free' );
+ debugWriteln( 'TDataBaseSystem.Free' );
freeandnil( ScoreDB );
end;
diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas
index 7e8e9849..18c347a7 100644
--- a/Game/Code/Classes/UDraw.pas
+++ b/Game/Code/Classes/UDraw.pas
@@ -250,14 +250,6 @@ begin
lTmpA := (Right-Left);
lTmpB := (Lines[NrCzesci].Line[Lines[NrCzesci].Current].End_ - Lines[NrCzesci].Line[Lines[NrCzesci].Current].StartNote);
- {$IFDEF LAZARUS}
-(*
- writeln( 'UDRAW (Right-Left) : ' + floattostr( lTmpA ) );
- writeln( 'UDRAW : ' + floattostr( lTmpB ) );
- writeln( '' );
-*)
- {$ENDIF}
-
if ( lTmpA > 0 ) AND
( lTmpB > 0 ) THEN
begin
diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas
index b7c231db..076db441 100644
--- a/Game/Code/Classes/UFiles.pas
+++ b/Game/Code/Classes/UFiles.pas
@@ -82,32 +82,32 @@ begin
AssignFile(SongFile, Name);
Rewrite(SongFile);
- WriteLn(SongFile, '#TITLE:' + Song.Title + '');
- WriteLn(SongFile, '#ARTIST:' + Song.Artist);
+ Writeln(SongFile, '#TITLE:' + Song.Title + '');
+ Writeln(SongFile, '#ARTIST:' + Song.Artist);
- if Song.Creator <> '' then WriteLn(SongFile, '#CREATOR:' + Song.Creator);
- if Song.Edition <> 'Unknown' then WriteLn(SongFile, '#EDITION:' + Song.Edition);
- if Song.Genre <> 'Unknown' then WriteLn(SongFile, '#GENRE:' + Song.Genre);
- if Song.Language <> 'Unknown' then WriteLn(SongFile, '#LANGUAGE:' + Song.Language);
+ if Song.Creator <> '' then Writeln(SongFile, '#CREATOR:' + Song.Creator);
+ if Song.Edition <> 'Unknown' then Writeln(SongFile, '#EDITION:' + Song.Edition);
+ if Song.Genre <> 'Unknown' then Writeln(SongFile, '#GENRE:' + Song.Genre);
+ if Song.Language <> 'Unknown' then Writeln(SongFile, '#LANGUAGE:' + Song.Language);
- WriteLn(SongFile, '#MP3:' + Song.Mp3);
+ Writeln(SongFile, '#MP3:' + Song.Mp3);
- if Song.Cover <> '' then WriteLn(SongFile, '#COVER:' + Song.Cover);
- if Song.Background <> '' then WriteLn(SongFile, '#BACKGROUND:' + Song.Background);
- if Song.Video <> '' then WriteLn(SongFile, '#VIDEO:' + Song.Video);
- if Song.VideoGAP <> 0 then WriteLn(SongFile, '#VIDEOGAP:' + FloatToStr(Song.VideoGAP));
- if Song.Resolution <> 4 then WriteLn(SongFile, '#RESOLUTION:' + IntToStr(Song.Resolution));
- if Song.NotesGAP <> 0 then WriteLn(SongFile, '#NOTESGAP:' + IntToStr(Song.NotesGAP));
- if Song.Start <> 0 then WriteLn(SongFile, '#START:' + FloatToStr(Song.Start));
- if Song.Finish <> 0 then WriteLn(SongFile, '#END:' + IntToStr(Song.Finish));
- if Relative then WriteLn(SongFile, '#RELATIVE:yes');
+ if Song.Cover <> '' then Writeln(SongFile, '#COVER:' + Song.Cover);
+ if Song.Background <> '' then Writeln(SongFile, '#BACKGROUND:' + Song.Background);
+ if Song.Video <> '' then Writeln(SongFile, '#VIDEO:' + Song.Video);
+ if Song.VideoGAP <> 0 then Writeln(SongFile, '#VIDEOGAP:' + FloatToStr(Song.VideoGAP));
+ if Song.Resolution <> 4 then Writeln(SongFile, '#RESOLUTION:' + IntToStr(Song.Resolution));
+ if Song.NotesGAP <> 0 then Writeln(SongFile, '#NOTESGAP:' + IntToStr(Song.NotesGAP));
+ if Song.Start <> 0 then Writeln(SongFile, '#START:' + FloatToStr(Song.Start));
+ if Song.Finish <> 0 then Writeln(SongFile, '#END:' + IntToStr(Song.Finish));
+ if Relative then Writeln(SongFile, '#RELATIVE:yes');
- WriteLn(SongFile, '#BPM:' + FloatToStr(Song.BPM[0].BPM / 4));
- WriteLn(SongFile, '#GAP:' + FloatToStr(Song.GAP));
+ Writeln(SongFile, '#BPM:' + FloatToStr(Song.BPM[0].BPM / 4));
+ Writeln(SongFile, '#GAP:' + FloatToStr(Song.GAP));
RelativeSubTime := 0;
for B := 1 to High(CurrentSong.BPM) do
- WriteLn(SongFile, 'B ' + FloatToStr(CurrentSong.BPM[B].StartBeat) + ' ' + FloatToStr(CurrentSong.BPM[B].BPM/4));
+ Writeln(SongFile, 'B ' + FloatToStr(CurrentSong.BPM[B].StartBeat) + ' ' + FloatToStr(CurrentSong.BPM[B].BPM/4));
for C := 0 to Lines.High do begin
for N := 0 to Lines.Line[C].HighNote do begin
@@ -123,7 +123,7 @@ begin
S := NoteState + IntToStr(Start-RelativeSubTime) + ' ' + IntToStr(Length) + ' ' + IntToStr(Tone) + ' ' + Text;
- WriteLn(SongFile, S);
+ Writeln(SongFile, S);
end; // with
end; // N
@@ -135,13 +135,13 @@ begin
' ' + IntToStr(Lines.Line[C+1].Start - RelativeSubTime);
RelativeSubTime := Lines.Line[C+1].Start;
end;
- WriteLn(SongFile, S);
+ Writeln(SongFile, S);
end;
end; // C
- WriteLn(SongFile, 'E');
+ Writeln(SongFile, 'E');
CloseFile(SongFile);
end;
diff --git a/Game/Code/Classes/UHooks.pas b/Game/Code/Classes/UHooks.pas
index 8b33959d..9c9e7dca 100644
--- a/Game/Code/Classes/UHooks.pas
+++ b/Game/Code/Classes/UHooks.pas
@@ -66,7 +66,9 @@ var
HookManager: THookManager;
implementation
-uses UCore;
+uses
+ ULog,
+ UCore;
//------------
// Create - Creates Class and Set Standard Values
@@ -82,7 +84,7 @@ begin
SpaceinEvents := SpacetoAllocate;
{$IFDEF DEBUG}
- WriteLn('HookManager: Succesful Created.');
+ debugWriteLn('HookManager: Succesful Created.');
{$ENDIF}
end;
@@ -109,7 +111,7 @@ begin
end;
{$IFDEF DEBUG}
- WriteLn('HookManager: Found Space for Event at Handle: ''' + InttoStr(Result+1) + '');
+ debugWriteLn('HookManager: Found Space for Event at Handle: ''' + InttoStr(Result+1) + '');
{$ENDIF}
end
else
@@ -127,12 +129,12 @@ begin
Inc(Result);
{$IFDEF DEBUG}
- WriteLn('HookManager: Add Event succesful: ''' + EventName + '');
+ debugWriteLn('HookManager: Add Event succesful: ''' + EventName + '');
{$ENDIF}
end
{$IFDEF DEBUG}
else
- WriteLn('HookManager: Trying to ReAdd Event: ''' + EventName + '');
+ debugWriteLn('HookManager: Trying to ReAdd Event: ''' + EventName + '');
{$ENDIF}
end;
@@ -160,7 +162,7 @@ begin
end;
{$IFDEF DEBUG}
- WriteLn('HookManager: Removed Event succesful: ''' + Events[hEvent].Name + '');
+ debugWriteLn('HookManager: Removed Event succesful: ''' + Events[hEvent].Name + '');
{$ENDIF}
//Free the Event
@@ -170,7 +172,7 @@ begin
{$IFDEF DEBUG}
else
- WriteLn('HookManager: Try to Remove not Existing Event. Handle: ''' + InttoStr(hEvent) + '');
+ debugWriteLn('HookManager: Try to Remove not Existing Event. Handle: ''' + InttoStr(hEvent) + '');
{$ENDIF}
end;
@@ -239,7 +241,7 @@ begin
Events[EventIndex].LastSubscriber := Cur;
{$IFDEF DEBUG}
- WriteLn('HookManager: Add Subscriber to Event ''' + Events[EventIndex].Name + ''' succesful. Handle: ''' + InttoStr(Result) + ''' Owner: ' + InttoStr(Cur.Owner));
+ debugWriteLn('HookManager: Add Subscriber to Event ''' + Events[EventIndex].Name + ''' succesful. Handle: ''' + InttoStr(Result) + ''' Owner: ' + InttoStr(Cur.Owner));
{$ENDIF}
end;
end;
@@ -298,7 +300,7 @@ begin
FreeSubscriber(EventIndex, Last, Cur);
{$IFDEF DEBUG}
- WriteLn('HookManager: Del Subscriber from Event ''' + Events[EventIndex].Name + ''' succesful. Handle: ''' + InttoStr(hSubscriber) + '');
+ debugWriteLn('HookManager: Del Subscriber from Event ''' + Events[EventIndex].Name + ''' succesful. Handle: ''' + InttoStr(hSubscriber) + '');
{$ENDIF}
//Set Result and Break the Loop
@@ -353,7 +355,7 @@ begin
end;
{$IFDEF DEBUG}
- WriteLn('HookManager: Called Chain from Event ''' + Events[EventIndex].Name + ''' succesful. Result: ''' + InttoStr(Result) + '');
+ debugWriteLn('HookManager: Called Chain from Event ''' + Events[EventIndex].Name + ''' succesful. Result: ''' + InttoStr(Result) + '');
{$ENDIF}
end;
diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas
index c30bf676..4e976ab4 100644
--- a/Game/Code/Classes/ULog.pas
+++ b/Game/Code/Classes/ULog.pas
@@ -53,6 +53,7 @@ type
end;
procedure SafeWriteLn(const msg: string); {$IFDEF HasInline}inline;{$ENDIF}
+procedure debugWriteln( aString : String );
var
Log: TLog;
@@ -66,8 +67,8 @@ uses
SysUtils,
DateUtils,
//UFiles,
- UMain,
URecord,
+ UMain,
UTime,
//UIni, // JB - Seems to not be needed.
{$IFDEF FPC}
@@ -136,10 +137,20 @@ begin
SDL_CondSignal(ConsoleCond);
SDL_mutexV(ConsoleMutex);
{$ELSE}
- WriteLn(msg);
+ debugWriteln(msg);
{$ENDIF}
end;
+procedure debugWriteln( aString : String );
+begin
+ {$IFDEF CONSOLE}
+ if FindCmdLineSwitch( cDebug ) then
+ writeln( 'DEBUG - '+aString );
+ {$ENDIF}
+
+end;
+
+
constructor TLog.Create;
begin
{$IFDEF FPC}
diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas
index f9762c1e..a68445b0 100644
--- a/Game/Code/Classes/UMain.pas
+++ b/Game/Code/Classes/UMain.pas
@@ -22,11 +22,6 @@ uses
UScreenSing,
USong,
OpenGL12,
- {$IFDEF UseSerialPort}
- //zlportio, //you can disable it and all PortWriteB calls
- {$ENDIF}
- //ULCD, //TODO: maybe LCD Support as Plugin?
- //ULight, //TODO: maybe Light Support as Plugin?
UThemes;
type
@@ -113,8 +108,8 @@ procedure NewBeatC(Sender: TScreenSing); // executed when on then new beat for c
procedure NewBeatD(Sender: TScreenSing); // executed when on then new beat for detection
//procedure NewHalf; // executed when in the half between beats
procedure NewNote(Sender: TScreenSing); // detect note
-function GetMidBeat(Time: real): real;
-function GetTimeFromBeat(Beat: integer): real;
+function GetMidBeat(Time: real): real;
+function GetTimeFromBeat(Beat: integer): real;
procedure ClearScores(PlayerNum: integer);
implementation
@@ -139,6 +134,9 @@ uses
UPluginDefs,
UPlatform;
+
+
+
procedure Main;
var
WndTitle: string;
@@ -225,36 +223,6 @@ begin
Log.BenchmarkEnd(1);
Log.LogBenchmark('Load Sound Settings', 1);
- // LCD //TODO: maybe LCD Support as Plugin?
- //Log.BenchmarkStart(1);
- //Log.LogStatus('Load LCD', 'Initialization');
- //LCD := TLCD.Create;
- (*
- if Ini.LPT = 1 then
- begin
- //LCD.HalfInterface := true;
- LCD.Enable;
- LCD.Clear;
- LCD.WriteText(1, ' UltraStar ');
- LCD.WriteText(2, ' Loading... ');
- end;
- Log.BenchmarkEnd(1);
- Log.LogBenchmark('Loading LCD', 1);
- *)
- // Light //TODO: maybe Light Support as Plugin?
- (*
- Log.BenchmarkStart(1);
- Log.LogStatus('Load Light', 'Initialization');
- Light := TLight.Create;
- if Ini.LPT = 2 then
- begin
- Light.Enable;
- end;
- Log.BenchmarkEnd(1);
- Log.LogBenchmark('Loading Light', 1);
- *)
-
-
// Theme
Log.BenchmarkStart(1);
Log.LogStatus('Load Themes', 'Initialization');
diff --git a/Game/Code/Classes/UServices.pas b/Game/Code/Classes/UServices.pas
index be1fcf2c..7cc811bc 100644
--- a/Game/Code/Classes/UServices.pas
+++ b/Game/Code/Classes/UServices.pas
@@ -65,7 +65,9 @@ var
ServiceManager: TServiceManager;
implementation
-uses UCore;
+uses
+ ULog,
+ UCore;
//------------
// Create - Creates Class and Set Standard Values
@@ -85,7 +87,7 @@ begin
NextHandle := 1;
{$IFDEF DEBUG}
- WriteLn('ServiceManager: Succesful created!');
+ debugWriteln('ServiceManager: Succesful created!');
{$ENDIF}
end;
@@ -141,14 +143,14 @@ begin
LastService := Cur;
{$IFDEF DEBUG}
- WriteLn('ServiceManager: Service added: ''' + ServiceName + ''', Handle: ' + InttoStr(Cur.Self));
+ debugWriteln('ServiceManager: Service added: ''' + ServiceName + ''', Handle: ' + InttoStr(Cur.Self));
{$ENDIF}
//Inc Next Handle
Inc(NextHandle);
end
{$IFDEF DEBUG}
- else WriteLn('ServiceManager: Try to readd Service: ' + ServiceName);
+ else debugWriteln('ServiceManager: Try to readd Service: ' + ServiceName);
{$ENDIF}
end;
end;
@@ -190,7 +192,7 @@ begin
end;
{$IFDEF DEBUG}
- WriteLn('ServiceManager: Removed Service succesful: ' + Cur.Name);
+ debugWriteln('ServiceManager: Removed Service succesful: ' + Cur.Name);
{$ENDIF}
//Free Memory
@@ -237,7 +239,7 @@ begin
end;
{$IFDEF DEBUG}
- WriteLn('ServiceManager: Service ''' + ServiceName + ''' called. Result: ' + InttoStr(Result));
+ debugWriteln('ServiceManager: Service ''' + ServiceName + ''' called. Result: ' + InttoStr(Result));
{$ENDIF}
end;
@@ -288,7 +290,7 @@ begin
Result := Integer(ServiceCache[I]);
{$IFDEF DEBUG}
- WriteLn('ServiceManager: Found Service in Cache: ''' + ServiceName + '''');
+ debugWriteln('ServiceManager: Found Service in Cache: ''' + ServiceName + '''');
{$ENDIF}
Break;
@@ -308,7 +310,7 @@ begin
Result := Integer(Cur);
{$IFDEF DEBUG}
- WriteLn('ServiceManager: Found Service in List: ''' + ServiceName + '''');
+ debugWriteln('ServiceManager: Found Service in List: ''' + ServiceName + '''');
{$ENDIF}
//Add to Cache
diff --git a/Game/Code/Classes/USingScores.pas b/Game/Code/Classes/USingScores.pas
index 894f5782..67f94824 100644
--- a/Game/Code/Classes/USingScores.pas
+++ b/Game/Code/Classes/USingScores.pas
@@ -423,31 +423,9 @@ begin
aPlayers[Cur.Player].ScoreDisplayed := aPlayers[Cur.Player].ScoreDisplayed + Cur.ScoreDiff - Cur.ScoreGiven;
//Change Bars Position
-
- // TODO : JB_Lazarus - Exception=Invalid floating point operation
- // AT THIS LINE !
-
- {$IFDEF LAZARUS}
-(*
- writeln( 'USINGSCORES-aPlayers[Cur.Player].RBTarget : ' + floattostr( aPlayers[Cur.Player].RBTarget ) );
- writeln( 'USINGSCORES-(Cur.ScoreDiff - Cur.ScoreGiven) : ' + floattostr( (Cur.ScoreDiff - Cur.ScoreGiven) ) );
- writeln( 'USINGSCORES-Cur.ScoreDiff : ' + floattostr( Cur.ScoreDiff ) );
- writeln( 'USINGSCORES-(Cur.Rating / 20 - 0.26) : ' + floattostr( (Cur.Rating / 20 - 0.26) ) );
- writeln( '' );
-*)
- {$ENDIF}
-
lTempA := ( aPlayers[Cur.Player].RBTarget + (Cur.ScoreDiff - Cur.ScoreGiven) );
lTempB := ( Cur.ScoreDiff * (Cur.Rating / 20 - 0.26) );
- {$IFDEF LAZARUS}
-(*
- writeln( 'USINGSCORES-lTempA : ' + floattostr( lTempA ) );
- writeln( 'USINGSCORES-lTempB : ' + floattostr( lTempB ) );
- writeln( '----------------------------------------------------------' );
-*)
- {$ENDIF}
-
if ( lTempA > 0 ) AND
( lTempB > 0 ) THEN
begin
diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas
index ce6275e8..10af65e3 100644
--- a/Game/Code/Classes/USongs.pas
+++ b/Game/Code/Classes/USongs.pas
@@ -157,30 +157,6 @@ begin
fDirWatch.active := true;
{$ENDIF}
- {$IFDEF linux}
- (*
- Thankyou to : http://www.linuxjournal.com/article/8478
- http://www.tin.org/bin/man.cgi?section=2&topic=inotify_add_watch
- *)
-(*
- fNotify := -1;
- fWatch := -1;
-
- writeln( 'Calling inotify_init' );
- fNotify := Do_SysCall( syscall_nr_inotify_init );
- if ( fNotify < 0 ) then
- writeln( 'Filesystem change notification - disabled' );
- writeln( 'Calling inotify_init : '+ inttostr(fNotify) );
-
- writeln( 'Calling syscall_nr_inotify_init ('+SongPath+')' );
- fWatch := Do_SysCall( syscall_nr_inotify_init , TSysParam( fNotify ), longint( pchar( SongPath ) ) , IN_MODIFY AND IN_CREATE AND IN_DELETE );
-
- if (fWatch < 0) then
- writeln ('inotify_add_watch');
- writeln( 'Calling syscall_nr_inotify_init : '+ inttostr(fWatch) );
-*)
- {$endif}
-
// now we can start the thread
Resume();
end;
@@ -209,7 +185,7 @@ begin
if fParseSongDirectory then
begin
- writeln( 'int_LoadSongList' );
+ debugWriteln( 'int_LoadSongList' );
int_LoadSongList();
end;
diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas
index d6041946..a6a91418 100644
--- a/Game/Code/Classes/UThemes.pas
+++ b/Game/Code/Classes/UThemes.pas
@@ -810,14 +810,14 @@ begin
create_theme_objects();
- writeln( 'TTheme.LoadTheme : '+ FileName );
+ debugWriteln( 'TTheme.LoadTheme : '+ FileName );
FileName := AdaptFilePaths( FileName );
if not FileExists(FileName) then
begin
{$ifndef win32}
- writeln( 'ERROR !!! Theme does not exist ('+ FileName +')' );
+ debugWriteln( 'ERROR !!! Theme does not exist ('+ FileName +')' );
{$endif}
Log.LogStatus( 'ERROR !!! Theme does not exist ('+ FileName +')' , 'TTheme.LoadTheme');
diff --git a/Game/Code/Classes/UTime.pas b/Game/Code/Classes/UTime.pas
index 3b7749a2..2bc77a9c 100644
--- a/Game/Code/Classes/UTime.pas
+++ b/Game/Code/Classes/UTime.pas
@@ -5,14 +5,13 @@ interface
{$IFDEF FPC}
{$MODE Delphi}
{$ENDIF}
-{$I switches.inc}
-{$UNDEF DebugDisplay}
+{$I switches.inc}
type
TTime = class
constructor Create;
- function GetTime: real;
+ function GetTime: real;
end;
procedure CountSkipTimeSet;
@@ -20,18 +19,17 @@ procedure CountSkipTime;
procedure CountMidTime;
var
- USTime: TTime;
+ USTime : TTime;
- TimeNew: int64;
- TimeOld: int64;
- TimeSkip: real;
- TimeMid: real;
- TimeMidTemp: int64;
+ TimeNew : int64;
+ TimeOld : int64;
+ TimeSkip : real;
+ TimeMid : real;
+ TimeMidTemp : int64;
implementation
uses
-// sysutils,
sdl,
ucommon;
@@ -53,50 +51,27 @@ begin
CountSkipTimeSet;
end;
-
procedure CountSkipTimeSet;
begin
- TimeNew := SDL_GetTicks();
-
- {$IFDEF DebugDisplay}
- Writeln( 'CountSkipTimeSet : ' + inttostr(trunc(TimeNew)) );
- {$ENDIF}
+ TimeNew := SDL_GetTicks();
end;
-
procedure CountSkipTime;
begin
- TimeOld := TimeNew;
- TimeNew := SDL_GetTicks();
- TimeSkip := (TimeNew-TimeOld) / cSDLCorrectionRatio;
-
- {$IFDEF DebugDisplay}
- Writeln( 'TimeNew : ' + inttostr(trunc(TimeNew)) );
- Writeln( 'CountSkipTime : ' + inttostr(trunc(TimeSkip)) );
- {$ENDIF}
+ TimeOld := TimeNew;
+ TimeNew := SDL_GetTicks();
+ TimeSkip := (TimeNew-TimeOld) / cSDLCorrectionRatio;
end;
-
procedure CountMidTime;
begin
TimeMidTemp := SDL_GetTicks();
TimeMid := (TimeMidTemp - TimeNew) / cSDLCorrectionRatio;
-
- {$IFDEF DebugDisplay}
- Writeln( 'TimeNew : ' + inttostr(trunc(TimeNew)) );
- Writeln( 'CountMidTime : ' + inttostr(trunc(TimeMid)) );
- {$ENDIF}
end;
-
function TTime.GetTime: real;
begin
- Result := SDL_GetTicks() / cSDLCorrectionRatio;
-
- {$IFDEF DebugDisplay}
- Writeln( 'GetTime : ' + inttostr(trunc(Result)) );
- {$ENDIF}
+ Result := SDL_GetTicks() / cSDLCorrectionRatio;
end;
-
end.
diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas
index 9a0c5f74..1db31b92 100644
--- a/Game/Code/Classes/UVideo.pas
+++ b/Game/Code/Classes/UVideo.pas
@@ -54,6 +54,7 @@ uses SDL,
{$endif}
*)
UIni,
+ ULog,
UMusic,
UGraphic;
@@ -126,7 +127,7 @@ type
procedure showmessage( aMessage : String );
begin
- writeln( aMessage );
+ debugwriteln( aMessage );
end;
//{$endif}
@@ -163,14 +164,14 @@ begin
aFirstAudioStream := -1;
aFirstVideoStream := -1;
- writeln( ' aFormatCtx.nb_streams : ' + inttostr( aFormatCtx.nb_streams ) );
- writeln( ' length( aFormatCtx.streams ) : ' + inttostr( length(aFormatCtx.streams) ) );
+ debugwriteln( ' aFormatCtx.nb_streams : ' + inttostr( aFormatCtx.nb_streams ) );
+ debugwriteln( ' length( aFormatCtx.streams ) : ' + inttostr( length(aFormatCtx.streams) ) );
i := 0;
while ( i < aFormatCtx.nb_streams ) do
// while ( i < length(aFormatCtx.streams)-1 ) do
begin
- writeln( ' aFormatCtx.streams[i] : ' + inttostr( i ) );
+ debugwriteln( ' aFormatCtx.streams[i] : ' + inttostr( i ) );
st := aFormatCtx.streams[i];
if(st.codec.codec_type = CODEC_TYPE_VIDEO ) AND
@@ -294,7 +295,7 @@ begin
else
if (AVPacket.stream_index = AudioStreamIndex ) then
begin
- writeln('Encue Audio packet');
+ debugwriteln('Encue Audio packet');
audioq.put(AVPacket);
{$endif}
*)
@@ -455,10 +456,10 @@ begin
TimeDifference := 0;
VideoFormatContext := nil;
-// writeln( aFileName );
+// debugwriteln( aFileName );
errnum := av_open_input_file(VideoFormatContext, pchar( aFileName ), Nil, 0, Nil);
-// writeln( 'Errnum : ' +inttostr( errnum ));
+// debugwriteln( 'Errnum : ' +inttostr( errnum ));
if(errnum <> 0) then
begin
{$ifdef DebugDisplay}
@@ -485,8 +486,8 @@ begin
begin
find_stream_ids( VideoFormatContext, VideoStreamIndex, AudioStreamIndex );
- writeln( 'VideoStreamIndex : ' + inttostr(VideoStreamIndex) );
- writeln( 'AudioStreamIndex : ' + inttostr(AudioStreamIndex) );
+ debugwriteln( 'VideoStreamIndex : ' + inttostr(VideoStreamIndex) );
+ debugwriteln( 'AudioStreamIndex : ' + inttostr(AudioStreamIndex) );
end;
// FIXME: AudioStreamIndex is -1 if video has no sound -> memory access error
// Just a temporary workaround for now
@@ -510,27 +511,27 @@ begin
if (SDL_OpenAudio(@wanted_spec, @spec) < 0) then
begin
- writeln('SDL_OpenAudio: '+SDL_GetError());
+ debugwriteln('SDL_OpenAudio: '+SDL_GetError());
exit;
end;
- writeln( 'SDL opened audio device' );
+ debugwriteln( 'SDL opened audio device' );
aCodec := avcodec_find_decoder(aCodecCtx.codec_id);
if (aCodec = nil) then
begin
- writeln('Unsupported codec!');
+ debugwriteln('Unsupported codec!');
exit;
end;
avcodec_open(aCodecCtx, aCodec);
- writeln( 'Opened the codec' );
+ debugwriteln( 'Opened the codec' );
packet_queue_init( audioq );
SDL_PauseAudio(0);
- writeln( 'SDL_PauseAudio' );
+ debugwriteln( 'SDL_PauseAudio' );
end;
@@ -608,9 +609,9 @@ begin
TexX, TexY, integer(PIX_FMT_RGB24),
SWS_FAST_BILINEAR, nil, nil, nil);
if SoftwareScaleContext <> Nil then
- writeln('got swscale context')
+ debugwriteln('got swscale context')
else begin
- writeln('ERROR: didnīt get swscale context');
+ debugwriteln('ERROR: didnīt get swscale context');
av_free(AVFrameRGB);
av_free(AVFrame);
avcodec_close(VideoCodecContext);
@@ -637,7 +638,7 @@ begin
ScaledVideoWidth:=800.0;
ScaledVideoHeight:=800.0/VideoAspect;
VideoTimeBase:=VideoFormatContext^.streams[VideoStreamIndex]^.r_frame_rate.den/VideoFormatContext^.streams[VideoStreamIndex]^.r_frame_rate.num;
- writeln(VideoTimeBase);
+ debugwriteln( floattostr(VideoTimeBase) );
{$ifdef DebugDisplay}
showmessage('framerate: '+inttostr(floor(1/videotimebase))+'fps');
{$endif}
diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas
index ab883b84..2cf78d12 100644
--- a/Game/Code/Screens/UScreenCredits.pas
+++ b/Game/Code/Screens/UScreenCredits.pas
@@ -337,7 +337,7 @@ begin
end
else
{$IFDEF FPC}
- writeln( 'could not open file - test.png');
+ debugWriteln( 'could not open file - test.png');
{$ELSE}
showmessage('could not open file - test.png');
{$ENDIF}
diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas
index bc6c0966..d75a3171 100644
--- a/Game/Code/Screens/UScreenSing.pas
+++ b/Game/Code/Screens/UScreenSing.pas
@@ -915,10 +915,7 @@ begin
if CurrentSong.VideoLoaded then
begin
try
- writeln( 'VideoPlayback.FFmpegGetFrame' );
fCurrentVideoPlaybackEngine.GetFrame(LineState.CurrentTime);
-
- writeln( 'VideoPlayback.FFmpegDrawGL' );
fCurrentVideoPlaybackEngine.DrawGL(ScreenAct);
// PlaySmpeg;
except
diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas
index a3467bfe..7bc08148 100644
--- a/Game/Code/Screens/UScreenSong.pas
+++ b/Game/Code/Screens/UScreenSong.pas
@@ -775,83 +775,7 @@ begin
CatSongs.Refresh;
GenerateThumbnails();
-(*
- if (length(CatSongs.Song) > 0) then
- begin
- //Set Length of Button Array one Time Instead of one time for every Song
- SetButtonLength(Length(CatSongs.Song));
-
- I := 0;
- CreateSongButtons:
-
- try
- for Pet := I to High(CatSongs.Song) do begin // creating all buttons
- // new
- Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0
-
- if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then
- CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover'
-
- if CatSongs.Song[Pet].Cover = '' then
- AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections)
- else begin
- // cache texture if there is a need to this
- if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then
- begin
- Texture.CreateCacheMipmap := true;
- Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap
- Texture.CreateCacheMipmap := false;
-
- // puts this texture to the cache file
- Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover);
-
- // unload full size texture
- Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false);
-
- // we should also add mipmap texture by calling createtexture and use mipmap cache as data source
- end;
-
- // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here)
- AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections);
- end;
- Texture.Limit := 1024*1024;
- I := -1;
- end;
- except
- //When Error is reported the First time for this Song
- if (I <> Pet) then
- begin
- //Some Error reporting:
- Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover);
-
- //Change Cover to NoCover and Continue Loading
- CatSongs.Song[Pet].Cover := '';
- I := Pet;
- end
- else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song
- begin
- Log.LogError('NoCover Cover is damaged!');
- try
- AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections);
- except
- {$IFDEF MSWINDOWS}
- Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK);
- {$ELSE}
- // TODO : JB_linux - better handle this message and display to user..
- writeln( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.');
- Log.LogError( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.' );
- {$ENDIF}
- Halt;
- end;
- I := Pet + 1;
- end;
- end;
- if (I <> -1) then
- GoTo CreateSongButtons;
-
- end;
-*)
// Randomize Patch
Randomize;
@@ -932,8 +856,9 @@ begin
{$IFDEF MSWINDOWS}
Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK);
{$ELSE}
+
// TODO : JB_linux - better handle this message and display to user..
- writeln( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.');
+ writeln( 'Cover Image is damaged. Could not Workaround Song Loading, Ultrastar will exit now.');
Log.LogError( 'No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.' );
{$ENDIF}
Halt;
@@ -1625,8 +1550,6 @@ begin
dx := SongTarget-SongCurrent;
dt := TimeSkip * 7;
-// writeln( 'TScreenSong.Draw '+ inttostr(trunc(TimeSkip)) );
-
if dt > 1 then
dt := 1;
diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc
index 1a8f26cc..ba028f57 100644
--- a/Game/Code/switches.inc
+++ b/Game/Code/switches.inc
@@ -7,6 +7,7 @@
// So, for Windows-only code use the MSWINDOWS define.
{$IFDEF FPC}
+ {$DEFINE CONSOLE}
{$IFDEF DARWIN}
{$H+}
{$R-}
@@ -26,6 +27,8 @@
{$DEFINE HasInline}
{$UNDEF UseSerialPort}
{$ELSE}
+ {$UNDEF CONSOLE} // Delphi requires a special app type... no thanks ! :)
+ // {$DEFINE CONSOLE} // -- use for development only !
{$DEFINE Delphi}
// Delphi version numbers (ignore versions released before Delphi 6 as they miss the $IF directive):
@@ -82,7 +85,9 @@
{$IFDEF DEBUG}
{$IFNDEF DARWIN}
- {$APPTYPE CONSOLE}
+ {$IFDEF CONSOLE}
+ {$APPTYPE CONSOLE}
+ {$ENDIF}
{$ENDIF}
{$ENDIF}