From 24825ff396dcafb6dac59cd7d8f5e11a5146a370 Mon Sep 17 00:00:00 2001 From: RT Date: Sun, 19 Jul 2026 16:41:45 -0500 Subject: [PATCH] more ddraw handling fixes for profiler. ugh. --- build-env/build-resources.ps1 | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/build-env/build-resources.ps1 b/build-env/build-resources.ps1 index 01bf7b48..2cc809d5 100644 --- a/build-env/build-resources.ps1 +++ b/build-env/build-resources.ps1 @@ -66,25 +66,29 @@ if (Test-Path $resDir) { $startUtc = (Get-Date).ToUniversalTime() # 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 -# "No 3D acceleration"/"No software rasterizer" problem). The fullscreen-exclusive path -# works (it's how the game runs) and the DWM shim applied above covers it. +# - WINDOWED (-window): windowed mode works on all configs including VMs with generic adapters. +# ddraw.dll is moved aside above so MW4pro.exe runs against native DirectDraw. # - /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 (this can take a while) ..." -ForegroundColor Yellow -# Always run the builder windowed (-window). DDrawCompat's ddraw.dll handles windowed DDraw -# on Win10/11 and VMs with generic adapters. Fullscreen requires the DWM16-bit shim which -# is unreliable on some machine configs. The builder only needs DDraw to init -- it never -# renders a frame with -norun, so windowed mode is always safe. -# dgVoodoo2 D3D interceptors (D3D8/D3D9/D3DImm.dll) must not be present during the build; -# move them aside if present (defensive -- they should not be in the repo). -$dgvDlls = @("D3D8.dll","D3D9.dll","D3DImm.dll") | Where-Object { Test-Path (Join-Path $Runtime $_) } +# Always run the builder windowed (-window). Windowed mode works on all tested configs including +# VMs with generic adapters. The ddraw.dll (DDrawCompat) that the editor installs is moved aside +# above before this point, so MW4pro.exe runs against native DirectDraw in windowed mode. +# DLLs that must not be present while MW4pro.exe runs (windowed or fullscreen): +# ddraw.dll = DDrawCompat (installed by deploy-editor.ps1 for the editor's windowed viewport). +# DDrawCompat intercepts DirectDraw and is fatal to MW4pro.exe in BOTH windowed +# 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 = @() -foreach ($d in $dgvDlls) { +foreach ($d in $dllsToMoveAside) { $src = Join-Path $Runtime $d; $bak = "$src.buildaside" 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 try {