From 6462ceef24f5c0c878695489aab4bfd0ed2ae2d7 Mon Sep 17 00:00:00 2001 From: joevt Date: Wed, 20 Mar 2024 04:56:11 -0700 Subject: [PATCH] atimach64gx: Add offset to cursor X position. CUR_HORZ_OFF becomes non-zero when the cursor needs to be drawn to the left of the left edge of the frame buffer. CUR_VERT_OFF is handled differently. When CUR_VERT_OFF is non-zero, CUR_OFFSET is changed to point to the first line of the cursor that will be drawn, so CUR_VERT_OFF is the number of lines to remove from the total height of the cursor. Alternatively, we could handle CUR_VERT_OFF the same way as CUR_HORZ_OFF by leaving the cursor height constant, drawing the cursor starting from the CUR_VERT_OFF line, and adjusting cursor Y position by negative CUR_VERT_OFF. --- devices/video/atimach64gx.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/devices/video/atimach64gx.cpp b/devices/video/atimach64gx.cpp index 3e818d3..4c2196e 100644 --- a/devices/video/atimach64gx.cpp +++ b/devices/video/atimach64gx.cpp @@ -726,7 +726,8 @@ void AtiMach64Gx::draw_hw_cursor(uint8_t *dst_buf, int dst_pitch) { } void AtiMach64Gx::get_cursor_position(int& x, int& y) { - x = extract_bits(this->regs[ATI_CUR_HORZ_VERT_POSN], ATI_CUR_HORZ_POSN, ATI_CUR_HORZ_POSN_size); + x = extract_bits(this->regs[ATI_CUR_HORZ_VERT_POSN], ATI_CUR_HORZ_POSN, ATI_CUR_HORZ_POSN_size) - + extract_bits(this->regs[ATI_CUR_HORZ_VERT_OFF ], ATI_CUR_HORZ_OFF , ATI_CUR_HORZ_OFF_size ); y = extract_bits(this->regs[ATI_CUR_HORZ_VERT_POSN], ATI_CUR_VERT_POSN, ATI_CUR_VERT_POSN_size); }