[0.4.8] [WIN32SS] D3DKMT commit fix of zefklop for CORE-13714
authorJoachim Henze <Joachim.Henze@reactos.org>
Tue, 6 Mar 2018 20:06:07 +0000 (21:06 +0100)
committerJoachim Henze <Joachim.Henze@reactos.org>
Tue, 6 Mar 2018 20:06:07 +0000 (21:06 +0100)
This commit was *not* committed to master yet.
I'll leave the ticket unresolved until it'll be.

We had the palette for some games regressed starting with r75061
when using VBEMP (and our inbuilt Mesa, not the rapps Mesa).
This wasn't noticed early because the same commit led to
many games crashing as well. After we recovered from the crashes
later, we were confronted with a regressed palette state.
E.g. in Diablo II, Anno 1602, MS Age of Empires.

With that commit the palette now looks like in r75060 again.
Palette in Rapps Mesa is now equal again to palette inbuilt Mesa.
The palette is still not perfect -
(CORE-10738 still needs to be addressed later).

Many thanks to zefklop!

win32ss/reactx/ntddraw/d3dkmt.c

index 2dae7ba..cc0852e 100644 (file)
@@ -86,6 +86,17 @@ NtGdiDdDDICreateDCFromMemory(D3DKMT_CREATEDCFROMMEMORY *desc)
     /* Get the handle for the bitmap */
     desc->hBitmap = (HBITMAP)psurf->SurfObj.hsurf;
 
+    /* Allocate a palette for this surface */
+    if (format->bit_count <= 8)
+    {
+        PPALETTE palette = PALETTE_AllocPalette(PAL_INDEXED, 1 << format->bit_count, NULL, 0, 0, 0);
+        if (palette)
+        {
+            SURFACE_vSetPalette(psurf, palette);
+            PALETTE_ShareUnlockPalette(palette);
+        }
+    }
+
     /* Unlock the surface and return */
     SURFACE_UnlockSurface(psurf);