update to 0.7.9
This commit is contained in:
@@ -36,6 +36,7 @@ var
|
||||
: Pointer cdecl;
|
||||
brunsli_free_JPEGOutput: procedure(P: Pointer)cdecl;
|
||||
brunsli_WriteJpeg: function(P: Pointer; oup: Pointer): Integer cdecl;
|
||||
|
||||
DLLLoaded: Boolean = False;
|
||||
|
||||
implementation
|
||||
@@ -45,7 +46,8 @@ var
|
||||
|
||||
procedure Init;
|
||||
begin
|
||||
Lib := TLibImport.Create(ExpandPath(PluginsPath + 'brunsli.dll', True));
|
||||
Lib := TLibImport.Create;
|
||||
Lib.LoadLib(ExpandPath(PluginsPath + 'brunsli.dll', True));
|
||||
if Lib.Loaded then
|
||||
begin
|
||||
@brunsli_alloc_JPEGData := Lib.GetProcAddr('brunsli_alloc_JPEGData');
|
||||
|
@@ -118,6 +118,7 @@ var
|
||||
: Boolean cdecl;
|
||||
FLAC__stream_decoder_finish: function(encoder: Pointer): Boolean cdecl;
|
||||
FLAC__stream_decoder_delete: procedure(encoder: Pointer)cdecl;
|
||||
|
||||
DLLLoaded: Boolean = False;
|
||||
|
||||
implementation
|
||||
@@ -127,8 +128,8 @@ var
|
||||
|
||||
procedure Init;
|
||||
begin
|
||||
Lib := TLibImport.Create
|
||||
(ExpandPath(PluginsPath + 'libFLAC_dynamic.dll', True));
|
||||
Lib := TLibImport.Create;
|
||||
Lib.LoadLib(ExpandPath(PluginsPath + 'libFLAC_dynamic.dll', True));
|
||||
if Lib.Loaded then
|
||||
begin
|
||||
@FLAC__stream_encoder_new := Lib.GetProcAddr('FLAC__stream_encoder_new');
|
||||
|
@@ -21,6 +21,12 @@ const
|
||||
FL2_BLOCK_OVERLAP_MIN = 0;
|
||||
FL2_BLOCK_OVERLAP_MAX = 14;
|
||||
|
||||
{$IFDEF CPU32BITS}
|
||||
FL2_DEC_MEM = 1 shl 29;
|
||||
{$ELSE}
|
||||
FL2_DEC_MEM = 1 shl 31;
|
||||
{$ENDIF}
|
||||
|
||||
type
|
||||
PFL2_inBuffer = ^FL2_inBuffer;
|
||||
|
||||
@@ -154,12 +160,15 @@ var
|
||||
|
||||
FL2_endStream: function(fcs: Pointer; output: PFL2_outBuffer): size_t cdecl;
|
||||
|
||||
FL2_estimateDStreamSize: function(dictSize: size_t; nbThreads: Cardinal)
|
||||
: size_t cdecl;
|
||||
FL2_isError: function(code: size_t): Cardinal cdecl;
|
||||
FL2_CStream_setParameter: function(fcs: Pointer; param: FL2_cParameter;
|
||||
value: size_t): size_t cdecl;
|
||||
FL2_CStream_getParameter: function(fcs: Pointer; param: FL2_cParameter)
|
||||
: size_t cdecl;
|
||||
FL2_setDStreamMemoryLimitMt: procedure(fds: Pointer; limit: size_t)cdecl;
|
||||
|
||||
DLLLoaded: boolean = False;
|
||||
|
||||
type
|
||||
@@ -193,23 +202,25 @@ type
|
||||
FBufferSize = 65536;
|
||||
private
|
||||
FCtx: Pointer;
|
||||
FThreads, FDictionary: Integer;
|
||||
FDecMem: Int64;
|
||||
FInp: FL2_inBuffer;
|
||||
FInput: TStream;
|
||||
FBuffer: array [0 .. FBufferSize - 1] of Byte;
|
||||
FInSize, FOutSize: Int64;
|
||||
FInitialized: boolean;
|
||||
public
|
||||
constructor Create(AInput: TStream);
|
||||
destructor Destroy; override;
|
||||
function Read(var Buffer; Count: Integer): Integer; override;
|
||||
property Threads: Integer read FThreads write FThreads;
|
||||
property DecodeMemory: Int64 read FDecMem write FDecMem;
|
||||
property InSize: Int64 read FInSize;
|
||||
property OutSize: Int64 read FOutSize;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
var
|
||||
Lib: TLibImport;
|
||||
|
||||
constructor TLZMACompressStream.Create(AOutput: TStream);
|
||||
begin
|
||||
inherited Create;
|
||||
@@ -236,6 +247,7 @@ function TLZMACompressStream.Write(const Buffer; Count: LongInt): LongInt;
|
||||
var
|
||||
Inp: FL2_inBuffer;
|
||||
Oup: FL2_outBuffer;
|
||||
LDict: Integer;
|
||||
begin
|
||||
Result := 0;
|
||||
if not FInitialized then
|
||||
@@ -255,6 +267,11 @@ begin
|
||||
FL2_CStream_setParameter(FCtx, FL2_cParameter.FL2_p_overlapFraction,
|
||||
FOverlap);
|
||||
FL2_initCStream(FCtx, 0);
|
||||
FL2_CStream_setParameter(FCtx, FL2_cParameter.FL2_p_overlapFraction,
|
||||
FOverlap);
|
||||
LDict := FL2_CStream_getParameter(FCtx,
|
||||
FL2_cParameter.FL2_p_dictionarySize);
|
||||
FOutput.WriteBuffer(LDict, LDict.size);
|
||||
FInitialized := True;
|
||||
end;
|
||||
Inp.src := PByte(@Buffer);
|
||||
@@ -298,27 +315,52 @@ end;
|
||||
constructor TLZMADecompressStream.Create(AInput: TStream);
|
||||
begin
|
||||
inherited Create;
|
||||
FThreads := ConvertToThreads('50p');
|
||||
AInput.ReadBuffer(FDictionary, FDictionary.size);
|
||||
FDecMem := FL2_DEC_MEM;
|
||||
FInput := AInput;
|
||||
{ FCtx := FL2_createDStream;
|
||||
FL2_setDStreamMemoryLimitMt(FCtx, 0); }
|
||||
FCtx := FL2_createDStream;
|
||||
FL2_initDStream(FCtx);
|
||||
FillChar(FInp, SizeOf(FL2_inBuffer), 0);
|
||||
FInSize := 0;
|
||||
FOutSize := 0;
|
||||
FInitialized := False;
|
||||
end;
|
||||
|
||||
destructor TLZMADecompressStream.Destroy;
|
||||
begin
|
||||
FL2_freeDCtx(FCtx);
|
||||
if FInitialized then
|
||||
try
|
||||
FL2_freeDCtx(FCtx);
|
||||
except
|
||||
end;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TLZMADecompressStream.Read(var Buffer; Count: Integer): Integer;
|
||||
var
|
||||
I: Integer;
|
||||
Oup: FL2_outBuffer;
|
||||
begin
|
||||
Result := 0;
|
||||
if not FInitialized then
|
||||
begin
|
||||
for I := FThreads downto 1 do
|
||||
begin
|
||||
if FL2_estimateDStreamSize(FDictionary, I) <= FDecMem then
|
||||
begin
|
||||
FThreads := I;
|
||||
break;
|
||||
end;
|
||||
end;
|
||||
if FThreads > 1 then
|
||||
begin
|
||||
FCtx := FL2_createDStreamMt(FThreads);
|
||||
FL2_setDStreamMemoryLimitMt(FCtx, NativeInt.MaxValue);
|
||||
end
|
||||
else
|
||||
FCtx := FL2_createDStream;
|
||||
FL2_initDStream(FCtx);
|
||||
FillChar(FInp, SizeOf(FL2_inBuffer), 0);
|
||||
FInitialized := True;
|
||||
end;
|
||||
if FInp.pos = FInp.size then
|
||||
begin
|
||||
FInp.src := @FBuffer[0];
|
||||
@@ -349,9 +391,13 @@ begin
|
||||
Result := Oup.pos;
|
||||
end;
|
||||
|
||||
var
|
||||
Lib: TLibImport;
|
||||
|
||||
procedure Init;
|
||||
begin
|
||||
Lib := TLibImport.Create(ExpandPath(PluginsPath + 'fast-lzma2.dll', True));
|
||||
Lib := TLibImport.Create;
|
||||
Lib.LoadLib(ExpandPath(PluginsPath + 'fast-lzma2.dll', True));
|
||||
if Lib.Loaded then
|
||||
begin
|
||||
@FL2_compress := Lib.GetProcAddr('FL2_compress');
|
||||
@@ -377,6 +423,7 @@ begin
|
||||
@FL2_initDStream := Lib.GetProcAddr('FL2_initDStream');
|
||||
@FL2_decompressStream := Lib.GetProcAddr('FL2_decompressStream');
|
||||
@FL2_endStream := Lib.GetProcAddr('FL2_endStream');
|
||||
@FL2_estimateDStreamSize := Lib.GetProcAddr('FL2_estimateDStreamSize');
|
||||
@FL2_isError := Lib.GetProcAddr('FL2_isError');
|
||||
@FL2_CStream_setParameter := Lib.GetProcAddr('FL2_CStream_setParameter');
|
||||
@FL2_CStream_getParameter := Lib.GetProcAddr('FL2_CStream_getParameter');
|
||||
|
@@ -1,52 +0,0 @@
|
||||
unit GrittibanzliDLL;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
WinAPI.Windows,
|
||||
System.SysUtils, System.Classes;
|
||||
|
||||
var
|
||||
Grittibanzli: function(const src: Pointer; srcSize: Cardinal; dst1: Pointer;
|
||||
dst1Capacity: PCardinal; dst2: Pointer; dst2Capacity: PCardinal)
|
||||
: boolean cdecl;
|
||||
Ungrittibanzli: function(const src1: Pointer; src1Size: Cardinal;
|
||||
const src2: Pointer; src2Size: Cardinal; dst: Pointer;
|
||||
dstCapacity: PCardinal): boolean cdecl;
|
||||
DLLLoaded: boolean = False;
|
||||
|
||||
implementation
|
||||
|
||||
var
|
||||
DLLHandle: THandle;
|
||||
|
||||
procedure Init;
|
||||
begin
|
||||
DLLHandle := LoadLibrary(PChar(ExtractFilePath(ParamStr(0)) +
|
||||
'grittibanzli_dll.dll'));
|
||||
if DLLHandle >= 32 then
|
||||
begin
|
||||
@Grittibanzli := GetProcAddress(DLLHandle, '__Grittibanzli');
|
||||
@Ungrittibanzli := GetProcAddress(DLLHandle, '__Ungrittibanzli');
|
||||
DLLLoaded := Assigned(Grittibanzli) and Assigned(Ungrittibanzli);
|
||||
end
|
||||
else
|
||||
DLLLoaded := False;
|
||||
end;
|
||||
|
||||
procedure Deinit;
|
||||
begin
|
||||
if not DLLLoaded then
|
||||
exit;
|
||||
FreeLibrary(DLLHandle);
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
Init;
|
||||
|
||||
finalization
|
||||
|
||||
Deinit;
|
||||
|
||||
end.
|
@@ -29,6 +29,7 @@ var
|
||||
jojpeg_Getvalue: function(p: Pointer; f_DEC, typ: integer): Int64;
|
||||
jojpeg_Addbuf: procedure(p: Pointer; f_DEC: integer; buf: Pointer;
|
||||
bufsize, state: integer)stdcall;
|
||||
|
||||
DLLLoaded: boolean = False;
|
||||
|
||||
implementation
|
||||
@@ -38,7 +39,8 @@ var
|
||||
|
||||
procedure Init;
|
||||
begin
|
||||
Lib := TLibImport.Create(ExpandPath(PluginsPath + 'jojpeg_dll.dll', True));
|
||||
Lib := TLibImport.Create;
|
||||
Lib.LoadLib(ExpandPath(PluginsPath + 'jojpeg_dll.dll', True));
|
||||
if Lib.Loaded then
|
||||
begin
|
||||
@jojpeg_Init := Lib.GetProcAddr('jojpeg_Init');
|
||||
|
@@ -12,14 +12,9 @@ const
|
||||
LZ4F_VERSION = 100;
|
||||
|
||||
type
|
||||
PLZ4_streamDecode_t = ^LZ4_streamDecode_t;
|
||||
LZ4_streamDecode_t = array [0 .. 1 shl 9 - 1] of byte;
|
||||
|
||||
PLZ4_stream_t = ^LZ4_stream_t;
|
||||
LZ4_stream_t = array [0 .. 1 shl 9 - 1] of byte;
|
||||
|
||||
PLZ4_streamHC_t = ^LZ4_streamHC_t;
|
||||
LZ4_streamHC_t = array [0 .. 1 shl 9 - 1] of byte;
|
||||
PLZ4_streamDecode_t = Pointer;
|
||||
PLZ4_stream_t = Pointer;
|
||||
PLZ4_streamHC_t = Pointer;
|
||||
|
||||
LZ4F_errorCode_t = type size_t;
|
||||
|
||||
@@ -113,13 +108,12 @@ var
|
||||
LZ4_compress_HC_continue: function(streamHCPtr: PLZ4_streamHC_t;
|
||||
const src: Pointer; dst: Pointer; srcSize: Integer; maxDstSize: Integer)
|
||||
: Integer cdecl;
|
||||
|
||||
DLLLoaded: Boolean = False;
|
||||
|
||||
function LZ4F_decompress_safe(source: Pointer; dest: Pointer;
|
||||
sourceSize: Integer; destSize: Integer; compressedSize: PInteger = nil;
|
||||
blockSize: PInteger = nil): Integer;
|
||||
function LZ4_compress_block(src, dst: Pointer;
|
||||
srcSize, dstCapacity: Integer): Integer;
|
||||
|
||||
implementation
|
||||
|
||||
@@ -160,51 +154,13 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function LZ4_compress_block(src, dst: Pointer;
|
||||
srcSize, dstCapacity: Integer): Integer;
|
||||
const
|
||||
blockSize = 64 * 1024;
|
||||
const
|
||||
BuffSize = 256 * 1024;
|
||||
var
|
||||
Buff: array [0 .. BuffSize - 1] of byte;
|
||||
ctx: PLZ4_stream_t;
|
||||
Pos1, Pos2, Res: Integer;
|
||||
X, Y: Integer;
|
||||
begin
|
||||
Result := 0;
|
||||
ctx := LZ4_createStream;
|
||||
LZ4_resetStream(ctx);
|
||||
Pos1 := 0;
|
||||
Pos2 := 0;
|
||||
try
|
||||
while (Pos1 < srcSize) and (Pos2 < dstCapacity) do
|
||||
begin
|
||||
X := Min(srcSize - Pos1, blockSize);
|
||||
Y := dstCapacity - Pos2;
|
||||
Res := LZ4_compress_fast_continue(ctx, PByte(src) + Pos1, @Buff[0], X,
|
||||
BuffSize, 1);
|
||||
if Res <= 0 then
|
||||
begin
|
||||
LZ4_freeStream(ctx);
|
||||
exit(-Pos2);
|
||||
end;
|
||||
Move(Buff[0], (PByte(dst) + Pos2)^, Res);
|
||||
Inc(Pos1, X);
|
||||
Inc(Pos2, Res);
|
||||
end;
|
||||
finally
|
||||
LZ4_freeStream(ctx);
|
||||
end;
|
||||
Result := Pos2;
|
||||
end;
|
||||
|
||||
var
|
||||
Lib: TLibImport;
|
||||
|
||||
procedure Init(Filename: String);
|
||||
begin
|
||||
Lib := TLibImport.Create(ExpandPath(Filename, True));
|
||||
Lib := TLibImport.Create;
|
||||
Lib.LoadLib(ExpandPath(Filename, True));
|
||||
if Lib.Loaded then
|
||||
begin
|
||||
@LZ4_decompress_safe := Lib.GetProcAddr('LZ4_decompress_safe');
|
||||
|
@@ -62,6 +62,7 @@ var
|
||||
dst: Pointer; dst_len: PNativeUInt; wrkmem: Pointer): integer; cdecl;
|
||||
lzo2a_decompress_safe: function(const src: Pointer; src_len: NativeUInt;
|
||||
dst: Pointer; dst_len: PNativeUInt): integer cdecl;
|
||||
|
||||
DLLLoaded: Boolean = False;
|
||||
|
||||
implementation
|
||||
@@ -71,7 +72,8 @@ var
|
||||
|
||||
procedure Init(Filename: String);
|
||||
begin
|
||||
Lib := TLibImport.Create(ExpandPath(Filename, True));
|
||||
Lib := TLibImport.Create;
|
||||
Lib.LoadLib(ExpandPath(Filename, True));
|
||||
if Lib.Loaded then
|
||||
begin
|
||||
@lzo1x_1_compress := Lib.GetProcAddr('lzo1x_1_compress');
|
||||
|
@@ -65,7 +65,7 @@ var
|
||||
rawSize: NativeUInt): NativeUInt stdcall;
|
||||
OodleLZ_GetCompressScratchMemBound: function(compressor: Integer;
|
||||
compressSelect: Integer; rawSize: NativeUInt;
|
||||
pOptions: POodleLZ_CompressOptions): NativeUInt stdcall = nil;
|
||||
pOptions: POodleLZ_CompressOptions = nil): NativeUInt stdcall = nil;
|
||||
|
||||
DLLLoaded: Boolean = False;
|
||||
|
||||
@@ -89,21 +89,20 @@ var
|
||||
I: Integer;
|
||||
C: Cardinal;
|
||||
begin
|
||||
Lib := TLibImport.Create(ExpandPath(Filename, True));
|
||||
Lib := TLibImport.Create;
|
||||
Lib.LoadLib(ExpandPath(Filename, True));
|
||||
if not Lib.Loaded then
|
||||
for I := 1 to 9 do
|
||||
for I := 3 to 9 do
|
||||
begin
|
||||
Lib.Free;
|
||||
Lib := TLibImport.Create(ExpandPath(PluginsPath + 'oo2core_' + I.ToString
|
||||
+ '_win64.dll', True));
|
||||
Lib.LoadLib(ExpandPath(PluginsPath + 'oo2core_' + I.ToString +
|
||||
'_win64.dll', True));
|
||||
if Lib.Loaded then
|
||||
break;
|
||||
end;
|
||||
if not Lib.Loaded then
|
||||
for I := 3 to 9 do
|
||||
begin
|
||||
Lib.Free;
|
||||
Lib := TLibImport.Create(ExpandPath(PluginsPath + 'oo2ext_' + I.ToString +
|
||||
Lib.LoadLib(ExpandPath(PluginsPath + 'oo2ext_' + I.ToString +
|
||||
'_win64.dll', True));
|
||||
if Lib.Loaded then
|
||||
break;
|
||||
@@ -112,7 +111,7 @@ begin
|
||||
begin
|
||||
Oodle_CheckVersion := Lib.GetProcAddr('Oodle_CheckVersion');
|
||||
if not Assigned(Oodle_CheckVersion) then
|
||||
for I := 0 to 32 do
|
||||
for I := 0 to 49 do
|
||||
begin
|
||||
@Oodle_CheckVersion :=
|
||||
Lib.GetProcAddr(PAnsiChar('_Oodle_CheckVersion@' + (I * 2).ToString));
|
||||
@@ -126,7 +125,7 @@ begin
|
||||
OldCompressOptions_GetDefault := LongRec(C).Hi < $2E08;
|
||||
@OodleLZ_Compress_1 := Lib.GetProcAddr('OodleLZ_Compress');
|
||||
if not Assigned(OodleLZ_Compress_1) then
|
||||
for I := 0 to 32 do
|
||||
for I := 0 to 49 do
|
||||
begin
|
||||
@OodleLZ_Compress_1 :=
|
||||
Lib.GetProcAddr(PAnsiChar('_OodleLZ_Compress@' + (I * 2).ToString));
|
||||
@@ -136,7 +135,7 @@ begin
|
||||
@OodleLZ_Compress_2 := @OodleLZ_Compress_1;
|
||||
OodleLZ_Decompress := Lib.GetProcAddr('OodleLZ_Decompress');
|
||||
if not Assigned(OodleLZ_Decompress) then
|
||||
for I := 0 to 32 do
|
||||
for I := 0 to 49 do
|
||||
begin
|
||||
@OodleLZ_Decompress :=
|
||||
Lib.GetProcAddr(PAnsiChar('_OodleLZ_Decompress@' + (I * 2).ToString));
|
||||
@@ -146,7 +145,7 @@ begin
|
||||
OodleLZ_CompressOptions_GetDefault_1 :=
|
||||
Lib.GetProcAddr('OodleLZ_CompressOptions_GetDefault');
|
||||
if not Assigned(OodleLZ_CompressOptions_GetDefault_1) then
|
||||
for I := 0 to 32 do
|
||||
for I := 0 to 49 do
|
||||
begin
|
||||
@OodleLZ_CompressOptions_GetDefault_1 :=
|
||||
Lib.GetProcAddr(PAnsiChar('_OodleLZ_CompressOptions_GetDefault@' +
|
||||
@@ -159,7 +158,7 @@ begin
|
||||
OodleLZ_GetCompressedBufferSizeNeeded_1 :=
|
||||
Lib.GetProcAddr('OodleLZ_GetCompressedBufferSizeNeeded');
|
||||
if not Assigned(OodleLZ_GetCompressedBufferSizeNeeded_1) then
|
||||
for I := 0 to 32 do
|
||||
for I := 0 to 49 do
|
||||
begin
|
||||
@OodleLZ_GetCompressedBufferSizeNeeded_1 :=
|
||||
Lib.GetProcAddr(PAnsiChar('_OodleLZ_GetCompressedBufferSizeNeeded@' +
|
||||
@@ -174,7 +173,7 @@ begin
|
||||
OodleLZ_GetCompressScratchMemBound :=
|
||||
Lib.GetProcAddr('OodleLZ_GetCompressScratchMemBound');
|
||||
if not Assigned(OodleLZ_GetCompressScratchMemBound) then
|
||||
for I := 0 to 32 do
|
||||
for I := 0 to 49 do
|
||||
begin
|
||||
@OodleLZ_GetCompressScratchMemBound :=
|
||||
Lib.GetProcAddr(PAnsiChar('_OodleLZ_GetCompressScratchMemBound@' +
|
||||
|
@@ -22,6 +22,7 @@ var
|
||||
in_size: Integer; out_dest: Pointer; out_type: Integer)cdecl;
|
||||
pjglib_version_info: function: PAnsiChar cdecl;
|
||||
pjglib_short_name: function: PAnsiChar cdecl;
|
||||
|
||||
DLLLoaded: Boolean = False;
|
||||
|
||||
implementation
|
||||
@@ -31,7 +32,8 @@ var
|
||||
|
||||
procedure Init;
|
||||
begin
|
||||
Lib := TLibImport.Create(ExpandPath(PluginsPath + 'packjpg_dll.dll', True));
|
||||
Lib := TLibImport.Create;
|
||||
Lib.LoadLib(ExpandPath(PluginsPath + 'packjpg_dll.dll', True));
|
||||
if Lib.Loaded then
|
||||
begin
|
||||
@pjglib_convert_stream2stream :=
|
||||
|
@@ -15,6 +15,7 @@ var
|
||||
preflate_reencode: function(const src1: Pointer; src1Size: integer;
|
||||
const src2: Pointer; src2Size: integer; dst: Pointer; dstCapacity: PInteger)
|
||||
: boolean cdecl;
|
||||
|
||||
DLLLoaded: boolean = False;
|
||||
|
||||
implementation
|
||||
@@ -24,7 +25,8 @@ var
|
||||
|
||||
procedure Init;
|
||||
begin
|
||||
Lib := TLibImport.Create(ExpandPath(PluginsPath + 'preflate_dll.dll', True));
|
||||
Lib := TLibImport.Create;
|
||||
Lib.LoadLib(ExpandPath(PluginsPath + 'preflate_dll.dll', True));
|
||||
if Lib.Loaded then
|
||||
begin
|
||||
@preflate_decode := Lib.GetProcAddr('decode');
|
||||
|
@@ -22,6 +22,7 @@ var
|
||||
hif2raw_Loop: function(p: Pointer): integer stdcall;
|
||||
hif2raw_getoutlen: function(p: Pointer): integer stdcall;
|
||||
hif2raw_addbuf: procedure(p: Pointer; buf: Pointer; bufsize: integer)stdcall;
|
||||
|
||||
DLLLoaded: boolean = False;
|
||||
|
||||
implementation
|
||||
@@ -31,8 +32,10 @@ var
|
||||
|
||||
procedure Init;
|
||||
begin
|
||||
Lib1 := TLibImport.Create(ExpandPath(PluginsPath + 'RAW2HIF_DLL.DLL', True));
|
||||
Lib2 := TLibImport.Create(ExpandPath(PluginsPath + 'HIF2RAW_DLL.DLL', True));
|
||||
Lib1 := TLibImport.Create;
|
||||
Lib1.LoadLib(ExpandPath(PluginsPath + 'RAW2HIF_DLL.DLL', True));
|
||||
Lib2 := TLibImport.Create;
|
||||
Lib2.LoadLib(ExpandPath(PluginsPath + 'HIF2RAW_DLL.DLL', True));
|
||||
if Lib1.Loaded and Lib2.Loaded then
|
||||
begin
|
||||
@raw2hif_Alloc := Lib1.GetProcAddr('raw2hif_Alloc');
|
||||
|
@@ -1,53 +0,0 @@
|
||||
unit TTADLL;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
WinAPI.Windows,
|
||||
System.SysUtils, System.Classes;
|
||||
|
||||
var
|
||||
tta_encode: function(const src: Pointer; srcSize: PInteger; dst: Pointer;
|
||||
dstCapacity: PInteger): Boolean cdecl;
|
||||
tta_decode: function(const src: Pointer; srcSize: Integer; dst: Pointer;
|
||||
dstCapacity: PInteger): Boolean cdecl;
|
||||
tta_getsize: function(const src: Pointer; srcSize: Integer;
|
||||
headerSize: PInteger): Integer cdecl;
|
||||
DLLLoaded: Boolean = False;
|
||||
|
||||
implementation
|
||||
|
||||
var
|
||||
DLLHandle: THandle;
|
||||
|
||||
procedure Init;
|
||||
begin
|
||||
DLLHandle := LoadLibrary(PChar(ExtractFilePath(ParamStr(0)) +
|
||||
'libtta_dll.dll'));
|
||||
if DLLHandle >= 32 then
|
||||
begin
|
||||
@tta_encode := GetProcAddress(DLLHandle, 'encode');
|
||||
@tta_decode := GetProcAddress(DLLHandle, 'decode');
|
||||
@tta_getsize := GetProcAddress(DLLHandle, 'getsize');
|
||||
DLLLoaded := Assigned(tta_encode) and Assigned(tta_decode);
|
||||
end
|
||||
else
|
||||
DLLLoaded := False;
|
||||
end;
|
||||
|
||||
procedure Deinit;
|
||||
begin
|
||||
if not DLLLoaded then
|
||||
exit;
|
||||
FreeLibrary(DLLHandle);
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
Init;
|
||||
|
||||
finalization
|
||||
|
||||
Deinit;
|
||||
|
||||
end.
|
@@ -1,70 +0,0 @@
|
||||
unit XDeltaDLL;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
InitCode,
|
||||
Utils, LibImport,
|
||||
WinAPI.Windows,
|
||||
System.SysUtils, System.Classes;
|
||||
|
||||
type
|
||||
xd3_flags = (XD3_JUST_HDR = (1 shl 1), XD3_SKIP_WINDOW = (1 shl 2),
|
||||
XD3_SKIP_EMIT = (1 shl 3), XD3_FLUSH = (1 shl 4), XD3_SEC_DJW = (1 shl 5),
|
||||
XD3_SEC_FGK = (1 shl 6), XD3_SEC_LZMA = (1 shl 24),
|
||||
XD3_SEC_TYPE = (XD3_SEC_DJW or XD3_SEC_FGK or XD3_SEC_LZMA),
|
||||
XD3_SEC_NODATA = (1 shl 7), XD3_SEC_NOINST = (1 shl 8),
|
||||
XD3_SEC_NOADDR = (1 shl 9), XD3_SEC_NOALL = (XD3_SEC_NODATA or
|
||||
XD3_SEC_NOINST or XD3_SEC_NOADDR), XD3_ADLER32 = (1 shl 10),
|
||||
XD3_ADLER32_NOVER = (1 shl 11), XD3_NOCOMPRESS = (1 shl 13),
|
||||
XD3_BEGREEDY = (1 shl 14), XD3_ADLER32_RECODE = (1 shl 15),
|
||||
XD3_COMPLEVEL_SHIFT = 20, XD3_COMPLEVEL_MASK = ($F shl XD3_COMPLEVEL_SHIFT),
|
||||
XD3_COMPLEVEL_1 = (1 shl XD3_COMPLEVEL_SHIFT),
|
||||
XD3_COMPLEVEL_2 = (2 shl XD3_COMPLEVEL_SHIFT),
|
||||
XD3_COMPLEVEL_3 = (3 shl XD3_COMPLEVEL_SHIFT),
|
||||
XD3_COMPLEVEL_6 = (6 shl XD3_COMPLEVEL_SHIFT),
|
||||
XD3_COMPLEVEL_9 = (9 shl XD3_COMPLEVEL_SHIFT));
|
||||
|
||||
var
|
||||
xd3_encode: function(const input: PByte; input_size: NativeUInt;
|
||||
source: PByte; source_size: NativeUInt; output_buffer: PByte;
|
||||
output_size: PNativeUInt; avail_output: NativeUInt; flags: Integer)
|
||||
: Integer cdecl;
|
||||
xd3_decode: function(const input: PByte; input_size: NativeUInt;
|
||||
source: PByte; source_size: NativeUInt; output_buf: PByte;
|
||||
output_size: PNativeUInt; avail_output: NativeUInt; flags: Integer)
|
||||
: Integer cdecl;
|
||||
DLLLoaded: boolean = False;
|
||||
|
||||
implementation
|
||||
|
||||
var
|
||||
Lib: TLibImport;
|
||||
|
||||
procedure Init;
|
||||
begin
|
||||
Lib := TLibImport.Create(ExpandPath(PluginsPath + 'xdelta3_dll.dll', True));
|
||||
if Lib.Loaded then
|
||||
begin
|
||||
DLLLoaded := True;
|
||||
@xd3_encode := Lib.GetProcAddr('xd3_encode');
|
||||
Assert(@xd3_encode <> nil);
|
||||
@xd3_decode := Lib.GetProcAddr('xd3_decode');
|
||||
Assert(@xd3_decode <> nil);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure Deinit;
|
||||
begin
|
||||
Lib.Free;
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
Init;
|
||||
|
||||
finalization
|
||||
|
||||
Deinit;
|
||||
|
||||
end.
|
@@ -88,7 +88,6 @@ function inflateReset(var strm: z_stream): integer;
|
||||
implementation
|
||||
|
||||
var
|
||||
Lib: TLibImport;
|
||||
WinAPIDLL: boolean;
|
||||
|
||||
function deflateInit2(var strm: z_stream; level, method, windowBits, memLevel,
|
||||
@@ -147,14 +146,15 @@ begin
|
||||
Result := System.ZLib.inflateReset(strm);
|
||||
end;
|
||||
|
||||
var
|
||||
Lib: TLibImport;
|
||||
|
||||
procedure Init(Filename: String);
|
||||
begin
|
||||
Lib := TLibImport.Create(ExpandPath(Filename, True));
|
||||
Lib := TLibImport.Create;
|
||||
Lib.LoadLib(ExpandPath(Filename, True));
|
||||
if not(Lib.Loaded and Assigned(Lib.GetProcAddr('zlibVersion'))) then
|
||||
begin
|
||||
Lib.Free;
|
||||
Lib := TLibImport.Create(ExpandPath(PluginsPath + 'zlib1.dll', True));
|
||||
end;
|
||||
Lib.LoadLib(ExpandPath(PluginsPath + 'zlib1.dll', True));
|
||||
if Lib.Loaded and Assigned(Lib.GetProcAddr('zlibVersion')) then
|
||||
begin
|
||||
DLLLoaded := True;
|
||||
|
@@ -17,6 +17,9 @@ type
|
||||
ZSTD_reset_session_and_parameters = 3,
|
||||
ZSTD_ResetDirective_Force32 = $40000000);
|
||||
|
||||
ZSTD_EndDirective = (ZSTD_e_continue = 0, ZSTD_e_flush = 1, ZSTD_e_end = 2,
|
||||
ZSTD_EndDirective_Force32 = $40000000);
|
||||
|
||||
PZSTD_inBuffer = ^ZSTD_inBuffer;
|
||||
|
||||
ZSTD_inBuffer = record
|
||||
@@ -54,11 +57,11 @@ type
|
||||
|
||||
ZSTD_compressionParameters = record
|
||||
windowLog: Cardinal;
|
||||
chainLogg: Cardinal;
|
||||
hashLogg: Cardinal;
|
||||
searchLogg: Cardinal;
|
||||
minMatchg: Cardinal;
|
||||
targetLengthg: Cardinal;
|
||||
chainLog: Cardinal;
|
||||
hashLog: Cardinal;
|
||||
searchLog: Cardinal;
|
||||
minMatch: Cardinal;
|
||||
targetLength: Cardinal;
|
||||
strategy: ZSTD_strategy;
|
||||
end;
|
||||
|
||||
@@ -78,6 +81,8 @@ var
|
||||
srcSize: size_t; compressionLevel: Integer): size_t cdecl;
|
||||
ZSTD_compress2: function(cctx: Pointer; dst: Pointer; dstCapacity: size_t;
|
||||
const src: Pointer; srcSize: size_t): size_t cdecl;
|
||||
ZSTD_compress_generic: function(cctx: Pointer; output: PZSTD_outBuffer;
|
||||
input: PZSTD_inBuffer; endOp: ZSTD_EndDirective): size_t cdecl;
|
||||
ZSTD_decompress: function(dst: Pointer; dstCapacity: size_t;
|
||||
const src: Pointer; srcSize: size_t): SSIZE_T cdecl;
|
||||
ZSTD_findFrameCompressedSize: function(const src: Pointer; srcSize: size_t)
|
||||
@@ -90,6 +95,8 @@ var
|
||||
: size_t cdecl;
|
||||
ZSTD_CCtx_setParameter: function(cctx: Pointer; param: ZSTD_cParameter;
|
||||
value: Integer): size_t cdecl;
|
||||
ZSTD_CCtx_refPrefix: function(cctx: Pointer; const prefix: Pointer;
|
||||
prefixSize: size_t): size_t cdecl;
|
||||
ZSTD_compressCCtx: function(cctx: Pointer; dst: Pointer; dstCapacity: size_t;
|
||||
src: Pointer; srcSize: size_t; compressionLevel: Integer): size_t cdecl;
|
||||
ZSTD_createDCtx: function: Pointer cdecl;
|
||||
@@ -116,6 +123,9 @@ var
|
||||
: size_t cdecl;
|
||||
ZSTD_endStream: function(zcs: Pointer; output: PZSTD_outBuffer): size_t cdecl;
|
||||
|
||||
ZSTD_getCParams: function(compressionLevel: Integer; estimatedSrcSize: UInt64;
|
||||
dictSize: size_t): ZSTD_compressionParameters;
|
||||
|
||||
DLLLoaded: Boolean = False;
|
||||
|
||||
function ZSTD_compress_dict(cctx: Pointer; dst: Pointer; dstCapacity: size_t;
|
||||
@@ -148,11 +158,13 @@ var
|
||||
|
||||
procedure Init(Filename: String);
|
||||
begin
|
||||
Lib := TLibImport.Create(ExpandPath(Filename, True));
|
||||
Lib := TLibImport.Create;
|
||||
Lib.LoadLib(ExpandPath(Filename, True));
|
||||
if Lib.Loaded then
|
||||
begin
|
||||
@ZSTD_compress := Lib.GetProcAddr('ZSTD_compress');
|
||||
@ZSTD_compress2 := Lib.GetProcAddr('ZSTD_compress2');
|
||||
@ZSTD_compress_generic := Lib.GetProcAddr('ZSTD_compress_generic');
|
||||
@ZSTD_decompress := Lib.GetProcAddr('ZSTD_decompress');
|
||||
@ZSTD_findFrameCompressedSize :=
|
||||
Lib.GetProcAddr('ZSTD_findFrameCompressedSize');
|
||||
@@ -161,6 +173,7 @@ begin
|
||||
@ZSTD_freeCCtx := Lib.GetProcAddr('ZSTD_freeCCtx');
|
||||
@ZSTD_CCtx_reset := Lib.GetProcAddr('ZSTD_CCtx_reset');
|
||||
@ZSTD_CCtx_setParameter := Lib.GetProcAddr('ZSTD_CCtx_setParameter');
|
||||
@ZSTD_CCtx_refPrefix := Lib.GetProcAddr('ZSTD_CCtx_refPrefix');
|
||||
@ZSTD_createDCtx := Lib.GetProcAddr('ZSTD_createDCtx');
|
||||
@ZSTD_freeDCtx := Lib.GetProcAddr('ZSTD_freeDCtx');
|
||||
@ZSTD_createCDict := Lib.GetProcAddr('ZSTD_createCDict');
|
||||
@@ -176,6 +189,7 @@ begin
|
||||
@ZSTD_compressStream := Lib.GetProcAddr('ZSTD_compressStream');
|
||||
@ZSTD_flushStream := Lib.GetProcAddr('ZSTD_flushStream');
|
||||
@ZSTD_endStream := Lib.GetProcAddr('ZSTD_endStream');
|
||||
@ZSTD_getCParams := Lib.GetProcAddr('ZSTD_getCParams');
|
||||
DLLLoaded := Assigned(ZSTD_compress) and Assigned(ZSTD_decompress);
|
||||
end;
|
||||
end;
|
||||
|
Reference in New Issue
Block a user