Author Topic: usb controller unplugging causes error  (Read 2783 times)

slydog43

  • Full Member
  • ***
  • Posts: 66
    • View Profile
usb controller unplugging causes error
« on: May 22, 2017, 03:10:47 PM »
I posted this in the bug report section, but thought this might be  better place as I'm not sure if its a bug or a limitation.  anyway, I totally Love this FE, definitely the best I have ever used. I have removable control panels for my mame cabs. I have run into an issue where if AM is running browsing games and I switch a control panel (usb ipac2), AM gets into a non responsive state. see link for error message. Any ideas?

I tried adding to the if statement
 && (move_duration > 0)  to eliminate the error, but still no control once the usb controller is removed and reinserted. 

So close to a perfect mame machine but I have to quit out of AM now inorder to change control panels

I can post a youtube vid of this happening if needed
« Last Edit: May 22, 2017, 03:32:00 PM by slydog43 »

slydog43

  • Full Member
  • ***
  • Posts: 66
    • View Profile
Re: usb controller unplugging causes error
« Reply #1 on: May 23, 2017, 04:41:41 AM »
More info:

This is not exactly an AM issue but a windows issue.  If I open notepad and move my current controller it moves the cursor around, thus input via Ipac is working.  If I unplug control panel (IPac) and replug it in the joystick will continue to move cursor around in notepad, thus all is good.  I can repeat this many times.  However if in AM or MAME.exe menu without AM and do the same thing, control is lost after first plug in.  Is there some sort of input reset that can be performed, not sure if windows is reassigning an ID to the USB controller (IPac) every time I plug it in.  This sucks as I was going to go the longer path and keep the I/Pac in the cabinet and wire a 50Pin scsi connector on each control panel, but was taking so long I decided to just use USB and a separate ipac in each control panel.  I should have tested this before committing to this plan

anyone much smarter than me have any ideas?  thanks

slydog43

  • Full Member
  • ***
  • Posts: 66
    • View Profile
Re: usb controller unplugging causes error
« Reply #2 on: May 23, 2017, 05:10:22 AM »
I have an idea that might work.  I can create a AutoHotKey script to Kill AM and restart AM.  I then put a button on the cab that runs this script (Hidden and only exposed when replacing control panels.  Will test this out later today to see if this works, crossing fingers

I got it to work, more testing is needed, but it seems to work with this AHK script hooked up to a button on my cab to reload AM.

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

;Windows Key + A will run this routine
#a::
  Runwait, taskkill /im attract.exe /f
  SetWorkingDir, C:\Emulation\FrontEnds\AttractMode
  Run, "C:\Emulation\FrontEnds\AttractMode\attract.exe",,,myPID
  ;Msgbox Pid=%myPID%
  Sleep, 750
  WinActivate, ahk_pid %myPID%
return


Not sure why I have to have some sleeps in there, but it would not always work without them, any ideas on improving script??


Hope this helps someone else out there who might need to do something similar


Well still not perfect, but much better.  I still have to hit Alt-Tab once ever 10 or so times.  Any ideas on this one?
« Last Edit: May 23, 2017, 12:09:55 PM by slydog43 »