diff --git a/src/d3d9/d3d9_cursor.cpp b/src/d3d9/d3d9_cursor.cpp index 999075df6..66751029d 100644 --- a/src/d3d9/d3d9_cursor.cpp +++ b/src/d3d9/d3d9_cursor.cpp @@ -40,6 +40,10 @@ namespace dxvk { BOOL D3D9Cursor::ShowCursor(BOOL bShow) { + // Cursor visibility remains unchanged (typically FALSE) if the cursor isn't set. + if (unlikely(m_hCursor == nullptr && m_sCursor.Width == 0 && m_sCursor.Height == 0)) + return m_visible; + if (likely(m_hCursor != nullptr)) ::SetCursor(bShow ? m_hCursor : nullptr); diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index ff34e8e04..37a49ea0d 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -345,9 +345,19 @@ namespace dxvk { uint32_t inputWidth = cursorTex->Desc()->Width; uint32_t inputHeight = cursorTex->Desc()->Height; - // Always use a hardware cursor when windowed. + // Check if surface dimensions are powers of two. + if ((inputWidth && (inputWidth & (inputWidth - 1))) + || (inputHeight && (inputHeight & (inputHeight - 1)))) + return D3DERR_INVALIDCALL; + D3DPRESENT_PARAMETERS params; m_implicitSwapchain->GetPresentParameters(¶ms); + + if (inputWidth > params.BackBufferWidth + || inputHeight > params.BackBufferHeight) + return D3DERR_INVALIDCALL; + + // Always use a hardware cursor when windowed. bool hwCursor = params.Windowed; // Always use a hardware cursor w/h <= 32 px