добавлен упущенный laa

This commit is contained in:
2026-08-05 01:58:29 +04:00
parent 83f5e08689
commit c1c2b4e8bb
+111 -8
View File
@@ -8,6 +8,73 @@ param(
[switch]$NativeRenderer
)
function Enable-LargeAddressAware {
param(
[Parameter(Mandatory)]
[string]$Path
)
$bytes = [System.IO.File]::ReadAllBytes($Path)
if ($bytes.Length -lt 64) {
throw "File is too small to be a valid PE executable: $Path"
}
# DOS header: MZ
if ($bytes[0] -ne 0x4D -or $bytes[1] -ne 0x5A) {
throw "DOS MZ signature was not found: $Path"
}
# IMAGE_DOS_HEADER.e_lfanew
$peOffset = [BitConverter]::ToInt32($bytes, 0x3C)
if ($peOffset -lt 0 -or ($peOffset + 24) -gt $bytes.Length) {
throw "Invalid PE header offset in: $Path"
}
# PE\0\0 signature
$peSignature = [BitConverter]::ToUInt32($bytes, $peOffset)
if ($peSignature -ne 0x00004550) {
throw "PE signature was not found: $Path"
}
# IMAGE_FILE_HEADER starts after the 4-byte PE signature.
# Characteristics is at offset 18 inside IMAGE_FILE_HEADER.
$characteristicsOffset = $peOffset + 4 + 18
$characteristics = [BitConverter]::ToUInt16(
$bytes,
$characteristicsOffset
)
$newCharacteristics = [uint16](
$characteristics -bor 0x0020
)
if ($newCharacteristics -ne $characteristics) {
$encoded = [BitConverter]::GetBytes($newCharacteristics)
$bytes[$characteristicsOffset] = $encoded[0]
$bytes[$characteristicsOffset + 1] = $encoded[1]
[System.IO.File]::WriteAllBytes($Path, $bytes)
Write-Host (
"LAA enabled for {0}: 0x{1:X4} -> 0x{2:X4}" -f
$Path,
$characteristics,
$newCharacteristics
) -ForegroundColor Green
}
else {
Write-Host (
"LAA is already enabled for {0}: 0x{1:X4}" -f
$Path,
$characteristics
) -ForegroundColor DarkGreen
}
}
$ErrorActionPreference = 'Stop'
$repoRoot = $PSScriptRoot
$cmake = 'C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe'
@@ -55,19 +122,55 @@ $selectedProxy = if ($NativeRenderer) { $nativeProxy } else { $modernProxy }
$adtResources = Join-Path $repoRoot 'vendor\modules\wxl-modern-adt\_resources'
function Install-WarcraftXLArtifacts {
param([Parameter(Mandatory)][string]$Destination)
param(
[Parameter(Mandatory)]
[string]$Destination
)
$utils = Join-Path $Destination 'Utils'
$loosePatch = Join-Path $Destination 'Data\Patch-WXL.MPQ'
New-Item -ItemType Directory -Path $Destination, $utils, $loosePatch -Force | Out-Null
Copy-Item -LiteralPath $stockExe -Destination (Join-Path $Destination 'Wow.exe') -Force
Copy-Item -LiteralPath $warcraftXL -Destination (Join-Path $Destination 'WarcraftXL.dll') -Force
Copy-Item -LiteralPath $selectedProxy -Destination (Join-Path $Destination 'd3d9.dll') -Force
Copy-Item -LiteralPath $nativeProxy -Destination (Join-Path $utils 'd3d9-native.dll') -Force
Copy-Item -LiteralPath $hostExe -Destination (Join-Path $utils 'WarcraftXLHost.exe') -Force
New-Item `
-ItemType Directory `
-Path $Destination, $utils, $loosePatch `
-Force |
Out-Null
$destinationExe = Join-Path $Destination 'Wow.exe'
Copy-Item `
-LiteralPath $stockExe `
-Destination $destinationExe `
-Force
Enable-LargeAddressAware -Path $destinationExe
Copy-Item `
-LiteralPath $warcraftXL `
-Destination (Join-Path $Destination 'WarcraftXL.dll') `
-Force
Copy-Item `
-LiteralPath $selectedProxy `
-Destination (Join-Path $Destination 'd3d9.dll') `
-Force
Copy-Item `
-LiteralPath $nativeProxy `
-Destination (Join-Path $utils 'd3d9-native.dll') `
-Force
Copy-Item `
-LiteralPath $hostExe `
-Destination (Join-Path $utils 'WarcraftXLHost.exe') `
-Force
Get-ChildItem -LiteralPath $adtResources | ForEach-Object {
Copy-Item -LiteralPath $_.FullName -Destination $loosePatch -Recurse -Force
Copy-Item `
-LiteralPath $_.FullName `
-Destination $loosePatch `
-Recurse `
-Force
}
}