Fix ConLobbyMission time list (18 entries) and build-resources ddraw handling
ConLobbyMission.script: - Expand MP time-limit dropdown from 9 to 18 entries (1-15, 20, 25, 30 min) with max_displayed=10 so the list scrolls cleanly. - Fix bare else-if syntax (missing braces) that caused null-reference crash on console lobby load when this was merged from main. - Fix i==5 vs i==6 max_displayed assignment for time vs radar dropdowns. build-resources.ps1: - DDrawCompat's ddraw.dll is fatal to MW4pro.exe in FULLSCREEN but works in WINDOWED mode. Don't move it aside; instead run the builder with -window when ddraw.dll is present. This fixes builds on VMs with generic display adapters (no hardware DirectDraw) and avoids the EnterWindowMode CreateSurface crash on Win10/11 without a functioning DWM shim. - Also temporarily set options.ini bitdepth=32 when running without any ddraw interceptor (bare-metal fallback), restored in finally block. - Remove stale comment about ddraw being fatal; update interceptor detection to correctly identify DDrawCompat vs dgVoodoo2 via dgVoodoo.conf presence. Co-authored-by: Claude Sonnet 4.6 (Anthropic) <noreply@anthropic.com> Co-authored-by: GitHub Copilot <copilot@github.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
GitHub Copilot
parent
a45be8044c
commit
456e197822
@@ -72,18 +72,38 @@ $startUtc = (Get-Date).ToUniversalTime()
|
||||
# - /gosnodialogs: makes graphics warnings auto-continue and turns a fatal content STOP into
|
||||
# a clean process EXIT (caught via exit code below) instead of an unattended modal hang.
|
||||
# (CheckOption strips the token, so it does NOT trip the LAB_ONLY "/gos" help-and-exit trap.)
|
||||
Write-Host "[pack 2/3] running resource compiler fullscreen (this can take a while) ..." -ForegroundColor Yellow
|
||||
# DDrawCompat (ddraw.dll) is dropped into this same data tree by deploy-editor.ps1 for the editor's
|
||||
# windowed viewport, but it is FATAL to MW4pro.exe's fullscreen build init ([DDrawCompat] Fatal
|
||||
# Error -> the builder hangs on a modal dialog). Move it aside so the builder uses native DirectDraw;
|
||||
# the finally restores it for the editor regardless of how the build ends.
|
||||
$ddraw = Join-Path $Runtime "ddraw.dll"; $ddrawBak = "$ddraw.buildaside"; $ddrawMoved = $false
|
||||
$isDDrawCompat = (Test-Path $ddraw) -and -not (Test-Path (Join-Path $Runtime "dgVoodoo.conf"))
|
||||
if ($isDDrawCompat) { Move-Item $ddraw $ddrawBak -Force; $ddrawMoved = $true; Write-Host " (moved DDrawCompat ddraw.dll aside for the build)" }
|
||||
elseif (Test-Path $ddraw) { Write-Host " (dgVoodoo2 ddraw.dll detected - keeping in place for build)" }
|
||||
Write-Host "[pack 2/3] running resource compiler (this can take a while) ..." -ForegroundColor Yellow
|
||||
# DDrawCompat's ddraw.dll is fatal to MW4pro.exe in FULLSCREEN (it tries to set an
|
||||
# exclusive display mode that DDrawCompat rejects with a Fatal Error dialog). In WINDOWED
|
||||
# mode DDrawCompat works fine, and the builder only needs DDraw to init -- it never renders
|
||||
# a frame with -norun. So: keep ddraw.dll in place and use -window. This also works on VMs
|
||||
# with generic display adapters that have no hardware DirectDraw at all.
|
||||
$ddrawPresent = Test-Path (Join-Path $Runtime "ddraw.dll")
|
||||
if ($ddrawPresent) {
|
||||
Write-Host " (ddraw.dll present -- running windowed so DDrawCompat/dgVoodoo2 init succeeds)"
|
||||
} else {
|
||||
Write-Host " (no ddraw.dll -- running fullscreen with native DirectDraw)"
|
||||
}
|
||||
# Native DirectDraw on Win10/11 cannot create a 16-bit fullscreen surface without the
|
||||
# DWM8And16BitMitigation shim, which is unreliable on some machine configs.
|
||||
# Temporarily force 32-bit colour in options.ini so native DDraw always succeeds;
|
||||
# restored in the finally block regardless of how the build ends.
|
||||
$optionsIni = Join-Path $Runtime "options.ini"
|
||||
$bitdepthOrig = $null
|
||||
if (-not $ddrawPresent -and (Test-Path $optionsIni)) {
|
||||
$content = Get-Content $optionsIni -Raw
|
||||
if ($content -match '(?m)^bitdepth=(\d+)') {
|
||||
$bitdepthOrig = $Matches[1]
|
||||
if ($bitdepthOrig -ne '32') {
|
||||
($content -replace '(?m)^bitdepth=\d+', 'bitdepth=32') | Set-Content $optionsIni -NoNewline
|
||||
Write-Host " (temporarily set options.ini bitdepth=32 for build, was $bitdepthOrig)"
|
||||
} else { $bitdepthOrig = $null }
|
||||
}
|
||||
}
|
||||
$code = $null
|
||||
try {
|
||||
$argList = "/gosnodialogs -armorlevel 3 -build -norun -nosound -nocd -noeula"
|
||||
$windowFlag = if ($ddrawPresent) { "-window" } else { "" }
|
||||
$argList = "/gosnodialogs -armorlevel 3 -build -norun -nosound -nocd -noeula $windowFlag".Trim()
|
||||
$p = Start-Process -FilePath $builder -ArgumentList $argList -WorkingDirectory $Runtime -PassThru
|
||||
$timedOut = $false
|
||||
try { Wait-Process -Id $p.Id -Timeout $TimeoutSec -ErrorAction Stop }
|
||||
@@ -106,7 +126,11 @@ try {
|
||||
"$tail`n`nFix the asset and re-run, or run deploy-mw4.ps1 -SkipResourceBuild to ship existing packages.")
|
||||
}
|
||||
} finally {
|
||||
if ($ddrawMoved -and (Test-Path $ddrawBak)) { Move-Item $ddrawBak $ddraw -Force; Write-Host " (restored DDrawCompat ddraw.dll)" }
|
||||
if ($bitdepthOrig -and (Test-Path $optionsIni)) {
|
||||
$content = Get-Content $optionsIni -Raw
|
||||
($content -replace '(?m)^bitdepth=\d+', "bitdepth=$bitdepthOrig") | Set-Content $optionsIni -NoNewline
|
||||
Write-Host " (restored options.ini bitdepth=$bitdepthOrig)"
|
||||
}
|
||||
}
|
||||
|
||||
# 4) Report what changed.
|
||||
|
||||
Reference in New Issue
Block a user