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: Wouldn't this be COOL?: random games run as screensaver  (Read 6233 times)

0 Members and 1 Guest are viewing this topic.

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Wouldn't this be COOL?: random games run as screensaver
« on: August 08, 2009, 02:42:00 am »
I think that this idea I'm going to suggest is a must and I'd really be happy if you could consider it for a future version of MaLa. Instead of a simple screensaver, a random game (even better if you can reduce the random selection from a custom list), will be run. You can also define for how long the game will be running until it quits and a new game is launched. This idea would be great for when you leave the cabinet alone. I usually like to have it on when I'm not playing, with a game running, just as decoration. With this idea of random games, it would be just perfect! Thanx.

mh12

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 125
  • Last login:December 24, 2010, 10:03:57 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #1 on: August 08, 2009, 02:59:47 am »
+1

i remember Maximus doing this, although i don't think there was an option to switch to another game from a list after a while. that would be great.

...Track n Field? nah....  X-Men? Nah... ooh, Galaga!  ;D

ETA: loadman's addressed this, in 2007: http://forum.arcadecontrols.com/index.php?topic=74628.msg772753#msg772753

and has anyone tried this? http://home.comcast.net/~tacobirds/
looks like it would work, but maybe a bit overkill for what the OP is talking about. and i'm wondering whether it works with your MAME install or is a new one. i wouldn't want to mess with another MAME.
« Last Edit: August 08, 2009, 03:18:46 am by mh12 »

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #2 on: August 08, 2009, 05:34:13 am »
I'm trying right now with Autoit. It works, but partially. I've created a script which presses shift (random game selection), waits for a second and then enter (run game). I've compiled it and renamed as a scr. You configure it in Windows and it works. However, the second part of the script doesn't. It's supposed to press esc or shut down MAME after one minute or so, but it doesn't. It's like MAME halting the script or something. The script is supposed to repeat the process in a loop, until the screensaver is interrupted.

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #3 on: August 08, 2009, 06:11:32 am »
That screensaver seems quite powerful and interesting. However, I still see the usual problem: it cannot know if I have my TV in yoko or in tate orientation. I have two layouts (horizontal and vertical) in MaLa, with two sepparate game lists, and I switch between them with one key. Having a screensaver which is integrated with MaLa means that only horizontal games will be run when in horizontal mode, and viceversa.

mh12

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 125
  • Last login:December 24, 2010, 10:03:57 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #4 on: August 08, 2009, 02:36:44 pm »
good try! sounds like you've come up against the same sort of problem loadman was having.

the screensaver program just seems too huge for the little function to be added. but maybe the author would have some advice on how to get this function working.

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #5 on: August 08, 2009, 04:39:42 pm »
It seems that MAME has some sort of protection that prevents automation tools to send keystrokes while it's running. Bad luck :(

Out only hope is in the hands of Loadman.

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #6 on: August 09, 2009, 06:45:53 am »
I got it!! With Autohotkey, and the command winclose MAME. Expect a release today or tomorrow :D

mh12

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 125
  • Last login:December 24, 2010, 10:03:57 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #7 on: August 09, 2009, 09:55:02 am »
would i have to map my 'random game' to Shift? or is it remappable?

now if only we could have it not affect the Most Played Games list....

just kidding. sounds great. looks like i'll be using this!

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #8 on: August 09, 2009, 12:01:43 pm »
I've just tried it in my cabinet and it works perfectly. You can even press the exit button while on a game demo, or just add coins and start playing. You don't notice that a script is working at all. I'm going to compile it and I'll include it in my MaLa Layout (http://www.alvarezeninternet.com/malalayout/). I'll come back to tell when it's online.

BTW, I've added a function which checks if the MaLa program is running. If that's not the case, for instance when you are using Windows for any other purpose, the blank screen screensaver (included in Windows) is used instead.

I have set this up for my MaLa configuration. I use the buttons in my control panel for functions such as random game, run game, exit, switch orientation, etc. Normally, no one uses a keyboard in a cabinet. However, apart from the joystick configuration, you can set up some keyboard keys in the MaLa options menu/controller/keyboard. That will not interfere with your joystick controls, and it's necessary for the script to work.

mh12

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 125
  • Last login:December 24, 2010, 10:03:57 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #9 on: August 09, 2009, 12:25:49 pm »
right on

although, are you using actual joystick controls? i have a JPAC, so my sticks and buttons are actually seen as keypresses. my 'start game' (1P start) is Enter (for compatibility with a few PC games) but a lot of people use 1. i think you will need to make the script's keypresses configurable for many people here to use it.

nice layout, by the way!

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #10 on: August 09, 2009, 12:32:36 pm »
hmmm I see. I've been reading about AutoHotKey and it seems it lacks a function for 'any key'. So, I think I could add several common keypresses for stoping the screensaver. Anyway, if you need any particular configuration, just tell me and I'll modify and compile it. I'll include the source code, moreover. It takes less than 1 minute.

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #11 on: August 09, 2009, 12:40:42 pm »
Something like this would be enough?:

Joy1:: ExitApp
Joy2:: ExitApp
Joy3:: ExitApp
Joy4:: ExitApp
Joy5:: ExitApp
Joy6:: ExitApp
Joy7:: ExitApp
Joy8:: ExitApp
Joy9:: ExitApp
Joy10:: ExitApp
Enter:: ExitApp
1:: ExitApp
5:: ExitApp
Space:: ExitApp
Tab:: ExitApp
LControl:: ExitApp
Rcontrol:: ExitApp
LAlt:: ExitApp
RAlt:: ExitApp
a:: ExitApp
s:: ExitApp
d:: ExitApp

mh12

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 125
  • Last login:December 24, 2010, 10:03:57 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #12 on: August 09, 2009, 12:55:27 pm »
looks good. so the idea is that when you start using the controls, the screensaver 'stops' and leaves the last selected game active to play?

putting out the source code sounds great. i could figure it out for my config. and it would probably help loadman a lot with implementing this in MaLa one day.

so the screensaver won't initialize when mame.exe is running, correct? what if you are running another game .exe (i notice you use Mugen), i guess you've coded it to look out for mugen.exe too? or does the screensaver know when MaLa is in its game-running mode?
« Last Edit: August 09, 2009, 01:01:54 pm by mh12 »

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #13 on: August 09, 2009, 02:30:52 pm »
Sure, as soon as you touch any joystick button, the script stops working, so you can then just let the game go on in attract mode, quit to the MaLa game menu, or start playing the game.

As far as I know, MAME doesn't let any Windows screensaver to load while it's running, so no problem with that.

hehe, actually mugen would be the only game that would stop the script from working, since the command used is Winclose MAME, and mugen is not MAME :D Since it's the only non-MAME game I have there, I'm not worried. I think it would be easy to modify that too anyway...

No problem, the code is basic, and the AutoHotKey is very easy to use, at least at this level. I'm a noob with programming and I can't even write html, so anyone can do it.  I thought about this yesterday. It is a simple need, a simple idea and a simple way to make it work.
« Last Edit: August 09, 2009, 02:32:48 pm by Stormrider »

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #14 on: August 09, 2009, 03:43:18 pm »
OK, it's uploaded. I've included in my MaLa Layout --> http://www.alvarezeninternet.com/malalayout/ Download the .zip, extract it, and just take the \random game screensaver\ folder. Delete the rest if you are no interested. I hope this works also for your layouts and your configurations. I usually do these things only for my personal use, but if you can benefit from them too, it's good to share. Anyway, if you need to do some fixes and adjustments, I'm sure they must be quite simple to do. I've included the instructions at the bottom of the file called !!READTHIS.TXT. I'll copy paste them for you here:

OPTIONAL SCREEN SAVER

In my MaLa layout I've included a very basic but practical screensaver which cycle the message in MaLa\ssaver. However, you can disable this internal screensaver (spacebar, GUI, screensaver and then disable screensaver), and use the Windows screensaver I have created with the help of AutoHotKey, an automation tool. I've included the necessary files in the folder called \random game screensaver\. What's special about this screensaver? When MaLa is idle, a random game will be launched. It will be displayed in attract mode for some minutes (hence the names of the .scr files), then MAME will quit, and a new random game will be run. The process will loop until you press any button in your control panel or some of the most usual keys in your keyboard. While a game is running, you can quit it at any moment, or start playing normally. An important advantage over other MAME screensavers is that only horizontal games will load when your monitor and layout are in horizontal orientation, and vice versa. This screensaver must be installed just as any other Windows screensaver. Copy the .scr file your wish to your \Windows\system32 folder. Right click on your desktop, and select the screensaver and the activation time. I've included a feature which launches the blank screen screensaver instead, in case MaLa is not running (for instance, when using Windows for any other purpose). For this screensaver to work, it's necessary that you configure your keyboard controls in MaLa so that right shift is set up to random game (controller, keyboard, advanced) and enter is set up for start game (controller, keyboard, basic). That should not interfere with your control panel configuration. It works perfectly for me. However, if you have any problem or need any specific configuration, don't hesitate to contact me. I'll try to modify it for you. You can also download AutoHotKey (http://www.autohotkey.com/) and alter the code yourself. The script is pretty basic. This program includes a tool for compiling, even including a custom icon. Then, all you need to do is to rename the .exe to .scr.

I'll explain the code:

#NoTrayIcon
#SingleInstance force
IfWinExist MaLa ahk_class TfrmMain ---> checks out that the MaLa program is running
{
Loop ---> infinite cycle
{
WinActivate MaLa ahk_class TfrmMain ---> not necessary really, I think...
sleep 100 ---> short pause
send {RShift} ---> random game selection
sleep 100
send {Enter} ---> MAME runs game
sleep 60000 ---> time MAME will be displaying the game (1000 = 1 second)
IfWinExist MAME ahk_class MAME
WinClose MAME ---> quit game
IfWinExist M.U.G.E.N ---> optional. Stops the script to prevent problems.
{ ---> optional
WinActivate M.U.G.E.N ---> optional
ExitApp ---> optional
} ---> optional
}
}
IfWinNotExist MaLa ahk_class TfrmMain ---> if MaLa is not loaded, the blank screen screensaver is used
run, open scrnsave.scr

Joy1:: ExitApp ---> buttons and keys that stop the script
Joy2:: ExitApp
Joy3:: ExitApp
Joy4:: ExitApp
Joy5:: ExitApp
Joy6:: ExitApp
Joy7:: ExitApp
Joy8:: ExitApp
Joy9:: ExitApp
Joy10:: ExitApp
Enter:: ExitApp
1:: ExitApp
5:: ExitApp
Space:: ExitApp
Tab:: ExitApp
LControl:: ExitApp
Rcontrol:: ExitApp
LAlt:: ExitApp
RAlt:: ExitApp
a:: ExitApp
s:: ExitApp
d:: ExitApp
ESC:: ExitApp

« Last Edit: August 10, 2009, 03:37:57 am by Stormrider »

TheShanMan

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1911
  • Last login:October 16, 2023, 03:35:12 pm
    • My Arcade (updated 1/30/13)
My Collection: Mame cab, 38 dedicated vids, pin, skeeball, coin op air hockey table, Ice Cold Beer, Megatouch, 2 token machines, and payphone (VAPS, pics at Arcade Crusade)

Add Ambience to your mame cab setup

ivwshane

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1036
  • Last login:December 24, 2022, 09:35:21 pm
    • My first mame cab! (WIP)
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #16 on: August 10, 2009, 02:22:03 am »
An actual screensaver that can run random mame games is this: http://www.google.com/url?sa=t&source=web&ct=res&cd=1&url=http%3A%2F%2Fhome.comcast.net%2F~tacobirds%2F&ei=5ix_Srb_CYLCsQPrwIXvCg&usg=AFQjCNFZvv3Rq0HdRdRpTkZ5srZzbLPP-w&sig2=TmZBpi1T32_lneLDQGBGbw. I use it on my mame cab and love it.

Wow! That seems exactly what everyone is asking for is it not? I guess we just need a way to integrate it into mala.



Either way it sounds cool to me!
« Last Edit: August 10, 2009, 02:26:49 am by ivwshane »

mh12

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 125
  • Last login:December 24, 2010, 10:03:57 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #17 on: August 10, 2009, 03:04:19 am »
um....  :)


good work, stormrider! thank you

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #18 on: August 10, 2009, 04:01:29 am »
I already tried that screensaver you have linked. It will be fine if you have a cabinet with just horizontal games, or just vertical games or if you play vertical games rotated on a horizontal monitor. If you have different gamelists for verticals and horizontals, then this must be dont from the frontend itself. The screensaver cannot guess your monitor orientation. That was the problem I noticed.

BTW, I've updated the code, as you can see, so that if the 'rom' called mugen is loaded, the script is canceled. Mugen doesn't let me close it from the script, and it will be a mess to try to quit it with keystrokes, so it's better this way. If you have any other games or programs in the MaLa gamelist, you can add them to the code too. There's a tool in Autohotkey called Window Spy, which tells you the internal name of any window.

Fordman

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 389
  • Last login:September 12, 2021, 11:20:27 am
  • MADE in the USA
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #19 on: August 10, 2009, 11:45:16 pm »
Having a random game play for the screensaver is why I dont use Maximus Arcade anymore.

Gets really annoying after a while! The sound of the game in the attract mode can be really really monotonous and if you dont want to play that game, you then have to exit the game then go back to Maximus to select another. So now I use MALA I just looks at my snaps when I pass by the cab.

 :cheers:

Fordman!

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #20 on: August 11, 2009, 02:22:21 am »
I suppose there's a command in AutoHotKey for muting or reducing to the minimum the soundcard volume.

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #21 on: August 11, 2009, 02:25:44 am »
Send {Volume_Mute}  ; Mute/unmute the master volume.

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #22 on: August 11, 2009, 01:02:48 pm »
I have almost finished a version with better code (I'm learning a little) and auto-mute when the screensaver is running.

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #23 on: August 12, 2009, 07:06:15 am »
I have not been able to do the sound muted version yet, but I have improved the code and I've corrected some minor bugs. For instance, now when you insert coin or press a button or any of the keys that cancels the script, you don't have to press it again. Therefore, now as soon as you insert coin or leave the game, the script, not only quits, but the keypress is correctly registered the first time. I have also fixed the part of the script which loads the blank screen when MaLa is not running. In the previous version, the script remained active, so the screensaver only worked once until you cancel the script with a key. This is the new code. The files in my web are already updated.

#NoTrayIcon

IfWinExist MaLa ahk_class TfrmMain ; checks out that the MaLa program is running
goto mala
else
goto nomala

mala:
Loop ; infinite cycle
{
WinActivate MaLa ahk_class TfrmMain ; not necessary really, I think...
sleep 100 ; very short pause
send {RShift} ; random game selection
sleep 100
send {Enter} ; MAME runs game
sleep 120000 ; time MAME will be displaying the game (1000 = 1 second)
IfWinExist MAME ahk_class MAME
WinClose MAME ; quit game
IfWinExist M.U.G.E.N ; optional. Exceptionally, quits to MaLa after demo and stops the script.
goto mugen
}

mugen:
sleep 20
sleep 60000
IfWinExist M.U.G.E.N
send {Esc}
sleep 40
IfWinExist M.U.G.E.N
send {Esc}
ExitApp

~Joy1:: ; buttons and keys that stop the script
~Joy2::
~Joy3::
~Joy4::
~Joy5::
~Joy6::
~Joy7::
~Joy8::
~Joy9::
~Joy10::
~1::
~5::
~Space::
~Tab::
~LControl::
~Rcontrol::
~LAlt::
~RAlt::
~a::
~s::
~d::
~ESC::
~Enter::
~Lbutton::
ExitApp

nomala: ; if MaLa is not loaded, the blank screen screensaver is used (cancelled by moving the mouse)
run scrnsave.scr /s
settimer, close, 2000000
mousegetpos, x, y
cx = %x%
cy = %y%
close:
mousegetpos, x, y
if (x!=cx or y!=cy)
ExitApp
« Last Edit: August 13, 2009, 06:38:53 am by Stormrider »

TheShanMan

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1911
  • Last login:October 16, 2023, 03:35:12 pm
    • My Arcade (updated 1/30/13)
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #24 on: August 12, 2009, 02:16:28 pm »
I already tried that screensaver you have linked. It will be fine if you have a cabinet with just horizontal games, or just vertical games or if you play vertical games rotated on a horizontal monitor. If you have different gamelists for verticals and horizontals, then this must be dont from the frontend itself. The screensaver cannot guess your monitor orientation. That was the problem I noticed.

If you're referring to the link I gave, it doesn't need to guess. You can tell it which roms to pick from. You can also have it mute the sound card while active.

I also wrote a little command line tool for exporting mala game lists into the file format for this screensaver.
« Last Edit: August 12, 2009, 02:19:51 pm by TheShanMan »
My Collection: Mame cab, 38 dedicated vids, pin, skeeball, coin op air hockey table, Ice Cold Beer, Megatouch, 2 token machines, and payphone (VAPS, pics at Arcade Crusade)

Add Ambience to your mame cab setup

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #25 on: August 12, 2009, 05:05:28 pm »
TheShanMan: ok, consider this situation. I have my monitor in horizontal mode. My layout is also horizontal and the associated gamelist contains horizontal games. With my script, when the screensaver runs, it will only launch horizontal games. Now, I decide I feel like playing some verticals, so I rotate my screen. I press one button in my control panel and voila, my MaLa layout is vertical, and the associated game list contains only vertical games. My screensaver will launch vertical games now. You simply cannot do this with the TB screensaver, because it's not linked to your layout.

Fordman: the idea is not a screensaver that runs a random game and leave it on screen forever. My script loads a game and after one, two... minutes, quits and runs another one and so on, until you press any key or button.
« Last Edit: August 12, 2009, 05:08:36 pm by Stormrider »

mh12

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 125
  • Last login:December 24, 2010, 10:03:57 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #26 on: August 13, 2009, 09:19:05 am »
this is the best feature request thread i've ever seen. great work,  Stormrider. nice and small and simple.

i had to download your layout to get it.. which i didn't end up using cos it's all low-res? and the instructions are about setting up MaLa from scratch. have you considered a version for people who already have MaLa configured the way they want it?

TheShanMan

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1911
  • Last login:October 16, 2023, 03:35:12 pm
    • My Arcade (updated 1/30/13)
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #27 on: August 13, 2009, 01:08:46 pm »
You could have TB_Screensaver adjust if you can have MaLa run an external app, by writing a batch file to do it. Not sure if there's a way to get MaLa to do it.
My Collection: Mame cab, 38 dedicated vids, pin, skeeball, coin op air hockey table, Ice Cold Beer, Megatouch, 2 token machines, and payphone (VAPS, pics at Arcade Crusade)

Add Ambience to your mame cab setup

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #28 on: August 13, 2009, 04:15:22 pm »
mh12: I suppose this screensaver script should work with all mala layouts for MAME games with the only requirements of having the shift key assigned to random game and enter to run game.

mh12

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 125
  • Last login:December 24, 2010, 10:03:57 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #29 on: August 13, 2009, 06:45:11 pm »
mh12: I suppose this screensaver script should work with all mala layouts for MAME games with the only requirements of having the shift key assigned to random game and enter to run game.

yup.. i never changed layouts. just saying i wanted to try yours but it didn't work out well since i'm using 640x480.. and the instructions are all about changing your mala.ini and all that

cheers

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #30 on: August 14, 2009, 04:30:28 am »
Sorry, maybe you didn't understand it well. The screensaver is included in the zip that contains the layout, but it can be totally independent. The instructions explain how to install the layout and also how to install the screensaver, apart from other issues. Ignore all that part if you don't like my layout, and just read the part entitled: OPTIONAL SCREEN SAVER (RANDOM GAMES)

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #31 on: August 14, 2009, 06:56:16 am »
I've found an important problem, which I don't know if it can be fixed. Using joy up and down to scroll the game list doesn't interrupt the screentimer timer for activation, unlike using any keyboard key, or even any joystick button. I think this depends on how windows handle screensavers. I'll investigate hot to fix this.

mh12

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 125
  • Last login:December 24, 2010, 10:03:57 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #32 on: August 14, 2009, 10:59:27 am »
Sorry, maybe you didn't understand it well. The screensaver is included in the zip that contains the layout, but it can be totally independent. The instructions explain how to install the layout and also how to install the screensaver, apart from other issues. Ignore all that part if you don't like my layout, and just read the part entitled: OPTIONAL SCREEN SAVER (RANDOM GAMES)

ok.. that's exactly what i did :)
i did want to TRY your layout but it didn't go well. no matter. i'm going to make my own sometime.
cheers

TheShanMan

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1911
  • Last login:October 16, 2023, 03:35:12 pm
    • My Arcade (updated 1/30/13)
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #33 on: August 14, 2009, 07:33:29 pm »
The Windows screensaver functionality doesn't pay attention to joystick devices. An individual screensaver could watch for joystick movement and kill itself if detected, but I think you'd have to find a hack to have joystick movement prevent the screensaver from starting.
My Collection: Mame cab, 38 dedicated vids, pin, skeeball, coin op air hockey table, Ice Cold Beer, Megatouch, 2 token machines, and payphone (VAPS, pics at Arcade Crusade)

Add Ambience to your mame cab setup

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #34 on: August 15, 2009, 02:10:34 am »
It seems that the screensaver pays attention to the controls that have been defined in the script. For instance, I have defined all joystick buttons and some keys as hotkeys in the script, with the function of cancelling the script. If you press any of those before the activation, the countdown is restarted. The problem is that joystick axes cannot be defined as hotkeys. However, thans to the guys in the AutoHotKey forums (they are really amazing!), I have the piece of code to fix this. If you pay attention to the countdown: section, what it does is to add one minute in which joystic axes are being listened to. If they are activated during that minute, the script is canceled. The only thing you will notice is that if you set up the screensaver activation time in windows to 3 minutes, it will actually take 4 minutes. In the third minute, the screensaver will be run, but nothing will happen until minute four, when a game will be run (unless you use any of your controls, which restart the activation time). I'll update the files in a while.

#NoTrayIcon

IfWinExist MaLa ahk_class TfrmMain
goto countdown
else
goto nomala

#Persistent
countdown:
WinActivate MaLa ahk_class TfrmMain
SetTimer, WatchAxis, 50
BeginTime := A_TickCount
WatchAxis:
GetKeyState, JoyX, JoyX
GetKeyState, JoyY, JoyY

if JoyX > 70
ExitApp
else if JoyX < 30
ExitApp
else if JoyY > 70
ExitApp
else if JoyY < 30
ExitApp

If (A_TickCount - BeginTime) > 60000
{
SetTimer, WatchAxis, off
SetTimer, mala, -1
}

return

mala:
Loop, 15
{
WinActivate MaLa ahk_class TfrmMain
sleep 800
send {RShift}
sleep 200
send {Enter}
sleep 120000
IfWinExist MAME ahk_class MAME
WinClose MAME
IfWinExist M.U.G.E.N
goto mugen
}

mugen:
sleep 20
sleep 60000
IfWinExist M.U.G.E.N
send {Esc}
sleep 40
IfWinExist M.U.G.E.N
send {Esc}
ExitApp



~Joy1::
~Joy2::
~Joy3::
~Joy4::
~Joy5::
~Joy6::
~Joy7::
~Joy8::
~Joy9::
~Joy10::
~1::
~5::
~Space::
~Tab::
~LControl::
~Rcontrol::
~LAlt::
~RAlt::
~a::
~s::
~d::
~ESC::
~Enter::
~Lbutton::
~Up::
ExitApp

nomala:
run scrnsave.scr /s
settimer, close, 2000000
mousegetpos, x, y
cx = %x%
cy = %y%
close:
mousegetpos, x, y
if (x!=cx or y!=cy)
ExitApp
« Last Edit: August 15, 2009, 03:27:23 am by Stormrider »

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Wouldn't this be COOL?: random games run as screensaver
« Reply #35 on: November 04, 2009, 08:13:19 am »
I have modified the screensaver to make it simpler and more reliable. The problem lies in the fact that the joystick axes do not stop the activation, and you cannot use them for hotkeys that send a keystroke. In the previous version I solved this with a process that detected joystick axes movement every 50 ms. This happened during 2 minutes just after the screensaver activation. Now I've changed that to something more sensible and with better functionality. When the screensaver runs, the script code reads selection.ini. Then it sleeps for 2 minutes. When that time is over, it reads again the file and compare the variables for the selected horizontal and vertical game. If they are the same, the random game selection and execution is run. If not, the script is cancelled. So, if we define an activation time of 3 minutes in Windows, pressing a key or button during that time prevents the activation of the screensaver. If we have not pressed any key or button, and even if we have used out stick to move thorugh the game list, the screensaver is run, but we don't notice anything at all. In two minutes then, it will test that we have not changed the selected game. If we have, the true activation is not launched and everything resets. Like in the previous version, the only drawback is that, depending on what we do, the real activation time can vary one minute or so.

#NoTrayIcon

IfWinActive MaLa ahk_class TfrmMain
goto countdown
else
goto nomala
return

#Persistent
countdown:
IniRead, h1, d:\mala\selection.ini, mame_hors, Game
IniRead, v1, d:\mala\selection.ini, mame_verts, Game
sleep 120000
IniRead, h2, d:\mala\selection.ini, mame_hors, Game
IniRead, v2, d:\mala\selection.ini, mame_verts, Game
if (h1 = h2) and (v1 = v2)
goto mala
else
Exitapp
return

mala:
Loop, 15
{
WinActivate MaLa ahk_class TfrmMain
sleep 800
send {RShift}
sleep 200
send {Enter}
sleep 120000
IfWinExist ahk_class MAME
WinKill MAME
IfWinExist M.U.G.E.N
goto mugen
}

mugen:
sleep 20
sleep 60000
IfWinExist M.U.G.E.N
send {Esc}
sleep 40
IfWinExist M.U.G.E.N
send {Esc}
ExitApp

nomala:
run scrnsave.scr /s
settimer, close, 2000000
mousegetpos, x, y
cx = %x%
cy = %y%
close:
mousegetpos, x, y
if (x!=cx or y!=cy)
ExitApp

~Joy1::
~Joy2::
~Joy3::
~Joy4::
~Joy5::
~Joy6::
~Joy7::
~Joy8::
~Joy9::
~Joy10::
~1::
~3::
~5::
~Space::
~Tab::
~LControl::
~Rcontrol::
~LAlt::
~RAlt::
~a::
~s::
~d::
~ESC::
~Enter::
~Lbutton::
~Del::
~Lshift::
~Rshift::
~Ins::
ExitApp