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: Single admin button for both Exit and Standby: possible in software?  (Read 901 times)

0 Members and 1 Guest are viewing this topic.

Diewrecked

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 179
  • Last login:June 20, 2012, 07:34:08 am
  • I want to build my own arcade controls!
Hi guys,

I'm building a MAME cab using 3DArcade as front end. I'd ideally like one admin button which is dual function:
  • When in a game, it effectively presses ESCAPE and quits back to the FE
  • When in the FE, it effectively presses the power button on the PC and puts it into STANDBY

Note I want to be able to go into Standby WITHOUT closing the FE, so that when I bring the machine back up the FE is already running (I've already mapped the exit key to be not-Escape).

Is this possible? Or would I need two buttons, one to act as Escape and one to act as the PC power button? Alternatively is there a nice little applet somewhere which will allow me to put the PC/Windows into Standby state by pressing the Escape key?

As an aside, am I right in thinking there is not a lot in it re power consumption/system reliability between a PC in full power-off state, a PC in hibernate - which is effectively the same thing but with RAMstate saved to a file - and a PC in Standby, which just keeps power to the RAM and keeps RAMstate live in volatile RAM (in the event of a power outage there would be nothing I would lose/need to have saved)?

Thanks in advance all
Cheers
« Last Edit: December 16, 2009, 04:48:32 am by Diewrecked »

speedklz

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 196
  • Last login:November 17, 2018, 12:56:23 pm
Re: Single admin button for both Exit and Standby: possible in software?
« Reply #1 on: December 16, 2009, 10:40:24 am »
Should be pretty easy to do. I would map the key in the FE to activate a batch file and then use the batch file to set the pc into standby mode sore there is no way of confusion in MAME. Dont map it directly to the stand by key because mame may also see the remapping and put the pc in standby.
%windir%\System32\rundll32.exe powrprof.dll,SetSuspendState    This can be put into a batch file and called up to put pc into standby mode. then just point the key you want to use to bring up this batch file.
Best of the Best of the Best. Sir!

doctorhifi

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 92
  • Last login:July 05, 2013, 08:21:41 am
    • My cabinet
Re: Single admin button for both Exit and Standby: possible in software?
« Reply #2 on: December 16, 2009, 10:58:10 am »
As far as your admin button causing the PC to go into standby from the frontend:

In your 3Darcade fe cfg file look for this entry:

exitcomp|false|false,shutdown,poweroff,logoff,reboot,restart|If set to true the frontend will after the kquit key has been pressed shutdown the computer.|

I don't know what the difference is between 'shutdown' and 'poweroff', but perhaps one of those can be used to place the PC in standby?  You could post that question on the 3Darcade forum.

As far as in-game exiting with your admin button, isn't that just a matter of going into the MAME setup screen and selecting that button as the default exit-to-frontend button?

If you are trying to make your admin button exit to the frontend when using other emulators then I wonder if you could write an AutoIt script to help with this?
some thoughts:
-Make the admin button a hot key using the HotKeySet function
-Use the ProcessClose function so when the hotkey is pressed it closes the particular emulator in question.
In this example the space button is the hotkey and causes the Visualboy Advance emulator to close:

HotKeySet("{SPACE}", "Exitemulator")

While 1
Sleep(100)
WEnd

Func Exitemulator()
ProcessClose ("VisualBoyAdvance-SDL.exe")
Exit (0)
EndFunc

In 3DArcade's emulator config file you have the option of having 3DArcade run an executable before an emulator is launched (RUNBEFORE) and you can use this in conjunction with your scripts to do some interesting things.  You also have the RUNAFTER command line to use as well.  A combination of these two can allow for many things.  In my situation I have certain scripts execute before a particular emulator is launched which remaps various keys to work properly with that particular emulator and then have a script that executes after returning to the FE that effectively cancels the first set of scripts returning all my keys to default value.  I don't claim this is the best or easiest way to do things but it works well for me.

Look for these lines in the 3DArcade femame cfg file:

runbefore||#fullexe|Format: commandline/runmethod/wait. Run an executable before the emulator to be launched by using normal,hidden, minimised or maximised and either wait (true) or don't wait (false) for its execution to be finished. The commandline accepts variables (field 2= $02) that reference the contents of fields of a gamelist entry.|
runafter||#fullexe|Format: commandline/runmethod/wait. Run an executable after the emulator to be launched by using normal,hidden, minimised or maximised and either wait (true) or don't wait (false) for its execution to be finished. The commandline accepts variables (field 2= $02) that reference the contents of fields of a gamelist entry.|