author | dominik |
Thu, 23 Dec 2004 18:28:13 +0000 | |
changeset 788 | 951b52443d48 |
parent 254 | c711cd6b716c |
child 801 | 7b6cb481359c |
permissions | -rw-r--r-- |
0 | 1 |
; Define your application name |
2 |
!define APPNAME "OpenTTD" |
|
250
733e18ca6e93
(svn r251) -Project ready for 0.3.4 release. Updated installer, readme and fileinformation
darkvater
parents:
32
diff
changeset
|
3 |
!define APPNAMEANDVERSION "OpenTTD 0.3.4.0" |
733e18ca6e93
(svn r251) -Project ready for 0.3.4 release. Updated installer, readme and fileinformation
darkvater
parents:
32
diff
changeset
|
4 |
!define APPVERSION "0.3.4.0" |
254
c711cd6b716c
(svn r259) -Fix: Installer version updated to 12. Properly commented now. Thx teeone
darkvater
parents:
250
diff
changeset
|
5 |
!define INSTALLERVERSION 12 ;NEED TO UPDATE THIS FOR EVERY RELEASE!!! |
0 | 6 |
|
7 |
BrandingText "OpenTTD Installer" |
|
8 |
||
9 |
||
10 |
; Version Info |
|
11 |
Var AddWinPrePopulate |
|
250
733e18ca6e93
(svn r251) -Project ready for 0.3.4 release. Updated installer, readme and fileinformation
darkvater
parents:
32
diff
changeset
|
12 |
VIProductVersion "${APPVERSION}" |
0 | 13 |
VIAddVersionKey "ProductName" "OpenTTD Installer" |
14 |
VIAddVersionKey "Comments" "Installs ${APPNAMEANDVERSION}" |
|
15 |
VIAddVersionKey "CompanyName" "OpenTTD Developers" |
|
16 |
VIAddVersionKey "FileDescription" "Installs ${APPNAMEANDVERSION}" |
|
17 |
VIAddVersionKey "ProductVersion" "${APPVERSION}" |
|
18 |
VIAddVersionKey "InternalName" "InstOpenTTD" |
|
19 |
VIAddVersionKey "FileVersion" "${APPVERSION}" |
|
20 |
VIAddVersionKey "LegalCopyright" " " |
|
21 |
; Main Install settings |
|
22 |
Name "${APPNAMEANDVERSION}" |
|
23 |
||
24 |
; NOTE: Keep trailing backslash! |
|
25 |
InstallDir "$PROGRAMFILES\OpenTTD\" |
|
26 |
InstallDirRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Install Folder" |
|
27 |
OutFile "openttd-${APPVERSION}.exe" |
|
28 |
||
29 |
ShowInstDetails show |
|
30 |
ShowUninstDetails show |
|
31 |
SetCompressor LZMA |
|
32 |
||
33 |
Var SHORTCUTS |
|
34 |
Var CDDRIVE |
|
35 |
||
36 |
; Modern interface settings |
|
37 |
!include "MUI.nsh" |
|
38 |
||
39 |
!define MUI_ABORTWARNING |
|
40 |
||
41 |
!insertmacro MUI_PAGE_WELCOME |
|
42 |
LicenseForceSelection radiobuttons "I &accept this Agreement" "I &do not accept this agreement" |
|
43 |
||
44 |
!insertmacro MUI_PAGE_LICENSE "gpl.txt" |
|
45 |
||
46 |
;-------------------------------- |
|
47 |
; Rest of pages |
|
48 |
!insertmacro MUI_PAGE_COMPONENTS |
|
49 |
||
50 |
||
51 |
;-------------------------------- |
|
52 |
; New custom page for finding CD |
|
53 |
Page custom SelectCD SelectCD2 ": TTD folder" |
|
54 |
||
55 |
!insertmacro MUI_PAGE_DIRECTORY |
|
56 |
||
57 |
;Start Menu Folder Page Configuration |
|
58 |
!define MUI_STARTMENUPAGE_DEFAULTFOLDER $SHORTCUTS |
|
59 |
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKEY_LOCAL_MACHINE" |
|
60 |
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" |
|
61 |
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Shortcut Folder" |
|
62 |
||
63 |
!insertmacro MUI_PAGE_STARTMENU "OpenTTD" $SHORTCUTS |
|
64 |
||
65 |
!insertmacro MUI_PAGE_INSTFILES |
|
66 |
||
67 |
!define MUI_FINISHPAGE_RUN "$INSTDIR\openttd.exe" |
|
68 |
!define MUI_FINISHPAGE_LINK "Visit OpenTTD's homepage" |
|
69 |
!define MUI_FINISHPAGE_LINK_LOCATION "http://www.openttd.com/" |
|
70 |
!define MUI_FINISHPAGE_NOREBOOTSUPPORT |
|
71 |
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\readme.txt" |
|
72 |
||
73 |
!insertmacro MUI_PAGE_FINISH |
|
74 |
!insertmacro MUI_UNPAGE_CONFIRM |
|
75 |
!insertmacro MUI_UNPAGE_INSTFILES |
|
76 |
||
77 |
; Set languages (first is default language) |
|
78 |
!insertmacro MUI_LANGUAGE "English" |
|
79 |
!insertmacro MUI_RESERVEFILE_LANGDLL |
|
80 |
||
81 |
;-------------------------------- |
|
82 |
; Sections |
|
83 |
Section "!OpenTTD" Section1 |
|
84 |
||
85 |
; Set Section properties |
|
86 |
SetOverwrite try |
|
87 |
||
88 |
; Make savegame folder |
|
89 |
SetOutPath "$INSTDIR\save" |
|
90 |
; define root variable relative to installer |
|
91 |
!define PATH_ROOT "..\..\..\" |
|
92 |
||
93 |
; Copy language files |
|
94 |
SetOutPath "$INSTDIR\lang\" |
|
95 |
File ${PATH_ROOT}lang\*.lng |
|
96 |
File ${PATH_ROOT}lang\english.txt |
|
97 |
||
98 |
; Copy data files |
|
99 |
SetOutPath "$INSTDIR\data\" |
|
250
733e18ca6e93
(svn r251) -Project ready for 0.3.4 release. Updated installer, readme and fileinformation
darkvater
parents:
32
diff
changeset
|
100 |
File ${PATH_ROOT}data\canalsw.grf |
733e18ca6e93
(svn r251) -Project ready for 0.3.4 release. Updated installer, readme and fileinformation
darkvater
parents:
32
diff
changeset
|
101 |
File ${PATH_ROOT}data\openttd.grf |
0 | 102 |
File ${PATH_ROOT}data\opntitle.dat |
103 |
File ${PATH_ROOT}data\signalsw.grf |
|
250
733e18ca6e93
(svn r251) -Project ready for 0.3.4 release. Updated installer, readme and fileinformation
darkvater
parents:
32
diff
changeset
|
104 |
File ${PATH_ROOT}data\trkfoundw.grf |
0 | 105 |
|
106 |
; Copy the rest of the stuff |
|
107 |
SetOutPath "$INSTDIR\" |
|
108 |
||
109 |
;Copy text files |
|
110 |
File ${PATH_ROOT}changelog.txt |
|
250
733e18ca6e93
(svn r251) -Project ready for 0.3.4 release. Updated installer, readme and fileinformation
darkvater
parents:
32
diff
changeset
|
111 |
File ${PATH_ROOT}COPYING |
0 | 112 |
File ${PATH_ROOT}readme.txt |
113 |
||
114 |
; Copy executable |
|
250
733e18ca6e93
(svn r251) -Project ready for 0.3.4 release. Updated installer, readme and fileinformation
darkvater
parents:
32
diff
changeset
|
115 |
File /oname=openttd.exe ${PATH_ROOT}Release\openttd.exe |
0 | 116 |
File ${PATH_ROOT}strgen\Release\strgen.exe |
117 |
||
118 |
||
119 |
; Delete old files from the main dir. they are now placed in data/ and lang/ |
|
120 |
Delete "$INSTDIR\*.lng" |
|
121 |
Delete "$INSTDIR\*.grf" |
|
122 |
Delete "$INSTDIR\sample.cat" |
|
123 |
Delete "$INSTDIR\ttd.exe" |
|
124 |
||
125 |
||
126 |
;Creates the Registry Entries |
|
127 |
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Comments" "Visit http://www.openttd.com" |
|
128 |
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "DisplayIcon" "$INSTDIR\setup.ico" |
|
129 |
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "DisplayName" "OpenTTD ${APPVERSION}" |
|
130 |
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "DisplayVersion" "${APPVERSION}" |
|
131 |
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "HelpLink" "http://www.openttd.com" |
|
132 |
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Install Folder" "$INSTDIR" |
|
133 |
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Publisher" "OpenTTD" |
|
134 |
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Shortcut Folder" "$SHORTCUTS" |
|
135 |
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "UninstallString" "$INSTDIR\uninstall.exe" |
|
136 |
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "URLInfoAbout" "http://www.openttd.com" |
|
137 |
;This key sets the Version DWORD that patches will check against |
|
138 |
WriteRegDWORD HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Version" ${INSTALLERVERSION} |
|
139 |
||
140 |
!insertmacro MUI_STARTMENU_WRITE_BEGIN "OpenTTD" |
|
141 |
CreateShortCut "$DESKTOP\OpenTTD.lnk" "$INSTDIR\openttd.exe" |
|
142 |
CreateDirectory "$SMPROGRAMS\$SHORTCUTS" |
|
143 |
CreateShortCut "$SMPROGRAMS\$SHORTCUTS\OpenTTD.lnk" "$INSTDIR\openttd.exe" |
|
144 |
CreateShortCut "$SMPROGRAMS\$SHORTCUTS\Uninstall.lnk" "$INSTDIR\uninstall.exe" |
|
145 |
CreateShortCut "$SMPROGRAMS\$SHORTCUTS\Readme.lnk" "$INSTDIR\Readme.txt" |
|
146 |
CreateShortCut "$SMPROGRAMS\$SHORTCUTS\Changelog.lnk" "$INSTDIR\Changelog.txt" |
|
147 |
!insertmacro MUI_STARTMENU_WRITE_END |
|
148 |
SectionEnd |
|
149 |
||
150 |
Section "Copy Game Graphics" Section2 |
|
151 |
; Include files from CD |
|
152 |
;Let's copy the files from the CD |
|
153 |
SetOutPath "$INSTDIR\gm" |
|
154 |
CopyFiles "$CDDRIVE\gm\*.gm" "$INSTDIR\gm\" |
|
155 |
SetOutPath "$INSTDIR\data\" |
|
156 |
CopyFiles "$CDDRIVE\sample.cat" "$INSTDIR\data\sample.cat" 1566 |
|
157 |
CopyFiles "$CDDRIVE\trg1r.grf" "$INSTDIR\data\trg1r.grf" 2365 |
|
158 |
CopyFiles "$CDDRIVE\trgcr.grf" "$INSTDIR\data\trgcr.grf" 260 |
|
159 |
CopyFiles "$CDDRIVE\trghr.grf" "$INSTDIR\data\trghr.grf" 400 |
|
160 |
CopyFiles "$CDDRIVE\trgir.grf" "$INSTDIR\data\trgir.grf" 334 |
|
161 |
CopyFiles "$CDDRIVE\trgtr.grf" "$INSTDIR\data\trgtr.grf" 546 |
|
162 |
SetOutPath "$INSTDIR\" |
|
163 |
SectionEnd |
|
164 |
||
165 |
;---------------------- |
|
166 |
Section -FinishSection |
|
167 |
WriteUninstaller "$INSTDIR\uninstall.exe" |
|
168 |
SectionEnd |
|
169 |
||
170 |
; Modern install component descriptions |
|
171 |
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN |
|
172 |
!insertmacro MUI_DESCRIPTION_TEXT ${Section1} "OpenTTD is a fully functional clone of TTD and is very playable." |
|
173 |
!insertmacro MUI_DESCRIPTION_TEXT ${Section2} "Copies the game graphics. Requires TTD for Windows." |
|
174 |
!insertmacro MUI_FUNCTION_DESCRIPTION_END |
|
175 |
||
176 |
;!undef SHORTCUTS |
|
177 |
;Uninstall section |
|
178 |
||
179 |
Section Uninstall |
|
31
85a8c911441c
(svn r32) -Fix [1007277] Windows Installer Fixes for bugs [991118] and [991102]. (lucaspiller)
darkvater
parents:
0
diff
changeset
|
180 |
MessageBox MB_YESNOCANCEL|MB_ICONQUESTION "Would you like to remove the Saved Game Folders located at '$INSTDIR\Save?' If you choose Yes, your Saved Games will be removed." IDYES RemoveSavedGames IDNO NoRemoveSavedGames |
0 | 181 |
RemoveSavedGames: |
31
85a8c911441c
(svn r32) -Fix [1007277] Windows Installer Fixes for bugs [991118] and [991102]. (lucaspiller)
darkvater
parents:
0
diff
changeset
|
182 |
Delete "$INSTDIR\Save\AutoSave\*" |
85a8c911441c
(svn r32) -Fix [1007277] Windows Installer Fixes for bugs [991118] and [991102]. (lucaspiller)
darkvater
parents:
0
diff
changeset
|
183 |
RMDir "$INSTDIR\Save\AutoSave" |
85a8c911441c
(svn r32) -Fix [1007277] Windows Installer Fixes for bugs [991118] and [991102]. (lucaspiller)
darkvater
parents:
0
diff
changeset
|
184 |
Delete "$INSTDIR\Save\*" |
0 | 185 |
RMDir "$INSTDIR\Save" |
186 |
NoRemoveSavedGames: |
|
187 |
||
31
85a8c911441c
(svn r32) -Fix [1007277] Windows Installer Fixes for bugs [991118] and [991102]. (lucaspiller)
darkvater
parents:
0
diff
changeset
|
188 |
MessageBox MB_YESNOCANCEL|MB_ICONQUESTION "Would you like to remove the Scenario Folders located at '$INSTDIR\Scenario?' If you choose Yes, your Scenarios will be removed." IDYES RemoveScen IDNO NoRemoveScen |
85a8c911441c
(svn r32) -Fix [1007277] Windows Installer Fixes for bugs [991118] and [991102]. (lucaspiller)
darkvater
parents:
0
diff
changeset
|
189 |
RemoveScen: |
85a8c911441c
(svn r32) -Fix [1007277] Windows Installer Fixes for bugs [991118] and [991102]. (lucaspiller)
darkvater
parents:
0
diff
changeset
|
190 |
Delete "$INSTDIR\Scenario\*" |
85a8c911441c
(svn r32) -Fix [1007277] Windows Installer Fixes for bugs [991118] and [991102]. (lucaspiller)
darkvater
parents:
0
diff
changeset
|
191 |
RMDir "$INSTDIR\Scenario" |
85a8c911441c
(svn r32) -Fix [1007277] Windows Installer Fixes for bugs [991118] and [991102]. (lucaspiller)
darkvater
parents:
0
diff
changeset
|
192 |
NoRemoveScen: |
85a8c911441c
(svn r32) -Fix [1007277] Windows Installer Fixes for bugs [991118] and [991102]. (lucaspiller)
darkvater
parents:
0
diff
changeset
|
193 |
|
0 | 194 |
;Remove from registry... |
195 |
!insertmacro MUI_STARTMENU_GETFOLDER "OpenTTD" $SHORTCUTS |
|
196 |
ReadRegStr $SHORTCUTS HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Shortcut Folder" |
|
197 |
||
198 |
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" |
|
199 |
||
200 |
; Delete self |
|
201 |
Delete "$INSTDIR\uninstall.exe" |
|
202 |
||
203 |
; Delete Shortcuts |
|
204 |
Delete "$DESKTOP\OpenTTD.lnk" |
|
205 |
Delete "$SMPROGRAMS\$SHORTCUTS\OpenTTD.lnk" |
|
206 |
Delete "$SMPROGRAMS\$SHORTCUTS\Uninstall.lnk" |
|
207 |
Delete "$SMPROGRAMS\$SHORTCUTS\Readme.lnk" |
|
208 |
Delete "$SMPROGRAMS\$SHORTCUTS\Changelog.lnk" |
|
209 |
||
210 |
; Clean up OpenTTD dir |
|
211 |
Delete "$INSTDIR\changelog.txt" |
|
212 |
Delete "$INSTDIR\readme.txt" |
|
213 |
Delete "$INSTDIR\openttd.exe" |
|
214 |
Delete "$INSTDIR\strgen.exe" |
|
250
733e18ca6e93
(svn r251) -Project ready for 0.3.4 release. Updated installer, readme and fileinformation
darkvater
parents:
32
diff
changeset
|
215 |
Delete "$INSTDIR\COPYING" |
0 | 216 |
Delete "$INSTDIR\INSTALL.LOG" |
217 |
Delete "$INSTDIR\crash.log" |
|
218 |
Delete "$INSTDIR\openttd.cfg" |
|
219 |
||
220 |
; Data files |
|
221 |
Delete "$INSTDIR\data\opntitle.dat" |
|
222 |
Delete "$INSTDIR\data\signalsw.grf" |
|
223 |
Delete "$INSTDIR\data\openttd.grf" |
|
224 |
Delete "$INSTDIR\data\canalsw.grf" |
|
250
733e18ca6e93
(svn r251) -Project ready for 0.3.4 release. Updated installer, readme and fileinformation
darkvater
parents:
32
diff
changeset
|
225 |
Delete "$INSTDIR\data\trkfoundw.grf" |
0 | 226 |
Delete "$INSTDIR\data\trg1r.grf" |
227 |
Delete "$INSTDIR\data\trghr.grf" |
|
228 |
Delete "$INSTDIR\data\trgtr.grf" |
|
229 |
Delete "$INSTDIR\data\sample.cat" |
|
230 |
Delete "$INSTDIR\data\trgcr.grf" |
|
231 |
Delete "$INSTDIR\data\trgir.grf" |
|
232 |
||
233 |
;Music |
|
234 |
Delete "$INSTDIR\gm\*.gm" |
|
235 |
||
236 |
;Language files |
|
237 |
Delete "$INSTDIR\lang\*.lng" |
|
238 |
Delete "$INSTDIR\lang\english.txt" |
|
239 |
||
240 |
; Remove remaining directories |
|
241 |
RMDir "$SMPROGRAMS\$SHORTCUTS\Extras\" |
|
242 |
RMDir "$SMPROGRAMS\$SHORTCUTS" |
|
243 |
RMDir "$INSTDIR\gm" |
|
244 |
RMDir "$INSTDIR\lang" |
|
245 |
RMDir "$INSTDIR\data" |
|
246 |
RMDir "$INSTDIR" |
|
247 |
SectionEnd |
|
248 |
||
249 |
Function SelectCD |
|
250 |
SectionGetFlags ${Section2} $0 |
|
251 |
IntOp $0 $0 & 1 |
|
252 |
IntCmp $0 1 NoAbort |
|
253 |
Abort |
|
254 |
NoAbort: |
|
255 |
||
256 |
GetTempFileName $R0 |
|
257 |
!insertmacro MUI_HEADER_TEXT "Locate TTD" "Setup needs the location of Transport Tycoon Deluxe in order to continue." |
|
258 |
File /oname=$R0 CDFinder.ini |
|
259 |
ClearErrors |
|
260 |
;Now, let's populate $CDDRIVE |
|
261 |
ReadRegStr $CDDRIVE HKLM "SOFTWARE\Fish Technology Group\Transport Tycoon Deluxe" "HDPath" |
|
262 |
IfErrors NoTTD |
|
263 |
StrCpy $AddWinPrePopulate "Setup has detected your TTD folder. Don't change the folder. Simply press Next." |
|
264 |
Goto TruFinish |
|
265 |
NoTTD: |
|
266 |
StrCpy $CDDRIVE "" |
|
267 |
StrCpy $AddWinPrePopulate "Setup couldn't find TTD. Please enter the path where the graphics files from TTD for Windows are stored and press Next to continue." |
|
268 |
TruFinish: |
|
269 |
ClearErrors |
|
270 |
WriteINIStr $R0 "Field 2" "State" $CDDRIVE |
|
271 |
WriteINIStr $R0 "Field 3" "Text" $AddWinPrePopulate |
|
272 |
||
273 |
InstallOptions::dialog $R0 |
|
274 |
Pop $R1 |
|
275 |
FunctionEnd |
|
276 |
||
277 |
; Exit from page function |
|
278 |
Function SelectCD2 |
|
279 |
ReadINIStr $CDDRIVE $R0 "Field 2" "State" |
|
280 |
IfFileExists $CDDRIVE\trg1r.grf "" NoCD |
|
281 |
IfFileExists $CDDRIVE\sample.cat "" NoCD |
|
282 |
IfFileExists $CDDRIVE\trgir.grf hasCD "" |
|
283 |
NoCD: |
|
284 |
MessageBox MB_OK "Setup cannot continue without the Transport Tycoon Deluxe Location!" |
|
285 |
Abort |
|
286 |
hasCD: |
|
287 |
FunctionEnd |
|
288 |
||
289 |
||
290 |
Var OLDVERSION |
|
291 |
Var UninstallString |
|
292 |
||
293 |
Function .onInit |
|
294 |
StrCpy $SHORTCUTS "OpenTTD" |
|
295 |
||
296 |
SectionSetFlags 0 17 |
|
297 |
||
298 |
;Want to have a splash BMP? Uncomment these lines - CAREFUL WITH FILE SIZE |
|
299 |
||
300 |
; # the plugins dir is automatically deleted when the installer exits |
|
301 |
; InitPluginsDir |
|
302 |
; File /oname=$PLUGINSDIR\splash.bmp "C:\Documents and Settings\Administrator\My Documents\My Pictures\OpenTTD Splash.bmp" |
|
303 |
; #optional |
|
304 |
; #File /oname=$PLUGINSDIR\splash.wav "C:\myprog\sound.wav" |
|
305 |
; |
|
306 |
; ;MessageBox MB_OK "Fading" |
|
307 |
; |
|
308 |
; advsplash::show 3000 600 400 -1 $PLUGINSDIR\splash |
|
309 |
; |
|
310 |
; Pop $0 ; $0 has '1' if the user closed the splash screen early, |
|
311 |
; ; '0' if everything closed normal, and '-1' if some error occured. |
|
312 |
;End Splash Area |
|
313 |
;Starts Setup - let's look for an older version of OpenTTD |
|
314 |
ReadRegDWORD $R8 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Version" |
|
315 |
||
316 |
IfErrors ShowWelcomeMessage ShowUpgradeMessage |
|
317 |
ShowWelcomeMessage: |
|
318 |
ReadRegStr $R8 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Version" |
|
319 |
;In the event someone still has OpenTTD 0.1, this will detect that (that installer used a string instead of dword entry) |
|
320 |
IfErrors FinishCallback |
|
321 |
||
322 |
ShowUpgradeMessage: |
|
323 |
IntCmp ${INSTALLERVERSION} $R8 VersionsAreEqual InstallerIsOlder WelcomeToSetup |
|
324 |
WelcomeToSetup: |
|
325 |
;An older version was found. Let's let the user know there's an upgrade that will take plce. |
|
326 |
ReadRegStr $OLDVERSION HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "DisplayVersion" |
|
327 |
;Gets the older version then displays it in a message box |
|
328 |
MessageBox MB_OK|MB_ICONINFORMATION "Welcome to ${APPNAMEANDVERSION} Setup.$\n$\nThis will allow you to upgrade from version $OLDVERSION." |
|
329 |
Goto FinishCallback |
|
330 |
||
331 |
VersionsAreEqual: |
|
332 |
ReadRegStr $UninstallString HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "UninstallString" |
|
333 |
IfFileExists "$UninstallString" "" FinishCallback |
|
334 |
MessageBox MB_YESNO|MB_ICONQUESTION "Setup detected ${APPNAMEANDVERSION} on your system. That's the version this program will install.$\n$\nAre you trying to uninstall it?" IDYES DoUninstall IDNO FinishCallback |
|
335 |
DoUninstall: ;You have the same version as this installer. This allows you to uninstall. |
|
336 |
Exec "$UninstallString" |
|
337 |
Quit |
|
338 |
||
339 |
InstallerIsOlder: |
|
340 |
MessageBox MB_OK|MB_ICONSTOP "You have a newer version of ${APPNAME}.$\n$\nSetup will now exit." |
|
341 |
Quit |
|
342 |
||
343 |
FinishCallback: |
|
344 |
ClearErrors |
|
345 |
FunctionEnd |
|
346 |
; eof |
|
347 |