Skip to content

Commit

Permalink
[d3d9] Hardware cursor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
WinterSnowfall authored and misyltoad committed Jul 7, 2024
1 parent 9b504b5 commit ef0c6b6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/d3d9/d3d9_cursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ namespace dxvk {


HRESULT D3D9Cursor::SetHardwareCursor(UINT XHotSpot, UINT YHotSpot, const CursorBitmap& bitmap) {
DWORD mask[32];
CursorMask mask;
std::memset(mask, ~0, sizeof(mask));

ICONINFO info;
info.fIcon = FALSE;
info.xHotspot = XHotSpot;
info.yHotspot = YHotSpot;
info.hbmMask = ::CreateBitmap(HardwareCursorWidth, HardwareCursorHeight, 1, 1, mask);
info.hbmMask = ::CreateBitmap(HardwareCursorWidth, HardwareCursorHeight, 1, 1, &mask[0]);
info.hbmColor = ::CreateBitmap(HardwareCursorWidth, HardwareCursorHeight, 1, 32, &bitmap[0]);

if (m_hCursor != nullptr)
Expand Down
9 changes: 9 additions & 0 deletions src/d3d9/d3d9_cursor.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,20 @@ namespace dxvk {

// Format Size of 4 bytes (ARGB)
using CursorBitmap = uint8_t[HardwareCursorHeight * HardwareCursorPitch];
// Monochrome mask (1 bit)
using CursorMask = uint8_t[HardwareCursorHeight * HardwareCursorWidth / 8];

class D3D9Cursor {

public:

#ifdef _WIN32
~D3D9Cursor() {
if (m_hCursor != nullptr)
::DestroyCursor(m_hCursor);
}
#endif

void UpdateCursor(int X, int Y);

BOOL ShowCursor(BOOL bShow);
Expand Down

0 comments on commit ef0c6b6

Please sign in to comment.