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: Saving Mame high scores while in the rom  (Read 9100 times)

0 Members and 1 Guest are viewing this topic.

processedmeat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 253
  • Last login:July 08, 2025, 12:30:14 pm
  • Ikeakade Here I come!
Saving Mame high scores while in the rom
« on: February 11, 2019, 02:57:23 pm »
Hi all, I'm building a 720 mame cab that uses a Windows 7 embedded PC build to boot directly into the 720 rom.  This setup allows me to safely hard power off the PC like a real arcade cab would.  The problem I'm encountering is that since Mame saves the high scores on exit when using the hiscore plugin, my cab won't save any high scores when I power off the cab while "inside" the 720 rom.  And since this is a single rom cab, I'll never exit mame and go back to the frontend, thereby saving the high score.

Any ideas?

I've tried enabling the autosave but it seems that it works the same way as the high score as it saves on exit.

I'm definitely no programmer by means but looking at the init.lua, I wonder if I need to alter something in this section to get it write to the high score file every 5 minutes or so?

Code: [Select]
local last_write_time = -10;
local function tick ()
  -- set up scores if they have been
  init();
  -- only allow save check to run when
  if mem_check_passed and timed_save then
-- The reason for this complicated mess is that
-- MAME does expose a hook for "exit". Once it does,
-- this should obviously just be done when the emulator
-- shuts down (or reboots).
local checksum = check_scores( positions );
if checksum ~= current_checksum and checksum ~= default_checksum then
  -- 5 sec grace time so we don't clobber io and cause
  -- latency. This would be bad as it would only ever happen
  -- to players currently reaching a new highscore
  if emu.time() > last_write_time + 5 then
write_scores( positions );
current_checksum = checksum;
last_write_time = emu.time();
-- emu.print_verbose( "SAVE SCORES EVENT!", last_write_time );
  end
end
  end
end


meyer980

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 387
  • Last login:July 06, 2025, 01:18:25 pm
  • Building fun things for fun
    • sergiostuff.com/2020/04/15/felix-son-arcade-game/
    • Sergio Stuff
Re: Saving Mame high scores while in the rom
« Reply #1 on: February 11, 2019, 03:09:22 pm »
I'm curious how you're currently shutting down? Are you just pulling the power plug? That doesn't seem like a good idea with any pc...

If you are using a frontend of SOME sort, even if you never need to see it, you could add a shutdown command to that frontend. That way when you exit the game, it would immediately shut the computer down.

Drnick

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1642
  • Last login:June 21, 2024, 03:32:31 pm
  • Plodding Through Life
Re: Saving Mame high scores while in the rom
« Reply #2 on: February 11, 2019, 03:54:29 pm »
I would recommend installing and setting up a single button that when pressed runs a shutdown script.  You want it to exit the game, then exit mame, then issue an immediate shutdown.  Windows embedded is forgiving but we have over 500 Dell TC with it installed at work, They all have write filter enabled, 2 of those 500+ failed after a recent power cut.  A rebuild resolved their issue, but that sounds like odds of around 250 to 1 on something going wrong.  Those are short odds if you pull the power every day :)

Mr. Peabody

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 813
  • Last login:March 05, 2025, 05:44:10 pm
Re: Saving Mame high scores while in the rom
« Reply #3 on: February 11, 2019, 04:01:30 pm »
Front ends typically have a shutdown function when exiting, as well as pre and post command sections, so exiting the game should be miniscule.

You also could have the fe background a 720 snap or the like. Exit the game and then exit the front end .
« Last Edit: February 11, 2019, 04:05:43 pm by Mr. Peabody »

processedmeat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 253
  • Last login:July 08, 2025, 12:30:14 pm
  • Ikeakade Here I come!
Re: Saving Mame high scores while in the rom
« Reply #4 on: February 11, 2019, 04:34:01 pm »
I'm curious how you're currently shutting down? Are you just pulling the power plug? That doesn't seem like a good idea with any pc...

If you are using a frontend of SOME sort, even if you never need to see it, you could add a shutdown command to that frontend. That way when you exit the game, it would immediately shut the computer down.

I'm using a Windows 7 Embedded image that was uploaded to ukvac forums by a guy named Chunskin.   Using embedded he is able to make it load into memory only to protect the Windows install from corruption and I also put it on a SSD, removed write catching, and so far so good in my other builds that utilize a frontend.

processedmeat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 253
  • Last login:July 08, 2025, 12:30:14 pm
  • Ikeakade Here I come!
Re: Saving Mame high scores while in the rom
« Reply #5 on: February 11, 2019, 04:38:37 pm »
I would recommend installing and setting up a single button that when pressed runs a shutdown script.  You want it to exit the game, then exit mame, then issue an immediate shutdown.  Windows embedded is forgiving but we have over 500 Dell TC with it installed at work, They all have write filter enabled, 2 of those 500+ failed after a recent power cut.  A rebuild resolved their issue, but that sounds like odds of around 250 to 1 on something going wrong.  Those are short odds if you pull the power every day :)

Just wondering if your Dells are using SSDs instead of a mechanical hard drive?  All my mame cabs are using them and they seem more forgiving when it comes to corruption on power cut. 

processedmeat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 253
  • Last login:July 08, 2025, 12:30:14 pm
  • Ikeakade Here I come!
Re: Saving Mame high scores while in the rom
« Reply #6 on: February 11, 2019, 04:41:00 pm »
Front ends typically have a shutdown function when exiting, as well as pre and post command sections, so exiting the game should be miniscule.

You also could have the fe background a 720 snap or the like. Exit the game and then exit the front end .

I have my whole arcade controlled by Alexa and I really like just being able to power on or off the entire arcade on command.

Just wanted to see if there was another way to tackle this. 

Thanks for the reply.

ark_ader

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5645
  • Last login:March 02, 2019, 07:35:34 pm
  • I glow in the dark.
Re: Saving Mame high scores while in the rom
« Reply #7 on: February 11, 2019, 10:58:05 pm »
I'm curious how you're currently shutting down? Are you just pulling the power plug? That doesn't seem like a good idea with any pc...

If you are using a frontend of SOME sort, even if you never need to see it, you could add a shutdown command to that frontend. That way when you exit the game, it would immediately shut the computer down.

I'm using a Windows 7 Embedded image that was uploaded to ukvac forums by a guy named Chunskin.   Using embedded he is able to make it load into memory only to protect the Windows install from corruption and I also put it on a SSD, removed write catching, and so far so good in my other builds that utilize a frontend.

Did you purchase a license for the windows 7 embedded?
If I had only one wish, it would be for three more wishes.

big10p

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 698
  • Last login:May 01, 2023, 01:46:23 pm
  • Mmmm, arcade classics!
Re: Saving Mame high scores while in the rom
« Reply #8 on: February 12, 2019, 04:24:58 am »
I'm curious how you're currently shutting down? Are you just pulling the power plug? That doesn't seem like a good idea with any pc...

If you are using a frontend of SOME sort, even if you never need to see it, you could add a shutdown command to that frontend. That way when you exit the game, it would immediately shut the computer down.

I'm using a Windows 7 Embedded image that was uploaded to ukvac forums by a guy named Chunskin.   Using embedded he is able to make it load into memory only to protect the Windows install from corruption and I also put it on a SSD, removed write catching, and so far so good in my other builds that utilize a frontend.

Did you purchase a license for the windows 7 embedded?
Yes, yes he did. I bought it for him. Handed the cash to Bill myself. Now jog on.

newmanfamilyvlogs

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1694
  • Last login:June 15, 2022, 05:20:38 pm
    • forum.arcadecontrols.com/index.php/topic,103584.msg1096585.html#msg1096585
    • Newman Family Vlogs
Re: Saving Mame high scores while in the rom
« Reply #9 on: February 12, 2019, 09:22:10 am »

I have my whole arcade controlled by Alexa and I really like just being able to power on or off the entire arcade on command.


I had never considered tying a cabinet into Alexa... I know this project is specifically for a single game cabinet, but a front-end plugin that accepts MQTT messages from a NodeRED (https://nodered.org/docs/getting-started/running) installation would mean on a traditional mame machine you could have your short-list in the FE, but when a guest asks about some particular game, you could ask Alexa to open it on the cabinet without searching through long lists. To me that would make having thousands of games set up more reasonable.

ark_ader

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5645
  • Last login:March 02, 2019, 07:35:34 pm
  • I glow in the dark.
Re: Saving Mame high scores while in the rom
« Reply #10 on: February 12, 2019, 11:20:40 am »
I'm curious how you're currently shutting down? Are you just pulling the power plug? That doesn't seem like a good idea with any pc...

If you are using a frontend of SOME sort, even if you never need to see it, you could add a shutdown command to that frontend. That way when you exit the game, it would immediately shut the computer down.
I'm using a Windows 7 Embedded image that was uploaded to ukvac forums by a guy named Chunskin.   Using embedded he is able to make it load into memory only to protect the Windows install from corruption and I also put it on a SSD, removed write catching, and so far so good in my other builds that utilize a frontend.

Did you purchase a license for the windows 7 embedded?
Yes, yes he did. I bought it for him. Handed the cash to Bill myself. Now jog on.

The reason why I asked that, as there has been some available nlighted builds of Windows 7 and XP that contains some nasty malware.  Just because it is up there, doesn't mean it is free from software designed to compromise your firewall from behind. 

The ability to have MITM attack is not good.  I work in computer security, and we have seen plenty of examples where personal information is being sent into the dark web via well intentioned downloadable software from the internet.  Why would one do this is a good question, when there are plenty of alternatives that are free that loads OS into memory and have the data saved into a file.  Linux does this very well and it is free.

I have bought a bunch of thin clients off ebay for a replacement to the Raspi for my lack builds, all running windows 7 embedded.  I wipe them and stick Puppy Arcade 10 on them. All run on 256mb of ram (in memory) with 100mb install size.  You can power off those without worry to the filing system and the high score data is saved on the 2 gb SSD in a single file. 


I have my whole arcade controlled by Alexa and I really like just being able to power on or off the entire arcade on command.


I had never considered tying a cabinet into Alexa... I know this project is specifically for a single game cabinet, but a front-end plugin that accepts MQTT messages from a NodeRED (https://nodered.org/docs/getting-started/running) installation would mean on a traditional mame machine you could have your short-list in the FE, but when a guest asks about some particular game, you could ask Alexa to open it on the cabinet without searching through long lists. To me that would make having thousands of games set up more reasonable.

I remote power the 1Up but I run a shutdown script into it first to power it down, then tell alexa to power it down.  I got some Merkury smart plugs for $10 at wallyworld.  I'm not a fan of plug pulling on the pi.  I'm curious on this project  for the front end.  I bought several echos over the Christmas sales.  That would be cool to figure that out for my five games.  Does that work for the fire tablets?
If I had only one wish, it would be for three more wishes.

tscottn

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 25
  • Last login:January 07, 2022, 02:18:13 pm
  • I want to build my own arcade controls!
Re: Saving Mame high scores while in the rom
« Reply #11 on: February 12, 2019, 11:27:59 am »

Did you purchase a license for the windows 7 embedded?
[/quote]

haha  that seems like a funny thing to say considering this forum ...
« Last Edit: February 12, 2019, 11:29:32 am by tscottn »

newmanfamilyvlogs

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1694
  • Last login:June 15, 2022, 05:20:38 pm
    • forum.arcadecontrols.com/index.php/topic,103584.msg1096585.html#msg1096585
    • Newman Family Vlogs
Re: Saving Mame high scores while in the rom
« Reply #12 on: February 12, 2019, 11:58:04 am »
I remote power the 1Up but I run a shutdown script into it first to power it down, then tell alexa to power it down.  I got some Merkury smart plugs for $10 at wallyworld.  I'm not a fan of plug pulling on the pi.  I'm curious on this project  for the front end.  I bought several echos over the Christmas sales.  That would be cool to figure that out for my five games.  Does that work for the fire tablets?

My experimenting with NodeRED hasn't gone much beyond cursory experimentation, but it's an interesting development environment. You design 'flows' consisting of various input, control, and output nodes. One of the simplest Alexa Integration nodes emulates a Phillips Hue bulb (so you don't need additional skills enabled on Alexa, and everything stays local to your network). The limitation there however is that it's limited on 'on/off/dim' commands.

https://flows.nodered.org/node/node-red-contrib-alexa-local

This is a discussion for a new thread at this point, which I've started here:
http://forum.arcadecontrols.com/index.php/topic,159565.0.html

Drnick

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1642
  • Last login:June 21, 2024, 03:32:31 pm
  • Plodding Through Life
Re: Saving Mame high scores while in the rom
« Reply #13 on: February 12, 2019, 02:54:46 pm »
Yeah, all the TC's use SSD, well it's more like an M2 flash drive but definitely not mechanical.  Nice to hear you have mame up and running on WE7, I may even have a look see at that image as I have a couple of TC's spare :)

processedmeat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 253
  • Last login:July 08, 2025, 12:30:14 pm
  • Ikeakade Here I come!
Re: Saving Mame high scores while in the rom
« Reply #14 on: February 12, 2019, 04:36:59 pm »
 
Yeah, all the TC's use SSD, well it's more like an M2 flash drive but definitely not mechanical.  Nice to hear you have mame up and running on WE7, I may even have a look see at that image as I have a couple of TC's spare :)


Thanks, that's good to know.  I'll have to be more diligent about making backups then.

Too bad my post got really derailed...  I'm really stuck on this issue :(

newmanfamilyvlogs

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1694
  • Last login:June 15, 2022, 05:20:38 pm
    • forum.arcadecontrols.com/index.php/topic,103584.msg1096585.html#msg1096585
    • Newman Family Vlogs
Re: Saving Mame high scores while in the rom
« Reply #15 on: February 12, 2019, 04:57:43 pm »
I was looking through the hiscore.dat file and didn't see an entry for 720. Does it actually even support saving the hiscores?

processedmeat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 253
  • Last login:July 08, 2025, 12:30:14 pm
  • Ikeakade Here I come!
Re: Saving Mame high scores while in the rom
« Reply #16 on: February 13, 2019, 10:39:06 am »
I was looking through the hiscore.dat file and didn't see an entry for 720. Does it actually even support saving the hiscores?

Yeah I noticed that as well.  However, 720 in mame does remember high scores when I exit.  After some researching, it seems that history.dat is for games that don't use nvram to save high scores.  I looked in the nvram folder and I see a 720 file in there.  Perhaps that how its saving high scores.

So I need a way to write to nvram while in the rom and not just on exit...

newmanfamilyvlogs

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1694
  • Last login:June 15, 2022, 05:20:38 pm
    • forum.arcadecontrols.com/index.php/topic,103584.msg1096585.html#msg1096585
    • Newman Family Vlogs
Re: Saving Mame high scores while in the rom
« Reply #17 on: February 13, 2019, 10:45:37 am »
Assuming there isn't a way to trigger it to write it periodically without compiling your own mame executable, what if you put the whole system internally on a UPS and set the machine to trigger a shutdown script that included closing mame gracefully prior to shutting the system down? You could connect the monitor to the non-battery side of the UPS to minimize power draw and prolong the life of the battery. You'd also have the added benefit of not munging up the operating system by yanking the power out unexpectedly.

ark_ader

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5645
  • Last login:March 02, 2019, 07:35:34 pm
  • I glow in the dark.
Re: Saving Mame high scores while in the rom
« Reply #18 on: February 13, 2019, 03:16:52 pm »
I was looking through the hiscore.dat file and didn't see an entry for 720. Does it actually even support saving the hiscores?

Yeah I noticed that as well.  However, 720 in mame does remember high scores when I exit.  After some researching, it seems that history.dat is for games that don't use nvram to save high scores.  I looked in the nvram folder and I see a 720 file in there.  Perhaps that how its saving high scores.

So I need a way to write to nvram while in the rom and not just on exit...

I just showed you a way, but if you are too ignorant to follow it then that is your problem.
If I had only one wish, it would be for three more wishes.

processedmeat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 253
  • Last login:July 08, 2025, 12:30:14 pm
  • Ikeakade Here I come!
Re: Saving Mame high scores while in the rom
« Reply #19 on: February 13, 2019, 04:08:40 pm »
I just showed you a way, but if you are too ignorant to follow it then that is your problem.

Wait, what way were you referring to?

Quote
I have bought a bunch of thin clients off ebay for a replacement to the Raspi for my lack builds, all running windows 7 embedded.  I wipe them and stick Puppy Arcade 10 on them. All run on 256mb of ram (in memory) with 100mb install size.  You can power off those without worry to the filing system and the high score data is saved on the 2 gb SSD in a single file. 

Quote
I remote power the 1Up but I run a shutdown script into it first to power it down, then tell alexa to power it down.  I got some Merkury smart plugs for $10 at wallyworld.  I'm not a fan of plug pulling on the pi.  I'm curious on this project  for the front end.  I bought several echos over the Christmas sales.  That would be cool to figure that out for my five games.  Does that work for the fire tablets?

Did I miss another one of your posts?

ark_ader

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5645
  • Last login:March 02, 2019, 07:35:34 pm
  • I glow in the dark.
Re: Saving Mame high scores while in the rom
« Reply #20 on: February 13, 2019, 10:48:50 pm »
I just showed you a way, but if you are too ignorant to follow it then that is your problem.

Wait, what way were you referring to?

Quote
I have bought a bunch of thin clients off ebay for a replacement to the Raspi for my lack builds, all running windows 7 embedded.  I wipe them and stick Puppy Arcade 10 on them. All run on 256mb of ram (in memory) with 100mb install size.  You can power off those without worry to the filing system and the high score data is saved on the 2 gb SSD in a single file. 

Quote
I remote power the 1Up but I run a shutdown script into it first to power it down, then tell alexa to power it down.  I got some Merkury smart plugs for $10 at wallyworld.  I'm not a fan of plug pulling on the pi.  I'm curious on this project  for the front end.  I bought several echos over the Christmas sales.  That would be cool to figure that out for my five games.  Does that work for the fire tablets?

Did I miss another one of your posts?
If I had only one wish, it would be for three more wishes.

processedmeat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 253
  • Last login:July 08, 2025, 12:30:14 pm
  • Ikeakade Here I come!
Re: Saving Mame high scores while in the rom
« Reply #21 on: February 14, 2019, 12:07:21 am »
  I have bought a bunch of thin clients off ebay for a replacement to the Raspi for my lack builds, all running windows 7 embedded.  I wipe them and stick Puppy Arcade 10 on them. All run on 256mb of ram (in memory) with 100mb install size.  You can power off those without worry to the filing system and the high score data is saved on the 2 gb SSD in a single file. 

Thanks for the suggestion but I'm dead set on using Groovymame as it makes 720 look great on my PC CRT and the frame delay allows for really tight controls.  Also I need a newer version of mame as it is the only way that you can fully use a real 720 joystick.

ark_ader

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 5645
  • Last login:March 02, 2019, 07:35:34 pm
  • I glow in the dark.
Re: Saving Mame high scores while in the rom
« Reply #22 on: February 14, 2019, 12:48:09 am »
  I have bought a bunch of thin clients off ebay for a replacement to the Raspi for my lack builds, all running windows 7 embedded.  I wipe them and stick Puppy Arcade 10 on them. All run on 256mb of ram (in memory) with 100mb install size.  You can power off those without worry to the filing system and the high score data is saved on the 2 gb SSD in a single file. 

Thanks for the suggestion but I'm dead set on using Groovymame as it makes 720 look great on my PC CRT and the frame delay allows for really tight controls.  Also I need a newer version of mame as it is the only way that you can fully use a real 720 joystick.

http://jstookey.com/arcade/720/index.php


Where's Driverman when you need him.  :duckhunt
If I had only one wish, it would be for three more wishes.

newmanfamilyvlogs

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1694
  • Last login:June 15, 2022, 05:20:38 pm
    • forum.arcadecontrols.com/index.php/topic,103584.msg1096585.html#msg1096585
    • Newman Family Vlogs
Re: Saving Mame high scores while in the rom
« Reply #23 on: February 14, 2019, 11:18:44 am »
http://jstookey.com/arcade/720/index.php
Where's Driverman when you need him.  :duckhunt

Is there a 720 to parallel port adapter? I mean, that is the lowest latency, after all. :D

processedmeat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 253
  • Last login:July 08, 2025, 12:30:14 pm
  • Ikeakade Here I come!
Re: Saving Mame high scores while in the rom
« Reply #24 on: February 18, 2019, 04:24:12 am »
I ended up using an Autohotkey script running in the background that will trigger a save state at a certain amount of time.

The script checks to see if there is an activity from the controls so that it doesn't save during play and then if there isn't any detected in 30 seconds, it will trigger a save state in mame.  It will then wait 10 minutes until it checks again so that it doesn't keep saving continuously if nobody is playing the machine.

So I figure once I'm done playing, i just have to wait about 30 seconds before I turn off the machine so that it'll save state.  Then on the next boot up, it will load the save state.

Code: [Select]
#InstallKeybdHook
#InstallMouseHook
#Persistent

Loop
{
 WinActivate Mame64

 if A_TimeIdle >= 30000 ; Is there 30 seconds of idle time?
 {
Sleep, 30
Send, {Shift Down}
Send, {F7 Down}
Sleep, 30
Send, {Shift up}
Send, {F7 up}
Sleep, 30
Send, {1 Down}
Sleep, 30
Send, {1 Up}
Sleep, 30
Sleep 600000 ; If there is idle time it saves and then it waits 10 minutes until it checks again
 }

In the mame.ini I changed the following:
state                            1
keyboardprovider          dinput


TOMMYGUN

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 74
  • Last login:May 20, 2025, 02:45:11 pm
  • When the time comes you will know
Re: Saving Mame high scores while in the rom
« Reply #25 on: February 18, 2019, 06:50:46 am »
I think there is a work around by changing the  power settings and configure your power button to go into hybernate mode. This will make windows save its current state and resume from it when you power your computer on again. Even if its powersource is disconnected since it stores the state on the hard disk.

Now when your in mame simply press the power button and it will go into hybernate. Press it again and within a few sexonds you find yourself back in mame, but i haven tried it yet, would it work?

processedmeat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 253
  • Last login:July 08, 2025, 12:30:14 pm
  • Ikeakade Here I come!
Re: Saving Mame high scores while in the rom
« Reply #26 on: February 18, 2019, 04:34:45 pm »
I think there is a work around by changing the  power settings and configure your power button to go into hybernate mode. This will make windows save its current state and resume from it when you power your computer on again. Even if its powersource is disconnected since it stores the state on the hard disk.

Now when your in mame simply press the power button and it will go into hybernate. Press it again and within a few sexonds you find yourself back in mame, but i haven tried it yet, would it work?

Yeah, I think that would work if you wanted to turn on or off your machine through a button press. 

In my case, I have a bunch of cabs and I wanted to be able to turn off all of my machines just by cutting their power like a real arcade cab.  If you go the route that you were suggesting, you could also just have it shutdown mame and the PC on the power button press.  Thanks for replying though.

nexusmtz

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 489
  • Last login:June 01, 2022, 03:14:22 am
Re: Saving Mame high scores while in the rom
« Reply #27 on: February 19, 2019, 12:06:31 am »
Your loop should probably start with checking the idle time, and only do the WinActivate (and presses) if the check passes. Also, I'd use IfWinActive around your keypress block to avoid sending the keys to some other window. Finally, add a sleep of at least a second to the bottom of your loop so it's not constantly firing. You don't really need it to check the idle time hundreds of times a second.

processedmeat

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 253
  • Last login:July 08, 2025, 12:30:14 pm
  • Ikeakade Here I come!
Re: Saving Mame high scores while in the rom
« Reply #28 on: February 20, 2019, 01:02:14 pm »
Your loop should probably start with checking the idle time, and only do the WinActivate (and presses) if the check passes. Also, I'd use IfWinActive around your keypress block to avoid sending the keys to some other window. Finally, add a sleep of at least a second to the bottom of your loop so it's not constantly firing. You don't really need it to check the idle time hundreds of times a second.

Oops I forgot to include the last line when I made this post.  I have it checking idle time every 3 seconds. 

So your suggestion is to put the WinActivite Mame64 line inside the IF block like shown below?

Code: [Select]
#InstallKeybdHook
#InstallMouseHook
#Persistent

Loop
{
  if A_TimeIdle >= 30000 ; Is there 30 seconds of idle time?
 {
WinActivate Mame64
                Sleep, 30
Send, {Shift Down}
Send, {F7 Down}
Sleep, 30
Send, {Shift up}
Send, {F7 up}
Sleep, 30
Send, {1 Down}
Sleep, 30
Send, {1 Up}
Sleep, 30
Sleep 600000 ; If there is idle time it saves and then it waits 10 minutes until it checks again
 }

Sleep 3000 ; Check idle time every 3 seconds
}

Thanks for your suggestions

nexusmtz

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 489
  • Last login:June 01, 2022, 03:14:22 am
Re: Saving Mame high scores while in the rom
« Reply #29 on: February 21, 2019, 01:37:28 am »
Yep, you got it. There's still the issue of sending keys to whatever the active window happens to be if mame isn't running, but on a dedicated machine, that shouldn't happen.