-
Notifications
You must be signed in to change notification settings - Fork 5
/
Windows Installer.nsi
304 lines (238 loc) · 10.2 KB
/
Windows Installer.nsi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
;
; NSIS Modern User Interface
; flaME Installer script
;
;--------------------------------
;Include section
!include "MUI2.nsh"
!include "FileFunc.nsh"
!include "LogicLib.nsh"
!include "FileAssociation.nsh"
;--------------------------------
;Defines
!define PROGRAMNAME "FlaME"
!define SRCCODEDIR "${PROGRAMNAME}"
!define EXESOURCELOC "${SRCCODEDIR}\bin\Debug"
!define INTERFACEDIR "${EXESOURCELOC}\interface"
!define INTERFACESUBDIR "interface"
!define INSTALLERDATA "Windows Installer"
!define PROGRAMVMAJOR "1"
!define PROGRAMVMINOR "29"
!define FLAMEVSHORT "${PROGRAMVMAJOR}.${PROGRAMVMINOR}"
!define FLAMEVFULL "${FLAMEVSHORT}.0.0"
!define FLAMEFULLNAME "${PROGRAMNAME} ${FLAMEVSHORT}"
!define UNDERSCOREFULLNAME "${PROGRAMNAME}_${PROGRAMVMAJOR}_${PROGRAMVMINOR}"
;---- Is better if all of these are unique
!define FMAP_REG "${PROGRAMNAME} Map File (${FLAMEFULLNAME})"
!define FME_REG "${PROGRAMNAME} Old Map File (${FLAMEFULLNAME})"
!define WZ_REG "Warzone 2100 Archive (${FLAMEFULLNAME})"
!define LND_REG "EditWorld Map File (${FLAMEFULLNAME})"
!define GAM_REG "Warzone 2100 Game File (${FLAMEFULLNAME})"
;--------------------------------
;General
CRCCheck on ;make sure this isn't corrupted
SetCompressor /SOLID lzma
;Name and file
Name "${FLAMEFULLNAME}"
OutFile "Install ${FLAMEFULLNAME}.exe"
;Default installation folder
InstallDir "$PROGRAMFILES\${FLAMEFULLNAME}"
;Request application privileges for Windows Vista
RequestExecutionLevel admin
;--------------------------------
;Versioninfo
VIProductVersion "${FLAMEVFULL}"
VIAddVersionKey "CompanyName" ""
VIAddVersionKey "FileDescription" "${FLAMEFULLNAME} Installer"
VIAddVersionKey "FileVersion" "${FLAMEVFULL}"
VIAddVersionKey "InternalName" "${FLAMEFULLNAME}"
VIAddVersionKey "LegalCopyright" ""
VIAddVersionKey "OriginalFilename" "${FLAMEFULLNAME}.exe"
VIAddVersionKey "ProductName" "${FLAMEFULLNAME}"
VIAddVersionKey "ProductVersion" "${FLAMEVFULL}"
VIAddVersionKey "Installer" "Installer script Copyright © 2010-2011 Milo Christiansen"
;--------------------------------
;Variables
Var StartMenuFolder
;--------------------------------
;Interface Settings
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "${INSTALLERDATA}\Header.bmp"
!define MUI_HEADERIMAGE_RIGHT
!define MUI_WELCOMEFINISHPAGE_BITMAP "${INSTALLERDATA}\Welcome.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${INSTALLERDATA}\Welcome.bmp"
!define MUI_ICON "${INSTALLERDATA}\flaME.ico"
!define MUI_UNICON "${INSTALLERDATA}\Uninstall.ico"
!define MUI_ABORTWARNING
; These indented statements modify settings for MUI_PAGE_FINISH
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_NOTCHECKED
!define MUI_FINISHPAGE_RUN_TEXT "Launch ${PROGRAMNAME}"
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
;!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
;!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\Readme.txt"
;Start Menu Folder Page Configuration
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "${FLAMEFULLNAME}"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${FLAMEFULLNAME}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
;--------------------------------
;Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU "${UNDERSCOREFULLNAME}" $StartMenuFolder
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_COMPONENTS
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
;Main install Section
Section "Install ${PROGRAMNAME}" Main
SectionIn RO
SetOutPath "$INSTDIR"
File "${EXESOURCELOC}\OpenTK.GLControl.dll"
File "${EXESOURCELOC}\OpenTK.dll"
File "${EXESOURCELOC}\OpenTK.dll.config"
File "${EXESOURCELOC}\ICSharpCode.SharpZipLib.dll"
;File "${EXESOURCELOC}\Lists.dll"
File "${EXESOURCELOC}\Matrix3D.dll"
File "${EXESOURCELOC}\notile.png"
File "${EXESOURCELOC}\overflow.png"
File "${EXESOURCELOC}\FlaME.exe"
File "${EXESOURCELOC}\flaME.ico"
File "${INSTALLERDATA}\map.ico"
SetOutPath "$INSTDIR\${INTERFACESUBDIR}"
File "${INTERFACEDIR}\displayautotexture.png"
File "${INTERFACEDIR}\drawtileorientation.png"
File "${INTERFACEDIR}\gateways.png"
File "${INTERFACEDIR}\objectsselect.png"
File "${INTERFACEDIR}\save.png"
File "${INTERFACEDIR}\selection.png"
File "${INTERFACEDIR}\selectioncopy.png"
File "${INTERFACEDIR}\selectionflipx.png"
File "${INTERFACEDIR}\selectionpaste.png"
File "${INTERFACEDIR}\selectionpasteoptions.png"
File "${INTERFACEDIR}\selectionrotateanticlockwise.png"
File "${INTERFACEDIR}\selectionrotateclockwise.png"
File "${INTERFACEDIR}\problem.png"
File "${INTERFACEDIR}\warning.png"
;Startmenu shortcuts
!insertmacro MUI_STARTMENU_WRITE_BEGIN "${UNDERSCOREFULLNAME}"
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\${FLAMEFULLNAME}.lnk" "$INSTDIR\FlaME.exe"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall ${FLAMEFULLNAME}.lnk" "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_END
;Store installation folder
WriteRegStr HKCU "Software\${FLAMEFULLNAME}" "" $INSTDIR
;Register with add/remove programs
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FLAMEFULLNAME}" "DisplayName" "${FLAMEFULLNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FLAMEFULLNAME}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FLAMEFULLNAME}" "NoModify" "1"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FLAMEFULLNAME}" "NoRepair" "1"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FLAMEFULLNAME}" "Publisher" "Flail13"
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
SubSection "File Associations"
Section "FlaME .fmap" RegFMAP
${registerExtension} "$INSTDIR\FlaME.exe" ".fmap" "${FMAP_REG}" "$INSTDIR\map.ico"
SectionEnd
Section "FlaME .fme" RegFME
${registerExtension} "$INSTDIR\FlaME.exe" ".fme" "${FME_REG}" "$INSTDIR\map.ico"
SectionEnd
Section "Editworld .lnd" RegLND
${registerExtension} "$INSTDIR\FlaME.exe" ".lnd" "${LND_REG}" "$INSTDIR\map.ico"
SectionEnd
Section "Warzone .wz" RegWZ
${registerExtension} "$INSTDIR\FlaME.exe" ".wz" "${WZ_REG}" "$INSTDIR\map.ico"
SectionEnd
Section "Warzone .gam" RegGam
${registerExtension} "$INSTDIR\FlaME.exe" ".gam" "${GAM_REG}" "$INSTDIR\map.ico"
SectionEnd
SubSectionEnd
Section "Desktop Shortcut" ShortcutDT
SetOutPath "$INSTDIR"
CreateShortCut "$DESKTOP\${FLAMEFULLNAME}.lnk" "$INSTDIR\FlaME.exe"
SectionEnd
;--------------------------------
;Installer Functions
Function LaunchLink
Exec '$INSTDIR\FlaME.exe'
FunctionEnd
;--------------------------------
;Installer Section descriptions
LangString DESC_Main ${LANG_ENGLISH} "Install ${PROGRAMNAME}."
LangString DESC_RegFMAP ${LANG_ENGLISH} "Open .fmap files when double clicked."
LangString DESC_RegFME ${LANG_ENGLISH} "Open .fme files when double clicked."
LangString DESC_RegLND ${LANG_ENGLISH} "Open .lnd files when double clicked."
LangString DESC_RegWZ ${LANG_ENGLISH} "Open .wz files when double clicked."
LangString DESC_RegGam ${LANG_ENGLISH} "Open .gam files when double clicked."
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Main} $(DESC_Main)
!insertmacro MUI_DESCRIPTION_TEXT ${RegFMAP} $(DESC_RegFMAP)
!insertmacro MUI_DESCRIPTION_TEXT ${RegFME} $(DESC_RegFME)
!insertmacro MUI_DESCRIPTION_TEXT ${RegLND} $(DESC_RegLND)
!insertmacro MUI_DESCRIPTION_TEXT ${RegWZ} $(DESC_RegWZ)
!insertmacro MUI_DESCRIPTION_TEXT ${RegGam} $(DESC_RegGam)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
;Uninstaller Section
Section "un.Uninstall ${PROGRAMNAME}" unMain
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${FLAMEFULLNAME}"
Delete "$INSTDIR\Uninstall.exe"
Delete "$INSTDIR\map.ico"
Delete "$INSTDIR\flaME.ico"
Delete "$INSTDIR\FlaME.exe"
Delete "$INSTDIR\ICSharpCode.SharpZipLib.dll"
Delete "$INSTDIR\notile.png"
Delete "$INSTDIR\overflow.png"
Delete "$INSTDIR\OpenTK.dll"
Delete "$INSTDIR\OpenTK.dll.config"
Delete "$INSTDIR\OpenTK.GLControl.dll"
Delete "$INSTDIR\Matrix3D.dll"
;Delete "$INSTDIR\Lists.dll"
Delete "$INSTDIR\${INTERFACESUBDIR}\displayautotexture.png"
Delete "$INSTDIR\${INTERFACESUBDIR}\drawtileorientation.png"
Delete "$INSTDIR\${INTERFACESUBDIR}\gateways.png"
Delete "$INSTDIR\${INTERFACESUBDIR}\objectsselect.png"
Delete "$INSTDIR\${INTERFACESUBDIR}\save.png"
Delete "$INSTDIR\${INTERFACESUBDIR}\selection.png"
Delete "$INSTDIR\${INTERFACESUBDIR}\selectioncopy.png"
Delete "$INSTDIR\${INTERFACESUBDIR}\selectionflipx.png"
Delete "$INSTDIR\${INTERFACESUBDIR}\selectionpaste.png"
Delete "$INSTDIR\${INTERFACESUBDIR}\selectionpasteoptions.png"
Delete "$INSTDIR\${INTERFACESUBDIR}\selectionrotateanticlockwise.png"
Delete "$INSTDIR\${INTERFACESUBDIR}\selectionrotateclockwise.png"
Delete "$INSTDIR\${INTERFACESUBDIR}\problem.png"
Delete "$INSTDIR\${INTERFACESUBDIR}\warning.png"
RMDir "$INSTDIR\${INTERFACESUBDIR}"
RMDir "$INSTDIR"
!insertmacro MUI_STARTMENU_GETFOLDER "${UNDERSCOREFULLNAME}" $StartMenuFolder
Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall ${FLAMEFULLNAME}.lnk"
Delete "$SMPROGRAMS\$StartMenuFolder\${FLAMEFULLNAME}.lnk"
RMDir "$SMPROGRAMS\$StartMenuFolder"
DeleteRegKey /ifempty HKCU "Software\${FLAMEFULLNAME}"
; remove the desktop shortcut icon
Delete "$DESKTOP\${FLAMEFULLNAME}.lnk"
${unregisterExtension} ".fmap" "${FMAP_REG}"
${unregisterExtension} ".fme" "${FME_REG}"
${unregisterExtension} ".wz" "${WZ_REG}"
${unregisterExtension} ".lnd" "${LND_REG}"
${unregisterExtension} ".gam" "${GAM_REG}"
SectionEnd
;--------------------------------
;Installer Section descriptions
LangString DESC_unMain ${LANG_ENGLISH} "Uninstall ${PROGRAMNAME}."
!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${unMain} $(DESC_unMain)
!insertmacro MUI_UNFUNCTION_DESCRIPTION_END