DirectX Installation for Fixed Media: Difference between revisions
Seg telltale (talk | contribs) (Created page with 'The following is for NSIS installations where the source is a media such as a DVD, CD-ROM, or otherwise can store the 100mb+ DirectX installation. As the installer will be on fix…') |
Seg telltale (talk | contribs) |
||
Line 70: | Line 70: | ||
[[Category:DirectX|Installation for Fixed Media, DirectX]] | [[Category:DirectX|Installation for Fixed Media, DirectX]] | ||
[[Category:Code_Examples]] |
Revision as of 21:44, 10 August 2009
The following is for NSIS installations where the source is a media such as a DVD, CD-ROM, or otherwise can store the 100mb+ DirectX installation. As the installer will be on fixed media, we can save installation time and user's hard drive space by running directly from the source media, rather than coping install files.
For web-based installers, please use the DirectX Web Installer instructions.
Prerequisites
Obtaining the DirectX Runtime Install
Obtain the Latest DirectX End-User Runtimes from Microsoft. You can use any release, but it's best to get the latest runtime, even if your title doesn't explicitly require it.
When you get the file, you will need to extract the contents, rather than installing the runtimes. To do this, you will need to run the file in a command line as follows, defining the export location in the /T parameter:
directx_redist.exe /T:<path to export> /C
Placing the DirectX install
You will need include the full DirectX installation files on your final media. While the contents can be named and places anywhere in relative to the final installer executable, this document will assume the following layout:
- ~/setup.exe Your final installer file.
- ~/DirectX/
- dxsetup.exe
- dsetup.dll
- dsetup32.dll
- All the other DirectX setup files.
Installing DirectX
There are two ways to go about the install. The easy way or use DirectSetup to interface with the DirectX install program directly.
The Easy Way
If you simply want to run the installer with only a fail/success status, this is the way to go. This script will do the following:
- Launch the DirectX Installer on the source media.
- NSIS waits till the DirectX installer finishes.
- Close and continue with the install script.
First, you will need to define a variable at the very beginning of your script:
Var DirectXSetupError
To make things easier on yourself, create a new Section for DirectX. NSIS will run the section while installing. The placement of the section could go anywhere, but it's highly recommended that DirectX be the last install section after everything else is complete. This is incase DirectX fails, your software will be installed.
If you use component install UI, DirectX will show up as an entry. You can force on with "SectionIn RO", or leave out if you wish the user to have the option to run the DirectX install.
Section "DirectX Install" SEC_DIRECTX SectionIn RO DetailPrint "Running DirectX Setup..." ExecWait '"$EXEDIR\DirectX\DXSETUP.exe" /silent' $DirectXSetupError DetailPrint "Finished DirectX Setup" SectionEnd
Note: Change the ExecWait line to point to the path of DXSETUP.exe. In this example, $EXEDIR is used to point to the directory the NSIS installer is located, then a subfolder of "DirectX".
The variable $DirectXSetupError is used to force NSIS to pause while the DirectX setup is running. You can use the error code to further script error handling, but a variable is required to be there in order for NSIS to wait.
I've also included DetailPrint lines to display the DirectX status in the install logs. These strings can be localized to your liking.
Using DirectSetup
This script will also require the use of the System plug-in, which is included in NSIS. I'm still researching this, so right now the easy way is the only documented way. Help appreciated!