/[pcsx2_0.9.7]/trunk/nsis/pcsx2_web_install.nsi
ViewVC logotype

Annotation of /trunk/nsis/pcsx2_web_install.nsi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (hide annotations) (download)
Tue Sep 7 03:24:11 2010 UTC (9 years, 4 months ago) by william
File size: 14665 byte(s)
committing r3113 initial commit again...
1 william 31
2     ; PCSX2 Web-based Install Package!
3     ; (a NSIS installer script)
4     ;
5     ; Copyright 2009-2010 PCSX2 Dev Team
6     ;
7     ; The installer generated by this script will download all relevant components for
8     ; PCSX2 from a variety of mirror hosts. Packages are only downloaded on an as-needed
9     ; basis; this most importantly applies to the very bulky VS 2008 and VS2010 packages.
10    
11     !ifndef INC_PLUGINS
12     ; Set to 0 to include the core binaries only (no plugins)
13     !define INC_PLUGINS 1
14     !endif
15    
16     !ifndef INC_ZZOGL
17     ; Includes ZZOGL and CG Toolkit (via web install). Currently not supported (work in progress)
18     !define INC_ZZOGL 0
19     !endif
20    
21     !ifndef INC_LANGS
22     ; Set to 1 to enable inclusion of Languages folders (which are currently missing in 0.9.7)
23     !define INC_LANGS 0
24     !endif
25    
26     !define OUTFILE_POSTFIX "websetup"
27     !include "SharedSettings.nsh"
28    
29     !include "MUI2.nsh"
30     !include "AdvUninstLog.nsh"
31    
32     ; Reserve features for improved performance with solid archiving.
33     ; (uncomment if we add our own install options ini files)
34     ;!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
35     ;!insertmacro MUI_RESERVEFILE_LANGDLL
36    
37     ; =======================================================================
38     ; Vista/Win7 UAC Stuff
39     ; =======================================================================
40    
41     !include "IsUserAdmin.nsi"
42    
43     ; Allow admin-rights PCSX2 users to be hardcore!
44     AllowRootDirInstall true
45    
46     ; FIXME !!
47     ; Request application privileges for Windows Vista/7; I'd love for this to be sensible about which
48     ; execution level it requests, but UAC is breaking my mind. I included some code for User type
49     ; detection in function IsUserAdmin, but not really using it constructively yet. (see also our
50     ; uses of SetShellVarContext in the installer sections)
51     RequestExecutionLevel admin
52    
53     ; This defines the Advanced Uninstaller mode of operation...
54     !insertmacro UNATTENDED_UNINSTALL
55    
56     !define MUI_HEADERIMAGE
57     !define MUI_HEADERIMAGE_BITMAP "banner.bmp"
58     ;!define MUI_COMPONENTSPAGE_NODESC
59     !define MUI_COMPONENTSPAGE_SMALLDESC
60    
61     !insertmacro MUI_PAGE_COMPONENTS
62     !insertmacro MUI_PAGE_DIRECTORY
63     !insertmacro MUI_PAGE_INSTFILES
64    
65     !insertmacro MUI_UNPAGE_CONFIRM
66     !insertmacro MUI_UNPAGE_COMPONENTS
67     !insertmacro MUI_UNPAGE_INSTFILES
68    
69     !insertmacro MUI_LANGUAGE "English"
70    
71     !include "ApplyExeProps.nsh"
72     !include "SharedRedtape.nsh"
73    
74     ; =======================================================================
75     ; Installer Sections
76     ; =======================================================================
77    
78     ; -----------------------------------------------------------------------
79     ; Basic section (emulation proper)
80     Section "!${APP_NAME} (required)" SEC_CORE
81    
82     SectionIn RO
83    
84     !include "SectionCoreReqs.nsh"
85    
86     ; ------------------------------------------
87     ; -- Plugins Section --
88     ; ------------------------------------------
89    
90     !if ${INC_PLUGINS} > 0
91    
92     ; [TODO] : Eventually the 'latest' plugin packages should be downloaded from one
93     ; of our mirrors. For now plugins are included in the web installer.
94    
95     SetOutPath "$INSTDIR\Plugins"
96     !insertmacro UNINSTALL.LOG_OPEN_INSTALL
97    
98     File /nonfatal /oname=gsdx-sse2-r${SVNREV_GSDX}.dll ..\bin\Plugins\gsdx-sse2.dll
99     File /nonfatal /oname=gsdx-ssse3-r${SVNREV_GSDX}.dll ..\bin\Plugins\gsdx-ssse3.dll
100     File /nonfatal /oname=gsdx-sse4-r${SVNREV_GSDX}.dll ..\bin\Plugins\gsdx-sse4.dll
101     File /nonfatal /oname=zerogs-r${SVNREV_ZEROGS}.dll ..\bin\Plugins\zerogs.dll
102    
103     File /nonfatal /oname=spu2-x-r${SVNREV_SPU2X}.dll ..\bin\Plugins\spu2-x.dll
104     File /nonfatal /oname=zerospu2-r${SVNREV_ZEROSPU2}.dll ..\bin\Plugins\zerospu2.dll
105    
106     File /nonfatal /oname=cdvdiso-r${SVNREV_CDVDISO}.dll ..\bin\Plugins\cdvdiso.dll
107     File ..\bin\Plugins\cdvdGigaherz.dll
108    
109     File /nonfatal /oname=lilypad-r${SVNREV_LILYPAD}.dll ..\bin\Plugins\lilypad.dll
110     File ..\bin\Plugins\PadSSSPSX.dll
111    
112     ;File ..\bin\Plugins\FWlinuz.dll
113    
114     !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
115    
116     !endif
117    
118     SectionEnd
119    
120     !if ${INC_ZZOGL} > 0
121     Section "ZZogl Plugin (requires OpenGL)"
122    
123     SetOutPath "$INSTDIR\Plugins"
124     !insertmacro UNINSTALL.LOG_OPEN_INSTALL
125     File /oname=zzogl-pg-r${SVNREV_ZZOGL}.dll ..\bin\Plugins\zzogl-pg.dll
126     !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
127    
128     SectionEnd
129    
130     Section "Nvidia's CG Toolkit"
131    
132     ; This section is required by anything using OpenGL, typically.
133     ; It should be automatically checked when ZZogl is enabled.
134    
135     ; CG Toolkit would be downloaded from here:
136     ; http://developer.download.nvidia.com/cg/Cg_2.2/Cg-2.2_February2010_Setup.exe
137    
138     SectionEnd
139     !endif
140    
141     ; -----------------------------------------------------------------------
142     ; Start Menu - Optional section (can be disabled by the user)
143     Section "Start Menu Shortcuts" SEC_STARTMENU
144    
145     ; CreateShortCut gets the working directory from OutPath
146     SetOutPath "$INSTDIR"
147    
148     CreateDirectory "$SMPROGRAMS\PCSX2"
149     CreateShortCut "$SMPROGRAMS\PCSX2\Uninstall ${APP_NAME}.lnk" "${UNINST_EXE}" "" "${UNINST_EXE}" 0
150     CreateShortCut "$SMPROGRAMS\PCSX2\${APP_NAME}.lnk" "${APP_EXE}" "" "${APP_EXE}" 0
151    
152     ;IfFileExists ..\bin\pcsx2-dev.exe 0 +2
153     ; CreateShortCut "PCSX2\pcsx2-dev-r${SVNREV}.lnk" "$INSTDIR\pcsx2-dev-r${SVNREV}.exe" "" "$INSTDIR\pcsx2-dev-r${SVNREV}.exe" 0 "" "" \
154     ; "PCSX2 Devel (has additional logging support)"
155    
156     SectionEnd
157    
158     ; -----------------------------------------------------------------------
159     ; Desktop Icon - Optional section (can be disabled by the user)
160     Section "Desktop Shortcut" SEC_DESKTOP
161    
162     ; CreateShortCut gets the working directory from OutPath
163     SetOutPath "$INSTDIR"
164    
165     CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "${APP_EXE}" "" "${APP_EXE}" 0 "" "" "A Playstation 2 Emulator"
166    
167     SectionEnd
168    
169     ; -----------------------------------------------------------------------
170     ; MSVC Redistributable - required if the user does not already have it
171     ; Note: if your NSIS generates an error here it means you need to download the latest
172     ; visual studio redist package from microsoft. Any redist 2008/SP1 or newer will do.
173     ;
174     ; IMPORTANT: Online references for how to detect the presence of the VS2008 redists LIE.
175     ; None of the methods are reliable, because the registry keys placed by the MSI installer
176     ; vary depending on operating system *and* MSI installer version (youch).
177     ;
178     Section "Microsoft Visual C++ 2008 SP1 Redist (required)" SEC_CRT2008
179    
180     ;SectionIn RO
181    
182     ; Downloaded from:
183     ; http://download.microsoft.com/download/d/d/9/dd9a82d0-52ef-40db-8dab-795376989c03/vcredist_x86.exe
184    
185     SetOutPath "$TEMP"
186    
187     DetailPrint "Downloading Visual C++ 2008 SP1 Redistributable Setup..."
188     DetailPrint "Contacting Microsoft.com..."
189     NSISdl::download /TIMEOUT=15000 "http://download.microsoft.com/download/d/d/9/dd9a82d0-52ef-40db-8dab-795376989c03/vcredist_x86.exe" "vcredist_2008_sp1_x86.exe"
190    
191     Pop $R0 ;Get the return value
192     StrCmp $R0 "success" OnSuccess
193     DetailPrint "Cound not contact Microsoft.com, or the file has been (re)moved!"
194     DetailPrint "Contacting Googlecode.com..."
195     NSISdl::download /TIMEOUT=20000 "http://pcsx2.googlecode.com/files/vcredist_2008_sp1_x86.exe" "vcredist_2008_sp1_x86.exe"
196    
197     ; [TODO] Provide a mirror for this file hosted from pcsx2.net .. ? or emudev.net .. ?
198     ;Pop $R0 ;Get the return value
199     ;StrCmp $R0 "success" +2
200     ;NSISdl::download /TIMEOUT=15000 "http://www.pcsx2.net/vcredist_x86.exe" "vcredist_2008_sp1_x86.exe"
201    
202     Pop $R0 ;Get the return value
203     StrCmp $R0 "success" +2
204     MessageBox MB_OK "Could not download Visual Studio 2008 Redist; none of the mirrors appear to be functional."
205     Goto done
206    
207     OnSuccess:
208     DetailPrint "Running Visual C++ 2008 SP1 Redistributable Setup..."
209     ExecWait '"$TEMP\vcredist_2008_sp1_x86.exe" /qb'
210     DetailPrint "Finished Visual C++ 2008 SP1 Redistributable Setup"
211     Delete "$TEMP\vcredist_2008_sp1_x86.exe"
212    
213     done:
214     SectionEnd
215    
216     Section "Microsoft Visual C++ 2010 Redist (required)" SEC_CRT2010
217    
218     ; Make this required on the web installer, since it has a fully reliable check to
219     ; see if it needs to be downloaded and installed or not.
220     SectionIn RO
221    
222     ; Detection made easy: Unlike previous redists, VC2010 now generates a platform
223     ; independent key for checking availability.
224    
225     ; Downloaded from:
226     ; http://download.microsoft.com/download/5/B/C/5BC5DBB3-652D-4DCE-B14A-475AB85EEF6E/vcredist_x86.exe
227    
228     ReadRegDword $R0 HKLM "SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x86" "Installed"
229     IfErrors done
230     StrCmp $R0 "1" done
231    
232     SetOutPath "$TEMP"
233    
234     DetailPrint "Downloading Visual C++ 2010 Redistributable Setup..."
235     DetailPrint "Contacting Microsoft.com..."
236     NSISdl::download /TIMEOUT=15000 "http://download.microsoft.com/download/5/B/C/5BC5DBB3-652D-4DCE-B14A-475AB85EEF6E/vcredist_x86.exe" "vcredist_2010_x86.exe"
237    
238     Pop $R0 ;Get the return value
239     StrCmp $R0 "success" OnSuccess
240     DetailPrint "Cound not contact Microsoft.com, or the file has been (re)moved!"
241     DetailPrint "Contacting Googlecode.com..."
242     NSISdl::download /TIMEOUT=20000 "http://pcsx2.googlecode.com/files/vcredist_2010_x86.exe" "vcredist_2010_x86.exe"
243    
244     ; [TODO] Provide a mirror for this file hosted from pcsx2.net .. ? or emudev.net .. ?
245     ;Pop $R0 ;Get the return value
246     ;StrCmp $R0 "success" +2
247     ;NSISdl::download /TIMEOUT=30000 "http://www.pcsx2.net/vcredist_x86.exe" "vcredist_2010_x86.exe"
248    
249     Pop $R0 ;Get the return value
250     StrCmp $R0 "success" +2
251     MessageBox MB_OK "Could not download Visual Studio 2010 Redist; none of the mirrors appear to be functional."
252     Goto done
253    
254     OnSuccess:
255     DetailPrint "Running Visual C++ 2010 SP1 Redistributable Setup..."
256     ExecWait '"$TEMP\vcredist_2010_x86.exe" /qb'
257     DetailPrint "Finished Visual C++ 2010 SP1 Redistributable Setup"
258    
259     Delete "$TEMP\vcredist_2010_x86.exe"
260    
261     done:
262     SectionEnd
263    
264     ; -----------------------------------------------------------------------
265     ; This section needs to be last, so that in case it fails, the rest of the program will
266     ; be installed cleanly.
267     ;
268     ; This section could be optional, but why not? It's pretty painless to double-check that
269     ; all the libraries are up-to-date.
270     ;
271     Section "DirectX Web Setup (recommended)" SEC_DIRECTX
272    
273     ;SectionIn RO
274    
275     SetOutPath "$TEMP"
276    
277     DetailPrint "Downloading DirectX Web Setup..."
278     DetailPrint "Contacting Microsoft.com..."
279     NSISdl::download /TIMEOUT=15000 "http://download.microsoft.com/download/1/7/1/1718CCC4-6315-4D8E-9543-8E28A4E18C4C/dxwebsetup.exe" dxwebsetup.exe
280    
281     ; No mirrors provided for the dx web setup. Either we get it from Microsoft, or we don't bother.
282     ; (this is done because there's a good chance the dxwebsetup we provide won't work anyway, if Microsoft
283     ; has in fact re-arranged their website (again)).
284    
285     ;Pop $R0 ;Get the return value
286     ;StrCmp $R0 "success" OnSuccess
287     ;DetailPrint "Cound not contact Microsoft.com, or the file has been (re)moved!"
288     ;DetailPrint "Contacting Googlecode.com..."
289     ;NSISdl::download /TIMEOUT=20000 "http://code.google.com/dxwebsetup01.exe" "dxwebsetup.exe"
290    
291     Pop $R0 ;Get the return value
292     StrCmp $R0 "success" OnSuccess
293     DetailPrint "Cound not contact Microsoft.com, or the file has been (re)moved!"
294     MessageBox MB_OK "Could not download the DirectX Web Setup. Microsoft probably rearranged their website. Please do an internet search for 'DirectX Setup' and download and install it yourself after this installer has finished."
295     Goto done
296    
297     ;Pop $R0 ;Get the return value
298     ;StrCmp $R0 "success" +2
299     ;NSISdl::download /TIMEOUT=30000 "http://www.pcsx2.net/dxwebsetup.exe" "dxwebsetup.exe"
300    
301     OnSuccess:
302     DetailPrint "Running DirectX Web Setup..."
303     ExecWait '"$TEMP\dxwebsetup.exe" /Q' $DirectXSetupError
304     DetailPrint "Finished DirectX Web Setup"
305     Delete "$TEMP\dxwebsetup.exe"
306    
307     done:
308    
309     SectionEnd
310    
311     ; =======================================================================
312     ; Un.Installer Sections
313     ; =======================================================================
314    
315     ; -----------------------------------------------------------------------
316     Section "Un.${APP_NAME} (EXEs, DLLs, game database, etc)"
317    
318     SetShellVarContext all
319    
320     !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR"
321    
322     ; Remove registry keys (but only the ones related to the installer -- user options remain)
323     DeleteRegKey HKLM "${INSTDIR_REG_KEY}"
324    
325     Call un.removeShorties
326    
327     !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\Langs"
328     !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\Plugins"
329    
330     ; Kill the entire PCSX2 registry key... ? (not recommended)
331     ;DeleteRegKey ${INSTDIR_REG_ROOT} Software\PCSX2
332    
333     SectionEnd
334    
335     Section "Un.Complete Registry Cleanup"
336    
337     ; Kill the entire PCSX2 registry key!
338     DeleteRegKey ${INSTDIR_REG_ROOT} Software\PCSX2
339    
340     ; Kill AppData/PCSX2 entry!
341    
342     SetShellVarContext current
343     StrCpy $0 $LOCALAPPDATA\PCSX2
344     Call un.DeleteDirIfEmpty
345     StrCpy $0 $APPDATA\PCSX2
346     Call un.DeleteDirIfEmpty
347    
348     SectionEnd
349    
350    
351     LangString DESC_CORE ${LANG_ENGLISH} "Core components (binaries, plugins, languages, etc)."
352    
353     LangString DESC_STARTMENU ${LANG_ENGLISH} "Adds shortcuts for PCSX2 to the start menu (all users)."
354     LangString DESC_DESKTOP ${LANG_ENGLISH} "Adds a shortcut for PCSX2 to the desktop (all users)."
355    
356     LangString DESC_CRT2008 ${LANG_ENGLISH} "Required! Only uncheck if you are certain this component is already installed."
357     LangString DESC_CRT2010 ${LANG_ENGLISH} "Will only be downloaded if you don't already have it installed."
358     LangString DESC_DIRECTX ${LANG_ENGLISH} "Only uncheck this if you are quite certain your Direct3D runtimes are up to date."
359    
360     !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
361     !insertmacro MUI_DESCRIPTION_TEXT ${SEC_CORE} $(DESC_CORE)
362     !insertmacro MUI_DESCRIPTION_TEXT ${SEC_STARTMENU} $(DESC_STARTMENU)
363     !insertmacro MUI_DESCRIPTION_TEXT ${SEC_DESKTOP} $(DESC_DESKTOP)
364    
365     !insertmacro MUI_DESCRIPTION_TEXT ${SEC_CRT2008} $(DESC_CRT2008)
366     !insertmacro MUI_DESCRIPTION_TEXT ${SEC_CRT2010} $(DESC_CRT2010)
367     !insertmacro MUI_DESCRIPTION_TEXT ${SEC_DIRECTX} $(DESC_DIRECTX)
368     !insertmacro MUI_FUNCTION_DESCRIPTION_END

  ViewVC Help
Powered by ViewVC 1.1.22