Impossible Creatures: Difference between revisions

From LANCommander
(Created page with "Category:Games {{Game.InfoBox |Cover = cover.jpg |Developers = {{Game.InfoBox.Developer|Relic Entertainment}} |Publishers = {{Game.InfoBox.Publisher|Nordic Games Publishing}} {{Game.InfoBox.Publisher|Microsoft Game Studios}} |Release Date = {{Game.InfoBox.ReleaseDate|Windows|December 29, 2002}} |Genres = {{Game.InfoBox.Genre|Simulator}} {{Game.InfoBox.Genre|Real Time Strategy (RTS)}} {{Game.InfoBox.Genre|Strategy}} | PCGamingWiki = Impossible_Creatures }} {{Game.Act...")
 
No edit summary
 
Line 5: Line 5:
{{Game.InfoBox.Developer|Relic Entertainment}}
{{Game.InfoBox.Developer|Relic Entertainment}}
|Publishers =
|Publishers =
{{Game.InfoBox.Publisher|Nordic Games Publishing}}
{{Game.InfoBox.Publisher|Nordic Games Publishing}}{{Game.InfoBox.Publisher|Microsoft Game Studios}}
{{Game.InfoBox.Publisher|Microsoft Game Studios}}
|Release Date =
|Release Date =
{{Game.InfoBox.ReleaseDate|Windows|December 29, 2002}}
{{Game.InfoBox.ReleaseDate|Windows|December 29, 2002}}
|Genres =
|Genres =
{{Game.InfoBox.Genre|Simulator}}
{{Game.InfoBox.Genre|Simulator}}{{Game.InfoBox.Genre|Real Time Strategy (RTS)}}{{Game.InfoBox.Genre|Strategy}}
{{Game.InfoBox.Genre|Real Time Strategy (RTS)}}
|PCGamingWiki = Impossible_Creatures}}
{{Game.InfoBox.Genre|Strategy}}
| PCGamingWiki = Impossible_Creatures
}}


{{Game.ActionBox
{{Game.ActionBox
|Actions =  
|Actions =  
{{Game.ActionBox.Row|Name = Setup|Path = ICConfig.exe|Arguments = |WorkingDirectory = |Primary = False}}
{{Game.ActionBox.Row|Name = Setup|Path = {InstallDir}\ICConfig.exe|Arguments = |WorkingDirectory = |Primary = False}}
{{Game.ActionBox.Row|Name = Mission Editor|Path = MissionEditor.exe|Arguments = |WorkingDirectory = |Primary = False}}
{{Game.ActionBox.Row|Name = Mission Editor|Path = {InstallDir}\MissionEditor.exe|Arguments = |WorkingDirectory = |Primary = False}}
{{Game.ActionBox.Row|Name = Play|Path = IC.exe|Arguments = |WorkingDirectory = |Primary = True}}
{{Game.ActionBox.Row|Name = Play|Path = {InstallDir}\IC.exe|Arguments = |WorkingDirectory = |Primary = True}}
}}
}}


{{Game.Scripts.Install
{{Game.Scripts.Install
Line 27: Line 24:
|Description =  
|Description =  
|RequiresAdmin = False
|RequiresAdmin = False
|Contents = <syntaxhighlight lang="powershell" line>
|Contents =
$InstallDir = $PSScriptRoot
<syntaxhighlight lang="powershell" line>
# Accessible via $Display.ScreenWidth and $Display.ScreenHeight
# Bounds are accessible by $Display.Bounds.Width and $Display.Bounds.Height
Add-Type -AssemblyName System.Windows.Forms
$Display = Get-PrimaryDisplay
$Display = [System.Windows.Forms.Screen]::AllScreens | Where-Object Primary | Select Bounds


function Write-ReplaceContentInFile([string]$Regex, [string]$Replacement, [string]$FilePath)
# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
{
Write-ReplaceContentInFile -Pattern '^screenwidth=(.+)' -Substitution "screenwidth=$($Display.Bounds.Width)" -FilePath "$InstallDirectory\local.ini"
    $content = (Get-Content $FilePath) -replace $Regex, $Replacement
Write-ReplaceContentInFile -Pattern '^screenheight=(.+)' -Substitution "screenheight=$($Display.Bounds.Height)" -FilePath "$InstallDirectory\local.ini"
    [IO.File]::WriteAllLines($FilePath, $content)
}


# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Rename-Item -Path "$InstallDirectory\Movies\Nordic_Games.bik" -NewName "$InstallDirectory\Movies\Nordic_Games.bik.bak"
Write-ReplaceContentInFile -Regex '^screenwidth=(.+)' -Replacement "screenwidth=$($Display.Width)" -FilePath "$InstallDir\local.ini"
Rename-Item -Path "$InstallDirectory\Movies\relicintro.bik" -NewName "$InstallDirectory\Movies\relicintro.bik.bak"
Write-ReplaceContentInFile -Regex '^screenheight=(.+)' -Replacement "screenheight=$($Display.Height)" -FilePath "$InstallDir\local.ini"
</syntaxhighlight>
</syntaxhighlight>
}}
}}
 
           
{{Game.Scripts.NameChange
{{Game.Scripts.NameChange
|Name = Name Change Script
|Name = Name Change Script
|Description =  
|Description =  
|RequiresAdmin = False
|RequiresAdmin = False
|Contents = <syntaxhighlight lang="powershell" line>
|Contents =
$InstallDir = $PSScriptRoot
<syntaxhighlight lang="powershell" line>
$NewName = $args[0]
# 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 10 -MinLength 10
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++
        }
    }
 
    # Pad the end with 0x00 to meet our max length
    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)
}
 
function Write-ReplaceContentInFile([string]$Regex, [string]$Replacement, [string]$FilePath)
{
    $content = (Get-Content $FilePath) -replace $Regex, $Replacement
    [IO.File]::WriteAllLines($FilePath, $content)
}
 
function Separate-AsciiBytes([byte[]]$Data)
{
    $array = @()
 
    foreach ($byte in $Data)
    {
        $array += $byte
        $array += 0x00
    }
 
    return $array
}


# Convert an input string to ASCII-encoded byte[]. Shorter strings will pad out to 12 bytes, longer strings will be trimmed.
#Edit-PatchBinary -FilePath "$InstallDirectory\Profiles\Profile2\name.dat" -Offset 0x02 -Data $bytes
$bytes = Get-AsciiBytes -InputString $NewName -MaxLength 10
$bytes = Separate-AsciiBytes -Data $bytes


# Writes byte[] to a file at an offset
Patch-Binary -FilePath "$InstallDir\Profiles\Profile2\name.dat" -Offset 0x02 -Data $bytes
</syntaxhighlight>
</syntaxhighlight>
}}
}}

Latest revision as of 02:13, 6 January 2024

Developers
Relic Entertainment
Publishers
Nordic Games PublishingMicrosoft Game Studios
Release Date
Windows: December 29, 2002
Genres
SimulatorReal Time Strategy (RTS)Strategy
View at PCGamingWiki

Actions

Name Path Arguments Working Directory Primary
Setup {InstallDir}\ICConfig.exe False
Mission Editor {InstallDir}\MissionEditor.exe False
Play {InstallDir}\IC.exe True

Install Script

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

# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Write-ReplaceContentInFile -Pattern '^screenwidth=(.+)' -Substitution "screenwidth=$($Display.Bounds.Width)" -FilePath "$InstallDirectory\local.ini"
Write-ReplaceContentInFile -Pattern '^screenheight=(.+)' -Substitution "screenheight=$($Display.Bounds.Height)" -FilePath "$InstallDirectory\local.ini"

Rename-Item -Path "$InstallDirectory\Movies\Nordic_Games.bik" -NewName "$InstallDirectory\Movies\Nordic_Games.bik.bak"
Rename-Item -Path "$InstallDirectory\Movies\relicintro.bik" -NewName "$InstallDirectory\Movies\relicintro.bik.bak"

Name Change Script

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

#Edit-PatchBinary -FilePath "$InstallDirectory\Profiles\Profile2\name.dat" -Offset 0x02 -Data $bytes