diff --git a/src/win32/fb_ddraw.cpp b/src/win32/fb_ddraw.cpp index 2521d6193..937fba046 100644 --- a/src/win32/fb_ddraw.cpp +++ b/src/win32/fb_ddraw.cpp @@ -143,6 +143,7 @@ DDrawFB::DDrawFB (int width, int height, bool fullscreen) NeedGammaUpdate = false; NeedPalUpdate = false; NeedResRecreate = false; + PaletteChangeExpected = false; MustBuffer = false; BufferingNow = false; WasBuffering = false; @@ -461,7 +462,7 @@ bool DDrawFB::CreateSurfacesComplex () { DDSURFACEDESC ddsd = { sizeof(ddsd), }; HRESULT hr; - int tries = 0; + int tries = 2; LOG ("creating surfaces using a complex primary\n"); @@ -717,7 +718,7 @@ void DDrawFB::PaletteChanged () // they are obviously jerks, and we need to restore our own palette. if (!Windowed) { - if (Palette != NULL) + if (!PaletteChangeExpected && Palette != NULL) { // It is not enough to set NeedPalUpdate to true. Some palette // entries might now be reserved for system usage, and nothing @@ -729,6 +730,7 @@ void DDrawFB::PaletteChanged () // somebody tries to lock it. NeedResRecreate = true; } + PaletteChangeExpected = false; } else { @@ -1197,6 +1199,7 @@ void DDrawFB::Update () if (pchanged && AppActive && !SessionState) { + PaletteChangeExpected = true; Palette->SetEntries (0, 0, 256, PalEntries); } } diff --git a/src/win32/win32iface.h b/src/win32/win32iface.h index 60dc9cbd3..66c396a96 100644 --- a/src/win32/win32iface.h +++ b/src/win32/win32iface.h @@ -208,6 +208,7 @@ private: bool NeedGammaUpdate; bool NeedPalUpdate; bool NeedResRecreate; + bool PaletteChangeExpected; bool MustBuffer; // The screen is not 8-bit, or there is no backbuffer bool BufferingNow; // Most recent Lock was buffered bool WasBuffering; // Second most recent Lock was buffered