# 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\Third Law Interactive\Aliens versus Predator 2: Primal Hunt\1.0" -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Third Law Interactive\Aliens versus Predator 2: Primal Hunt\1.0" -Name "InstallDir" -Value "$InstallDirectory" -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Third Law Interactive\Aliens versus Predator 2: Primal Hunt\1.0" -Name "Language" -Value "English" -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Third Law Interactive\Aliens versus Predator 2: Primal Hunt\1.0" -Name "Disable Hardware Cursor" -Value 0 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Third Law Interactive\Aliens versus Predator 2: Primal Hunt\1.0" -Name "Disable Joysticks" -Value 0 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Third Law Interactive\Aliens versus Predator 2: Primal Hunt\1.0" -Name "Disable Hardware Movies" -Value 0 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Third Law Interactive\Aliens versus Predator 2: Primal Hunt\1.0" -Name "Disable Hardware Music" -Value 0 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Third Law Interactive\Aliens versus Predator 2: Primal Hunt\1.0" -Name "Disable Hardware Sound" -Value 0 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Third Law Interactive\Aliens versus Predator 2: Primal Hunt\1.0" -Name "Disable Hardware Triple Buffering" -Value 0 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Third Law Interactive\Aliens versus Predator 2: Primal Hunt\1.0" -Name "Num Launcher Runs" -Value 0 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Third Law Interactive\Aliens versus Predator 2: Primal Hunt\1.0" -Name "PatchRez" -Value "-rez avp2p.rez -rez avp2p1.rez -rez avp2x.rez" -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Third Law Interactive\Aliens versus Predator 2: Primal Hunt\1.0" -Name "Disable Movies" -Value 1 -Force
Remove-Item -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Third Law Interactive\Aliens versus Predator 2: Primal Hunt" -Force -Recurse
Write-ReplaceContentInFile -Pattern '^PlayerName = "(.+)"' -Substitution "PlayerName = ""$NewPlayerAlias""" -FilePath "$InstallDirectory\Profiles\Player_0.txt"
Write-ReplaceContentInFile -Pattern '^PlayerName = "(.+)"' -Substitution "PlayerName = ""$NewPlayerAlias""" -FilePath "$InstallDirectory\Profiles\Player_0.txt"