From: DeaDDooMER Date: Thu, 29 Aug 2019 19:33:20 +0000 (+0300) Subject: add parameter --log-file X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=6a529517007ed9becc3cd4e188f3c0e1348fda1b;p=d2df-sdl.git add parameter --log-file --- diff --git a/src/game/Doom2DF.lpr b/src/game/Doom2DF.lpr index 3239be1..f8d946e 100644 --- a/src/game/Doom2DF.lpr +++ b/src/game/Doom2DF.lpr @@ -172,12 +172,32 @@ begin SetEnvVar('TIMIDITY_CFG', 'timidity.cfg'); {$ENDIF ANDROID} - for f := 1 to ParamCount do + f := 1; + while f <= ParamCount do begin - if ParamStr(f) = '--gdb' then noct := true - else if ParamStr(f) = '--log' then conbufDumpToStdOut := true - else if ParamStr(f) = '--safe-log' then e_SetSafeSlowLog(true); + case ParamStr(f) of + '--gdb': noct := true; + '--log': conbufDumpToStdOut := true; + '--safe-log': e_SetSafeSlowLog(true); + '--log-file': + if f + 1 <= ParamCount then + begin + Inc(f); + LogFileName := ParamStr(f) + end; + end; + Inc(f) end; + + if LogFileName = '' then + begin +{$IFDEF HEADLESS} + LogFileName := 'Doom2DF_H.log'; +{$ELSE} + LogFileName := 'Doom2DF.log'; +{$ENDIF} + end; + if noct then begin Main() diff --git a/src/game/g_game.pas b/src/game/g_game.pas index 77fd80a..e6429bc 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -211,7 +211,6 @@ const ANNOUNCE_ALL = 3; CONFIG_FILENAME = 'Doom2DF.cfg'; - LOG_FILENAME = 'Doom2DF.log'; TEST_MAP_NAME = '$$$_TEST_$$$'; diff --git a/src/game/g_main.pas b/src/game/g_main.pas index b559583..2f68e2e 100644 --- a/src/game/g_main.pas +++ b/src/game/g_main.pas @@ -32,6 +32,7 @@ var MapsDir: string; ModelsDir: string; GameWAD: string; + LogFileName: string; implementation @@ -67,7 +68,7 @@ begin ModelsDir := DataDir + 'models/'; GameWAD := DataDir + 'Game.wad'; - e_InitLog(GameDir + '/' + LOG_FILENAME, TWriteMode.WM_NEWFILE); + e_InitLog(GameDir + '/' + LogFileName, TWriteMode.WM_NEWFILE); e_WriteLog( 'Doom 2D: Forever version ' + GAME_VERSION +