|
|
| version 1.1.1.1, 2003/10/16 17:57:55 | version 1.5, 2003/11/21 06:51:11 |
|---|---|
| Line 1 | Line 1 |
| #include "compiler.h" | #include "compiler.h" |
| #include "mousemng.h" | #include "mousemng.h" |
| #include "i286.h" | |
| #include "pccore.h" | #include "pccore.h" |
| #include "iocore.h" | #include "iocore.h" |
| Line 17 void mouseif_sync(void) { | Line 18 void mouseif_sync(void) { |
| // 今回の移動量を取得 | // 今回の移動量を取得 |
| mouseif.b = mousemng_getstat(&mouseif.sx, &mouseif.sy, 1); | mouseif.b = mousemng_getstat(&mouseif.sx, &mouseif.sy, 1); |
| if (np2cfg.KEY_MODE == 3) { | |
| mouseif.b &= keyext_getmouse(&mouseif.sx, &mouseif.sy); | |
| } | |
| mouseif.rx = mouseif.sx; | mouseif.rx = mouseif.sx; |
| mouseif.ry = mouseif.sy; | mouseif.ry = mouseif.sy; |
| mouseif.lastc = nevent.clock + nevent.baseclock | mouseif.lastc = I286_CLOCK + I286_BASECLOCK + I286_REMCLOCK; |
| - nevent.remainclock; | |
| } | } |
| static void calc_mousexy(void) { | static void calc_mousexy(void) { |
| Line 29 static void calc_mousexy(void) { | Line 32 static void calc_mousexy(void) { |
| UINT32 clock; | UINT32 clock; |
| SINT32 diff; | SINT32 diff; |
| clock = nevent.clock + nevent.baseclock - nevent.remainclock; | clock = I286_CLOCK + I286_BASECLOCK + I286_REMCLOCK; |
| diff = clock - mouseif.lastc; | diff = clock - mouseif.lastc; |
| if (diff >= 2000) { | if (diff >= 2000) { |
| short dx, dy; | SINT32 dx; |
| SINT32 dy; | |
| mouseif.rapid ^= 0xa0; | mouseif.rapid ^= 0xa0; |
| diff /= 1000; | diff /= 1000; |
| dx = (short)((long)mouseif.sx * diff / (long)pc.frame1000); | dx = mouseif.sx; |
| if (dx >= 0) { // 正 | if (dx > 0) { |
| dx = dx * diff / pc.frame1000; | |
| if (dx > mouseif.rx) { | if (dx > mouseif.rx) { |
| dx = mouseif.rx; | dx = mouseif.rx; |
| } | } |
| } | } |
| else { // 負 | else if (dx < 0) { |
| dx *= -1; | |
| dx = dx * diff / pc.frame1000; | |
| dx *= -1; | |
| if (dx < mouseif.rx) { | if (dx < mouseif.rx) { |
| dx = mouseif.rx; | dx = mouseif.rx; |
| } | } |
| } | } |
| mouseif.x += dx; | mouseif.x += dx; |
| mouseif.rx -= dx; | mouseif.rx -= dx; |
| dy = (short)((long)mouseif.sy * diff / (long)pc.frame1000); | |
| if (dy >= 0) { // 正 | dy = mouseif.sy; |
| if (dy > 0) { | |
| dy = dy * diff / pc.frame1000; | |
| if (dy > mouseif.ry) { | if (dy > mouseif.ry) { |
| dy = mouseif.ry; | dy = mouseif.ry; |
| } | } |
| } | } |
| else { // 負 | else if (dy < 0) { |
| dy *= -1; | |
| dy = dy * diff / pc.frame1000; | |
| dy *= -1; | |
| if (dy < mouseif.ry) { | if (dy < mouseif.ry) { |
| dy = mouseif.ry; | dy = mouseif.ry; |
| } | } |
| Line 144 static BYTE IOINPCALL mouseif_i7fd9(UINT | Line 157 static BYTE IOINPCALL mouseif_i7fd9(UINT |
| BYTE portc; | BYTE portc; |
| calc_mousexy(); | calc_mousexy(); |
| ret = mouseif.b & 0xf0; | ret = mouseif.b; |
| if (np2cfg.MOUSERAPID) { | if (np2cfg.MOUSERAPID) { |
| ret |= mouseif.rapid; | ret |= mouseif.rapid; |
| } | } |
| ret |= 0x40; | ret &= 0xf0; |
| ret |= 0x50; | |
| portc = mouseif.portc; | portc = mouseif.portc; |
| if (portc & 0x80) { | if (portc & 0x80) { |
| x = mouseif.latch_x; | x = mouseif.latch_x; |
| Line 167 static BYTE IOINPCALL mouseif_i7fd9(UINT | Line 181 static BYTE IOINPCALL mouseif_i7fd9(UINT |
| else { | else { |
| ret |= (x >> 4) & 0x0f; | ret |= (x >> 4) & 0x0f; |
| } | } |
| // TRACEOUT(("%x %x mouse [%x] %d -> %x", I286_CS, I286_IP, portc & 0x20, y, ret)); | |
| (void)port; | (void)port; |
| return(ret); | return(ret); |
| } | } |