NSIS Installer:

* Added Visual Studio 2010 Redistributables to the installer package.
 * Added some component descriptions. :)
 * Separated several things into nsh header files for organizational purposes


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3031 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2010-05-17 04:52:31 +00:00
parent 9c9769c380
commit b6bc57b9e6
6 changed files with 370 additions and 232 deletions

13
nsis/ApplyExeProps.nsh Normal file
View File

@ -0,0 +1,13 @@
; =======================================================================
; Setup.exe Properties
; =======================================================================
; (for the professionalism!!)
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "${APP_NAME}"
;VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "A test comment"
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© 2010 PCSX2 Dev Team"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Installs PCSX2, a Playstation 2 Emulator for the PC"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${APP_VERSION}.${SVNREV}"
VIProductVersion "${APP_VERSION}.${SVNREV}"

83
nsis/SectionCoreReqs.nsh Normal file
View File

@ -0,0 +1,83 @@
; --- UAC NIGHTMARES ---
; Ideally this would default to 'current' for user-level installs and 'all' for admin-level installs.
; There are problems to be aware of, however!
;
; * If the user is an admin, Windows Vista/7 will DEFAULT to an "all" shell context (installing shortcuts
; for all users), even if we don't want it to (which causes the uninstaller to fail!)
; * If the user is not an admin, setting Shell Context to all will cause the installer to fail because the
; user won't have permission enough to install it at all (sigh).
;
; For now we just require Admin rights to install PCSX2. An ideal solution would be to use our IsUserAdmin
; function to auto-detect and modify nsis installer behavior accordingly.
;
; (note! the SetShellVarContext use in the uninstaller section must match this one!)
SetShellVarContext all
;SetShellVarContext current
SetOutPath "$INSTDIR"
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
File /oname=${APP_EXE} ..\bin\pcsx2.exe
;File /nonfatal /oname=pcsx2-dev-r${SVNREV}.exe ..\bin\pcsx2-dev.exe
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
; ------------------------------------------
; -- Shared Core Components --
; ------------------------------------------
; (Binaries, shared DLLs, null plugins, game database, languages, etc)
; Note that v3 pthreads is compatible with v4 pthreads, so we just copy v4 oover both
; filenames. This allows many older plugin versions to continue to work. (note that
; v3 will be removed for 0.9.8).
!insertmacro UNINSTALL.LOG_OPEN_INSTALL_SECTION CoreShared
SetOutPath "$INSTDIR"
File ..\bin\w32pthreads.v4.dll
File /oname=w32pthreads.v3.dll ..\bin\w32pthreads.v4.dll
File ..\bin\GameIndex.dbf
; Note: HostFS is not enabled by default, so no need to bundle it yet
;File ..\bin\pcsx2hostfs_ldr.elf
SetOutPath "$INSTDIR\Plugins"
; NULL plugins are required, because the PCSX2 plugin selector needs a dummy plugin in every slot
; in order to run (including CDVD!) -- and really there should be more but we don't have working
; SPU2 null plugins right now.
File ..\bin\Plugins\GSnull.dll
;File ..\bin\Plugins\SPU2null.dll
File ..\bin\Plugins\USBnull.dll
File ..\bin\Plugins\DEV9null.dll
File ..\bin\Plugins\FWnull.dll
File ..\bin\Plugins\CDVDnull.dll
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL_SECTION CoreShared
; In 0.9.7 there is only English, so including the other mo files (for now) is pointless.
; This code will be re-enabled when the new GUI is translated.
!if ${INC_LANGS} > 0
SetOutPath $INSTDIR\Langs
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
File /nonfatal /r ..\bin\Langs\*.mo
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
!endif
; ------------------------------------------
; -- Registry Section --
; ------------------------------------------
; Write the installation path into the registry
WriteRegStr HKLM Software\PCSX2 "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "${INSTDIR_REG_KEY}" "DisplayName" "PCSX2 - Playstation 2 Emulator"
WriteRegStr HKLM "${INSTDIR_REG_KEY}" "UninstallString" "${UNINST_EXE}"
WriteRegDWORD HKLM "${INSTDIR_REG_KEY}" "NoModify" 1
WriteRegDWORD HKLM "${INSTDIR_REG_KEY}" "NoRepair" 1
WriteUninstaller "${UNINST_EXE}"

114
nsis/SharedRedtape.nsh Normal file
View File

@ -0,0 +1,114 @@
; =======================================================================
; Plugin Includes
; =======================================================================
; Note that zzOgl is disabled for now because it requires CG dependencies to be installed.
!if ${INC_PLUGINS} > 0
!system 'SubWCRev.exe ..\plugins\gsdx templates\svnrev_gsdx.nsh svnrev_gsdx.nsh'
!system 'SubWCRev.exe ..\plugins\spu2-x templates\svnrev_spu2x.nsh svnrev_spu2x.nsh'
!system 'SubWCRev.exe ..\plugins\cdvdiso templates\svnrev_cdvdiso.nsh svnrev_cdvdiso.nsh'
!system 'SubWCRev.exe ..\plugins\lilypad templates\svnrev_lilypad.nsh svnrev_lilypad.nsh'
!system 'SubWCRev.exe ..\plugins\zerogs\dx templates\svnrev_zerogs.nsh svnrev_zerogs.nsh'
;!system 'SubWCRev.exe ..\plugins\zzogl-pg templates\svnrev_zzogl.nsh svnrev_zzogl.nsh'
!system 'SubWCRev.exe ..\plugins\zerospu2 templates\svnrev_zerospu2.nsh svnrev_zerospu2.nsh'
!include "svnrev_gsdx.nsh"
!include "svnrev_spu2x.nsh"
!include "svnrev_cdvdiso.nsh"
!include "svnrev_lilypad.nsh"
!include "svnrev_zerogs.nsh"
;!include "svnrev_zzogl.nsh"
!include "svnrev_zerospu2.nsh"
!endif
; =======================================================================
; Shared Install Functions
; =======================================================================
; ==================================================================================
Function .onInit
;prepare Advanced Uninstall log always within .onInit function
!insertmacro UNINSTALL.LOG_PREPARE_INSTALL
; MORE UAC HELL ---------- >
call IsUserAdmin
FunctionEnd
Function .onInstSuccess
;create/update log always within .onInstSuccess function
!insertmacro UNINSTALL.LOG_UPDATE_INSTALL
FunctionEnd
; =======================================================================
; Shared Uninstall Functions
; =======================================================================
; Safe directory deletion code. :)
;
Function un.DeleteDirIfEmpty
; Use $TEMP as the out dir when removing directories, since NSIS won't let us remove the
; "current" directory.
SetOutPath "$TEMP"
FindFirst $R0 $R1 "$0\*.*"
strcmp $R1 "." 0 NoDelete
FindNext $R0 $R1
strcmp $R1 ".." 0 NoDelete
ClearErrors
FindNext $R0 $R1
IfErrors 0 NoDelete
FindClose $R0
Sleep 1000
RMDir "$0"
NoDelete:
FindClose $R0
FunctionEnd
; ==================================================================================
Function un.removeShorties
; Remove shortcuts, if any
Delete "$DESKTOP\${APP_NAME}.lnk"
Delete "$SMPROGRAMS\PCSX2\Uninstall ${APP_NAME}.lnk"
Delete "$SMPROGRAMS\PCSX2\${APP_NAME}.lnk"
;Delete "$SMPROGRAMS\PCSX2\pcsx2-dev-r${SVNREV}.lnk"
StrCpy $0 "$SMPROGRAMS\PCSX2"
Call un.DeleteDirIfEmpty
FunctionEnd
; begin uninstall, could be added on top of uninstall section instead
Function un.onInit
!insertmacro UNINSTALL.LOG_BEGIN_UNINSTALL
FunctionEnd
Function un.onUninstSuccess
!insertmacro UNINSTALL.LOG_END_UNINSTALL
; And remove the various install dir(s) but only if they're clean of user content:
StrCpy $0 "$INSTDIR\langs"
Call un.DeleteDirIfEmpty
StrCpy $0 "$INSTDIR\plugins"
Call un.DeleteDirIfEmpty
StrCpy $0 "$INSTDIR"
Call un.DeleteDirIfEmpty
FunctionEnd

26
nsis/SharedSettings.nsh Normal file
View File

@ -0,0 +1,26 @@
; =======================================================================
; Core Includes and Defines
; =======================================================================
!system 'SubWCRev.exe ..\pcsx2 templates\svnrev_pcsx2.nsh svnrev_pcsx2.nsh'
!include "svnrev_pcsx2.nsh"
!ifndef APP_VERSION
!define APP_VERSION "0.9.7"
!endif
!define APP_NAME "PCSX2 ${APP_VERSION} (r${SVNREV})"
!define APP_FILENAME "pcsx2-r${SVNREV}"
!define UNINSTALL_LOG "Uninst-${APP_FILENAME}"
!define INSTDIR_REG_ROOT "HKLM"
XPStyle on
; LZMA is the best, by far, so let's make sure it's always in use:
; (dictionaries larger than 24MB don't seem to help)
SetCompressor /SOLID lzma
SetCompressorDictSize 24

View File

@ -5,11 +5,17 @@
* Install NSIS (tested with 2.45)
* Install NSIS Script: Advanced Uninstall Log (you can find it on NSIS wiki)
* Download the latest Visual C++ Redistributable (currently 2008 SP1 as of this writing) and
save it to this nsis/ folder.
* Download the Visual C++ 2008 SP1 Redistributable and save it to this nsis/ folder under the name:
vcredist_2008_sp1_x86.exe
* Download the Visual C++ 2010 Redistributable and save it to this nsis/ folder.
vcredist_2010_x86.exe
[both files can be obtained from Microsoft's website, just google for them]
* Download the DirectX Web Installer (vcwebsetup.exe) from Microsoft's website and save it to
this nsis/ folder. (currently required, might be made optional later).
this nsis/ folder. (currently required, might be made optional later). No name change is
required.
* Load the PCSX2 Suite solution and rebuild all in the following targets:
* Release SSE2

View File

@ -5,25 +5,24 @@
; Application version, changed for each release to match the version
; Uncomment this to create a package that includes binaries and binary dependencies only.
!define INC_PLUGINS
!system 'SubWCRev.exe ..\pcsx2 templates\svnrev_pcsx2.nsh svnrev_pcsx2.nsh'
!include "svnrev_pcsx2.nsh"
!ifndef INC_PLUGINS
!define INC_PLUGINS 1
!endif
;LoadLanguageFile "${NSISDIR}\Contrib\Language files\english.nlf"
!ifndef INC_CRT_2008
!define INC_CRT_2008 1
!endif
; =======================================================================
; Global Names and Such
; =======================================================================
!ifndef INC_CRT_2010
!define INC_CRT_2010 1
!endif
!define APP_VERSION "0.9.7"
!define APP_NAME "PCSX2 ${APP_VERSION} (r${SVNREV})"
!define APP_FILENAME "pcsx2-r${SVNREV}"
!define UNINSTALL_LOG "Uninst-${APP_FILENAME}"
!define INSTDIR_REG_ROOT "HKLM"
!ifndef INC_LANGS
!define INC_LANGS 0
!endif
!include "SharedSettings.nsh"
; The name of the installer
Name "${APP_NAME}"
@ -37,13 +36,6 @@ InstallDir "$PROGRAMFILES\PCSX2 ${APP_VERSION}"
; overwrite the old one automatically)
InstallDirRegKey ${INSTDIR_REG_ROOT} "Software\PCSX2" "Install_Dir"
XPStyle on
; LZMA is the best, by far, so let's make sure it's always in use:
; (dictionaries larger than 24MB don't seem to help)
SetCompressor /SOLID lzma
SetCompressorDictSize 24
; These defines are dependent on NSIS vars assigned above.
!define APP_EXE "$INSTDIR\${APP_FILENAME}.exe"
@ -51,33 +43,42 @@ SetCompressorDictSize 24
Var DirectXSetupError
; =======================================================================
; Plugin Includes
; =======================================================================
; Note that zzOgl is disabled for now because it requires CG dependencies to be installed.
!ifdef INC_PLUGINS
!system 'SubWCRev.exe ..\plugins\gsdx templates\svnrev_gsdx.nsh svnrev_gsdx.nsh'
!system 'SubWCRev.exe ..\plugins\spu2-x templates\svnrev_spu2x.nsh svnrev_spu2x.nsh'
!system 'SubWCRev.exe ..\plugins\cdvdiso templates\svnrev_cdvdiso.nsh svnrev_cdvdiso.nsh'
!system 'SubWCRev.exe ..\plugins\lilypad templates\svnrev_lilypad.nsh svnrev_lilypad.nsh'
!system 'SubWCRev.exe ..\plugins\zerogs\dx templates\svnrev_zerogs.nsh svnrev_zerogs.nsh'
;!system 'SubWCRev.exe ..\plugins\zzogl-pg templates\svnrev_zzogl.nsh svnrev_zzogl.nsh'
!system 'SubWCRev.exe ..\plugins\zerospu2 templates\svnrev_zerospu2.nsh svnrev_zerospu2.nsh'
!include "svnrev_gsdx.nsh"
!include "svnrev_spu2x.nsh"
!include "svnrev_cdvdiso.nsh"
!include "svnrev_lilypad.nsh"
!include "svnrev_zerogs.nsh"
;!include "svnrev_zzogl.nsh"
!include "svnrev_zerospu2.nsh"
!endif
!include "MUI2.nsh"
!include "AdvUninstLog.nsh"
; UNINSTALL.LOG_OPEN_INSTALL_SECTION {section_name}
; UNINSTALL.LOG_CLOSE_INSTALL_SECTION {section_name}
;
; Advanced Uninstaller Extension: This allows us to safely log to arbitrary "sections" of
; installation of our choosing, without having to rely on $OUTDIR (which is how the default
; provided LOG_OPEN_INSTALL works). In other words, different files in the same folder can
; be added to different install lists. :)
;
!macro UNINSTALL.LOG_OPEN_INSTALL_SECTION SectionName
!verbose push
!verbose ${UNINST_LOG_VERBOSE}
StrCmp $unlog_error "error" +2
${uninstall.log_install} "${EXCLU_LIST}" "${UNINST_DAT}" "${SectionName}"
!verbose pop
!macroend
!macro UNINSTALL.LOG_CLOSE_INSTALL_SECTION SectionName
!verbose push
!verbose ${UNINST_LOG_VERBOSE}
!define ID ${__LINE__}
${uninstall.log_install} "${UNLOG_PART}${ID}" "${EXCLU_LIST}" "${SectionName}"
${uninstall.log_mergeID} "${UNLOG_PART}${ID}"
!undef ID ${__LINE__}
!verbose pop
!macroend
; =======================================================================
; Vista/Win7 UAC Stuff
; =======================================================================
@ -99,7 +100,8 @@ RequestExecutionLevel admin
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "banner.bmp"
!define MUI_COMPONENTSPAGE_NODESC
;!define MUI_COMPONENTSPAGE_NODESC
!define MUI_COMPONENTSPAGE_SMALLDESC
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
@ -111,18 +113,8 @@ RequestExecutionLevel admin
!insertmacro MUI_LANGUAGE "English"
; =======================================================================
; Setup.exe Properties
; =======================================================================
; (for the professionalism!!)
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "${APP_NAME}"
;VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "A test comment"
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "© 2010 PCSX2 Dev Team"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Installs PCSX2, a Playstation 2 Emulator for the PC"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${APP_VERSION}.${SVNREV}"
VIProductVersion "${APP_VERSION}.${SVNREV}"
!include "ApplyExeProps.nsh"
!include "SharedRedtape.nsh"
; =======================================================================
; Installer Sections
@ -130,121 +122,48 @@ VIProductVersion "${APP_VERSION}.${SVNREV}"
; -----------------------------------------------------------------------
; Basic section (emulation proper)
Section "${APP_NAME} (required)"
Section "!${APP_NAME} (required)" SEC_CORE
SectionIn RO
; --- UAC NIGHTMARES ---
; Ideally this would default to 'current' for user-level installs and 'all' for admin-level installs.
; There are problems to be aware of, however!
;
; * If the user is an admin, Windows Vista/7 will DEFAULT to an "all" shell context (installing shortcuts
; for all users), even if we don't want it to (which causes the uninstaller to fail!)
; * If the user is not an admin, setting Shell Context to all will cause the installer to fail because the
; user won't have permission enough to install it at all (sigh).
;
; For now we just require Admin rights to install PCSX2. An ideal solution would be to use our IsUserAdmin
; function to auto-detect and modify nsis installer behavior accordingly.
;
; (note! the SetShellVarContext use in the uninstaller section must match this one!)
SetShellVarContext all
;SetShellVarContext current
; Note that v3 pthreads is compatible with v4 pthreads, so we just copy v4 oover both
; filenames. This allows many older plugin versions to continue to work. (note that
; v3 will be removed for 0.9.8).
SetOutPath "$INSTDIR"
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
File /oname=${APP_EXE} ..\bin\pcsx2.exe
;File /nonfatal /oname=pcsx2-dev-r${SVNREV}.exe ..\bin\pcsx2-dev.exe
File ..\bin\w32pthreads.v4.dll
File /oname=w32pthreads.v3.dll ..\bin\w32pthreads.v4.dll
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
; ------------------------------------------
; -- Game Database and Languages --
; ------------------------------------------
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
File ..\bin\DataBase.dbf
; HostFS is not enabled by default, so no need to bundle it yet
;File ..\bin\pcsx2hostfs_ldr.elf
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
; In 0.9.7 there is only English, so including the other mo files (for now) is pointless.
; This code will be re-enabled when the new GUI is translated.
!ifdef INC_LANGS
SetOutPath $INSTDIR\Langs
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
File /nonfatal /r ..\bin\Langs\*.mo
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
!endif
!include "SectionCoreReqs.nsh"
; ------------------------------------------
; -- Plugins Section --
; ------------------------------------------
SetOutPath $INSTDIR\Plugins
; NULL plugins are required, and really there should be more but we don't have working
; SPU2 null plugins right now.
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
File ..\bin\Plugins\GSnull.dll
;File ..\bin\Plugins\SPU2null.dll
File ..\bin\Plugins\USBnull.dll
File ..\bin\Plugins\DEV9null.dll
File ..\bin\Plugins\FWnull.dll
File ..\bin\Plugins\CDVDnull.dll
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
!if ${INC_PLUGINS} > 0
; -- Other plugins --
SetOutPath "$INSTDIR\Plugins"
!insertmacro UNINSTALL.LOG_OPEN_INSTALL
!ifdef INC_PLUGINS
File /nonfatal /oname=gsdx-sse2-r${SVNREV_GSDX}.dll ..\bin\Plugins\gsdx-sse2.dll
File /nonfatal /oname=gsdx-ssse3-r${SVNREV_GSDX}.dll ..\bin\Plugins\gsdx-ssse3.dll
File /nonfatal /oname=gsdx-sse4-r${SVNREV_GSDX}.dll ..\bin\Plugins\gsdx-sse4.dll
File /nonfatal /oname=zerogs-r${SVNREV_ZEROGS}.dll ..\bin\Plugins\zerogs.dll
File /nonfatal /oname=gsdx-sse2-r${SVNREV_GSDX}.dll ..\bin\Plugins\gsdx-sse2.dll
File /nonfatal /oname=gsdx-ssse3-r${SVNREV_GSDX}.dll ..\bin\Plugins\gsdx-ssse3.dll
File /nonfatal /oname=gsdx-sse4-r${SVNREV_GSDX}.dll ..\bin\Plugins\gsdx-sse4.dll
File /nonfatal /oname=zerogs-r${SVNREV_ZEROGS}.dll ..\bin\Plugins\zerogs.dll
File /nonfatal /oname=spu2-x-r${SVNREV_SPU2X}.dll ..\bin\Plugins\spu2-x.dll
File /nonfatal /oname=zerospu2-r${SVNREV_ZEROSPU2}.dll ..\bin\Plugins\zerospu2.dll
File /nonfatal /oname=spu2-x-r${SVNREV_SPU2X}.dll ..\bin\Plugins\spu2-x.dll
File /nonfatal /oname=zerospu2-r${SVNREV_ZEROSPU2}.dll ..\bin\Plugins\zerospu2.dll
File /nonfatal /oname=cdvdiso-r${SVNREV_CDVDISO}.dll ..\bin\Plugins\cdvdiso.dll
File ..\bin\Plugins\cdvdGigaherz.dll
File /nonfatal /oname=cdvdiso-r${SVNREV_CDVDISO}.dll ..\bin\Plugins\cdvdiso.dll
File ..\bin\Plugins\cdvdGigaherz.dll
File /nonfatal /oname=lilypad-r${SVNREV_LILYPAD}.dll ..\bin\Plugins\lilypad.dll
File ..\bin\Plugins\PadSSSPSX.dll
File /nonfatal /oname=lilypad-r${SVNREV_LILYPAD}.dll ..\bin\Plugins\lilypad.dll
File ..\bin\Plugins\PadSSSPSX.dll
;File ..\bin\Plugins\FWlinuz.dll
!endif
!insertmacro UNINSTALL.LOG_CLOSE_INSTALL
; ------------------------------------------
; -- Registry Section --
; ------------------------------------------
; Write the installation path into the registry
WriteRegStr HKLM Software\PCSX2 "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "${INSTDIR_REG_KEY}" "DisplayName" "PCSX2 - Playstation 2 Emulator"
WriteRegStr HKLM "${INSTDIR_REG_KEY}" "UninstallString" "${UNINST_EXE}"
WriteRegDWORD HKLM "${INSTDIR_REG_KEY}" "NoModify" 1
WriteRegDWORD HKLM "${INSTDIR_REG_KEY}" "NoRepair" 1
WriteUninstaller "${UNINST_EXE}"
!endif
SectionEnd
; -----------------------------------------------------------------------
; Start Menu - Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"
Section "Start Menu Shortcuts" SEC_STARTMENU
; CreateShortCut gets the working directory from OutPath
; CreateShortCut gets the working directory from OutPath
SetOutPath "$INSTDIR"
CreateDirectory "$SMPROGRAMS\PCSX2"
@ -259,7 +178,7 @@ SectionEnd
; -----------------------------------------------------------------------
; Desktop Icon - Optional section (can be disabled by the user)
Section "Desktop Shortcut"
Section "Desktop Shortcut" SEC_DESKTOP
; CreateShortCut gets the working directory from OutPath
SetOutPath "$INSTDIR"
@ -272,19 +191,56 @@ SectionEnd
; MSVC Redistributable - required if the user does not already have it
; Note: if your NSIS generates an error here it means you need to download the latest
; visual studio redist package from microsoft. Any redist 2008/SP1 or newer will do.
Section "Microsoft Visual C++ 2008 SP1 Redist (required)"
;
; IMPORTANT: Online references for how to detect the presence of the VS2008 redists LIE.
; None of the methods are reliable, because the registry keys placed by the MSI installer
; vary depending on operating system *and* MSI installer version (youch).
;
!if ${INC_CRT_2008} > 0
Section "Microsoft Visual C++ 2008 SP1 Redist (required)" SEC_CRT2008
SectionIn RO
; Downloaded from:
; http://download.microsoft.com/download/d/d/9/dd9a82d0-52ef-40db-8dab-795376989c03/vcredist_x86.exe
SetOutPath "$TEMP"
File "vcredist_x86.exe"
File "vcredist_2008_sp1_x86.exe"
DetailPrint "Running Visual C++ 2008 SP1 Redistributable Setup..."
ExecWait '"$TEMP\vcredist_x86.exe" /qb'
ExecWait '"$TEMP\vcredist_2008_sp1_x86.exe" /qb'
DetailPrint "Finished Visual C++ 2008 SP1 Redistributable Setup"
Delete "$TEMP\vcredist_x86.exe"
Delete "$TEMP\vcredist_2008_sp1_x86.exe"
SectionEnd
!endif
!if ${INC_CRT_2010} > 0
Section "Microsoft Visual C++ 2010 Redist (recommended)" SEC_CRT2010
;SectionIn RO
; Detection made easy: Unlike previous redists, VC2010 now generates a platform
; independent key for checking availability.
; Downloaded from:
; http://download.microsoft.com/download/5/B/C/5BC5DBB3-652D-4DCE-B14A-475AB85EEF6E/vcredist_x86.exe
ReadRegDword $R0 HKLM "SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x86" "Installed"
IfErrors done
StrCmp $R0 "1" done
SetOutPath "$TEMP"
File "vcredist_2010_x86.exe"
DetailPrint "Running Visual C++ 2010 SP1 Redistributable Setup..."
ExecWait '"$TEMP\vcredist_2010_x86.exe" /qb'
DetailPrint "Finished Visual C++ 2010 SP1 Redistributable Setup"
Delete "$TEMP\vcredist_2010_x86.exe"
done:
SectionEnd
!endif
; -----------------------------------------------------------------------
; This section needs to be last, so that in case it fails, the rest of the program will
@ -293,9 +249,9 @@ SectionEnd
; This section could be optional, but why not? It's pretty painless to double-check that
; all the libraries are up-to-date.
;
Section "DirectX Web Setup (required)" SEC_DIRECTX
Section "DirectX Web Setup (recommended)" SEC_DIRECTX
SectionIn RO
;SectionIn RO
SetOutPath "$TEMP"
File "dxwebsetup.exe"
@ -307,67 +263,10 @@ Section "DirectX Web Setup (required)" SEC_DIRECTX
SectionEnd
;--------------------------------
Function .onInit
;prepare Advanced Uninstall log always within .onInit function
!insertmacro UNINSTALL.LOG_PREPARE_INSTALL
; MORE UAC HELL ---------- >
call IsUserAdmin
FunctionEnd
Function .onInstSuccess
;create/update log always within .onInstSuccess function
!insertmacro UNINSTALL.LOG_UPDATE_INSTALL
FunctionEnd
; =======================================================================
; Un.Installer Sections
; =======================================================================
; Safe directory deletion code. :)
;
Function un.DeleteDirIfEmpty
; Use $TEMP as the out dir when removing directories, since NSIS won't let us remove the
; "current" directory.
SetOutPath "$TEMP"
FindFirst $R0 $R1 "$0\*.*"
strcmp $R1 "." 0 NoDelete
FindNext $R0 $R1
strcmp $R1 ".." 0 NoDelete
ClearErrors
FindNext $R0 $R1
IfErrors 0 NoDelete
FindClose $R0
Sleep 1000
RMDir "$0"
NoDelete:
FindClose $R0
FunctionEnd
Function un.removeShorties
; Remove shortcuts, if any
Delete "$DESKTOP\${APP_NAME}.lnk"
Delete "$SMPROGRAMS\PCSX2\Uninstall ${APP_NAME}.lnk"
Delete "$SMPROGRAMS\PCSX2\${APP_NAME}.lnk"
;Delete "$SMPROGRAMS\PCSX2\pcsx2-dev-r${SVNREV}.lnk"
StrCpy $0 "$SMPROGRAMS\PCSX2"
Call un.DeleteDirIfEmpty
FunctionEnd
; -----------------------------------------------------------------------
Section "Un.Core Executables ${APP_NAME}"
@ -400,24 +299,21 @@ Section "Un.Shared Components (DLLs, Languages, etc)"
SectionEnd
; begin uninstall, could be added on top of uninstall section instead
Function un.onInit
!insertmacro UNINSTALL.LOG_BEGIN_UNINSTALL
FunctionEnd
LangString DESC_CORE ${LANG_ENGLISH} "Core components (binaries, plugins, languages, etc)."
LangString DESC_STARTMENU ${LANG_ENGLISH} "Adds shortcuts for PCSX2 to the start menu (all users)."
LangString DESC_DESKTOP ${LANG_ENGLISH} "Adds a shortcut for PCSX2 to the desktop (all users)."
Function un.onUninstSuccess
!insertmacro UNINSTALL.LOG_END_UNINSTALL
LangString DESC_CRT2008 ${LANG_ENGLISH} "The 2008 Redist is required by the PCSX2 binaries packaged in this installer."
LangString DESC_CRT2010 ${LANG_ENGLISH} "The 2010 Redist will be used by future PCSX2 plugins and updates, but is not (yet) necessary."
LangString DESC_DIRECTX ${LANG_ENGLISH} "Only uncheck this if you are quite certain your Direct3D runtimes are up to date."
; And remove the various install dir(s) but only if they're clean of user content:
StrCpy $0 "$INSTDIR\langs"
Call un.DeleteDirIfEmpty
StrCpy $0 "$INSTDIR\plugins"
Call un.DeleteDirIfEmpty
StrCpy $0 "$INSTDIR"
Call un.DeleteDirIfEmpty
FunctionEnd
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_CORE} $(DESC_CORE)
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_STARTMENU} $(DESC_STARTMENU)
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_DESKTOP} $(DESC_DESKTOP)
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_CRT2008} $(DESC_CRT2008)
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_CRT2010} $(DESC_CRT2010)
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_DIRECTX} $(DESC_DIRECTX)
!insertmacro MUI_FUNCTION_DESCRIPTION_END