do not ask for ROM file on update

This commit is contained in:
Fabian Dill 2020-04-11 16:10:15 +02:00
parent 16be0dfd5c
commit 3de1770e8e
1 changed files with 133 additions and 116 deletions

View File

@ -1,116 +1,133 @@
#define sourcepath "build\exe.win-amd64-3.8\" #define sourcepath "build\exe.win-amd64-3.8\"
#define MyAppName "BerserkerMultiWorld" #define MyAppName "BerserkerMultiWorld"
#define MyAppExeName "BerserkerMultiClient.exe" #define MyAppExeName "BerserkerMultiClient.exe"
#define MyAppIcon "icon.ico" #define MyAppIcon "icon.ico"
[Setup] [Setup]
; NOTE: The value of AppId uniquely identifies this application. ; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications. ; Do not use the same AppId value in installers for other applications.
AppId={{6D826EE0-49BE-4B36-BACE-09C6971CD85C}} AppId={{6D826EE0-49BE-4B36-BACE-09C6971CD85C}}
AppName={#MyAppName} AppName={#MyAppName}
AppVerName={#MyAppName} AppVerName={#MyAppName}
DefaultDirName={commonappdata}\{#MyAppName} DefaultDirName={commonappdata}\{#MyAppName}
DisableProgramGroupPage=yes DisableProgramGroupPage=yes
OutputDir=setups OutputDir=setups
OutputBaseFilename=Setup {#MyAppName} OutputBaseFilename=Setup {#MyAppName}
Compression=lzma2 Compression=lzma2
SolidCompression=yes SolidCompression=yes
LZMANumBlockThreads=8 LZMANumBlockThreads=8
ArchitecturesInstallIn64BitMode=x64 ArchitecturesInstallIn64BitMode=x64
ChangesAssociations=yes ChangesAssociations=yes
ArchitecturesAllowed=x64 ArchitecturesAllowed=x64
AllowNoIcons=yes AllowNoIcons=yes
SetupIconFile={#MyAppIcon} SetupIconFile={#MyAppIcon}
UninstallDisplayIcon={app}\{#MyAppExeName} UninstallDisplayIcon={app}\{#MyAppExeName}
LicenseFile= LICENSE LicenseFile= LICENSE
WizardStyle= modern WizardStyle= modern
SetupLogging=yes SetupLogging=yes
[Languages] [Languages]
Name: "english"; MessagesFile: "compiler:Default.isl" Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks] [Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}";
[Dirs] [Dirs]
NAME: "{app}"; Flags: setntfscompression; Permissions: everyone-modify users-modify authusers-modify; NAME: "{app}"; Flags: setntfscompression; Permissions: everyone-modify users-modify authusers-modify;
[Files] [Files]
Source: "{code:GetROMPath}"; DestDir: "{app}"; DestName: "Zelda no Densetsu - Kamigami no Triforce (Japan).sfc"; Flags: external Source: "{code:GetROMPath}"; DestDir: "{app}"; DestName: "Zelda no Densetsu - Kamigami no Triforce (Japan).sfc"; Flags: external
Source: "{#sourcepath}*"; Excludes: "*.key, *.log, *.hpkey"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "{#sourcepath}*"; Excludes: "*.key, *.log, *.hpkey"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "vc_redist.x64.exe"; DestDir: {tmp}; Flags: deleteafterinstall Source: "vc_redist.x64.exe"; DestDir: {tmp}; Flags: deleteafterinstall
; NOTE: Don't use "Flags: ignoreversion" on any shared system files ; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons] [Icons]
Name: "{group}\{#MyAppName} Folder"; Filename: "{app}"; Name: "{group}\{#MyAppName} Folder"; Filename: "{app}";
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}";
Name: "{commondesktop}\{#MyAppName} Folder"; Filename: "{app}"; Tasks: desktopicon Name: "{commondesktop}\{#MyAppName} Folder"; Filename: "{app}"; Tasks: desktopicon
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run] [Run]
Filename: "{tmp}\vc_redist.x64.exe"; Parameters: "/passive /norestart"; Check: IsVCRedist64BitNeeded; StatusMsg: "Installing VC++ redistributable..." Filename: "{tmp}\vc_redist.x64.exe"; Parameters: "/passive /norestart"; Check: IsVCRedist64BitNeeded; StatusMsg: "Installing VC++ redistributable..."
; Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
[UninstallDelete]
[UninstallDelete] Type: dirifempty; Name: "{app}"
Type: dirifempty; Name: "{app}"
[Registry]
[Registry]
Root: HKCR; Subkey: ".bmbp"; ValueData: "{#MyAppName}patch"; Flags: uninsdeletevalue; ValueType: string; ValueName: ""
Root: HKCR; Subkey: ".bmbp"; ValueData: "{#MyAppName}patch"; Flags: uninsdeletevalue; ValueType: string; ValueName: "" Root: HKCR; Subkey: "{#MyAppName}patch"; ValueData: "{#MyAppName} Patch"; Flags: uninsdeletekey; ValueType: string; ValueName: ""
Root: HKCR; Subkey: "{#MyAppName}patch"; ValueData: "{#MyAppName} Patch"; Flags: uninsdeletekey; ValueType: string; ValueName: "" Root: HKCR; Subkey: "{#MyAppName}patch\DefaultIcon"; ValueData: "{app}\{#MyAppExeName},0"; ValueType: string; ValueName: ""
Root: HKCR; Subkey: "{#MyAppName}patch\DefaultIcon"; ValueData: "{app}\{#MyAppExeName},0"; ValueType: string; ValueName: "" Root: HKCR; Subkey: "{#MyAppName}patch\shell\open\command"; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; ValueType: string; ValueName: ""
Root: HKCR; Subkey: "{#MyAppName}patch\shell\open\command"; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; ValueType: string; ValueName: ""
[Code]
[Code] // See: https://stackoverflow.com/a/51614652/2287576
// See: https://stackoverflow.com/a/51614652/2287576 function IsVCRedist64BitNeeded(): boolean;
function IsVCRedist64BitNeeded(): boolean; var
var strVersion: string;
strVersion: string; begin
begin if (RegQueryStringValue(HKEY_LOCAL_MACHINE,
if (RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64', 'Version', strVersion)) then
'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64', 'Version', strVersion)) then begin
begin // Is the installed version at least 14.24 ?
// Is the installed version at least 14.24 ? Log('VC Redist x64 Version : found ' + strVersion);
Log('VC Redist x64 Version : found ' + strVersion); Result := (CompareStr(strVersion, 'v14.24.28127.4') < 0);
Result := (CompareStr(strVersion, 'v14.24.28127.4') < 0); end
end else
else begin
begin // Not even an old version installed
// Not even an old version installed Log('VC Redist x64 is not already installed');
Log('VC Redist x64 is not already installed'); Result := True;
Result := True; end;
end; end;
end;
var ROMFilePage: TInputFileWizardPage;
var ROMFilePage: TInputFileWizardPage; var R : longint;
var R : longint; var rom: string;
procedure InitializeWizard(); procedure InitializeWizard();
begin begin
ROMFilePage := rom := FileSearch('Zelda no Densetsu - Kamigami no Triforce (Japan).sfc', WizardDirValue());
CreateInputFilePage( if Length(rom) > 0 then
wpLicense, begin
'Select ROM File', log('existing ROM found');
'Where is your Zelda no Densetsu - Kamigami no Triforce (Japan).sfc located?', log(IntToStr(CompareStr(GetMD5OfFile(rom), '03a63945398191337e896e5771f77173')));
'Select the file, then click Next.'); if CompareStr(GetMD5OfFile(rom), '03a63945398191337e896e5771f77173') = 0 then
begin
ROMFilePage.Add( log('existing ROM verified');
'Location of ROM file:', exit;
'SNES ROM files|*.sfc|All files|*.*', end;
'.sfc'); log('existing ROM failed verification');
end; end;
rom := ''
function GetROMPath(Param: string): string; ROMFilePage :=
begin CreateInputFilePage(
if Assigned(RomFilePage) then begin wpLicense,
R := CompareStr(GetMD5OfFile(ROMFilePage.Values[0]), '03a63945398191337e896e5771f77173') 'Select ROM File',
if R <> 0 then 'Where is your Zelda no Densetsu - Kamigami no Triforce (Japan).sfc located?',
MsgBox('ROM validation failed. Very likely wrong file.', mbInformation, MB_OK); 'Select the file, then click Next.');
Result := ROMFilePage.Values[0]
end ROMFilePage.Add(
else 'Location of ROM file:',
Result := ''; 'SNES ROM files|*.sfc|All files|*.*',
end; '.sfc');
end;
function GetROMPath(Param: string): string;
begin
if Length(rom) > 0 then
Result := rom
else if Assigned(RomFilePage) then
begin
R := CompareStr(GetMD5OfFile(ROMFilePage.Values[0]), '03a63945398191337e896e5771f77173')
if R <> 0 then
MsgBox('ROM validation failed. Very likely wrong file.', mbInformation, MB_OK);
Result := ROMFilePage.Values[0]
end
else
Result := '';
end;