Hi all,

I'm having some weird issues trying to get the mouse to work for a joystick input. I finally decided that I'd try to get a "real" mouse device hooked up, so I added some code for another mouse.

What's really strange is that once I added the additional mouse, the mouse control of the joystick all of a sudden started working. I added a PORT_CODE(MOUSECODE_X) to select the mouse axis x for the joystick, but it wouldn't work. I also couldn't map the Mouse axis in the mame control panel by hitting enter then moving the mouse horizontally back and forth for mouse axis x or vertically for mouse axis y. With the additional mouse, I can map mouse axis x or y in the control panel.

Another thing I noticed is that if you add the apple mouse card with "-sl4 mouse", you have to manually select the mouse x and y axis in the control panel. I think if there were a PORT_CODE(MOUSECODE_X) for the mouse x axis and a PORT_CODE(MOUSECODE_Y) for the y axis that it would automatically select that. I was using the mouse card with Print Magic and it works really nicely once you config the mouse x axis and y axis.





Code

// just copied mouse definitions from devices/bus/a2bus/mouse.cpp

#define MOUSE_BUTTON_TAG    "a2mse_button"
#define MOUSE_XAXIS_TAG     "a2mse_x"
#define MOUSE_YAXIS_TAG     "a2mse_y"

// joystick definitions from src/mame/drivers/apple2.cpp

#define JOYSTICK_DELTA          80
#define JOYSTICK_SENSITIVITY    50
#define JOYSTICK_AUTOCENTER     80

static INPUT_PORTS_START( apple2_joystick3 )
        PORT_START("joystick_3_x")      /* Joystick 1 X Axis */
        PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X) PORT_NAME("P3 Joystick X")
        PORT_SENSITIVITY(JOYSTICK_SENSITIVITY)
        PORT_KEYDELTA(JOYSTICK_DELTA)
        PORT_CENTERDELTA(JOYSTICK_AUTOCENTER)
        PORT_MINMAX(0,0xff) PORT_PLAYER(3)
        PORT_CODE(MOUSECODE_X)
        PORT_CODE_DEC(KEYCODE_4_PAD)    PORT_CODE_INC(KEYCODE_6_PAD)
        PORT_CODE_DEC(JOYCODE_X_LEFT_SWITCH)    PORT_CODE_INC(JOYCODE_X_RIGHT_SWITCH)

        PORT_START("joystick_3_y")      /* Joystick 1 Y Axis */
        PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y) PORT_NAME("P3 Joystick Y")
        PORT_SENSITIVITY(JOYSTICK_SENSITIVITY)
        PORT_KEYDELTA(JOYSTICK_DELTA)
        PORT_CENTERDELTA(JOYSTICK_AUTOCENTER)
        PORT_MINMAX(0,0xff) PORT_PLAYER(3)
        PORT_CODE(MOUSECODE_Y)
        PORT_CODE_DEC(KEYCODE_8_PAD)    PORT_CODE_INC(KEYCODE_2_PAD)
        PORT_CODE_DEC(JOYCODE_Y_UP_SWITCH)      PORT_CODE_INC(JOYCODE_Y_DOWN_SWITCH)

        PORT_START("joystick_3_buttons")
        PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1)  PORT_PLAYER(3)            PORT_CODE(KEYCODE_0_PAD)    PORT_CODE(JOYCODE_BUTTON1)
        PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2)  PORT_PLAYER(3)            PORT_CODE(KEYCODE_ENTER_PAD)PORT_CODE(JOYCODE_BUTTON2)
INPUT_PORTS_END

static INPUT_PORTS_START( mouse )
        PORT_START(MOUSE_BUTTON_TAG) /* Mouse - button */
        PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button") PORT_CODE(MOUSECODE_BUTTON1)

        PORT_START(MOUSE_XAXIS_TAG) /* Mouse - X AXIS */
        PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(40) PORT_KEYDELTA(0) PORT_PLAYER(1)

        PORT_START(MOUSE_YAXIS_TAG) /* Mouse - Y AXIS */
        PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(40) PORT_KEYDELTA(0) PORT_PLAYER(1)
INPUT_PORTS_END


static INPUT_PORTS_START( gfxall )
    PORT_INCLUDE( mouse )
    PORT_INCLUDE(apple2_joystick3)
INPUT_PORTS_END

/***************************************************************************
    FUNCTION PROTOTYPES
***************************************************************************/


// missing the word const

ioport_constructor a2bus_agraphtablet_device::device_input_ports() const
{
    return INPUT_PORTS_NAME (gfxall );
//  can only return one INPUT_PORTS_NAME here, so we include them both in gfxall and return that
//    return INPUT_PORTS_NAME( apple2_joystick3 );
//    return INPUT_PORTS_NAME(mouse);

}


[Linked Image from i.imgur.com]

and now I can draw! (with a mouse)

[Linked Image from i.imgur.com]

Now I wonder how to handle that I can't see the tablet overlays to actually use the software... gonna have to try to make a layout. 8-)