Files
itgmania212121/stepmania/stepmania.nsi
T

662 lines
20 KiB
NSIS
Raw Normal View History

2002-08-23 20:06:23 +00:00
; NSIS Install Script
; created by
2005-10-31 20:50:42 +00:00
; BBF, GlennMaynard, ChrisDanford
2002-08-23 20:06:23 +00:00
; I use the following command to create the installer:
; NOTE: this .NSI script is designed for NSIS v2.0+
2002-08-23 20:06:23 +00:00
2005-10-31 20:50:42 +00:00
;--------------------------------
;Includes
2005-10-31 20:50:42 +00:00
!include "MUI.nsh" ; Modern UI
; Product info is in a separate file so that people will change
; the version info for the installer and the program at the same time.
; It's confusing when the installer and shortcut text doesn't match the
; title screen version text.
!include "src\ProductInfo.inc"
2005-10-31 20:50:42 +00:00
;--------------------------------
;General
2005-10-31 20:50:42 +00:00
!system "echo This may take a moment ..." ignore
; upx isn't working with VC++2003 executables. Disable temporarily. ;!system "utils\upx Program\*.exe Program\*.dll" ignore
2002-08-23 20:06:23 +00:00
2006-05-03 04:50:41 +00:00
Name "${PRODUCT_DISPLAY}"
OutFile "${PRODUCT_DISPLAY}.exe"
2004-05-23 07:29:08 +00:00
2006-05-03 04:50:41 +00:00
Caption "${PRODUCT_DISPLAY}"
UninstallCaption "${PRODUCT_DISPLAY}"
2004-05-23 07:29:08 +00:00
2005-10-31 20:50:42 +00:00
; Some default compiler settings (uncomment and change at will):
2006-05-07 09:27:58 +00:00
!ifdef COMPRESS
SetCompress auto
!else
SetCompress off
!endif
2005-10-31 20:50:42 +00:00
SetDatablockOptimize on ; (can be off)
2006-05-03 04:50:41 +00:00
!ifdef CRC_CHECK
2006-05-04 12:28:00 +00:00
CRCCheck on
2006-05-03 04:50:41 +00:00
!else
2006-05-04 12:28:00 +00:00
CRCCheck off
2006-05-03 04:50:41 +00:00
!endif
2005-10-31 20:50:42 +00:00
AutoCloseWindow true ; (can be true for the window go away automatically at end)
; ShowInstDetails hide ; (can be show to have them shown, or nevershow to disable)
SetDateSave on ; (can be on to have files restored to their orginal date)
InstallDir "$PROGRAMFILES\${PRODUCT_ID}"
2006-02-25 23:41:50 +00:00
InstallDirRegKey HKEY_LOCAL_MACHINE "SOFTWARE\${PRODUCT_ID}" ""
2005-10-31 20:50:42 +00:00
; DirShow show ; (make this hide to not let the user change it)
2006-05-03 04:50:41 +00:00
DirText "${PRODUCT_DISPLAY}"
2005-10-31 20:50:42 +00:00
InstallColors /windows
InstProgressFlags smooth
2002-08-23 20:06:23 +00:00
2005-10-31 20:50:42 +00:00
;--------------------------------
;Interface Settings
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "Installer\header.bmp"
2005-10-31 20:50:42 +00:00
!define MUI_ABORTWARNING
!define MUI_ICON "Installer\install.ico"
!define MUI_UNICON "Installer\uninstall.ico"
2005-10-31 20:50:42 +00:00
;--------------------------------
;Language Selection Dialog Settings
;Remember the installer language
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
2006-02-25 23:41:50 +00:00
!define MUI_LANGDLL_REGISTRY_KEY "Software\${PRODUCT_ID}"
2005-10-31 20:50:42 +00:00
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
;--------------------------------
;Pages
2005-11-01 18:01:41 +00:00
!ifdef SHOW_AUTORUN
2006-05-03 04:50:41 +00:00
Page custom ShowAutorun LeaveAutorun
2005-11-01 18:01:41 +00:00
!endif
2005-10-31 20:50:42 +00:00
;!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
;!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English" # first language is the default language
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_LANGUAGE "Spanish"
2005-11-02 08:51:29 +00:00
!insertmacro MUI_LANGUAGE "Italian"
2005-10-31 20:50:42 +00:00
;!insertmacro MUI_LANGUAGE "SimpChinese"
;!insertmacro MUI_LANGUAGE "TradChinese"
;!insertmacro MUI_LANGUAGE "Japanese"
;!insertmacro MUI_LANGUAGE "Korean"
;!insertmacro MUI_LANGUAGE "Dutch"
;!insertmacro MUI_LANGUAGE "Danish"
;!insertmacro MUI_LANGUAGE "Swedish"
;!insertmacro MUI_LANGUAGE "Norwegian"
;!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 "Catalan"
;!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"
; generate, then include installer strings
2006-06-12 11:41:44 +00:00
!delfile "nsis_strings_temp.inc"
!system '"Program\${PRODUCT_FAMILY}.exe" --ExportNsisStrings'
!include "nsis_strings_temp.inc"
2005-10-31 20:50:42 +00:00
;--------------------------------
;Reserve Files
;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)
!insertmacro MUI_RESERVEFILE_LANGDLL
;--------------------------------
;Utility Functions
2005-11-12 07:14:55 +00:00
!ifdef ASSOCIATE_SMZIP
!define SHCNE_ASSOCCHANGED 0x08000000
!define SHCNF_IDLIST 0
Function RefreshShellIcons
; By jerome tremblay - april 2003
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v \
(${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)'
FunctionEnd
Function un.RefreshShellIcons
; By jerome tremblay - april 2003
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v \
(${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)'
FunctionEnd
!endif
2005-10-31 20:50:42 +00:00
;--------------------------------
;Installer Sections
Section "Main Section" SecMain
; write out uninstaller
SetOutPath "$INSTDIR"
AllowSkipFiles off
SetOverwrite on
2006-05-03 04:50:41 +00:00
!ifdef FULL_INSTALL
2005-10-31 20:50:42 +00:00
WriteUninstaller "$INSTDIR\uninstall.exe"
; add registry entries
2006-02-25 23:41:50 +00:00
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\${PRODUCT_ID}" "" "$INSTDIR"
WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_ID}" "DisplayName" "$(TEXT_IO_REMOVE_ONLY)"
2005-10-31 20:50:42 +00:00
WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_ID}" "UninstallString" '"$INSTDIR\uninstall.exe"'
2006-05-03 04:50:41 +00:00
!endif
2005-10-31 20:50:42 +00:00
2006-05-03 04:50:41 +00:00
!ifdef INSTALL_EXTERNAL_PCKS
2005-11-07 01:22:06 +00:00
; Do this copy before anything else. It's the most likely to fail.
; Possible failure reasons are: scratched CD, user tried to copy the installer but forgot the pcks.
2005-10-31 21:31:46 +00:00
CreateDirectory $INSTDIR\pcks
2006-05-07 09:27:58 +00:00
CopyFiles "$EXEDIR\${PRODUCT_ID}\${PRODUCT_ID}.app\Contents\Resources\pcks\*.pck" $INSTDIR\pcks 650000 ; assume a CD full of data
2006-05-06 03:58:24 +00:00
IfErrors do_error_pck do_no_error_pck
do_error_pck:
2006-04-24 09:24:07 +00:00
MessageBox MB_OK|MB_ICONSTOP "$(TEXT_IO_FATAL_ERROR_COPYING_PCK)"
2005-11-04 02:43:22 +00:00
Quit
2006-05-06 03:58:24 +00:00
do_no_error_pck:
2005-11-07 01:22:06 +00:00
!endif
2005-10-31 21:31:46 +00:00
2005-11-12 07:14:55 +00:00
!ifdef ASSOCIATE_SMZIP
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Classes\Applications\tools.exe\shell\open\command" "" '"$INSTDIR\Program\tools.exe" "%1"'
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Classes\smzipfile" "" "$(TEXT_IO_SMZIP_PACKAGE)"
2005-11-12 07:14:55 +00:00
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Classes\smzipfile\DefaultIcon" "" "$INSTDIR\Program\tools.exe,0"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Classes\smzipfile\shell\open\command" "" '"$INSTDIR\Program\tools.exe" "%1"'
2005-10-31 20:50:42 +00:00
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Classes\.smzip" "" "smzipfile"
2005-11-04 02:43:22 +00:00
!endif
2005-10-31 20:50:42 +00:00
2006-05-03 04:50:41 +00:00
!ifdef INSTALL_NON_PCK_FILES
2005-10-31 20:50:42 +00:00
CreateDirectory "$INSTDIR\Announcers"
SetOutPath "$INSTDIR\Announcers"
File "Announcers\instructions.txt"
CreateDirectory "$INSTDIR\BGAnimations"
SetOutPath "$INSTDIR\BGAnimations"
File "BGAnimations\instructions.txt"
CreateDirectory "$INSTDIR\CDTitles"
SetOutPath "$INSTDIR\CDTitles"
File "CDTitles\Instructions.txt"
RMDir /r "$INSTDIR\Characters\default"
CreateDirectory "$INSTDIR\Characters\default"
SetOutPath "$INSTDIR\Characters"
2006-05-29 21:49:58 +00:00
File /r /x CVS /x .svn "Characters\default"
2005-10-31 20:50:42 +00:00
# File "Characters\instructions.txt"
CreateDirectory "$INSTDIR\Courses"
SetOutPath "$INSTDIR\Courses"
File "Courses\instructions.txt"
2006-05-29 21:49:58 +00:00
File /r /x CVS /x .svn "Courses\Samples"
2005-10-31 20:50:42 +00:00
CreateDirectory "$INSTDIR\Packages"
File "Packages\Instructions.txt"
RMDir /r "$INSTDIR\NoteSkins\common\default"
RMDir /r "$INSTDIR\NoteSkins\dance\MAX"
RMDir /r "$INSTDIR\NoteSkins\dance\default"
RMDir /r "$INSTDIR\NoteSkins\dance\flat"
RMDir /r "$INSTDIR\NoteSkins\dance\note"
RMDir /r "$INSTDIR\NoteSkins\dance\solo"
SetOutPath "$INSTDIR\NoteSkins"
File "NoteSkins\instructions.txt"
SetOutPath "$INSTDIR\NoteSkins\common"
2006-05-29 21:49:58 +00:00
File /r /x CVS /x .svn "NoteSkins\common\default"
2005-10-31 20:50:42 +00:00
SetOutPath "$INSTDIR\NoteSkins\dance"
2006-05-29 21:49:58 +00:00
File /r /x CVS /x .svn "NoteSkins\dance\default"
File /r /x CVS /x .svn "NoteSkins\dance\flat"
File /r /x CVS /x .svn "NoteSkins\dance\note"
File /r /x CVS /x .svn "NoteSkins\dance\solo"
2005-10-31 20:50:42 +00:00
SetOutPath "$INSTDIR\NoteSkins\pump"
2006-05-29 21:49:58 +00:00
File /r /x CVS /x .svn "NoteSkins\pump\Classic" ; what the heck, they're tiny
File /r /x CVS /x .svn "NoteSkins\pump\default"
2005-10-31 20:50:42 +00:00
SetOutPath "$INSTDIR\NoteSkins\para"
2006-05-29 21:49:58 +00:00
File /r /x CVS /x .svn "NoteSkins\para\default"
2005-10-31 20:50:42 +00:00
; temporarily disabled--noteskin needs updating
;SetOutPath "$INSTDIR\NoteSkins\ez2"
2006-05-29 21:49:58 +00:00
;File /r /x CVS /x .svn "NoteSkins\ez2\original"
2005-10-31 20:50:42 +00:00
;SetOutPath "$INSTDIR\NoteSkins\para"
2006-05-29 21:49:58 +00:00
;File /r /x CVS /x .svn "NoteSkins\para\original"
2005-10-31 20:50:42 +00:00
SetOutPath "$INSTDIR"
CreateDirectory "$INSTDIR\BackgroundEffects"
2006-05-29 21:49:58 +00:00
File /r /x CVS /x .svn "BackgroundEffects"
2005-10-31 20:50:42 +00:00
CreateDirectory "$INSTDIR\BackgroundTransitions"
2006-05-29 21:49:58 +00:00
File /r /x CVS /x .svn "BackgroundTransitions"
2005-10-31 20:50:42 +00:00
CreateDirectory "$INSTDIR\RandomMovies"
SetOutPath "$INSTDIR\RandomMovies"
File "RandomMovies\instructions.txt"
CreateDirectory "$INSTDIR\Songs"
SetOutPath "$INSTDIR\Songs"
File "Songs\Instructions.txt"
RMDir /r "$INSTDIR\Themes\default"
CreateDirectory "$INSTDIR\Themes"
SetOutPath "$INSTDIR\Themes"
File "Themes\instructions.txt"
2006-05-29 21:49:58 +00:00
File /r /x CVS /x .svn "Themes\default"
2005-10-31 20:50:42 +00:00
CreateDirectory "$INSTDIR\Data"
SetOutPath "$INSTDIR\Data"
2005-11-07 01:22:06 +00:00
File "Data\*.*"
!endif
2005-11-04 02:43:22 +00:00
2006-05-03 04:50:41 +00:00
!ifdef INSTALL_INTERNAL_PCKS
2005-11-07 01:22:06 +00:00
CreateDirectory "$INSTDIR\pcks"
SetOutPath "$INSTDIR\pcks"
File "pcks\*.*"
2005-10-31 21:31:46 +00:00
!endif
2005-10-31 20:50:42 +00:00
2005-10-31 21:31:46 +00:00
SetOutPath "$INSTDIR\Program"
2006-02-26 00:12:29 +00:00
File "Program\${PRODUCT_FAMILY}.exe"
File "Program\${PRODUCT_FAMILY}.vdi"
2005-11-12 07:14:55 +00:00
File "Program\tools.exe"
!ifdef ASSOCIATE_SMZIP
Call RefreshShellIcons
2005-11-04 02:43:22 +00:00
!endif
!ifdef FULL_INSTALL
2006-05-03 04:50:41 +00:00
File "Program\mfc71.dll"
2005-10-31 21:31:46 +00:00
File "Program\msvcr71.dll"
File "Program\msvcp71.dll"
File "Program\jpeg.dll"
File "Program\avcodec.dll"
File "Program\avformat.dll"
File "Program\dbghelp.dll"
File "Program\zlib1.dll"
2006-02-26 00:46:10 +00:00
SetOutPath "$INSTDIR"
File "Docs\Licenses.txt"
CreateDirectory "$INSTDIR\Manual"
SetOutPath "$INSTDIR\Manual"
2006-05-29 21:49:58 +00:00
File /r /x CVS /x .svn /x _* /x desktop.ini "Manual\*.*"
2006-02-26 00:46:10 +00:00
2005-10-31 20:50:42 +00:00
; Create Start Menu icons
SetShellVarContext current # 'all' doesn't work on Win9x
CreateDirectory "$SMPROGRAMS\${PRODUCT_ID}\"
CreateShortCut "$DESKTOP\$(TEXT_IO_RUN).lnk" "$INSTDIR\Program\${PRODUCT_FAMILY}.exe"
CreateShortCut "$SMPROGRAMS\${PRODUCT_ID}\$(TEXT_IO_RUN).lnk" "$INSTDIR\Program\${PRODUCT_FAMILY}.exe"
2006-05-03 04:50:41 +00:00
!ifdef MAKE_OPEN_PROGRAM_FOLDER_SHORTCUT
CreateShortCut "$SMPROGRAMS\${PRODUCT_ID}\$(TEXT_IO_OPEN_PROGRAM_FOLDER).lnk" "$WINDIR\explorer.exe" "$INSTDIR\"
!endif
CreateShortCut "$SMPROGRAMS\${PRODUCT_ID}\$(TEXT_IO_VIEW_STATISTICS).lnk" "$INSTDIR\Program\tools.exe" "--machine-profile-stats"
CreateShortCut "$SMPROGRAMS\${PRODUCT_ID}\$(TEXT_IO_TOOLS).lnk" "$INSTDIR\Program\tools.exe"
CreateShortCut "$SMPROGRAMS\${PRODUCT_ID}\$(TEXT_IO_MANUAL).lnk" "$INSTDIR\Manual\index.html"
CreateShortCut "$SMPROGRAMS\${PRODUCT_ID}\$(TEXT_IO_UNINSTALL).lnk" "$INSTDIR\uninstall.exe"
CreateShortCut "$SMPROGRAMS\${PRODUCT_ID}\$(TEXT_IO_WEB_SITE).lnk" "${PRODUCT_URL}"
!ifdef MAKE_UPDATES_SHORTCUT
CreateShortCut "$SMPROGRAMS\${PRODUCT_ID}\$(TEXT_IO_CHECK_FOR_UPDATES).lnk" "${UPDATES_URL}"
!endif
2005-10-31 20:50:42 +00:00
2006-02-26 00:12:29 +00:00
CreateShortCut "$INSTDIR\${PRODUCT_ID}.lnk" "$INSTDIR\Program\${PRODUCT_FAMILY}.exe"
2006-05-03 04:50:41 +00:00
!endif
2005-10-31 20:50:42 +00:00
2006-04-24 09:24:07 +00:00
IfErrors do_error do_no_error
do_error:
MessageBox MB_OK|MB_ICONSTOP "$(TEXT_IO_FATAL_ERROR_INSTALL)"
Quit
do_no_error:
2005-10-31 20:50:42 +00:00
Exec '$WINDIR\explorer.exe "$SMPROGRAMS\${PRODUCT_ID}\"'
SectionEnd
;--------------------------------
;Installer Functions
2002-08-23 20:06:23 +00:00
2005-11-07 01:26:36 +00:00
!ifdef SHOW_AUTORUN
2005-11-01 18:01:41 +00:00
Var hwnd ; Window handle of the custom page
2006-05-03 04:50:41 +00:00
Function ShowAutorun
2005-11-01 18:01:41 +00:00
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\custom.ini"
; In this mode InstallOptions returns the window handle so we can use it
Pop $hwnd
GetDlgItem $1 $HWNDPARENT 1 ; Next button
ShowWindow $1 0
StrCpy $R1 "$INSTDIR\uninst.exe"
StrCpy $R2 "_="
IfFileExists "$R1" uninstall_available
StrCpy $R1 "$INSTDIR\uninstall.exe"
StrCpy $R2 "_?="
IfFileExists "$R1" uninstall_available
GetDlgItem $1 $hwnd 1201 ; Second cutom control
ShowWindow $1 0
GetDlgItem $1 $hwnd 1202 ; Third cutom control
ShowWindow $1 0
Goto uninstall_done
uninstall_available:
GetDlgItem $1 $hwnd 1200 ; First cutom control
ShowWindow $1 0
uninstall_done:
; Now show the dialog and wait for it to finish
InstallOptions::show
; Finally fetch the InstallOptions status value (we don't care what it is though)
Pop $0
FunctionEnd
2006-05-03 04:50:41 +00:00
Function LeaveAutorun
2005-11-01 18:01:41 +00:00
; At this point the user has either pressed Next or one of our custom buttons
; We find out which by reading from the INI file
ReadINIStr $0 "$PLUGINSDIR\custom.ini" "Settings" "State"
StrCmp $0 1 install
StrCmp $0 2 play
StrCmp $0 3 install
Goto proceed
install:
Call PreInstall
GoTo proceed
play:
2006-02-26 00:12:29 +00:00
Exec "$INSTDIR\Program\${PRODUCT_FAMILY}.exe"
2005-11-01 18:01:41 +00:00
IfErrors play_error
quit
play_error:
MessageBox MB_ICONEXCLAMATION "$(TEXT_IO_COULD_NOT_EXECUTE)"
2005-11-01 18:01:41 +00:00
abort
proceed:
GetDlgItem $1 $HWNDPARENT 1 ; Next button
ShowWindow $1 1
FunctionEnd
2005-11-07 01:26:36 +00:00
!endif
2005-11-01 18:01:41 +00:00
Function PreInstall
!ifdef FULL_INSTALL
2006-05-03 04:50:41 +00:00
; force uninstall of previous version using NSIS
; We need to wait until the uninstaller finishes before continuing, since it's possible
; to click the next button again before the uninstaller's window appears and takes focus.
; This is tricky: we can't just ExecWait the uninstaller, since it copies off the uninstaller
; EXE and exec's that (otherwise it couldn't delete itself), so it appears to exit immediately.
; We need to copy it off ourself, run it with the hidden parameter to tell it it's a copy,
; and then delete the copy ourself. There's one more trick: the hidden parameter changed
; between NSIS 1 and 2: in 1.x it was _=C:\Foo, in 2.x it's _?=C:\Foo. Rename the installer
; for newer versions, so we can tell the difference: "uninst.exe" is the old 1.x uninstaller,
; "uninstall.exe" is 2.x.
StrCpy $R1 "$INSTDIR\uninst.exe"
StrCpy $R2 "_="
IfFileExists "$R1" prompt_uninstall_nsis
StrCpy $R1 "$INSTDIR\uninstall.exe"
StrCpy $R2 "_?="
IfFileExists "$R1" prompt_uninstall_nsis old_nsis_not_installed
2006-05-03 04:50:41 +00:00
prompt_uninstall_nsis:
MessageBox MB_YESNO|MB_ICONINFORMATION "$(TEXT_IO_UNINSTALL_PREVIOUS)" IDYES do_uninstall_nsis
Abort
2006-05-03 04:50:41 +00:00
do_uninstall_nsis:
GetTempFileName $R3
CopyFiles /SILENT $R1 $R3
ExecWait '$R3 $R2$INSTDIR' $R4
; Delete the copy of the installer.
Delete $R3
2006-05-03 04:50:41 +00:00
; $R4 is the exit value of the uninstaller. 0 means success, anything else is
; failure (eg. aborted).
IntCmp $R4 0 old_nsis_not_installed ; jump if 0
2006-05-03 04:50:41 +00:00
MessageBox MB_YESNO|MB_DEFBUTTON2|MB_ICONINFORMATION "$(TEXT_IO_UNINSTALL_FAILED_INSTALL_ANYWAY)" IDYES old_nsis_not_installed
Abort
2006-05-03 04:50:41 +00:00
old_nsis_not_installed:
2006-05-03 04:50:41 +00:00
; Check for DirectX 8.0 (to be moved to the right section later)
; We only use this for sound. Actually, I could probably make the sound
; work with an earlier one; I'm not sure if that's needed or not. For one
; thing, forcing people to upgrade drivers is somewhat of a good thing;
; but upgrading to DX8 if you really don't have to is also somewhat
; annoying, too ... -g
ReadRegStr $0 HKEY_LOCAL_MACHINE "Software\Microsoft\DirectX" "Version"
StrCpy $1 $0 2 2 ; 8.1 is "4.08.01.0810"
IntCmpU $1 8 check_subversion old_dx ok
check_subversion:
StrCpy $1 $0 2 5
IntCmpU $1 0 ok old_dx ok
2002-08-23 20:06:23 +00:00
2006-05-03 04:50:41 +00:00
; We can function without it (using WaveOut), so don't *require* this.
old_dx:
!ifdef DIRECTX_81_REDIST_PRESENT
MessageBox MB_YESNO|MB_ICONINFORMATION "$(TEXT_IO_INSTALL_DIRECTX)" IDNO ok
Exec "DirectX81\dxsetup.exe"
quit
ok:
!else
MessageBox MB_YESNO|MB_ICONINFORMATION "$(TEXT_IO_DIRECTX_VISIT_MICROSOFT)" IDNO ok
ExecShell "" "http://www.microsoft.com/directx/"
Abort
ok:
!endif
!else
; Check that full version is installed.
IfFileExists "$INSTDIR\Program\${PRODUCT_FAMILY}.exe" proceed_with_patch
MessageBox MB_YESNO|MB_ICONINFORMATION "$(TEXT_IO_FULL_INSTALL_NOT_FOUND)" IDYES proceed_with_patch
Abort
proceed_with_patch:
2005-11-04 02:43:22 +00:00
!endif
2002-08-23 20:06:23 +00:00
FunctionEnd
2005-11-01 18:01:41 +00:00
Function .onInit
2005-11-02 08:51:29 +00:00
; Force show language selection for debugging
;!define MUI_LANGDLL_ALWAYSSHOW
!insertmacro MUI_LANGDLL_DISPLAY
2005-11-01 18:01:41 +00:00
!ifdef SHOW_AUTORUN
;
; Extract files for the InstallOptions page
;
!insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "Installer\custom.ini" "custom.ini"
;$PLUGINSDIR will automatically be removed when the installer closes
InitPluginsDir
2005-11-02 08:51:29 +00:00
WriteINIStr $PLUGINSDIR\custom.ini "Field 1" "Text" "$(TEXT_IO_INSTALL)"
WriteINIStr $PLUGINSDIR\custom.ini "Field 2" "Text" "$(TEXT_IO_PLAY)"
WriteINIStr $PLUGINSDIR\custom.ini "Field 3" "Text" "$(TEXT_IO_REINSTALL)"
2005-11-01 18:01:41 +00:00
WriteINIStr $PLUGINSDIR\custom.ini "Field 4" "Text" "${PRODUCT_URL}"
WriteINIStr $PLUGINSDIR\custom.ini "Field 4" "State" "${PRODUCT_URL}"
File /oname=$PLUGINSDIR\image.bmp "Installer\custom.bmp"
WriteINIStr $PLUGINSDIR\custom.ini "Field 5" "Text" $PLUGINSDIR\image.bmp
!else
2006-05-03 04:50:41 +00:00
2005-11-01 18:01:41 +00:00
call PreInstall
!endif
FunctionEnd
2005-10-31 20:50:42 +00:00
;--------------------------------
;Uninstaller Section
2002-08-23 20:06:23 +00:00
2005-10-31 20:50:42 +00:00
Section "Uninstall"
2005-10-31 20:50:42 +00:00
; add delete commands to delete whatever files/registry keys/etc you installed here.
2006-02-25 23:41:50 +00:00
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\${PRODUCT_ID}"
2005-10-31 20:50:42 +00:00
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_ID}"
2002-08-23 20:06:23 +00:00
2006-05-03 04:50:41 +00:00
!ifdef INSTALL_EXTERNAL_PCKS | INSTALL_INTERNAL_PCKS
2005-10-31 21:31:46 +00:00
RMDir /r "$INSTDIR\pcks"
2005-11-07 01:22:06 +00:00
!endif
2005-10-31 21:31:46 +00:00
2005-11-12 07:14:55 +00:00
!ifdef ASSOCIATE_SMZIP
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Classes\Applications\tools.exe\shell\open\command"
2005-10-31 20:50:42 +00:00
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Classes\smzipfile"
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Classes\.smzip"
2005-11-04 02:43:22 +00:00
!endif
2002-08-23 20:06:23 +00:00
2006-05-03 04:50:41 +00:00
!ifdef INSTALL_NON_PCK_FILES
2005-10-31 20:50:42 +00:00
Delete "$INSTDIR\Announcers\instructions.txt"
RMDir "$INSTDIR\Announcers"
2002-08-23 20:06:23 +00:00
2005-10-31 20:50:42 +00:00
Delete "$INSTDIR\BGAnimations\instructions.txt"
RMDir "$INSTDIR\BGAnimations"
2003-04-12 06:16:12 +00:00
2005-11-07 01:22:06 +00:00
RMDir /r "$INSTDIR\Cache"
2002-08-23 20:06:23 +00:00
2005-10-31 20:50:42 +00:00
Delete "$INSTDIR\CDTitles\Instructions.txt"
RMDir "$INSTDIR\CDTitles"
2003-12-10 08:44:13 +00:00
2005-10-31 20:50:42 +00:00
RMDir /r "$INSTDIR\Characters\default"
RMDir "$INSTDIR\Characters"
2005-10-31 20:50:42 +00:00
RMDir /r "$INSTDIR\Cache"
2005-10-31 20:50:42 +00:00
Delete "$INSTDIR\Packages\instructions.txt"
RMDir "$INSTDIR\Packages"
2005-10-31 20:50:42 +00:00
Delete "$INSTDIR\Courses\instructions.txt"
RMDir /r "$INSTDIR\Courses\Samples"
RMDir "$INSTDIR\Courses"
2003-01-19 06:29:25 +00:00
2005-10-31 20:50:42 +00:00
Delete "$INSTDIR\NoteSkins\instructions.txt"
RMDir /r "$INSTDIR\NoteSkins\common\default"
RMDir "$INSTDIR\NoteSkins\common"
RMDir /r "$INSTDIR\NoteSkins\dance\default"
RMDir /r "$INSTDIR\NoteSkins\dance\flat"
RMDir /r "$INSTDIR\NoteSkins\dance\note"
RMDir /r "$INSTDIR\NoteSkins\dance\solo"
RMDir "$INSTDIR\NoteSkins\dance"
RMDir /r "$INSTDIR\NoteSkins\pump\classic"
RMDir /r "$INSTDIR\NoteSkins\pump\default"
RMDir "$INSTDIR\NoteSkins\pump"
RMDir /r "$INSTDIR\NoteSkins\para\default"
2005-10-31 20:50:42 +00:00
RMDir "$INSTDIR\NoteSkins\para"
RMDir "$INSTDIR\NoteSkins"
2003-01-19 06:29:25 +00:00
2006-02-25 23:13:44 +00:00
RMDir /r "$INSTDIR\BackgroundEffects"
RMDir /r "$INSTDIR\BackgroundTransitions"
2005-10-31 20:50:42 +00:00
Delete "$INSTDIR\RandomMovies\instructions.txt"
RMDir "$INSTDIR\RandomMovies"
2003-01-19 06:29:25 +00:00
2005-10-31 20:50:42 +00:00
Delete "$INSTDIR\Songs\Instructions.txt"
RMDir "$INSTDIR\Songs" ; will delete only if empty
2005-10-31 20:50:42 +00:00
Delete "$INSTDIR\Themes\instructions.txt"
RMDir /r "$INSTDIR\Themes\default"
RMDir "$INSTDIR\Themes"
2005-06-20 04:39:55 +00:00
2005-11-07 01:22:06 +00:00
Delete "$INSTDIR\Data\*.*"
2005-10-31 20:50:42 +00:00
RMDir "$INSTDIR\Data"
2005-10-31 21:31:46 +00:00
!endif
2006-02-26 00:12:29 +00:00
Delete "$INSTDIR\Program\${PRODUCT_FAMILY}.exe"
2005-11-12 07:14:55 +00:00
Delete "$INSTDIR\Program\tools.exe"
2005-11-08 23:54:58 +00:00
Delete "$INSTDIR\Program\mfc71.dll"
2005-11-12 07:14:55 +00:00
!ifdef ASSOCIATE_SMZIP
Call un.RefreshShellIcons
2005-11-04 02:43:22 +00:00
!endif
2006-02-26 00:12:29 +00:00
Delete "$INSTDIR\Program\${PRODUCT_FAMILY}.vdi"
!ifdef FULL_INSTALL
2006-05-03 04:50:41 +00:00
Delete "$INSTDIR\Program\mfc71.dll"
2005-10-31 21:31:46 +00:00
Delete "$INSTDIR\Program\msvcr71.dll"
Delete "$INSTDIR\Program\msvcp71.dll"
2005-10-31 20:50:42 +00:00
Delete "$INSTDIR\Program\jpeg.dll"
Delete "$INSTDIR\Program\avcodec.dll"
Delete "$INSTDIR\Program\avformat.dll"
Delete "$INSTDIR\Program\dbghelp.dll"
Delete "$INSTDIR\Program\zlib1.dll"
RMDir "$INSTDIR\Program"
2002-08-23 20:06:23 +00:00
Delete "$INSTDIR\Licenses.txt"
2006-02-26 00:46:10 +00:00
RMDir /r "$INSTDIR\Manual"
2006-05-03 04:50:41 +00:00
!endif
2005-10-31 20:50:42 +00:00
Delete "$INSTDIR\log.txt"
Delete "$INSTDIR\info.txt"
Delete "$INSTDIR\crashinfo.txt"
2006-02-26 00:12:29 +00:00
Delete "$INSTDIR\${PRODUCT_ID}.lnk"
2003-04-19 17:53:10 +00:00
2005-10-31 20:50:42 +00:00
RMDir "$INSTDIR" ; will delete only if empty
2002-12-20 19:55:15 +00:00
2005-10-31 20:50:42 +00:00
SetShellVarContext current
Delete "$DESKTOP\Play StepMania CVS.lnk"
2006-05-03 04:50:41 +00:00
Delete "$DESKTOP\${PRODUCT_DISPLAY}.lnk"
2005-10-31 20:50:42 +00:00
; I'm being paranoid here:
Delete "$SMPROGRAMS\${PRODUCT_ID}\*.*"
RMDir "$SMPROGRAMS\${PRODUCT_ID}"
2005-10-31 20:50:42 +00:00
Delete "$INSTDIR\Uninstall.exe"
2006-02-26 00:12:29 +00:00
DeleteRegKey /ifempty HKEY_LOCAL_MACHINE "SOFTWARE\${PRODUCT_ID}"
2005-10-31 20:50:42 +00:00
SectionEnd
2005-10-31 20:50:42 +00:00
;--------------------------------
;Uninstaller Functions
2005-10-31 20:50:42 +00:00
Function un.onInit
2003-12-12 08:53:44 +00:00
2005-10-31 20:50:42 +00:00
!insertmacro MUI_UNGETLANGUAGE
2005-12-23 02:02:04 +00:00
FunctionEnd