|
@@ -6,7 +6,9 @@ uses
|
|
const
|
|
const
|
|
use_temp_dir : boolean = true;
|
|
use_temp_dir : boolean = true;
|
|
hide_execution : boolean = true;
|
|
hide_execution : boolean = true;
|
|
- do_exit : boolean =true;
|
|
|
|
|
|
+ do_exit : boolean = true;
|
|
|
|
+ verbose : boolean = false;
|
|
|
|
+
|
|
dosbox_timeout : integer = 100; { default timeout in seconds }
|
|
dosbox_timeout : integer = 100; { default timeout in seconds }
|
|
var
|
|
var
|
|
OutputFileName : String;
|
|
OutputFileName : String;
|
|
@@ -21,6 +23,8 @@ begin
|
|
repeat
|
|
repeat
|
|
try
|
|
try
|
|
FileName := TempDir + 'dosboxwrappertmp_' + IntToStr(Random(100000));
|
|
FileName := TempDir + 'dosboxwrappertmp_' + IntToStr(Random(100000));
|
|
|
|
+ if verbose then
|
|
|
|
+ writeln('Trying to create directory ',Filename);
|
|
MkDir(FileName);
|
|
MkDir(FileName);
|
|
Done := True;
|
|
Done := True;
|
|
except
|
|
except
|
|
@@ -28,7 +32,10 @@ begin
|
|
begin
|
|
begin
|
|
{ 5 = Access Denied, returned when a file is duplicated }
|
|
{ 5 = Access Denied, returned when a file is duplicated }
|
|
if E.ErrorCode <> 5 then
|
|
if E.ErrorCode <> 5 then
|
|
- raise;
|
|
|
|
|
|
+ begin
|
|
|
|
+ Writeln('Directory creation failed');
|
|
|
|
+ raise;
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
until Done;
|
|
until Done;
|
|
@@ -44,7 +51,8 @@ begin
|
|
SourceConfFileName := ExtractFilePath(ParamStr(0)) + 'dosbox.conf';
|
|
SourceConfFileName := ExtractFilePath(ParamStr(0)) + 'dosbox.conf';
|
|
TargetConfFileName := ADosBoxDir + 'dosbox.conf';
|
|
TargetConfFileName := ADosBoxDir + 'dosbox.conf';
|
|
OutputFileName := ADosBoxDir + 'dosbox.out';
|
|
OutputFileName := ADosBoxDir + 'dosbox.out';
|
|
- Writeln('Using target dosbox.conf ',TargetConfFileName);
|
|
|
|
|
|
+ if verbose then
|
|
|
|
+ Writeln('Using target dosbox.conf ',TargetConfFileName);
|
|
AssignFile(SourceFile, SourceConfFileName);
|
|
AssignFile(SourceFile, SourceConfFileName);
|
|
AssignFile(TargetFile, TargetConfFileName);
|
|
AssignFile(TargetFile, TargetConfFileName);
|
|
Reset(SourceFile);
|
|
Reset(SourceFile);
|
|
@@ -77,7 +85,8 @@ var
|
|
Buf: array [0..4095] of Byte;
|
|
Buf: array [0..4095] of Byte;
|
|
BytesRead: Integer;
|
|
BytesRead: Integer;
|
|
begin
|
|
begin
|
|
- Writeln('CopyFile ', ASrcFileName, '->', ADestFileName);
|
|
|
|
|
|
+ if verbose then
|
|
|
|
+ Writeln('CopyFile ', ASrcFileName, '->', ADestFileName);
|
|
if not AnsiEndsText('.exe', ASrcFileName) then
|
|
if not AnsiEndsText('.exe', ASrcFileName) then
|
|
ASrcFileName := ASrcFileName + '.exe';
|
|
ASrcFileName := ASrcFileName + '.exe';
|
|
OldFileMode := FileMode;
|
|
OldFileMode := FileMode;
|
|
@@ -107,29 +116,42 @@ end;
|
|
|
|
|
|
{ On modified dosbox executable it is possible to get
|
|
{ On modified dosbox executable it is possible to get
|
|
a copy of all output to CON into a file, simply write it
|
|
a copy of all output to CON into a file, simply write it
|
|
- back to output, so it ends up into testname.elg file }
|
|
|
|
|
|
+ back to output, so it ends up into testname.elg file.
|
|
|
|
+ Skip all until line beginning with 'Drive C is mounted as' }
|
|
procedure EchoOutput;
|
|
procedure EchoOutput;
|
|
|
|
+const
|
|
|
|
+ SkipUntilText = 'Drive C is mounted as ';
|
|
var
|
|
var
|
|
StdText : TextFile;
|
|
StdText : TextFile;
|
|
st : string;
|
|
st : string;
|
|
line : longint;
|
|
line : longint;
|
|
|
|
+ SkipUntilSeen : boolean;
|
|
begin
|
|
begin
|
|
if FileExists(OutputFileName) then
|
|
if FileExists(OutputFileName) then
|
|
begin
|
|
begin
|
|
- Writeln('Trying to open ',OutputFileName);
|
|
|
|
|
|
+ if verbose then
|
|
|
|
+ Writeln('Trying to open ',OutputFileName);
|
|
try
|
|
try
|
|
AssignFile(StdText, OutputFileName);
|
|
AssignFile(StdText, OutputFileName);
|
|
Reset(StdText);
|
|
Reset(StdText);
|
|
- Writeln('Successfully opened ',OutputFileName,', copying content to output');
|
|
|
|
|
|
+ if verbose then
|
|
|
|
+ Writeln('Successfully opened ',OutputFileName,', copying content to output');
|
|
try
|
|
try
|
|
line:=0;
|
|
line:=0;
|
|
|
|
+ SkipUntilSeen:=false;
|
|
while not eof(StdText) do
|
|
while not eof(StdText) do
|
|
begin
|
|
begin
|
|
Readln(StdText,st);
|
|
Readln(StdText,st);
|
|
inc(line);
|
|
inc(line);
|
|
- Writeln(line,': ',st);
|
|
|
|
|
|
+ if not SkipUntilSeen then
|
|
|
|
+ SkipUntilSeen:=pos(SkipUntilText,st)>0;
|
|
|
|
+ if SkipUntilSeen then
|
|
|
|
+ Writeln(line,': ',st);
|
|
end;
|
|
end;
|
|
finally
|
|
finally
|
|
|
|
+ if not SkipUntilSeen then
|
|
|
|
+ Writeln('Could not find "',SkipUntilText,'" in file ',OutputFilename);
|
|
|
|
+ Flush(output);
|
|
CloseFile(StdText);
|
|
CloseFile(StdText);
|
|
end;
|
|
end;
|
|
finally
|
|
finally
|
|
@@ -149,11 +171,11 @@ begin
|
|
Readln(F, Result);
|
|
Readln(F, Result);
|
|
if Result <> 0 then
|
|
if Result <> 0 then
|
|
Writeln('ExitCode=',Result);
|
|
Writeln('ExitCode=',Result);
|
|
|
|
+ CloseFile(F);
|
|
except
|
|
except
|
|
Writeln('Unable to read exitcode value');
|
|
Writeln('Unable to read exitcode value');
|
|
ReadExitCode:=127*256;
|
|
ReadExitCode:=127*256;
|
|
end;
|
|
end;
|
|
- CloseFile(F);
|
|
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure ExecuteDosBox(const ADosBoxBinaryPath, ADosBoxDir: string);
|
|
procedure ExecuteDosBox(const ADosBoxBinaryPath, ADosBoxDir: string);
|
|
@@ -224,6 +246,11 @@ begin
|
|
do_exit:=false;
|
|
do_exit:=false;
|
|
Writeln('do_exit set to false');
|
|
Writeln('do_exit set to false');
|
|
end;
|
|
end;
|
|
|
|
+ if GetEnvironmentVariable('DOSBOX_VERBOSE')<>'' then
|
|
|
|
+ begin
|
|
|
|
+ verbose:=true;
|
|
|
|
+ Writeln('verbose set to true');
|
|
|
|
+ end;
|
|
if GetEnvironmentVariable('DOSBOX_TIMEOUT')<>'' then
|
|
if GetEnvironmentVariable('DOSBOX_TIMEOUT')<>'' then
|
|
begin
|
|
begin
|
|
dosbox_timeout:=StrToInt(GetEnvironmentVariable('DOSBOX_TIMEOUT'));
|
|
dosbox_timeout:=StrToInt(GetEnvironmentVariable('DOSBOX_TIMEOUT'));
|