Go Back   FileForums > Game Backup > PC Games > PC Games - CD/DVD Conversions > Conversion Tutorials

Reply
 
Thread Tools Display Modes
  #1  
Old 17-09-2021, 04:09
maybeknow maybeknow is offline
Registered User
 
Join Date: Sep 2021
Location: canada
Posts: 7
Thanks: 4
Thanked 0 Times in 0 Posts
maybeknow is on a distinguished road
what is the best and right way to patch a file in inno setup using xdelta

I want to patch one big file (~1GB) inside of my installer that I created with inno setup
for creating the binary different patch file I think the best way is using xdelta (if there is any better ways I will be happy to hear it), but I'm not sure what is the best way to apply the created xdelta patch to a file in install time.
I know there is a function name ISXDeltaExtract in IsDone that I think created for same reason, but I'm not sure how can I use it properly
Code:
function ISxDeltaExtract(CurComponent: Cardinal; PctOfTotal: Double; MinRAM, MaxRAM: Integer; InName, DiffFile, OutFile: AnsiString; DeleteInFile, DeleteDiffFile: Boolean): Boolean;
and I also know I can just create a batch file and extract and run it at the end of my installer, but I don't think its a good idea at all, because the file is kind of big, its going to take some time and I want to somehow show the progress of it in installer (if its possible to show it at the installation progress bar its much better, just like how fitgirl do it); that I don't think I can do it with batch file method
Reply With Quote
Sponsored Links
  #2  
Old 17-09-2021, 04:37
Cesar82's Avatar
Cesar82 Cesar82 is offline
Registered User
 
Join Date: May 2011
Location: Brazil
Posts: 1,026
Thanks: 1,738
Thanked 2,192 Times in 750 Posts
Cesar82 is on a distinguished road
It is necessary to include XDelta3.dll in your installer.
You can create the code by copying parts of the code included in the DiskSpan GUI 2.0.0.2 example script.
ISxDeltaExtract only works if you create the patch using XDelta with the parameters:
Code:
MakePatch.bat

@echo off
set "OldFile=File_Old.txt"
set "NewFile=File_New.txt"
echo.
xdelta3.exe -e -9 -S djw -vfs "%OldFile%" "%NewFile%" "%OldFile%.diff"
echo.
echo.Press any key to exit.
pause >nul
Reply With Quote
The Following User Says Thank You to Cesar82 For This Useful Post:
maybeknow (17-09-2021)
  #3  
Old 17-09-2021, 05:12
maybeknow maybeknow is offline
Registered User
 
Join Date: Sep 2021
Location: canada
Posts: 7
Thanks: 4
Thanked 0 Times in 0 Posts
maybeknow is on a distinguished road
Quote:
Originally Posted by Cesar82 View Post
It is necessary to include XDelta3.dll in your installer.
You can create the code by copying parts of the code included in the DiskSpan GUI 2.0.0.2 example script.
ISxDeltaExtract only works if you create the patch using XDelta with the parameters:
Code:
MakePatch.bat

@echo off
set "OldFile=File_Old.txt"
set "NewFile=File_New.txt"
echo.
xdelta3.exe -e -9 -S djw -vfs "%OldFile%" "%NewFile%" "%OldFile%.diff"
echo.
echo.Press any key to exit.
pause >nul
thank you, the DiskSpan GUI 2.0.0.2 is a great example, but I think maybe its better for me to follow the original example of ISDone, because i want to use it on a simple inno setup script (nothing fancy)
but something that I still not sure about is how can I show the progress of it in installation page of my installer...
Reply With Quote
  #4  
Old 17-09-2021, 07:18
maybeknow maybeknow is offline
Registered User
 
Join Date: Sep 2021
Location: canada
Posts: 7
Thanks: 4
Thanked 0 Times in 0 Posts
maybeknow is on a distinguished road
I Keep getting this error...
and I dont know why


here is the line of code
Code:
ExtractTemporaryFile('XDelta3.dll');
ISxDeltaExtract(0, 0, 0, 256000, ExpandConstant('{app}\test1.txt'), ExpandConstant('{tmp}\test1.txt.diff'), ExpandConstant('{app}\out3.dat'), false, false);
oh I think I made a big mistake...
what is the type of first argument of function? should I pass a compressed file to it??

Last edited by maybeknow; 17-09-2021 at 08:09.
Reply With Quote
  #5  
Old 17-09-2021, 08:45
Cesar82's Avatar
Cesar82 Cesar82 is offline
Registered User
 
Join Date: May 2011
Location: Brazil
Posts: 1,026
Thanks: 1,738
Thanked 2,192 Times in 750 Posts
Cesar82 is on a distinguished road
Quote:
Originally Posted by maybeknow View Post
thank you, the DiskSpan GUI 2.0.0.2 is a great example, but I think maybe its better for me to follow the original example of ISDone, because i want to use it on a simple inno setup script (nothing fancy)
but something that I still not sure about is how can I show the progress of it in installation page of my installer...
To display the progress I think it will be necessary to use the parameter "PctOfTotal" of the functions used.

Example patch 10% of progressbar.
Code:
if not ISArcExtract ( 0, 0.9, ExpandConstant('{src}\*.arc'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;

if not ISxDeltaExtract ( 0, 0, 0.1, 640, ExpandConstant('{app}\origfile.txt'), ExpandConstant('{app}\patch.diff'),   ExpandConstant('{app}\newfile.txt'), false, false) then break;
Reply With Quote
The Following User Says Thank You to Cesar82 For This Useful Post:
maybeknow (17-09-2021)
  #6  
Old 17-09-2021, 08:56
Cesar82's Avatar
Cesar82 Cesar82 is offline
Registered User
 
Join Date: May 2011
Location: Brazil
Posts: 1,026
Thanks: 1,738
Thanked 2,192 Times in 750 Posts
Cesar82 is on a distinguished road
Quote:
Originally Posted by maybeknow View Post
I Keep getting this error...
and I dont know why


here is the line of code
Code:
ExtractTemporaryFile('XDelta3.dll');
ISxDeltaExtract(0, 0, 0, 256000, ExpandConstant('{app}\test1.txt'), ExpandConstant('{tmp}\test1.txt.diff'), ExpandConstant('{app}\out3.dat'), false, false);
oh I think I made a big mistake...
what is the type of first argument of function? should I pass a compressed file to it??
Code:
ExtractTemporaryFile('XDelta3.dll');
ISxDeltaExtract(0, 0, 0, 640, ExpandConstant('{app}\test1.txt'), ExpandConstant('{tmp}\test1.txt.diff'), ExpandConstant('{app}\test_dest.txt'), false, false);
Reply With Quote
The Following User Says Thank You to Cesar82 For This Useful Post:
maybeknow (17-09-2021)
  #7  
Old 17-09-2021, 09:21
maybeknow maybeknow is offline
Registered User
 
Join Date: Sep 2021
Location: canada
Posts: 7
Thanks: 4
Thanked 0 Times in 0 Posts
maybeknow is on a distinguished road
Quote:
Originally Posted by Cesar82 View Post
Code:
ExtractTemporaryFile('XDelta3.dll');
ISxDeltaExtract(0, 0, 0, 640, ExpandConstant('{app}\test1.txt'), ExpandConstant('{tmp}\test1.txt.diff'), ExpandConstant('{app}\test_dest.txt'), false, false);
thank you again, but I still getting the same result...
I just using the ISDone.dll for the xdelta function, and im not using any other function
Reply With Quote
  #8  
Old 17-09-2021, 12:32
Cesar82's Avatar
Cesar82 Cesar82 is offline
Registered User
 
Join Date: May 2011
Location: Brazil
Posts: 1,026
Thanks: 1,738
Thanked 2,192 Times in 750 Posts
Cesar82 is on a distinguished road
Quote:
Originally Posted by maybeknow View Post
thank you again, but I still getting the same result...
I just using the ISDone.dll for the xdelta function, and im not using any other function
Make patch with parametters
xdelta3.exe -e -9 -S djw -vfs "%OldFile%" "%NewFile%" "%OldFile%.diff"

Tested with XDelta 3.0.11
Use the attachment to create the .diff file
Attached Files
File Type: 7z Make Patch XDELTA.7z (175.4 KB, 35 views)

Last edited by Cesar82; 17-09-2021 at 12:35.
Reply With Quote
The Following User Says Thank You to Cesar82 For This Useful Post:
maybeknow (17-09-2021)
  #9  
Old 17-09-2021, 12:59
maybeknow maybeknow is offline
Registered User
 
Join Date: Sep 2021
Location: canada
Posts: 7
Thanks: 4
Thanked 0 Times in 0 Posts
maybeknow is on a distinguished road
Quote:
Originally Posted by Cesar82 View Post
Make patch with parametters
xdelta3.exe -e -9 -S djw -vfs "%OldFile%" "%NewFile%" "%OldFile%.diff"

Tested with XDelta 3.0.11
Use the attachment to create the .diff file
thank you, I defiantly doing something wrong, here is my code
Code:
#define MyAppName "My Program"
#define MyAppVersion "1.5"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "MyProg.exe"

[Setup]
AppId={{D304513B-BAFC-4211-96A0-0FFA39EAB24E}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename=setup
OutputDir="C:\Users\saman\Desktop\12Min"
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Files]
Source: "ISDone.dll"; DestDir: "{tmp}"; Flags: dontcopy;
Source: "XDelta3.dll"; DestDir: "{tmp}"; Flags: dontcopy;
Source: "xdelta\test\File_Old.txt.diff"; DestDir: "{tmp}"; Flags: dontcopy;

[-code]
function ISxDeltaExtract(CurComponent: Cardinal; PctOfTotal: Double; MinRAM, MaxRAM: Integer; InName, DiffFile, OutFile: AnsiString; DeleteInFile, DeleteDiffFile: Boolean): Boolean; external 'ISxDeltaExtract@{tmp}\ISDone.dll stdcall delayload';

procedure CurStepChanged(CurInstallStep: TSetupStep );
begin
  if (CurInstallStep = ssInstall) then
  begin
    ExtractTemporaryFile('XDelta3.dll');
    ExtractTemporaryFile('ISDone.dll');
    if ISxDeltaExtract(0, 0, 0, 640, ExpandConstant('{app}\File_New.txt'), ExpandConstant('{app}\*.diff'), ExpandConstant('{app}\test_dest.txt'), false, false) then Log('nice.');
  end;
end;
sorry for bother you so much and thank you
Reply With Quote
Reply

Tags
inno setup, patch, xdelta, xdelta3

Thread Tools
Display Modes

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



All times are GMT -7. The time now is 03:55.


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