Battlefield 2: Difference between revisions
DoctorDalek (talk | contribs) (Created new page for Battlefield 2) |
DoctorDalek (talk | contribs) No edit summary |
||
Line 5: | Line 5: | ||
{{Game.InfoBox.Developer|Digital Illusions CE}} | {{Game.InfoBox.Developer|Digital Illusions CE}} | ||
|Publishers = | |Publishers = | ||
{{Game.InfoBox. | {{Game.InfoBox.Publisher|Electronic Arts}} | ||
|Release Date = | |Release Date = | ||
{{Game.InfoBox.ReleaseDate|Windows|June 21, 2005}} | {{Game.InfoBox.ReleaseDate|Windows|June 21, 2005}} | ||
Line 14: | Line 14: | ||
{{Game.ActionBox | {{Game.ActionBox | ||
|Actions = | |Actions = | ||
{{Game.ActionBox.Row|Name = Play|Path = {InstallDir}\bf2. | {{Game.ActionBox.Row|Name = Play Battlefield 2|Path = {InstallDir}\bf2.exe|Arguments = +szx {DisplayWidth} +szy {DisplayHeight} +menu 1 +widescreen 1 +restart 1|WorkingDirectory = |Primary = True}} | ||
}} | }} | ||
Line 46: | Line 46: | ||
|Contents = | |Contents = | ||
<syntaxhighlight lang="powershell" line> | <syntaxhighlight lang="powershell" line> | ||
Remove- | $VirtualStore = "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE" | ||
Remove-Item -Path " | $Documents = [Environment]::GetFolderPath('MyDocuments') | ||
Remove-Item -Path " | |||
Remove-Item -Path "$Documents\Battlefield 2" -Recurse -Force | |||
Remove-Item -Path "$VirtualStore\Wow6432Node\Electronic Arts\EA Games\Battlefield 2" -Force -Recurse | |||
Remove-Item -Path "$VirtualStore\Wow6432Node\Electronic Arts\EA Games\Battlefield 2 Special Forces" -Force -Recurse | |||
</syntaxhighlight> | </syntaxhighlight> | ||
}} | }} | ||
Line 71: | Line 74: | ||
|Contents = | |Contents = | ||
<syntaxhighlight lang="powershell" line> | <syntaxhighlight lang="powershell" line> | ||
$VirtualStore = "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE" | |||
New-Item -Path "$VirtualStore\Wow6432Node\Electronic Arts\EA Games\Battlefield 2\ergc" | |||
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Electronic Arts\EA GAMES\Battlefield 2\ergc" -Name "@" -Value "x9392$AllocatedKey" -Force | |||
New-Item -Path "$VirtualStore\Wow6432Node\Electronic Arts\EA Games\Battlefield 2 Special Forces\ergc" | |||
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Electronic Arts\EA GAMES\Battlefield 2 Special Forcers\ergc" -Name "@" -Value "x9392$AllocatedKey" -Force | |||
</syntaxhighlight> | </syntaxhighlight> | ||
}} | }} |
Latest revision as of 00:38, 22 February 2024
Developers | |
---|---|
Digital Illusions CE | |
Publishers | |
Electronic Arts | |
Release Date | |
Windows: June 21, 2005 | |
Genres | |
Shooter | |
View at PCGamingWiki |
Actions
Name | Path | Arguments | Working Directory | Primary |
---|---|---|---|---|
Play Battlefield 2 | {InstallDir}\bf2.exe | +szx {DisplayWidth} +szy {DisplayHeight} +menu 1 +widescreen 1 +restart 1 | True |
Install Script
#######################################################################
#Updates Screen Resolution to match desktop resolution
#######################################################################
# Bounds are accessible by $Display.Bounds.Width and $Display.Bounds.Height
$Display = Get-PrimaryDisplay
Set-Content -Path "$InstallDirectory\bf2.bat" -Value "bf2.exe +szx $($Display.Bounds.Width) +szy $($Display.Bounds.Height) +widescreen 1 +restart" -force
# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Copy-Item -Path "$InstallDirectory\ProfileTemplate" -Destination "$env:userprofile\Documents\Battlefield 2" -force -Recurse
#######################################################################
Uninstall Script
$VirtualStore = "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE"
$Documents = [Environment]::GetFolderPath('MyDocuments')
Remove-Item -Path "$Documents\Battlefield 2" -Recurse -Force
Remove-Item -Path "$VirtualStore\Wow6432Node\Electronic Arts\EA Games\Battlefield 2" -Force -Recurse
Remove-Item -Path "$VirtualStore\Wow6432Node\Electronic Arts\EA Games\Battlefield 2 Special Forces" -Force -Recurse
Name Change Script
Write-ReplaceContentInFile -Pattern 'LocalProfile.setName "(.+)"' -Substitution "LocalProfile.setName ""$NewPlayerAlias""" -FilePath "$env:userprofile\Documents\Battlefield 2\Profiles\0001\Profile.con"
Write-ReplaceContentInFile -Pattern 'LocalProfile.setNick "(.+)"' -Substitution "LocalProfile.setNick ""$NewPlayerAlias""" -FilePath "$env:userprofile\Documents\Battlefield 2\Profiles\0001\Profile.con"
Write-ReplaceContentInFile -Pattern 'LocalProfile.setName "(.+)"' -Substitution "LocalProfile.setName ""$NewPlayerAlias""" -FilePath "$env:userprofile\Documents\Battlefield 2\Profiles\Default\Profile.con"
Write-ReplaceContentInFile -Pattern 'LocalProfile.setNick "(.+)"' -Substitution "LocalProfile.setNick ""$NewPlayerAlias""" -FilePath "$env:userprofile\Documents\Battlefield 2\Profiles\Default\Profile.con"
Key Change Script
$VirtualStore = "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE"
New-Item -Path "$VirtualStore\Wow6432Node\Electronic Arts\EA Games\Battlefield 2\ergc"
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Electronic Arts\EA GAMES\Battlefield 2\ergc" -Name "@" -Value "x9392$AllocatedKey" -Force
New-Item -Path "$VirtualStore\Wow6432Node\Electronic Arts\EA Games\Battlefield 2 Special Forces\ergc"
New-ItemProperty -Path "$VirtualStore\WOW6432Node\Electronic Arts\EA GAMES\Battlefield 2 Special Forcers\ergc" -Name "@" -Value "x9392$AllocatedKey" -Force