Need for Speed: Hot Pursuit 2

From LANCommander
Developers
Black Box GamesEA Seattle
Publishers
Electronic Arts
Release Date
Windows: September 30, 2002
Genres
Racing
View at PCGamingWiki

Actions

Name Path Arguments Working Directory Primary
Play {InstallDir}\nfshp2.exe True

Install Script

# Bounds are accessible by $Display.Bounds.Width and $Display.Bounds.Height
$Display = Get-PrimaryDisplay

$InstallDrive = Split-Path -Path $InstallDirectory -Qualifier

New-Item -ItemType Directory -Path "$env:userprofile\Documents\EA Games\Need For Speed Hot Pursuit 2\" -force

Copy-Item "$InstallDirectory\ProfileTempate\*.*" -Destination "$env:userprofile\Documents\EA Games\Need For Speed Hot Pursuit 2" -Recurse

New-Item -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\EA Games"
New-Item -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2"
New-Item -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2\1.0"

New-Item -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Electronic Arts"
New-Item -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Electronic Arts\EA Games"
New-Item -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Electronic Arts\EA Games\Need For Speed Hot Pursuit 2"
New-Item -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Electronic Arts\EA Games\Need For Speed Hot Pursuit 2\ergc"
New-Item -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{76F4DD9B-C246-4BE0-00B6-3DE9ABF72299}"

New-Item -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\NFSHP2.exe"
New-Item -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\App Paths\NFSHP2.exe"

Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2" -Name "CacheSize" -Value 546357 -Force

# These should match and it needs to be a drive that is actually mapped
Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2" -Name "CD Drive" -Value "$InstallDrive\" -Force
Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2" -Name "Installed From" -Value "$InstallDrive\"

Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2" -Name "DisplayName" -Value "Need For Speed Hot Pursuit 2"
Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2" -Name "Folder" -Value "$env:ProgramData\Microsoft\Windows\Start Menu\Programs\EA Games\Need For Speed Hot Pursuit 2\"
Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2" -Name "Install Dir" -Value "$InstallDirectory"
Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2" -Name "Language" -Value "English US"
Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2" -Name "Patch URL" -Value "http://patches.ea.com/nfshp2/EN-US/home.html"
Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2" -Name "Product GUID" -Value "{76F4DD9B-C246-4BE0-00B6-3DE9ABF72299}"
Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2" -Name "Region" -Value "en-us"
Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2" -Name "SwapSize" -Value 0

Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2\1.0" -Name "DisplayName" -Value "Need For Speed Hot Pursuit 2"
Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2\1.0" -Name "Language" -Value 1
Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2\1.0" -Name "LanguageName" -Value "English US"

Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\NFSHP2.exe" -Name "Game Registry" -Value "SOFTWARE\EA Games\Need For Speed Hot Pursuit 2"
Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\NFSHP2.exe" -Name "Restart" -Value 0
Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\NFSHP2.exe" -Name "Path" -Value "$InstallDirectory"
Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\NFSHP2.exe" -Name "(Default)" -Value "$InstallDirectory\NFSHP2.exe"

Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\Microsoft\WOW6432Node\Windows\CurrentVersion\App Paths\NFSHP2.exe" -Name "Game Registry" -Value "SOFTWARE\EA Games\Need For Speed Hot Pursuit 2"
Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\Microsoft\WOW6432Node\Windows\CurrentVersion\App Paths\NFSHP2.exe" -Name "Restart" -Value 0
Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\Microsoft\WOW6432Node\Windows\CurrentVersion\App Paths\NFSHP2.exe" -Name "Path" -Value "$InstallDirectory"
Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\Microsoft\WOW6432Node\Windows\CurrentVersion\App Paths\NFSHP2.exe" -Name "(Default)" -Value "$InstallDirectory\NFSHP2.exe"

Rename-Item -Path "$InstallDirectory\movies\hp2e.mad" -NewName "$InstallDirectory\movies\hp2e.mad.bak"
Rename-Item -Path "$InstallDirectory\movies\logoE.mad" -NewName "$InstallDirectory\movies\logoE.mad.bak"
Rename-Item -Path "$InstallDirectory\movies\LogoS.mad" -NewName "$InstallDirectory\movies\LogoS.mad.bak"

New-Item -Path "$InstallDirectory\movies\" -Name "hp2e.mad" -ItemType "file" -Value " " -force
New-Item -Path "$InstallDirectory\movies\" -Name "logoE.mad" -ItemType "file" -Value " " -force
New-Item -Path "$InstallDirectory\movies\" -Name "LogoS.mad" -ItemType "file" -Value " " -force

# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Write-ReplaceContentInFile -Pattern '^Width=(.+)' -Substitution "Width=$($Display.Bounds.Width)" -FilePath "$env:userprofile\Documents\EA Games\Need For Speed Hot Pursuit 2\rendercaps.ini"
Write-ReplaceContentInFile -Pattern '^Height=(.+)' -Substitution "Height=$($Display.Bounds.Height)" -FilePath "$env:userprofile\Documents\EA Games\Need For Speed Hot Pursuit 2\rendercaps.ini"


#$Documents = [Environment]::GetFolderPath("MyDocuments")
#$ProgramData = [Environment]::GetFolderPath("CommonApplicationData")
#$InstallDrive = Split-Path -Path $InstallDirectory -Qualifier
#
#New-Item -ItemType Directory -Force -Path "$Documents\EA Games\Need For Speed Hot Pursuit 2"
#
#Copy-Item "$InstallDirectory\ProfileTemplate" -Destination "$Documents\EA Games\Need For Speed Hot Pursuit 2" -Recurse
#
#New-Item -Path "HKLM:\SOFTWARE\WOW6432Node\EA Games"
#New-Item -Path "HKLM:\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2"
#New-Item -Path "HKLM:\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2\1.0"
#
#New-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Electronic Arts"
#New-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Electronic Arts\EA Games"
#New-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Electronic Arts\EA Games\Need For Speed Hot Pursuit 2"
#New-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Electronic Arts\EA Games\Need For Speed Hot Pursuit 2\ergc"
#New-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{76F4DD9B-C246-4BE0-00B6-3DE9ABF72299}"
#
#New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\NFSHP2.exe"
#New-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\App Paths\NFSHP2.exe"
#
#Set-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2" -Name "CacheSize" -Value 546357 -Force
#
## These should match and it needs to be a drive that is actually mapped
#Set-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2" -Name "CD Drive" -Value "$InstallDrive\" -Force
#Set-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2" -Name "Installed From" -Value "$InstallDrive\"
#
#Set-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2" -Name "DisplayName" -Value "Need For Speed Hot Pursuit 2"
#Set-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2" -Name "Folder" -Value "$ProgramData\Microsoft\Windows\Start Menu\Programs\EA Games\Need For Speed Hot Pursuit 2\"
#Set-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2" -Name "Install Dir" -Value "$InstallDirectory"
#Set-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2" -Name "Language" -Value "English US"
#Set-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2" -Name "Patch URL" -Value "http://patches.ea.com/nfshp2/EN-US/home.html"
#Set-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2" -Name "Product GUID" -Value "{76F4DD9B-C246-4BE0-00B6-3DE9ABF72299}"
#Set-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2" -Name "Region" -Value "en-us"
#Set-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2" -Name "SwapSize" -Value 0
#
#Set-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2\1.0" -Name "DisplayName" -Value "Need For Speed Hot Pursuit 2"
#Set-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2\1.0" -Name "Language" -Value 1
#Set-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\EA Games\Need For Speed Hot Pursuit 2\1.0" -Name "LanguageName" -Value "English US"
#
#Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\NFSHP2.exe" -Name "Game Registry" -Value "SOFTWARE\EA Games\Need For Speed Hot Pursuit 2"
#Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\NFSHP2.exe" -Name "Restart" -Value 0
#Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\NFSHP2.exe" -Name "Path" -Value "$InstallDirectory"
#Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\NFSHP2.exe" -Name "(Default)" -Value "$InstallDirectory\NFSHP2.exe"
#
#Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WOW6432Node\Windows\CurrentVersion\App Paths\NFSHP2.exe" -Name "Game Registry" -Value "SOFTWARE\EA Games\Need For Speed Hot Pursuit 2"
#Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WOW6432Node\Windows\CurrentVersion\App Paths\NFSHP2.exe" -Name "Restart" -Value 0
#Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WOW6432Node\Windows\CurrentVersion\App Paths\NFSHP2.exe" -Name "Path" -Value "$InstallDirectory"
#Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WOW6432Node\Windows\CurrentVersion\App Paths\NFSHP2.exe" -Name "(Default)" -Value "$InstallDirectory\NFSHP2.exe"

Uninstall Script

Remove-Item -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Electronic Arts\EA Games\Need For Speed Hot Pursuit 2" -Recurse -ErrorAction Ignore
Remove-Item -path "$env:userprofile\Documents\EA Games\Need For Speed Hot Pursuit 2" -recurse -force

Name Change Script

$Documents = [Environment]::GetFolderPath("MyDocuments")
Write-ReplaceContentInFile -Pattern '^playerName(.+)' -Substitution "playerName=$NewPlayerAlias" -FilePath "$Documents\EA Games\Need For Speed Hot Pursuit 2\netprefs.ini"

Key Change Script

New-Item -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Electronic Arts"
New-Item -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Electronic Arts\EA Games"
New-Item -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Electronic Arts\EA Games\Need For Speed Hot Pursuit 2"
New-Item -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Electronic Arts\EA Games\Need For Speed Hot Pursuit 2\ergc"

$Key = $AllocatedKey -Replace "-", ""

Set-ItemProperty -Path "HKCU:\SOFTWARE\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\Electronic Arts\EA Games\Need For Speed Hot Pursuit 2\ergc" -Name "(Default)" -Value $Key

#New-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Electronic Arts"
#New-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Electronic Arts\EA Games"
#New-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Electronic Arts\EA Games\Need For Speed Hot Pursuit 2"
#New-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Electronic Arts\EA Games\Need For Speed Hot Pursuit 2\ergc"
#
#$Key = $AllocatedKey -Replace "-", ""
#
#Set-ItemProperty -Path "HKLM:\SOFTWARE\WOW6432Node\Electronic Arts\EA Games\Need For Speed Hot Pursuit 2\ergc" -Name "(Default)" -Value $Key