Halo 2

From LANCommander
Revision as of 02:12, 6 January 2024 by DoctorDalek (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Developers
Bungie
Publishers
Microsoft Game Studios
Release Date
Windows: November 9, 2004
Genres
Shooter
View at PCGamingWiki

Actions

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

Install Script

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

New-Item -ItemType Directory -Force -Path "$($env:LOCALAPPDATA)\Microsoft\Halo 2\Saved Games"
Remove-Item "$($env:LOCALAPPDATA)\Microsoft\Halo 2\Saved Games\S0000000" -Recurse -ErrorAction Ignore
Copy-Item -Path "$InstallDirectory\ProfileTemplate\S0000000" -Destination "$($env:LOCALAPPDATA)\Microsoft\Halo 2\Saved Games\S0000000" -Recurse
New-Item -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Halo 2"

New-Item -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Halo 2\Audio Settings"
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Halo 2\Audio Settings" -Name "ReverbEnable" -Value 0 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Halo 2\Audio Settings" -Name "LowPassEnable" -Value 0 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Halo 2\Audio Settings" -Name "MonoCount" -Value 36 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Halo 2\Audio Settings" -Name "StereoCount" -Value 36 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Halo 2\Audio Settings" -Name "Volume" -Value 0 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Halo 2\Audio Settings" -Name "SpeakerConfig" -Value 0 -Force

New-Item -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Halo 2\Video Settings"
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Halo 2\Video Settings" -Name "ScreenResX" -Value $Display.Bounds.Width -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Halo 2\Video Settings" -Name "ScreenResY" -Value $Display.Bounds.Height -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Halo 2\Video Settings" -Name "ScreenRefresh" -Value 60 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Halo 2\Video Settings" -Name "AspectRatio" -Value 0 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Halo 2\Video Settings" -Name "DisplayMode" -Value 0 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Halo 2\Video Settings" -Name "Brightness" -Value 3 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Halo 2\Video Settings" -Name "Gamma" -Value 2 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Halo 2\Video Settings" -Name "AntiAliasing" -Value 0 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Halo 2\Video Settings" -Name "HudSize" -Value 2 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Halo 2\Video Settings" -Name "SafeArea" -Value 0 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Halo 2\Video Settings" -Name "LevelOfDetail" -Value 0 -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Halo 2\Video Settings" -Name "@" -Value "hex(4):" -Force

Uninstall Script

Remove-Item -Path "registry::\HKEY_CURRENT_USER\Software\Microsoft\Halo 2" -Recurse -Force
Remove-Item "$($env:LOCALAPPDATA)\Microsoft\Halo 2" -Recurse -ErrorAction Ignore

Name Change Script

Names are stored in a `profile` and `savemeta.bin` file as an ASCII encoded string with 0x00 separating characters. Names can be a maximum of 16 characters. We force that to avoid any overflows / profile corruption.

# Converts a string to a UTF16-encoded byte array. This looks like ASCII characters separated by 0x00 in most cases.
$bytes = ConvertTo-StringBytes -Input $NewPlayerAlias -Utf16 1 -MaxLength 16 -MinLength 16

Remove-Item "$($env:LOCALAPPDATA)\Microsoft\Halo 2\Saved Games\S0000000" -Recurse -ErrorAction Ignore
Copy-Item -Path "$InstallDirectory\ProfileTemplate\S0000000" -Destination "$($env:LOCALAPPDATA)\Microsoft\Halo 2\Saved Games\S0000000" -Recurse
Edit-PatchBinary -FilePath "$($env:LOCALAPPDATA)\Microsoft\Halo 2\Saved Games\S0000000\profile" -Offset 8 -Data $bytes
Edit-PatchBinary -FilePath "$($env:LOCALAPPDATA)\Microsoft\Halo 2\Saved Games\S0000000\savemeta.bin" -Offset 18 -Data $bytes