Author Topic: AM support mouse or touch monitor input?  (Read 4477 times)

kent79

  • Hero Member
  • *****
  • Posts: 580
    • View Profile
AM support mouse or touch monitor input?
« on: March 05, 2016, 06:21:09 PM »
I would like using "mouse" or "touch monitor" instead of joystick to select the game. May I know AM support Mouse control or not? If support, how to activate it?  :)

raygun

  • Administrator
  • Sr. Member
  • *****
  • Posts: 391
    • View Profile
Re: AM support mouse or touch monitor input?
« Reply #1 on: March 11, 2016, 11:23:56 PM »
Configure->Controls->Up->Add Input

When you are prompted to press the input to be mapped, move the mouse in the direction you want mapped.

Only one mouse is supported ATM.  No touch monitor controls.

djrobx

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Re: AM support mouse or touch monitor input?
« Reply #2 on: February 25, 2017, 02:54:26 PM »
I tried doing this, but the result is extremely slow/erratic   The mouse pointer also appears on the screen and jumps around.    At first it would only move up, but after exiting and restarting it moves up and down... barely.

Would be really great to be able to "flick" my trackball to rapidly scroll through the list, since the number of games in MAME is huge. 
« Last Edit: February 25, 2017, 03:04:55 PM by djrobx »

djrobx

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Re: AM support mouse or touch monitor input?
« Reply #3 on: February 26, 2017, 12:51:57 AM »
Well, I figured out what most of this problem is - the console window is appearing behind AM.    But, for whatever reason, the mouse pointer appears whenever the mouse is over that hidden console window, and is also prevents the events from flowing correctly to the UI.   It behaves as if the console menu is on top of the UI, which means it doesn't see the mouse movements until the cursor leaves the bounding rect of the console window.

I changed it to start AM with a utility called Hidden Start (hstart.exe) to suppress the console window and now it works better.   I also added a hack to mine that switches to page keys if I move the ball really fast (mouse moved more than sensitivity * 2), and that improves the usability some more too.   

Nick

  • Full Member
  • ***
  • Posts: 26
    • View Profile
Re: AM support mouse or touch monitor input?
« Reply #4 on: February 26, 2017, 05:32:06 PM »
Hello, I haven't tried it myself but I just saw this in another thread:
Quote
If you don't care about the console window at all (handy for debugging sometimes), do this:

In attract.cfg, in the general section: change hide_console from no to yes.
That might be simpler to hide the console.

djrobx

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Re: AM support mouse or touch monitor input?
« Reply #5 on: February 26, 2017, 10:59:06 PM »
Confirmed this also solves the issue.   Definitely the better way to do it.  :)

pcss911

  • Jr. Member
  • **
  • Posts: 19
    • View Profile
Re: AM support mouse or touch monitor input?
« Reply #6 on: February 28, 2017, 03:37:38 PM »
djrobx - May I learn how you applied the trackball hack for faster wheel scrolling as noted above? Do you suppose the same logic can be applied to the spinner instead?

djrobx

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Re: AM support mouse or touch monitor input?
« Reply #7 on: March 01, 2017, 09:44:57 PM »
It would work the same for a spinner as it does my trackball, but you might need to assign it to the X axis instead of Y as you see here.    It's a filthy dirty, nasty hack to the code but it actually works very nicely.   Note that you'd need to specify the keys you use for PageUp and PageDown - this basically "presses" PageUp and PageDown when you move the ball really fast.

In fe_input.cpp, my changes in bold.
Quote
      case sf::Event::MouseMoved:
         if ( e.mouseMove.x < mc_rect.left )
         {
            m_type = Mouse;
            m_code = MouseLeft;
         }
         else if ( e.mouseMove.y < mc_rect.top )
         {
if (e.mouseMove.y < mc_rect.top - (mc_rect.height/2))
{   
   m_type = Keyboard;
   m_code = sf::Keyboard::PageUp;
}
else
{

            m_type = Mouse;
            m_code = MouseUp;   
}
         }
         else if ( e.mouseMove.x > mc_rect.left + mc_rect.width )
         {
            m_type = Mouse;
            m_code = MouseRight;
         }
         else if ( e.mouseMove.y > mc_rect.top + mc_rect.height )
         {
if (e.mouseMove.y > mc_rect.top + mc_rect.height + (mc_rect.height/2))
{   
   m_type = Keyboard;
   m_code = sf::Keyboard::PageDown;
}
else
{
            m_type = Mouse;
            m_code = MouseDown;
}            
         }
         break;

I hope it inspires someone to do it properly, maybe hook the mouse movements into the actual wheel acceleration (like you get when you hold a key down).

pcss911

  • Jr. Member
  • **
  • Posts: 19
    • View Profile
Re: AM support mouse or touch monitor input?
« Reply #8 on: March 02, 2017, 05:39:30 AM »
Thank you for the detail.  Two questions - are your bolded lines additions to the surrounding code or alterations to lines in existing code?  Also, I am unable to locate where the file "fe_input.cpp" is, anywhere in my Attract Mode folder.  The common filename extension appears to be *.nut.   My system is Win7.  Perhaps that applies only to Linux?  I'm not a linux guy so that is mere conjecture.

djrobx

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Re: AM support mouse or touch monitor input?
« Reply #9 on: March 02, 2017, 08:17:06 AM »
The bolded lines are all additions (no lines are modified in this case).  This is to the attract mode source code.   You'd have to download it, make the changes, and build it, which gives you a new attract.exe.   Towards the very bottom is the Windows (native) instructions.   Note that step 5 actually downloads the code.  Once it does that and you have a successful build you can make the changes to the files.

http://attractmode.org/docs/Compile.html

If you've used the MAME compiler before:

http://headsoft.com.au/index.php?category=mame&page=mc64

It leaves a buildtools folder.  That buildtools is the same as MSYS2.   So you can just run "buildtools" and then follow steps 2-5.

It looks scary especially if you're not a linux guy, but it went pretty smoothly for me.
« Last Edit: March 02, 2017, 08:19:05 AM by djrobx »

pcss911

  • Jr. Member
  • **
  • Posts: 19
    • View Profile
Re: AM support mouse or touch monitor input?
« Reply #10 on: March 02, 2017, 02:13:36 PM »
Much respect for the level of detail in your response.   As much as I'd like to implement this, I'm afraid I will need to leave it be.  I'm not a coder at all, and what is likely trivial to you is monumental to me.  This is clearly far more than I feel I'm able to achieve with the available time I have to attempt to feel my way through it.  Maybe one day.

Unless -- if you've already done it, is there any way I can grab your attract.exe, assuming that was the only change?  In which case, would I simply replace my existing attract.exe with no other corollary changes?

djrobx

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Re: AM support mouse or touch monitor input?
« Reply #11 on: March 03, 2017, 11:42:26 PM »
Yep, I can do that for you, but you mentioned that you're using a spinner.   

So I need two bits of info: Does your spinner use the X or Y mouse axis?   And, are you ok with assigning PgUp and PgDn keys to the wheel movements?   If you need different keys I could modify to match whatever you're using.

I synced the original version for a bit and I have to say this "hack" really does do wonders for being able to scroll through the wheel intuitively.   It felt so unresponsive without it.  :)


pcss911

  • Jr. Member
  • **
  • Posts: 19
    • View Profile
Re: AM support mouse or touch monitor input?
« Reply #12 on: March 04, 2017, 08:24:27 AM »
Much appreciation for the offer. 

My cp hasn't quite yet been built and sent to me.  Mameroom.com is doing a custom one per my design and I won't learn how they've wired it up to the i-pac until I receive it, though there is still time for me to request certain mapping preferences.  Any suggestions?  I believe I recall being informed that the spinner will be on the x-axis, and I am okay with PgUp/PgDn, but would that require the i-pac to offer those keys?  I am not yet familiar with any of its mapping capabilities.

However, because I will have both a trackball and spinner, after thinking it through further I figured perhaps the trackball would be the better bet, seeing as I am right handed and my trackball will be on the right side (spinner a bit left of center).  Spinner would otherwise be my ideal choice, but trackball should work well enough, as per your own experience.  Should I assume that rolling the trackball towards me (down?) would cause the names in the wheel to move up (list advancing alphabetically)?  I'm using the Nevato theme, in case that matters.

Assuming AM sees both spinner and trackball as mice, then in case I might like the option to try switching back and forth between the spinner and trackball on the fly (both active at the same time even better) for this purpose, could that be achieved by having the spinner set to the y-axis, and if so, what are the caveats of having it on y instead of x, with respect to game play in mame? (e.g. Would Arkanoid still play normally, etc.)

And lastly, would any of this negate the ability to simultaneously retain having a joystick up/down move one at a time?

« Last Edit: March 04, 2017, 03:08:45 PM by pcss911 »

djrobx

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Re: AM support mouse or touch monitor input?
« Reply #13 on: March 04, 2017, 07:47:30 PM »
>Assuming AM sees both spinner and trackball as mice, then in case I might like the option to try switching back and forth between the spinner and trackball on the fly (both active at the same time even better) for this purpose, could that be achieved by having the spinner set to the y-axis, and if so, what are the caveats of having it on y instead of x, with respect to game play in mame? (e.g. Would Arkanoid still play normally, etc.)

If you have both a trackball AND a spinner you either need two iPacs (say an iPac and a mini-pac) or you have to assign your spinner to the Z axis.   I don't think AM supports the Z axis for mouse input. 

MAME's inputs are so configurable that there's really not a big caveat either way for actual gameplay.

If you connect multiple mice, Windows will let you use them all simultaneously as one "mouse".   This is the case on my cab too, it has 3 trackballs.   I can scroll the wheel from any of the 3 trackballs just fine.    AM cannot currently differentiate them though, so I can't automatically rotate the display to where you're sitting (you have to touch the other controls for that).   MAME, on the other hand, does know the difference, so two player games can work correctly.

> And lastly, would any of this negate the ability to simultaneously retain having a joystick up/down move one at a time?

Nope not at all.

>  and I am okay with PgUp/PgDn, but would that require the i-pac to offer those keys?

No conflict or special requirements there.   The real PgDn key can be used, or not, it's fine either way.   The hack just "virtually" presses PgDn/PgUp when you spin the ball very fast.    I have my U-Hid programmed to hit PgUp/PgDn when I hold the Exit Game button ("Shift key") and press up and down on the joystick.   But that has no impact for this spinner hack.     Now that the ball is working so well I almost never touch the joystick now.  :)

> I am not yet familiar with any of its mapping capabilities.

It's really easy to change things around in the mapping software.   I wouldn't stress out about it too much.

pcss911

  • Jr. Member
  • **
  • Posts: 19
    • View Profile
Re: AM support mouse or touch monitor input?
« Reply #14 on: March 04, 2017, 11:19:23 PM »
I wasn't aware, until just now, that having a trackball would force the spinner to the z-axis or require a 2nd keyboard encoder.  I'll make that inquiry with the builder and see what can be worked out.

Perhaps it's best, if you're agreeable, to revisit this matter once my cp arrives, hopefully in a week or two, when I'll have a better handle on how things were configured for me?

Thank you so much again for the generous gift of your time in getting this done for me.   The community is better off for it.