update to 0.6.9 se

This commit is contained in:
Razor12911
2022-12-31 22:45:22 +02:00
parent 722279aad5
commit 552a733296
34 changed files with 374 additions and 250 deletions

View File

@@ -3,6 +3,7 @@ unit PrecompDLL;
interface
uses
InitCode,
Utils,
UIMain,
PrecompUtils,
@@ -151,14 +152,15 @@ end;
function DLLParse(Command: PChar; Option: PInteger;
Funcs: PPrecompFuncs): Boolean;
var
I: Integer;
I, J: Integer;
begin
Result := False;
for I := Low(CodecDLL) to High(CodecDLL) do
begin
if IndexText(Funcs^.GetCodec(Command, 0, False), CodecDLL[I].Names) >= 0
then
J := IndexText(Funcs^.GetCodec(Command, 0, False), CodecDLL[I].Names);
if J >= 0 then
begin
LongRec(Option^).Lo := J;
LongRec(Option^).Hi := I;
Result := True;
break;
@@ -355,7 +357,7 @@ var
initialization
DLLList := TDirectory.GetFiles(ExtractFilePath(Utils.GetModuleName), '*.dll',
DLLList := TDirectory.GetFiles(ExpandPath(PluginsPath, True), '*.dll',
TSearchOption.soTopDirectoryOnly);
FuncList := TStringList.Create;
for I := Low(DLLList) to High(DLLList) do
@@ -376,7 +378,7 @@ begin
@DLLStruct^.Scan2 := GetProcAddress(DLLHandle, 'PrecompScan2');
@DLLStruct^.Process := GetProcAddress(DLLHandle, 'PrecompProcess');
@DLLStruct^.Restore := GetProcAddress(DLLHandle, 'PrecompRestore');
if UIMain.DLLLoaded then
if InitCode.UIDLLLoaded then
XTLAddplugin(ChangeFileExt(ExtractFileName(DLLList[I]), ''),
PLUGIN_LIBRARY);
Insert(DLLStruct^, CodecDLL, Length(CodecDLL));
@@ -387,7 +389,7 @@ begin
Insert(S, CodecDLL[Pred(Length(CodecDLL))].Names,
Length(CodecDLL[Pred(Length(CodecDLL))].Names));
Insert(S, Codec.Names, Length(Codec.Names));
if UIMain.DLLLoaded then
if InitCode.UIDLLLoaded then
XTLAddCodec(S);
Inc(J);
end;
@@ -398,7 +400,7 @@ begin
Length(CodecDLL[Pred(Length(CodecDLL))].Names));
Insert(ChangeFileExt(ExtractFileName(DLLList[I]), ''), Codec.Names,
Length(Codec.Names));
if UIMain.DLLLoaded then
if InitCode.UIDLLLoaded then
XTLAddCodec(ChangeFileExt(ExtractFileName(DLLList[I]), ''));
end;
end;

View File

@@ -3,6 +3,7 @@ unit PrecompExe;
interface
uses
InitCode,
Utils, Threading,
SynCommons, SynCrypto,
PrecompUtils,
@@ -685,7 +686,8 @@ var
initialization
S1 := ChangeFileExt(Utils.GetModuleName, '.ini');
S1 := ExpandPath(PluginsPath, True) +
ChangeFileExt(ExtractFileName(Utils.GetModuleName), '.ini');
if FileExists(S1) then
begin
Ini := TMemIniFile.Create(S1);
@@ -694,7 +696,7 @@ begin
for I := 0 to SL.Count - 1 do
begin
List := DecodeStr(SL[I], ',');
if FileExists(ExtractFilePath(Utils.GetModuleName) +
if FileExists(ExpandPath(PluginsPath, True) +
GetCmdStr(Ini.ReadString(SL[I], 'Decode', ''), 0)) then
for K := Low(List) to High(List) do
begin
@@ -710,8 +712,7 @@ begin
else
S1 := Ini.ReadString(SL[I], 'Decode', '');
S1 := ReplaceText(S1, '<codec>', List[K]);
ExeStruct.Exec[X] := ExtractFilePath(Utils.GetModuleName) +
GetCmdStr(S1, 0);
ExeStruct.Exec[X] := ExpandPath(PluginsPath, True) + GetCmdStr(S1, 0);
ExeStruct.Param[X] := '';
ExeStruct.Mode[X] := 0;
for J := 1 to GetCmdCount(S1) - 1 do

View File

@@ -3,6 +3,7 @@ unit PrecompINI;
interface
uses
InitCode,
Utils, ParseExpr,
UIMain,
PrecompUtils,
@@ -379,7 +380,7 @@ var
initialization
CfgList := TDirectory.GetFiles(ExtractFilePath(Utils.GetModuleName), '*.ini',
CfgList := TDirectory.GetFiles(ExpandPath(PluginsPath, True), '*.ini',
TSearchOption.soTopDirectoryOnly);
SL := TStringList.Create;
SetLength(CodecCfg, 1);
@@ -391,7 +392,7 @@ begin
begin
S1 := ChangeFileExt(ExtractFileName(CfgList[I]), '');
Insert(S1, Codec.Names, Length(Codec.Names));
if UIMain.DLLLoaded then
if InitCode.UIDLLLoaded then
XTLAddplugin(S1, PLUGIN_CONFIG);
SetLength(CodecCfg[0], Succ(Length(CodecCfg[0])));
CfgRecArray := @CodecCfg[0, Pred(Length(CodecCfg[0]))];
@@ -403,7 +404,7 @@ begin
CfgRec := @CodecCfg[0, Pred(Length(CodecCfg[0])), J];
CfgRec^.Parser := TExpressionParser.Create;
CfgRec^.Name := ReadString('Stream' + X.ToString, 'Name', '');
if UIMain.DLLLoaded then
if InitCode.UIDLLLoaded then
XTLAddCodec(CfgRec^.Name);
CfgRec^.Codec := ReadString('Stream' + X.ToString, 'Codec', '');
CfgRec^.BigEndian := ReadBool('Stream' + X.ToString,

View File

@@ -3,6 +3,7 @@ unit PrecompINIEx;
interface
uses
InitCode,
Utils, ParseExpr,
UIMain,
PrecompUtils,
@@ -500,7 +501,7 @@ var
initialization
CfgList := TDirectory.GetFiles(ExtractFilePath(Utils.GetModuleName), '*.ini',
CfgList := TDirectory.GetFiles(ExpandPath(PluginsPath, True), '*.ini',
TSearchOption.soTopDirectoryOnly);
SL := TStringList.Create;
SetLength(CodecCfg, 1);
@@ -512,7 +513,7 @@ begin
begin
S1 := ChangeFileExt(ExtractFileName(CfgList[I]), '');
Insert(S1, Codec.Names, Length(Codec.Names));
if UIMain.DLLLoaded then
if InitCode.UIDLLLoaded then
XTLAddplugin(S1, PLUGIN_CONFIG);
SetLength(CodecCfg[0], Succ(Length(CodecCfg[0])));
CfgRecArray := @CodecCfg[0, Pred(Length(CodecCfg[0]))];
@@ -524,7 +525,7 @@ begin
CfgRec := @CodecCfg[0, Pred(Length(CodecCfg[0])), J];
CfgRec^.Parser := TExpressionParser.Create;
CfgRec^.Name := ReadString('StreamList' + X.ToString, 'Name', '');
if UIMain.DLLLoaded then
if InitCode.UIDLLLoaded then
XTLAddCodec(CfgRec^.Name);
CfgRec^.Codec := ReadString('StreamList' + X.ToString, 'Codec', '');
CfgRec^.BigEndian := ReadBool('StreamList' + X.ToString,

View File

@@ -31,6 +31,7 @@ const
var
SOList: array of array [0 .. CODEC_COUNT - 1] of TSOList;
CodecAvailable, CodecEnabled: TArray<Boolean>;
LMaxSize: Integer = L_MAXSIZE;
LBlockSize: Integer = L_BLOCKSIZE;
LBlockDependency: Integer = L_BLOCKDEPENDENCY;
LAcceleration: Integer = L_ACCELERATION;
@@ -61,6 +62,8 @@ begin
if (CompareText(S, LZ4Codecs[LZ4_CODEC]) = 0) and LZ4DLL.DLLLoaded then
begin
CodecEnabled[LZ4_CODEC] := True;
if Funcs^.GetParam(Command, X, 'm') <> '' then
LMaxSize := ConvertToBytes(Funcs^.GetParam(Command, X, 'm'));
if Funcs^.GetParam(Command, X, 'a') <> '' then
LAcceleration := StrToInt(Funcs^.GetParam(Command, X, 'a'));
end
@@ -72,6 +75,8 @@ begin
for I := Low(SOList) to High(SOList) do
SOList[I][LZ4HC_CODEC].Update
([StrToInt(Funcs^.GetParam(Command, X, 'l'))], True);
if Funcs^.GetParam(Command, X, 'm') <> '' then
LMaxSize := ConvertToBytes(Funcs^.GetParam(Command, X, 'm'));
end
else if (CompareText(S, LZ4Codecs[LZ4F_CODEC]) = 0) and LZ4DLL.DLLLoaded
then
@@ -81,6 +86,8 @@ begin
for I := Low(SOList) to High(SOList) do
SOList[I][LZ4F_CODEC].Update
([StrToInt(Funcs^.GetParam(Command, X, 'l'))], True);
if Funcs^.GetParam(Command, X, 'm') <> '' then
LMaxSize := ConvertToBytes(Funcs^.GetParam(Command, X, 'm'));
if Funcs^.GetParam(Command, X, 'b') <> '' then
LBlockSize := StrToInt(Funcs^.GetParam(Command, X, 'b')) - 4;
if Funcs^.GetParam(Command, X, 'd') <> '' then
@@ -182,7 +189,7 @@ begin
DI1.OldSize := SizeEx;
if not CodecAvailable[X] then
exit;
Y := Max(DI1.NewSize, L_MAXSIZE);
Y := Max(DI1.NewSize, LMaxSize);
Buffer := Funcs^.Allocator(Instance, Y);
case X of
LZ4_CODEC, LZ4HC_CODEC:
@@ -217,7 +224,7 @@ begin
end;
if BoolArray(CodecEnabled, False) then
exit;
Buffer := Funcs^.Allocator(Instance, L_MAXSIZE);
Buffer := Funcs^.Allocator(Instance, LMaxSize);
Pos := 0;
while Pos < Size do
begin
@@ -225,7 +232,7 @@ begin
(CodecEnabled[LZ4HC_CODEC] and (SOList[Instance][LZ4HC_CODEC].Count = 1))
then
begin
Y := LZ4_decompress_safe(Input + Pos, Buffer, SizeEx - Pos, L_MAXSIZE);
Y := LZ4_decompress_safe(Input + Pos, Buffer, SizeEx - Pos, LMaxSize);
if Abs(Y) > 256 then
begin
try
@@ -260,7 +267,7 @@ begin
if PCardinal(Input + Pos)^ = $184D2204 then
begin
Y := LZ4F_decompress_safe(Input + Pos, Buffer, SizeEx - Pos,
L_MAXSIZE, @X, @Z);
LMaxSize, @X, @Z);
if (X < Y) then
begin
Output(Instance, Buffer, Y);
@@ -296,7 +303,7 @@ begin
X := GetBits(StreamInfo^.Option, 0, 5);
if StreamInfo^.OldSize <= 0 then
exit;
StreamInfo^.NewSize := Max(StreamInfo^.NewSize, L_MAXSIZE);
StreamInfo^.NewSize := Max(StreamInfo^.NewSize, LMaxSize);
Buffer := Funcs^.Allocator(Instance, StreamInfo^.NewSize);
case X of
LZ4_CODEC, LZ4HC_CODEC:

View File

@@ -21,8 +21,8 @@ const
LZO1C_CODEC = 2;
const
L_WORKMEM = 524288;
L_MAXSIZE = 16 * 1024 * 1024;
L_WORKMEM = 524288;
LZO1X_999 = 999;
LZO2A_999 = 999;
LZO1C_999 = 999;
@@ -34,6 +34,7 @@ var
LZO2AVariant: Integer = LZO2A_999;
LZO1CVariant: Integer = LZO1C_999;
CodecAvailable, CodecEnabled: TArray<Boolean>;
LMaxSize: Integer = L_MAXSIZE;
type
PLZOSI = ^TLZOSI;
@@ -134,6 +135,8 @@ begin
for I := Low(SOList) to High(SOList) do
SOList[I][LZO1X_CODEC].Update
([StrToInt(Funcs^.GetParam(Command, X, 'l'))], True);
if Funcs^.GetParam(Command, X, 'm') <> '' then
LMaxSize := ConvertToBytes(Funcs^.GetParam(Command, X, 'm'));
end
else if (CompareText(S, LZOCodecs[LZO2A_CODEC]) = 0) and LZODLL.DLLLoaded
then
@@ -141,6 +144,8 @@ begin
CodecEnabled[LZO2A_CODEC] := True;
if Funcs^.GetParam(Command, X, 'v') = '999' then
LZO2AVariant := 999;
if Funcs^.GetParam(Command, X, 'm') <> '' then
LMaxSize := ConvertToBytes(Funcs^.GetParam(Command, X, 'm'));
end
else if (CompareText(S, LZOCodecs[LZO1C_CODEC]) = 0) and LZODLL.DLLLoaded
then
@@ -148,6 +153,8 @@ begin
CodecEnabled[LZO1C_CODEC] := True;
if Funcs^.GetParam(Command, X, 'v') = '999' then
LZO1CVariant := 999;
if Funcs^.GetParam(Command, X, 'm') <> '' then
LMaxSize := ConvertToBytes(Funcs^.GetParam(Command, X, 'm'));
end;
Inc(X);
end;
@@ -240,7 +247,7 @@ begin
exit;
if not CodecAvailable[X] then
exit;
Res := Max(DI1.NewSize, L_MAXSIZE);
Res := Max(DI1.NewSize, LMaxSize);
Buffer := Funcs^.Allocator(Instance, Res);
case X of
LZO1X_CODEC:
@@ -285,11 +292,11 @@ begin
end;
if BoolArray(CodecEnabled, False) then
exit;
Buffer := Funcs^.Allocator(Instance, L_MAXSIZE);
Buffer := Funcs^.Allocator(Instance, LMaxSize);
Pos := 0;
while Pos < Size do
begin
if GetLZO1XSI(Input + Pos, SizeEx - Pos, Buffer, L_MAXSIZE, @LZOSI) then
if GetLZO1XSI(Input + Pos, SizeEx - Pos, Buffer, LMaxSize, @LZOSI) then
begin
Output(Instance, Buffer, LZOSI.DSize);
SI.Position := Pos;
@@ -321,7 +328,7 @@ begin
X := GetBits(StreamInfo^.Option, 0, 5);
if StreamInfo^.OldSize <= 0 then
exit;
Res := Max(StreamInfo^.NewSize, L_MAXSIZE);
Res := Max(StreamInfo^.NewSize, LMaxSize);
Buffer := Funcs^.Allocator(Instance, Res);
case X of
LZO1X_CODEC:

View File

@@ -5,6 +5,7 @@ unit PrecompMain;
interface
uses
InitCode,
Threading, Utils, SynCommons, ParseClass, ParseExpr, FLZMA2DLL,
PrecompUtils, PrecompCrypto, PrecompZLib, PrecompLZ4, PrecompLZO, PrecompZSTD,
PrecompOodle, PrecompMedia, PrecompINI, PrecompINIEx, PrecompSearch,
@@ -197,7 +198,7 @@ begin
StoreDD := -2;
if ArgParse.AsBoolean('-dd') or ArgParse.AsBoolean('--dedup') then
StoreDD := -1;
if FileExists(ExtractFilePath(Utils.GetModuleName) + 'srep.exe') then
if FileExists(ExpandPath(PluginsPath + 'srep.exe', True)) then
begin
StoreDD := ArgParse.AsInteger('--dedup=', 0, StoreDD);
StoreDD := ArgParse.AsInteger('-dd', 0, StoreDD);
@@ -1736,9 +1737,9 @@ begin
TBufferedStream(TempOutput).Flush;
if StoreDD >= 0 then
begin
with TProcessStream.Create(ExtractFilePath(Utils.GetModuleName) +
'srep.exe', '-m' + StoreDD.ToString + 'f ' + S + ' -', GetCurrentDir,
nil, Output) do
with TProcessStream.Create(ExpandPath(PluginsPath + 'srep.exe', True),
'-m' + StoreDD.ToString + 'f ' + S + ' -', GetCurrentDir, nil,
Output) do
try
if Execute then
begin
@@ -2113,9 +2114,8 @@ begin
begin
if (Depth = 0) and (StoreDD >= 0) then
begin
LStream := TProcessStream.Create(ExtractFilePath(Utils.GetModuleName) +
'srep.exe', '-d -s -mem' + SrepMemCfg + ' - -', GetCurrentDir,
Input, nil);
LStream := TProcessStream.Create(ExpandPath(PluginsPath + 'srep.exe',
True), '-d -s -mem' + SrepMemCfg + ' - -', GetCurrentDir, Input, nil);
if not LStream.Execute then
raise EReadError.CreateRes(@SReadError);
DecInput[Index] := TBufferedStream.Create(LStream, True, 4194304);

View File

@@ -25,14 +25,17 @@ const
LEVIATHAN_CODEC = 5;
const
O_MAXSIZE = 16 * 1024 * 1024;
O_LENGTH = 32;
O_TRADEOFF = 256;
O_MAXSIZE = 16 * 1024 * 1024;
O_DICTIONARY = 0;
var
SOList: array of array [0 .. CODEC_COUNT - 1] of TSOList;
OMaxSize: Integer = O_MAXSIZE;
OLength: Integer = O_LENGTH;
OTradeOff: Integer = O_TRADEOFF;
ODictionary: Integer = O_DICTIONARY;
CodecAvailable, CodecEnabled: TArray<Boolean>;
type
@@ -379,10 +382,14 @@ begin
for I := Low(SOList) to High(SOList) do
SOList[I][Y].Update
([StrToInt(Funcs^.GetParam(Command, X, 'l'))], True);
if Funcs^.GetParam(Command, X, 'm') <> '' then
OMaxSize := ConvertToBytes(Funcs^.GetParam(Command, X, 'm'));
if Funcs^.GetParam(Command, X, 'n') <> '' then
OLength := StrToInt(Funcs^.GetParam(Command, X, 'n'));
if Funcs^.GetParam(Command, X, 't') <> '' then
OTradeOff := StrToInt(Funcs^.GetParam(Command, X, 't'));
if Funcs^.GetParam(Command, X, 'd') <> '' then
ODictionary := StrToInt(Funcs^.GetParam(Command, X, 'd'));
end;
Inc(X);
end;
@@ -427,6 +434,8 @@ begin
SetBits(Option^, 1, 12, 1);
if Funcs^.GetParam(Command, I, 't') <> '' then
SetBits(Option^, StrToInt(Funcs^.GetParam(Command, I, 't')), 13, 11);
if Funcs^.GetParam(Command, I, 'd') <> '' then
SetBits(Option^, StrToInt(Funcs^.GetParam(Command, I, 'd')), 24, 5);
Result := True;
end;
Inc(I);
@@ -462,7 +471,7 @@ begin
if (X in [LZNA_CODEC, LEVIATHAN_CODEC]) and (DI1.NewSize <= 0) then
exit;
if DI1.NewSize <= 0 then
Res := O_MAXSIZE
Res := OMaxSize
else
Res := DI1.NewSize;
Buffer := Funcs^.Allocator(Instance, Res);
@@ -619,9 +628,11 @@ begin
SizeOf(TOodleLZ_CompressOptions));
COptions.sendQuantumCRCs := GetBits(StreamInfo^.Option, 12, 1) = 1;
COptions.spaceSpeedTradeoffBytes := GetBits(StreamInfo^.Option, 13, 11);
// COptions.dictionarySize := 262144;
COptions.dictionarySize := IfThen(GetBits(StreamInfo^.Option, 24, 5) = 0, 0,
Round(Power(2, GetBits(StreamInfo^.Option, 24, 5))));
Params := 'l' + I.ToString + ':' + 'c' + GetBits(StreamInfo^.Option, 12, 1)
.ToString + ':' + 't' + GetBits(StreamInfo^.Option, 13, 11).ToString;
.ToString + ':' + 't' + GetBits(StreamInfo^.Option, 13, 11).ToString + ':'
+ 'd' + GetBits(StreamInfo^.Option, 24, 5).ToString;
if not Result then
Res1 := OodleLZ_Compress(Y, NewInput, StreamInfo^.NewSize, Buffer, I,
@COptions);
@@ -677,9 +688,12 @@ begin
COptions, SizeOf(TOodleLZ_CompressOptions));
COptions.sendQuantumCRCs := GetBits(StreamInfo.Option, 12, 1) = 1;
COptions.spaceSpeedTradeoffBytes := GetBits(StreamInfo.Option, 13, 11);
COptions.dictionarySize := IfThen(GetBits(StreamInfo.Option, 24, 5) = 0, 0,
Round(Power(2, GetBits(StreamInfo.Option, 24, 5))));
Params := 'l' + GetBits(StreamInfo.Option, 5, 7).ToString + ':' + 'c' +
GetBits(StreamInfo.Option, 12, 1).ToString + ':' + 't' +
GetBits(StreamInfo.Option, 13, 11).ToString;
GetBits(StreamInfo.Option, 13, 11).ToString + ':' + 'd' +
GetBits(StreamInfo.Option, 24, 5).ToString;
Res1 := OodleLZ_Compress(Y, Input, StreamInfo.NewSize, Buffer,
GetBits(StreamInfo.Option, 5, 7), @COptions);
Funcs^.LogRestore(OodleCodecs[GetBits(StreamInfo.Option, 0, 5)],

View File

@@ -3,6 +3,7 @@ unit PrecompSearch;
interface
uses
InitCode,
Utils, SynCommons, SynCrypto,
UIMain,
PrecompUtils,
@@ -265,7 +266,7 @@ var
initialization
SearchList := TDirectory.GetFiles(ExtractFilePath(Utils.GetModuleName), '*.xtl',
SearchList := TDirectory.GetFiles(ExpandPath(PluginsPath, True), '*.xtl',
TSearchOption.soTopDirectoryOnly);
for I := Low(SearchList) to High(SearchList) do
begin
@@ -282,7 +283,7 @@ begin
SetLength(CodecSearch, Succ(J));
S := ChangeFileExt(ExtractFileName(SearchList[I]), '');
Insert(S, Codec.Names, Length(Codec.Names));
if UIMain.DLLLoaded then
if InitCode.UIDLLLoaded then
XTLAddplugin(S, PLUGIN_DATABASE);
end;
while FStream.Position < FStream.Size do

View File

@@ -27,6 +27,7 @@ var
// cdict, ddict: Pointer;
DStream: TMemoryStream;
CodecAvailable, CodecEnabled: TArray<Boolean>;
ZMaxSize: Integer = Z_MAXSIZE;
function ZSTDInit(Command: PChar; Count: Integer; Funcs: PPrecompFuncs)
: Boolean;
@@ -59,6 +60,8 @@ begin
for I := Low(SOList) to High(SOList) do
SOList[I][ZSTD_CODEC].Update
([StrToInt(Funcs^.GetParam(Command, X, 'l'))], True);
if Funcs^.GetParam(Command, X, 'm') <> '' then
ZMaxSize := ConvertToBytes(Funcs^.GetParam(Command, X, 'm'));
end;
Inc(X);
end;
@@ -143,7 +146,7 @@ begin
exit;
Y := ZSTD_findDecompressedSize(Input, SizeEx);
if Y <= 0 then
Y := Z_MAXSIZE;
Y := ZMaxSize;
Buffer := Funcs^.Allocator(Instance, Y);
case X of
ZSTD_CODEC:
@@ -183,7 +186,7 @@ begin
begin
Z := ZSTD_findDecompressedSize(Input + Pos, X);
if Z <= 0 then
Z := Z_MAXSIZE;
Z := ZMaxSize;
Buffer := Funcs^.Allocator(Instance, Z);
Y := ZSTD_decompressDCtx(dctx[Instance], Buffer, Z, Input + Pos, X);
// Y := ZSTD_decompress_usingDDict(dctx[Instance], Buffer, Z, Input + Pos, X, ddict);
@@ -224,7 +227,7 @@ begin
if StreamInfo^.NewSize <= 0 then
StreamInfo^.NewSize := ZSTD_findDecompressedSize(Input, Size);
if StreamInfo^.NewSize <= 0 then
StreamInfo^.NewSize := Z_MAXSIZE;
StreamInfo^.NewSize := ZMaxSize;
Buffer := Funcs^.Allocator(Instance, StreamInfo^.NewSize);
case X of
ZSTD_CODEC: