1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-29 01:24:11 +01:00

[d3d9] Hardware cursor fixes

This commit is contained in:
WinterSnowfall 2024-07-06 23:43:38 +03:00 committed by Joshie
parent 9b504b506e
commit ef0c6b6f6f
2 changed files with 11 additions and 2 deletions

View File

@ -26,14 +26,14 @@ namespace dxvk {
HRESULT D3D9Cursor::SetHardwareCursor(UINT XHotSpot, UINT YHotSpot, const CursorBitmap& bitmap) { HRESULT D3D9Cursor::SetHardwareCursor(UINT XHotSpot, UINT YHotSpot, const CursorBitmap& bitmap) {
DWORD mask[32]; CursorMask mask;
std::memset(mask, ~0, sizeof(mask)); std::memset(mask, ~0, sizeof(mask));
ICONINFO info; ICONINFO info;
info.fIcon = FALSE; info.fIcon = FALSE;
info.xHotspot = XHotSpot; info.xHotspot = XHotSpot;
info.yHotspot = YHotSpot; 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]); info.hbmColor = ::CreateBitmap(HardwareCursorWidth, HardwareCursorHeight, 1, 32, &bitmap[0]);
if (m_hCursor != nullptr) if (m_hCursor != nullptr)

View File

@ -11,11 +11,20 @@ namespace dxvk {
// Format Size of 4 bytes (ARGB) // Format Size of 4 bytes (ARGB)
using CursorBitmap = uint8_t[HardwareCursorHeight * HardwareCursorPitch]; using CursorBitmap = uint8_t[HardwareCursorHeight * HardwareCursorPitch];
// Monochrome mask (1 bit)
using CursorMask = uint8_t[HardwareCursorHeight * HardwareCursorWidth / 8];
class D3D9Cursor { class D3D9Cursor {
public: public:
#ifdef _WIN32
~D3D9Cursor() {
if (m_hCursor != nullptr)
::DestroyCursor(m_hCursor);
}
#endif
void UpdateCursor(int X, int Y); void UpdateCursor(int X, int Y);
BOOL ShowCursor(BOOL bShow); BOOL ShowCursor(BOOL bShow);