more ddraw handling fixes for profiler. ugh.

This commit is contained in:
2026-07-19 16:41:45 -05:00
parent 0ceba9c778
commit 24825ff396
+16 -12
View File
@@ -66,25 +66,29 @@ if (Test-Path $resDir) {
$startUtc = (Get-Date).ToUniversalTime() $startUtc = (Get-Date).ToUniversalTime()
# 3) Run the in-exe resource compiler (build-and-exit), guarded by a timeout. # 3) Run the in-exe resource compiler (build-and-exit), guarded by a timeout.
# - FULLSCREEN (no -window): the windowed DirectDraw/D3D7 path fails on Win11 (the editor's # - WINDOWED (-window): windowed mode works on all configs including VMs with generic adapters.
# "No 3D acceleration"/"No software rasterizer" problem). The fullscreen-exclusive path # ddraw.dll is moved aside above so MW4pro.exe runs against native DirectDraw.
# works (it's how the game runs) and the DWM shim applied above covers it.
# - /gosnodialogs: makes graphics warnings auto-continue and turns a fatal content STOP into # - /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. # 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.) # (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 (this can take a while) ..." -ForegroundColor Yellow Write-Host "[pack 2/3] running resource compiler (this can take a while) ..." -ForegroundColor Yellow
# Always run the builder windowed (-window). DDrawCompat's ddraw.dll handles windowed DDraw # Always run the builder windowed (-window). Windowed mode works on all tested configs including
# on Win10/11 and VMs with generic adapters. Fullscreen requires the DWM16-bit shim which # VMs with generic adapters. The ddraw.dll (DDrawCompat) that the editor installs is moved aside
# is unreliable on some machine configs. The builder only needs DDraw to init -- it never # above before this point, so MW4pro.exe runs against native DirectDraw in windowed mode.
# renders a frame with -norun, so windowed mode is always safe. # DLLs that must not be present while MW4pro.exe runs (windowed or fullscreen):
# dgVoodoo2 D3D interceptors (D3D8/D3D9/D3DImm.dll) must not be present during the build; # ddraw.dll = DDrawCompat (installed by deploy-editor.ps1 for the editor's windowed viewport).
# move them aside if present (defensive -- they should not be in the repo). # DDrawCompat intercepts DirectDraw and is fatal to MW4pro.exe in BOTH windowed
$dgvDlls = @("D3D8.dll","D3D9.dll","D3DImm.dll") | Where-Object { Test-Path (Join-Path $Runtime $_) } # and fullscreen modes. Move it aside and restore after the build.
# D3D8/D3D9/D3DImm.dll = dgVoodoo2 interceptors -- should not be in the repo but handled
# defensively in case they reappear.
$dllsToMoveAside = @("ddraw.dll","D3D8.dll","D3D9.dll","D3DImm.dll") | Where-Object { Test-Path (Join-Path $Runtime $_) }
$dgvMoved = @() $dgvMoved = @()
foreach ($d in $dgvDlls) { foreach ($d in $dllsToMoveAside) {
$src = Join-Path $Runtime $d; $bak = "$src.buildaside" $src = Join-Path $Runtime $d; $bak = "$src.buildaside"
Move-Item $src $bak -Force; $dgvMoved += $bak Move-Item $src $bak -Force; $dgvMoved += $bak
Write-Host " (moved $d aside -- dgVoodoo2 interceptors break the builder)" $reason = if ($d -eq "ddraw.dll") { "DDrawCompat breaks MW4pro.exe (windowed and fullscreen)" }
else { "dgVoodoo2 interceptor breaks the builder" }
Write-Host " (moved $d aside -- $reason)"
} }
$code = $null $code = $null
try { try {