hedgewars/ArgParsers.inc
changeset 8325 ecd51650d5d8
parent 8309 edcfb5e43245
child 8327 a6f3452f5f94
equal deleted inserted replaced
8324:e0dcf5b0e1b1 8325:ecd51650d5d8
    14  * You should have received a copy of the GNU General Public License
    14  * You should have received a copy of the GNU General Public License
    15  * along with this program; if not, write to the Free Software
    15  * along with this program; if not, write to the Free Software
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    17  *)
    17  *)
    18 
    18 
    19 
    19 procedure GciEasterEgg;
    20 procedure internalStartGameWithParameters();
    20 begin
    21 var tmp: LongInt;
    21     WriteLn(stdout, '                                                                ');
    22 begin
    22     WriteLn(stdout, '      /\\\\\\\\\\\\        /\\\\\\\\\  /\\\\\\\\\\\             ');
    23     UserPathPrefix:= ParamStr(1);
    23     WriteLn(stdout, '     /\\\//////////      /\\\////////  \/////\\\///             ');
    24     cScreenWidth:= StrToInt(ParamStr(2));
    24     WriteLn(stdout, '     /\\\               /\\\/               \/\\\               ');
    25     cScreenHeight:= StrToInt(ParamStr(3));
    25     WriteLn(stdout, '     \/\\\    /\\\\\\\  /\\\                 \/\\\              ');
    26     //cBits:= StrToInt(ParamStr(4));
    26     WriteLn(stdout, '      \/\\\   \/////\\\ \/\\\                 \/\\\             ');
    27     ipcPort:= StrToInt(ParamStr(5));
    27     WriteLn(stdout, '       \/\\\       \/\\\ \//\\\                \/\\\            ');
    28     cFullScreen:= ParamStr(6) = '1';
    28     WriteLn(stdout, '        \/\\\       \/\\\  \///\\\              \/\\\           ');
    29     SetSound(ParamStr(7) = '1');
    29     WriteLn(stdout, '         \/\\\\\\\\\\\\\/     \////\\\\\\\\\  /\\\\\\\\\\\      ');
    30     SetMusic(ParamStr(8) = '1');
    30     WriteLn(stdout, '          \/////////////          \/////////  \///////////      ');
    31     SetVolume(StrToInt(ParamStr(9)));
    31     WriteLn(stdout, '                                                                ');
    32     cTimerInterval:= StrToInt(ParamStr(10));
    32     WriteLn(stdout, ' Command Line Parser Implementation by a Google Code-In Student ');
    33     PathPrefix:= ParamStr(11);
    33     WriteLn(stdout, '             ASCII Art easter egg idea by @sheepluva            ');
    34     cShowFPS:= ParamStr(12) = '1';
    34     WriteLn(stdout, '                                                                ');
    35     cAltDamage:= ParamStr(13) = '1';
    35 end;
    36     UserNick:= DecodeBase64(ParamStr(14));
    36 
    37     cReducedQuality:= StrToInt(ParamStr(15));
    37 procedure DisplayUsage;
    38     tmp:= StrToInt(ParamStr(16));
    38 begin
       
    39     WriteLn(stdout, 'Usage: hwengine <path to replay file> [options]');
       
    40     WriteLn(stdout, '');
       
    41     WriteLn(stdout, 'where [options] can be any of the following:');
       
    42     WriteLn(stdout, ' --prefix [path to folder]');
       
    43     WriteLn(stdout, ' --user-prefix [path to folder]');
       
    44     WriteLn(stdout, ' --locale [name of language file]');
       
    45     WriteLn(stdout, ' --nick [string]');
       
    46     WriteLn(stdout, ' --width [screen width in pixels]');
       
    47     WriteLn(stdout, ' --height [screen height in pixels]');
       
    48     WriteLn(stdout, ' --volume [sound level]');
       
    49     WriteLn(stdout, ' --frame-interval [milliseconds]');
       
    50     Writeln(stdout, ' --stereo [value]');
       
    51     WriteLn(stdout, ' --raw-quality [flags]');
       
    52     WriteLn(stdout, ' --low-quality');
       
    53     WriteLn(stdout, ' --nomusic');
       
    54     WriteLn(stdout, ' --nosound');
       
    55     WriteLn(stdout, ' --fullscreen');
       
    56     WriteLn(stdout, ' --showfps');
       
    57     WriteLn(stdout, ' --altdmg');
       
    58     WriteLn(stdout, ' --stats-only');
       
    59     WriteLn(stdout, ' --help');
       
    60     WriteLn(stdout, '');
       
    61     WriteLn(stdout, 'For more detailed help and examples go to:');
       
    62     WriteLn(stdout, 'http://code.google.com/p/hedgewars/wiki/CommandLineOptions');
       
    63     GameType:= gmtSyntax;
       
    64 end;
       
    65 
       
    66 procedure setDepth(var paramIndex: LongInt);
       
    67 begin
       
    68     WriteLn(stdout, 'WARNING: --depth is a deprecated command, which could be removed in a future version!');
       
    69     WriteLn(stdout, '         This option no longer does anything, please consider removing it');
       
    70     WriteLn(stdout, '');
       
    71    inc(ParamIndex);
       
    72 end;
       
    73 
       
    74 procedure statsOnlyGame;
       
    75 begin
       
    76     cOnlyStats:= true;
       
    77     cReducedQuality:= $FFFFFFFF xor rqLowRes;
       
    78     SetSound(false);
       
    79     SetMusic(false);
       
    80     SetVolume(0);
       
    81 end;
       
    82 
       
    83 procedure setIpcPort(port: LongInt; var wrongParameter:Boolean);
       
    84 begin
       
    85     if isInternal then
       
    86         ipcPort := port
       
    87     else
       
    88         begin
       
    89         WriteLn(stderr, 'ERROR: use of --port is not allowed');
       
    90         wrongParameter := true;
       
    91         end
       
    92 end;
       
    93 
       
    94 function parseNick(nick: String): String;
       
    95 begin
       
    96     if isInternal then
       
    97         parseNick:= DecodeBase64(nick)
       
    98     else
       
    99         parseNick:= nick;
       
   100 end;
       
   101 
       
   102 procedure setStereoMode(tmp: LongInt);
       
   103 begin
    39     GrayScale:= false;
   104     GrayScale:= false;
    40 {$IFDEF USE_S3D_RENDERING}
   105 {$IFDEF USE_S3D_RENDERING}
    41     if (tmp > 9) and (tmp < 16) then
   106     if (tmp > 9) and (tmp < 16) then
    42         begin
   107         begin
    43         // set the gray anaglyph rendering
   108         // set the gray anaglyph rendering
    49         cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp)))
   114         cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp)))
    50     else
   115     else
    51         // any other mode
   116         // any other mode
    52         cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp-6)));
   117         cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp-6)));
    53 {$ELSE}
   118 {$ELSE}
    54 	cStereoMode:= smNone;
   119     cStereoMode:= smNone;
    55 {$ENDIF}
   120 {$ENDIF}
    56     cLocaleFName:= ParamStr(17);
   121 end;
    57 end;
   122 
    58 
   123 procedure startVideoRecording(var paramIndex: LongInt);
       
   124 begin
    59 {$IFDEF USE_VIDEO_RECORDING}
   125 {$IFDEF USE_VIDEO_RECORDING}
    60 procedure internalStartVideoRecordingWithParameters();
       
    61 begin
       
    62     internalStartGameWithParameters();
       
    63     GameType:= gmtRecord;
   126     GameType:= gmtRecord;
    64     cVideoFramerateNum:= StrToInt(ParamStr(18));
   127     inc(paramIndex);
    65     cVideoFramerateDen:= StrToInt(ParamStr(19));
   128     cVideoFramerateNum:= StrToInt(ParamStr(paramIndex)); inc(paramIndex);
    66     RecPrefix:= ParamStr(20);
   129     cVideoFramerateDen:= StrToInt(ParamStr(paramIndex)); inc(paramIndex);
    67     cAVFormat:= ParamStr(21);
   130     RecPrefix:= ParamStr(paramIndex);                    inc(paramIndex);
    68     cVideoCodec:= ParamStr(22);
   131     cAVFormat:= ParamStr(paramIndex);                    inc(paramIndex);
    69     cVideoQuality:= StrToInt(ParamStr(23));
   132     cVideoCodec:= ParamStr(paramIndex);                  inc(paramIndex);
    70     cAudioCodec:= ParamStr(24);
   133     cVideoQuality:= StrToInt(ParamStr(paramIndex));      inc(paramIndex);
    71 end;
   134     cAudioCodec:= ParamStr(paramIndex);                  inc(paramIndex);
    72 {$ENDIF}
   135 {$ENDIF}
    73 
       
    74 procedure DisplayUsage;
       
    75 begin
       
    76     WriteLn(stdout, 'Usage: hwengine <path to replay file> [options]');
       
    77     WriteLn(stdout, '');
       
    78     WriteLn(stdout, 'where [options] can be any of the following:');
       
    79     WriteLn(stdout, ' --prefix [path to folder]');
       
    80     WriteLn(stdout, ' --user-prefix [path to folder]');
       
    81     WriteLn(stdout, ' --locale [name of language file]');
       
    82     WriteLn(stdout, ' --width [screen width in pixels]');
       
    83     WriteLn(stdout, ' --height [screen height in pixels]');
       
    84     WriteLn(stdout, ' --volume [sound level]');
       
    85     WriteLn(stdout, ' --frame-interval [milliseconds]');
       
    86     WriteLn(stdout, ' --raw-quality [flags]');
       
    87     WriteLn(stdout, ' --low-quality');
       
    88     WriteLn(stdout, ' --nomusic');
       
    89     WriteLn(stdout, ' --nosound');
       
    90     WriteLn(stdout, ' --fullscreen');
       
    91     WriteLn(stdout, ' --showfps');
       
    92     WriteLn(stdout, ' --altdmg');
       
    93     WriteLn(stdout, ' --stats-only');
       
    94     WriteLn(stdout, ' --help');
       
    95     WriteLn(stdout, '');
       
    96     WriteLn(stdout, 'For more detailed help and examples go to:');
       
    97     WriteLn(stdout, 'http://code.google.com/p/hedgewars/wiki/CommandLineOptions');
       
    98 end;
   136 end;
    99 
   137 
   100 function getLongIntParameter(str:String; var paramIndex:LongInt; var wrongParameter:Boolean): LongInt;
   138 function getLongIntParameter(str:String; var paramIndex:LongInt; var wrongParameter:Boolean): LongInt;
   101 var tmpInt, c: LongInt;
   139 var tmpInt, c: LongInt;
   102 begin
   140 begin
   120 
   158 
   121 procedure parseClassicParameter(cmdArray: Array of String; size:LongInt; var paramIndex:LongInt); Forward;
   159 procedure parseClassicParameter(cmdArray: Array of String; size:LongInt; var paramIndex:LongInt); Forward;
   122 
   160 
   123 function parseParameter(cmd:String; arg:String; var paramIndex:LongInt): Boolean;
   161 function parseParameter(cmd:String; arg:String; var paramIndex:LongInt): Boolean;
   124 const videoArray: Array [1..3] of String = ('--width','--height','--depth');
   162 const videoArray: Array [1..3] of String = ('--width','--height','--depth');
   125 const audioArray: Array [1..3] of String = ('--volume','--nomusic','--nosound');
   163       audioArray: Array [1..3] of String = ('--volume','--nomusic','--nosound');
   126 const otherArray: Array [1..3] of String = ('--locale','--fullscreen','--showfps');
   164       otherArray: Array [1..3] of String = ('--locale','--fullscreen','--showfps');
   127 const mediaArray: Array [1..8] of String = ('--width','--height','--depth','--volume','--nomusic','--nosound','--locale','--fullscreen');
   165       mediaArray: Array [1..8] of String = ('--width','--height','--depth','--volume','--nomusic','--nosound','--locale','--fullscreen');
   128 const allArray: Array [1..12] of String = ('--width','--height','--depth','--volume','--nomusic','--nosound','--locale','--fullscreen','--showfps','--altdmg','--time','--lowquality');
   166       allArray: Array [1..12] of String = ('--width','--height','--depth','--volume','--nomusic','--nosound','--locale','--fullscreen','--showfps','--altdmg','--frame-interval','--low-quality');
   129 const reallyAll: array[0..22] of shortstring = (
   167       reallyAll: array[0..28] of shortstring = (
   130                 '--prefix', '--user-prefix', '--locale', '--width', '--height', '--frame-interval', '--volume','--nomusic', '--nosound',
   168                 '--prefix', '--user-prefix', '--locale', '--width', '--height', '--frame-interval', '--volume','--nomusic', '--nosound',
   131                 '--fullscreen', '--showfps', '--altdmg', '--low-quality', '--raw-quality',
   169                 '--fullscreen', '--showfps', '--altdmg', '--low-quality', '--raw-quality', '--stereo', '--nick',
   132   {deprecated}  '--depth', '--set-video', '--set-audio', '--set-other', '--set-multimedia', '--set-everything',
   170   {deprecated}  '--depth', '--set-video', '--set-audio', '--set-other', '--set-multimedia', '--set-everything',
   133                 '--stats-only', '--gci', '--help');
   171   {internal}    '--internal', '--port', '--recorder', '--landpreview',
       
   172   {misc}        '--stats-only', '--gci', '--help');
   134 var cmdIndex: byte;
   173 var cmdIndex: byte;
   135 begin
   174 begin
   136     parseParameter:= false;
   175     parseParameter:= false;
   137     cmdIndex:= 0;
   176     cmdIndex:= 0;
   138 
   177 
   153         {--fullscreen}      9 : cFullScreen    := true;
   192         {--fullscreen}      9 : cFullScreen    := true;
   154         {--showfps}        10 : cShowFPS       := true;
   193         {--showfps}        10 : cShowFPS       := true;
   155         {--altdmg}         11 : cAltDamage     := true;
   194         {--altdmg}         11 : cAltDamage     := true;
   156         {--low-quality}    12 : cReducedQuality:= $FFFFFFFF xor rqLowRes;
   195         {--low-quality}    12 : cReducedQuality:= $FFFFFFFF xor rqLowRes;
   157         {--raw-quality}    13 : cReducedQuality:= getLongIntParameter(arg, paramIndex, parseParameter);
   196         {--raw-quality}    13 : cReducedQuality:= getLongIntParameter(arg, paramIndex, parseParameter);
       
   197         {--stereo}         14 : setStereoMode   ( getLongIntParameter(arg, paramIndex, parseParameter) );
       
   198         {--nick}           15 : UserNick       := parseNick( getStringParameter(arg, paramIndex, parseParameter) );
   158         {deprecated options}
   199         {deprecated options}
   159         {--depth}          14 : {do nothing};
   200         {--depth}          16 : setDepth(paramIndex);
   160         {--set-video}      15 : parseClassicParameter(videoArray,3,paramIndex);
   201         {--set-video}      17 : parseClassicParameter(videoArray,3,paramIndex);
   161         {--set-audio}      16 : parseClassicParameter(audioArray,3,paramIndex);
   202         {--set-audio}      18 : parseClassicParameter(audioArray,3,paramIndex);
   162         {--set-other}      17 : parseClassicParameter(otherArray,3,paramIndex);
   203         {--set-other}      19 : parseClassicParameter(otherArray,3,paramIndex);
   163         {--set-multimedia} 18 : parseClassicParameter(mediaArray,8,paramIndex);
   204         {--set-multimedia} 20 : parseClassicParameter(mediaArray,8,paramIndex);
   164         {--set-everything} 19 : parseClassicParameter(allArray,12,paramIndex);
   205         {--set-everything} 21 : parseClassicParameter(allArray,12,paramIndex);
       
   206         {"internal" options}
       
   207         {--internal}       22 : {note it, but do nothing};
       
   208         {--port}            23 : setIpcPort( getLongIntParameter(arg, paramIndex, parseParameter), parseParameter );
       
   209         {--recorder}       24 : startVideoRecording(paramIndex);
       
   210         {--landpreview}    25 : GameType := gmtLandPreview;
   165         {anything else}
   211         {anything else}
   166         {--stats-only}     20 : begin
   212         {--stats-only}     26 : statsOnlyGame();
   167                                 cOnlyStats:= true;
   213         {--gci}            27 : GciEasterEgg();
   168                                 cReducedQuality:= $FFFFFFFF xor rqLowRes;
   214         {--help}           28 : DisplayUsage();
   169                                 SetSound(false);
       
   170                                 end;
       
   171         {--gci}            21 : begin            //     We had to make up all this saved space some how...     \\
       
   172                                 WriteLn(stdout, '                                                                ');
       
   173                                 WriteLn(stdout, '      /\\\\\\\\\\\\        /\\\\\\\\\  /\\\\\\\\\\\             ');
       
   174                                 WriteLn(stdout, '     /\\\//////////      /\\\////////  \/////\\\///             ');
       
   175                                 WriteLn(stdout, '     /\\\               /\\\/               \/\\\               ');
       
   176                                 WriteLn(stdout, '     \/\\\    /\\\\\\\  /\\\                 \/\\\              ');
       
   177                                 WriteLn(stdout, '      \/\\\   \/////\\\ \/\\\                 \/\\\             ');
       
   178                                 WriteLn(stdout, '       \/\\\       \/\\\ \//\\\                \/\\\            ');
       
   179                                 WriteLn(stdout, '        \/\\\       \/\\\  \///\\\              \/\\\           ');
       
   180                                 WriteLn(stdout, '         \/\\\\\\\\\\\\\/     \////\\\\\\\\\  /\\\\\\\\\\\      ');
       
   181                                 WriteLn(stdout, '          \/////////////          \/////////  \///////////      ');
       
   182                                 WriteLn(stdout, '                                                                ');
       
   183                                 WriteLn(stdout, ' Command Line Parser Implementation by a Google Code-In Student ');
       
   184                                 WriteLn(stdout, '             ASCII Art easter egg idea by @sheepluva            ');
       
   185                                 WriteLn(stdout, '                                                                ');
       
   186                                 end;
       
   187         {--help}           22 : begin
       
   188                                 DisplayUsage();
       
   189                                 GameType:= gmtSyntax;
       
   190                                 end;
       
   191     else
   215     else
   192         begin
   216         begin
   193         //Asusme the first "non parameter" is the replay file, anything else is invalid
   217         //Asusme the first "non parameter" is the replay file, anything else is invalid
   194         if recordFileName = '' then
   218         if (recordFileName = '') and (Copy(cmd,1,2) <> '--') then
   195             recordFileName := cmd
   219             recordFileName := cmd
   196         else
   220         else
   197             begin
   221             begin
   198             WriteLn(stderr, 'ERROR: '+cmd+' is not a valid argument');
   222             WriteLn(stderr, '"'+cmd+'" is not a valid option');
   199             parseParameter:= true;
   223             parseParameter:= true;
   200             end;
   224             end;
   201         end;
   225         end;
   202     end;
   226     end;
   203 end;
   227 end;
   204 
   228 
   205 procedure parseClassicParameter(cmdArray: Array of String; size:LongInt; var paramIndex:LongInt);
   229 procedure parseClassicParameter(cmdArray: Array of String; size:LongInt; var paramIndex:LongInt);
   206 var index, tmpInt: LongInt;
   230 var index, tmpInt: LongInt;
   207     isBool: Boolean;
   231     isBool, isValid: Boolean;
       
   232     cmd, arg, newSyntax: String;
   208 begin
   233 begin
   209     WriteLn(stdout, 'WARNING: you are using a deprecated command, which could be removed in a future version!');
   234     WriteLn(stdout, 'WARNING: you are using a deprecated command, which could be removed in a future version!');
   210     WriteLn(stdout, '         Consider updating to the latest syntax, which is much more flexible!');
   235     WriteLn(stdout, '         Consider updating to the latest syntax, which is much more flexible!');
   211     WriteLn(stdout, '         Run `hwegine --help` to learn it!');
   236     WriteLn(stdout, '         Run `hwegine --help` to learn it!');
   212     WriteLn(stdout, '');
   237     WriteLn(stdout, '');
   213 
   238 
   214     index:= 0;
   239     index:= 0;
   215     tmpInt:= 1;
   240     tmpInt:= 1;
   216     while (index < size) do
   241     while (index < size) do
   217         begin
   242         begin
   218         paramIndex:= paramIndex+1;
   243         inc(paramIndex);
       
   244         cmd:= cmdArray[index];
       
   245         arg:= ParamStr(paramIndex);
       
   246         isValid:= (cmd<>'--depth');
       
   247 
   219         // check if the parameter is a boolean one
   248         // check if the parameter is a boolean one
   220         isBool:= (cmdArray[index] = '--nomusic')
   249         isBool:= (cmd = '--nomusic') or (cmd = '--nosound') or (cmd = '--fullscreen') or (cmd = '--showfps') or (cmd = '--altdmg');
   221             or (cmdArray[index] = '--nosound')
   250         if isBool and (arg='0') then
   222             or (cmdArray[index] = '--fullscreen')
   251             isValid:= false;
   223             or (cmdArray[index] = '--showfps')
   252         if (cmd='--nomusic') or (cmd='--nosound') then
   224             or (cmdArray[index] = '--altdmg')
   253             isValid:= not isValid;
   225             or (cmdArray[index] = '--low-quality');
   254 
   226         if (not isBool) or ((ParamStr(paramIndex)='1') and (cmdArray[index]<>'--nomusic') and (cmdArray[index]<>'--nosound')) then
   255         if isValid then
   227             parseParameter(cmdArray[index], ParamStr(paramIndex), tmpInt);
   256             begin
       
   257             parseParameter(cmd, arg, tmpInt);
       
   258             newSyntax += cmd + ' ';
       
   259             if not isBool then
       
   260                 newSyntax += arg + ' ';
       
   261             end;
   228         inc(index);
   262         inc(index);
   229         end;
   263         end;
       
   264     
       
   265     WriteLn(stdout, 'Attempted to automatically convert to the new syntax:');
       
   266     WriteLn(stdout, newSyntax);
       
   267     WriteLn(stdout, '');
   230 end;
   268 end;
   231 
   269 
   232 procedure playReplayFileWithParameters;
   270 procedure playReplayFileWithParameters;
   233 var paramIndex: LongInt;
   271 var paramIndex: LongInt;
   234     wrongParameter: boolean;
   272     wrongParameter: boolean;
   240         if parseParameter( ParamStr(paramIndex), ParamStr(paramIndex+1), paramIndex) then
   278         if parseParameter( ParamStr(paramIndex), ParamStr(paramIndex+1), paramIndex) then
   241             wrongParameter:= true;
   279             wrongParameter:= true;
   242         inc(paramIndex);
   280         inc(paramIndex);
   243         end;
   281         end;
   244     if wrongParameter = true then
   282     if wrongParameter = true then
   245         begin
       
   246         WriteLn(stderr, 'Please use --help to see possible arguments and their usage');
       
   247         GameType:= gmtSyntax;
   283         GameType:= gmtSyntax;
   248         end
       
   249 end;
   284 end;
   250 
   285 
   251 procedure GetParams;
   286 procedure GetParams;
       
   287 //var tmpInt: LongInt;
   252 begin
   288 begin
   253     (*
   289     (*
   254     tmpInt:=0;
   290     tmpInt:=0;
   255     while (tmpInt <= ParamCount) do
   291     while (tmpInt <= ParamCount) do
   256         begin
   292         begin
   257         WriteLn(stdout,inttostr(tmpInt) + ': ' + ParamStr(tmpInt));
   293         WriteLn(stdout, inttostr(tmpInt) + ': ' + ParamStr(tmpInt));
   258         inc(tmpInt);
   294         inc(tmpInt);
   259         end;
   295         end;
   260     *)
   296     *)
   261 
   297 
   262     if (ParamCount = 3) and (ParamStr(3) = 'landpreview') then
   298     isInternal:= (ParamStr(1) = '--internal');
   263     begin
       
   264         PathPrefix := ParamStr(1);
       
   265         ipcPort    := StrToInt(ParamStr(2));
       
   266         GameType   := gmtLandPreview;
       
   267         exit;
       
   268     end;
       
   269 
       
   270     //TODO: prepend something so that we can use a cDefaultParamNum of parameters
       
   271     if ParamCount = cDefaultParamNum then
       
   272     begin
       
   273         internalStartGameWithParameters();
       
   274         exit;
       
   275     end
       
   276 {$IFDEF USE_VIDEO_RECORDING}
       
   277     else if ParamCount = cVideorecParamNum then
       
   278     begin
       
   279         internalStartVideoRecordingWithParameters();
       
   280         exit;
       
   281     end
       
   282 {$ENDIF};
       
   283 
   299 
   284     UserPathPrefix := '.';
   300     UserPathPrefix := '.';
   285     PathPrefix     := cDefaultPathPrefix;
   301     PathPrefix     := cDefaultPathPrefix;
   286     recordFileName := '';
   302     recordFileName := '';
   287     playReplayFileWithParameters();
   303     playReplayFileWithParameters();
   288 
   304 
   289     if (recordFileName = '') then
   305     if (isInternal) and (ParamCount<=1) then
   290         begin
   306         begin
   291         DisplayUsage();
   307         WriteLn(stderr, '--internal should not be manually used');
   292         GameType:= gmtSyntax;
   308         GameType := gmtSyntax;
   293         end;
   309         end;
       
   310 
       
   311     if (not isInternal) and (recordFileName = '') then
       
   312         begin
       
   313         WriteLn(stderr, 'You must specify a replay file');
       
   314         GameType := gmtSyntax;
       
   315         end
       
   316     else if (recordFileName <> '') then
       
   317         WriteLn(stdout, 'Attempting to play demo file "' + recordFilename + '"');
       
   318 
       
   319     if (GameType = gmtSyntax) then
       
   320         WriteLn(stderr, 'Please use --help to see possible arguments and their usage');
       
   321 
   294     (*
   322     (*
   295     WriteLn(stdout,'PathPrefix:     ' + PathPrefix);
   323     WriteLn(stdout,'PathPrefix:     ' + PathPrefix);
   296     WriteLn(stdout,'UserPathPrefix: ' + UserPathPrefix);
   324     WriteLn(stdout,'UserPathPrefix: ' + UserPathPrefix);
   297     WriteLn(stdout,'recordFilename: ' + recordFilename);
       
   298     *)
   325     *)
   299 end;
   326 end;
   300 
       
   301