1 ; Define your application name
2 !define APPNAME
"openc2e"
3 !define APPNAMEANDVERSION
"openc2e (development build)"
5 ; Development build revision
6 !define REVISION
"1784"
8 ; Main Install settings
9 Name "${APPNAMEANDVERSION}"
10 InstallDir "$PROGRAMFILES\openc2e"
11 InstallDirRegKey HKLM "Software\${APPNAME}" ""
12 OutFile "installers\openc2e-dev${REVISION}-win32.exe"
17 ; Modern interface settings
21 !define MUI_ICON
"instal.ico"
22 !define MUI_UNICON
"uninst.ico"
24 !define MUI_ABORTWARNING
26 ;Enable the start menu selection box
27 !define MUI_DIRECTORYPAGE
29 !insertmacro MUI_PAGE_WELCOME
30 !insertmacro MUI_PAGE_LICENSE
"COPYING"
31 !insertmacro MUI_PAGE_DIRECTORY
32 !insertmacro MUI_PAGE_INSTFILES
33 !insertmacro MUI_PAGE_FINISH
35 !insertmacro MUI_UNPAGE_CONFIRM
36 !insertmacro MUI_UNPAGE_INSTFILES
38 ; Set languages (first is default language)
39 !insertmacro MUI_LANGUAGE
"English"
40 !insertmacro MUI_LANGUAGE
"Dutch"
41 !insertmacro MUI_LANGUAGE
"French"
42 !insertmacro MUI_LANGUAGE
"German"
43 !insertmacro MUI_LANGUAGE
"Spanish"
44 !insertmacro MUI_RESERVEFILE_LANGDLL
46 !macro IfKeyExists ROOT MAIN_KEY KEY
50 !define Index
'Line${__LINE__}'
56 EnumRegKey $R0 ${ROOT} "${MAIN_KEY}" "$R1"
57 StrCmp $R0 "" "${Index}-False"
59 StrCmp $R0 "${KEY}" "${Index}-True" "${Index}-Loop"
67 ;Return 0 if not found
78 !macro GetCleanDir INPUTDIR
79 ; ATTENTION: USE ON YOUR OWN RISK!
80 ; Please report bugs here: http://stefan.bertels.org/
81 !define Index_GetCleanDir
'GetCleanDir_Line${__LINE__}'
84 StrCpy $R0 "${INPUTDIR}"
85 StrCmp $R0 "" ${Index_GetCleanDir}-finish
86 StrCpy $R1 "$R0" "" -1
87 StrCmp "$R1" "\" ${Index_GetCleanDir}-finish
89 ${Index_GetCleanDir}-finish:
92 !undef Index_GetCleanDir
95 !macro RemoveFilesAndSubDirs DIRECTORY
96 ; ATTENTION: USE ON YOUR OWN RISK!
97 ; Please report bugs here: http://stefan.bertels.org/
98 !define Index_RemoveFilesAndSubDirs
'RemoveFilesAndSubDirs_${__LINE__}'
104 !insertmacro GetCleanDir
"${DIRECTORY}"
106 FindFirst $R0 $R1 "$R2*.*"
107 ${Index_RemoveFilesAndSubDirs}-loop:
108 StrCmp $R1 "" ${Index_RemoveFilesAndSubDirs}-done
109 StrCmp $R1 "." ${Index_RemoveFilesAndSubDirs}-next
110 StrCmp $R1 ".." ${Index_RemoveFilesAndSubDirs}-next
111 IfFileExists "$R2$R1\*.*" ${Index_RemoveFilesAndSubDirs}-directory
114 goto ${Index_RemoveFilesAndSubDirs}-next
115 ${Index_RemoveFilesAndSubDirs}-directory:
118 ${Index_RemoveFilesAndSubDirs}-next:
120 Goto ${Index_RemoveFilesAndSubDirs}-loop
121 ${Index_RemoveFilesAndSubDirs}-done:
127 !undef Index_RemoveFilesAndSubDirs
130 Function CheckVCRedist
133 ReadRegDword
$R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{7299052b-02a4-4627-81f2-1818da5d550d}" "Version"
135 ; if VS 2005+ redist SP1 not installed, install it
147 Section "openc2e" Main
149 ; Set Section properties
152 ; Set Section Files and Shortcuts
153 SetOutPath "$INSTDIR\"
155 IfFileExists "$INSTDIR\uninstall.exe" remold
159 MessageBox MB_YESNO 'An old version of openc2e is installed. Do you wish to$\rremove it before proceeding (recommended)?' IDYES remold1
162 ExecWait '"$INSTDIR\uninstall.exe" _?=$INSTDIR /S'
165 File "Release\openc2e.exe"
166 File "Release\SDL.dll"
167 ;File "Release\SDL_mixer.dll"
168 File "Release\SDL_net.dll"
169 File "Release\SDL_ttf.dll"
170 File "Release\zlib1.dll"
171 File "Release\libfreetype-6.dll"
172 File "Release\QtCore4.dll"
173 File "Release\QtGui4.dll"
174 File "Release\QtNetwork4.dll"
175 File "Release\alut.dll"
180 File "Release\oalinst.exe"
182 File "tools\braininavat\Brain-in-a-vat\Release\Brain-in-a-vat.exe"
183 File "tools\debugkit\DebugKit\release\DebugKit.exe"
184 File "gamefinder.exe"
186 CreateDirectory "$SMPROGRAMS\openc2e\Tools"
187 CreateDirectory "$SMPROGRAMS\openc2e\Games"
188 CreateDirectory "$SMPROGRAMS\openc2e"
189 CreateShortCut "$SMPROGRAMS\openc2e\Tools\Brain-in-a-Vat.lnk" "$INSTDIR\Brain-in-a-vat.exe"
190 CreateShortCut "$SMPROGRAMS\openc2e\Tools\Debug Kit.lnk" "$INSTDIR\DebugKit.exe"
191 CreateShortCut "$SMPROGRAMS\openc2e\Update Game Shortcuts.lnk" "$INSTDIR\gamefinder.exe"
192 CreateShortCut "$SMPROGRAMS\openc2e\Uninstall.lnk" "$INSTDIR\uninstall.exe"
196 Section -FinishSection
198 WriteRegStr HKLM "Software\${APPNAME}" "" "$INSTDIR"
199 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}"
200 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$INSTDIR\uninstall.exe"
201 WriteUninstaller "$INSTDIR\uninstall.exe"
203 ;Run the OpenAL installer silently
204 DetailPrint "Installing OpenAL sound library..."
205 ExecWait '"$INSTDIR\oalinst.exe" /s'
206 Delete "$INSTDIR\oalinst.exe"
208 DetailPrint "Checking for VC++ runtime libraries..."
211 StrCmp $R0 "1" foundvc
212 ReadRegDword
$R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{7299052b-02a4-4627-81f2-1818da5d550d}" "Version"
213 MessageBox MB_YESNO "Based on a cursory examination, you do not appear to have necessary VC++ runtime$\rlibraries installed. However, if you have Visual Studio 2005 installed, I could$\rbe wrong. Would you like to download and install these libraries? (2.5mb or so)$\rIf you do not know for sure, I'd go with 'Yes'." IDYES installvc
214 MessageBox MB_OK "Fair enough. If openc2e fails to run, make sure to acquire the Visual C++ 2005$\rruntime libraries from http://openc2e.ccdevnet.org/files/win32/vcredist_x86.exe"
218 DetailPrint "VC++ runtime libraries found (probably.)"
222 DetailPrint "Downloading VC++ runtime library redistributable..."
223 NSISdl::download
http://openc2e
.ccdevnet
.org
/files
/win32
/vcredist_x86
.exe
$INSTDIR\vcredist_x86
.exe
225 StrCmp $R0 "success" runvcinst
226 MessageBox MB_OK|
MB_ICONSTOP "The download of the VC++ runtime library installer failed: $R0 $\rSorry, but I guess you'll have to download it yourself. :($\r (http://openc2e.ccdevnet.org/files/win32/vcredist_x86.exe)"
229 ExecWait "$INSTDIR\vcredist_x86.exe"
230 Delete "$INSTDIR\vcredist_x86.exe"
233 ;Run the shortcut-maker
234 ;MessageBox MB_YESNO 'Look for installed Creatures games now? $\rIf you choose to wait, you can run "Update Game Shortcuts" from the start menu later.' IDYES run
237 DetailPrint "Searching for installed creatures games..."
238 ExecWait '"$INSTDIR\gamefinder.exe" /S'
242 ; Modern install component descriptions
243 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
244 !insertmacro MUI_DESCRIPTION_TEXT
${Main} ""
245 !insertmacro MUI_FUNCTION_DESCRIPTION_END
250 ; Remove from registry...
251 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
252 DeleteRegKey HKLM "SOFTWARE\${APPNAME}"
254 ; Delete Program Files
255 !insertmacro RemoveFilesAndSubDirs
"$INSTDIR\"
258 !insertmacro RemoveFilesAndSubDirs
"$SMPROGRAMS\${APPNAME}\"
260 ; Remove remaining directories
261 RMDir "$SMPROGRAMS\openc2e\Tools"
262 RMDir "$SMPROGRAMS\openc2e\Games"
263 RMDir "$SMPROGRAMS\openc2e"
271 !insertmacro MUI_LANGDLL_DISPLAY
275 BrandingText "http://openc2e.ccdevnet.org"