Help: Custom Page with MUI not working
For some reason, my custom page doesn't run.
I know it is allot of code, but please take a look.
The point is they could have 2 totally different install types, so I want a screen before the directory choice that says:
RadioButton "Default Installation (this user)"
RadioButton "All Users (--nohomedir)"
Then depending on what they choose, I will have a better chance of pre-deterining the install path using the registration keys.
This is a work in progress, so messy, but here we have it..
http://nsis.pastebin.com/m52ae8546 Line 179
I also tried.
http://nsis.pastebin.com/m4d2fca04 Line 170 and 179
Current code compiles, but I am in the middle of trying:
/******************************************************************************
;NSIS Modern User Interface
;Copyright 2004-2009 Josh Lee
; Special thanks to Bob Gneu for helping with the Registry Key logic of UT3
;--------------------------------
-1 Compressor Setings
-2 User Over-ridable Config
-3 Constants
-4 Registry Information
-5 Variable Decleration
-6 Pages
-7 Language Definition
-8 Section Over-rides
-8.5 Page Overrides (after sections for variable def.)
-9 Function Decleration
******************************************************************************/
!include "MUI2.nsh"
!include FileFunc.nsh
!include "StrFunc.nsh"
${StrRep}
;=== Runtime Switches
SetCompress Auto
SetCompressor /SOLID lzma
SetCompressorDictSize 32
SetDatablockOptimize On
XPStyle on
CRCCheck on
AutoCloseWindow True
;Request application privileges for Windows Vista
RequestExecutionLevel user
###############################################################################
###############################################################################
# Begin Config
;--------------------------------
;General
;Name and file
NAME "Unreal Tournament 3 - Jailbreak"
!define VERSION "Alpha9"
!define SHORTNAME "JB_${VERSION}"
!define UNINSTALLER "Uninstall_Jailbreak.exe"
; Version of installer in X.X.X.X format (requried by NSIS2 MUI)
!define JAILBREAK_INSTALLER_VERSION "1.0.0.0"
; Installer File name
OutFile "${SHORTNAME}_Installer.exe"
;Default installation folder
InstallDir "$DOCUMENTS\My Games\Unreal Tournament 3\UTGame\Published\CookedPC"
; images
;=== Icon & Stye ===
!define AP_ICON "required_files\JBIcon.ico"
!define LOGO "required_files\logo.bmp"
;=== BEGIN: BASIC INFORMATION
!define NAME "Unreal Tournament 3 - Jailbreak x"
!define Caption "${NAME} - Installer"
;=== Program Icon
Icon "${AP_ICON}"
!define STARTMENUFOLDER "Unreal Tournament 3\PlanetJailbreak.com"
!define DEFAULT_DESTINATION "${InstallDir}"
!define CHECKRUNNING "UT3.exe"
!define CLOSENAME "Unreal Tournament 3"
!define PRODUCT_WEB_SITE "http://www.PlanetJailbreak.com"
!define INSTALLERCOMMENTS "For additional details, visit PlanetJailbreak.com xxx:todo"
!define INSTALLERADDITIONALTRADEMARKS "Jailbreak is a Trademark of PlanetJailbreakâ„¢" ;end this entry with a period and a space if used
!define INSTALLERLEGALCOPYRIGHT "PlanetJailbreakâ„¢ and contributors."
!define LICENSEAGREEMENT "required_files\JBLicense.txt"
!define PRODUCT_COMPANY "PlanetJailBreak.com"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_COMPANY}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define MESSAGE_INTRO "UT3 Jailbreak has been installed."
!define MESSAGE_SIGNATURE "$\n$\nFor further assistance please use the forums at PlanetJailbreak.com. $\n$\n- UT3 Jailbreak | Project Lead - Wormbo"
!define SUCCESS_MESSAGE "${MESSAGE_INTRO} $\n$\nThere are shortcuts available to you in your installation directory. ${MESSAGE_SIGNATURE}"
!define FAILURE_MESSAGE "${MESSAGE_INTRO} $\n$\nUnfortunately your UT3 installation was not found in the registry. ${MESSAGE_SIGNATURE}"
;Interface Settings
;=== Header Icon
!define MUI_ICON "${AP_ICON}"
!define MUI_ABORTWARNING
!define MUI_WELCOMEFINISHPAGE_BITMAP "${LOGO}"
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE LeaveDirectory
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\Jailbreak" ""
# Command Line
!define UT3_BINARY_LOC "Binaries\UT3.exe"
!define STEAM_UT3_DIR "\steamapps\common\unreal tournament 3\"
!define UT3_CMD_OPTIONS "-mod=..\Jailbreak -solomod"
!define EDITOR_LNK "UnrealED - Jailbreak.lnk"
!define GAME_LNK "Play Jailbreak.lnk"
# End Config
###############################################################################
###############################################################################
# Begin Constants
;--------------------------------------------------------------------------------------------------------------------
# Branding Variables
;!include "required_files\constants.nsh"
BrandingText "${INSTALLERLEGALCOPYRIGHT}"
VIProductVersion "${JAILBREAK_INSTALLER_VERSION}"
VIAddVersionKey ProductName "${NAME}"
VIAddVersionKey Comments "${INSTALLERCOMMENTS}"
VIAddVersionKey PRODUCT_COMPANY "${PRODUCT_COMPANY}"
VIAddVersionKey ProductWebsite "${PRODUCT_WEB_SITE}"
VIAddVersionKey Website "${PRODUCT_WEB_SITE}"
VIAddVersionKey LegalCopyright "${INSTALLERLEGALCOPYRIGHT}"
VIAddVersionKey FileDescription "${NAME}"
VIAddVersionKey FileVersion "${VERSION}"
VIAddVersionKey ProductVersion "${VERSION}"
VIAddVersionKey InternalName "${NAME}"
VIAddVersionKey LegalTrademarks "${INSTALLERADDITIONALTRADEMARKS}"
VIAddVersionKey OriginalFilename "${FILENAME}.paf.exe"
VIAddVersionKey PlanetJailbreak.comInstallerVersion "${JAILBREAK_INSTALLER_VERSION}"
# End Constants
###############################################################################
###############################################################################
# Begin Registry Information
;--------------------------------------------------------------------------------------------------------------------
# Registry Key Variables
;!include "required_files\registry_keys.nsh"
;--------------------------------
# UT3 CU Registry Keys
!define INSTALL_CU_KEY_UNK1_32 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{C019D439-E7F8-49EB-85FA-6D0C8CCBDA23}"
!define INSTALL_CU_KEY_UNK2_32 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{A007C579-B78D-4FDE-A85A-16987A251E53}"
!define INSTALL_CU_KEY_UNK3_32 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{FDBBAF14-5ED8-49B7-A5BE-1C35668B074D}"
!define INSTALL_CU_KEY_UNK4_32 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{69082C6E-1944-4EAD-B119-06DCBF492C3F}"
!define INSTALL_CU_KEY_US_WIN_32 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{BFA90209-7AFF-4DB6-8E4B-E57305751AD7}"
!define INSTALL_CU_KEY_UNK1_64 "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{C019D439-E7F8-49EB-85FA-6D0C8CCBDA23}"
!define INSTALL_CU_KEY_UNK2_64 "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{A007C579-B78D-4FDE-A85A-16987A251E53}"
!define INSTALL_CU_KEY_UNK3_64 "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{FDBBAF14-5ED8-49B7-A5BE-1C35668B074D}"
!define INSTALL_CU_KEY_UNK4_64 "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{69082C6E-1944-4EAD-B119-06DCBF492C3F}"
!define INSTALL_CU_KEY_US_WIN_64 "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_{BFA90209-7AFF-4DB6-8E4B-E57305751AD7}"
# UT3 LM Registry Keys
!define INSTALL_LM_KEY_UNK1_32 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{C019D439-E7F8-49EB-85FA-6D0C8CCBDA23}"
!define INSTALL_LM_KEY_UNK2_32 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{A007C579-B78D-4FDE-A85A-16987A251E53}"
!define INSTALL_LM_KEY_UNK3_32 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{FDBBAF14-5ED8-49B7-A5BE-1C35668B074D}"
!define INSTALL_LM_KEY_UNK4_32 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{69082C6E-1944-4EAD-B119-06DCBF492C3F}"
!define INSTALL_LM_KEY_US_WIN_32 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{BFA90209-7AFF-4DB6-8E4B-E57305751AD7}"
!define INSTALL_LM_KEY_UNK1_64 "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{C019D439-E7F8-49EB-85FA-6D0C8CCBDA23}"
!define INSTALL_LM_KEY_UNK2_64 "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{A007C579-B78D-4FDE-A85A-16987A251E53}"
!define INSTALL_LM_KEY_UNK3_64 "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{FDBBAF14-5ED8-49B7-A5BE-1C35668B074D}"
!define INSTALL_LM_KEY_UNK4_64 "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{69082C6E-1944-4EAD-B119-06DCBF492C3F}"
!define INSTALL_LM_KEY_US_WIN_64 "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{BFA90209-7AFF-4DB6-8E4B-E57305751AD7}"
# Steam Registry Keys
!define INSTALL_KEY_STEAM "Software\Valve\Steam"
# End Registry Information
###############################################################################
###############################################################################
# Begin Variable Decleration
;--------------------------------------------------------------------------------------------------------------------
;Variables
Var StartMenuFolder
# End Variable Decloration
###############################################################################
###############################################################################
# Begin Pages
;--------------------------------------------------------------------------------------------------------------------
;Pages
; Installer Pages
!define MUI_CUSTOMFUNCTION_GUIINIT CustomPageFunction
!define MUI_WELCOMEPAGE_TITLE "Unreal Tournament 3 - Jailbreak"
!insertmacro MUI_PAGE_WELCOME
!ifdef LICENSEAGREEMENT
!define MUI_LICENSEPAGE_CHECKBOX
!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
!endif
Page custom CustomPageFunction
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
;!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
;!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Jailbreak"
;!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!define MUI_STARTPAGE_TITLE "Test"
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_TITLE "Jailbreak"
!insertmacro MUI_PAGE_FINISH
!define MUI_FINISHPAGE_TEXT "$(finish)"
; Un-installer Pages
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
# End Pages
Function CustomPageFunction
!insertmacro MUI_HEADER_TEXT "Page Title" "Subtitle"
;!insertmacro MUI_INSTALLOPTIONS_DISPLAY "${LICENSEAGREEMENT}"
FunctionEnd
###############################################################################
###############################################################################
# Begin Language Definition
;--------------------------------------------------------------------------------------------------------------------
;Language Selection Dialog Settings
;Remember the installer language
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
!define MUI_LANGDLL_REGISTRY_KEY "Software\Jailbreak"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
;--------------------------------------------------------------------------------------------------------------------
;Languages
;!include "required_files\language_setup.nsh"
!insertmacro MUI_LANGUAGE "English" ;first language is the default language
/*
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_LANGUAGE "Spanish"
!insertmacro MUI_LANGUAGE "SpanishInternational"
!insertmacro MUI_LANGUAGE "SimpChinese"
!insertmacro MUI_LANGUAGE "TradChinese"
!insertmacro MUI_LANGUAGE "Japanese"
!insertmacro MUI_LANGUAGE "Korean"
!insertmacro MUI_LANGUAGE "Italian"
!insertmacro MUI_LANGUAGE "Dutch"
!insertmacro MUI_LANGUAGE "Danish"
!insertmacro MUI_LANGUAGE "Swedish"
!insertmacro MUI_LANGUAGE "Norwegian"
!insertmacro MUI_LANGUAGE "NorwegianNynorsk"
!insertmacro MUI_LANGUAGE "Finnish"
!insertmacro MUI_LANGUAGE "Greek"
!insertmacro MUI_LANGUAGE "Russian"
!insertmacro MUI_LANGUAGE "Portuguese"
!insertmacro MUI_LANGUAGE "PortugueseBR"
!insertmacro MUI_LANGUAGE "Polish"
!insertmacro MUI_LANGUAGE "Ukrainian"
!insertmacro MUI_LANGUAGE "Czech"
!insertmacro MUI_LANGUAGE "Slovak"
!insertmacro MUI_LANGUAGE "Croatian"
!insertmacro MUI_LANGUAGE "Bulgarian"
!insertmacro MUI_LANGUAGE "Hungarian"
!insertmacro MUI_LANGUAGE "Thai"
!insertmacro MUI_LANGUAGE "Romanian"
!insertmacro MUI_LANGUAGE "Latvian"
!insertmacro MUI_LANGUAGE "Macedonian"
!insertmacro MUI_LANGUAGE "Estonian"
!insertmacro MUI_LANGUAGE "Turkish"
!insertmacro MUI_LANGUAGE "Lithuanian"
!insertmacro MUI_LANGUAGE "Slovenian"
!insertmacro MUI_LANGUAGE "Serbian"
!insertmacro MUI_LANGUAGE "SerbianLatin"
!insertmacro MUI_LANGUAGE "Arabic"
!insertmacro MUI_LANGUAGE "Farsi"
!insertmacro MUI_LANGUAGE "Hebrew"
!insertmacro MUI_LANGUAGE "Indonesian"
!insertmacro MUI_LANGUAGE "Mongolian"
!insertmacro MUI_LANGUAGE "Luxembourgish"
!insertmacro MUI_LANGUAGE "Albanian"
!insertmacro MUI_LANGUAGE "Breton"
!insertmacro MUI_LANGUAGE "Belarusian"
!insertmacro MUI_LANGUAGE "Icelandic"
!insertmacro MUI_LANGUAGE "Malay"
!insertmacro MUI_LANGUAGE "Bosnian"
!insertmacro MUI_LANGUAGE "Kurdish"
!insertmacro MUI_LANGUAGE "Irish"
!insertmacro MUI_LANGUAGE "Uzbek"
!insertmacro MUI_LANGUAGE "Galician"
!insertmacro MUI_LANGUAGE "Afrikaans"
!insertmacro MUI_LANGUAGE "Catalan"
!insertmacro MUI_LANGUAGE "Esperanto"
*/
;LangString welcome ${LANG_ENGLISH} "This wizard will guide you through the installation of ${NAME}.\r\n\r\nIf you are upgrading an existing installation of ${NAME}, please close UT3 before proceeding.\r\n\r\nClick Next to continue."
LangString finish ${LANG_ENGLISH} "${NAME} has been installed on your device.\r\n\r\nClick Finish to close this wizard."
LangString runwarning ${LANG_ENGLISH} "Please close all instances of ${CLOSENAME} and then click OK. Jailbreak Mod can not be upgraded while it is running."
LangString invaliddirectory ${LANG_ENGLISH} "The destination folder you selected is invalid. Please choose a valid folder."
LangString notenoughspace ${LANG_ENGLISH} "The device you have selected to install to does not have enough free space for Jailbreak."
; LangString required ${LANG_ENGLISH} "required"
;LangString checkforplatform ${LANG_ENGLISH} "Checking for previous install of Jailbreak"
;LangString refreshmenu ${LANG_ENGLISH} "Refreshing Jailbreak Menu"
!insertmacro MUI_RESERVEFILE_LANGDLL
!insertmacro MUI_RESERVEFILE_LANGDLL
# End Language Definition
###############################################################################
;--------------------------------------------------------------------------------------------------------------------
;Reserve Files
;If you are using solid compression, files that are required before
;the actual installation should be stored first in the data block,
;because this will make your installer start faster.
###############################################################################
###############################################################################
# Begin Section Over-rides
;--------------------------------
;Installer Sections
Section "!Jailbreak (required)" section_jailbreak_main
SectionIn RO
SetOutPath $INSTDIR
;Store installation folder
WriteRegStr HKCU "Software\Jailbreak" "" $INSTDIR
# Begin copying necessary files over
;File /oname=$OUTDIR\readme.txt readme.txt
;File /oname=$OUTDIR\changelog.txt changelog.txt
# CustomChars
;CreateDirectory $OUTDIR\Screenshots
;CreateDirectory $OUTDIR\Splash
;SetOutPath $INSTDIR\Splash
;File /oname=$OUTDIR\Splash.bmp ..\..\Trunk\Splash\Splash.bmp
;File /oname=$OUTDIR\EdSplash.bmp ..\..\Trunk\Splash\EdSplash.bmp
# Maps
CreateDirectory $INSTDIR\Maps
# Localization
CreateDirectory $INSTDIR\Localization
CreateDirectory $INSTDIR\Localization\DEU
CreateDirectory $INSTDIR\Localization\ESN
CreateDirectory $INSTDIR\Localization\FRA
CreateDirectory $INSTDIR\Localization\INT
CreateDirectory $INSTDIR\Localization\ITA
SetOutPath $INSTDIR\Localization
; Write Uninstaller information
WriteUninstaller "$INSTDIR\${UNINSTALLER}"
WriteRegStr "${PRODUCT_UNINST_ROOT_KEY}" "${PRODUCT_UNINST_KEY}" "DisplayName" "${NAME}"
WriteRegStr "${PRODUCT_UNINST_ROOT_KEY}" "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\${UNINSTALLER}"
WriteRegStr "${PRODUCT_UNINST_ROOT_KEY}" "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${VERSION}"
WriteRegStr "${PRODUCT_UNINST_ROOT_KEY}" "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr "${PRODUCT_UNINST_ROOT_KEY}" "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_COMPANY}"
WriteRegStr "${PRODUCT_UNINST_ROOT_KEY}" "${PRODUCT_UNINST_KEY}" "Install Date" "${__TIMESTAMP__}"
#######################################################################
# Sub Section Start Menu Begin
;!include "required_files\start_menu.nsh"
;Call setStartFolder
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
SetOutPath $INSTDIR
# Get the path to the UT3 binary
WriteIniStr "$INSTDIR\${PRODUCT_COMPANY}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Website.lnk" "$INSTDIR\${PRODUCT_COMPANY}.url"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\${UNINSTALLER}"
ClearErrors
# Check Current User keys first
ReadRegStr $0 HKCU "${INSTALL_CU_KEY_UNK1_32}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKCU "${INSTALL_CU_KEY_UNK2_32}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKCU "${INSTALL_CU_KEY_UNK3_32}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKCU "${INSTALL_CU_KEY_UNK4_32}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKCU "${INSTALL_CU_KEY_US_WIN_32}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKCU "${INSTALL_CU_KEY_UNK1_64}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKCU "${INSTALL_CU_KEY_UNK2_64}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKCU "${INSTALL_CU_KEY_UNK3_64}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKCU "${INSTALL_CU_KEY_UNK4_64}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKCU "${INSTALL_CU_KEY_US_WIN_64}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors # Check the Local Machine keys
ReadRegStr $0 HKLM "${INSTALL_LM_KEY_UNK1_32}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKLM "${INSTALL_LM_KEY_UNK2_32}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKLM "${INSTALL_LM_KEY_UNK3_32}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKLM "${INSTALL_LM_KEY_UNK4_32}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKLM "${INSTALL_LM_KEY_US_WIN_32}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKLM "${INSTALL_LM_KEY_UNK1_64}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKLM "${INSTALL_LM_KEY_UNK2_64}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKLM "${INSTALL_LM_KEY_UNK3_64}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKLM "${INSTALL_LM_KEY_UNK4_64}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKLM "${INSTALL_LM_KEY_US_WIN_64}" 'InstallLocation'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKCU "${INSTALL_KEY_STEAM}" 'SteamPath'
IfErrors 0 CheckFiles
ClearErrors
ReadRegStr $0 HKLM "${INSTALL_KEY_STEAM}" 'InstallPath'
IfErrors 0 CheckFiles
GOTO SkipShortcuts
CheckFiles:
${StrRep} $0 "$0" "/" "\"
IffileExists "$0Binaries\UT3.exe" CreateShortcuts 0
IffileExists "$0\steamapps\common\unreal tournament 3\Binaries\UT3.exe" 0 SkipShortcuts
CreateSteamShortcuts:
# Startup Menu Shortcuts
;CreateShortCut "$SMPROGRAMS\Gneu\Project: White\${EDITOR_LNK}" "$0${STEAM_UT3_DIR}${UT3_BINARY_LOC}" "editor ${UT3_CMD_OPTIONS}"
;CreateShortCut "$SMPROGRAMS\Gneu\Project: White\${GAME_LNK}" "$0${STEAM_UT3_DIR}${UT3_BINARY_LOC}" "${UT3_CMD_OPTIONS}"
# Install Directory Shortcuts
;CreateShortCut "$INSTDIR\${EDITOR_LNK}" "$0${STEAM_UT3_DIR}${UT3_BINARY_LOC}" "editor ${UT3_CMD_OPTIONS}"
;CreateShortCut "$INSTDIR\${GAME_LNK}" "$0${STEAM_UT3_DIR}${UT3_BINARY_LOC}" "${UT3_CMD_OPTIONS}"
MessageBox MB_OK "${SUCCESS_MESSAGE}"
GoTo Done
CreateShortcuts:
# Startup Menu Shortcuts
;CreateShortCut "$SMPROGRAMS\Gneu\Project: White\${EDITOR_LNK}" "$0Binaries\UT3.exe" "editor ${UT3_CMD_OPTIONS}"
;CreateShortCut "$SMPROGRAMS\Gneu\Project: White\${GAME_LNK}" "$0Binaries\UT3.exe" "${UT3_CMD_OPTIONS}"
# Install Directory Shortcuts
;CreateShortCut "$INSTDIR\${EDITOR_LNK}" "$0${UT3_BINARY_LOC}" "editor ${UT3_CMD_OPTIONS}"
;CreateShortCut "$INSTDIR\${GAME_LNK}" "$0${UT3_BINARY_LOC}" "${UT3_CMD_OPTIONS}"
MessageBox MB_OK "${SUCCESS_MESSAGE}"
GoTo Done
SkipShortcuts:
MessageBox MB_OK "${FAILURE_MESSAGE}"
Done:
;Create shortcuts
!insertmacro MUI_STARTMENU_WRITE_END
# End Sub Section Start Menu
#######################################################################
SectionEnd
Section "Jailbreak Maps" section_maps
SetOutPath $INSTDIR
SectionEnd
;Assign descriptions to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${section_jailbreak_main} "Jailbreak Mod."
!insertmacro MUI_DESCRIPTION_TEXT ${section_maps} "Jailbreak Maps."
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
;Uninstaller Section
Section "Uninstall"
Delete "$INSTDIR\${UNINSTALLER}"
RMDir "$INSTDIR"
DeleteRegKey /ifempty HKCU "Software\Jailbreak"
SectionEnd
# End Section Over-rides
###############################################################################
###############################################################################
# Begin Function Decleration
;!include "required_files\functions.nsh"
;--------------------------------
;Installer Functions
Function .onInit
InitPluginsDir
File /oname=$PLUGINSDIR\splash.bmp "${LOGO}"
;delay fadein fadeout
advsplash::show 2000 1000 1000 -1 $PLUGINSDIR\splash
Pop $0
Delete $PLUGINSDIR\splash.bmp
!insertmacro MUI_LANGDLL_DISPLAY
Call setStartFolder
FunctionEnd
;--------------------------------
;Uninstaller Functions
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
FunctionEnd
Function LeaveDirectory
GetInstDirError $0
;=== Does it already exist? (upgrade)
IfFileExists "$INSTDIR\Jailbreak.u" "" CheckInstallerError
;=== Check if app is running?
StrCmp ${CHECKRUNNING} "NONE" CheckInstallerError
FindProcDLL::FindProc "${CHECKRUNNING}"
StrCmp $R0 "1" "" CheckInstallerError
MessageBox MB_OK|MB_ICONINFORMATION "$(runwarning)"
Abort
CheckInstallerError:
${Switch} $0
${Case} 0 ;=== Valid directory and enough free space
${Break}
${Case} 1
MessageBox MB_OK "$(invaliddirectory)"
Abort
${Break}
${Case} 2
IfFileExists "$INSTDIR" "" NotEnoughSpaceNoUpgrade ;=== Is upgrade
SectionGetSize ${section_jailbreak_main} $1 ;=== Space Required for App
${GetRoot} "$INSTDIR" $2
${DriveSpace} "$2\" "/D=F /S=K" $3 ;=== Space Free on Device
${GetSize} "$INSTDIR" "/M=*.* /S=0K /G=1" $4 $5 $6 ;=== Current installation size
IntOp $7 $3 + $4 ;=== Space Free + Current Install Size
NotEnoughSpaceNoUpgrade:
MessageBox MB_OK "$(notenoughspace)"
Abort
${Break}
${EndSwitch}
FunctionEnd
Function setStartFolder
StrCpy $StartMenuFolder "${STARTMENUFOLDER}"
FunctionEnd
# End Function Decleration
###############################################################################