2006-12-26 11:59:34 -08:00
;NSIS Modern User Interface
2007-03-31 17:19:03 -07:00
;Warzone 2100 Resurrection Installer script
2006-12-26 11:59:34 -08:00
;Written by Dennis Schridde
;--------------------------------
;Include Modern UI
!include "MUI.nsh"
;--------------------------------
;General
;Name and file
Name "Warzone 2100"
2006-12-27 07:48:28 -08:00
OutFile "warzone2100-${VERSION}.exe"
2006-12-26 11:59:34 -08:00
;Default installation folder
InstallDir "$PROGRAMFILES\Warzone 2100"
;Get installation folder from registry if available
2007-03-31 17:19:03 -07:00
InstallDirRegKey HKLM "Software\Warzone 2100" ""
2006-12-26 11:59:34 -08:00
SetCompressor /FINAL /SOLID lzma
2006-12-27 07:26:44 -08:00
;--------------------------------
;Versioninfo
2006-12-27 07:48:28 -08:00
VIProductVersion "${VERSIONNUM}"
2006-12-27 07:26:44 -08:00
VIAddVersionKey "CompanyName" "Warzone Resurrection Project"
VIAddVersionKey "FileDescription" "Warzone 2100 Installer"
2006-12-27 07:48:28 -08:00
VIAddVersionKey "FileVersion" "${VERSION}"
2006-12-27 07:26:44 -08:00
VIAddVersionKey "InternalName" "Warzone 2100"
2007-02-06 05:20:05 -08:00
VIAddVersionKey "LegalCopyright" "Copyright © 2006 Warzone Resurrection Project"
2006-12-27 07:48:28 -08:00
VIAddVersionKey "OriginalFilename" "warzone2100-${VERSION}.exe"
2006-12-27 07:26:44 -08:00
VIAddVersionKey "ProductName" "Warzone 2100"
2006-12-27 07:48:28 -08:00
VIAddVersionKey "ProductVersion" "${VERSION}"
2006-12-27 07:26:44 -08:00
2006-12-26 11:59:34 -08:00
;--------------------------------
;Variables
Var MUI_TEMP
Var STARTMENU_FOLDER
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
; Settings for MUI_PAGE_LICENSE
!define MUI_LICENSEPAGE_RADIOBUTTONS
;Start Menu Folder Page Configuration (for MUI_PAGE_STARTMENU)
2007-03-31 17:19:03 -07:00
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
2006-12-26 11:59:34 -08:00
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Warzone 2100"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
; These indented statements modify settings for MUI_PAGE_FINISH
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_NOTCHECKED
!define MUI_FINISHPAGE_RUN_TEXT $(TEXT_RunWarzone)
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!define MUI_FINISHPAGE_SHOWREADME $INSTDIR\Readme.txt
;--------------------------------
;Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE $(MUILicense)
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English" # first language is the default language
!insertmacro MUI_LANGUAGE "German"
;--------------------------------
;License Language String
2006-12-27 13:44:46 -08:00
LicenseLangString MUILicense ${LANG_ENGLISH} "..\COPYING"
LicenseLangString MUILicense ${LANG_GERMAN} "..\COPYING"
2006-12-26 11:59:34 -08:00
;--------------------------------
;Reserve Files
2007-02-06 05:20:05 -08:00
2006-12-26 11:59:34 -08:00
;These files should be inserted before other files in the data block
;Keep these lines before any File command
;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)
2007-02-06 05:20:05 -08:00
2006-12-26 11:59:34 -08:00
!insertmacro MUI_RESERVEFILE_LANGDLL
;--------------------------------
;Installer Sections
Section $(TEXT_SecBase) SecBase
SectionIn RO
SetOutPath "$INSTDIR"
;ADD YOUR OWN FILES HERE...
2006-12-27 06:57:41 -08:00
; Main executable
2006-12-27 13:44:46 -08:00
File "..\src\warzone2100.exe"
2006-12-26 11:59:34 -08:00
2006-12-27 06:57:41 -08:00
; Required runtime libs
2006-12-27 07:48:28 -08:00
File "${LIBDIR}\OpenAL32.dll"
File "${LIBDIR}\wrap_oal.dll"
2006-12-27 06:57:41 -08:00
2007-03-31 11:04:43 -07:00
; Windows dbghelp library
File "${LIBDIR}\dbghelp.dll.license.txt"
File "${LIBDIR}\dbghelp.dll"
2006-12-27 06:57:41 -08:00
; Data files
2006-12-27 13:44:46 -08:00
File "..\data\mp.wz"
File "..\data\warzone.wz"
2006-12-27 06:57:41 -08:00
; Information/documentation files
2007-02-15 07:42:47 -08:00
File "/oname=ChangeLog.txt" "..\ChangeLog"
File "/oname=Authors.txt" "..\AUTHORS"
2006-12-27 13:44:46 -08:00
File "/oname=License.txt" "..\COPYING"
File "/oname=Readme.txt" "..\README"
2006-12-26 11:59:34 -08:00
;Store installation folder
2007-03-31 17:19:03 -07:00
WriteRegStr HKLM "Software\Warzone 2100" "" $INSTDIR
2006-12-26 11:59:34 -08:00
2006-12-27 06:57:41 -08:00
; Write the Windows-uninstall keys
2007-03-31 17:19:03 -07:00
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Warzone 2100" "DisplayName" "Warzone 2100"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Warzone 2100" "DisplayVersion" "${VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Warzone 2100" "DisplayIcon" "$INSTDIR\warzone2100.exe,0"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Warzone 2100" "Publisher" "Warzone Resurrection Project"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Warzone 2100" "URLInfoAbout" "http://wz2100.net/"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Warzone 2100" "InstallLocation" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Warzone 2100" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Warzone 2100" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Warzone 2100" "NoRepair" 1
2006-12-27 06:57:41 -08:00
2006-12-26 11:59:34 -08:00
;Create uninstaller
2006-12-27 06:57:41 -08:00
WriteUninstaller "$INSTDIR\uninstall.exe"
2006-12-26 11:59:34 -08:00
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
2007-02-06 05:20:05 -08:00
2006-12-26 11:59:34 -08:00
;Create shortcuts
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
2006-12-27 06:57:41 -08:00
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\uninstall.exe"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Warzone 2100.lnk" "$INSTDIR\warzone2100.exe"
2007-02-06 05:20:05 -08:00
2006-12-26 11:59:34 -08:00
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
2007-03-31 11:04:43 -07:00
SectionGroup /e $(TEXT_SecMods) secMods
2006-12-26 11:59:34 -08:00
Section $(TEXT_SecGrimMod) SecGrimMod
SetOutPath "$INSTDIR\mods\global"
2006-12-27 13:44:46 -08:00
File "..\data\grim.wz"
2006-12-26 11:59:34 -08:00
SetOutPath "$INSTDIR"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Warzone 2100 - Grim's GFX.lnk" "$INSTDIR\warzone2100.exe" "--mod grim.wz"
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
SectionGroupEnd
;--------------------------------
;Installer Functions
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
Function LaunchLink
ExecShell "" "$SMPROGRAMS\$STARTMENU_FOLDER\Warzone 2100.lnk"
FunctionEnd
;--------------------------------
;Descriptions
;Language strings
LangString TEXT_SecBase ${LANG_ENGLISH} "Standard installation"
LangString DESC_SecBase ${LANG_ENGLISH} "Standard installation."
LangString TEXT_SecMods ${LANG_ENGLISH} "Mods"
LangString DESC_SecMods ${LANG_ENGLISH} "Various mods."
2007-02-14 08:23:24 -08:00
LangString TEXT_SecGrimMod ${LANG_ENGLISH} "Grim's graphics-update"
2007-02-14 11:11:56 -08:00
LangString DESC_SecGrimMod ${LANG_ENGLISH} "Grim's graphics-update. Contains more detailed textures for campaign 1 as well as additional texture- and model-updates. Copyright (C) 2005-2007 Grim Moroe, Use is only permited for Warzone 2100."
2006-12-26 11:59:34 -08:00
LangString TEXT_SecBase ${LANG_GERMAN} "Standart installation"
LangString DESC_SecBase ${LANG_GERMAN} "Standart installation."
LangString TEXT_SecMods ${LANG_GERMAN} "Mods"
LangString DESC_SecMods ${LANG_GERMAN} "Verschiedene Mods."
2007-02-14 08:23:24 -08:00
LangString TEXT_SecGrimMod ${LANG_GERMAN} "Grims Grafik-Update"
LangString DESC_SecGrimMod ${LANG_GERMAN} "Grims Grafik-Update. Enthält detailliertere Texturen für Kampagne 1 sowie einige andere Textur- und Model-Updates. Copyright (C) 2005-2007 Grim Moroe, Verwendung nur für Warzone 2100 gestattet."
2006-12-26 11:59:34 -08:00
LangString TEXT_RunWarzone ${LANG_ENGLISH} "Run Warzone 2100"
LangString TEXT_RunWarzone ${LANG_GERMAN} "Starte Warzone 2100"
;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecBase} $(DESC_SecBase)
!insertmacro MUI_DESCRIPTION_TEXT ${SecMods} $(DESC_SecMods)
!insertmacro MUI_DESCRIPTION_TEXT ${SecGrimMod} $(DESC_SecGrimMod)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
;Uninstaller Section
Section "Uninstall"
;ADD YOUR OWN FILES HERE...
Delete "$INSTDIR\warzone2100.exe"
2007-03-31 11:04:43 -07:00
2006-12-26 11:59:34 -08:00
Delete "$INSTDIR\OpenAL32.dll"
Delete "$INSTDIR\wrap_oal.dll"
2007-03-31 11:04:43 -07:00
Delete "$INSTDIR\dbghelp.dll.license.txt"
Delete "$INSTDIR\dbghelp.dll"
2006-12-26 11:59:34 -08:00
Delete "$INSTDIR\warzone.wz"
Delete "$INSTDIR\mp.wz"
Delete "$INSTDIR\Readme.txt"
Delete "$INSTDIR\License.txt"
2007-04-02 06:18:38 -07:00
Delete "$INSTDIR\Authors.txt"
Delete "$INSTDIR\ChangeLog.txt"
2006-12-26 11:59:34 -08:00
2006-12-27 06:57:41 -08:00
Delete "$INSTDIR\uninstall.exe"
2006-12-26 11:59:34 -08:00
Delete "$INSTDIR\mods\global\grim.wz"
RMDir "$INSTDIR\mods\global"
RMDir "$INSTDIR\mods"
RMDir "$INSTDIR"
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
2007-02-06 05:20:05 -08:00
2006-12-26 11:59:34 -08:00
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\Warzone 2100.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\Warzone 2100 - Grim's GFX.lnk"
2007-02-06 05:20:05 -08:00
2006-12-26 11:59:34 -08:00
;Delete empty start menu parent diretories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
2007-02-06 05:20:05 -08:00
2006-12-26 11:59:34 -08:00
startMenuDeleteLoop:
ClearErrors
RMDir $MUI_TEMP
GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
2007-02-06 05:20:05 -08:00
2006-12-26 11:59:34 -08:00
IfErrors startMenuDeleteLoopDone
2007-02-06 05:20:05 -08:00
2006-12-26 11:59:34 -08:00
StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
startMenuDeleteLoopDone:
2007-03-31 17:19:03 -07:00
DeleteRegValue HKLM "Software\Warzone 2100" "Start Menu Folder"
DeleteRegValue HKLM "Software\Warzone 2100" ""
DeleteRegKey /ifempty HKLM "Software\Warzone 2100"
2006-12-26 11:59:34 -08:00
2006-12-27 06:57:41 -08:00
; Unregister with Windows' uninstall system
2007-03-31 17:19:03 -07:00
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Warzone 2100"
2006-12-27 06:57:41 -08:00
2006-12-26 11:59:34 -08:00
SectionEnd
;--------------------------------
;Uninstaller Functions
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
2007-02-06 05:20:05 -08:00
2006-12-26 11:59:34 -08:00
FunctionEnd