Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Script generated by the Inno Script Studio Wizard.
- ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
- #define MyAppName "OFP Materials"
- #define MyAppVersion "1.1"
- #define MyAppPublisher "kenoxite"
- #define MyAppURL "http://forums.bistudio.com/showthread.php?190481"
- #define MyGroupName "OFP & CWA mods/OFP Materials"
- #define modDir "OFPmaterials"
- [Setup]
- ; NOTE: The value of AppId uniquely identifies this application.
- ; Do not use the same AppId value in installers for other applications.
- ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
- AppId=207A157A-FCB3-4EA7-884A-59F053F8198B
- AppName={#MyAppName}
- AppVersion={#MyAppVersion}
- ;AppVerName={#MyAppName} {#MyAppVersion}
- AppPublisher={#MyAppPublisher}
- AppPublisherURL={#MyAppURL}
- AppSupportURL={#MyAppURL}
- AppUpdatesURL={#MyAppURL}
- DefaultDirName={#modDir}
- OutputBaseFilename=OFP Materials v1.1 Setup
- SolidCompression=yes
- OutputDir=C:\Users\Usuario\Documents
- DisableDirPage=auto
- DisableReadyMemo=True
- UsePreviousGroup=False
- AllowNoIcons=True
- AlwaysUsePersonalGroup=True
- DefaultGroupName={#MyGroupName}
- DisableWelcomePage=false
- DisableReadyPage=True
- WizardImageFile=userdocs:Installer_OFPmaterials\OFPMatInstallerimg1.bmp
- WizardSmallImageFile=userdocs:Installer_OFPmaterials\OFPMatInstallersmallimg1.bmp
- [Messages]
- WelcomeLabel2=This will install the OFP Materials addon for OFP/CWA.%n%nOFP Materials provides material properties to all the vanilla textures and a numerous amount of user made addons.%n%nEverything look more vibrant and realistic than before, giving more contrast and depth to the game.
- [CustomMessages]
- OptionsFormCaption=OFP Materials installed already...
- RepairButtonCaption=Repair
- UninstallButtonCaption=Uninstall
- [Languages]
- Name: "english"; MessagesFile: "compiler:Default.isl"
- Name: "brazilianportuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl"
- Name: "catalan"; MessagesFile: "compiler:Languages\Catalan.isl"
- Name: "corsican"; MessagesFile: "compiler:Languages\Corsican.isl"
- Name: "czech"; MessagesFile: "compiler:Languages\Czech.isl"
- Name: "danish"; MessagesFile: "compiler:Languages\Danish.isl"
- Name: "dutch"; MessagesFile: "compiler:Languages\Dutch.isl"
- Name: "finnish"; MessagesFile: "compiler:Languages\Finnish.isl"
- Name: "french"; MessagesFile: "compiler:Languages\French.isl"
- Name: "german"; MessagesFile: "compiler:Languages\German.isl"
- Name: "greek"; MessagesFile: "compiler:Languages\Greek.isl"
- Name: "hebrew"; MessagesFile: "compiler:Languages\Hebrew.isl"
- Name: "hungarian"; MessagesFile: "compiler:Languages\Hungarian.isl"
- Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
- Name: "japanese"; MessagesFile: "compiler:Languages\Japanese.isl"
- Name: "norwegian"; MessagesFile: "compiler:Languages\Norwegian.isl"
- Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl"
- Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
- Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
- Name: "scottishgaelic"; MessagesFile: "compiler:Languages\ScottishGaelic.isl"
- Name: "serbiancyrillic"; MessagesFile: "compiler:Languages\SerbianCyrillic.isl"
- Name: "serbianlatin"; MessagesFile: "compiler:Languages\SerbianLatin.isl"
- Name: "slovenian"; MessagesFile: "compiler:Languages\Slovenian.isl"
- Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
- Name: "turkish"; MessagesFile: "compiler:Languages\Turkish.isl"
- Name: "ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl"
- [Tasks]
- Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"
- Name: "lowcontrast"; Description: "Install low contrast version"; GroupDescription: "The low contrast version is more visually compatible with dynamically spawned units and unsupported addons:"; Flags: unchecked
- [Icons]
- Name: "{userdesktop}\OFP Materials"; Filename: "{code:getGamePath}"; Parameters: "-nosplash -mod=OFPmaterials"; Tasks: desktopicon
- Name: "{userdesktop}\OFP Materials (Steam)"; Filename: "{code:getGamePathSteam}"; Parameters: "-applaunch 65790 -nosplash -mod=OFPmaterials"; Tasks: desktopicon; Check: returnSteamCheck
- Name: "{group}\Play OFP Materials"; Filename: "{code:getGamePath}"; Parameters: "-nosplash -mod=OFPmaterials"
- Name: "{group}\Play OFP Materials (Steam)"; Filename: "{code:getGamePathSteam}"; Parameters: "-applaunch 65790 -nosplash -mod=OFPmaterials"; Check: returnSteamCheck
- Name: "{group}\View Readme"; Filename: "{app}\OFPMaterials-Readme.pdf"
- Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
- [Files]
- Source: "OFPmaterials\low contrast\*"; DestDir: "{app}\low contrast"; Flags: ignoreversion createallsubdirs recursesubdirs
- Source: "OFPmaterials\high contrast\*"; DestDir: "{app}\high contrast"; Flags: ignoreversion createallsubdirs recursesubdirs
- Source: "OFPmaterials\addons\*"; DestDir: "{app}\addons"; Flags: ignoreversion createallsubdirs recursesubdirs
- Source: "OFPmaterials\_pbo\*"; DestDir: "{app}\_pbo"; Flags: ignoreversion createallsubdirs recursesubdirs
- Source: "OFPmaterials\_config_template\*"; DestDir: "{app}\_config_template"; Flags: ignoreversion createallsubdirs recursesubdirs
- Source: "OFPmaterials\OFPMaterials-Readme.pdf"; DestDir: "{app}"; Flags: ignoreversion isreadme
- Source: "OFPmaterials\OFPMaterials-Readme.txt"; DestDir: "{app}"; Flags: ignoreversion
- Source: "OFPmaterials\low contrast\ofp_matdef_core.pbo"; DestDir: "{app}\addons"; Flags: ignoreversion; Tasks: lowcontrast
- [Run]
- Filename: {code:getGamePath}; Parameters: "-nosplash -mod=OFPmaterials"; Flags: nowait postinstall skipifsilent unchecked; Description: "Launch OFP Materials"
- [UninstallDelete]
- Type: dirifempty; Name: "{app}\*"
- [Code]
- const
- mrRepair = 100;
- mrUninstall = 101;
- var
- InstPath: string;
- isSteam: boolean;
- // Check if the selected installation directory has a CWA or OFP game
- function isCWA: Boolean;
- begin
- Result := false;
- if FileExists(ExpandConstant(InstPath+'coldwarassault.exe')) then
- Result := true;
- end;
- // Generates an installation path based on the one selected by the user
- function getInstallPath(Append: String): String;
- begin
- Result := InstPath + Append;
- end;
- // Generates a path to the game based on if it's an OFP or CWA installation and the directory selected by the user
- function getGamePath(Default: String): String;
- begin
- if isCWA then begin
- Result := InstPath + 'coldwarassault.exe';
- end else begin
- Result := InstPath + 'FLASHPOINTRESISTANCE.exe';
- end;
- end;
- // Get Steam path
- function getSteamPath(Default: String): String;
- begin
- Result := '';
- if RegKeyExists(HKEY_LOCAL_MACHINE, 'Software\Valve\Steam') then
- RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\Valve\Steam','InstallPath', Result);
- end;
- // Check if the selected installation directory belongs to Steam
- function isSteamGame: Boolean;
- var steamPath: string;
- begin
- Result := false;
- if RegKeyExists(HKEY_LOCAL_MACHINE, 'Software\Valve\Steam') then begin
- steamPath := getSteamPath('');
- if InstPath = (steamPath + '\steamapps\common\ARMA Cold War Assault\') then begin
- Result := true;
- end;
- end;
- end;
- // Get Steam game path
- function getGamePathSteam(Default: String): String;
- begin
- Result := getSteamPath('') + '\Steam.exe';
- end;
- // Return the result of the Steam check
- // This seems a bit convoluted (lots of similar checks), but Inno doesn't seem to create the shortcuts otherwise
- function returnSteamCheck: Boolean;
- begin
- Result := isSteam;
- end;
- // Manage next button click event
- function NextButtonClick(CurPageID: Integer): Boolean;
- var
- debugStr:string;
- begin
- Result := True;
- //MsgBox('Page is "' + IntToStr(CurPageID) + '"', mbInformation, MB_OK);
- // Generate a new default install dir based on the installed games
- if CurPageID = 1 then begin
- WizardForm.DirEdit.Text := InstPath + '{#modDir}';
- end;
- if CurPageID = wpSelectProgramGroup then begin
- isSteam := isSteamGame;
- end;
- end;
- // Repair or uninstall if the mod was already installed
- function ShowOptionsForm: TModalResult;
- var
- OptionsForm: TSetupForm;
- RepairButton: TNewButton;
- UninstallButton: TNewButton;
- begin
- Result := mrNone;
- OptionsForm := CreateCustomForm;
- try
- OptionsForm.Width := 220;
- OptionsForm.Caption := ExpandConstant('{cm:OptionsFormCaption}');
- OptionsForm.Position := poScreenCenter;
- RepairButton := TNewButton.Create(OptionsForm);
- RepairButton.Parent := OptionsForm;
- RepairButton.Left := 8;
- RepairButton.Top := 8;
- RepairButton.Width := OptionsForm.ClientWidth - 16;
- RepairButton.Caption := ExpandConstant('{cm:RepairButtonCaption}');
- RepairButton.ModalResult := mrRepair;
- UninstallButton := TNewButton.Create(OptionsForm);
- UninstallButton.Parent := OptionsForm;
- UninstallButton.Left := 8;
- UninstallButton.Top := RepairButton.Top + RepairButton.Height + 8;
- UninstallButton.Width := OptionsForm.ClientWidth - 16;
- UninstallButton.Caption := ExpandConstant('{cm:UninstallButtonCaption}');
- UninstallButton.ModalResult := mrUninstall;
- OptionsForm.ClientHeight := RepairButton.Height + UninstallButton.Height + 24;
- Result := OptionsForm.ShowModal;
- finally
- OptionsForm.Free;
- end;
- end;
- function GetUninstallerPath: string;
- var
- RegKey: string;
- begin
- Result := '';
- RegKey := Format('%s\%s_is1', ['Software\Microsoft\Windows\CurrentVersion\Uninstall',
- '{#emit SetupSetting("AppId")}']);
- if not RegQueryStringValue(HKEY_LOCAL_MACHINE, RegKey, 'UninstallString', Result) then
- RegQueryStringValue(HKEY_CURRENT_USER, RegKey, 'UninstallString', Result);
- end;
- function InitializeSetup: Boolean;
- var
- regPath: string;
- UninstPath: string;
- ResultCode: Integer;
- begin
- Result := True;
- // Set default directory based on reg (OFP or CWA). CWA takes precedence over OFP
- if RegQueryStringValue(HKLM, 'SOFTWARE\Codemasters\Operation Flashpoint', 'MAIN', regPath) then
- InstPath := regPath + '\';
- if RegQueryStringValue(HKLM, 'SOFTWARE\bohemia interactive studio\coldwarassault', 'MAIN', regPath) then
- InstPath := regPath + '\';
- if RegQueryStringValue(HKLM, 'SOFTWARE\WOW6432Node\bohemia interactive studio\coldwarassault', 'MAIN', regPath) then
- InstPath := regPath + '\';
- // Get Uninstall path
- UninstPath := RemoveQuotes(GetUninstallerPath);
- if UninstPath <> '' then
- begin
- case ShowOptionsForm of
- mrRepair: Result := True;
- mrUninstall:
- begin
- Result := False;
- if not Exec(UninstPath, '', '', SW_SHOW, ewNoWait, ResultCode) then
- MsgBox(FmtMessage(SetupMessage(msgUninstallOpenError), [UninstPath]), mbError, MB_OK);
- end;
- else
- Result := False;
- end;
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement