diff options
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | int15ps2.h | 29 | ||||
-rw-r--r-- | mousetsr.h | 2 | ||||
-rw-r--r-- | mousmain.c | 14 |
4 files changed, 43 insertions, 7 deletions
@@ -603,8 +603,8 @@ this shouldn't be a problem either. ## Future work -* The VirtualBox BIOS can crash on warm-boot (e.g. Ctrl+Alt+Del) if the mouse - was in the middle of sending a packet. A VM reboot fixes it. +* BIOS can crash on warm-boot (e.g. Ctrl+Alt+Del) if the mouse + was in the middle of sending a packet. A hardware reboot fixes it. We probably need to hook Ctrl+Alt+Del and turn off the mouse. * DOS has functions to start (FindFirst) and continue (FindNext) a directory @@ -626,4 +626,3 @@ this shouldn't be a problem either. * Would it be possible to use a hardware rendered mouse pointer in Windows 3.x, without having to replace the video driver? - This would also help other emulators. @@ -268,4 +268,33 @@ static bool ps2m_detect_imps2(void) return err == 0 && device_id == PS2M_DEVICE_ID_IMPS2; } +static bool ps2m_detect_imex(void) +{ + int err; + uint8_t device_id; + + // Get the initial mouse device id + err = ps2m_get_device_id(&device_id); + if (err) { + return false; + } + + if (device_id == PS2M_DEVICE_ID_IMEX + || device_id == PS2M_DEVICE_ID_IMEX_HORZ) { + // Already ImEx + return true; + } + + if (device_id != PS2M_DEVICE_ID_IMPS2) { + return false; + } + + // Send the knock sequence to activate the extended packet + ps2m_send_imex_sequence(); + + // Now check if the device id has changed + err = ps2m_get_device_id(&device_id); + return err == 0 && device_id == PS2M_DEVICE_ID_IMEX; +} + #endif /* INT15PS2_H */ @@ -180,7 +180,9 @@ typedef struct tsrdata { uint8_t buttons; struct { struct buttoncounter { + /** Last position of cursor where this button was pressed. */ struct point last; + /** Number of button presses since last button report. */ uint16_t count; } pressed, released; } button[MAX_BUTTONS]; @@ -36,14 +36,20 @@ static nl_catd cat; #if USE_WHEEL -static bool detect_wheel() +static bool detect_wheel(LPTSRDATA data) { // Do a quick check for a mouse wheel here. // The TSR will do its own check when it is reset anyway if (ps2m_detect_imps2()) { + if (ps2m_detect_imex()) { + data->num_wheels = 2; + } else { + data->num_wheels = 1; + } printf(_(1, 0, "Wheel mouse found and enabled\n")); return true; } else { + data->num_wheels = 0; return false; } } @@ -54,7 +60,7 @@ static int set_wheel(LPTSRDATA data, bool enable) data->usewheel = enable; if (data->usewheel) { - if (detect_wheel()) { + if (!detect_wheel(data)) { fprintf(stderr, _(3, 0, "Could not find PS/2 wheel mouse\n")); } } else { @@ -62,7 +68,7 @@ static int set_wheel(LPTSRDATA data, bool enable) data->num_wheels = 0; } -return 0; + return 0; } static int set_wheel_key(LPTSRDATA data, const char *keyname) @@ -263,7 +269,7 @@ static int configure_driver(LPTSRDATA data) data->usewheel = true; data->wheel_up_key = 0; data->wheel_down_key = 0; - detect_wheel(); // Prints message if wheel found + detect_wheel(data); // Prints message if wheel found #endif #if USE_INTEGRATION |