Compare commits

...

4 Commits
079 ... main

Author SHA1 Message Date
Razor12911 9a1d5fafcf
0.7.9 hotfix 1 2023-09-18 02:43:52 +02:00
Razor12911 9d6a2d6e20
0.7.9 hotfix 1 2023-09-18 02:42:53 +02:00
Razor12911 16199e4908
0.7.9 hotfix 1 2023-09-18 02:42:01 +02:00
Razor12911 83e41efb88
0.7.9 hotfix 1 2023-09-14 23:04:54 +02:00
4 changed files with 68 additions and 51 deletions

View File

@ -10,6 +10,11 @@ uses
const const
OODLELZ_SCRATCH_MEM_NO_BOUND = NativeUInt(-1); OODLELZ_SCRATCH_MEM_NO_BOUND = NativeUInt(-1);
{$IFDEF CPU64BITS}
OODLELZ_ARCH = '_win64.dll';
{$ELSE}
OODLELZ_ARCH = '_win32.dll';
{$ENDIF}
type type
POodleLZ_CompressOptions = ^TOodleLZ_CompressOptions; POodleLZ_CompressOptions = ^TOodleLZ_CompressOptions;
@ -95,7 +100,7 @@ begin
for I := 3 to 9 do for I := 3 to 9 do
begin begin
Lib.LoadLib(ExpandPath(PluginsPath + 'oo2core_' + I.ToString + Lib.LoadLib(ExpandPath(PluginsPath + 'oo2core_' + I.ToString +
'_win64.dll', True)); OODLELZ_ARCH, True));
if Lib.Loaded then if Lib.Loaded then
break; break;
end; end;
@ -103,7 +108,7 @@ begin
for I := 3 to 9 do for I := 3 to 9 do
begin begin
Lib.LoadLib(ExpandPath(PluginsPath + 'oo2ext_' + I.ToString + Lib.LoadLib(ExpandPath(PluginsPath + 'oo2ext_' + I.ToString +
'_win64.dll', True)); OODLELZ_ARCH, True));
if Lib.Loaded then if Lib.Loaded then
break; break;
end; end;
@ -230,7 +235,7 @@ var
initialization initialization
DLLFile := PluginsPath + 'oo2core_9_win64.dll'; DLLFile := PluginsPath + 'oo2core_9' + OODLELZ_ARCH;
for I := 1 to ParamCount do for I := 1 to ParamCount do
begin begin
if ParamStr(I).StartsWith(DLLParam) then if ParamStr(I).StartsWith(DLLParam) then

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);

View File

@ -281,15 +281,15 @@ begin
DeleteFile(WorkDir[Instance, 0] + InFile[0]); DeleteFile(WorkDir[Instance, 0] + InFile[0]);
DeleteFile(WorkDir[Instance, 0] + OutFile[0]); DeleteFile(WorkDir[Instance, 0] + OutFile[0]);
S := Param[0]; S := Param[0];
S := ReplaceText(S, '<insize>', StreamInfo^.OldSize.ToString); S := ReplaceText(S, '[insize]', StreamInfo^.OldSize.ToString);
S := ReplaceText(S, '<outsize>', StreamInfo^.NewSize.ToString); S := ReplaceText(S, '[outsize]', StreamInfo^.NewSize.ToString);
Res := 0; Res := 0;
if ContainsText(S, '<fileres>') and Funcs^.GetResource(StreamInfo^.Resource, if ContainsText(S, '[fileres]') and Funcs^.GetResource(StreamInfo^.Resource,
nil, @Res) and (Res > 0) then nil, @Res) and (Res > 0) then
begin begin
T := StreamInfo^.Resource.ToHexString.ToLower + '.res'; T := StreamInfo^.Resource.ToHexString.ToLower + '.res';
S := ReplaceText(S, '<fileres>', T); S := ReplaceText(S, '[fileres]', T);
S := ReplaceText(S, '<ressize>', Res.ToString); S := ReplaceText(S, '[ressize]', Res.ToString);
T := WorkDir[Instance, 0] + T; T := WorkDir[Instance, 0] + T;
if not FileExists(T) then if not FileExists(T) then
with TFileStream.Create(T, fmCreate) do with TFileStream.Create(T, fmCreate) do
@ -377,15 +377,15 @@ begin
DeleteFile(WorkDir[Instance, 1] + InFile[1]); DeleteFile(WorkDir[Instance, 1] + InFile[1]);
DeleteFile(WorkDir[Instance, 1] + OutFile[1]); DeleteFile(WorkDir[Instance, 1] + OutFile[1]);
S := Param[1]; S := Param[1];
S := ReplaceText(S, '<insize>', StreamInfo^.NewSize.ToString); S := ReplaceText(S, '[insize]', StreamInfo^.NewSize.ToString);
S := ReplaceText(S, '<outsize>', StreamInfo^.OldSize.ToString); S := ReplaceText(S, '[outsize]', StreamInfo^.OldSize.ToString);
Res := 0; Res := 0;
if ContainsText(S, '<fileres>') and Funcs^.GetResource(StreamInfo^.Resource, if ContainsText(S, '[fileres]') and Funcs^.GetResource(StreamInfo^.Resource,
nil, @Res) and (Res > 0) then nil, @Res) and (Res > 0) then
begin begin
T := StreamInfo^.Resource.ToHexString.ToLower + '.res'; T := StreamInfo^.Resource.ToHexString.ToLower + '.res';
S := ReplaceText(S, '<fileres>', T); S := ReplaceText(S, '[fileres]', T);
S := ReplaceText(S, '<ressize>', Res.ToString); S := ReplaceText(S, '[ressize]', Res.ToString);
T := WorkDir[Instance, 1] + T; T := WorkDir[Instance, 1] + T;
if not FileExists(T) then if not FileExists(T) then
with TFileStream.Create(T, fmCreate) do with TFileStream.Create(T, fmCreate) do
@ -685,14 +685,15 @@ begin
S1 := Ini.ReadString(SL[I], 'Encode', '') S1 := Ini.ReadString(SL[I], 'Encode', '')
else else
S1 := Ini.ReadString(SL[I], 'Decode', ''); S1 := Ini.ReadString(SL[I], 'Decode', '');
S1 := ReplaceText(S1, '<codec>', List[K]); S1 := ReplaceText(S1, '[codec]', List[K]);
ExeStruct.Exec[X] := ExpandPath(PluginsPath, True) + GetCmdStr(S1, 0); ExeStruct.Exec[X] := ExpandPath(PluginsPath, True) + GetCmdStr(S1, 0);
ExeStruct.Param[X] := ''; ExeStruct.Param[X] := '';
ExeStruct.Mode[X] := 0; ExeStruct.Mode[X] := 0;
for J := 1 to GetCmdCount(S1) - 1 do for J := 1 to GetCmdCount(S1) - 1 do
begin begin
S2 := GetCmdStr(S1, J); S2 := GetCmdStr(S1, J);
if ContainsText(S2, '<library>') then if ContainsText(S2, '<library>') or ContainsText(S2, '[library]')
then
begin begin
SetBits(ExeStruct.Mode[X], STDIO_MODE, 0, 2); SetBits(ExeStruct.Mode[X], STDIO_MODE, 0, 2);
ExeStruct.IsLib[X] := True; ExeStruct.IsLib[X] := True;
@ -719,14 +720,13 @@ begin
ExeStruct.InFile[X] := ExtractStr('<filein>', S2) ExeStruct.InFile[X] := ExtractStr('<filein>', S2)
else else
ExeStruct.InFile[X] := ExtractStr('[filein]', S2); ExeStruct.InFile[X] := ExtractStr('[filein]', S2);
S2 := ReplaceText(S2, ExeStruct.InFile[X], S3);
ExeStruct.InFile[X] := ReplaceText(ExeStruct.InFile[X], ExeStruct.InFile[X] := ReplaceText(ExeStruct.InFile[X],
'<filein>', S3); '<filein>', S3);
ExeStruct.InFile[X] := ReplaceText(ExeStruct.InFile[X], ExeStruct.InFile[X] := ReplaceText(ExeStruct.InFile[X],
'[filein]', S3); '[filein]', S3);
S2 := ExeStruct.InFile[X]; if ContainsText(S2, '<filein>') then
if ContainsText(S2, '[filein]') then
continue; continue;
S2 := ExeStruct.InFile[X];
end end
else if ContainsText(S2, '<fileout>') or else if ContainsText(S2, '<fileout>') or
ContainsText(S2, '[fileout]') then ContainsText(S2, '[fileout]') then
@ -741,9 +741,9 @@ begin
'<fileout>', S3); '<fileout>', S3);
ExeStruct.OutFile[X] := ReplaceText(ExeStruct.OutFile[X], ExeStruct.OutFile[X] := ReplaceText(ExeStruct.OutFile[X],
'[fileout]', S3); '[fileout]', S3);
S2 := ExeStruct.OutFile[X]; if ContainsText(S2, '<fileout>') then
if ContainsText(S2, '[fileout]') then
continue; continue;
S2 := ExeStruct.OutFile[X];
end; end;
S2 := IfThen((Pos(' ', S2) > 0) or (S2 = ''), '"' + S2 + '"', S2); S2 := IfThen((Pos(' ', S2) > 0) or (S2 = ''), '"' + S2 + '"', S2);
ExeStruct.Param[X] := ExeStruct.Param[X] + ' ' + S2; ExeStruct.Param[X] := ExeStruct.Param[X] + ' ' + S2;

View File

@ -437,7 +437,7 @@ begin
Options.DedupSysMem := -Options.DedupSysMem; Options.DedupSysMem := -Options.DedupSysMem;
SrepCfg := ArgParse.AsString('-sp', 0, '').ToLower; SrepCfg := ArgParse.AsString('-sp', 0, '').ToLower;
{$IFDEF CPU64BITS} {$IFDEF CPU64BITS}
S := ArgParse.AsString('-p', 0, '512mb'); S := ArgParse.AsString('-p', 0, '0mb');
S := ReplaceText(S, 'KB', '* 1024^1'); S := ReplaceText(S, 'KB', '* 1024^1');
S := ReplaceText(S, 'MB', '* 1024^2'); S := ReplaceText(S, 'MB', '* 1024^2');
S := ReplaceText(S, 'GB', '* 1024^3'); S := ReplaceText(S, 'GB', '* 1024^3');