# Version numbers to update
!define APPV_MAJOR 1
!define APPV_MINOR 2
!define APPV_MAINT 0
!define APPV_BUILD 0
!define APPV_EXTRA "-alpha"
!define APPNAME "OpenTTD" ; Define application name
!define APPVERSION "${APPV_MAJOR}.${APPV_MINOR}.${APPV_MAINT}${APPV_EXTRA}" ; Define application version
!define APPVERSIONINTERNAL "${APPV_MAJOR}.${APPV_MINOR}.${APPV_MAINT}.${APPV_BUILD}" ; Define application version in X.X.X.X
!define INSTALLERVERSION ${APPV_MAJOR}${APPV_MINOR}${APPV_MAINT}${APPV_BUILD}
!include ${VERSION_INCLUDE}
!define APPURLLINK "http://www.openttd.org"
!define APPNAMEANDVERSION "${APPNAME} ${APPVERSION}"
!define OPENGFX_BASE_VERSION "0.7.0"
!define OPENSFX_BASE_VERSION "0.8.0"
!define OPENMSX_BASE_VERSION "1.0.0"
!define MUI_ICON "..\..\..\media\openttd.ico"
!define MUI_UNICON "..\..\..\media\openttd.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP "welcome.bmp"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "top.bmp"
BrandingText "OpenTTD Installer"
SetCompressor LZMA
; Version Info
Var AddWinPrePopulate
VIProductVersion "${APPVERSIONINTERNAL}"
VIAddVersionKey "ProductName" "OpenTTD ${APPBITS}-bit Installer for Windows ${EXTRA_VERSION}"
VIAddVersionKey "Comments" "Installs ${APPNAMEANDVERSION}"
VIAddVersionKey "CompanyName" "OpenTTD Developers"
VIAddVersionKey "FileDescription" "Installs ${APPNAMEANDVERSION}"
VIAddVersionKey "ProductVersion" "${APPVERSION}"
VIAddVersionKey "InternalName" "InstOpenTTD-${APPARCH}"
VIAddVersionKey "FileVersion" "${APPVERSION}-${APPARCH}"
VIAddVersionKey "LegalCopyright" " "
; Main Install settings
Name "${APPNAMEANDVERSION} ${APPBITS}-bit for Windows ${EXTRA_VERSION}"
; NOTE: Keep trailing backslash!
InstallDirRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Install Folder"
OutFile "openttd-${APPVERSION}-${APPARCH}.exe"
CRCCheck force
ShowInstDetails show
ShowUninstDetails show
RequestExecutionLevel admin
Var SHORTCUTS
Var CDDRIVE
; Modern interface settings
!include "MUI2.nsh"
!include "InstallOptions.nsh"
!include "WinVer.nsh"
!define MUI_ABORTWARNING
!define MUI_WELCOMEPAGE_TITLE_3LINES
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "..\..\..\COPYING"
!define MUI_COMPONENTSPAGE_SMALLDESC
!insertmacro MUI_PAGE_COMPONENTS
;---------------------------------
; Custom page for finding TTDLX CD
Page custom SelectCDEnter SelectCDExit ": TTD folder"
!insertmacro MUI_PAGE_DIRECTORY
;Start Menu Folder Page Configuration
!define MUI_STARTMENUPAGE_DEFAULTFOLDER $SHORTCUTS
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKEY_LOCAL_MACHINE"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Shortcut Folder"
!insertmacro MUI_PAGE_STARTMENU "OpenTTD" $SHORTCUTS
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_TITLE_3LINES
!define MUI_FINISHPAGE_RUN_TEXT "Run ${APPNAMEANDVERSION} now!"
!define MUI_FINISHPAGE_RUN "$INSTDIR\openttd.exe"
!define MUI_FINISHPAGE_LINK "Visit the OpenTTD site for the latest news, FAQs and downloads"
!define MUI_FINISHPAGE_LINK "Visit the OpenTTD site for more information"
!define MUI_FINISHPAGE_LINK_LOCATION "${APPURLLINK}"
!define MUI_FINISHPAGE_NOREBOOTSUPPORT
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\readme.txt"
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!define MUI_WELCOMEFINISHPAGE_CUSTOMFUNCTION_INIT DisableBack
!insertmacro MUI_PAGE_FINISH
!define MUI_PAGE_HEADER_TEXT "Uninstall ${APPNAMEANDVERSION}"
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
; Set languages (first is default language)
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_RESERVEFILE_LANGDLL
;--------------------------------------------------------------
; (Core) OpenTTD install section. Copies all internal game data
Section "!OpenTTD" Section1
; Make sure to be upgraded OpenTTD is not running
Call CheckOpenTTDRunning
; Overwrite files by default, but don't complain on failure
SetOverwrite try
SetShellVarContext all
; Define root variable relative to installer
!define PATH_ROOT "..\..\..\"
; Copy language files
SetOutPath "$INSTDIR\lang\"
File ${PATH_ROOT}bin\lang\english.lng
; Copy AI files
SetOutPath "$INSTDIR\ai\"
File ${PATH_ROOT}bin\ai\compat_*.nut
; Copy data files
SetOutPath "$INSTDIR\baseset\"
File ${PATH_ROOT}bin\baseset\*.grf
File ${PATH_ROOT}bin\baseset\*.obg
File ${PATH_ROOT}bin\baseset\*.obm
File ${PATH_ROOT}bin\baseset\*.obs
File ${PATH_ROOT}bin\baseset\opntitle.dat
; Copy the scripts
SetOutPath "$INSTDIR\scripts\"
File ${PATH_ROOT}bin\scripts\*.*
Push "$INSTDIR\scripts\readme.txt"
Call unix2dos
; Copy some documention files
SetOutPath "$INSTDIR\docs\"
File ${PATH_ROOT}docs\multiplayer.txt
Push "$INSTDIR\docs\multiplayer.txt"
File ${PATH_ROOT}docs\32bpp.txt
Push "$INSTDIR\docs\32bpp.txt"
; Copy the rest of the stuff
SetOutPath "$INSTDIR\"
; Copy text files
File ${PATH_ROOT}changelog.txt
Push "$INSTDIR\changelog.txt"
File ${PATH_ROOT}COPYING
Push "$INSTDIR\COPYING"
File ${PATH_ROOT}readme.txt
Push "$INSTDIR\readme.txt"
File ${PATH_ROOT}known-bugs.txt
Push "$INSTDIR\known-bugs.txt"
; Copy executable
File /oname=openttd.exe ${BINARY_DIR}\openttd.exe
; Delete old files from the main dir. they are now placed in baseset/ and lang/
Delete "$INSTDIR\*.lng"
Delete "$INSTDIR\*.grf"
Delete "$INSTDIR\sample.cat"
Delete "$INSTDIR\ttd.exe"
Delete "$INSTDIR\data\opntitle.dat"
Delete "$INSTDIR\data\2ccmap.grf"
Delete "$INSTDIR\data\airports.grf"
Delete "$INSTDIR\data\autorail.grf"
Delete "$INSTDIR\data\canalsw.grf"
Delete "$INSTDIR\data\dosdummy.grf"
Delete "$INSTDIR\data\elrailsw.grf"
Delete "$INSTDIR\data\nsignalsw.grf"
Delete "$INSTDIR\data\openttd.grf"
Delete "$INSTDIR\data\roadstops.grf"
Status change: