0.7.9 hotfix 1

This commit is contained in:
Razor12911 2023-09-18 02:43:52 +02:00 committed by GitHub
parent 9d6a2d6e20
commit 9a1d5fafcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 42 additions and 30 deletions

View File

@ -1,9 +1,5 @@
unit IOExecute; unit IOExecute;
(* xbcm:t4:c256m
xtool execute {options} - - <stdin> <stdout> bcm.exe -9 [filein] [fileout]
xtool decode {options} - - <stdin> <stdout> bcm.exe -d [filein] [fileout] *)
interface interface
uses uses
@ -135,58 +131,74 @@ type
Mode: Byte; Mode: Byte;
end; end;
procedure Init(ParamArg: TArray<string>; Ctx: PCtx); procedure Init(ParamArg: TArray<string>; Ctx: PCtx; IsDecode: Boolean);
var var
I: Integer; I: Integer;
S: String; S1, S2: String;
begin begin
with Ctx^ do with Ctx^ do
begin begin
Exec := ''; Exec := '';
Param := ''; Param := '';
InFile := FILE_IN; InFile := '';
OutFile := FILE_OUT; OutFile := '';
Mode := 0; Mode := 0;
for I := Low(ParamArg) to High(ParamArg) do for I := Low(ParamArg) to High(ParamArg) do
begin begin
S := ParamArg[I]; S1 := ParamArg[I];
if ContainsText(S, '<stdin>') or ContainsText(S, '[stdin]') then if ContainsText(S1, '{stdin}') or ContainsText(S1, '<stdin>') or
ContainsText(S1, '[stdin]') then
begin begin
SetBits(Mode, 1, 0, 1); SetBits(Mode, 1, 0, 1);
continue; continue;
end end
else if ContainsText(S, '<stdout>') or ContainsText(S, '[stdout]') then else if ContainsText(S1, '{stdout}') or ContainsText(S1, '<stdout>') or
ContainsText(S1, '[stdout]') then
begin begin
SetBits(Mode, 1, 1, 1); SetBits(Mode, 1, 1, 1);
continue; continue;
end end
else if ContainsText(S, '<filein>') or ContainsText(S, '[filein]') then else if ContainsText(S1, '{filein}') or ContainsText(S1, '<filein>') or
ContainsText(S1, '[filein]') then
begin begin
S2 := IfThen(IsDecode = False, FILE_IN, FILE_OUT);
SetBits(Mode, 0, 0, 1); SetBits(Mode, 0, 0, 1);
if ContainsText(S, '<filein>') then if ContainsText(S1, '{filein}') then
InFile := ExtractStr('<filein>', S) InFile := ExtractStr('{filein}', S1)
else if ContainsText(S1, '<filein>') then
InFile := ExtractStr('<filein>', S1)
else else
InFile := ExtractStr('[filein]', S); InFile := ExtractStr('[filein]', S1);
S := ReplaceText(S, InFile, FILE_IN); InFile := ReplaceText(InFile, '{filein}', S2);
InFile := ReplaceText(InFile, '<filein>', FILE_IN); InFile := ReplaceText(InFile, '<filein>', S2);
InFile := ReplaceText(InFile, '[filein]', FILE_IN); InFile := ReplaceText(InFile, '[filein]', S2);
if ContainsText(S1, '{filein}') or ContainsText(S1, '<filein>') then
continue;
S1 := InFile;
end end
else if ContainsText(S, '<fileout>') or ContainsText(S, '[fileout]') then else if ContainsText(S1, '{fileout}') or ContainsText(S1, '<fileout>') or
ContainsText(S1, '[fileout]') then
begin begin
S2 := IfThen(IsDecode = True, FILE_IN, FILE_OUT);
SetBits(Mode, 0, 1, 1); SetBits(Mode, 0, 1, 1);
if ContainsText(S, '<fileout>') then if ContainsText(S1, '{fileout}') then
OutFile := ExtractStr('<fileout>', S) OutFile := ExtractStr('{fileout}', S1)
else if ContainsText(S1, '<fileout>') then
OutFile := ExtractStr('<fileout>', S1)
else else
OutFile := ExtractStr('[fileout]', S); OutFile := ExtractStr('[fileout]', S1);
S := ReplaceText(S, OutFile, FILE_OUT); OutFile := ReplaceText(OutFile, '{fileout}', S2);
OutFile := ReplaceText(OutFile, '<fileout>', FILE_OUT); OutFile := ReplaceText(OutFile, '<fileout>', S2);
OutFile := ReplaceText(OutFile, '[fileout]', FILE_OUT); OutFile := ReplaceText(OutFile, '[fileout]', S2);
if ContainsText(S1, '{fileout}') or ContainsText(S1, '<fileout>') then
continue;
S1 := OutFile;
end; end;
if I = 0 then if I = 0 then
Exec := ExpandPath(PluginsPath + S, True) Exec := ExpandPath(PluginsPath + S1, True)
else else
Param := Param + ' ' + IfThen(ContainsText(S, ' ') or (S = ''), Param := Param + ' ' + IfThen(ContainsText(S1, ' ') or (S1 = ''),
'"' + S + '"', S); '"' + S1 + '"', S1);
end; end;
end; end;
end; end;
@ -293,7 +305,7 @@ var
begin begin
I := XTOOL_EXEC; I := XTOOL_EXEC;
Output.WriteBuffer(I, I.Size); Output.WriteBuffer(I, I.Size);
Init(ParamArg, @LCtx); Init(ParamArg, @LCtx, False);
SetLength(WorkDir, Options.Threads); SetLength(WorkDir, Options.Threads);
SetLength(Tasks, Options.Threads); SetLength(Tasks, Options.Threads);
SetLength(State, Options.Threads); SetLength(State, Options.Threads);
@ -409,7 +421,7 @@ var
end; end;
begin begin
Init(ParamArg, @LCtx); Init(ParamArg, @LCtx, True);
SetLength(WorkDir, Options.Threads); SetLength(WorkDir, Options.Threads);
SetLength(Tasks, Options.Threads); SetLength(Tasks, Options.Threads);
SetLength(State, Options.Threads); SetLength(State, Options.Threads);