From a1d1ee89ed9909fa979b6cb994fe9c8786a3466e Mon Sep 17 00:00:00 2001 From: rubidium Date: Mon, 14 Dec 2009 18:20:42 +0000 Subject: [PATCH] (svn r18496) -Codechange: some changes to the installer to make it more usable, easier to maintain and more up-to-date --- os/windows/installer/install.nsi | 106 ++++++++++++++++--------- os/windows/installer/version_win32.txt | 2 +- os/windows/installer/version_win64.txt | 2 +- os/windows/installer/version_win9x.txt | 2 +- 4 files changed, 72 insertions(+), 40 deletions(-) diff --git a/os/windows/installer/install.nsi b/os/windows/installer/install.nsi index 423e1a9446..98ec89cc5a 100644 --- a/os/windows/installer/install.nsi +++ b/os/windows/installer/install.nsi @@ -1,7 +1,14 @@ +# Version numbers to update +!define APPV_MAJOR 0 +!define APPV_MINOR 8 +!define APPV_MAINT 0 +!define APPV_BUILD 0 +!define APPV_EXTRA "" + !define APPNAME "OpenTTD" ; Define application name -!define APPVERSION "0.8.0" ; Define application version -!define APPVERSIONINTERNAL "0.8.0.0" ; Define application version in X.X.X.X -!define INSTALLERVERSION 71 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!! +!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" @@ -9,6 +16,7 @@ !define OPENGFX_BASE_VERSION "0.7.0" !define OPENSFX_BASE_VERSION "0.8.0" +!define NOSOUND_BASE_VERSION "0.8.0" !define MUI_ICON "..\..\..\media\openttd.ico" !define MUI_UNICON "..\..\..\media\openttd.ico" @@ -22,7 +30,7 @@ SetCompressor LZMA ; Version Info Var AddWinPrePopulate VIProductVersion "${APPVERSIONINTERNAL}" -VIAddVersionKey "ProductName" "OpenTTD Installer ${APPBITS} bits version ${EXTRA_VERSION}" +VIAddVersionKey "ProductName" "OpenTTD Installer ${APPBITS} bits for Windows ${EXTRA_VERSION}" VIAddVersionKey "Comments" "Installs ${APPNAMEANDVERSION}" VIAddVersionKey "CompanyName" "OpenTTD Developers" VIAddVersionKey "FileDescription" "Installs ${APPNAMEANDVERSION}" @@ -31,7 +39,7 @@ VIAddVersionKey "InternalName" "InstOpenTTD-${APPARCH}" VIAddVersionKey "FileVersion" "${APPVERSION}-${APPARCH}" VIAddVersionKey "LegalCopyright" " " ; Main Install settings -Name "${APPNAMEANDVERSION} ${APPBITS} bits version ${EXTRA_VERSION}" +Name "${APPNAMEANDVERSION} ${APPBITS} bits for Windows ${EXTRA_VERSION}" ; NOTE: Keep trailing backslash! InstallDirRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Install Folder" @@ -45,17 +53,15 @@ Var SHORTCUTS Var CDDRIVE ; Modern interface settings -!include "MUI.nsh" +!include "MUI2.nsh" +!include "InstallOptions.nsh" !define MUI_ABORTWARNING !define MUI_WELCOMEPAGE_TITLE_3LINES !insertmacro MUI_PAGE_WELCOME - -!define MUI_LICENSEPAGE_RADIOBUTTONS -!insertmacro MUI_DEFAULT MUI_LICENSEPAGE_RADIOBUTTONS_TEXT_ACCEPT "I &accept this agreement" -!insertmacro MUI_DEFAULT MUI_LICENSEPAGE_RADIOBUTTONS_TEXT_DECLINE "I &do not accept this agreement" !insertmacro MUI_PAGE_LICENSE "..\..\..\COPYING" +!define MUI_COMPONENTSPAGE_SMALLDESC !insertmacro MUI_PAGE_COMPONENTS ;--------------------------------- @@ -104,7 +110,7 @@ Section "!OpenTTD" Section1 ; Copy language files SetOutPath "$INSTDIR\lang\" - File ${PATH_ROOT}bin\lang\*.lng + File ${PATH_ROOT}bin\lang\english.lng ; Copy AI files SetOutPath "$INSTDIR\ai\" @@ -166,9 +172,20 @@ Section "!OpenTTD" Section1 !insertmacro MUI_STARTMENU_WRITE_END SectionEnd +;-------------------------------------------------------------- +; OpenTTD translation install section. Copies only translations +Section "OpenTTD translations" Section6 + ; Overwrite files by default, but don't complain on failure + SetOverwrite try + + ; Copy language files + SetOutPath "$INSTDIR\lang\" + File ${PATH_ROOT}bin\lang\*.lng +SectionEnd + ;---------------------------------------------------------------------------------- ; OpenGFX files install section. Downloads OpenGFX and installs it -Section "Download free Graphics" Section3 +Section "Download OpenGFX (free graphics set)" Section3 SetOverwrite try NSISdl::download "http://binaries.openttd.org/installer/opengfx-${OPENGFX_BASE_VERSION}.tar.7z" "$INSTDIR\data\opengfx.tar.7z" @@ -189,7 +206,7 @@ SectionEnd ;---------------------------------------------------------------------------------- ; OpenSFX files install section. Downloads OpenSFX and installs it -Section "Download free Sounds" Section4 +Section "Download OpenSFX (free sound set)" Section4 SetOverwrite try NSISdl::download "http://binaries.openttd.org/installer/opensfx-${OPENSFX_BASE_VERSION}.tar.7z" "$INSTDIR\data\opensfx.tar.7z" @@ -208,9 +225,30 @@ Done: SectionEnd +;---------------------------------------------------------------------------------- +; NoSound files install section. Downloads NoSound and installs it +Section "Download NoSound (free sound set)" Section5 + SetOverwrite try + + NSISdl::download "http://binaries.openttd.org/installer/nosound-${NOSOUND_BASE_VERSION}.tar.7z" "$INSTDIR\data\nosound.tar.7z" + Pop $R0 ;Get the return value + StrCmp $R0 "success" +3 + MessageBox MB_OK "Downloading of NoSound failed" + Goto Done + + ; Let's extract the files + SetOutPath "$INSTDIR\data\" + NSIS7z::Extract "$INSTDIR\data\nosound.tar.7z" + + Delete "$INSTDIR\data\nosound.tar.7z" + SetOutPath "$INSTDIR\" +Done: + +SectionEnd + ;---------------------------------------------------------------------------------- ; TTDLX files install section. Copies all needed TTDLX files from CD or install dir -Section /o "Copy Game Graphics" Section2 +Section /o "Copy data from Transport Tycoon Deluxe CD-ROM" Section2 SetOverwrite try ; Let's copy the files with size approximation SetOutPath "$INSTDIR\gm" @@ -240,9 +278,11 @@ SectionEnd ; Modern install component descriptions !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN - !insertmacro MUI_DESCRIPTION_TEXT ${Section1} "OpenTTD is a fully functional clone of Transport Tycoon Deluxe and is very playable. You need at least one of the game graphics and sound sets installed" - !insertmacro MUI_DESCRIPTION_TEXT ${Section3} "Download the free OpenGFX game graphics. This download is about 3 MiB." - !insertmacro MUI_DESCRIPTION_TEXT ${Section4} "Download the free OpenSFX game sounds. This download is about 7 MiB." + !insertmacro MUI_DESCRIPTION_TEXT ${Section1} "Minimal OpenTTD installation in English. You need at least one of the game graphics and sound sets installed." + !insertmacro MUI_DESCRIPTION_TEXT ${Section6} "Translations of OpenTTD." + !insertmacro MUI_DESCRIPTION_TEXT ${Section3} "Download the free OpenGFX game graphics set. This download is about 3 MiB." + !insertmacro MUI_DESCRIPTION_TEXT ${Section4} "Download the free OpenSFX game sound set. This download is about 7 MiB." + !insertmacro MUI_DESCRIPTION_TEXT ${Section5} "Download the free NoSound game sound set. You will not hear anything with this. This download is about 7 KiB." !insertmacro MUI_DESCRIPTION_TEXT ${Section2} "Copies the game graphics and sounds from the Transport Tycoon Deluxe CD." !insertmacro MUI_FUNCTION_DESCRIPTION_END @@ -344,8 +384,9 @@ Section "Uninstall" Delete "$INSTDIR\gm\*.gm" ; Downloaded OpenGFX/OpenSFX - Delete "$INSTDIR\data\opengfx.tar" - Delete "$INSTDIR\data\opensfx.tar" + Delete "$INSTDIR\data\opengfx-*.tar" + Delete "$INSTDIR\data\opensfx-*.tar" + Delete "$INSTDIR\data\nosound-*.tar" ; Language files Delete "$INSTDIR\lang\*.lng" @@ -377,7 +418,7 @@ NoAbort: GetTempFileName $R0 !insertmacro MUI_HEADER_TEXT "Locate TTD" "Setup needs the location of Transport Tycoon Deluxe in order to continue." - !insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "CDFinder.ini" "CDFinder" + !insertmacro INSTALLOPTIONS_EXTRACT_AS "CDFinder.ini" "CDFinder" ClearErrors ; Now, let's populate $CDDRIVE @@ -392,18 +433,18 @@ NoTTD: StrCpy $AddWinPrePopulate "Setup couldn't find TTD. Please enter the path where the graphics files from TTD are stored and press Next to continue." TruFinish: ClearErrors - !insertmacro MUI_INSTALLOPTIONS_WRITE "CDFinder" "Field 2" "State" $CDDRIVE ; TTDLX path - !insertmacro MUI_INSTALLOPTIONS_WRITE "CDFinder" "Field 3" "Text" $AddWinPrePopulate ; Caption + !insertmacro INSTALLOPTIONS_WRITE "CDFinder" "Field 2" "State" $CDDRIVE ; TTDLX path + !insertmacro INSTALLOPTIONS_WRITE "CDFinder" "Field 3" "Text" $AddWinPrePopulate ; Caption DoneCD: ; Initialize the dialog *AFTER* we've changed the text otherwise we won't see the changes - !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "CDFinder" - !insertmacro MUI_INSTALLOPTIONS_SHOW + !insertmacro INSTALLOPTIONS_INITDIALOG "CDFinder" + !insertmacro INSTALLOPTIONS_SHOW FunctionEnd ;---------------------------------------------------------------- ; Custom page function when 'next' is selected for the TTDLX path Function SelectCDExit - !insertmacro MUI_INSTALLOPTIONS_READ $CDDRIVE "CDFinder" "Field 2" "State" + !insertmacro INSTALLOPTIONS_READ $CDDRIVE "CDFinder" "Field 2" "State" ; If trg1r.grf does not exist at the path, retry with DOS version IfFileExists $CDDRIVE\trg1r.grf "" DosCD IfFileExists $CDDRIVE\trgir.grf "" NoCD @@ -418,17 +459,6 @@ NoCD: hasCD: FunctionEnd -;---------------------------------------------------------------------------------- -; Disable the "Back" button on finish page if the installer is run on Win9x systems -Function DisableBack - Call GetWindowsVersion - Pop $R0 - StrCmp $R0 "win9x" 0 WinNT - !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "Settings" "BackEnabled" "0" -WinNT: - ClearErrors -FunctionEnd - ;------------------------------------------------------------------------------- ; Determine windows version, returns "win9x" if Win9x/Me or "winnt" on the stack Function GetWindowsVersion @@ -493,7 +523,8 @@ Function .onInit StrCpy $SHORTCUTS "OpenTTD" SectionSetSize ${Section3} 6144 - SectionSetSize ${Section4} 10240 + SectionSetSize ${Section4} 13312 + SectionSetSize ${Section5} 30 SectionSetFlags 0 17 @@ -518,6 +549,7 @@ WelcomeToSetup: SectionSetFlags ${Section2} 0x80 ; set bit 7 SectionSetFlags ${Section3} 0x80 ; set bit 7 SectionSetFlags ${Section4} 0x80 ; set bit 7 + SectionSetFlags ${Section5} 0x80 ; set bit 7 Goto FinishCallback VersionsAreEqual: diff --git a/os/windows/installer/version_win32.txt b/os/windows/installer/version_win32.txt index ed7f77e3df..546512091b 100644 --- a/os/windows/installer/version_win32.txt +++ b/os/windows/installer/version_win32.txt @@ -1,5 +1,5 @@ !define APPBITS 32 ; Define number of bits for the architecture -!define EXTRA_VERSION "for Windows 2000, XP and Vista" +!define EXTRA_VERSION "2000, XP, Vista and 7" !define APPARCH "win32" ; Define the application architecture !define BINARY_DIR "${PATH_ROOT}objs\win32\Release" InstallDir "$PROGRAMFILES32\OpenTTD\" diff --git a/os/windows/installer/version_win64.txt b/os/windows/installer/version_win64.txt index 3c84447b60..492a75894f 100644 --- a/os/windows/installer/version_win64.txt +++ b/os/windows/installer/version_win64.txt @@ -1,5 +1,5 @@ !define APPBITS 64 ; Define number of bits for the architecture -!define EXTRA_VERSION "for Windows XP and Vista" +!define EXTRA_VERSION "XP, Vista and 7" !define APPARCH "win64" ; Define the application architecture !define BINARY_DIR "${PATH_ROOT}objs\x64\Release" InstallDir "$PROGRAMFILES64\OpenTTD\" diff --git a/os/windows/installer/version_win9x.txt b/os/windows/installer/version_win9x.txt index be20888e59..1ab32b9cf3 100644 --- a/os/windows/installer/version_win9x.txt +++ b/os/windows/installer/version_win9x.txt @@ -1,5 +1,5 @@ !define APPBITS 32 ; Define number of bits for the architecture -!define EXTRA_VERSION "for Windows 95, 98 and ME" +!define EXTRA_VERSION "95, 98 and ME" !define APPARCH "win9x" ; Define the application architecture !define BINARY_DIR "${PATH_ROOT}bin" InstallDir "$PROGRAMFILES32\OpenTTD\"