Build Your Own Arcade Controls Forum

Main => Main Forum => Topic started by: Bill Mote on April 21, 2008, 02:09:52 pm

Title: Automatically Restarting a Front End
Post by: Bill Mote on April 21, 2008, 02:09:52 pm
Does anyone know how to monitor the Front End and restart it if it stops?  I know "firedaemon" can do this if you launch your FE as a process and I've come up with a simple .bat file that launches mamewah:

Code: [Select]
:RUNFE

CD C:\MAMEWAH
@CALL MAMEWAH.EXE

GOTO RUNFE

This launches MAMEWah and returns control to the batch file if mamewah exits.  It relaunches mamewah automatically, but this feels more like a hack than anything respectable ;)  Firedaemon costs $40 for home use.  I'm not that ashamed of my batch file.  Just curious if anyone knows of a better and/or more sophisticated way to do this.

dot
Title: Re: Automatically Restarting a Front End
Post by: fjl on April 21, 2008, 03:17:12 pm
I'm by no means a coding pro. Everything I know I learned on my own. This is one thing I learned from playing around with DOS...


Code: [Select]
@echo off
:relaunch
start /wait Frontend.exe
goto :relaunch

Basically what it does is open a program and waits for it to close. If it closes it loops back to the command that opens it and again waits for it to close. It repeats this indefinitely until someone closes the DOS Batch Window. Which is the only problem, a DOS Window pops up when this is inserted into a batch file. But I suppose you can add it to a previous batch file or something.
Title: Re: Automatically Restarting a Front End
Post by: gonzo90017 on April 21, 2008, 04:22:04 pm
You know how the old saying goes. If it works....
Title: Re: Automatically Restarting a Front End
Post by: Bill Mote on April 21, 2008, 04:23:01 pm
If it works tweak it?  :P

dot
Title: Re: Automatically Restarting a Front End
Post by: TheShanMan on April 21, 2008, 04:51:00 pm
Not sure how well FE's would work as a service, but you could try getting one of those "run app as a service" programs and set it to run your FE as a service. Then go into the services "properties" dialog and set it to interact with desktop (otherwise you will never see the FE). Finally you can tell it to restart if the process terminates in that same dialog.

This is assuming you're using XP.
Title: Re: Automatically Restarting a Front End
Post by: Bill Mote on April 21, 2008, 04:53:30 pm
M$ provides the SRVANY and I've used it many times in the past.  I guess I could give that a try ...

dot
Title: Re: Automatically Restarting a Front End
Post by: Havok on April 21, 2008, 08:45:53 pm
I think the bigger question is why? Does it crash? My frontend always runs and I don't have to resort to that...
Title: Re: Automatically Restarting a Front End
Post by: fjl on April 22, 2008, 03:59:08 am
So my DOS batch file doesn't cut it?  ??? :'(
Why not?
Title: Re: Automatically Restarting a Front End
Post by: protokatie on April 22, 2008, 04:09:54 am
Quote
I think the bigger question is why? Does it crash? My frontend always runs and I don't have to resort to that...

You hit it where the sun dont shine. I was thinking "These are cool ways to make sure a program always runs" then I was like "Wait a minute, why do I need this?"

If your front end and or mame is failing regularly enough that you need an autorestart then you have more serious problems than scripting and batch files...

(Still interesting tho)
Title: Re: Automatically Restarting a Front End
Post by: protokatie on April 22, 2008, 04:20:12 am
Quote
So my DOS batch file doesn't cut it?

Another double post... By me.

Yes it works, but it shouldnt be needed. Also "So my DOS batch file doesn't cut it?" should be made to be your title by Saint. ;)

BTW, when I was an Amiga fan, I was big on AREXX, so I feel your pain.
Title: Re: Automatically Restarting a Front End
Post by: Ginsu Victim on April 22, 2008, 08:15:57 am
this would've been nice to know when mamewah was always crashing me on, but I found the bug and squashed it.

Still, it's a good temporary fix.

Better than nothing.

Here's my question: Say I load a game in MAME that doesn't work and freezes when I load it (there are a few). Is there a way to set a program to automatically close if it's not responding? (Using FastMAME .84)
Title: Re: Automatically Restarting a Front End
Post by: Bill Mote on April 22, 2008, 10:38:19 am
Why you ask?  :)  I have lots of kids using my cab.  They *always* hit the EXIT button too many times and end up at a blank black screen because MAMEWah is my OS shell.  Then I either have to open the coin door and pull out the keyboard or I have to VNC into the cab.  Both ruin the magic for those standing around ;)

MAMEWah has never crashed on my cab that I'm aware of.  It's just kids aged 3-14 that are causing the exits!  LOL

dot
Title: Re: Automatically Restarting a Front End
Post by: TheShanMan on April 22, 2008, 11:20:57 am
Surely you can disable exiting via the keyboard in mamewah? You can in mala, so for me that is a non-issue.
Title: Re: Automatically Restarting a Front End
Post by: Stub on April 22, 2008, 11:45:58 am
GameEx works nicely. I can configure what it allows. I can set up no exit, and power down only with a confirmation.
Title: Re: Automatically Restarting a Front End
Post by: Ginsu Victim on April 22, 2008, 11:52:56 am
You can easily remap MAMEWAH to exit with a different method. I use a shifted button, which takes me to the options menu. I exit to windows from there.
The only other exit method I have is a hidden button on top of the cabinet that shuts down everything.
Title: Re: Automatically Restarting a Front End
Post by: fjl on April 23, 2008, 03:11:20 am
Surely you can disable exiting via the keyboard in mamewah? You can in mala, so for me that is a non-issue.

I completely disabled the "Exit Frontend" option.
No wait, let me rephrase that. It's remapped so it can only be done with the keyboard. Pressing Escape only has an effect on the current game being played which displays the Exit confirmation screen. On the Frontend, its not mapped so it does nothing. To exit they'd have to access the keyboard which only I can.
Title: Re: Automatically Restarting a Front End
Post by: Bill Mote on April 23, 2008, 07:24:03 am
Thanks for the suggestions.  I'll look at my config and adjust ;)

dot
Title: Re: Automatically Restarting a Front End
Post by: Havok on April 23, 2008, 08:08:07 am
There you go - it's always good to ask why. Now you will have a better setup, avoid the kludge!
Title: Re: Automatically Restarting a Front End
Post by: (+_+) on April 23, 2008, 01:59:32 pm
The easy way, although not always evident, is the best way. Leading down the track you were going with firedaemon, you would have to ask what's going to watch firedaemon to make sure it doesn't crash and so on...