Star Wars: X-Wing Alliance

From LANCommander
Revision as of 21:57, 8 January 2024 by DoctorDalek (talk | contribs) (Created new page for Star Wars: X-Wing Alliance)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Developers
Totally Games
Publishers
LucasArts
Release Date
Windows: February 28, 1999
Genres
SimulatorShooter
View at PCGamingWiki

Actions

Name Path Arguments Working Directory Primary
Play {InstallDir}\Alliance.EXE True

Name Change Script

This script will patch the pilot file ($NewName0.plt) with the new name and rename it from the old name or copy a template pilot file in the install directory.

$NewPlayerAlias = $NewPlayerAlias.Split([IO.Path]::GetInvalidFileNameChars()) -join '_'
$OldPlayerAlias = $OldPlayerAlias.Split([IO.Path]::GetInvalidFileNameChars()) -join '_'

if ($OldPlayerAlias.Length -gt 12) {
    $OldPlayerAlias = $OldPlayerAlias.Substring(0, 12);
}

if ($NewPlayerAlias.Length -gt 12) {
    $NewPlayerAlias = $NewPlayerAlias.Substring(0, 12);
}

if (Test-Path "$InstallDirectory\$($OldPlayerAlias)0.PLT") {
    Rename-Item -Path "$InstallDirectory\$($OldPlayerAlias)0.PLT" -NewName "$InstallDirectory\$($NewPlayerAlias)0.PLT"
} else {
    Copy-Item -Path "$InstallDirectory\TemplatePilot.PLT.example" -Destination "$InstallDirectory\$($NewPlayerAlias)0.PLT"
}

# 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 12 -MinLength 12

Edit-PatchBinary -FilePath "$InstallDirectory\$($NewPlayerAlias)0" -Offset 0x00 -Data $bytes