Compare commits
4 Commits
Author | SHA1 | Date |
---|---|---|
![]() |
9a1d5fafcf | |
![]() |
9d6a2d6e20 | |
![]() |
16199e4908 | |
![]() |
83e41efb88 |
|
@ -10,6 +10,11 @@ uses
|
|||
|
||||
const
|
||||
OODLELZ_SCRATCH_MEM_NO_BOUND = NativeUInt(-1);
|
||||
{$IFDEF CPU64BITS}
|
||||
OODLELZ_ARCH = '_win64.dll';
|
||||
{$ELSE}
|
||||
OODLELZ_ARCH = '_win32.dll';
|
||||
{$ENDIF}
|
||||
|
||||
type
|
||||
POodleLZ_CompressOptions = ^TOodleLZ_CompressOptions;
|
||||
|
@ -95,7 +100,7 @@ begin
|
|||
for I := 3 to 9 do
|
||||
begin
|
||||
Lib.LoadLib(ExpandPath(PluginsPath + 'oo2core_' + I.ToString +
|
||||
'_win64.dll', True));
|
||||
OODLELZ_ARCH, True));
|
||||
if Lib.Loaded then
|
||||
break;
|
||||
end;
|
||||
|
@ -103,7 +108,7 @@ begin
|
|||
for I := 3 to 9 do
|
||||
begin
|
||||
Lib.LoadLib(ExpandPath(PluginsPath + 'oo2ext_' + I.ToString +
|
||||
'_win64.dll', True));
|
||||
OODLELZ_ARCH, True));
|
||||
if Lib.Loaded then
|
||||
break;
|
||||
end;
|
||||
|
@ -230,7 +235,7 @@ var
|
|||
|
||||
initialization
|
||||
|
||||
DLLFile := PluginsPath + 'oo2core_9_win64.dll';
|
||||
DLLFile := PluginsPath + 'oo2core_9' + OODLELZ_ARCH;
|
||||
for I := 1 to ParamCount do
|
||||
begin
|
||||
if ParamStr(I).StartsWith(DLLParam) then
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
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
|
||||
|
||||
uses
|
||||
|
@ -135,58 +131,74 @@ type
|
|||
Mode: Byte;
|
||||
end;
|
||||
|
||||
procedure Init(ParamArg: TArray<string>; Ctx: PCtx);
|
||||
procedure Init(ParamArg: TArray<string>; Ctx: PCtx; IsDecode: Boolean);
|
||||
var
|
||||
I: Integer;
|
||||
S: String;
|
||||
S1, S2: String;
|
||||
begin
|
||||
with Ctx^ do
|
||||
begin
|
||||
Exec := '';
|
||||
Param := '';
|
||||
InFile := FILE_IN;
|
||||
OutFile := FILE_OUT;
|
||||
InFile := '';
|
||||
OutFile := '';
|
||||
Mode := 0;
|
||||
for I := Low(ParamArg) to High(ParamArg) do
|
||||
begin
|
||||
S := ParamArg[I];
|
||||
if ContainsText(S, '<stdin>') or ContainsText(S, '[stdin]') then
|
||||
S1 := ParamArg[I];
|
||||
if ContainsText(S1, '{stdin}') or ContainsText(S1, '<stdin>') or
|
||||
ContainsText(S1, '[stdin]') then
|
||||
begin
|
||||
SetBits(Mode, 1, 0, 1);
|
||||
continue;
|
||||
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
|
||||
SetBits(Mode, 1, 1, 1);
|
||||
continue;
|
||||
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
|
||||
S2 := IfThen(IsDecode = False, FILE_IN, FILE_OUT);
|
||||
SetBits(Mode, 0, 0, 1);
|
||||
if ContainsText(S, '<filein>') then
|
||||
InFile := ExtractStr('<filein>', S)
|
||||
if ContainsText(S1, '{filein}') then
|
||||
InFile := ExtractStr('{filein}', S1)
|
||||
else if ContainsText(S1, '<filein>') then
|
||||
InFile := ExtractStr('<filein>', S1)
|
||||
else
|
||||
InFile := ExtractStr('[filein]', S);
|
||||
S := ReplaceText(S, InFile, FILE_IN);
|
||||
InFile := ReplaceText(InFile, '<filein>', FILE_IN);
|
||||
InFile := ReplaceText(InFile, '[filein]', FILE_IN);
|
||||
InFile := ExtractStr('[filein]', S1);
|
||||
InFile := ReplaceText(InFile, '{filein}', S2);
|
||||
InFile := ReplaceText(InFile, '<filein>', S2);
|
||||
InFile := ReplaceText(InFile, '[filein]', S2);
|
||||
if ContainsText(S1, '{filein}') or ContainsText(S1, '<filein>') then
|
||||
continue;
|
||||
S1 := InFile;
|
||||
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
|
||||
S2 := IfThen(IsDecode = True, FILE_IN, FILE_OUT);
|
||||
SetBits(Mode, 0, 1, 1);
|
||||
if ContainsText(S, '<fileout>') then
|
||||
OutFile := ExtractStr('<fileout>', S)
|
||||
if ContainsText(S1, '{fileout}') then
|
||||
OutFile := ExtractStr('{fileout}', S1)
|
||||
else if ContainsText(S1, '<fileout>') then
|
||||
OutFile := ExtractStr('<fileout>', S1)
|
||||
else
|
||||
OutFile := ExtractStr('[fileout]', S);
|
||||
S := ReplaceText(S, OutFile, FILE_OUT);
|
||||
OutFile := ReplaceText(OutFile, '<fileout>', FILE_OUT);
|
||||
OutFile := ReplaceText(OutFile, '[fileout]', FILE_OUT);
|
||||
OutFile := ExtractStr('[fileout]', S1);
|
||||
OutFile := ReplaceText(OutFile, '{fileout}', S2);
|
||||
OutFile := ReplaceText(OutFile, '<fileout>', S2);
|
||||
OutFile := ReplaceText(OutFile, '[fileout]', S2);
|
||||
if ContainsText(S1, '{fileout}') or ContainsText(S1, '<fileout>') then
|
||||
continue;
|
||||
S1 := OutFile;
|
||||
end;
|
||||
if I = 0 then
|
||||
Exec := ExpandPath(PluginsPath + S, True)
|
||||
Exec := ExpandPath(PluginsPath + S1, True)
|
||||
else
|
||||
Param := Param + ' ' + IfThen(ContainsText(S, ' ') or (S = ''),
|
||||
'"' + S + '"', S);
|
||||
Param := Param + ' ' + IfThen(ContainsText(S1, ' ') or (S1 = ''),
|
||||
'"' + S1 + '"', S1);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
@ -293,7 +305,7 @@ var
|
|||
begin
|
||||
I := XTOOL_EXEC;
|
||||
Output.WriteBuffer(I, I.Size);
|
||||
Init(ParamArg, @LCtx);
|
||||
Init(ParamArg, @LCtx, False);
|
||||
SetLength(WorkDir, Options.Threads);
|
||||
SetLength(Tasks, Options.Threads);
|
||||
SetLength(State, Options.Threads);
|
||||
|
@ -409,7 +421,7 @@ var
|
|||
end;
|
||||
|
||||
begin
|
||||
Init(ParamArg, @LCtx);
|
||||
Init(ParamArg, @LCtx, True);
|
||||
SetLength(WorkDir, Options.Threads);
|
||||
SetLength(Tasks, Options.Threads);
|
||||
SetLength(State, Options.Threads);
|
||||
|
|
|
@ -281,15 +281,15 @@ begin
|
|||
DeleteFile(WorkDir[Instance, 0] + InFile[0]);
|
||||
DeleteFile(WorkDir[Instance, 0] + OutFile[0]);
|
||||
S := Param[0];
|
||||
S := ReplaceText(S, '<insize>', StreamInfo^.OldSize.ToString);
|
||||
S := ReplaceText(S, '<outsize>', StreamInfo^.NewSize.ToString);
|
||||
S := ReplaceText(S, '[insize]', StreamInfo^.OldSize.ToString);
|
||||
S := ReplaceText(S, '[outsize]', StreamInfo^.NewSize.ToString);
|
||||
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
|
||||
begin
|
||||
T := StreamInfo^.Resource.ToHexString.ToLower + '.res';
|
||||
S := ReplaceText(S, '<fileres>', T);
|
||||
S := ReplaceText(S, '<ressize>', Res.ToString);
|
||||
S := ReplaceText(S, '[fileres]', T);
|
||||
S := ReplaceText(S, '[ressize]', Res.ToString);
|
||||
T := WorkDir[Instance, 0] + T;
|
||||
if not FileExists(T) then
|
||||
with TFileStream.Create(T, fmCreate) do
|
||||
|
@ -377,15 +377,15 @@ begin
|
|||
DeleteFile(WorkDir[Instance, 1] + InFile[1]);
|
||||
DeleteFile(WorkDir[Instance, 1] + OutFile[1]);
|
||||
S := Param[1];
|
||||
S := ReplaceText(S, '<insize>', StreamInfo^.NewSize.ToString);
|
||||
S := ReplaceText(S, '<outsize>', StreamInfo^.OldSize.ToString);
|
||||
S := ReplaceText(S, '[insize]', StreamInfo^.NewSize.ToString);
|
||||
S := ReplaceText(S, '[outsize]', StreamInfo^.OldSize.ToString);
|
||||
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
|
||||
begin
|
||||
T := StreamInfo^.Resource.ToHexString.ToLower + '.res';
|
||||
S := ReplaceText(S, '<fileres>', T);
|
||||
S := ReplaceText(S, '<ressize>', Res.ToString);
|
||||
S := ReplaceText(S, '[fileres]', T);
|
||||
S := ReplaceText(S, '[ressize]', Res.ToString);
|
||||
T := WorkDir[Instance, 1] + T;
|
||||
if not FileExists(T) then
|
||||
with TFileStream.Create(T, fmCreate) do
|
||||
|
@ -685,14 +685,15 @@ begin
|
|||
S1 := Ini.ReadString(SL[I], 'Encode', '')
|
||||
else
|
||||
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.Param[X] := '';
|
||||
ExeStruct.Mode[X] := 0;
|
||||
for J := 1 to GetCmdCount(S1) - 1 do
|
||||
begin
|
||||
S2 := GetCmdStr(S1, J);
|
||||
if ContainsText(S2, '<library>') then
|
||||
if ContainsText(S2, '<library>') or ContainsText(S2, '[library]')
|
||||
then
|
||||
begin
|
||||
SetBits(ExeStruct.Mode[X], STDIO_MODE, 0, 2);
|
||||
ExeStruct.IsLib[X] := True;
|
||||
|
@ -719,14 +720,13 @@ begin
|
|||
ExeStruct.InFile[X] := ExtractStr('<filein>', S2)
|
||||
else
|
||||
ExeStruct.InFile[X] := ExtractStr('[filein]', S2);
|
||||
S2 := ReplaceText(S2, ExeStruct.InFile[X], S3);
|
||||
ExeStruct.InFile[X] := ReplaceText(ExeStruct.InFile[X],
|
||||
'<filein>', S3);
|
||||
ExeStruct.InFile[X] := ReplaceText(ExeStruct.InFile[X],
|
||||
'[filein]', S3);
|
||||
S2 := ExeStruct.InFile[X];
|
||||
if ContainsText(S2, '[filein]') then
|
||||
if ContainsText(S2, '<filein>') then
|
||||
continue;
|
||||
S2 := ExeStruct.InFile[X];
|
||||
end
|
||||
else if ContainsText(S2, '<fileout>') or
|
||||
ContainsText(S2, '[fileout]') then
|
||||
|
@ -741,9 +741,9 @@ begin
|
|||
'<fileout>', S3);
|
||||
ExeStruct.OutFile[X] := ReplaceText(ExeStruct.OutFile[X],
|
||||
'[fileout]', S3);
|
||||
S2 := ExeStruct.OutFile[X];
|
||||
if ContainsText(S2, '[fileout]') then
|
||||
if ContainsText(S2, '<fileout>') then
|
||||
continue;
|
||||
S2 := ExeStruct.OutFile[X];
|
||||
end;
|
||||
S2 := IfThen((Pos(' ', S2) > 0) or (S2 = ''), '"' + S2 + '"', S2);
|
||||
ExeStruct.Param[X] := ExeStruct.Param[X] + ' ' + S2;
|
||||
|
|
|
@ -437,7 +437,7 @@ begin
|
|||
Options.DedupSysMem := -Options.DedupSysMem;
|
||||
SrepCfg := ArgParse.AsString('-sp', 0, '').ToLower;
|
||||
{$IFDEF CPU64BITS}
|
||||
S := ArgParse.AsString('-p', 0, '512mb');
|
||||
S := ArgParse.AsString('-p', 0, '0mb');
|
||||
S := ReplaceText(S, 'KB', '* 1024^1');
|
||||
S := ReplaceText(S, 'MB', '* 1024^2');
|
||||
S := ReplaceText(S, 'GB', '* 1024^3');
|
||||
|
|
Loading…
Reference in New Issue