Skip to content

Instantly share code, notes, and snippets.

@marth8880
Created April 28, 2019 11:43
Show Gist options
  • Select an option

  • Save marth8880/3e16065b663f702253dbf71d44d00cf4 to your computer and use it in GitHub Desktop.

Select an option

Save marth8880/3e16065b663f702253dbf71d44d00cf4 to your computer and use it in GitHub Desktop.
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Mass Effect Unification R6.5 (Standalone)"
#define MyAppGroupName "Mass Effect Unification"
#define MyAppVersion "1.3.1"
#define MyAppPublisher "Frayed Wires Studios"
#define MyAppPublisherURL "http://www.moddb.com/company/frayedwiresstudios"
#define MyAppURL "http://www.moddb.com/mods/the-mass-effect-mod"
#define MySupportURL "http://www.moddb.com/mods/the-mass-effect-mod/forum/board/support"
#define MyUpdatesURL "http://www.moddb.com/mods/the-mass-effect-mod/downloads"
[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.)
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MySupportURL}
AppUpdatesURL={#MyUpdatesURL}
VersionInfoVersion={#MyAppVersion}
DefaultDirName={code:GetDirName}
;DefaultDirName={pf}\LucasArts\Star Wars Battlefront II\GameData
;DefaultDirName={pf}\Steam\SteamApps\common\Star Wars Battlefront II\GameData
DefaultGroupName={#MyAppGroupName}
LicenseFile=Y:\Builds\MEU\me5_40316_40404-06.5_standalone\files\addon\ME5\data\_LVL_PC\docs\License.rtf
InfoAfterFile=Y:\Builds\MEU\me5_40316_40404-06.5_standalone\files\addon\ME5\data\_LVL_PC\docs\changelog_r6.5_refined.txt
OutputDir=Y:\Builds\MEU\Builds\Release\R6.5
OutputBaseFilename=MassEffectUnificationSetup_R6.5
Compression=lzma/ultra
SolidCompression=yes
InternalCompressLevel=ultra
AllowRootDirectory=true
DirExistsWarning=no
UsePreviousAppDir=no
ShowLanguageDialog=yes
DisableReadyPage=true
WindowVisible=true
DiskSpanning=true
SetupIconFile=Y:\Builds\MEU\me5_40316_40404-06.5_standalone\config_tool.ico
WizardImageFile=Y:\Builds\MEU\me5_40316_40404-06.5_standalone\WizardImageFile.bmp
WizardSmallImageFile=Y:\Builds\MEU\me5_40316_40404-06.5_standalone\WizardSmallImageFile.bmp
[Code]
function ParseSteamConfig(FileName: string; var Paths: TArrayOfString): Boolean;
var
Lines: TArrayOfString;
I: Integer;
Line: string;
P: Integer;
Key: string;
Value: string;
Count: Integer;
BaseInstallFolderKeyPrefix: string;
begin
BaseInstallFolderKeyPrefix := 'BaseInstallFolder_';
Result := LoadStringsFromFile(FileName, Lines);
Count := 0;
// source: https://stackoverflow.com/a/37019690/3639133
// parse Steam's config.vdf file and extract the Steam library directory paths
for I := 0 to GetArrayLength(Lines) - 1 do
begin
Line := Trim(Lines[I]);
if Copy(Line, 1, 1) = '"' then
begin
Delete(Line, 1, 1);
P := Pos('"', Line);
if P > 0 then
begin
Key := Trim(Copy(Line, 1, P - 1));
Delete(Line, 1, P);
Line := Trim(Line);
//Log(Format('Found key "%s"', [Key]));
if (CompareText(Copy(Key, 1, Length(BaseInstallFolderKeyPrefix)), BaseInstallFolderKeyPrefix) = 0) and
(Line[1] = '"') then
begin
//Log(Format('Found base install folder key "%s"', [Key]));
Delete(Line, 1, 1);
P := Pos('"', Line);
if P > 0 then
begin
Value := Trim(Copy(Line, 1, P - 1));
StringChange(Value, '\\', '\');
Log(Format('Found base install folder "%s"', [Value]));
Count := Count + 1;
SetArrayLength(Paths, Count);
Paths[Count - 1] := Value;
end;
end;
end;
end;
end;
end;
function GetDirName(const Value: string): string;
var
InstallPath: string;
SteamPath: string;
SteamConfigFileArray: TArrayOfString;
SteamLibs: TArrayOfString;
SteamConfigFilePath: string;
I: integer;
begin
// initialize default path, which will be returned when the following registry
// key queries fail due to missing keys or for some different reason
Result := ExpandConstant('{pf}\LucasArts\Star Wars Battlefront II\GameData\');
// query the first registry value; if this succeeds, return the obtained value
if RegQueryStringValue(HKLM, 'SOFTWARE\LucasArts\Star Wars Battlefront II\1.0', 'ExePath', InstallPath) then
Result := InstallPath
// otherwise the first registry key query failed, so query the second registry value; if it succeeds, return the obtained value
else if RegQueryStringValue(HKLM, 'SOFTWARE\Wow6432Node\LucasArts\Star Wars Battlefront II\1.0', 'ExePath', InstallPath) then
Result := InstallPath
else
// if the registry values aren't found, check if the game is through Steam
begin
SteamPath := ExpandConstant('{reg:HKLM\SOFTWARE\Valve\Steam,SteamPath}');
if SteamPath = '' then
SteamPath := ExpandConstant('{reg:HKCU\SOFTWARE\Valve\Steam,SteamPath}');
if SteamPath = '' then
SteamPath := ExpandConstant('{pf}\Steam');
Log(Format('Found SteamPath: %s', [SteamPath]));
SteamConfigFilePath := SteamPath + '\config\config.vdf';
if FileExists(SteamConfigFilePath) then
begin
if LoadStringsFromFile(SteamConfigFilePath, SteamConfigFileArray) then
begin
// get the user's Steam library paths
ParseSteamConfig(SteamConfigFilePath, SteamLibs);
// look for the game directory in each Steam library
for I := 0 to GetArrayLength(SteamLibs) - 1 do
begin
if FileExists(SteamLibs[i] + '\steamapps\common\Star Wars Battlefront II\GameData\BattlefrontII.exe') then
begin
Result := SteamLibs[i] + '\steamapps\common\Star Wars Battlefront II\GameData\BattlefrontII.exe';
break;
end;
end;
end;
end;
end;
Log(Format('Result is %s', [ExtractFilePath(Result)]));
// return only the path
Result := ExtractFilePath(Result);
end;
[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: "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: "ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl"
[Files]
Source: "Y:\Builds\MEU\me5_40316_40404-06.5_standalone\files\addon\*"; DestDir: "{app}\addon"; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "Y:\Builds\MEU\me5_40316_40404-06.5_standalone\files\addon\uninsMEU.bat"; DestDir: "{app}\addon"; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall; Attribs: hidden
Source: "Y:\Builds\MEU\me5_40316_40404-06.5_standalone\files\SaveGames\MEU-Newcomer.profile"; DestDir: "{app}\SaveGames"; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall onlyifdoesntexist
Source: "Y:\Builds\MEU\me5_40316_40404-06.5_standalone\files\data\_lvl_pc\sound\shell.lvl"; DestDir: "{app}\data\_lvl_pc\sound"; Flags: uninsneveruninstall
Source: "Y:\Builds\MEU\me5_40316_40404-06.5_standalone\files\data\_lvl_pc\sound\shell_OLD.lvl"; DestDir: "{app}\data\_lvl_pc\sound"; Flags: uninsneveruninstall
Source: "Y:\Builds\MEU\me5_40316_40404-06.5_standalone\files\data\_lvl_pc\sound\retail\shell.lvl"; DestDir: "{app}\data\_lvl_pc\sound\retail"; Flags: uninsneveruninstall
Source: "Y:\Builds\MEU\me5_40316_40404-06.5_standalone\appdatajunk\*"; DestDir: "{localappdata}\Configuration Tool"; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "Y:\Builds\MEU\me5_40316_40404-06.5_standalone\patchfiles\addon\AAA\*"; DestDir: "{app}\addon\AAA-v1.3patch"; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "Y:\Builds\MEU\me5_40316_40404-06.5_standalone\patchfiles\data\*"; DestDir: "{app}\data"; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\Configuration Utility"; Filename: "{app}\addon\ME5\data\_LVL_PC\ConfigTool\ConfigTool.exe"
Name: "{group}\Mass Effect Unification on Mod DB"; Filename: "http://j.mp/meunification"
Name: "{group}\Report a Bug"; Filename: "http://j.mp/MEU-Bugs"
Name: "{group}\Discord Server"; Filename: "http://bit.ly/Frayed-Discord"
Name: "{group}\Technical Support (Web)"; Filename: "http://j.mp/MEU-Support"
Name: "{group}\Technical Support (E-Mail)"; Filename: "mailto:unification.debug@gmail.com"
; support@frayedwiresstudios.com
Name: "{group}\Credits"; Filename: "{app}\addon\ME5\data\_LVL_PC\docs\Credits.rtf"
Name: "{group}\Frequently Asked Questions"; Filename: "{app}\addon\ME5\data\_LVL_PC\docs\Frequently Asked Questions.rtf"
Name: "{group}\Menu Music Manifest"; Filename: "https://docs.google.com/spreadsheets/d/1kid1lFddtq9yG_1lRyytsTmt4QmMgKVeGl9_xxu7pOk/pubhtml"
Name: "{group}\Read Me"; Filename: "{app}\addon\ME5\data\_LVL_PC\docs\Mass Effect Unification README (EN-US).rtf"
Name: "{group}\{cm:UninstallProgram,{#MyAppGroupName}}"; Filename: "{uninstallexe}"
[Run]
Filename: "{app}\addon\ME5\data\_LVL_PC\bin\flagRecovery.bat"; StatusMsg: "Flushing Flag Directory..."; Flags: shellexec runascurrentuser
Filename: "{app}\addon\ME5\data\_LVL_PC\bin\installUserScripts__BOTH.bat"; StatusMsg: "Installing Custom GCs and User Scripts..."; Flags: shellexec runascurrentuser
;Filename: "{app}\addon\ME5\data\_LVL_PC\bin\installUserScripts__custom_gc.bat"; StatusMsg: "Installing custom GCs..."; Flags: shellexec runascurrentuser
;Filename: "{app}\addon\ME5\data\_LVL_PC\bin\installUserScripts__user_script.bat"; StatusMsg: "Installing user scripts..."; Flags: shellexec runascurrentuser
;Filename: "{app}\addon\ME5\data\_LVL_PC\bin\Redist\SWBF2-v1.3patch r129.exe"; StatusMsg: "Installing Unofficial v1.3 Patch..."
Filename: "{app}\addon\ME5\data\_LVL_PC\bin\Redist\dotNetFx40_Full_x86_x64.exe"; StatusMsg: "Installing Microsoft .NET Framework 4.0..."; Parameters: "/q /norestart"
Filename: "{app}\addon\ME5\data\_LVL_PC\docs\Mass Effect Unification README (EN-US).rtf"; Description: "View README file"; Flags: postinstall shellexec
Filename: "{app}\addon\ME5\data\_LVL_PC\docs\changelog_r6_refined.txt"; Description: "View Change Log"; Flags: postinstall shellexec
Filename: "{app}\addon\ME5\data\_LVL_PC\ConfigTool\ConfigTool.exe"; Description: "Launch Configuration Utility"; Flags: postinstall nowait
[InstallDelete]
Type: filesandordirs; Name: "{app}\addon\ME5\data\_LVL_PC\cfg\*"
;Type: filesandordirs; Name: "{group}"
[UninstallRun]
Filename: "{app}\addon\uninsMEU.bat"; Flags: shellexec runascurrentuser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment