# Bounds are accessible by $Display.Bounds.Width and $Display.Bounds.Height
$Display = Get-PrimaryDisplay
Write-ReplaceContentInFile -Pattern '^"SCREENWIDTH" "(.+)"' -Substitution """SCREENWIDTH"" ""$($Display.Bounds.Width)""" -FilePath "$InstallDirectory\autoexec.cfg"
Write-ReplaceContentInFile -Pattern '^"GameScreenWidth" "(.+)"' -Substitution """GameScreenWidth"" ""$($Display.Bounds.Width)""" -FilePath "$InstallDirectory\autoexec.cfg"
Write-ReplaceContentInFile -Pattern '^"SCREENHEIGHT" "(.+)"' -Substitution """SCREENHEIGHT"" ""$($Display.Bounds.Height)""" -FilePath "$InstallDirectory\autoexec.cfg"
Write-ReplaceContentInFile -Pattern '^"GameScreenHeight" "(.+)"' -Substitution """GameScreenHeight"" ""$($Display.Bounds.Height)""" -FilePath "$InstallDirectory\autoexec.cfg"
New-Item -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Monolith Productions\Aliens vs. Predator 2\1.0" -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Monolith Productions\Aliens vs. Predator 2\1.0" -Name "InstallDir" -Value "$InstallDirectory" -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Monolith Productions\Aliens vs. Predator 2\1.0" -Name "Language" -Value "English" -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Monolith Productions\Aliens vs. Predator 2\1.0" -Name "Update Command Line" -Value "-rez AVP2P1.REZ -rez AVP2SP.REZ -rez avp2p5.rez" -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Monolith Productions\Aliens vs. Predator 2\1.0" -Name "Num Launcher Runs" -Value 1 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Monolith Productions\Aliens vs. Predator 2\1.0" -Name "Disable Sound" -Value 0 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Monolith Productions\Aliens vs. Predator 2\1.0" -Name "Disable Music" -Value 0 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Monolith Productions\Aliens vs. Predator 2\1.0" -Name "Disable Movies" -Value 1 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Monolith Productions\Aliens vs. Predator 2\1.0" -Name "Disable Joysticks" -Value 0 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Monolith Productions\Aliens vs. Predator 2\1.0" -Name "Disable Triple Buffering" -Value 1 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Monolith Productions\Aliens vs. Predator 2\1.0" -Name "Disable Hardware Cursor" -Value 0 -Force
Rename-Item -Path "$InstallDirectory\Movies\foxlogo.bik" -NewName "$InstallDirectory\Movies\foxlogo.bik.bak"
Rename-Item -Path "$InstallDirectory\Movies\lithlogo.bik" -NewName "$InstallDirectory\Movies\lithlogo.bik.bak"
Rename-Item -Path "$InstallDirectory\Movies\ltlogo.bik" -NewName "$InstallDirectory\Movies\ltlogo.bik.bak"
Rename-Item -Path "$InstallDirectory\Movies\sierralogo.bik" -NewName "$InstallDirectory\Movies\sierralogo.bik.bak"
Remove-Item -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Monolith Productions\Aliens vs. Predator 2" -Force -Recurse
Write-ReplaceContentInFile -Pattern '^PlayerName = "(.+)"' -Substitution "PlayerName = ""$NewPlayerAlias""" -FilePath "$InstallDirectory\Profiles\Player_0.txt"