diff options
author | Jaroslav Hensl <jara@hensl.cz> | 2023-07-06 12:52:00 +0200 |
---|---|---|
committer | Jaroslav Hensl <jara@hensl.cz> | 2023-07-06 12:52:00 +0200 |
commit | d53f427dc984abe25616287fded56d7a02a85809 (patch) | |
tree | 497fb8d9c828a06ecc722113f93da8505c754710 /dibcall.c | |
parent | 7f80983c1b9431380a9dce18586e0eea57be5707 (diff) | |
download | vmdisp9x-d53f427dc984abe25616287fded56d7a02a85809.tar.gz |
QEMU VMWARE adapter operational + better idle on 32bpp + HW cursor (bugged in VBox, disabled by default)
Diffstat (limited to 'dibcall.c')
-rw-r--r-- | dibcall.c | 176 |
1 files changed, 172 insertions, 4 deletions
@@ -22,7 +22,6 @@ THE SOFTWARE. *****************************************************************************/
-
#include "winhack.h"
#include <gdidefs.h>
#include <dibeng.h>
@@ -30,6 +29,11 @@ THE SOFTWARE. #include "minidrv.h"
+#ifdef SVGA
+# include "svga_all.h"
+# include <string.h>
+#endif
+
/*
* What's this all about? Most of the required exported driver functions can
* be passed straight to the DIB Engine. The DIB Engine in some cases requires
@@ -45,14 +49,178 @@ THE SOFTWARE. * are not hardware specific.
*/
+/* from DDK98 */
+typedef struct
+{
+ int xHotSpot, yHotSpot;
+ int cx, cy;
+ int cbWidth;
+ BYTE Planes, BitsPixel;
+} CURSORSHAPE;
+
+#ifdef SVGA
+BOOL cursorVisible = FALSE;
+#endif
+
#pragma code_seg( _TEXT )
+#ifdef SVGA
+# ifndef HWCURSOR
+static LONG cursorX = 0;
+static LONG cursorY = 0;
+static LONG cursorW = 0;
+static LONG cursorH = 0;
+static LONG cursorHX = 0;
+static LONG cursorHY = 0;
+
+void update_cursor()
+{
+ if(wBpp == 32)
+ {
+ LONG x = cursorX - cursorHX;
+ LONG y = cursorY - cursorHY;
+ LONG w = cursorW;
+ LONG h = cursorH;
+
+ if(x < 0) x = 0;
+ if(y < 0) y = 0;
+ if(x+w > wScreenX) w = wScreenX - x;
+ if(y+h > wScreenY) y = wScreenY - h;
+
+ if(w > 0 && h > 0)
+ {
+ SVGA_Update(x, y, w, h);
+ }
+ }
+}
+# endif
+#endif
+
+void WINAPI __loadds MoveCursor(WORD absX, WORD absY)
+{
+ if(wEnabled)
+ {
+#ifdef SVGA
+ if(wBpp == 32)
+ {
+# ifdef HWCURSOR
+ SVGA_MoveCursor(cursorVisible, absX, absY, 0);
+# else
+ DIB_MoveCursorExt(absX, absY, lpDriverPDevice);
+ update_cursor();
+ cursorX = absX;
+ cursorY = absY;
+ update_cursor();
+# endif
+ return;
+ }
+#endif
+ DIB_MoveCursorExt(absX, absY, lpDriverPDevice);
+ }
+}
+
+WORD WINAPI __loadds SetCursor_driver(CURSORSHAPE __far *lpCursor)
+{
+ if(wEnabled)
+ {
+#ifdef SVGA
+ if(wBpp == 32)
+ {
+# ifdef HWCURSOR
+ void __far* ANDMask = NULL;
+ void __far* XORMask = NULL;
+ SVGAFifoCmdDefineCursor cur;
+
+ if(lpCursor != NULL)
+ {
+ cur.id = 0;
+ cur.hotspotX = lpCursor->xHotSpot;
+ cur.hotspotY = lpCursor->yHotSpot;
+ cur.width = lpCursor->cx;
+ cur.height = lpCursor->cy;
+ cur.andMaskDepth = 1;
+ cur.xorMaskDepth = 1;
+
+ dbg_printf("cx: %d, cy: %d, cbWidth: %d, Planes: %d\n", lpCursor->cx, lpCursor->cy, lpCursor->cbWidth, lpCursor->Planes);
+
+ SVGA_BeginDefineCursor(&cur, &ANDMask, &XORMask);
+
+ if(ANDMask)
+ {
+ _fmemcpy(ANDMask, lpCursor+1, lpCursor->cbWidth*lpCursor->cy);
+ }
+
+ if(XORMask)
+ {
+ BYTE __far *ptr = (BYTE __far *)(lpCursor+1);
+ ptr += lpCursor->cbWidth*lpCursor->cy;
+
+ _fmemcpy(XORMask, ptr, lpCursor->cbWidth*lpCursor->cy);
+ }
+
+ SVGA_FIFOCommitAll();
+ cursorVisible = TRUE;
+ return 1;
+ }
+ else
+ {
+ /* virtual bug on SVGA_MoveCursor(FALSE, ...)
+ * so if is cursor NULL, create empty
+ */
+ cur.id = 0;
+ cur.hotspotX = 0;
+ cur.hotspotY = 0;
+ cur.width = 32;
+ cur.height = 32;
+ cur.andMaskDepth = 1;
+ cur.xorMaskDepth = 1;
+
+ SVGA_BeginDefineCursor(&cur, &ANDMask, &XORMask);
+
+ if(ANDMask) _fmemset(ANDMask, 0xFF, 4*32);
+ if(XORMask) _fmemset(XORMask, 0, 4*32);
+
+ SVGA_FIFOCommitAll();
+
+ SVGA_MoveCursor(FALSE, 0, 0, 0);
+ cursorVisible = FALSE;
+ return 1;
+ }
+# else
+ if(lpCursor != NULL)
+ {
+ cursorW = lpCursor->cx;
+ cursorH = lpCursor->cy;
+ cursorHX = lpCursor->xHotSpot;
+ cursorHY = lpCursor->yHotSpot;
+ }
+# endif
+ } // 32bpp
+#endif
+ DIB_SetCursorExt(lpCursor, lpDriverPDevice);
+ return 1;
+ }
+ return 0;
+}
+
/* Exported as DISPLAY.104 */
void WINAPI __loadds CheckCursor( void )
{
- if( wEnabled ) {
- DIB_CheckCursorExt( lpDriverPDevice );
- }
+ if( wEnabled ) {
+#ifdef SVGA
+# ifndef HWCURSOR
+ DIB_CheckCursorExt( lpDriverPDevice );
+ if(wBpp == 32)
+ {
+ update_cursor();
+ }
+# else
+ if(wBpp != 32) DIB_CheckCursorExt( lpDriverPDevice );
+# endif
+#else
+ DIB_CheckCursorExt( lpDriverPDevice );
+#endif
+ }
}
/* If there is no hardware screen-to-screen BitBlt, there's no point in
|