Stronghold Crusader

From LANCommander
Revision as of 21:57, 8 January 2024 by DoctorDalek (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Developers
Firefly Studios
Publishers
Take-Two Interactive
Release Date
Windows: July 31, 2002
Genres
SimulatorReal Time Strategy (RTS)Strategy
View at PCGamingWiki

Actions

Name Path Arguments Working Directory Primary
Play Stronghold: Crusader Extreme {InstallDir}\Stronghold_Crusader_Extreme.exe True
Play Stronghold: Crusader {InstallDir}\Stronghold Crusader.exe True

Install Script

$Documents = [Environment]::GetFolderPath("MyDocuments")
$Display = Get-PrimaryDisplay

$Resolution = Switch ("$($Display.Bounds.Width)x$($Display.Bounds.Height)") {
    "800x600" { 0x01; Break }
    "1024x768" { 0x02; Break }
    "1280x720" { 0x03; Break }
    "1280x1024" { 0x04; Break }
    "1366x768" { 0x05; Break }
    "1440x900" { 0x06; Break }
    "1600x900" { 0x07; Break }
    # "FAIL" { 0x08; Break }
    "1680x1050" { 0x09; Break }
    "1920x1080" { 0x0A; Break }
    "1920x1200" { 0x0B; Break }
    "2560x1440" { 0x0C; Break }
}

New-Item -ItemType Directory -Force -Path "$Documents\Stronghold Crusader"

Copy-Item -Path "$InstallDirectory\Default.cfg" -Destination "$Documents\Stronghold Crusader\crusader.cfg"
Copy-Item -Path "$InstallDirectory\Default.cfg" -Destination "$Documents\Stronghold Crusader\crusaderExtreme.cfg"

Edit-PatchBinary -FilePath "$Documents\Stronghold Crusader\crusader.cfg" -Offset 0x3B9 -Data ([byte[]]@( $Resolution )
Edit-PatchBinary -FilePath "$Documents\Stronghold Crusader\crusaderExtreme.cfg" -Offset 0x3B9 -Data ([byte[]]@( $Resolution )

Uninstall Script

$Documents = [Environment]::GetFolderPath("MyDocuments")

Remove-Item "$Documents\Stronghold Crusader" -Recurse -ErrorAction Ignore

Name Change Script

$Documents = [Environment]::GetFolderPath("MyDocuments")

# 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 -MaxLength 16 -MinLength 16

Edit-PatchBinary -FilePath "$Documents\Stronghold Crusader\crusader.cfg" -Offset 0x23 -Data $bytes
Edit-PatchBinary -FilePath "$Documents\Stronghold Crusader\crusaderExtreme.cfg" -Offset 0x23 -Data $bytes