DEADSOFTWARE

"--log" cli arg; fixed bug with console output (endless loop)
[d2df-sdl.git] / src / game / g_main.pas
index 48f0bb5648c73f18825364e46b4e8b93c99bf4bf..0d84cf24a1bb27ef60c9e0456f76f4e8b0c9abda 100644 (file)
@@ -1,3 +1,19 @@
+(* Copyright (C)  DooM 2D:Forever Developers
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *)
+{$MODE DELPHI}
 unit g_main;
 
 interface
@@ -33,6 +49,8 @@ procedure Main();
 var
   sdlflags: LongWord;
 begin
+  e_InitWritelnDriver();
+
   GetDir(0, GameDir);
   MapsDir := GameDir + '/maps/';
   DataDir := GameDir + '/data/';
@@ -43,8 +61,11 @@ begin
 
   e_WriteLog('Read config file', MSG_NOTIFY);
   g_Options_Read(GameDir + '/' + CONFIG_FILENAME);
-  
-  e_WriteToStdOut := {$IFDEF HEADLESS}True;{$ELSE}False;{$ENDIF}
+
+{$IFDEF HEADLESS}
+  conbufDumpToStdOut := true;
+{$ENDIF}
+  e_WriteToStdOut := False; //{$IFDEF HEADLESS}True;{$ELSE}False;{$ENDIF}
 
   //GetSystemDefaultLCID()
 
@@ -52,7 +73,7 @@ begin
   //g_Language_Load(DataDir + gLanguage + '.txt');
   e_WriteLog(gLanguage, MSG_NOTIFY);
   g_Language_Set(gLanguage);
-  
+
 {$IFDEF HEADLESS}
   sdlflags := SDL_INIT_TIMER or $00004000;
 {$ELSE}
@@ -64,7 +85,7 @@ begin
 {$ENDIF}
   if SDL_Init(sdlflags) < 0 then
     raise Exception.Create('SDL: Init failed: ' + SDL_GetError());
-    
+
 {$IFDEF HEADLESS}
   SDL_StartTextInput();
 {$ENDIF}