Go Back   FileForums > Game Backup > PC Games > PC Games - CD/DVD Conversions > Conversion Tutorials
Register FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 03-01-2018, 06:08
JRD!'s Avatar
JRD! JRD! is offline
Registered User
 
Join Date: Sep 2015
Location: Matrix
Posts: 274
Thanks: 225
Thanked 600 Times in 168 Posts
JRD! is on a distinguished road
Finally I will leave the original format, I just change the way to recovered the output path in order to be compatible with ArcGUI.

for those interested here are the changes:
Code:
function IsRelativePath(const sPath: string): Boolean;
begin
  Result:=True;
  if Length(sPath) >= 2 then
    Result:=sPath[2] <> ':';
end;

function ClsMain(operation: Integer; Callback: CLS_CALLBACK; Instance: Pointer): Integer; cdecl;
const
  BuffSize = 64 * 1024;
var
  CLS: TCLSStream;
  SS: TSplitStream;
  Bytes: TBytes;
  X: Integer;
  X8: Byte;
  X64: Int64;
  s: String;
  FirstVolume, OtherVolume: Int64;
  i: integer;
begin

  Result := CLS_ERROR_GENERAL;

  case (operation) of
    CLS_COMPRESS:
      begin
 
        for i := 1 to ParamCount do
        begin
          if (ExtractFileExt(ParamStr(i)) = '.001') then
          begin
            Archive := ParamStr(i);
            Break;
          end;
        end;

        if IsRelativePath(Archive) then
          Archive := ExtractFilePath(GetModuleName) + Archive;

        Archive := ChangeFileExt(Archive, '');

        SetLength(Bytes, 256);
        FillChar(Bytes[0], Length(Bytes), #0);

        X := Callback(Instance, CLS_GET_PARAMSTR, @Bytes[0], Length(Bytes));
        s := StringOf(Bytes);
        s := ReplaceStr(s, #0, '');

        FirstVolume := ConvertToBytes(LeftStr(s, Pos(':', s) - 1));
        OtherVolume := ConvertToBytes(ReplaceStr(s, LeftStr(s, Pos(':', s)), ''));

        CLS := TCLSStream.Create(Callback, Instance);
        CLS.WriteBuffer(FirstVolume, sizeof(FirstVolume));

        Bytes := BytesOf(ExtractFileName(Archive));

        X := Length(Bytes);

        CLS.WriteBuffer(X, sizeof(X));
        CLS.WriteBuffer(Bytes, Length(Bytes));

        X64 := StreamToStream(CLS, CLS, BuffSize, FirstVolume);

        if X64 = FirstVolume then
        begin
          X := CLS.Read(Bytes, Length(Bytes));
          if X > 0 then
          begin
            X8 := 1;
            CLS.WriteBuffer(X8, sizeof(X8));
            SS := TSplitStream.Create(Archive, False, OtherVolume, OtherVolume);
            SS.WriteBuffer(Bytes, X);
            StreamToStream(CLS, SS, BuffSize);
            SS.Free;
          end else
          begin
            X8 := 0;
            CLS.WriteBuffer(X8, sizeof(X8));
          end;
        end;
        CLS.Free;
        SetLength(Bytes, 0);
        Result := CLS_OK;
      end;
    CLS_DECOMPRESS:
      begin
        try
          if SrcPath = '' then
            SrcPath := GetCurrentDir;
          CLS := TCLSStream.Create(Callback, Instance);
          CLS.ReadBuffer(FirstVolume, sizeof(FirstVolume));
          CLS.ReadBuffer(X, sizeof(X));
          SetLength(Bytes, X);
          CLS.ReadBuffer(Bytes, Length(Bytes));
          Archive := IncludeTrailingBackSlash(SrcPath) + StringOf(Bytes);
          X64 := StreamToStream(CLS, CLS, BuffSize, FirstVolume);
          if FirstVolume = X64 then
          begin
            CLS.ReadBuffer(X8, sizeof(X8));
            if X8 = 1 then
            begin
              SS := TSplitStream.Create(Archive, True, OtherVolume, OtherVolume, MyDiskRequest);
              StreamToStream(SS, CLS, BuffSize);
              SS.Free;
            end;
          end;
          CLS.Free;
          SetLength(Bytes, 0);
          Result := CLS_OK;
        except
          Result := CLS_ERROR_GENERAL;
        end;
      end;
  else
    Result := CLS_ERROR_NOT_IMPLEMENTED;
  end;
end;
I also re-implemented the external compressors in the popup menu:

__________________
Practice makes perfect.
Reply With Quote
The Following 7 Users Say Thank You to JRD! For This Useful Post:
78372 (03-01-2018), ffmla (05-01-2018), mausschieber (03-01-2018), pakrat2k2 (03-01-2018), romi1996 (30-01-2020), Simorq (03-01-2018), Titeuf (03-01-2018)
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Vista beta 2 blocking Starforce ronandex CD/DVD Copy Protections & Utilities 4 31-05-2006 02:37
Neverwinter Nights v1.66.8071 (Beta) doomerdgr8 PC Games 1 28-05-2005 10:18
Copying Socom2 Beta Is It Possible dblue PS2 Games 6 14-10-2003 19:14
OT: Opinion and BETA testers neded for my upcomming products! krondike PC Games 3 06-10-2003 08:29
PAL Patcher 0.93 Beta Megalexxx DC Games 18 03-01-2003 09:23



All times are GMT -7. The time now is 22:29.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
FileForums @ https://fileforums.com