Keith Duthie wrote:
> The game is called Ringworld: Revenge of the Patriach. This problem could
This is really great: this game crashes when moveing the mouse and it does
*not* use dpmi. Previously I sought it is a dpmi problem, but now I see how I
was wrong.
Also now I think I understand where the real problem is.
Can you please try the attached patch?
It is not a final solution, it is just a hacks only to prove if my theory is
right. And it seems problematic to make it work properly with dpmi.
But if it solves your problem, then I hope that someone from dosemu developers
will help me to make a correct patch that will prevent from crashing also
dpmi apps.
--- src/base/mouse/mouse.c      Sun Nov 12 20:02:07 2000
+++ src/base/mouse/mouse.c      Tue Aug 28 02:01:53 2001
@@ -1510,6 +1510,19 @@
 void
 mouse_event()
 {
+  if(!in_dpmi) {
+   unsigned char * ssp;
+   unsigned long sp;
+      ssp = (unsigned char *)(LWORD(ss)<<4);
+      sp = (unsigned long) LWORD(esp);
+      LWORD(esp) = (LWORD(esp) - 4) & 0xffff;  
+      pushw(ssp, sp, REG(cs));
+      pushw(ssp, sp, LWORD(eip));
+      REG(cs) = PIC_SEG;
+      LWORD(eip) = PIC_OFF;
+  }
+  pic_icount++;
+
   if (mouse.mask & mouse_events && (mouse.cs || mouse.ip)) {
     if(in_dpmi && !in_dpmi_dos_int 
           && !((mouse.cs == DPMI_SEG) && 
--- src/base/mouse/mouseint.c   Sun Nov 12 20:04:26 2000
+++ src/base/mouse/mouseint.c   Tue Aug 28 01:59:07 2001
@@ -462,9 +462,16 @@
        unsigned char rBuf[MOUSE_BUFFER];
        int nBytes;
 
+       if (pic_icount) {
+         pic_request(PIC_IMOUSE);      // hack: return the request back to PIC
+         return;
+       }
+       if (mice->type == MOUSE_X)
+         mouse_event();
+       else {    
        nBytes = RPT_SYSCALL(read(mice->fd, (char *)rBuf, sizeof(rBuf)));
        if (nBytes>0 && !config.usesX) {
          m_printf("MOUSE: Read %d bytes\n", nBytes);
          DOSEMUMouseProtocol(rBuf, nBytes);
-       }
+       }}
 }
--- src/base/misc/ioctl.c       Sun Nov 12 20:02:07 2000
+++ src/base/misc/ioctl.c       Mon Aug 27 02:35:07 2001
@@ -170,7 +170,8 @@
 
     default:                   /* has at least 1 descriptor ready */
 
-      if ((mice->intdrv || mice->type == MOUSE_PS2 || mice->type == MOUSE_IMPS2)
+      if ((mice->intdrv || mice->type == MOUSE_PS2 || mice->type == MOUSE_IMPS2
+        || mice->type == MOUSE_X)
          && mice->fd >= 0)
        if (FD_ISSET(mice->fd, &fds)) {
                m_printf("MOUSE: We have data\n");
--- src/base/dev/pic/pic.c      Mon Aug 27 14:40:14 2001
+++ src/base/dev/pic/pic.c      Tue Aug 28 01:52:36 2001
@@ -1214,7 +1219,8 @@
   pic_seti(PIC_IRQ0, timer_int_engine, 0);  /* do_irq0 in pic.c */
   pic_unmaski(PIC_IRQ0);
   pic_request(PIC_IRQ0);                    /* start timer */
-  if (mice->intdrv || mice->type == MOUSE_PS2 || mice->type == MOUSE_IMPS2) {
+  if (mice->intdrv || mice->type == MOUSE_PS2 || mice->type == MOUSE_IMPS2
+    || mice->type == MOUSE_X) {
     pic_seti(PIC_IMOUSE, DOSEMUMouseEvents, 0);
     pic_unmaski(PIC_IMOUSE);
   }
--- src/base/init/init.c        Sun Nov 12 20:02:07 2000
+++ src/base/init/init.c        Mon Aug 27 02:32:48 2001
@@ -208,7 +208,8 @@
   pic_unmaski(PIC_IRQ1);
   pic_seti(PIC_IRQ8, rtc_int8, 0);
   pic_unmaski(PIC_IRQ8);
-  if (mice->intdrv || mice->type == MOUSE_PS2 || mice->type == MOUSE_IMPS2) {
+  if (mice->intdrv || mice->type == MOUSE_PS2 || mice->type == MOUSE_IMPS2
+    || mice->type == MOUSE_X) {
     pic_seti(PIC_IMOUSE, DOSEMUMouseEvents, 0);
     pic_unmaski(PIC_IMOUSE);
   }
--- src/env/video/X.c   Sun Oct  8 00:33:40 2000
+++ src/env/video/X.c   Mon Aug 27 02:26:36 2001
@@ -1531,7 +1531,8 @@
 
   busy = 0;
 #if CONFIG_X_MOUSE  
-  mouse_event();
+  pic_request(PIC_IMOUSE);
+//  mouse_event();
 #endif  
 
 #if 0

Reply via email to