Need for Speed II: Difference between revisions

From LANCommander
(Created page with "Category:Games {{Game.InfoBox |Cover = cover.jpg |Developers = {{Game.InfoBox.Developer|EA Canada}} |Publishers = {{Game.InfoBox.Publisher|Electronic Arts}} |Release Date = {{Game.InfoBox.ReleaseDate|Windows|March 31, 1997}} |Genres = {{Game.InfoBox.Genre|Simulator}} {{Game.InfoBox.Genre|Racing}} | PCGamingWiki = Need_for_Speed_II }} {{Game.ActionBox |Actions = {{Game.ActionBox.Row|Name = Play|Path = nfs2se-gl2.exe|Arguments = |WorkingDirectory = |Primary = True}}...")
 
No edit summary
 
Line 9: Line 9:
{{Game.InfoBox.ReleaseDate|Windows|March 31, 1997}}
{{Game.InfoBox.ReleaseDate|Windows|March 31, 1997}}
|Genres =
|Genres =
{{Game.InfoBox.Genre|Simulator}}
{{Game.InfoBox.Genre|Simulator}}{{Game.InfoBox.Genre|Racing}}
{{Game.InfoBox.Genre|Racing}}
|PCGamingWiki = Need_for_Speed_II}}
| PCGamingWiki = Need_for_Speed_II
}}


{{Game.ActionBox
{{Game.ActionBox
|Actions =  
|Actions =  
{{Game.ActionBox.Row|Name = Play|Path = nfs2se-gl2.exe|Arguments = |WorkingDirectory = |Primary = True}}
{{Game.ActionBox.Row|Name = Play|Path = {InstallDir}\nfs2se-gl2.exe|Arguments = |WorkingDirectory = |Primary = True}}
}}
}}


{{Game.Scripts.Install
|Name = Install Script
|Description =
|RequiresAdmin = False
|Contents =
<syntaxhighlight lang="powershell" line>
$AppData = [Environment]::GetFolderPath('ApplicationData')
Copy-Item -Path "$InstallDirectory\ProfileTemplate" -Destination "$AppData\.nfs2se" -Recurse
</syntaxhighlight>
}}
           
{{Game.Scripts.Uninstall
|Name = Uninstall Script
|Description =
|RequiresAdmin = False
|Contents =
<syntaxhighlight lang="powershell" line>
$AppData = [Environment]::GetFolderPath('ApplicationData')
Remove-Item "$AppData\.nfs2se" -Recurse -ErrorAction Ignore
</syntaxhighlight>
}}
           
{{Game.Scripts.NameChange
{{Game.Scripts.NameChange
|Name = Name Change Script
|Name = Name Change Script
|Description = This script patches the config.dat file found in the user's AppData\Roaming\.nfs2se\config folder that is created by the NFSIISE port created by zaps166. The config file has no checksum so modifying the player names is as simple as patching two locations in the binary.
|Description = This script patches the config.dat file found in the user&#x27;s AppData\Roaming\.nfs2se\config folder that is created by the NFSIISE wrapper created by zaps166. The config file has no checksum so modifying the player names is as simple as patching two locations in the binary.
|RequiresAdmin = False
|RequiresAdmin = False
|Contents = <syntaxhighlight lang="powershell" line>
|Contents =
$NewName = $args[0]
<syntaxhighlight lang="powershell" line>
$InstallDir = $PSScriptRoot
$AppData = [Environment]::GetFolderPath('ApplicationData')
 
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 $bytes
}
 
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 8
# 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 8 -MinLength 8


Patch-Binary -FilePath "$($env:APPDATA)\.nfs2se\config.dat" -Offset 228 -Data $rawBytes
Edit-PatchBinary -FilePath "$AppData\.nfs2se\config\config.dat" -Offset 228 -Data $bytes
Patch-Binary -FilePath "$($env:APPDATA)\.nfs2se\config.dat" -Offset 428 -Data $rawBytes
Edit-PatchBinary -FilePath "$AppData\.nfs2se\config\config.dat" -Offset 428 -Data $bytes
</syntaxhighlight>
</syntaxhighlight>
}}
}}

Latest revision as of 03:29, 6 January 2024

Developers
EA Canada
Publishers
Electronic Arts
Release Date
Windows: March 31, 1997
Genres
SimulatorRacing
View at PCGamingWiki

Actions

Name Path Arguments Working Directory Primary
Play {InstallDir}\nfs2se-gl2.exe True

Install Script

$AppData = [Environment]::GetFolderPath('ApplicationData')

Copy-Item -Path "$InstallDirectory\ProfileTemplate" -Destination "$AppData\.nfs2se" -Recurse

Uninstall Script

$AppData = [Environment]::GetFolderPath('ApplicationData')

Remove-Item "$AppData\.nfs2se" -Recurse -ErrorAction Ignore

Name Change Script

This script patches the config.dat file found in the user's AppData\Roaming\.nfs2se\config folder that is created by the NFSIISE wrapper created by zaps166. The config file has no checksum so modifying the player names is as simple as patching two locations in the binary.

$AppData = [Environment]::GetFolderPath('ApplicationData')

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

Edit-PatchBinary -FilePath "$AppData\.nfs2se\config\config.dat" -Offset 228 -Data $bytes
Edit-PatchBinary -FilePath "$AppData\.nfs2se\config\config.dat" -Offset 428 -Data $bytes