Previous Thread
Next Thread
Print Thread
Page 32 of 80 1 2 30 31 32 33 34 79 80
Joined: Feb 2014
Posts: 1,102
Likes: 173
G
Very Senior Member
Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,102
Likes: 173
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-)

Joined: May 2004
Posts: 1,772
Likes: 34
H
Very Senior Member
Offline
Very Senior Member
H
Joined: May 2004
Posts: 1,772
Likes: 34
might need work on the artwork system, I'm not sure there is a way to translate relative coordinates on a layout element into screen coordinates

(things like the Pico need something like this as you're meant to press locations on the book)

Joined: Feb 2014
Posts: 1,102
Likes: 173
G
Very Senior Member
Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,102
Likes: 173
I was thinking of something like this screenshot from OpenEmulator where you could click and draw on the "virtual tablet".

[Linked Image from i.imgur.com]

Joined: Mar 2008
Posts: 229
Likes: 8
R
Senior Member
Offline
Senior Member
R
Joined: Mar 2008
Posts: 229
Likes: 8
I'd love to have this working for the Dragon with the Touchmaster Tablet!

Joined: Mar 2001
Posts: 17,217
Likes: 234
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 17,217
Likes: 234
robcfg: if we can come up with a way to make this work in terms of the artwork system and everything, it should also be possible to adapt for other systems.

Joined: Feb 2014
Posts: 1,102
Likes: 173
G
Very Senior Member
Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,102
Likes: 173
Just a little mockup in LibreOffice Draw

[Linked Image from i.imgur.com]

If I could hook up clickable buttons I could set the tablet to register its position in that location.

Joined: Feb 2014
Posts: 1,102
Likes: 173
G
Very Senior Member
Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,102
Likes: 173
Some funny messages I saw when trying to run the Menu Alignment Program:

[Linked Image from i.imgur.com]
[Linked Image from i.imgur.com]
[Linked Image from i.imgur.com]

Joined: Feb 2014
Posts: 1,102
Likes: 173
G
Very Senior Member
Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,102
Likes: 173
Having some fun with Motter Tektura fonts and some logos that I found.

I managed to find a neat one with a fixed "s" character called Apple-motter.v1.dfont, but the y character looked funny so I used Verdana and scaled and stretched it.

[Linked Image from i.imgur.com]

Joined: Feb 2014
Posts: 1,102
Likes: 173
G
Very Senior Member
Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,102
Likes: 173
Ok if you want to try the Graphics Tablet,

https://github.com/goldnchild/mame/commit/d5a41eeb31daab5999c76f3656762a7a04bc2d7e


You'll need the rom:

ROM_LOAD( "341-0026-00.bin", 0x000000, 0x000800, CRC(3dda85de) SHA1(b025f03bb5a9316d4a50bca5503ad4825389518f))


It's pretty useful to "tune" the tablet by setting the min and max values it will return which can be done from the lua console or the mame debugger memory view window (Apple Graphics Tablet/:sl2:agraphtablet/ entries)


You can't have min less than 97 (0x61) or max greater than 2560 (0xa00). Values outside this range are considered "off scale" and you will be likely be eaten by a grue. (No, nothing bad will happen but it will act as though the pen is off the tablet).

Note also that you should use the control panel to remap the mouse buttons for the joystick 3 input (which is masquerading as our tablet) if you want to draw with the tablet disk.

Joystick Button 1 will make the tablet go "offscale" and joystick button 2 will act as "pen down".


The software's not really usable yet as clicking on the overlay buttons is impossible, but I managed to hit the color menu just clicking blindly.

[Linked Image from i.imgur.com]

Last edited by Golden Child; 04/16/19 06:26 PM.
Joined: Apr 2012
Posts: 343
Likes: 60
Senior Member
Offline
Senior Member
Joined: Apr 2012
Posts: 343
Likes: 60
Originally Posted by robcfg
I'd love to have this working for the Dragon with the Touchmaster Tablet!
I looked into this a couple of years ago. When a practical solution exists for the artwork then I'll get back on it. The tablet overlays should ideally be associated with software, rather than artwork for a machine.
See
https://forums.bannister.org/ubbthreads.php?ubb=showflat&Number=109936#Post109936 for my previous attempt.


BBC Model B, ATPL Sidewise, Acorn Speech, 2xWatford Floppy Drives, AMX Mouse, Viglen case, etc.
Page 32 of 80 1 2 30 31 32 33 34 79 80

Link Copied to Clipboard
Who's Online Now
0 members (), 315 guests, and 4 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,320
Posts121,944
Members5,074
Most Online1,283
Dec 21st, 2022
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Forum hosted by www.retrogamesformac.com