Star Wars: Empire at War

From LANCommander
Revision as of 01:29, 1 August 2023 by DoctorDalek (talk | contribs) (Created page with "Category:Games {{Game.InfoBox |Cover = cover.jpg |Developers = {{Game.InfoBox.Developer|Petroglyph Games}} |Publishers = {{Game.InfoBox.Publisher|LucasArts}} {{Game.InfoBox.Publisher|Aspyr Media}} |Release Date = {{Game.InfoBox.ReleaseDate|Windows|February 16, 2006}} |Genres = {{Game.InfoBox.Genre|Real Time Strategy (RTS)}} {{Game.InfoBox.Genre|Strategy}} | PCGamingWiki = Star_Wars:_Empire_at_War }} {{Game.ActionBox |Actions = {{Game.ActionBox.Row|Name = Play Star...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Developers
Petroglyph Games
Publishers
LucasArts Aspyr Media
Release Date
Windows: February 16, 2006
Genres
Real Time Strategy (RTS)

Strategy

View at PCGamingWiki

Actions

Name Path Arguments Working Directory Primary
Play Star Wars: Empire at War - Forces of Corruption swfoc.exe {InstallDir}/EAWX True
Play Star Wars: Empire at War sweaw.exe {InstallDir}/GameData True
Terrain Editor EAW Terrain Editor.exe {InstallDir}/GameData False

Install Script

This script requires admin access to function properly

Empire at War's expansion pack requires specific registry keys to exist that point to the base game's installation directory.

$InstallDir = $PSScriptRoot
$EmpireAtWarPath = "HKLM:\SOFTWARE\WOW6432Node\LucasArts\Star Wars Empire at War\1.0"
$ForcesOfCorruptionPath = "HKLM:\SOFTWARE\WOW6432Node\LucasArts\Star Wars Empire at War Forces of Corruption\1.0"

New-Item -Path "$EmpireAtWarPath" -Force
New-Item -Path "$ForcesOfCorruptionPath" -Force

New-ItemProperty -Path $EmpireAtWarPath -Name "InstallPath" -Value $InstallDir
New-ItemProperty -Path $EmpireAtWarPath -Name "ExePath" -Value "$InstallDir\GameData\sweaw.exe"
New-ItemProperty -Path $EmpireAtWarPath -Name "CD Key" -Value ""
New-ItemProperty -Path $EmpireAtWarPath -Name "EAWGold" -Value 20070323
New-ItemProperty -Path $EmpireAtWarPath -Name "Installed" -Value 1
New-ItemProperty -Path $EmpireAtWarPath -Name "Revision" -Value 10105

New-ItemProperty -Path $ForcesOfCorruptionPath -Name "InstallPath" -Value "$InstallDir\EAWX"
New-ItemProperty -Path $ForcesOfCorruptionPath -Name "ExePath" -Value "$InstallDir\EAWX\swfoc.exe"
New-ItemProperty -Path $ForcesOfCorruptionPath -Name "CD Key" -Value ""
New-ItemProperty -Path $ForcesOfCorruptionPath -Name "EAWGold" -Value 20070323
New-ItemProperty -Path $ForcesOfCorruptionPath -Name "Installed" -Value 1
New-ItemProperty -Path $ForcesOfCorruptionPath -Name "Revision" -Value 10100

Uninstall Script

This script requires admin access to function properly

Removes the registry keys created by the install script

$EmpireAtWarPath = "HKLM:\SOFTWARE\WOW6432Node\LucasArts\Star Wars Empire at War"
$ForcesOfCorruptionPath = "HKLM:\SOFTWARE\WOW6432Node\LucasArts\Star Wars Empire at War Forces of Corruption"

Remove-Item -Path "$EmpireAtWarPath" -Force -Recurse
Remove-Item -Path "$ForcesOfCorruptionPath" -Force -Recurse

Name Change Script

$NewName = $args[0]

function Get-AsciiBytes([string]$InputString, [int]$MaxLength)
{
    if ($InputString.Length -gt $MaxLength)
    {
        $InputString = $InputString.Substring(0, $MaxLength)
    }

    $bytes = [System.Text.Encoding]::ASCII.GetBytes($InputString)
    $array = @()
    $count = 0

    $extraPadding = $MaxLength - $bytes.Length

    foreach ($byte in $bytes)
    {
        if ($count -lt $MaxLength)
        {
            $array += $byte
            $count++
        }
    }

    for ($i = $count; $i -lt $MaxLength; $i++)
    {
        $array += 0x00
    }

    return $array
}

function Separate-AsciiBytes([byte[]]$Data)
{
    $array = @()

    foreach ($byte in $Data)
    {
        $array += $byte
        $array += 0x00
    }

    $array += 0x00
    $array += 0x00

    return $array
}

$rawBytes = Get-AsciiBytes -InputString $NewName -MaxLength 20
$profileNameBytes = Separate-AsciiBytes -Data $rawBytes

New-Item -Path "HKCU:\SOFTWARE\Petroglyph"
New-Item -Path "HKCU:\SOFTWARE\Petroglyph\StarWars"
New-Item -Path "HKCU:\SOFTWARE\Petroglyph\StarWars\Profiles"
New-Item -Path "HKCU:\SOFTWARE\Petroglyph\StarWars\Profiles\Profile0"
New-Item -Path "HKCU:\SOFTWARE\Petroglyph\StarWars\Profiles\Profile0\Player"
New-Item -Path "HKCU:\SOFTWARE\Petroglyph\StarWars FOC"
New-Item -Path "HKCU:\SOFTWARE\Petroglyph\StarWars FOC\Profiles"
New-Item -Path "HKCU:\SOFTWARE\Petroglyph\StarWars FOC\Profiles\Profile0"
New-Item -Path "HKCU:\SOFTWARE\Petroglyph\StarWars FOC\Profiles\Profile0\Player"

New-ItemProperty -Path "HKCU:\SOFTWARE\Petroglyph\StarWars\Profiles\Profile0\Player" -Name "Name" -PropertyType Binary -Value $profileNameBytes -Force
New-ItemProperty -Path "HKCU:\SOFTWARE\Petroglyph\StarWars FOC\Profiles\Profile0\Player" -Name "Name" -PropertyType Binary -Value $profileNameBytes -Force