$Display = Get-PrimaryDisplay
$FOV = 80
if (($Display.Bounds.Width / $Display.Bounds.Height) -eq (16 / 9)) {
$FOV = 96.4183
} elseif (($Display.Bounds.Width / $Display.Bounds.Height) -eq (16 / 10)) {
$FOV = 90.3951
}
# Base Game Resolution
Write-ReplaceContentInFile -Pattern '^seta r_customheight(.+)' -Substitution "seta r_customheight ""$($Display.Bounds.Height)""" -FilePath "$InstallDirectory\main\config_mp.cfg"
Write-ReplaceContentInFile -Pattern '^seta r_customwidth(.+)' -Substitution "seta r_customwidth ""$($Display.Bounds.Width)""" -FilePath "$InstallDirectory\main\config_mp.cfg"
Write-ReplaceContentInFile -Pattern '^seta r_mode(.+)' -Substitution "seta r_mode ""-1""" -FilePath "$InstallDirectory\main\config_mp.cfg"
Write-ReplaceContentInFile -Pattern '^seta r_customaspect(.+)' -Substitution "seta r_customaspect ""1.7""" -FilePath "$InstallDirectory\main\config_mp.cfg"
Write-ReplaceContentInFile -Pattern '^seta cg_fov(.+)' -Substitution "seta cg_fov ""$FOV""" -FilePath "$InstallDirectory\main\config_mp.cfg"
# United Offensive Resolution
Write-ReplaceContentInFile -Pattern '^seta r_customheight(.+)' -Substitution "seta r_customheight ""$($Display.Bounds.Height)""" -FilePath "$InstallDirectory\uo\uoconfig_mp.cfg"
Write-ReplaceContentInFile -Pattern '^seta r_customwidth(.+)' -Substitution "seta r_customwidth ""$($Display.Bounds.Width)""" -FilePath "$InstallDirectory\uo\uoconfig_mp.cfg"
Write-ReplaceContentInFile -Pattern '^seta r_mode(.+)' -Substitution "seta r_mode ""-1""" -FilePath "$InstallDirectory\uo\uoconfig_mp.cfg"
Write-ReplaceContentInFile -Pattern '^seta r_customaspect(.+)' -Substitution "seta r_customaspect ""1.7""" -FilePath "$InstallDirectory\uo\uoconfig_mp.cfg"
Write-ReplaceContentInFile -Pattern '^seta cg_fov(.+)' -Substitution "seta cg_fov ""$FOV""" -FilePath "$InstallDirectory\uo\uoconfig_mp.cfg"
# Non-destructively creates path in registry
New-Item -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Activision"
New-Item -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Activision\Call of Duty United Offensive"
# Creates or updates a key in the registry
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Activision\Call of Duty United Offensive" -Name "Version" -Value "1.51" -Force
Remove-Item -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Activision\Call of Duty" -Force -Recurse
Remove-Item -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Activision\Call of Duty United Offensive" -Force -Recurse
Write-ReplaceContentInFile -Pattern '^seta name (.+)' -Substitution "seta name ""$NewPlayerAlias""" -FilePath "$InstallDirectory\Main\config_mp.cfg"
Write-ReplaceContentInFile -Pattern '^seta name (.+)' -Substitution "seta name ""$NewPlayerAlias""" -FilePath "$InstallDirectory\uo\uoconfig_mp.cfg"
$Key = $AllocatedKey
$Key = $Key.Replace("-", "")
$codkey, $coduokey = $Key -Split ',',2
# Non-destructively creates path in registry
New-Item -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Activision"
New-Item -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Activision\Call of Duty"
New-Item -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Activision\Call of Duty United Offensive"
# Creates or updates a key in the registry
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Activision\Call of Duty" -Name "codkey" -Value $codkey -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Activision\Call of Duty United Offensive" -Name "key" -Value $coduokey -Force