aboutsummaryrefslogtreecommitdiffstats
path: root/Game
diff options
context:
space:
mode:
authorwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-07-08 12:00:15 +0000
committerwhiteshark0 <whiteshark0@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-07-08 12:00:15 +0000
commitdd3cc6f8e84f03f626a88741474412d36e4d18ac (patch)
treeb4c398b4f01aac329108b77008b62bdad9209820 /Game
parentdce08a8771098ac1a56dd4548202454ab268e951 (diff)
downloadusdx-dd3cc6f8e84f03f626a88741474412d36e4d18ac.tar.gz
usdx-dd3cc6f8e84f03f626a88741474412d36e4d18ac.tar.xz
usdx-dd3cc6f8e84f03f626a88741474412d36e4d18ac.zip
Improved Error Logging and Benchmark:
Write US Version, date and time to files. Added better Commandline Parameter Interpreter: More than one parameter can be used at the same time Many new, useful farameters: e.g. No error logging, Resolution change, FullScreen, DualScreen Mode, other Config File, other Score File and SongPath git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@274 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game')
-rw-r--r--Game/Code/Classes/UDraw.pas4
-rw-r--r--Game/Code/Classes/UGraphic.pas31
-rw-r--r--Game/Code/Classes/UIni.pas289
-rw-r--r--Game/Code/Classes/ULog.pas68
-rw-r--r--Game/Code/Classes/UMain.pas4
-rw-r--r--Game/Code/Menu/UDisplay.pas4
-rw-r--r--Game/Code/UltraStar.dpr24
7 files changed, 237 insertions, 187 deletions
diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas
index 2575758f..077f5121 100644
--- a/Game/Code/Classes/UDraw.pas
+++ b/Game/Code/Classes/UDraw.pas
@@ -153,8 +153,8 @@ var
begin;
// Log.LogStatus('Oscilloscope', 'SingDraw');
glColor3f(Skin_OscR, Skin_OscG, Skin_OscB);
- if (ParamStr(1) = '-black') or (ParamStr(1) = '-fsblack') then
- glColor3f(1, 1, 1);
+ {if (ParamStr(1) = '-black') or (ParamStr(1) = '-fsblack') then
+ glColor3f(1, 1, 1); }
glBegin(GL_LINE_STRIP);
glVertex2f(X, -Sound[NrSound].BufferArray[1] / $10000 * H + Y + H/2);
diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas
index 205fa9fd..cf1a0c5a 100644
--- a/Game/Code/Classes/UGraphic.pas
+++ b/Game/Code/Classes/UGraphic.pas
@@ -178,7 +178,7 @@ procedure LoadScreens;
implementation
-uses UMain, UIni, UDisplay, Graphics, Classes, Windows;
+uses UMain, UIni, UDisplay, UCommandLine, Graphics, Classes, Windows;
procedure LoadTextures;
var
@@ -332,8 +332,12 @@ var
S: string;
I: integer;
W, H: integer;
+ Depth: Integer;
begin
- Screens := Ini.Screens + 1;
+ if (Params.Screens <> -1) then
+ Screens := Params.Screens + 1
+ else
+ Screens := Ini.Screens + 1;
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
@@ -341,28 +345,39 @@ begin
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
- S := IResolution[Ini.Resolution];
+ // If there is a resolution in Parameters, use it, else use the Ini value
+ I := Params.Resolution;
+ if (I <> -1) then
+ S := IResolution[I]
+ else
+ S := IResolution[Ini.Resolution];
+
I := Pos('x', S);
W := StrToInt(Copy(S, 1, I-1)) * Screens;
H := StrToInt(Copy(S, I+1, 1000));
- if ParamStr(1) = '-fsblack' then begin
+ {if ParamStr(1) = '-fsblack' then begin
W := 800;
H := 600;
end;
if ParamStr(1) = '-320x240' then begin
W := 320;
H := 240;
- end;
+ end; }
+
+ If (Params.Depth <> -1) then
+ Depth := Params.Depth
+ else
+ Depth := Ini.Depth;
Log.LogStatus('SDL_SetVideoMode', 'Initialize3D');
// SDL_SetRefreshrate(85);
// SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
- if (Ini.FullScreen = 0) and (ParamStr(1) <> '-fsblack') then
- screen := SDL_SetVideoMode(W, H, (Ini.Depth+1) * 16, SDL_OPENGL)
+ if (Ini.FullScreen = 0) and (Not Params.FullScreen) then
+ screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL)
else begin
- screen := SDL_SetVideoMode(W, H, (Ini.Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN);
+ screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN);
SDL_ShowCursor(0);
end;
if (screen = nil) then begin
diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas
index ceb3c240..846c0deb 100644
--- a/Game/Code/Classes/UIni.pas
+++ b/Game/Code/Classes/UIni.pas
@@ -11,6 +11,9 @@ type
NameTeam: array[0..2] of string;
NameTemplate: array[0..11] of string;
+ //Filename of the opened iniFile
+ Filename: string;
+
// Game
Players: integer;
Difficulty: integer;
@@ -159,7 +162,7 @@ const
IChannel: array[0..6] of string = ('0', '1', '2', '3', '4', '5', '6');
implementation
-uses UFiles, SDL, ULanguage, USkins, URecord;
+uses UFiles, SDL, ULanguage, USkins, URecord, UCommandLine;
procedure TIni.Load;
var
@@ -181,7 +184,16 @@ var
begin
GamePath := ExtractFilePath(ParamStr(0));
- IniFile := TMemIniFile.Create(GamePath + 'config.ini');
+
+ 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
@@ -516,9 +528,12 @@ begin
// SongPath
- SongPath := IncludeTrailingPathDelimiter(IniFile.ReadString('Path', 'Songs', SongPath));
-
+ if (Params.SongPath <> '') then
+ SongPath := IncludeTrailingPathDelimiter(Params.SongPath)
+ else
+ SongPath := IncludeTrailingPathDelimiter(IniFile.ReadString('Path', 'Songs', SongPath));
+ Filename := IniFile.FileName;
IniFile.Free;
end;
@@ -529,176 +544,178 @@ var
I: Integer;
S: String;
begin
- if not (FileExists(GamePath + 'config.ini') and FileIsReadOnly(GamePath + 'config.ini')) then begin
- IniFile := TIniFile.Create(GamePath + 'config.ini');
+ //if not (FileExists(GamePath + 'config.ini') and FileIsReadOnly(GamePath + 'config.ini')) then begin
+ if not (FileExists(Filename) and FileIsReadOnly(Filename)) then begin
- // Players
- Tekst := IPlayers[Ini.Players];
- IniFile.WriteString('Game', 'Players', Tekst);
+ IniFile := TIniFile.Create(Filename);
- // Difficulty
- Tekst := IDifficulty[Ini.Difficulty];
- IniFile.WriteString('Game', 'Difficulty', Tekst);
+ // Players
+ Tekst := IPlayers[Ini.Players];
+ IniFile.WriteString('Game', 'Players', Tekst);
- // Language
- Tekst := ILanguage[Ini.Language];
- IniFile.WriteString('Game', 'Language', Tekst);
+ // Difficulty
+ Tekst := IDifficulty[Ini.Difficulty];
+ IniFile.WriteString('Game', 'Difficulty', Tekst);
- // Tabs
- Tekst := ITabs[Ini.Tabs];
- IniFile.WriteString('Game', 'Tabs', Tekst);
+ // Language
+ Tekst := ILanguage[Ini.Language];
+ IniFile.WriteString('Game', 'Language', Tekst);
- // Sorting
- Tekst := ISorting[Ini.Sorting];
- IniFile.WriteString('Game', 'Sorting', Tekst);
+ // Tabs
+ Tekst := ITabs[Ini.Tabs];
+ IniFile.WriteString('Game', 'Tabs', Tekst);
- // Debug
- Tekst := IDebug[Ini.Debug];
- IniFile.WriteString('Game', 'Debug', Tekst);
+ // Sorting
+ Tekst := ISorting[Ini.Sorting];
+ IniFile.WriteString('Game', 'Sorting', Tekst);
- // Screens
- Tekst := IScreens[Ini.Screens];
- IniFile.WriteString('Graphics', 'Screens', Tekst);
+ // Debug
+ Tekst := IDebug[Ini.Debug];
+ IniFile.WriteString('Game', 'Debug', Tekst);
- // FullScreen
- Tekst := IFullScreen[Ini.FullScreen];
- IniFile.WriteString('Graphics', 'FullScreen', Tekst);
+ // Screens
+ Tekst := IScreens[Ini.Screens];
+ IniFile.WriteString('Graphics', 'Screens', Tekst);
- // Resolution
- Tekst := IResolution[Ini.Resolution];
- IniFile.WriteString('Graphics', 'Resolution', Tekst);
+ // FullScreen
+ Tekst := IFullScreen[Ini.FullScreen];
+ IniFile.WriteString('Graphics', 'FullScreen', Tekst);
- // Depth
- Tekst := IDepth[Ini.Depth];
- IniFile.WriteString('Graphics', 'Depth', Tekst);
+ // Resolution
+ Tekst := IResolution[Ini.Resolution];
+ IniFile.WriteString('Graphics', 'Resolution', Tekst);
- // Resolution
- Tekst := ITextureSize[Ini.TextureSize];
- IniFile.WriteString('Graphics', 'TextureSize', Tekst);
+ // Depth
+ Tekst := IDepth[Ini.Depth];
+ IniFile.WriteString('Graphics', 'Depth', Tekst);
- // Sing Window
- Tekst := ISingWindow[Ini.SingWindow];
- IniFile.WriteString('Graphics', 'SingWindow', Tekst);
+ // Resolution
+ Tekst := ITextureSize[Ini.TextureSize];
+ IniFile.WriteString('Graphics', 'TextureSize', Tekst);
- // Oscilloscope
- Tekst := IOscilloscope[Ini.Oscilloscope];
- IniFile.WriteString('Graphics', 'Oscilloscope', Tekst);
+ // Sing Window
+ Tekst := ISingWindow[Ini.SingWindow];
+ IniFile.WriteString('Graphics', 'SingWindow', Tekst);
- // Spectrum
- Tekst := ISpectrum[Ini.Spectrum];
- IniFile.WriteString('Graphics', 'Spectrum', Tekst);
+ // Oscilloscope
+ Tekst := IOscilloscope[Ini.Oscilloscope];
+ IniFile.WriteString('Graphics', 'Oscilloscope', Tekst);
- // Spectrograph
- Tekst := ISpectrograph[Ini.Spectrograph];
- IniFile.WriteString('Graphics', 'Spectrograph', Tekst);
+ // Spectrum
+ Tekst := ISpectrum[Ini.Spectrum];
+ IniFile.WriteString('Graphics', 'Spectrum', Tekst);
- // Movie Size
- Tekst := IMovieSize[Ini.MovieSize];
- IniFile.WriteString('Graphics', 'MovieSize', Tekst);
+ // Spectrograph
+ Tekst := ISpectrograph[Ini.Spectrograph];
+ IniFile.WriteString('Graphics', 'Spectrograph', Tekst);
- // MicBoost
- Tekst := IMicBoost[Ini.MicBoost];
- IniFile.WriteString('Sound', 'MicBoost', Tekst);
+ // Movie Size
+ Tekst := IMovieSize[Ini.MovieSize];
+ IniFile.WriteString('Graphics', 'MovieSize', Tekst);
- // ClickAssist
- Tekst := IClickAssist[Ini.ClickAssist];
- IniFile.WriteString('Sound', 'ClickAssist', Tekst);
+ // MicBoost
+ Tekst := IMicBoost[Ini.MicBoost];
+ IniFile.WriteString('Sound', 'MicBoost', Tekst);
- // BeatClick
- Tekst := IBeatClick[Ini.BeatClick];
- IniFile.WriteString('Sound', 'BeatClick', Tekst);
+ // ClickAssist
+ Tekst := IClickAssist[Ini.ClickAssist];
+ IniFile.WriteString('Sound', 'ClickAssist', Tekst);
- // Threshold
- Tekst := IThreshold[Ini.Threshold];
- IniFile.WriteString('Sound', 'Threshold', Tekst);
+ // BeatClick
+ Tekst := IBeatClick[Ini.BeatClick];
+ IniFile.WriteString('Sound', 'BeatClick', Tekst);
- // Song Preview
- Tekst := IPreviewVolume[Ini.PreviewVolume];
- IniFile.WriteString('Sound', 'PreviewVolume', Tekst);
+ // Threshold
+ Tekst := IThreshold[Ini.Threshold];
+ IniFile.WriteString('Sound', 'Threshold', Tekst);
- Tekst := IPreviewFading[Ini.PreviewFading];
- IniFile.WriteString('Sound', 'PreviewFading', Tekst);
+ // Song Preview
+ Tekst := IPreviewVolume[Ini.PreviewVolume];
+ IniFile.WriteString('Sound', 'PreviewVolume', Tekst);
- // SavePlayback
- Tekst := ISavePlayback[Ini.SavePlayback];
- IniFile.WriteString('Sound', 'SavePlayback', Tekst);
+ Tekst := IPreviewFading[Ini.PreviewFading];
+ IniFile.WriteString('Sound', 'PreviewFading', Tekst);
- // Lyrics Font
- Tekst := ILyricsFont[Ini.LyricsFont];
- IniFile.WriteString('Lyrics', 'LyricsFont', Tekst);
+ // SavePlayback
+ Tekst := ISavePlayback[Ini.SavePlayback];
+ IniFile.WriteString('Sound', 'SavePlayback', Tekst);
- // Lyrics Effect
- Tekst := ILyricsEffect[Ini.LyricsEffect];
- IniFile.WriteString('Lyrics', 'LyricsEffect', Tekst);
+ // Lyrics Font
+ Tekst := ILyricsFont[Ini.LyricsFont];
+ IniFile.WriteString('Lyrics', 'LyricsFont', Tekst);
- // Solmization
- Tekst := ISolmization[Ini.Solmization];
- IniFile.WriteString('Lyrics', 'Solmization', Tekst);
+ // Lyrics Effect
+ Tekst := ILyricsEffect[Ini.LyricsEffect];
+ IniFile.WriteString('Lyrics', 'LyricsEffect', Tekst);
- // Theme
- Tekst := ITheme[Ini.Theme];
- IniFile.WriteString('Themes', 'Theme', Tekst);
+ // Solmization
+ Tekst := ISolmization[Ini.Solmization];
+ IniFile.WriteString('Lyrics', 'Solmization', Tekst);
- // Skin
- Tekst := ISkin[Ini.SkinNo];
- IniFile.WriteString('Themes', 'Skin', Tekst);
+ // Theme
+ Tekst := ITheme[Ini.Theme];
+ IniFile.WriteString('Themes', 'Theme', Tekst);
- // Color
- Tekst := IColor[Ini.Color];
- IniFile.WriteString('Themes', 'Color', Tekst);
+ // Skin
+ Tekst := ISkin[Ini.SkinNo];
+ IniFile.WriteString('Themes', 'Skin', Tekst);
- // Record
- for I := 0 to High(CardList) do begin
- S := IntToStr(I+1);
+ // Color
+ Tekst := IColor[Ini.Color];
+ IniFile.WriteString('Themes', 'Color', Tekst);
- Tekst := CardList[I].Name;
- IniFile.WriteString('Record', 'DeviceName' + S, Tekst);
+ // Record
+ for I := 0 to High(CardList) do begin
+ S := IntToStr(I+1);
- Tekst := IntToStr(CardList[I].Input);
- IniFile.WriteString('Record', 'Input' + S, Tekst);
+ Tekst := CardList[I].Name;
+ IniFile.WriteString('Record', 'DeviceName' + S, Tekst);
- Tekst := IntToStr(CardList[I].ChannelL);
- IniFile.WriteString('Record', 'ChannelL' + S, Tekst);
+ Tekst := IntToStr(CardList[I].Input);
+ IniFile.WriteString('Record', 'Input' + S, Tekst);
- Tekst := IntToStr(CardList[I].ChannelR);
- IniFile.WriteString('Record', 'ChannelR' + S, Tekst);
- end;
+ Tekst := IntToStr(CardList[I].ChannelL);
+ IniFile.WriteString('Record', 'ChannelL' + S, Tekst);
- //Log.LogError(InttoStr(Length(CardList)) + ' Cards Saved');
+ Tekst := IntToStr(CardList[I].ChannelR);
+ IniFile.WriteString('Record', 'ChannelR' + S, Tekst);
+ end;
- //Advanced Settings
+ //Log.LogError(InttoStr(Length(CardList)) + ' Cards Saved');
- //LoadAnimation
- Tekst := ILoadAnimation[Ini.LoadAnimation];
- IniFile.WriteString('Advanced', 'LoadAnimation', Tekst);
+ //Advanced Settings
- //EffectSing
- Tekst := IEffectSing[Ini.EffectSing];
- IniFile.WriteString('Advanced', 'EffectSing', Tekst);
+ //LoadAnimation
+ Tekst := ILoadAnimation[Ini.LoadAnimation];
+ IniFile.WriteString('Advanced', 'LoadAnimation', Tekst);
- //ScreenFade
- Tekst := IScreenFade[Ini.ScreenFade];
- IniFile.WriteString('Advanced', 'ScreenFade', Tekst);
+ //EffectSing
+ Tekst := IEffectSing[Ini.EffectSing];
+ IniFile.WriteString('Advanced', 'EffectSing', Tekst);
- //AskbeforeDel
- Tekst := IAskbeforeDel[Ini.AskbeforeDel];
- IniFile.WriteString('Advanced', 'AskbeforeDel', Tekst);
+ //ScreenFade
+ Tekst := IScreenFade[Ini.ScreenFade];
+ IniFile.WriteString('Advanced', 'ScreenFade', Tekst);
- //OnSongClick
- Tekst := IOnSongClick[Ini.OnSongClick];
- IniFile.WriteString('Advanced', 'OnSongClick', Tekst);
+ //AskbeforeDel
+ Tekst := IAskbeforeDel[Ini.AskbeforeDel];
+ IniFile.WriteString('Advanced', 'AskbeforeDel', Tekst);
- //Line Bonus
- Tekst := ILineBonus[Ini.LineBonus];
- IniFile.WriteString('Advanced', 'LineBonus', Tekst);
+ //OnSongClick
+ Tekst := IOnSongClick[Ini.OnSongClick];
+ IniFile.WriteString('Advanced', 'OnSongClick', Tekst);
- //Party Popup
- Tekst := IPartyPopup[Ini.PartyPopup];
- IniFile.WriteString('Advanced', 'PartyPopup', Tekst);
+ //Line Bonus
+ Tekst := ILineBonus[Ini.LineBonus];
+ IniFile.WriteString('Advanced', 'LineBonus', Tekst);
- // Joypad
- Tekst := IJoypad[Ini.Joypad];
- IniFile.WriteString('Controller', 'Joypad', Tekst);
+ //Party Popup
+ Tekst := IPartyPopup[Ini.PartyPopup];
+ IniFile.WriteString('Advanced', 'PartyPopup', Tekst);
+
+ // Joypad
+ Tekst := IJoypad[Ini.Joypad];
+ IniFile.WriteString('Controller', 'Joypad', Tekst);
IniFile.Free;
end;
@@ -709,8 +726,10 @@ var
IniFile: TIniFile;
I: integer;
begin
- if not FileIsReadOnly(GamePath + 'config.ini') then begin
- IniFile := TIniFile.Create(GamePath + 'config.ini');
+ //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
@@ -730,8 +749,10 @@ var
IniFile: TIniFile;
I: integer;
begin
- if not FileIsReadOnly(GamePath + 'config.ini') then begin
- IniFile := TIniFile.Create(GamePath + 'config.ini');
+ //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]);
diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas
index 59e25954..9d20d2f1 100644
--- a/Game/Code/Classes/ULog.pas
+++ b/Game/Code/Classes/ULog.pas
@@ -11,13 +11,14 @@ type
FileBenchmark: TextFile;
FileBenchmarkO: boolean; // opened
- FileAnalyze: TextFile;
- FileAnalyzeO: boolean; // opened
FileError: TextFile;
FileErrorO: boolean; // opened
Title: String; //Application Title
+ //Should Log Files be written
+ Enabled: Boolean;
+
// destuctor
destructor Free;
@@ -26,9 +27,6 @@ type
procedure BenchmarkEnd(Number: integer);
procedure LogBenchmark(Text: string; Number: integer);
- // analyze
- procedure LogAnalyze(Text: string);
-
// error
procedure LogError(Text: string); overload;
@@ -47,7 +45,7 @@ var
Log: TLog;
implementation
-uses UFiles, SysUtils, DateUtils, URecord, UTime, UIni, Windows;
+uses UFiles, SysUtils, DateUtils, URecord, UTime, UIni, Windows, UCommandLine;
destructor TLog.Free;
begin
@@ -78,7 +76,7 @@ var
ValueText: string;
begin
- if (ParamStr(1) = '-benchmark') then begin
+ if Enabled AND (Params.Benchmark) then begin
if not FileBenchmarkO then begin
FileBenchmarkO := true;
AssignFile(FileBenchmark, LogPath + 'Benchmark.log');
@@ -86,6 +84,16 @@ begin
Rewrite(FileBenchmark);
if IOResult = 0 then FileBenchmarkO := true;
{$I+}
+
+ //If File is opened write Date to Benchmark File
+ If (FileBenchmarkO) then
+ begin
+ WriteLn(FileBenchmark, Title + ' Benchmark File');
+ WriteLn(FileBenchmark, 'Date: ' + DatetoStr(Now) + ' Time: ' + TimetoStr(Now));
+ WriteLn(FileBenchmark, '-------------------');
+
+ Flush(FileBenchmark);
+ end;
end;
if FileBenchmarkO then begin
@@ -133,44 +141,34 @@ begin
end;
end;
-procedure TLog.LogAnalyze(Text: string);
-var
- Seconds: integer;
- Miliseconds: integer;
- ValueText: string;
-begin
- //if Ini.Debug = 1 then begin
-
- if not FileAnalyzeO then begin
- AssignFile(FileAnalyze, LogPath + 'Analyze.log');
- {$I-}
- Rewrite(FileAnalyze);
- if IOResult = 0 then FileAnalyzeO := true;
- {$I+}
- end;
-
- if FileAnalyzeO then begin
- WriteLn(FileAnalyze, Text);
- Flush(FileAnalyze); // try to speed up
- end;
-
- //end;
-end;
-
procedure TLog.LogError(Text: string);
begin
- if not FileErrorO then begin
+ if Enabled AND (not FileErrorO) then begin
FileErrorO := true;
AssignFile(FileError, LogPath + 'Error.log');
{$I-}
Rewrite(FileError);
if IOResult = 0 then FileErrorO := true;
{$I+}
+
+ //If File is opened write Date to Error File
+ If (FileErrorO) then
+ begin
+ WriteLn(FileError, Title + ' Error Log');
+ WriteLn(FileError, 'Date: ' + DatetoStr(Now) + ' Time: ' + TimetoStr(Now));
+ WriteLn(FileError, '-------------------');
+
+ Flush(FileError);
+ end;
end;
if FileErrorO then begin
- WriteLn(FileError, Text);
- Flush(FileError);
+ try
+ WriteLn(FileError, Text);
+ Flush(FileError);
+ except
+ FileErrorO := false;
+ end;
end;
end;
@@ -225,3 +223,5 @@ begin
end;
end.
+
+
diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas
index 3bf7d197..b47047a5 100644
--- a/Game/Code/Classes/UMain.pas
+++ b/Game/Code/Classes/UMain.pas
@@ -95,7 +95,7 @@ function GetTimeFromBeat(Beat: integer): real;
procedure ClearScores(PlayerNum: integer);
implementation
-uses USongs, UJoystick, math;
+uses USongs, UJoystick, math, UCommandLine;
procedure MainLoop;
var
@@ -105,7 +105,7 @@ begin
While not Done do
Begin
// joypad
- if Ini.Joypad = 1 then
+ if (Ini.Joypad = 1) OR (Params.Joypad) then
Joy.Update;
// keyboard events
diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas
index f95a73e3..223a7615 100644
--- a/Game/Code/Menu/UDisplay.pas
+++ b/Game/Code/Menu/UDisplay.pas
@@ -111,8 +111,8 @@ begin
Result := True;
Col := 1;
- if (ParamStr(1) = '-black') or (ParamStr(1) = '-fsblack') then
- Col := 0;
+ {if (ParamStr(1) = '-black') or (ParamStr(1) = '-fsblack') then
+ Col := 0; }
glClearColor(Col, Col, Col , 0);
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr
index b9687292..44899166 100644
--- a/Game/Code/UltraStar.dpr
+++ b/Game/Code/UltraStar.dpr
@@ -1,7 +1,6 @@
program UltraStar;
{$DEFINE TRANSLATE}
-//DEFINE THEMESAVE}
{$R 'UltraStar.res' 'UltraStar.rc'}
@@ -26,7 +25,6 @@ uses
UGraphic in 'Classes\UGraphic.pas',
UTexture in 'Classes\UTexture.pas',
UMusic in 'Classes\UMusic.pas',
- //UPliki in 'Classes\UPliki.pas',
ULanguage in 'Classes\ULanguage.pas',
UMain in 'Classes\UMain.pas',
UDraw in 'Classes\UDraw.pas',
@@ -51,6 +49,7 @@ uses
UDLLManager in 'Classes\UDLLManager.pas',
UParty in 'Classes\UParty.pas',
UPlaylist in 'Classes\UPlaylist.pas',
+ UCommandLine in 'Classes\UCommandLine.pas',
//------------------------------
//Includes - Screens
@@ -144,9 +143,13 @@ begin
//------------------------------
USTime := TTime.Create;
+ // Commandline Parameter Parser
+ Params := TCMDParams.Create;
+
// Log + Benchmark
Log := TLog.Create;
Log.Title := WndTitle;
+ Log.Enabled := Not Params.NoLog;
Log.BenchmarkStart(0);
// Language
@@ -182,7 +185,13 @@ begin
Log.BenchmarkStart(1);
Log.LogStatus('Load Ini', 'Initialization'); Ini := TIni.Create;
Ini.Load;
- Language.ChangeLanguage(ILanguage[Ini.Language]);
+
+ //Load Languagefile
+ if (Params.Language <> -1) then
+ Language.ChangeLanguage(ILanguage[Params.Language])
+ else
+ Language.ChangeLanguage(ILanguage[Ini.Language]);
+
Log.BenchmarkEnd(1);
Log.LogBenchmark('Loading Ini', 1);
@@ -268,7 +277,12 @@ begin
Log.BenchmarkStart(1);
Log.LogStatus('DataBase System', 'Initialization');
DataBase := TDataBaseSystem.Create;
- DataBase.Init ('Ultrastar.db');
+
+ if (Params.ScoreFile = '') then
+ DataBase.Init ('Ultrastar.db')
+ else
+ DataBase.Init (Params.ScoreFile);
+
Log.BenchmarkEnd(1);
Log.LogBenchmark('Loading DataBase System', 1);
@@ -287,7 +301,7 @@ begin
Log.LogBenchmark('Loading Particel System', 1);
// Joypad
- if Ini.Joypad = 1 then begin
+ if (Ini.Joypad = 1) OR (Params.Joypad) then begin
Log.BenchmarkStart(1);
Log.LogStatus('Initialize Joystick', 'Initialization'); Joy := TJoy.Create;
Log.BenchmarkEnd(1);