From 42c71c47753b0271309de8b6be6177880ec3b9ba Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Wed, 12 Jul 2023 02:49:09 +0200 Subject: [PATCH] Add XAudio2 redistributable DLL for older Windows versions The CI builds link against XAudio2_9, which isn't available on Windows 8 and lower. As a quick and dirty workaround, this commit ships the XAudio2 redistributable on those older Windows versions. Simply renaming the redistributable to XAudio2_9.dll isn't strictly allowed by the documentation, but it works and is probably an acceptable hack to support an outdated operating system... Fixes arch1t3cht/Aegisub#16 . --- packages/win_installer/fragment_runtimes.iss | 1 + packages/win_installer/portable/create-portable.ps1 | 3 +++ tools/win-installer-setup.ps1 | 8 ++++++++ 3 files changed, 12 insertions(+) diff --git a/packages/win_installer/fragment_runtimes.iss b/packages/win_installer/fragment_runtimes.iss index c7c69762f..af87ea201 100644 --- a/packages/win_installer/fragment_runtimes.iss +++ b/packages/win_installer/fragment_runtimes.iss @@ -2,6 +2,7 @@ [Files] DestDir: {tmp}; Source: "{#DEPS_DIR}\VC_redist\VC_redist.x{#ARCH}.exe"; Flags: nocompression deleteafterinstall +DestDir: {app}; Source: "{#DEPS_DIR}\XAudio2_redist\build\native\release\bin\x{#ARCH}\xaudio2_9redist.dll"; DestName: "XAudio2_9.dll"; OnlyBelowVersion: 10.0 [Run] Filename: {tmp}\VC_redist.x{#ARCH}.exe; StatusMsg: {cm:InstallRuntime}; Parameters: "/install /quiet /norestart" diff --git a/packages/win_installer/portable/create-portable.ps1 b/packages/win_installer/portable/create-portable.ps1 index 0b121254f..91956c9c7 100644 --- a/packages/win_installer/portable/create-portable.ps1 +++ b/packages/win_installer/portable/create-portable.ps1 @@ -60,6 +60,9 @@ Write-Output 'Copying - codecs\VSFilter' Copy-New-Item $InstallerDepsDir\VSFilter\x64\VSFilter.dll $PortableOutputDir\csri Write-Output 'Copying - runtimes\MS-CRT' Copy-New-Item $InstallerDepsDir\VC_redist\VC_redist.x64.exe $PortableOutputDir\Microsoft.CRT +Write-Output 'Copying - redist\XAudio2_9' +Copy-New-Item $InstallerDepsDir\XAudio2_redist\build\native\release\bin\x64\xaudio2_9redist.dll $PortableOutputDir\Redist +Rename-Item $PortableOutputDir\Redist\xaudio2_9redist.dll $PortableOutputDir\Redist\XAudio2_9.dll Write-Output 'Copying - automation' Copy-New-Items "$InstallerDir\share\aegisub\automation\*" "$PortableOutputDir\automation\" -Recurse diff --git a/tools/win-installer-setup.ps1 b/tools/win-installer-setup.ps1 index 312bf292c..060964e8e 100644 --- a/tools/win-installer-setup.ps1 +++ b/tools/win-installer-setup.ps1 @@ -74,6 +74,14 @@ if (!(Test-Path VC_redist)) { Invoke-WebRequest https://aka.ms/vs/16/release/VC_redist.x64.exe -OutFile "$redistDir\VC_redist.x64.exe" -UseBasicParsing } +# XAudio2 redistributable +if (!(Test-Path XAudio2_redist)) { + New-Item -ItemType Directory XAudio2_redist + Invoke-WebRequest https://www.nuget.org/api/v2/package/Microsoft.XAudio2.Redist/1.2.11 -OutFile XAudio2Redist.zip + Expand-Archive -LiteralPath XAudio2Redist.zip -DestinationPath XAudio2_redist + Remove-Item XAudio2Redist.zip +} + # TODO dictionaries # localization