sultim-t / prboom-plus-rt

816 stars 50 forks source link

Install Script for Windows Powershell (Script included) #110

Open floriankraemer opened 11 months ago

floriankraemer commented 11 months ago

I like to automate my stuff, so I asked ChatGTP to write me a Powershell script to do the work for me. I ran it only on Windows 11. It might help somebody else. It also includes https://github.com/sultim-t/RayTracedGL1/issues/22

powershell.exe -ExecutionPolicy Bypass -File .\prboom-rtx.ps1`

Put the script in a file ending with ps1 and execute it with the command above.

# Define the URL of the prboom-rt file to download
$prboomFileUrl = "https://github.com/sultim-t/prboom-plus-rt/releases/download/v2.6.1-rt1.0.7/prboom-rt-1.0.7.zip"

# Define the URL of the nvngx_dlss.dll file to download
$dlssDllUrl = "https://github.com/NVIDIA/DLSS/raw/main/lib/Windows_x86_64/rel/nvngx_dlss.dll"

# Define the URL of the RayTracedGL1-DLSS.zip file to download
# Please see: https://github.com/sultim-t/RayTracedGL1/issues/22
$rayTracedGL1ZipUrl = "https://github.com/sultim-t/RayTracedGL1/files/10120309/RayTracedGL1.zip"

# Set the destination folder to the current directory
$destinationFolder = $PSScriptRoot

# Create the "Prboom" folder if it doesn't exist
$prboomFolder = Join-Path -Path $destinationFolder -ChildPath "Prboom"
if (-not (Test-Path -Path $prboomFolder -PathType Container)) {
    New-Item -Path $prboomFolder -ItemType Directory
}

# Download the prboom-rt file to the "Prboom" folder
$prboomDownloadedFilePath = Join-Path -Path $prboomFolder -ChildPath "prboom-rt.zip"
Invoke-WebRequest -Uri $prboomFileUrl -OutFile $prboomDownloadedFilePath

# Unpack the downloaded prboom-rt file (assuming it's a ZIP file) within the "Prboom" folder
Expand-Archive -Path $prboomDownloadedFilePath -DestinationPath $prboomFolder -Force

# Download the nvngx_dlss.dll file to the "Prboom" folder
Invoke-WebRequest -Uri $dlssDllUrl -OutFile (Join-Path -Path $prboomFolder -ChildPath "nvngx_dlss.dll")

# Download the RayTracedGL1-DLSS.zip file
$rayTracedGL1ZipPath = Join-Path -Path $prboomFolder -ChildPath "RayTracedGL1-DLSS.zip"
Invoke-WebRequest -Uri $rayTracedGL1ZipUrl -OutFile $rayTracedGL1ZipPath

# Unpack the downloaded zip file to a temporary folder
$unzipFolder = Join-Path -Path $prboomFolder -ChildPath "TempUnzip"
Expand-Archive -Path $rayTracedGL1ZipPath -DestinationPath $unzipFolder -Force

# Copy only the RayTracedGL1.dll to the Prboom folder and override any existing file
Copy-Item -Path (Join-Path -Path $unzipFolder -ChildPath "RayTracedGL1.dll") -Destination $prboomFolder -Force

# Remove the temporary unzip folder
Remove-Item -Path $unzipFolder -Recurse -Force

# Remove the downloaded zip file
Remove-Item -Path $rayTracedGL1ZipPath

# Provide feedback
Write-Host "Files downloaded and extracted successfully."