StarLancer

From LANCommander
Revision as of 01:31, 1 August 2023 by DoctorDalek (talk | contribs) (Created page with "Category:Games {{Game.InfoBox |Cover = cover.jpg |Developers = {{Game.InfoBox.Developer|Digital Anvil}} {{Game.InfoBox.Developer|Warthog PLC}} |Publishers = {{Game.InfoBox.Publisher|Microsoft}} |Release Date = {{Game.InfoBox.ReleaseDate|Windows|March 31, 2000}} |Genres = {{Game.InfoBox.Genre|Simulator}} | PCGamingWiki = StarLancer }} {{Game.ActionBox |Actions = {{Game.ActionBox.Row|Name = Play|Path = lancer.exe|Arguments = |WorkingDirectory = |Primary = True}} }}...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Developers
Digital Anvil

Warthog PLC

Publishers
Microsoft
Release Date
Windows: March 31, 2000
Genres
Simulator
View at PCGamingWiki

Actions

Name Path Arguments Working Directory Primary
Play lancer.exe True

Name Change Script

$NewName = $args[0]
$InstallDir = $PSScriptRoot

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 Patch-Binary([byte[]]$Data, [int]$Offset, [string]$FilePath)
{
    $bytes = [System.IO.File]::ReadAllBytes($FilePath)

    for ($i = 0; $i -lt $Data.Length; $i++)
    {
        $bytes[$Offset + $i] = $Data[$i]
    }

    [System.IO.File]::WriteAllBytes($FilePath, $bytes)
}

$rawBytes = Get-AsciiBytes -InputString $newName -MaxLength 18

Patch-Binary -FilePath "$InstallDir\profile.bin" -Offset 0x4 -Data $rawBytes