Author Topic: AM no longer responds after exiting a MAME game  (Read 3825 times)

Wobbles

  • Newbie
  • *
  • Posts: 1
    • View Profile
AM no longer responds after exiting a MAME game
« on: October 07, 2017, 03:55:04 AM »
Hi,

I'm running a GroovyArcade installation on a VirtualBox VM (this is for test purposes before I install it on my actual Cocktail Cabinet). However, I'm having an issue when I choose AttractMode as the frontend. On startup everything works fine, but after running a MAME game and returning to AttractMode (by pressing ESC), AttractMode no longer responds in any way. The AttractMode animation is still running, but the arrowkeys, TAB, ESC keys (or any other key combination I can think of) do not respond. All I can do is restart the VM.

I don't have this problem if I choose AdvanceMenu as the frontend, everything works fine.

I've tried remapping the ESC key for AttractMode to something else, but that has no effect either. I don't know if this is just something to do with running it in a VM or not, but I'd like to be sure before going ahead with a full install on my arcade machine.

Thanks for any help!
Wobbles

YellowBirdAZ

  • Full Member
  • ***
  • Posts: 80
    • View Profile
Re: AM no longer responds after exiting a MAME game
« Reply #1 on: October 07, 2017, 06:40:31 PM »
First, thank goodness the forum is back.

I was having the same problem. It was the last major issue I was having with my cabinet.

I think I fixed it in my case by messing with the Resfix plug-in. This has been mentioned elsewhere as a possible solution. When I turned it off completely, the problem went away.

Now, this may introduce new issues I haven't encountered yet. But so far, nothing.

You can set Resfix to only do its thing with specified emulators. I may go back and selectively turn it back on for some things. I am pretty sure the issue I was having was specific to MAME, so I may just turn it off for that.

It was a very frustrating problem, and I wasted a lot of time trying to figure it out on my own (without much success) while the forum was down.

YellowBirdAZ

  • Full Member
  • ***
  • Posts: 80
    • View Profile
Re: AM no longer responds after exiting a MAME game
« Reply #2 on: October 07, 2017, 08:22:43 PM »
Well, Resfix is part of the problem but not all of it.

Shutting it off fixed everything on my office PC, but obviously that's not a perfect test of my actual cabinet.

When I tried it on my cabinet it didn't solve the issue, but got be closer.

I am using an Autohotkey script to listen for a PAUSE/RESET button on my cabinet. (Short press = pause, hold for 3 seconds exits back to AM.) I had to add a line in the AHK script to send a ALT+TAB key press combo to restore focus to AM after MAME closes.

So that works, but super clunky. I need to flash a black screen or something to conceal the hackery going on just to get back to the front-end.

It would be great to have a simple, clean solution to this, but I don't have one.

kent79

  • Hero Member
  • *****
  • Posts: 842
    • View Profile
Re: AM no longer responds after exiting a MAME game
« Reply #3 on: October 10, 2017, 05:29:37 PM »
Using RetroArch as backend instead of MAME  :)

YellowBirdAZ

  • Full Member
  • ***
  • Posts: 80
    • View Profile
Re: AM no longer responds after exiting a MAME game
« Reply #4 on: October 10, 2017, 08:48:32 PM »
RetroArch exits nicely, eh?

You know, I thought I would save time by sticking with what I know best, but in retrospect getting more familiar with RetroArch might have actually ended up SAVING me time.

I have a couple games I run through the FB Alpha core of Retroarch. But otherwise I stuck with MAME. Once my cabinet is working I am not futzing with it anymore (or I hope I won't).


jimmer

  • Full Member
  • ***
  • Posts: 45
    • View Profile
Re: AM no longer responds after exiting a MAME game
« Reply #5 on: November 25, 2017, 02:50:41 PM »
Hey Yellowbird,

I like the idea of short press for pause and long press for exit. Any chance you could share the script please? I've not used AHK before.

YellowBirdAZ

  • Full Member
  • ***
  • Posts: 80
    • View Profile
Re: AM no longer responds after exiting a MAME game
« Reply #6 on: January 23, 2018, 07:35:43 PM »
Sorry for delayed response Jimmer. Here is what I did. It has been a while since I looked at this, forgive clunky stuff like absolute paths and whatnot. It appears my solution was very specific to the I-Pac, but any USB keyboard encoder that supports macros should work. I just have mine configured so the pause/reset button sends a "P", then an "=".

MAME catches the P and pauses the game. Then this script catches the "=" and if it's depressed for 3 seconds it shuts whatever is running in the foreground down.

I just leave this script constantly running in the background.

Code: [Select]
; THE I-PAC 4 SENDS A MACRO WITH A "P" AND A "=" WHEN PAUSE/RESET BUTTON IS PRESSED
; MAME AND OTHER GAMES INTERPRET THE "P" AS THE PAUSE SIGNAL
; THIS SCRIPT IGNORES THE "P" AND INSTEAD TIMES HOW LONG THE "=" IS DEPRESSED
; IF "=" IS HELD DOWN FOR OVER 3 SECONDS, THIS SCRIPT EXECUTES A FRONT-END RESET

#WinActivateForce

^!3::Run, C:/CSR/ChangeScreenResolution.exe /d=\\.\DISPLAY1 /w=320 /h=240
^!6::Run, C:/CSR/ChangeScreenResolution.exe /d=\\.\DISPLAY1 /w=640 /h=480
^!8::Run, C:/CSR/ChangeScreenResolution.exe /d=\\.\DISPLAY1 /w=800 /h=600

$=::

; Get Title and ID of current window
WinGetTitle, wTitle, A
wId := WinExist("A")

if (wTitle != "Attract-Mode")
{
KeyWait `=, t3.0
if (errorlevel)
{

; CLOSE OR KILL THE WINDOW THAT WAS ACTIVE WHEN RESET INITIATED
WinClose, ahk_id %wId%,,1.5
IfWinExist, ahk_id %wId%
{
WinKill, ahk_id %wId%
}

; RESET SCREEN RESOLUTION
; USE RUNWAIT
RunWait, C:/CSR/ChangeScreenResolution.exe /d=\\.\DISPLAY1 /w=320 /h=240

; IF ATTRACT-MODE IS RUNNING, BRING IT TO THE FRONT
IfWinExist, Attract-Mode
{
WinActivate
}

                ; SEND KEYSTROKES TO RESET FOCUS
Send {ALT DOWN}{TAB}{ALT UP}

; IF ATTRACT-MODE IS NOT RUNNING, RESTART IT
IfWinNotExist, Attract-Mode
{
;Run C:\AttractMode\attract.exe
}

; CLOSE ALL AHK SCRIPTS EXCEPT THIS ONE
PID:=DllCall("GetCurrentProcessId")
for process in ComObjGet("winmgmts:").ExecQuery("Select * from Win32_Process where name = 'Autohotkey.exe' and processID  <> " PID )
    process, close, % process.ProcessId

}


}

Return