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: Screen saver while MAME is paused  (Read 3258 times)

0 Members and 1 Guest are viewing this topic.

rCadeGaming

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1256
  • Last login:April 13, 2025, 12:14:40 pm
  • Just call me Rob!
Screen saver while MAME is paused
« on: March 16, 2012, 07:15:32 pm »
I'm writing my own front-end for Mame.  It has a feature where if you leave it idle for a period of time, it launches a random game and runs it for a little while.  That games stops after a while, goes back to the FE for a few seconds, and it launches another game.  This process repeats until you press any button or move the mouse/trackball.  Then it returns to the FE and the initial idle timer resets.

This is done simply by launching MAME with the "seconds to run" property, and telling it to use an alternate mame.ini, pointing to an alternate default.cfg file, where all the cabinet's inputs are set to "ui cancel."

I got this all working great as a screen saver for the FE, but the problem is that the user can still launch a game manually, pause it, and walk away to let the screen burn in.

Anyone know how to add a screen saver or something to the pause screen in MAME?  I could turn the pause brightness all the way down, but that's really a last resort.

Since I'm writing my own front-end, it can't be a feature of another.  Anyone know of a stand-alone program or a diff or some kind of mod or solution?

If someone good with C could write a diff, I think it would be helpful to a lot of cab builders.  A simple but effective solution could be that the pause screen is the normal dimmed gameplay screen for a minute or so, then something pops up and moves around the screen to prevent burn-in.

Any ideas?

Le Chuck

  • Saint, make a poll!
  • Wiki Contributor
  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5509
  • Last login:June 14, 2025, 06:26:06 pm
  • <insert personal text here>
Re: Screen saver while MAME is paused
« Reply #1 on: March 16, 2012, 07:22:11 pm »
I would think that you could do an AHK script that whenever P <insert your pause button> is depressed it runs a script that first pauses two minutes then sends a key press to save state then sends a keypress to exit game.  After that everything else takes over.  When you come back you just need to load state.   

rCadeGaming

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1256
  • Last login:April 13, 2025, 12:14:40 pm
  • Just call me Rob!
Re: Screen saver while MAME is paused
« Reply #2 on: March 16, 2012, 07:31:56 pm »
Looked up AutoHotKey.  I could try something use this, but I'm worried it would get out of sync with whether MAME is paused or not.  Autokey can't interact directly with MAME right?

I know it should be easy to find the code in MAME that runs when you push pause and add something there.  I would like to be able to write it myself, but I don't know anywhere close to enough about C/C++.  I wrote my FE in Visual Basic .NET. 

Le Chuck

  • Saint, make a poll!
  • Wiki Contributor
  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5509
  • Last login:June 14, 2025, 06:26:06 pm
  • <insert personal text here>
Re: Screen saver while MAME is paused
« Reply #3 on: March 16, 2012, 07:40:07 pm »
In AHK you can add a one liner to make the code only activate when MAME is running.  It's an if win active command I think.  Nitz would have already written the code for you if he had seen this thread.  He's generally helpful like that.  I on the other hand tend to muddle though my coding. 

nitz

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 507
  • Last login:November 24, 2015, 07:57:29 pm
Re: Screen saver while MAME is paused
« Reply #4 on: March 17, 2012, 01:14:16 am »
Heard my name again! ;D

rCadeGaming, if I'm understanding correctly, you want a screen saver to kick in when mame has been paused for a couple minutes, but not otherwise? This does the trick.

Quote
setTitleMatchMode, 2

Loop
{
IfWinNotActive, MAME
continue
    If (A_TimeIdle > 120000)
    {
    setworkingdir, C:\Windows\System32
    run ribbons.scr /s
        Loop
        {
        If (A_TimeIdle < 120000)
        break
        }
    }
}

The top two lines of the first loop cause it to simply restart whenever mame is not the active window. But if it is, the script continues and checks the idle time. When it's less than 2 minutes, the loop starts over. When it's greater than 2 minutes, the script changes to the directory where the screensavers are, and runs the ribbons screensaver (I'm on Windows 7, the directory may be different and the ribbons screensaver may not exist depending on what flavor of Windows you're on, so adjust accordingly) Then it runs another loop until idle time is less than 2 minutes (ie. you pressed something) then the whole process starts over. Whenever you exit mame, it gets stuck at the beginning of the main loop until you start mame again.

I realize this may not be *quite* what you asked for since it does not require mame to be paused. I did it this way because doing it the other way would require a special mame compile. If you want to go down that road we can, but I think this works nicely since you'd be hard pressed to find an arcade game that would have you not pressing anything for a whole 2 minutes straight, except maybe during an ending sequence.

 :cheers:

rCadeGaming

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1256
  • Last login:April 13, 2025, 12:14:40 pm
  • Just call me Rob!
Re: Screen saver while MAME is paused
« Reply #5 on: March 17, 2012, 02:04:22 am »
nitz.  That... is.. awesome!  Thank you!

Questions:

Where do you insert this?

The time is in increments of thousands of a second?

The ending sequence thing is kind of a problem.  Could you show me how to make it only do this during pause?  I compile my own MAME anyways.  For a few reasons, including this:

http://www.mameworld.info/ubbthreads/showflat.php?Cat=&Number=266133&page=0&view=expanded&sb=5&o=&vc=1

Thanks again.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19433
  • Last login:Today at 12:20:57 am
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Screen saver while MAME is paused
« Reply #6 on: March 17, 2012, 07:01:39 am »
I would reccomend against this.  Mame is a fullscreen directx app.... pausing it and going to another ap while paused is possible, but it can cause issues.  Every time mame drops out of fs all the textures have to be destroyed and recreated.  If there is even the slightest bug in mame's source, constantly re-creating the texture cache could create a memory leak.  On top of that you are essentially wanting to run two instances of mame at once.  Again, this is possible but it could cause issues.  For example, if your users are using a app that takes advantage of mame's output system, having two instances of mame running at once is going to confuse the heck out of it.

I would actually reccomend not using mame's pause feature at all.  Real arcade games don't have a pause feature you know.  If you insist on adding this feature, a simple slideshow would be better for when mame's paused.  Perhaps only showing artwork related to the game playing?

rCadeGaming

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1256
  • Last login:April 13, 2025, 12:14:40 pm
  • Just call me Rob!
Re: Screen saver while MAME is paused
« Reply #7 on: March 17, 2012, 11:19:25 am »
I'm not trying to run two instances of MAME at once.  I never said the screen saver during pause had to work the same way as the screen saver in my front-end, just anything to stop burn-in.  I certainly agree that it would cause problems to run two MAMEs.

I know real arcades didn't let you, but I'm making a custom cabinet, so I'd like to add the ability to stop and go to the bathroom without starting over.

A slideshow in MAME itself would be fine.  It wouldn't even have to be more than different colored balls bouncing around the screen.  Just something to prevent burn-in.

nitz

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 507
  • Last login:November 24, 2015, 07:57:29 pm
Re: Screen saver while MAME is paused
« Reply #8 on: March 17, 2012, 07:49:36 pm »
Where do you insert this?

You would just put it into a text file, name it with the extension .ahk and then run it. You could put a shortcut to it in your startup folder to have it running all the time.

The time is in increments of thousands of a second?

You got it. 120000 milliseconds = 120 seconds = 2 minutes

The ending sequence thing is kind of a problem.  Could you show me how to make it only do this during pause?

Certainly. First I'll direct you to another thread, check out step 4 in reply 20 here: http://forum.arcadecontrols.com/index.php?topic=105538.0 You'll need to compile mame to accept keypresses from a program for this to work.

When you've done that, try a script like this.

Quote
setTitleMatchMode, 2

paused = 0

#IfWinActive, MAME

$p::
send {blind} {p downtemp}
send {blind} {p up}

If (paused = 1)
{
paused := 0
return
}

paused := 1

sleep 120000

If (paused = 1)
{
setworkingdir, C:\Windows\System32
run ribbons.scr /s
}
return

This is untested as I don't have the special compile of mame handy, but it should work.

Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19433
  • Last login:Today at 12:20:57 am
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: Screen saver while MAME is paused
« Reply #9 on: March 17, 2012, 09:23:34 pm »
I'm not trying to run two instances of MAME at once.  I never said the screen saver during pause had to work the same way as the screen saver in my front-end, just anything to stop burn-in.  I certainly agree that it would cause problems to run two MAMEs.


Good... that simplifies things dramatically.  There is a setting in your mame.ini called "pause_brightness"  set that to 0 and the screen will blank when you pause a game.  You could also set it to a stupidly low number like 0.01 and I don't think you would have to worry about burn in unless you leave it paused for several hours.

rCadeGaming

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1256
  • Last login:April 13, 2025, 12:14:40 pm
  • Just call me Rob!
Re: Screen saver while MAME is paused
« Reply #10 on: March 24, 2012, 10:48:25 pm »
Hey, sorry for not responding for a while, haven't been able to get much free time because of work in the last week.  Currently I'm focusing the time I do have to work on cabinet stuff on the hardware side, but I will definitely implement this when I get back to working on my front-end and other software stuff.  Thanks!