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: Prevent MAME frontend from exiting [SOLVED]  (Read 2968 times)

0 Members and 1 Guest are viewing this topic.

aesculus

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 11
  • Last login:February 09, 2021, 09:37:48 pm
  • I want to build my own arcade controls!
Prevent MAME frontend from exiting [SOLVED]
« on: February 02, 2021, 09:25:52 pm »
I don't use Hyperspin or any frontend. I like the plain old MAME frontend. I have my machine pretty much configured how I want it, with one exception. Whenever my kids play it, they often hit the escape button too many times, closing MAME and showing the Windows 10 desktop. Is there a way to set the key that closes a game different from the key that closes MAME out completely? I want players to be able to close individual games normally, but require a secret keypress to close the MAME frontend. Is that even possible?

********

Here's what I ended up doing. Rather than use AutoHotkey to have esc launch MAME, which actually interfered with the key's function while in MAME (or would launch repeated instances of MAME), I simply made an AutoHotkey script that listens for mame64.exe to close, and then immediately re-launches it. So when the user hits escape, the the mame screen blanks momentarily, then comes right back up. The user cannot exit using the CP now. I threw in a F4::Pause to make getting back to Windows graceful for the admin. Hitting F4 again in Windows automatically launches MAME again. Script is simple:
Code: [Select]
Loop {
Process, WaitClose, mame64.exe
Run mame64.exe
}
F4::Pause
« Last Edit: February 05, 2021, 06:26:19 pm by aesculus »

Robbbert

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 205
  • Last login:Yesterday at 04:40:45 am
Re: Prevent MAME frontend from exiting
« Reply #1 on: February 03, 2021, 08:39:16 am »
Doesn't seem to be possible.

Thenasty

  • Trade Count: (+17)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4413
  • Last login:April 17, 2024, 04:54:36 pm
    • Thenasty's Arcademania Horizontal/Vertical monitor setup.
Re: Prevent MAME frontend from exiting
« Reply #2 on: February 04, 2021, 09:03:10 am »
I don't use it like you do but, I was thinking what if you assign the MAME setting (when you are in a game, TAB into the configuration) and change the EXIT GAME to any other keys?

does this 2 the share the same configuration ?

« Last Edit: February 04, 2021, 09:04:41 am by Thenasty »
Thenasty's Arcademania Horizontal/Vertical setup.
http://forum.arcadecontrols.com/index.php?topic=26696.0

Free VGA Breakout Cable
http://forum.arcadecontrols.com/index.php?topic=38228.0

Ultimate All in One Coin Mech write up (Make your own)
http://forum.arcadecontrols.com/index.php?topic=19200.0

aesculus

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 11
  • Last login:February 09, 2021, 09:37:48 pm
  • I want to build my own arcade controls!
Re: Prevent MAME frontend from exiting
« Reply #3 on: February 04, 2021, 01:27:40 pm »
Unfortunately, the key assigned to exit a machine is always the same key that exits mame. It's hard to believe, but that is how it is, I've come to find out. I had an idea that maybe using AutoHotkey to relaunch mame whenever the esc key is pressed would be the solution. Like a yo-yo, every time you try to close it, it persistently comes back. That might present its own problems, however. I will test that out.

Phreakwars

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 591
  • Last login:Today at 12:39:34 am
  • Waka-Waka
    • forum.arcadecontrols.com/index.php/topic,146325.0.html
    • My Facebook Page
Re: Prevent MAME frontend from exiting
« Reply #4 on: February 04, 2021, 05:37:52 pm »
On my son's, while configuring, and before I set it to auto shutdown on exit,  I'll often exit MAME and reenter with the joystick controls by pressing Ctrl (button 1)+ esc to bring up the taskbar menu, then just use the joystick to navigate up to the shortcut on the start menu and hit enter. I know that doesn't solve the problem, but it's an easy way to reload mame after exiting. I do this for programming and testing things like LEDBlinky and the Sinden.

PL1

  • Global Moderator
  • Trade Count: (+1)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 9401
  • Last login:Yesterday at 09:47:50 pm
  • Designated spam hunter
Re: Prevent MAME frontend from exiting
« Reply #5 on: February 05, 2021, 01:30:28 am »
Perhaps a remix of the image-search AHK scripts by Nitz and Le Chuck might be useful.
How did you do the Tron in-game switch? Joychoose is probably normally looking at controls.ini, which doesn't give 8way v/s 4 way for tron. 
Right you are, Tron is an 8way in the controls.ini so I went hunting for suggestions and Nitz came to the rescue with a great image-search AHK script.  The development of the project is here.  In short a script runs in the background and hunts for some very small images that are unique to Tron and the lightbikes level.  When it sees these images the script calls my servo.

Wire the Exit button to a different IPac input or reprogram your IPac Exit input to a different keystroke.
- Either way, assign a keystroke to the Exit button that isn't used in the MAME built-in frontend or any games.

When the AHK script sees that keystroke, trigger the search for an image unique to the MAME frontend.
- If it finds the unique image, do nothing. (i.e. don't exit MAME)
- If it doesn't find the unique image, send an ESC keystroke.
- Maybe add a short pause after sending the ESC keystroke to reduce the chance that someone hits the key several times when exiting the game, triggering image search several times and buffering some ESC keystrokes before the MAME frontend is displayed.   :dunno

Even with the AHK script running, you can still exit MAME by pressing ESC on a wireless keyboard or using a hidden button wired to an IPac input that outputs an ESC keystroke.


Scott

Zebidee

  • Trade Count: (+9)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3247
  • Last login:Yesterday at 05:01:12 am
Re: Prevent MAME frontend from exiting
« Reply #6 on: February 05, 2021, 02:52:19 am »
On my son's, while configuring, and before I set it to auto shutdown on exit,  I'll often exit MAME and reenter with the joystick controls by pressing Ctrl (button 1)+ esc to bring up the taskbar menu, then just use the joystick to navigate up to the shortcut on the start menu and hit enter. I know that doesn't solve the problem, but it's an easy way to reload mame after exiting. I do this for programming and testing things like LEDBlinky and the Sinden.

Easier way to do this:

Make a shortcut to mame (or your frontend), which you have already done. Now go to the shortcut's properties (right-click). From there you can set a shortcut key combo to launch the shortcut. I always choose [ctrl]+[alt]+1, which = P1 buttons 1+2+ P1 start for default MAME keys.
Check out my completed projects!


aesculus

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 11
  • Last login:February 09, 2021, 09:37:48 pm
  • I want to build my own arcade controls!
Re: Prevent MAME frontend from exiting [SOLVED]
« Reply #7 on: February 05, 2021, 06:30:18 pm »
Thank you for the suggestions. I came up with a solution that I like. I posted it at the beginning of the thread.

Zebidee

  • Trade Count: (+9)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3247
  • Last login:Yesterday at 05:01:12 am
Re: Prevent MAME frontend from exiting [SOLVED]
« Reply #8 on: February 05, 2021, 09:16:15 pm »
Neat solution, thanks for posting it
Check out my completed projects!


Robbbert

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 205
  • Last login:Yesterday at 04:40:45 am
Re: Prevent MAME frontend from exiting [SOLVED]
« Reply #9 on: February 06, 2021, 02:24:42 am »
Just as long as you know that from 0.229, it won't be called mame64.exe any more - it will become mame.exe