aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaroslav Hensl <jara@hensl.cz>2024-07-06 18:52:00 +0200
committerJaroslav Hensl <jara@hensl.cz>2024-07-06 18:52:00 +0200
commit4d88a00bbf47515c38339966a38acb76559eafea (patch)
tree0cc75e4ba942eccfa95de6ed524105800aacaf03
parente04537c2481cfdf3537c9e108fb8632181151d2c (diff)
downloadvmdisp9x-4d88a00bbf47515c38339966a38acb76559eafea.tar.gz
mouse tests
-rw-r--r--makefile2
-rw-r--r--tools/test/mouse.c98
-rw-r--r--vxd_main.c15
3 files changed, 113 insertions, 2 deletions
diff --git a/makefile b/makefile
index 0d0ebf1..39167f4 100644
--- a/makefile
+++ b/makefile
@@ -12,7 +12,7 @@ OBJS += &
INCS = -I$(%WATCOM)\h\win -Iddk -Ivmware
-VER_BUILD = 54
+VER_BUILD = 57
FLAGS = -DDRV_VER_BUILD=$(VER_BUILD)
diff --git a/tools/test/mouse.c b/tools/test/mouse.c
new file mode 100644
index 0000000..a286d3c
--- /dev/null
+++ b/tools/test/mouse.c
@@ -0,0 +1,98 @@
+#include <Windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "../../3d_accel.h"
+
+#define DRIVER "vmwsmini.vxd"
+#define CMD_SIZE 128
+
+BOOL run_command(HANDLE vxd, const char *cmdline)
+{
+ if(strncmp(cmdline, "show", sizeof("show")-1) == 0)
+ {
+ DeviceIoControl(vxd, OP_MOUSE_SHOW,
+ NULL, 0,
+ NULL, 0,
+ NULL, NULL);
+ }
+ else if(strncmp(cmdline, "hide", sizeof("hide")-1) == 0)
+ {
+ DeviceIoControl(vxd, OP_MOUSE_HIDE,
+ NULL, 0,
+ NULL, 0,
+ NULL, NULL);
+ }
+ else if(strncmp(cmdline, "move", sizeof("move")-1) == 0)
+ {
+ DWORD pos[2] = {0, 0};
+ char *ptr = (char*)cmdline + sizeof("move") - 1;
+
+ pos[0] = strtoul(ptr, &ptr, 0);
+ pos[1] = strtoul(ptr, NULL, 0);
+
+ DeviceIoControl(vxd, OP_MOUSE_MOVE,
+ &pos[0], sizeof(pos),
+ NULL, 0,
+ NULL, NULL);
+ }
+ else if(strncmp(cmdline, "exit", sizeof("exit")-1) == 0)
+ {
+ return FALSE;
+ }
+ else
+ {
+ printf("Unknown command: %s\n", cmdline);
+ }
+
+ return TRUE;
+}
+
+int main()
+{
+ char cmdbuf[CMD_SIZE];
+ int cmdbuf_len = 0;
+
+ HANDLE vxd = CreateFileA("\\\\.\\" DRIVER, 0, 0, 0, CREATE_NEW, FILE_FLAG_DELETE_ON_CLOSE, 0);
+ if(vxd == INVALID_HANDLE_VALUE)
+ {
+ printf("cannot load VXD driver\n");
+ return EXIT_FAILURE;
+ }
+
+ for(;;)
+ {
+ int c = getchar();
+ switch(c)
+ {
+ case EOF:
+ if(cmdbuf_len == 0)
+ {
+ goto dingo;
+ }
+ /* fall */
+ case '\n':
+ cmdbuf[cmdbuf_len] = '\0';
+ cmdbuf_len = 0;
+ if(!run_command(vxd, cmdbuf))
+ {
+ goto dingo;
+ }
+ break;
+ case '\r':
+ break;
+ default:
+ if(cmdbuf_len < CMD_SIZE - 1)
+ {
+ cmdbuf[cmdbuf_len] = c;
+ cmdbuf_len++;
+ }
+ break;
+ }
+ }
+
+ dingo:
+ CloseHandle(vxd);
+
+ return EXIT_SUCCESS;
+}
diff --git a/vxd_main.c b/vxd_main.c
index 4cacbc2..dfd56dd 100644
--- a/vxd_main.c
+++ b/vxd_main.c
@@ -247,7 +247,6 @@ WORD __stdcall VXD_API_Proc(PCRS_32 state)
}
break;
}
- break;
case OP_FBHDA_ACCESS_BEGIN:
FBHDA_access_begin(state->Client_ECX);
rc = 1;
@@ -299,9 +298,11 @@ WORD __stdcall VXD_API_Proc(PCRS_32 state)
break;
case OP_MOUSE_SHOW:
mouse_show();
+ rc = 1;
break;
case OP_MOUSE_HIDE:
mouse_hide();
+ rc = 1;
break;
#ifdef SVGA
case OP_SVGA_VALID:
@@ -592,6 +593,18 @@ DWORD __stdcall Device_IO_Control_proc(DWORD vmhandle, struct DIOCParams *params
case OP_SVGA_VXDCMD:
outBuf[0] = (DWORD)SVGA_vxdcmd(inBuf[0]);
return 0;
+#ifdef DBGPRINT
+ /* export some mouse function for debuging */
+ case OP_MOUSE_MOVE:
+ mouse_move(inBuf[0], inBuf[1]);
+ return 0;
+ case OP_MOUSE_SHOW:
+ mouse_show();
+ return 0;
+ case OP_MOUSE_HIDE:
+ mouse_hide();
+ return 0;
+#endif /*DBGPRINT */
#endif /* SVGA */
}