Skip to content

Commit

Permalink
Create Update.iss
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlmundo committed Apr 8, 2024
1 parent 83c1b19 commit b849edb
Showing 1 changed file with 105 additions and 0 deletions.
105 changes: 105 additions & 0 deletions Install Script Source/Update.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#define AppName "Worms 2 Plus Update 1.5.8.x to 1.5.8.2"
#define AppVersion "1.5.8.2"
#define AppProcess1 "frontend.exe"
#define AppProcess2 "worms2.exe"
#define Game "Worms 2"
#define RegPathCU1 "Software\Team17SoftwareLTD\Worms2"
#define RegPathLM1 "Software\GOG.com\GOGWORMS2"
#define RegPathLM2 "Software\Microsoft\DirectPlay\Applications\worms2"
#define MsgRunning 'Worms 2 is running. Please close the game before installing the patch.'

[Setup]
AppId={{B90927CD-E317-466C-8B6B-BC9042E2F1D2}
AppName={#AppName}
AppVersion={#AppVersion}
DefaultDirName={code:GetDefaultDir}
DisableProgramGroupPage=yes
DirExistsWarning=no
DisableDirPage=no
AppendDefaultDirName=no
DisableReadyPage=yes
AlwaysShowDirOnReadyPage=yes
CloseApplications=yes
OutputBaseFilename={#AppName}
SetupIconFile=image-icon.ico
WizardImageFile=image-large.bmp
WizardImageStretch=no
WizardSmallImageFile=image-small.bmp
Compression=none
Uninstallable=no
PrivilegesRequired=admin
ShowLanguageDialog=yes
RestartIfNeededByRun=no

[Languages]
Name: "nl"; MessagesFile: "compiler:Languages\Dutch.isl"
Name: "en"; MessagesFile: "compiler:Default.isl"
Name: "fr"; MessagesFile: "compiler:Languages\French.isl"
Name: "de"; MessagesFile: "compiler:Languages\German.isl"
Name: "it"; MessagesFile: "compiler:Languages\Italian.isl"
Name: "pl"; MessagesFile: "compiler:Languages\Polish.isl"
Name: "pt"; MessagesFile: "compiler:Languages\Portuguese.isl"
Name: "es"; MessagesFile: "compiler:Languages\Spanish.isl"
Name: "es_la"; MessagesFile: "Languages\SpanishLA.isl"
Name: "sv"; MessagesFile: "Languages\Swedish.isl"

[Files]
Source: "..\Patch\All Installs\fkUpdate.dll"; DestDir: "{app}\"; Flags: ignoreversion recursesubdirs createallsubdirs overwritereadonly;
Source: "..\Patch\All Installs\Teams\Internet.dat"; DestDir: "{app}\"; Flags: ignoreversion recursesubdirs createallsubdirs overwritereadonly;

[Code]
var InstalledDir : string;
function IsAppRunning(const FileName: string): Boolean;
var
FWMIService: Variant;
FSWbemLocator: Variant;
FWbemObjectSet: Variant;
begin
Result := false;
FSWbemLocator := CreateOleObject('WBEMScripting.SWBEMLocator');
FWMIService := FSWbemLocator.ConnectServer('', 'root\CIMV2', '', '');
FWbemObjectSet := FWMIService.ExecQuery(Format('SELECT Name FROM Win32_Process Where Name="%s"',[FileName]));
Result := (FWbemObjectSet.Count > 0);
FWbemObjectSet := Unassigned;
FWMIService := Unassigned;
FSWbemLocator := Unassigned;
end;
function InitializeSetup: boolean;
begin
Result := not IsAppRunning('{#AppProcess1}');
if Result then begin
Result := not IsAppRunning('{#AppProcess2}');
end;
if not Result then
MsgBox('{#MsgRunning}', mbError, MB_OK);
end;
function GetDefaultDir(def: string): string;
begin
if RegQueryStringValue(HKLM32, '{#RegPathLM1}', 'PATH', InstalledDir) then begin
end
else if RegQueryStringValue(HKLM32, '{#RegPathLM2}', 'Path', InstalledDir) then begin
end;
Result := InstalledDir;
end;
function NextButtonClick(PageId: Integer): Boolean;
begin
Result := True;
if (PageId = wpSelectDir) then begin
if (not FileExists(ExpandConstant('{app}\{#AppProcess2}'))) then begin
MsgBox('{#Game} could not be found in that folder. If it is the correct folder, please try reinstalling the game.', mbError, MB_OK);
Result := False;
end
end;
end;
[Messages]
SelectLanguageTitle=Select Language
SelectLanguageLabel=Select the language for setup
SetupAppTitle={#AppName}
SetupWindowTitle={#AppName}
WelcomeLabel1={#AppName}
en.SelectDirLabel3=Setup will try to detect where {#Game} is installed.
en.SelectDirBrowseLabel=If it has not been detected, click Browse to specify the folder.

0 comments on commit b849edb

Please sign in to comment.