Powerblock proper ES shutdown
-
Thanks! I'll try this tonight after my day's worth of responsibilities are done with, haha.
-
@capeman I've got the script!
#!/bin/bash shutdown -h now
So I've updated to previous posting. It should work!
-
Great! I will test it out tonight and report back.
-
Interesting, I must be using really old powerblock drivers (i've had the thing for a year and a half now) - and the .sh file isnt located in /etc/... so I'm going through the retropie update and installing the built in driver from source. I hope i don't cause a conflict haha.
Edit a that did it! the .sh file is there now! Let's do some editing.
-
@cyperghost Dang you guys are smart! Works with powerblock without a hitch! Beautiful piece of coding!
One question. I read and noticed that when the power button is switched, retroarch exits out to ES first before shutting down. Is Retroarch exiting cleanly to the point where it will save sram on exit or is it being crashed out and sram will be lost?
I have my autosave interval set to 10 seconds, but i read somewhere it doesnt write unless theres a change so i might drop it to 3 seconds, but if the switch exits cleanly, then i probably dont have to worry about it.
-
Hmmm i may as well test it, I'll remove autosave interval in my retroarch cfg, start a new game in kirby's adventure on NES (which i am certain autosaves), then use the power switch process to shut down. If Kirby has a save file, then i would assume that retroarch is exiting cleanly and saving sram... right?
If not i might try switching out KILL with SIGTERM in the code above to see if simulates a clean exit, it's worth seeing what happens. (as detailed in the retroarch.cfg notes).
# Killing it in any hard way (SIGKILL, etc) will terminate RetroArch without saving RAM, etc. # On Unix-likes, SIGINT/SIGTERM allows a clean deinitialization. input_exit_emulator = "esc"
I'll let you know what i find and if i need to adjust anything. If this was covered in the mausberry thread and i didn't read it, my bad, that was alot to go back and read and I'm impatient and mostly skimmed.
-
@capeman Do a test for us all. Turn off auto save. Make a save in game. Then hit the a switch and see if it saves.
-
@capeman find a game that makes it obvious. Like one of the gba castlevania games. Save, kill one enemy. Check the xp before and after. Save and see what the xp is after the shutdown.
-
@lostless Right, that was my plan. I'll test it after my wife watches her netflix, and report back.
-
@capeman i beat you to it. It does save! I will still keep auto on just in case of power outage. But it does solve then default delema of losing my save using a switch because I didn't to exit out of the emulator.
-
You indeed beat me to it, but i just got done finishing testing. Appears to be working for me too. I read a bit more into it, apparently KILL when used with a properly running non-frozen application can be ignored by the application and treated as a termination call. Most applications will clean exit on a KILL command and not hard exit when not frozen. So yeah, this seem to work just fine.
-
-
You are doing awesome work here!
Do you think that the PowerBlock driver in the repository should be modified or extended in any way? -
@petrockblog I would vote yes on this! It works flawlessly with ES and retroarch. It is such a simple update to the .sh file and even if doesn't clean exit a non retroarch emulator, it will still exit the old fashioned way and clean exit ES for meta save. So either way it seems pretty harmless.
-
@petrockblog said in Powerblock proper ES shutdown:
You are doing awesome work here!
This one has several fathers.
Do you think that the PowerBlock driver in the repository should be modified or extended in any way?
Well ... I think the usecase must be cleared. I'm not sure if everybody will take case in the use of emulators. So I would rather prefer you take this sniplet and push it to your github and let the user get the choice to download/use it during driver installation.
@meleu What is your opinion?
-
@meleu What is your opinion?
Well. I got my ego massage receiving a compliment from the RetroPie's creator. :-)
Oh... You're talking about modifying/extending the PowerBlock's driver in the repo... Well, what we made here is very specific for a RetroPie-EmulationStation setup. Some people use Attract Mode and at some point others will use Pegasus, and maybe there are PowerBlock owners that don't even run RetroPie.
Maybe you can put this code in the repo as an option, not as default.
That is my opinion.
-
@meleu I agree. I will put that script into the repository as alternative shutdown script. Thanks!
-
@petrockblog
There's a update to the code!Version 1.59 --- I update forst posting!
Version 1.58 Introduced a method to kill child processes via PPID @cyperghost
Version 1.59 is a code polishing done by @meleu -
I know this topic a bit old - but I wanted to ask if this is still the best approach for a proper shutdown of a RetroPie/EmulationStation/PowerBlock combo?
@petrockblog you mentioned above that you were going to add this into your repo, but it looks like it's not there?
I just installed the PowerBlock on my Pi4 last night and it's working well, but I just wanted to add the proper shutdown of ES.
Thanks! Apologies for reviving an old thread.
-
@saturnx
@cyperghost has released a full power, exit script that works for many power options a while ago. It’s generic and just have to run certain tags from it to get the result you want.
https://github.com/crcerror/ES-generic-shutdown
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.