Author Topic: Running AM in a cabinet shutting down the mains.  (Read 273 times)

SpoonyAllen

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Running AM in a cabinet shutting down the mains.
« on: February 09, 2021, 10:19:31 AM »
I've been having a myriad of issues with a new build running AM but I've slowly widdled things down to one big issue.

I have AM configured and set to load at startup.
I have it set to load the last game that was played.
I had an issue with videos running in one theme. swtiched to verticools and the issues stopped

But i still have this:
About every dozen or so bootups AM crashes. Most of the time it will crash with a white background. nothing comes up in the AM logs. It will not load mame or the last game run. Sometimes it will magically start up again if i select attract mode manually via a mouse. sometimes it will boot if i load the console version of AM. Other times it requires me to use a backup of attract.cfg in order to get it back up and running (looking at the 'corrupted' cfg doesn't show anything out of the ordinary)

I do have this mame cab loading up following AC power loss so it can boot together with all of the other cabinets in my arcade. I'm starting to think shutting down the PC via the power mains is the culprit here, possibly causing some kind of corruption somewhere. Has anyone else had a similar issue? any work-around for this?

hermine.potter

  • Hero Member
  • *****
  • Posts: 628
    • View Profile
Re: Running AM in a cabinet shutting down the mains.
« Reply #1 on: February 09, 2021, 10:44:05 PM »
-Which OS do you use?

-Which version of AM do you use?

-how do you shutdown your computer?
shut down dialouge of OS?
pressing power button of computer?
attractmode internal command?
simple electricity switch (hard power off)?

-what kind of harddisk drive do you use?
SSD or classic HDD?
« Last Edit: February 09, 2021, 10:46:52 PM by hermine.potter »
AM Version : 2.6.1
Input : Mad Catz Brawlstick; Mouse; Keyboard; Xbox360 Wireless
Cabinet : Yes
OS : Windows10 Pro
System : Dell Precision T3500 ; Intel X5650 ; 12GB RAM

mahuti

  • Administrator
  • Sr. Member
  • *****
  • Posts: 240
    • View Profile
    • Github Repositories
Re: Running AM in a cabinet shutting down the mains.
« Reply #2 on: February 10, 2021, 01:48:32 AM »
This isn't an AM solution, but a general one I use to prevent corruption.  Lately I use a relay timer switch to help with this. When I hit a switch, it sends a power-off command to the pc, and the relay timer is triggered. After a set amount of time the main power is shut down to the cabinet and the pc... but the pc should have had time to power down gracefully already.

 That won't help if you're just flipping a switch for everything all at once. The only option in that case would be adding a battery backup with a USB connection to your PC. A decent backup unit usually integrates with graceful power-down software to shut the PC down when the backup gets triggered.

Hard-powering down any PC that isn't built for it can generate problems.
« Last Edit: February 10, 2021, 01:50:49 AM by mahuti »

SpoonyAllen

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Re: Running AM in a cabinet shutting down the mains.
« Reply #3 on: February 10, 2021, 10:40:18 AM »
-Which OS do you use?

-Which version of AM do you use?

-how do you shutdown your computer?
shut down dialouge of OS?
pressing power button of computer?
attractmode internal command?
simple electricity switch (hard power off)?

-what kind of harddisk drive do you use?
SSD or classic HDD?

sorry, should have added more details

win7 x64
Version 2.6.1
just shutting the power off using a mains kill switch. PC boots up using the recover from power loss option in the bios
runs an SSD

This isn't an AM solution, but a general one I use to prevent corruption.  Lately I use a relay timer switch to help with this. When I hit a switch, it sends a power-off command to the pc, and the relay timer is triggered. After a set amount of time the main power is shut down to the cabinet and the pc... but the pc should have had time to power down gracefully already.

 That won't help if you're just flipping a switch for everything all at once. The only option in that case would be adding a battery backup with a USB connection to your PC. A decent backup unit usually integrates with graceful power-down software to shut the PC down when the backup gets triggered.

Hard-powering down any PC that isn't built for it can generate problems.

I've made multiple mame cabs with zero issues shutting off mains as long as you make adjustments to windows. The reason i chose attract mode is because its the only UI that allows you to automatically load a game at startup.

I have boiled the issue down to the load last game at startup feature which is controlled by the attract.am file. I read another thread where someone was having issues with that. they were encouraged to set a delay in loading attract mode at startup. I tried that but once again after about 5 or so bootups, attract mode crashes again. When i do restart attract mode manually using a mouse, AM launches the first game on the list (005).

hermine.potter

  • Hero Member
  • *****
  • Posts: 628
    • View Profile
Re: Running AM in a cabinet shutting down the mains.
« Reply #4 on: February 10, 2021, 01:05:32 PM »
@ SpoonyAllen

=SSD:
SSD is ok => so there don't exist problems like headcrash on power loss and so on

=immediate power loss:
because files are in use, that could bring data loss and data damages as result.

use a correct shutdown sequence:
-set in windows power settings : if power button is pressed, shutdown windows.
extend computer power button reachable in cabinet, so you can press it.

-set shutdown command in AM:
start AM > press TAB key > General > Exit Command : shutdown -s -f -t 01
if you exit AM via dialogue, windows and computer shutdown too

then use electric power switch

-issue with attract.am:
use correct shutdown sequence (see above)

or

delete content of file attract.am > enable write protection > now AM starts always the first game of first display

or

choose a specific game, that always should start > delete all other content of file attract.am > enable write protection > now AM starts always with this specific game
AM Version : 2.6.1
Input : Mad Catz Brawlstick; Mouse; Keyboard; Xbox360 Wireless
Cabinet : Yes
OS : Windows10 Pro
System : Dell Precision T3500 ; Intel X5650 ; 12GB RAM

mahuti

  • Administrator
  • Sr. Member
  • *****
  • Posts: 240
    • View Profile
    • Github Repositories
Re: Running AM in a cabinet shutting down the mains.
« Reply #5 on: February 10, 2021, 04:17:13 PM »
Quote
I've made multiple mame cabs with zero issues shutting off mains as long as you make adjustments to windows     

You don't have to convince me.  ;D You might need to convince your current setup that it's not supposed to have issues though. In any case, I'm rooting for it and you!

SpoonyAllen

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Re: Running AM in a cabinet shutting down the mains.
« Reply #6 on: February 10, 2021, 06:30:46 PM »
@ SpoonyAllen

=SSD:
SSD is ok => so there don't exist problems like headcrash on power loss and so on

=immediate power loss:
because files are in use, that could bring data loss and data damages as result.

use a correct shutdown sequence:
-set in windows power settings : if power button is pressed, shutdown windows.
extend computer power button reachable in cabinet, so you can press it.

-set shutdown command in AM:
start AM > press TAB key > General > Exit Command : shutdown -s -f -t 01
if you exit AM via dialogue, windows and computer shutdown too

then use electric power switch

-issue with attract.am:
use correct shutdown sequence (see above)

or

delete content of file attract.am > enable write protection > now AM starts always the first game of first display

or

choose a specific game, that always should start > delete all other content of file attract.am > enable write protection > now AM starts always with this specific game

As i mentioned, i can't use a script for a shutdown sequence. I need to rely on the bios to turn the PC on once mains power is restored.  If i shut down the PC using any traditional method, be it shutting down via the start menu or through a script then there's no way i can turn the PC back on in its current state and configuration inside of the cabinet. Not to sound like an ass or singling out anyone but not being able to use this feature properly basically negates the need to even use attract mode for me.

I think what's happening between these dozen or so boots is that Attract.AM is either being written or being prepared to be written just as i shut down power. I've even tried to properly exit a game, wait a few seconds and kill mains power at the menu, i still get this attract.am crash about every 10 startups. It seems the file persistence read of the file is not on a strict, regular interval.

I've done some experimentation with this. What i did was i opened windows explorer and set it to sort files by which ones were modified first. I launched a new game and i notice attract.am is being modified anywhere between 50 seconds to 2 minutes between launching a new game and following the exit of a game. If "launch_last_game" setting is enabled, shouldn't attract.am only be written to immediately following the launch of a game only and be left alone by attract mode following that?

edit: this issue was already discussed on the github
https://github.com/mickelson/attract/issues/608
« Last Edit: February 10, 2021, 06:51:25 PM by SpoonyAllen »

progets

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1139
    • View Profile
Re: Running AM in a cabinet shutting down the mains.
« Reply #7 on: February 10, 2021, 08:50:42 PM »
As i mentioned, i can't use a script for a shutdown sequence. I need to rely on the bios to turn the PC on once mains power is restored.  If i shut down the PC using any traditional method, be it shutting down via the start menu or through a script then there's no way i can turn the PC back on in its current state and configuration inside of the cabinet. Not to sound like an ass or singling out anyone but not being able to use this feature properly basically negates the need to even use attract mode for me.

This isn't accurate. If the BIOS is set to boot when power is restored, it doesn't matter how the computer was shutdown as long as the power is removed and then reapplied. If the BIOS is set to return power to previous operation, then it won't boot if it was shutdown properly before the power loss. Check your BIOS setting and make sure you're using the correct option.

Other tips include...
- Making the attract.am and/or attract.cfg read only or run a script to replace the attract.am and/or attract.cfg on boot with a good copy.
- Schedule a proper timed shutdown and then the BIOS to boot when power is lost and restored
- Use another computer on the network to issue the shutdown, then use another computer on the network to boot the machine using a "magic packet" over ethernet on boot.
- Create a read only OS via HD, SSD, USB, CD, DVD, etc. that will always remain static.
- Use a different OS that is more flexible for you needs.
- Plug the machine into a different outlet and run it 24/7. If this costs too much consider a $40 Raspberry Pi and you'll be saving money on less power use in the first year or two versus your Windows machine. A Pi uses less than $5 a year (on 24/7) and your old PC likely uses ten times more than that.
- Instead of booting AM, boot a script that just runs the game you want and then runs AM when you exit the game.
Example of script
Code: [Select]
C:\MAME\mame.exe pacman
C:\AttractMode\attract.exe -c C:\AttractMode

I think there are many options to overcome your issue but you need to be creative and look beyond attract-mode only solutions. Pulling the power cord on a computer isn't best practice for any computer that runs an OS that isn't designed to do so.
« Last Edit: February 11, 2021, 12:19:41 AM by progets »