Home Page
Posted By: PhillHS Mouse emulation.... - 09/30/21 02:23 PM
Hi all,

Working trying to fix the mouse handling in the rmnimbus driver.....

Is there a way of defining a mouse in a driver such that it returns a movement delta?

Ideally what I'd want is, 0 if the mouse is not moved +ve if moved right (for example) and -ve if moved right? No matter what I do the read() function always seems to return a +ve value that wraps.

Ports are currently defined as :
Code
	
PORT_START(MOUSEX_TAG) /* Mouse - X AXIS */
	PORT_BIT( 0xfff, 0x000, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)

	PORT_START(MOUSEY_TAG) /* Mouse - Y AXIS */
	PORT_BIT( 0xfff, 0x000, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)

And I'm reading them with :

Code
	int   x = 0;
	int   y = 0;

	x = m_io_mousex->read();
	y = m_io_mousey->read();

	if (x != 0) 
		logerror("x=%d\n",x);

Can anyone give me some hints please?

Cheers.

Phill.
Posted By: R. Belmont Re: Mouse emulation.... - 09/30/21 02:49 PM
Is this the common-ish case where there are 2 bits for each axis, one saying move/didn't move and one indicating the direction of movement?

ETA: if so, the best example is probably https://github.com/mamedev/mame/blob/master/src/mame/drivers/mac128.cpp#L927
Posted By: crazyc Re: Mouse emulation.... - 10/01/21 12:29 AM
I spent a bit of time trying to fix that some years ago without much luck. Do you know if the mouse is connected to the io processor? I couldn't ever find much low level documentation for the system
© Forums