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: Feature Request: 3 second press of exit button to exit games  (Read 6757 times)

0 Members and 1 Guest are viewing this topic.

severdhed

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2971
  • Last login:October 07, 2022, 04:45:32 pm
  • RIP Dinosaur Hippo
Feature Request: 3 second press of exit button to exit games
« on: September 02, 2010, 10:26:31 pm »
I feel the need to have a dedicated exit button on my panel for obvious reasons, however my kids have a need to press that button at the most inconvenient times.  from what i have read, maximus arcade has a feature where you have to press and hold the exit button for several seconds before it will exit back to the front end.  i know some people got this to work using autohotkey, but that only apparently works with really old versions of mame. 

any chance of getting this functionality into MaLa?

i absolutely love MaLa, and i dont want to switch front ends if i dont have to.

thanks
Current Projects:      Zak-Man | TMNT Pedestal | SNES Pi | N64 Odroid
Former Projects:     4 Player Showcase | Donkey Kong | iCade

loadman

  • Moderator
  • Trade Count: (+3)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 4305
  • Last login:August 17, 2020, 03:23:55 am
  • Cocktail Cab owner and MaLa FE developer
    • MaLa
Re: Feature Request: 3 second press of exit button to exit games
« Reply #1 on: September 03, 2010, 12:00:10 am »
Hi,

I don't understand how I could put that in a FE,  ???

In MaLa there is no control over a emulator once it is running right?  Perhaps I missunderstand what you mean  ???

MaLa launches the emulated game then waits for the emulated game to stop running. MaLa doesn't kill the emulated game,.

 

Marsupial

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 511
  • Last login:April 17, 2024, 09:00:56 pm
  • I am teh Mars!
Re: Feature Request: 3 second press of exit button to exit games
« Reply #2 on: September 03, 2010, 01:36:16 am »
instead of a simple key, I use a shifted key for exit (or any admin function)

the shift key is not a button, but a keyswitch. So without the admin key, no can change game. (or config, etc)

with kids, I think its the best.
-Mars

empardopo

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 526
  • Last login:April 25, 2024, 10:57:48 am
    • My personal forum
Re: Feature Request: 3 second press of exit button to exit games
« Reply #3 on: September 03, 2010, 05:54:07 am »
You could use a combination of buttons to close the emulator using AllInOne. That would be less likely to close by mistake.

There is a link to AllInOne in my signature. (I'm sorry but It's a spanish version)

severdhed

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2971
  • Last login:October 07, 2022, 04:45:32 pm
  • RIP Dinosaur Hippo
Re: Feature Request: 3 second press of exit button to exit games
« Reply #4 on: September 03, 2010, 11:09:10 am »
i already have it set up for multiple buttons to be pressed to get it to exit, mame can do that natively. 

i'm not sure how you would implement this into mala, but lots of people on the forums say that maximus arcade can do it, so it has to be possible.  from what i understand, maximus uses a different key to exit than ESC.  a key that has no function in mame for instance.  when  you press and hold that key for several seconds, maximus sends the esc command to mame.  i'm not sure how it works exactly, that's just how i understood it from looking around.  either way it should be possible.
Current Projects:      Zak-Man | TMNT Pedestal | SNES Pi | N64 Odroid
Former Projects:     4 Player Showcase | Donkey Kong | iCade

Blanka

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2248
  • Last login:January 25, 2018, 03:19:28 pm
Re: Feature Request: 3 second press of exit button to exit games
« Reply #5 on: September 03, 2010, 11:20:57 am »
On the Mac, all emu's except MAME have a 2 second ESC button-press.

loadman

  • Moderator
  • Trade Count: (+3)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 4305
  • Last login:August 17, 2020, 03:23:55 am
  • Cocktail Cab owner and MaLa FE developer
    • MaLa
Re: Feature Request: 3 second press of exit button to exit games
« Reply #6 on: September 03, 2010, 09:24:24 pm »
  when  you press and hold that key for several seconds, maximus sends the esc command to mame.  i'm not sure how it works exactly, that's just how i understood it from looking around.  either way it should be possible.

I have not got lot's of spare time to chase these things up

if I am given all the details for what is required there is a much greater chase I can do something.

I have many questions:
- How would MaLa know what the esc key is for any emu?
- How would mala know what key is unused in any emu?

Do if somebody want to spend the time to work out how Maximus or other FE is arranged to make this possible then pass it on otherwise I rekon ha a shofted key works for me  ;D

Marsupial

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 511
  • Last login:April 17, 2024, 09:00:56 pm
  • I am teh Mars!
Re: Feature Request: 3 second press of exit button to exit games
« Reply #7 on: September 03, 2010, 10:05:11 pm »
What if mala simply have a configuration for the user to decide what key he wants?
-Mars

severdhed

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2971
  • Last login:October 07, 2022, 04:45:32 pm
  • RIP Dinosaur Hippo
Re: Feature Request: 3 second press of exit button to exit games
« Reply #8 on: September 03, 2010, 10:43:13 pm »
yeah, like for instance.  in MALA, you set the exit key to something like "Q", assuming that Q is not mapped to anything in mame.  you have mame configured as Esc as the exit key. in mala, a long press of the Q key would send the Esc command to mame.

i see that in mala, there are hot keys for other emulators so that you can press a key and send something different, (like alt F4), so this isn't really that different.

Current Projects:      Zak-Man | TMNT Pedestal | SNES Pi | N64 Odroid
Former Projects:     4 Player Showcase | Donkey Kong | iCade

nitz

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 507
  • Last login:November 24, 2015, 07:57:29 pm
Re: Feature Request: 3 second press of exit button to exit games
« Reply #9 on: September 07, 2010, 12:29:38 am »
I feel the need to have a dedicated exit button on my panel for obvious reasons, however my kids have a need to press that button at the most inconvenient times.  from what i have read, maximus arcade has a feature where you have to press and hold the exit button for several seconds before it will exit back to the front end.  i know some people got this to work using autohotkey, but that only apparently works with really old versions of mame. 

any chance of getting this functionality into MaLa?

i absolutely love MaLa, and i dont want to switch front ends if i dont have to.

thanks

I'm planning on doing something similar. I'm not gonna have a dedicated exit key, but I was thinking maybe holding down 1P and 2P start at the same time for 2 seconds could send esc. Easy to do, but unlikely to be done by accident during gameplay.

I investigated a bit, and it's actually really easy to compile new versions of mame to work with autohotkey again. I did this awhile back, so I'm fuzzy on the exact details, but tell me you're interested and I'll look back at my compiling stuff and let you know.

severdhed

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2971
  • Last login:October 07, 2022, 04:45:32 pm
  • RIP Dinosaur Hippo
Re: Feature Request: 3 second press of exit button to exit games
« Reply #10 on: September 07, 2010, 10:50:38 am »
yeah, that would be cool.  i installed a single admin button that i planned on using as Exit, however when that didnt work due to my kids, i decided to make it pause instead.  ideally if you press it it, it would be pause, and if you press and hold it, it would be excape. 

i'm not real familiar with the compiling process, i did it once when i first set up my cabinet to add hiscore support, but if i remember properly, it was difficult.  I'd like to stick with mame .124, since i have the roms for it...plus i had problems with sound on MK2 and MK3 on older versions. if there was a way to compile mame 124 to support the ahk exit script and hiscore support, i'd be all over that.(provided someone could help me do it)
Current Projects:      Zak-Man | TMNT Pedestal | SNES Pi | N64 Odroid
Former Projects:     4 Player Showcase | Donkey Kong | iCade

JustMichael

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1438
  • Last login:September 27, 2015, 01:19:40 am
  • Mmmmm!! Cheesecake!!
Re: Feature Request: 3 second press of exit button to exit games
« Reply #11 on: September 07, 2010, 10:56:51 am »
Perhaps it is time to teach the kids there are consequences to their actions...   ;D

severdhed

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2971
  • Last login:October 07, 2022, 04:45:32 pm
  • RIP Dinosaur Hippo
Re: Feature Request: 3 second press of exit button to exit games
« Reply #12 on: September 07, 2010, 11:00:21 am »
lol.  my 3 year old son knows which buttons to press, and which ones not to.  he really enjoys playing games with me.  however my 20month old  son is not so understanding.  i usually just put him on a bar stool and he sits there and pounds buttons and plays with sticks while we play, but he is really drawn to the one button that lights up (the exit button).  and, since it is a showcase cab, he stands on the little bridge portion between the panel and the monitor and reaches in from the back to press the button, he is very sneaky. 
Current Projects:      Zak-Man | TMNT Pedestal | SNES Pi | N64 Odroid
Former Projects:     4 Player Showcase | Donkey Kong | iCade

Marsupial

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 511
  • Last login:April 17, 2024, 09:00:56 pm
  • I am teh Mars!
Re: Feature Request: 3 second press of exit button to exit games
« Reply #13 on: September 07, 2010, 12:25:47 pm »
I don't have an exit button. I use the shift functionality of my iPac, and the shift button happens to be a keyswitch just for that purpose - you literally need an admin "key" if you want to exit the games.

I made the cab thinking that the toddlers would press any buttons. And it works.  Plus, the CP isn't overfilled with buttons.



-Mars

severdhed

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2971
  • Last login:October 07, 2022, 04:45:32 pm
  • RIP Dinosaur Hippo
Re: Feature Request: 3 second press of exit button to exit games
« Reply #14 on: September 07, 2010, 12:34:05 pm »
that's a cool idea, however i want other people to be able to use my cabinet. quite often, my wife's friends will come over to visit with their kids, who all want to play on the cabinets.  i am not always around when this happens.  i want them to be able to play the games they want to play, and choose another if they would like, without having to remember button combos or anything like that.  i want it to be simple enough that anyone can walk up to use it, with minimal instruction.
Current Projects:      Zak-Man | TMNT Pedestal | SNES Pi | N64 Odroid
Former Projects:     4 Player Showcase | Donkey Kong | iCade

loadman

  • Moderator
  • Trade Count: (+3)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 4305
  • Last login:August 17, 2020, 03:23:55 am
  • Cocktail Cab owner and MaLa FE developer
    • MaLa
Re: Feature Request: 3 second press of exit button to exit games
« Reply #15 on: September 07, 2010, 08:24:44 pm »
How About This?   :P

Marsupial

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 511
  • Last login:April 17, 2024, 09:00:56 pm
  • I am teh Mars!
Re: Feature Request: 3 second press of exit button to exit games
« Reply #16 on: September 07, 2010, 10:22:30 pm »
Who said you cannot have a key available, and admin buttons that are OFF without they key?
There's one admin key on top of my cabinet when I'm not there. You could have the "exit" button made to work only when the keyswitch is activated.  The other buttons aren't an issue, really. Its annoying but not a problem when the kids pause, or change volume.

Alternatively, you could use a version of MAME that saves the state on exit, and comes back right where you left next time you load a game.
-Mars

nitz

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 507
  • Last login:November 24, 2015, 07:57:29 pm
Re: Feature Request: 3 second press of exit button to exit games
« Reply #17 on: September 08, 2010, 02:11:57 am »
i'm not real familiar with the compiling process, i did it once when i first set up my cabinet to add hiscore support, but if i remember properly, it was difficult.  I'd like to stick with mame .124, since i have the roms for it...plus i had problems with sound on MK2 and MK3 on older versions. if there was a way to compile mame 124 to support the ahk exit script and hiscore support, i'd be all over that.(provided someone could help me do it)

Didn't really have time to hang out on the forum today - real life stuff, you know how it is. ;)

Coincidently, .124 was the version I used when I did this, so I'm gonna post a walkthrough here for you as soon as I get time. :cheers: That's good that you've compiled mame before - that's the harder part, making the change to accept autohotkey again is super easy! I'll take you through the whole process though since you feel a bit unsure, and I see that Mr Do's excellent walkthrough on mameworld now only covers the last few versions, and there are a few small differences for compiling as old as .124.

EvilNuff

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 430
  • Last login:February 24, 2024, 04:41:13 pm
Re: Feature Request: 3 second press of exit button to exit games
« Reply #18 on: September 08, 2010, 03:17:00 pm »
I've used AutoHotKey for other things (*cough*automating stuff in wow*cough*) but not this...why isn't this as simple as setting up an AHK script to capture when you hold a specific key for 3 seconds and sending a separate keystroke after the 3 seconds where the separate key is your exit key?

severdhed

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2971
  • Last login:October 07, 2022, 04:45:32 pm
  • RIP Dinosaur Hippo
Re: Feature Request: 3 second press of exit button to exit games
« Reply #19 on: September 08, 2010, 03:27:01 pm »
thats awesome, i understand about not having time.  i'd love to know how to compile mame to support that function again, as well as hiscore support an no nag screens. 

the AHK scripts seem to work fine in windows, but apparently there is an issue with how mame receives keystrokes that it doesn't ever get the signal sent by the script. 
Current Projects:      Zak-Man | TMNT Pedestal | SNES Pi | N64 Odroid
Former Projects:     4 Player Showcase | Donkey Kong | iCade

nitz

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 507
  • Last login:November 24, 2015, 07:57:29 pm
Re: Feature Request: 3 second press of exit button to exit games
« Reply #20 on: September 09, 2010, 12:57:22 am »
Alrighty, I'm going to run through compiling mame0124 with hi score and no nag + autohotkey acceptance. I'll make the disclaimer that all this is correct to the best of my knowledge, but it's always possible that I've made a mistake. If there are any problems, I'll try to help. Also, I may state stuff that seems obvious. I do this because this kind of thing requires following instructions to the letter, so I want to make this as clear as I can to anyone reading it.

OK, here we go!

1. Go here http://mamedev.org/tools/previous-20070810.html and download mingw-mame-20070810.exe. Double click it, and the file will self-extract. Extract it to C:\mingw. On the same page, there is a download link for dx80 mgw.zip. Download that, and extract it to a temporary folder. In that folder, find the following files:

d3d8.h
d3d8caps.h
d3d8types.h
ddraw.h
dinput.h
dsound.h

and copy them to your C:\mingw\include directory.

2. Go here http://mamedev.org/oldrel.html and download mame0124s.zip. Extract the file inside it, mame.zip, to wherever you like. Then extract mame.zip to C:\mamesrc.

3. Go here http://forum.arcadecontrols.com/index.php?topic=64298.0 and download the 124 hi score no nag patch. Change the file extension from txt to diff and place it in C:\mamesrc.

4. Now here's the part where we fix it so autohotkey will work again. Navigate your way to C:\mamesrc\src\osd\windows\. Open the file input.c. If you double-click it, it should just open in notepad, if not, open it with notepad. Now, find the following text:

// initialize RawInput and DirectInput (RawInput first so we can fall back)
rawinput_init(machine);
dinput_init(machine);
win32_init(machine);

and change it to this:

// initialize RawInput and DirectInput (DirectInput first so we can fall back)
dinput_init(machine);
rawinput_init(machine);
win32_init(machine);

Close the file and save your changes. We're basically just making mame revert to its old input system. I'm not sure if there are any negative side effects to this - I've never seen any, but this info is provided without warranty of any kind. ;)

5. Download the file I've attached to this post. This is simply the older version of the compile extras that are no longer available on Mr. Do's page. If you don't want to download this, you can search out how to compile with a diff file manually, but this will be much easier.

6. Extract the contents of compile_extras.zip to C:\mamesrc.

7. Go to C:\mamesrc and double click the command prompt shortcut. Type the following at the prompt:

patchmame hi_124

This puts in the hi score no nag patch.

8. We're ready to compile! At the command prompt, type this:

makemame

And now we wait. You'll see a bunch of code scrolling. Actually, this could take awhile. On my slowish computer, it takes over an hour. But when it finishes, you'll have a nice mame.exe (along with the other files you normally get with mame) in the C:\mamesrc folder with no nagging, hi score, and ready to take sent keypresses again!

One final note: It still won't work to send keypresses in the normal way. You have to do something different. Instead of typing

send {esc}

in your script as you normally would, you'll need to type

send {Blind} {esc downtemp}
send {Blind} {esc up}

That should work. Try it out!

I haven't looked into hotkeys involving holding down a key for a set amount of time. But you could probably figure it out, and I'm sure someone on the autohotkey forum could tell you in 2 seconds anyway.

Let me know how this works out! I'll try to help anyone with any issues.

severdhed

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2971
  • Last login:October 07, 2022, 04:45:32 pm
  • RIP Dinosaur Hippo
Re: Feature Request: 3 second press of exit button to exit games
« Reply #21 on: October 06, 2010, 10:49:25 pm »
oh, awesome...i missed your post.  i thought i had it set to notify me of replies to this thread, but apparently i didn't.  just by chance, i figured i'd check just to make sure adn i just found your instructions.  thank you for taking the time to do this, i am downloading the files right now and will be testing it here shortly.  i'll let you know how it works.
Current Projects:      Zak-Man | TMNT Pedestal | SNES Pi | N64 Odroid
Former Projects:     4 Player Showcase | Donkey Kong | iCade

severdhed

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2971
  • Last login:October 07, 2022, 04:45:32 pm
  • RIP Dinosaur Hippo
Re: Feature Request: 3 second press of exit button to exit games
« Reply #22 on: October 07, 2010, 12:20:27 am »
ok, so i followed the instructions, and after about 30 minutes, it was done compiling. since i was already running mame 124, i just copied the mame.exe and overwrote my old one. so far, the games still play.

i have an autohk script that i got from another thread(dont remmeber where i found it now). it was set up for the Esc key,however on my panel, the exit key is "5".  i managed to modify the script to work with the 5 key instead, and so far, that works.  i initially tried making the changes you suggested to my script, but unless i messed it up, it seemed to send the space key before and after the 5. so i went back to my original.  i fire up notepad and press the button, nothing happens, if i hold it for a few seconds, a 5 pops up.  so i fired up mala, launched a game, pressed the key, nothing happens (good) and when i hold the button, it exits the game.  this is awesome.  however i have one more tweak i would like to make to the script.  ideally, i'd like to make this button serve a dual purpose...a quick press would pause or unpause the game, and a long press would exit.  i tried playing around with the script, but i just don't understand it enough to make it work properly. any idea how to do this?  below is the contents of my ahk script.  right now, i have mame set up to pause with the "9" key. so in a perfect world, a quick press of the 5 key would send 9, and a long press would send 5. (i know these are not standard buttons, but im using a keywiz and dont want to have to reprogram it, so i am using the default key assignments and just reprogrammed mame to match)

any ideas on how to acccompish this?

here is my script:

;HoldEscape:

toggletimer = 0
esckill = 1
SetKeyDelay, 10, 20

$5::
   if toggletimer = 0
      SetTimer, resettimer, 1000
   toggletimer++
   if toggletimer > 3
      goto, toggleesckill
   if esckill = 1
   {
      tt=0 ; set time to 0
      loop,100
      {
         GetKeyState, s , 5, p
        if s=U
           Break
         tt+=25
         sleep 25
      }
      if tt>=2000  ; if key pressed for 2 or more sec
      {
         send, {5}
         toggletimer = 0
         sleep 1200
      }
   }
   else
   {
      send, {5}
   }
return

resettimer:
   toggletimer = 0
return

toggleesckill:
   soundplay, *48
   toggletimer = 0
   esckill *= -1
   sleep 500
return


Like i said, i'm not really sure how to do this, i just downloaded this existing script and changed all of the calles to {esc] and changed them to {5}


thanks again for all your help, this is awesome
Current Projects:      Zak-Man | TMNT Pedestal | SNES Pi | N64 Odroid
Former Projects:     4 Player Showcase | Donkey Kong | iCade

severdhed

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2971
  • Last login:October 07, 2022, 04:45:32 pm
  • RIP Dinosaur Hippo
Re: Feature Request: 3 second press of exit button to exit games
« Reply #23 on: October 08, 2010, 04:45:28 pm »
since this really has nothign to do with MaLa at this point, i created a new thread in the software forum regarding autohotkey


http://forum.arcadecontrols.com/index.php?topic=106418.0
Current Projects:      Zak-Man | TMNT Pedestal | SNES Pi | N64 Odroid
Former Projects:     4 Player Showcase | Donkey Kong | iCade

jasonbar

  • Trade Count: (+10)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2247
  • Last login:July 30, 2023, 02:52:55 am
  • Dr. Inferno
    • The Infernolab
Re: Feature Request: 3 second press of exit button to exit games
« Reply #24 on: October 14, 2010, 06:58:50 pm »
I use the same spring-loaded, hinged switch cover, but I don't use the key switch.  I use an all chrome (or stainless?) momentary pushbutton that has a similar form factor to the key switch.

Thanks,
-Jason


I don't have an exit button. I use the shift functionality of my iPac, and the shift button happens to be a keyswitch just for that purpose - you literally need an admin "key" if you want to exit the games.

I made the cab thinking that the toddlers would press any buttons. And it works.  Plus, the CP isn't overfilled with buttons.





Marsupial

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 511
  • Last login:April 17, 2024, 09:00:56 pm
  • I am teh Mars!
Re: Feature Request: 3 second press of exit button to exit games
« Reply #25 on: October 14, 2010, 08:24:39 pm »
that's not a bad idea...
-Mars