Thanks for the test, and comments!
http://wiki.enterpriseforever.com/index.php/EnterMice#Control_MapThis section was a real miracle for me to help to understand how it does work at all ...
![Smiley :)](/Smileys/phpbb/smiley.gif)
Besides rewriting the whole stuff, I've found some old mistakes of mine, for example:
* L column bit on button was set always in every rows, but should be on row=0.
* watchdog was handled in reading the port, I think it should be (and now it is) at the RTS signaling
* there were even mistakes at nibble handling (totally wrong values) if modes 4,5,6 are used ...
And it's possible there were more, just I haven't noticed them as mistakes, but the rewrite fixed them as well ...
My TODO/check list:
* if you see the source, maybe buttons should be swapped (?) in entermice mode, that's easy just the button map arraies should be mododified for the given mode
* the glitch stuff what you mentioned seems to be interesting ... X/Y coordinates are hold in signed 8 bit values, SDL PC mouse events updates it in a sign correct way, but if it would over/underflow, it "saturated" on the 8 bit signed max/min value. Reading the mouse buffer causes to reset x or y variable (move_dx and move_dy in the source) to zero
* it would be interesting to see if extra buttons work, if there is a software at all tries to use it (of courses modes 2,3 or 5,6 are needed for that)
* it would be interesting to see if wheel works ... wheel is handled like the mouse move, just wheel_dy is the key variable (there is wheel_dx as well, but in entermice dox, it's said that currently only one wheel is supported as a 8 bit signed value like for X/Y vals). of course, the same 2/3 or 5/6 modes are needed for that!
* it would be interesting to see if full entermice 16 nibble (8 byte) lenth answer (mode 3 or mode 6) can be interpreted successfully with any software at all (if such a software exist ...). You can see the source input.c after line "static Uint8 mouse_buffer[] = {" that "ENTERMICE" stuffs are sent as those bytes (0x44, 0x14, 0x19, 0x5D).
* handle joystick emulation if mouse is on K-column, since in that case, J-column joy-1 is available (currently this case is not handled in Xep128, joystick is not used then - anyway joystick now means the key pad numbers, which is by default replicated as both of joy-1 and joy-2, joy-1 only if mouse mode/grab is not enabled).
* as a bonus project
![Smiley :)](/Smileys/phpbb/smiley.gif)
write SDL code to really have joystick/gamepad handled as EP joy
![Smiley :)](/Smileys/phpbb/smiley.gif)
this would require me to have at least one joy/pad for real, ehhh ...
![Cheesy :D](/Smileys/phpbb/ds_icon_biggrin.gif)
* figure out what kind of mouse modes are really useful and needed ... even there can be boxsoft J-column but with and without swapped buttons for convience, and some of them may be not needed at all