fork/m-overlay

git clone https://git.julia.blue/fork/m-overlay

BkacjiosFinal update logic fixesf03565a

v2.1.2
4.9 KiB132 linesraw
1; -- 64Bit.iss --
2; Demonstrates installation of a program built for the x64 (a.k.a. AMD64)
3; architecture.
4; To successfully run this installation and the program it installs,
5; you must have a "x64" edition of Windows.
6
7; SEE THE DOCUMENTATION FOR DETAILS ON CREATING .ISS SCRIPT FILES!
8
9[Setup]
10#define AppName "M'Overlay"
11;#define AppMajor
12;#define AppMinor
13;#define AppRevision
14;#define AppBuild
15;#define AppVersion GetVersionComponents("build/x64/m-overlay-x64.exe", AppMajor, AppMinor, AppRevision, AppBuild)
16;#define AppVersion Str(AppMajor) + "." + Str(AppMinor) + "." + Str(AppRevision)
17#define AppVersion "2.1.0"
18PrivilegesRequired=lowest
19DisableWelcomePage=no
20AppName={#AppName}
21AppId={#AppName}
22AppVersion={#AppVersion}
23AppPublisher=Bkacjios
24AppPublisherURL=https://github.com/bkacjios
25AppUpdatesURL=https://github.com/bkacjios/m-overlay/releases
26AppSupportURL=https://github.com/bkacjios/m-overlay/issues
27WizardStyle=modern
28DefaultDirName={autopf}\{#AppName}
29DefaultGroupName={#AppName}
30UninstallDisplayIcon={app}\m-overlay-x64.exe
31SetupIconFile=installer/icon.ico
32WizardImageFile=installer/wizardbanner.bmp
33WizardSmallImageFile=installer/wizard.bmp
34Compression=lzma2
35SolidCompression=yes
36OutputDir=./releases
37OutputBaseFilename=m-overlay-x64-installer
38; "ArchitecturesAllowed=x64" specifies that Setup cannot run on
39; anything but x64.
40ArchitecturesAllowed=x64
41; "ArchitecturesInstallIn64BitMode=x64" requests that the install be
42; done in "64-bit mode" on x64, meaning it should use the native
43; 64-bit Program Files directory and the 64-bit view of the registry.
44ArchitecturesInstallIn64BitMode=x64
45LicenseFile=build/x64/license.txt
46
47[Files]
48Source: "build/x64/license.txt"; DestDir: "{app}"; DestName: "license.txt"; Flags: ignoreversion
49Source: "build/x64/m-overlay-x64.exe"; DestDir: "{app}"; DestName: "m-overlay-x64.exe"; Flags: ignoreversion
50Source: "build/x64/love.dll"; DestDir: "{app}"; DestName: "love.dll"; Flags: ignoreversion
51Source: "build/x64/lua51.dll"; DestDir: "{app}"; DestName: "lua51.dll"; Flags: ignoreversion
52Source: "build/x64/mpg123.dll"; DestDir: "{app}"; DestName: "mpg123.dll"; Flags: ignoreversion
53Source: "build/x64/msvcp120.dll"; DestDir: "{app}"; DestName: "msvcp120.dll"; Flags: ignoreversion
54Source: "build/x64/msvcr120.dll"; DestDir: "{app}"; DestName: "msvcr120.dll"; Flags: ignoreversion
55Source: "build/x64/OpenAL32.dll"; DestDir: "{app}"; DestName: "OpenAL32.dll"; Flags: ignoreversion
56Source: "build/x64/SDL2.dll"; DestDir: "{app}"; DestName: "SDL2.dll"; Flags: ignoreversion
57Source: "build/x64/ssl.dll"; DestDir: "{app}"; DestName: "ssl.dll"; Flags: ignoreversion
58Source: "build/application.love"; DestDir: "{userappdata}/m-overlay"; DestName: "application.love"; Flags: ignoreversion
59
60[Tasks]
61Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; \
62    GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
63
64[Icons]
65Name: "{group}\{#AppName}"; Filename: "{app}\m-overlay-x64.exe"
66Name: "{commondesktop}\{#AppName}"; Filename: "{app}\m-overlay-x64.exe"; \
67    Tasks: desktopicon
68
69[Run]
70Filename: {app}\m-overlay-x64.exe; Description: "Launch {#AppName}"; Flags: postinstall shellexec skipifsilent nowait
71
72[Code]
73
74{ ///////////////////////////////////////////////////////////////////// }
75function GetUninstallString(): String;
76var
77  sUnInstPath: String;
78  sUnInstallString: String;
79begin
80  sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\M''Overlay_is1');
81  sUnInstallString := '';
82  if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
83    RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
84  Result := sUnInstallString;
85end;
86
87
88{ ///////////////////////////////////////////////////////////////////// }
89function IsUpgrade(): Boolean;
90begin
91  Result := (GetUninstallString() <> '');
92end;
93
94
95{ ///////////////////////////////////////////////////////////////////// }
96function UnInstallOldVersion(): Integer;
97var
98  sUnInstallString: String;
99  iResultCode: Integer;
100begin
101{ Return Values: }
102{ 1 - uninstall string is empty }
103{ 2 - error executing the UnInstallString }
104{ 3 - successfully executed the UnInstallString }
105
106  { default return value }
107  Result := 0;
108
109  { get the uninstall string of the old app }
110  sUnInstallString := GetUninstallString();
111  if sUnInstallString <> '' then begin
112    sUnInstallString := RemoveQuotes(sUnInstallString);
113    if Exec(sUnInstallString, '/VERYSILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
114      Result := 3
115    else
116      Result := 2;
117  end else
118    Result := 1;
119end;
120
121{ ///////////////////////////////////////////////////////////////////// }
122procedure CurStepChanged(CurStep: TSetupStep);
123begin
124  if (CurStep=ssInstall) then
125  begin
126    if (IsUpgrade()) then
127    begin
128      MsgBox('M''Overlay has changed install directories, so the old version will be uninstalled first. Your config files and music will remain untouched.', mbInformation, MB_OK);
129      UnInstallOldVersion();
130    end;
131  end;
132end;