1
0
Fork 0

(svn r8916) [0.5] -Codechange (win32): Update the installer, add proper indentation, use MUI throughout and add a custom page about UNICODE and MSLU (remove some obsolete files)

release/0.5
Darkvater 2007-02-27 15:29:11 +00:00
parent 274f841c61
commit 5bfdc6e75a
5 changed files with 220 additions and 145 deletions

View File

@ -1,38 +0,0 @@
; Ini file generated by the HM NIS Edit IO designer.
[Settings]
NumFields=4
[Field 1]
Type=Button
Text=Instant Install
Flags=NOTIFY
Left=0
Right=58
Top=0
Bottom=15
[Field 2]
Type=Button
Text=Advanced Install
Flags=NOTIFY
Left=0
Right=58
Top=19
Bottom=35
[Field 3]
Type=Label
Text=Install OpenTTD instantly and quickly, no questions asked
Left=62
Right=245
Top=3
Bottom=11
[Field 4]
Type=Label
Text=In case you want to change location, options, Start Menu location, etc
Left=62
Right=283
Top=23
Bottom=31

View File

@ -1,14 +0,0 @@
TTD to OpenTTD
Transition Guide
This guide gives you pointers in making the transition from TTD to OpenTTD. Once OpenTTD matures more, this guide will grow. For now, here are the major differences that Ive seen.
* Being able to resize the window so that "full-screen" can also show so much more of the land
* Command Line switches to make things easier
* Generate Random Land in the scenario editor also builds small towns, forests, and industries
* A configuration screen that lets you turn on / off TTD Patch features
Some day, OpenTTD will contain the features of TTD Patch.
Created by RaggieSoft TallwoodBand@cox.net
Guide Version: 0.1.1
Supports OpenTTD Version: 0.2.1
Send your ideas for this document to my email address. I also maintain an accunt with tt-forums.net. It's RaggieSoft.

View File

@ -5,22 +5,22 @@ NumFields=3
[Field 1] [Field 1]
Type=Groupbox Type=Groupbox
Text=Transport Tycoon Deluxe Installation location Text=Transport Tycoon Deluxe Installation location
Left=0 Left=6
Right=288 Right=294
Top=68 Top=68
Bottom=100 Bottom=100
[Field 2] [Field 2]
Type=DirRequest Type=DirRequest
Left=4 Left=10
Right=282 Right=290
Top=80 Top=80
Bottom=92 Bottom=92
[Field 3] [Field 3]
Type=Label Type=Label
Left=13 Left=17
Right=278 Right=282
Top=6 Top=6
Bottom=64 Bottom=64

View File

@ -1,8 +1,11 @@
; Define your application name !define APPNAME "OpenTTD" ; Define application name
!define APPNAME "OpenTTD" !define APPVERSION "0.5.0" ; Define application version
!define APPNAMEANDVERSION "OpenTTD 0.5.0.0" !define INSTALLERVERSION 28 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!!
!define APPVERSION "0.5.0.0"
!define INSTALLERVERSION 28 ;NEED TO UPDATE THIS FOR EVERY RELEASE!!! !define APPURLLINK "http://www.openttd.org"
!define APPNAMEANDVERSION "${APPNAME} ${APPVERSION}"
!define APPVERSIONINTERNAL "${APPVERSION}.0" ; Needs to be of the format X.X.X.X
!define MUI_ICON "..\..\..\openttd.ico" !define MUI_ICON "..\..\..\openttd.ico"
!define MUI_UNICON "..\..\..\openttd.ico" !define MUI_UNICON "..\..\..\openttd.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP "welcome.bmp" !define MUI_WELCOMEFINISHPAGE_BITMAP "welcome.bmp"
@ -14,7 +17,7 @@ SetCompressor LZMA
; Version Info ; Version Info
Var AddWinPrePopulate Var AddWinPrePopulate
VIProductVersion "${APPVERSION}" VIProductVersion "${APPVERSIONINTERNAL}"
VIAddVersionKey "ProductName" "OpenTTD Installer" VIAddVersionKey "ProductName" "OpenTTD Installer"
VIAddVersionKey "Comments" "Installs ${APPNAMEANDVERSION}" VIAddVersionKey "Comments" "Installs ${APPNAMEANDVERSION}"
VIAddVersionKey "CompanyName" "OpenTTD Developers" VIAddVersionKey "CompanyName" "OpenTTD Developers"
@ -44,18 +47,17 @@ Var CDDRIVE
!define MUI_ABORTWARNING !define MUI_ABORTWARNING
!insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_WELCOME
LicenseForceSelection radiobuttons "I &accept this Agreement" "I &do not accept this agreement"
!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" !insertmacro MUI_PAGE_LICENSE "..\..\..\COPYING"
;--------------------------------
; Rest of pages
!insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_COMPONENTS
;---------------------------------
;-------------------------------- ; Custom page for finding TTDLX CD
; New custom page for finding CD Page custom SelectCDEnter SelectCDExit ": TTD folder"
Page custom SelectCD SelectCD2 ": TTD folder"
!insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_DIRECTORY
@ -69,9 +71,13 @@ Page custom SelectCD SelectCD2 ": TTD folder"
!insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_RUN "$INSTDIR\OpenTTD.exe" ;-----------------------------------------------------
; New custom page to show UNICODE and MSLU information
Page custom ShowWarningsPage
!define MUI_FINISHPAGE_RUN "$INSTDIR\openttd.exe"
!define MUI_FINISHPAGE_LINK "Visit OpenTTD's homepage" !define MUI_FINISHPAGE_LINK "Visit OpenTTD's homepage"
!define MUI_FINISHPAGE_LINK_LOCATION "http://www.openttd.org/" !define MUI_FINISHPAGE_LINK_LOCATION "${APPURLLINK}"
!define MUI_FINISHPAGE_NOREBOOTSUPPORT !define MUI_FINISHPAGE_NOREBOOTSUPPORT
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\readme.txt" !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\readme.txt"
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
@ -84,64 +90,63 @@ Page custom SelectCD SelectCD2 ": TTD folder"
!insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_RESERVEFILE_LANGDLL !insertmacro MUI_RESERVEFILE_LANGDLL
;-------------------------------- ;--------------------------------------------------------------
; Sections ; (Core) OpenTTD install section. Copies all internal game data
Section "!OpenTTD" Section1 Section "!OpenTTD" Section1
; Overwrite files by default, but don't complain on failure
; Set Section properties
SetOverwrite try SetOverwrite try
; Make savegame folder ; Make savegame folder
SetOutPath "$INSTDIR\save" SetOutPath "$INSTDIR\save"
; define root variable relative to installer ; Define root variable relative to installer
!define PATH_ROOT "..\..\..\" !define PATH_ROOT "..\..\..\"
; Copy language files ; Copy language files
SetOutPath "$INSTDIR\lang\" SetOutPath "$INSTDIR\lang\"
File ${PATH_ROOT}lang\*.lng File ${PATH_ROOT}lang\*.lng
File ${PATH_ROOT}lang\english.txt File ${PATH_ROOT}lang\english.txt
; Copy data files ; Copy data files
SetOutPath "$INSTDIR\data\" SetOutPath "$INSTDIR\data\"
File ${PATH_ROOT}data\*.grf File ${PATH_ROOT}data\*.grf
File ${PATH_ROOT}data\opntitle.dat File ${PATH_ROOT}data\opntitle.dat
; Copy scenario files ; Copy scenario files (don't choke if they don't exist)
SetOutPath "$INSTDIR\scenario\" SetOutPath "$INSTDIR\scenario\"
File ${PATH_ROOT}scenario\*.scn File /nonfatal ${PATH_ROOT}scenario\*.scn
; Copy the rest of the stuff ; Copy the rest of the stuff
SetOutPath "$INSTDIR\" SetOutPath "$INSTDIR\"
;Copy text files ; Copy text files
File ${PATH_ROOT}changelog.txt File ${PATH_ROOT}changelog.txt
File ${PATH_ROOT}COPYING File ${PATH_ROOT}COPYING
File ${PATH_ROOT}readme.txt File ${PATH_ROOT}readme.txt
File ${PATH_ROOT}known-bugs.txt File ${PATH_ROOT}known-bugs.txt
; Copy executable ; Copy executable
File /oname=OpenTTD.exe ${PATH_ROOT}Release\openttd.exe File /oname=openttd.exe ${PATH_ROOT}Release\openttd.exe
File ${PATH_ROOT}strgen\Debug\strgen.exe File ${PATH_ROOT}strgen\Debug\strgen.exe
; Delete old files from the main dir. they are now placed in data/ and lang/ ; Delete old files from the main dir. they are now placed in data/ and lang/
Delete "$INSTDIR\*.lng" Delete "$INSTDIR\*.lng"
Delete "$INSTDIR\*.grf" Delete "$INSTDIR\*.grf"
Delete "$INSTDIR\sample.cat" Delete "$INSTDIR\sample.cat"
Delete "$INSTDIR\ttd.exe" Delete "$INSTDIR\ttd.exe"
;Creates the Registry Entries ; Create the Registry Entries
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Comments" "Visit http://www.openttd.org" WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Comments" "Visit ${APPURLLINK}"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "DisplayIcon" "$INSTDIR\openttd.exe,0" WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "DisplayIcon" "$INSTDIR\openttd.exe,0"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "DisplayName" "OpenTTD ${APPVERSION}" WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "DisplayName" "OpenTTD ${APPVERSION}"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "DisplayVersion" "${APPVERSION}" WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "DisplayVersion" "${APPVERSION}"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "HelpLink" "http://www.openttd.org" WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "HelpLink" "${APPURLLINK}"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Install Folder" "$INSTDIR" WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Install Folder" "$INSTDIR"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Publisher" "OpenTTD" WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Publisher" "OpenTTD"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Shortcut Folder" "$SHORTCUTS" WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Shortcut Folder" "$SHORTCUTS"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "UninstallString" "$INSTDIR\uninstall.exe" WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "URLInfoAbout" "http://www.openttd.org" WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "URLInfoAbout" "${APPURLLINK}"
;This key sets the Version DWORD that patches will check against ; This key sets the Version DWORD that new installers will check against
WriteRegDWORD HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Version" ${INSTALLERVERSION} WriteRegDWORD HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Version" ${INSTALLERVERSION}
!insertmacro MUI_STARTMENU_WRITE_BEGIN "OpenTTD" !insertmacro MUI_STARTMENU_WRITE_BEGIN "OpenTTD"
@ -155,11 +160,12 @@ Section "!OpenTTD" Section1
!insertmacro MUI_STARTMENU_WRITE_END !insertmacro MUI_STARTMENU_WRITE_END
SectionEnd SectionEnd
;----------------------------------------------------------------------------------
; TTDLX files install section. Copies all needed TTDLX files from CD or install dir
Section "Copy Game Graphics" Section2 Section "Copy Game Graphics" Section2
; Include files from CD ; Let's copy the files with size approximation
;Let's copy the files from the CD
SetOutPath "$INSTDIR\gm" SetOutPath "$INSTDIR\gm"
CopyFiles "$CDDRIVE\gm\*.gm" "$INSTDIR\gm\" CopyFiles "$CDDRIVE\gm\*.gm" "$INSTDIR\gm\" 1028
SetOutPath "$INSTDIR\data\" SetOutPath "$INSTDIR\data\"
CopyFiles "$CDDRIVE\sample.cat" "$INSTDIR\data\sample.cat" 1566 CopyFiles "$CDDRIVE\sample.cat" "$INSTDIR\data\sample.cat" 1566
; Copy Windows files ; Copy Windows files
@ -177,7 +183,8 @@ Section "Copy Game Graphics" Section2
SetOutPath "$INSTDIR\" SetOutPath "$INSTDIR\"
SectionEnd SectionEnd
;---------------------- ;-------------------------------------------
; Install the uninstaller (option is hidden)
Section -FinishSection Section -FinishSection
WriteUninstaller "$INSTDIR\uninstall.exe" WriteUninstaller "$INSTDIR\uninstall.exe"
SectionEnd SectionEnd
@ -188,25 +195,30 @@ SectionEnd
!insertmacro MUI_DESCRIPTION_TEXT ${Section2} "Copies the game graphics. Requires TTD (for Windows)." !insertmacro MUI_DESCRIPTION_TEXT ${Section2} "Copies the game graphics. Requires TTD (for Windows)."
!insertmacro MUI_FUNCTION_DESCRIPTION_END !insertmacro MUI_FUNCTION_DESCRIPTION_END
;!undef SHORTCUTS ;-----------------------------------------------
;Uninstall section ; Uninstall section, deletes all installed files
Section "Uninstall"
Section Uninstall MessageBox MB_YESNO|MB_ICONQUESTION \
MessageBox MB_YESNOCANCEL|MB_ICONQUESTION "Would you like to remove the Saved Game Folders located at '$INSTDIR\Save?' If you choose Yes, your Saved Games will be removed." IDYES RemoveSavedGames IDNO NoRemoveSavedGames "Remove the save game folders located at $\"$INSTDIR\save?$\"$\n \
If you choose Yes, your saved games will be deleted." \
IDYES RemoveSavedGames IDNO NoRemoveSavedGames
RemoveSavedGames: RemoveSavedGames:
Delete "$INSTDIR\Save\AutoSave\*" Delete "$INSTDIR\save\autosave\*"
RMDir "$INSTDIR\Save\AutoSave" RMDir "$INSTDIR\save\autosave"
Delete "$INSTDIR\Save\*" Delete "$INSTDIR\save\*"
RMDir "$INSTDIR\Save" RMDir "$INSTDIR\save"
NoRemoveSavedGames: NoRemoveSavedGames:
MessageBox MB_YESNOCANCEL|MB_ICONQUESTION "Would you like to remove the Scenario Folders located at '$INSTDIR\Scenario?' If you choose Yes, your Scenarios will be removed." IDYES RemoveScen IDNO NoRemoveScen MessageBox MB_YESNO|MB_ICONQUESTION \
"Remove the scenario folders located at $\"$INSTDIR\scenario?$\"$\n \
If you choose Yes, your scenarios will be deleted." \
IDYES RemoveScen IDNO NoRemoveScen
RemoveScen: RemoveScen:
Delete "$INSTDIR\Scenario\*" Delete "$INSTDIR\scenario\*"
RMDir "$INSTDIR\Scenario" RMDir "$INSTDIR\scenario"
NoRemoveScen: NoRemoveScen:
;Remove from registry... ; Remove from registry...
!insertmacro MUI_STARTMENU_GETFOLDER "OpenTTD" $SHORTCUTS !insertmacro MUI_STARTMENU_GETFOLDER "OpenTTD" $SHORTCUTS
ReadRegStr $SHORTCUTS HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Shortcut Folder" ReadRegStr $SHORTCUTS HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Shortcut Folder"
@ -239,12 +251,17 @@ Section Uninstall
; Data files ; Data files
Delete "$INSTDIR\data\opntitle.dat" 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\nsignalsw.grf"
Delete "$INSTDIR\data\openttd.grf" Delete "$INSTDIR\data\openttd.grf"
Delete "$INSTDIR\data\canalsw.grf"
Delete "$INSTDIR\data\trkfoundw.grf" Delete "$INSTDIR\data\trkfoundw.grf"
Delete "$INSTDIR\data\autorail.grf"
Delete "$INSTDIR\data\dosdummy.grf"
Delete "$INSTDIR\data\sample.cat" Delete "$INSTDIR\data\sample.cat"
; Windows Data files ; Windows Data files
Delete "$INSTDIR\data\trg1r.grf" Delete "$INSTDIR\data\trg1r.grf"
@ -259,10 +276,10 @@ Section Uninstall
Delete "$INSTDIR\data\trgc.grf" Delete "$INSTDIR\data\trgc.grf"
Delete "$INSTDIR\data\trgi.grf" Delete "$INSTDIR\data\trgi.grf"
;Music ; Music
Delete "$INSTDIR\gm\*.gm" Delete "$INSTDIR\gm\*.gm"
;Language files ; Language files
Delete "$INSTDIR\lang\*.lng" Delete "$INSTDIR\lang\*.lng"
Delete "$INSTDIR\lang\english.txt" Delete "$INSTDIR\lang\english.txt"
@ -273,89 +290,145 @@ Section Uninstall
RMDir "$INSTDIR\lang" RMDir "$INSTDIR\lang"
RMDir "$INSTDIR\data" RMDir "$INSTDIR\data"
RMDir "$INSTDIR" RMDir "$INSTDIR"
SectionEnd SectionEnd
Function SelectCD ;------------------------------------------------------------
; Custom page function to find the TTDLX CD/install location
Function SelectCDEnter
SectionGetFlags ${Section2} $0 SectionGetFlags ${Section2} $0
IntOp $1 $0 & 0x80 ; bit 7 set by upgrade, no need to copy files IntOp $1 $0 & 0x80 ; bit 7 set by upgrade, no need to copy files
IntCmp $1 1 DoneCD ;upgrade doesn't need copy files IntCmp $1 1 DoneCD ; Upgrade doesn't need copy files
IntOp $0 $0 & 1 IntOp $0 $0 & 1
IntCmp $0 1 NoAbort IntCmp $0 1 NoAbort
Abort Abort
NoAbort: NoAbort:
GetTempFileName $R0 GetTempFileName $R0
!insertmacro MUI_HEADER_TEXT "Locate TTD" "Setup needs the location of Transport Tycoon Deluxe in order to continue." !insertmacro MUI_HEADER_TEXT "Locate TTD" "Setup needs the location of Transport Tycoon Deluxe in order to continue."
File /oname=$R0 CDFinder.ini !insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "CDFinder.ini" "CDFinder"
ClearErrors ClearErrors
;Now, let's populate $CDDRIVE ; Now, let's populate $CDDRIVE
ReadRegStr $CDDRIVE HKLM "SOFTWARE\Fish Technology Group\Transport Tycoon Deluxe" "HDPath" ReadRegStr $CDDRIVE HKLM "SOFTWARE\Fish Technology Group\Transport Tycoon Deluxe" "HDPath"
IfErrors NoTTD IfErrors NoTTD
StrCpy $AddWinPrePopulate "Setup has detected your TTD folder. Don't change the folder. Simply press Next." StrCpy $AddWinPrePopulate "Setup has detected your TTD folder. Don't change the folder. Simply press Next."
!insertmacro MUI_INSTALLOPTIONS_WRITE "CDFinder" "Field 2" "State" $CDDRIVE ; TTDLX path
Goto TruFinish Goto TruFinish
NoTTD: NoTTD:
StrCpy $CDDRIVE "" StrCpy $AddWinPrePopulate "Setup couldn't find TTD. Please enter the path where the graphics files from TTD are stored and press Next to continue."
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: TruFinish:
ClearErrors ClearErrors
WriteINIStr $R0 "Field 2" "State" $CDDRIVE !insertmacro MUI_INSTALLOPTIONS_WRITE "CDFinder" "Field 3" "Text" $AddWinPrePopulate ; Caption
WriteINIStr $R0 "Field 3" "Text" $AddWinPrePopulate
DoneCD: DoneCD:
InstallOptions::dialog $R0 ; Initialize the dialog *AFTER* we've changed the text otherwise we won't see the changes
Pop $R1 !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "CDFinder"
!insertmacro MUI_INSTALLOPTIONS_SHOW
FunctionEnd FunctionEnd
; Exit from page function ;----------------------------------------------------------------
Function SelectCD2 ; Custom page function when 'next' is selected for the TTDLX path
ReadINIStr $CDDRIVE $R0 "Field 2" "State" Function SelectCDExit
IfFileExists $CDDRIVE\trgir.grf hasCD "" !insertmacro MUI_INSTALLOPTIONS_READ $CDDRIVE "CDFinder" "Field 2" "State"
IfFileExists $CDDRIVE\TRGI.GRF hasCD "" ; If trg1r.grf does not exist at the path, retry with DOS version
IfFileExists $CDDRIVE\sample.cat "" NoCD IfFileExists $CDDRIVE\trg1r.grf "" DosCD
IfFileExists $CDDRIVE\trgir.grf "" NoCD
IfFileExists $CDDRIVE\sample.cat hasCD NoCD
DosCD:
IfFileExists $CDDRIVE\TRG1.GRF "" NoCD
IfFileExists $CDDRIVE\TRGI.GRF "" NoCD
IfFileExists $CDDRIVE\SAMPLE.CAT hasCD NoCD
NoCD: NoCD:
MessageBox MB_OK "Setup cannot continue without the Transport Tycoon Deluxe Location!" MessageBox MB_OK "Setup cannot continue without the Transport Tycoon Deluxe Location!"
Abort Abort
hasCD: hasCD:
FunctionEnd FunctionEnd
;---------------------------------------------------------------------
; Custom page function to show notices for running OpenTTD
; We have extracted this custom page as Notice in the .onInit function
Function ShowWarningsPage
!insertmacro MUI_HEADER_TEXT "Installation Complete" "Important notices for OpenTTD usage."
!insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "notice.ini" "Notice"
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "Notice"
Call GetWindowsVersion
Pop $R0
; Hide the MSLU text if the installer is not run on Win9x systems
StrCmp $R0 "winnt" 0 Win9x
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "Notice" "Field 1" "HWND" ; MSLU groupbox
ShowWindow $R1 0
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "Notice" "Field 2" "HWND" ; MSLU text
ShowWindow $R1 0
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "Notice" "Field 3" "HWND" ; MSLU link
ShowWindow $R1 0
Win9x:
ClearErrors
!insertmacro MUI_INSTALLOPTIONS_SHOW
FunctionEnd
;-------------------------------------------------------------------------------
; Determine windows version, returns "win9x" if Win9x/Me or "winnt" on the stack
Function GetWindowsVersion
ClearErrors
StrCpy $R0 "winnt"
ReadRegStr $R1 HKLM "SOFTWARE\MICROSOFT\WINDOWS NT\CurrentVersion" CurrentVersion
IfErrors 0 WinNT
StrCpy $R0 "win9x"
WinNT:
ClearErrors
Push $R0
FunctionEnd
Var OLDVERSION Var OLDVERSION
Var UninstallString Var UninstallString
;-----------------------------------------------------------------------------------
; NSIS Initialize function, determin if we are going to install/upgrade or uninstall
Function .onInit Function .onInit
StrCpy $SHORTCUTS "OpenTTD" StrCpy $SHORTCUTS "OpenTTD"
SectionSetFlags 0 17 SectionSetFlags 0 17
;Starts Setup - let's look for an older version of OpenTTD ; Starts Setup - let's look for an older version of OpenTTD
ReadRegDWORD $R8 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Version" ReadRegDWORD $R8 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Version"
IfErrors ShowWelcomeMessage ShowUpgradeMessage IfErrors ShowWelcomeMessage ShowUpgradeMessage
ShowWelcomeMessage: ShowWelcomeMessage:
ReadRegStr $R8 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Version" ReadRegStr $R8 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "Version"
;In the event someone still has OpenTTD 0.1, this will detect that (that installer used a string instead of dword entry) ; In the event someone still has OpenTTD 0.1, this will detect that (that installer used a string instead of dword entry)
IfErrors FinishCallback IfErrors FinishCallback
ShowUpgradeMessage: ShowUpgradeMessage:
IntCmp ${INSTALLERVERSION} $R8 VersionsAreEqual InstallerIsOlder WelcomeToSetup IntCmp ${INSTALLERVERSION} $R8 VersionsAreEqual InstallerIsOlder WelcomeToSetup
WelcomeToSetup: WelcomeToSetup:
;An older version was found. Let's let the user know there's an upgrade that will take plce. ; An older version was found. Let's let the user know there's an upgrade that will take place.
ReadRegStr $OLDVERSION HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "DisplayVersion" ReadRegStr $OLDVERSION HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "DisplayVersion"
;Gets the older version then displays it in a message box ; Gets the older version then displays it in a message box
MessageBox MB_OK|MB_ICONINFORMATION "Welcome to ${APPNAMEANDVERSION} Setup.$\n$\nThis will allow you to upgrade from version $OLDVERSION." MessageBox MB_OK|MB_ICONINFORMATION \
"Welcome to ${APPNAMEANDVERSION} Setup.$\n \
This will allow you to upgrade from version $OLDVERSION."
SectionSetFlags ${Section2} 0x80 ; set bit 7 SectionSetFlags ${Section2} 0x80 ; set bit 7
Goto FinishCallback Goto FinishCallback
VersionsAreEqual: VersionsAreEqual:
ReadRegStr $UninstallString HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "UninstallString" ReadRegStr $UninstallString HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenTTD" "UninstallString"
IfFileExists "$UninstallString" "" FinishCallback IfFileExists "$UninstallString" "" FinishCallback
MessageBox MB_YESNO|MB_ICONQUESTION "Setup detected ${APPNAMEANDVERSION} on your system. That's the version this program will install.$\n$\nAre you trying to uninstall it?" IDYES DoUninstall IDNO FinishCallback MessageBox MB_YESNO|MB_ICONQUESTION \
DoUninstall: ;You have the same version as this installer. This allows you to uninstall. "Setup detected ${APPNAMEANDVERSION} on your system. That's the version this program will install.$\n \
Are you trying to uninstall it?" \
IDYES DoUninstall IDNO FinishCallback
DoUninstall: ; You have the same version as this installer. This allows you to uninstall.
Exec "$UninstallString" Exec "$UninstallString"
Quit Quit
InstallerIsOlder: InstallerIsOlder:
MessageBox MB_OK|MB_ICONSTOP "You have a newer version of ${APPNAME}.$\n$\nSetup will now exit." MessageBox MB_OK|MB_ICONSTOP \
"You have a newer version of ${APPNAME}.$\n \
Setup will now exit."
Quit Quit
FinishCallback: FinishCallback:

View File

@ -0,0 +1,54 @@
; Ini file generated by the HM NIS Edit IO designer.
[Settings]
NumFields=6
[Field 1]
Type=Groupbox
Text=Notice for Windows 9x/ME users!
Left=8
Right=292
Top=80
Bottom=138
[Field 2]
Type=Label
Text=OpenTTD will not work without the Microsoft Layer for Unicode installed.\r\nDue to licensing issues we cannot bundle this file with the installer. Please download MSLU from the Microsoft website and extract UnicoWS.dll to the same directory as the openttd executabe.
Left=13
Right=284
Top=91
Bottom=127
[Field 3]
Type=Link
Text=Microsoft Layer for Unicode
State=http://www.microsoft.com/downloads/details.aspx?FamilyId=73BA7BD7-ED06-4F0D-80A4-2A7EEAEE17E2&displaylang=en
Left=197
Right=284
Top=127
Bottom=135
[Field 4]
Type=Groupbox
Text=UNICODE support
Left=8
Right=292
Top=0
Bottom=75
[Field 5]
Type=Label
Text=This version of OpenTTD has support for UNICODE, allowing users to use non-ASCII character sets such as Russian or Japanese.\r\nSelecting such a language will result in an unusable and garbled interface. You will need to specify a font that has support for these characters in openttd.cfg, or alternatively use an appropiate grf file.\r\n\r\nFor more information please refer to the readme or the wiki.
Left=13
Right=284
Top=9
Bottom=65
[Field 6]
Type=Link
Text=OpenTTD wiki
Left=238
Right=284
Top=64
Bottom=72
State=http://wiki.openttd.org/index.php/Unicode