Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Mala registering u360 inputs while Mame is running a game.  (Read 3671 times)

0 Members and 1 Guest are viewing this topic.

TopJimmyCooks

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2097
  • Last login:March 26, 2024, 01:18:39 pm
Mala registering u360 inputs while Mame is running a game.
« on: November 15, 2011, 09:38:50 am »
I enabled and changed the various sounds that play while scrolling the gamelist, switching lists/emulators, etc.  Previously, Mala would regularly be on a different game or list when I exited a mame game.  Now I realize that what is happening is Mala registers the inputs given while the game is booting/loading screen is up, until Mame takes over the display - I can hear the sounds.  

Is there any way to get Mala to stop taking keypresses u360 joystick inputs as soon as the game is selected?
« Last Edit: February 13, 2012, 10:36:14 am by TopJimmyCooks »

TopJimmyCooks

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2097
  • Last login:March 26, 2024, 01:18:39 pm
Re: Mala registering u360 inputs while Mame is running a game.
« Reply #1 on: February 13, 2012, 10:35:23 am »
More information and a bump on this-Now that I'm basically done with the cab this is really starting to bug me.

Setup:  Mame 141u6 and 145 (tried both).  Mala 174 and 174.5 (both).  Win XP.
Hardware:  U360 is joystick 1.  everything else is digital on an Ipac2, which works fine no problem.  No problem with mouse/Optipac doing this either.

somehow mala is not going to "sleep" while a mame game is running and moves up and down the gamelist when the u360 is used during mame. 

Games:  Some games do it, some don't.  for instance, donpachi (US) does it constantly throughout the entire game, no matter when you move the u360 during game load or after.  donpachi (japan) doesn't do it at all.  Chicken Shift does it when you move the joystick right after starting the game, but if you wait for the title screen to move the u360, it doesn't do it. 

I've checked the u360 logs and malalog.log files for anything interesting and I can't find any difference between games that have the problem and ones that don't.  I would be more that happy to post some up if someone more experienced wants a look at them.

For paranoia purposes, i checked some different layouts, no change.  Changed the event sounds back to default, no change.  Tried different versions of mala and mame as noted above.  No issue if joystick is removed/unchecked as a mala controller under the controllers tab, but that makes it counterintuitive to navigate mala only by player 2 stick.  I can go further with changes to my setup, like disabling startcom (monitor rotation) and the u360 mapper application/fatfingers, but I need to run these day to day if I'm going to use Mala. 

I think this is something dumb, since extensive searching and reading every Mala forum post from 2008 on has not revealed someone else running into this problem.  If I can't get it worked out, the U360 is going to get sidelined, I need mala's rotation capability more than I need the u360.  even though it's a mala issue not a hardware issue as far as I can tell.  Help!

nitz

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 507
  • Last login:November 24, 2015, 07:57:29 pm
Re: Mala registering u360 inputs while Mame is running a game.
« Reply #2 on: February 13, 2012, 09:52:31 pm »
Very weird...since no one else seems to be having that problem, there must some strange conflict somewhere.

If you're unable to figure out what that is, an ahk script might do the trick. ;) First, go to the "Key List (Keyboard, Mouse, Joystick)" page in the ahk help file. You'll find a script there that will help you identify your joystick button numbers.

Once you have that, try a script like this:

Quote
setTitleMatchMode, 2

#IfWinActive, MaLa

joy1::a

joy2::b

joy3::c

etc...

Make sure that the name of the Mala window contains the text MaLa - and it is case sensitive by the way. I know this always was the case, but it's been a long time since I've updated Mala.

What you need to do is set the various Mala keys to a, b, c...(or whatever you want) and when (and only when)Mala is the active window, the joystick will be able to work with Mala, however, when running Mame, Mala would be receiving the normal joystick keys which shouldn't do anything.

That's my theory anyway...hard to say exactly what will happen, since this is such a strange issue, but I'm thinking this could work. :cheers:

Le Chuck

  • Saint, make a poll!
  • Wiki Contributor
  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5509
  • Last login:June 14, 2025, 06:26:06 pm
  • <insert personal text here>
Re: Mala registering u360 inputs while Mame is running a game.
« Reply #3 on: February 14, 2012, 03:42:00 am »
Nitz, if this works I'm counting this as miracle two.  One more for canonization.  No pressure  ;D 

TopJimmyCooks

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2097
  • Last login:March 26, 2024, 01:18:39 pm
Re: Mala registering u360 inputs while Mame is running a game.
« Reply #4 on: February 14, 2012, 08:22:55 am »
Thanks for the input Nitz.  I'm going to break it down to basics tonight.  Fresh install of Mala, ultramap, no plugins, etc. and see what happens.  If I can't isolate something there I'll move on to the script workaround.  That sounds like a great workaround to give MaLa joystick inputs without having the stick enabled in MaLa settings.   

TopJimmyCooks

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2097
  • Last login:March 26, 2024, 01:18:39 pm
Re: Mala registering u360 inputs while Mame is running a game.
« Reply #5 on: February 14, 2012, 12:15:07 pm »
OK, Nitz, took a little lunchbreak and played with this.

-Checked the keylisting script and I'm sending X and Y axis joystick states in the 0 to 100 range, left/down is 0, right or up is 100.  I probably need to look into identifying it as joystick 1 because the swap panels have other USB joysticks involved that might steal the #1 id (note to self: look into DrVenture controller remap!)
-Checked the windowspy and the window does have "MaLa" in the title.  

I found http://www.autohotkey.com/docs/misc/RemapJoystick.htm and copied their script for joystick axes to keystrokes.

combined with your window name check and came up with

Code: [Select]

SEE CORRECTED CODE IN POST BELOW - THANKS


It didn't work right off but I'm sure with a little more fiddling tonight it will come together.  
« Last Edit: February 16, 2012, 03:13:43 pm by TopJimmyCooks »

TopJimmyCooks

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2097
  • Last login:March 26, 2024, 01:18:39 pm
Re: Mala registering u360 inputs while Mame is running a game.
« Reply #6 on: February 16, 2012, 11:21:20 am »
New information.  Took a break from the AHK thing and did a fresh install of Mala 174.  Testing as I went along, exiting, launching MaLa and playing Donpachi (US) after any change and checking for the problem.  Keeping everything as stock as possible, layout, sounds, etc.  Mame 145, all newly DL'd catver.ini, controls.ini, etc. No plugins, no focus logger, etc. and no problem so far.

Then I installed the startcom plugin.  Problem showed up right away.  I think there is something happening between startcom and the usb joystick.  My startcom plugin is set to run a batch file and pass it a variable for horizontal or vertical.  the batch file calls the Pololu software SMCCMD via command line, 2 different ones according to the direction of rotation.  The Pololu motor controller interfaces via USB.  

Anybody else running a u360 and Mala with Startcom?  My best bet is to get Nitz's ahk script running to change the usb joystick inputs to keypresses, but no luck so far - need help on this.  Besides the script as shown in the previous post, I tried putting brackets around everything after #ifwinactive, and also tried DetectHiddenWindow since MaLa could be a hidden window?  Never shows a window on screen.  I'm past my depth on AHK at this point.  

_____________________________________________________________

Update:  Got it working with the final version below.  I left out a hash mark that Nitz told me to do in front of ifwinactive, and I left out a #persistent that AHK told me to put in.  I guess I'm not the best at following written directions sometimes.  not sure if the detect hidden windows is needed, but now that it works I'm not going to experiment further!.  Although I may work on a script to get MaLa to accept more than one key to start a game.  E. g. mala currently allows only one keypress as the signal to start a game, I would like for coin up, p1 start, p2 start and fire button to all start a game.  why make it hard for guests. 

Code: [Select]
;
;This script is to make the joystick (u360) give keyboard inputs to MaLa, due to the problem with MaLa taking joystick inputs after the game starts and moving around in the gamelist when Mala would normally be asleep. 
;

setTitleMatchMode, 2

DetectHiddenWindows,on

#IfWinActive, MaLa

#Persistent
SetTimer, WatchAxis, 5
return

WatchAxis:
GetKeyState, JoyX, JoyX  ; Get position of X axis.
GetKeyState, JoyY, JoyY  ; Get position of Y axis.
KeyToHoldDownPrev = %KeyToHoldDown%  ; Prev now holds the key that was down before (if any).

if JoyX > 70
    KeyToHoldDown = Right
else if JoyX < 30
    KeyToHoldDown = Left
else if JoyY > 70
    KeyToHoldDown = Down
else if JoyY < 30
    KeyToHoldDown = Up
else
    KeyToHoldDown =

if KeyToHoldDown = %KeyToHoldDownPrev%  ; The correct key is already down (or no key is needed).
    return  ; Do nothing.

; Otherwise, release the previous key and press down the new key:
SetKeyDelay -1  ; Avoid delays between keystrokes.
if KeyToHoldDownPrev   ; There is a previous key to release.
    Send, {%KeyToHoldDownPrev% up}  ; Release it.
if KeyToHoldDown   ; There is a key to press down.
    Send, {%KeyToHoldDown% down}  ; Press it down.
return

« Last Edit: February 16, 2012, 03:19:06 pm by TopJimmyCooks »

nitz

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 507
  • Last login:November 24, 2015, 07:57:29 pm
Re: Mala registering u360 inputs while Mame is running a game.
« Reply #7 on: February 19, 2012, 04:53:32 pm »
Hey TopJimmyCooks, glad to see you got this working! :applaud: I didn't forget about this, I've been lurking every day this last week, but was crazy busy and since it appeared that you got it sorted out, I just didn't get around to logging in and posting.

This problem was a weird one, and to be perfectly honest with you, after looking it over for a couple minutes, I'm not quite sure why that script does the trick. But no matter, awesome that you were able to get things working. :cheers:

Nitz, if this works I'm counting this as miracle two.  One more for canonization.  No pressure  ;D 

 :lol Haha! Thanks man. AutoHotKey really makes this stuff pretty straight forward and I've spent tons of time working with it, so I can often think of potential solutions to stuff fairly quickly.

TopJimmyCooks

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2097
  • Last login:March 26, 2024, 01:18:39 pm
Re: Mala registering u360 inputs while Mame is running a game.
« Reply #8 on: February 19, 2012, 07:52:17 pm »
Thanks to your prompting I got it working- it really is a workaround rather than a fix.  The original problem is still there if I enable joystick navigation in MaLa.  I think its a rare problem due to the combo of U360, MaLa and StartCom which is why nothing else popped up earlier.  AFAIK, I'm the only one with this combo.

Also, with a simple key substitution script, I got Mala to start a game on pressing 1, 2, 5 or 6.  As far as Mala sees, they're all 1, which is set as the one keypress Mala uses for game start.  Using your information, both scripts are only active while the Mala window is active.  These are cool but the Tron in-game thing is a stunner.  If I go back to using the Fatfingers u360 mapping plugin for Mala, I might have to give that one a try.