Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

fix(ww3d2): -dx11dump makes the directory it was given

Olcay Seygan0937a850f929
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11backend.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11backend.cpp
index 8089227f2..f94c83d0d 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11backend.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11backend.cpp
@@ -513,6 +513,12 @@ bool DX11BackendClass::Any_Missing_Texture() const
void DX11BackendClass::Set_Dump_Directory(const char * directory)
{
DumpDirectory = directory == NULL ? "" : directory;
+
+ // fopen will not make the directory, and a dump that writes nothing looks exactly like a run
+ // that built no pipelines. An existing one comes back as an error and is ignored.
+ if (!DumpDirectory.empty()) {
+ CreateDirectoryA(DumpDirectory.c_str(), NULL);
+ }
}
// The key has characters a file name cannot carry, so it becomes the file's first line and the
diff --git a/dx11-check.ps1 b/dx11-check.ps1
index da31984cb..23b40a6a7 100644
--- a/dx11-check.ps1
+++ b/dx11-check.ps1
@@ -64,12 +64,17 @@ function Shoot($c, $tag, $extra) {
return $out
}
-# Every fourth pixel of every other row, counting the ones more than 40 apart in summed channels.
-# The same measure tree-check.ps1 uses, so the two numbers are comparable.
+# Every other pixel of every other row, counting the ones more than 40 apart in summed channels.
+#
+# The whole frame, where tree-check.ps1 stops at row 520 to keep the command bar out of a comparison
+# about trees. Carrying that limit over here hid a bug for the length of the phase: the 2D layer was
+# drawn half a pixel off under Direct3D 11, 45% of the command bar was past this threshold, and every
+# number this script printed was blind to it. An instrument that cannot see part of the picture
+# cannot be the exit condition for drawing the picture.
function DiffPct($a, $b) {
$ia = New-Object System.Drawing.Bitmap($a)
$ib = New-Object System.Drawing.Bitmap($b)
- $w = $ia.Width; $h = [Math]::Min($ia.Height, 520)
+ $w = $ia.Width; $h = $ia.Height
$apart = 0; $total = 0
for ($y = 0; $y -lt $h; $y += 2) {
for ($x = 0; $x -lt $w; $x += 2) {