Deploying XAudio2 With InnoSetup
Monday, February 1st, 2010Zeta Centauri’s latest application, SampliTron, uses XAudio2, which is the new audio portion of Microsoft’s DirectX. Bundling all of DirectX with an installer is overkill for applications that don’t need all of it – for instance, apps that only use the audio portion. Since SampliTron is a fairly large download due to all of the bundled .WAV files, I wanted to keep from inflating the installer much.
Microsoft has an article on MSDN, “DirectX Installation for Game Developers”. That gives an overview of performing a minimal install by bundling only the items you need to distribute. After a bit of experimentation with InnoSetup I came up with a process that works well.
First thing, I figured out what files I wanted to include. These are:
DSETUP.dll
dsetup32.dll
DXSETUP.exe
dxupdate.cab
Aug2009_XAudio_x86.cab
These files add up to 2.5 megabytes, a far cry from the full DirectX installation, which is over 100MB. To deploy these in an InnoSetup project, I added the following lines to my InnoSetup script:
[Files]
Source: “F:\src\zc\SampliTron\Release\DirectX\DXSETUP.exe”; DestDir: “{app}”; Flags: ignoreversion deleteafterinstall
Source: “F:\src\zc\SampliTron\Release\DirectX\DSETUP.dll”; DestDir: “{app}”; Flags: ignoreversion deleteafterinstall
Source: “F:\src\zc\SampliTron\Release\DirectX\dsetup32.dll”; DestDir: “{app}”; Flags: ignoreversion deleteafterinstall
Source: “F:\src\zc\SampliTron\Release\DirectX\dxupdate.cab”; DestDir: “{app}”; Flags: ignoreversion deleteafterinstall
Source: “F:\src\zc\SampliTron\Release\DirectX\Aug2009_XAudio_x86.cab”; DestDir: “{app}”; Flags: ignoreversion deleteafterinstall
[Run]
Filename: “{app}\DXSETUP.exe”; Parameters: “/SILENT”; WorkingDir: “{app}”; StatusMsg: “Installing DirectX XAudio2 Redistributable…”; Flags: waituntilterminated
The “deleteafterinstall” means that InnoSetup will remove the files after setup completes. In the [Run] section, the DXSETUP.exe is before the “LaunchProgram” entry to be sure that it is installed before the user can launch the program. This method can be used to include any other portions of DirectX you want — it only installs the pieces it finds .cab files for.