Mausberry Shutdown Script Doesn't Save Metadata
-
@cyperghost @pjft
Hey guys, I didn't read what you guys already tried, sorry. But I'm afraid it's not possible to get the results expected in the OP by killing ES. As far as I understood this part of ES code must be executed to update the gamelists: https://github.com/retropie/EmulationStation/blob/master/es-app/src/SystemData.cpp#L51I'm not used to ES code (maybe @pjft can help with this), but I think that that line won't be executed by killing ES while an emulator is running.
-
@pjft I see it as encourgement that @hansolo77 got now his toolbox to write a script that is intented for his usecase. All commands are given in this sniplet. If this will work?? I don't know.
From first version up to 1.2 - I was 100% sure that this works. And this works for every user here in the forum... Any other method is simply try and error.
-
@meleu Hi mate :)
No problem. We know that a proper exit via pkill/kill works(remember this thread my friend?) . @hansolo77 confirmed this. It won't work if the emulator is running. So my shotgun method is to always kill emulator (retroarch) wait 2-3 seconds and then it may work becasue ES can write XML data. But I think version 1.2 of the script posted here works for all users out here. So this version should be maintained.
-
@cyperghost ha! good catch! can I give a suggestion?
your script only works properly if the user is running retroarch. I believe you can kill any
emulatorprogram launched by runcommand using this (please, test it before using!!):pkill -f "$(sed -n 4p /dev/shm/runcommand.info)"
Note: the 4th line of
runcommand.info
has the exact command line launched by runcommand, as you can see in this line of runcommand.sh code. -
Yes I kill only retroarch ... but I'm not sure if this is enough. If your script can find out all running emulators then the usecase works for all. But I haven't tested out now if killing emulator ... waiting 2 seconds ... hoping that ES writes XML file ... does work.
I think that's @hansolo77 job and then it would nice not to always kill the emulator process (=shotgun method) rather if it running, so you need a new if-then branch or make use of case selection. But I believe that is not our job :)
But you know I really appreciate your help, always!
-
@cyperghost said in Mausberry Shutdown Script Doesn't Save Metadata:
If your script can find out all running emulators
AFAIK EmulationStation isn't able to launch more than one emulator. You must exit the emulator, then go back to ES and then launch another emulator. Then killing the command that stays in the 4th line of
/dev/shm/runcommand.info
looks like a good approach for me. -
That will work. Indeed ....
inruncommand.info
is everything stored but not if an emulator is currently running or not.
I wouldratheruseruncommand.log
runcommand.info
, too4th line /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-fceumm/fceumm_libretro.so --confi....
and check
pgrep /opt/retropie/emulators/retroarch/bin/retroarch
for ex. if PID > 0
if yes, then an emulator seems to be running if PID empty or 0 then there is no emulator.So it is surly possible to detect every emulator-run proper initiated by
runcommand.sh
Thank you
@hansolo77 got his toolbox now ;) He should use it :)
-
@cyperghost Wow! You really confused me! PID > 0? Also, why are you so obsessed in killing retroarch? Is it your next victim after you killed EmulationStation so many times like it was Kenny (Sourth Park)? :)
If you
pkill
an inexistent process it doesn't hurt anything, then IMHO there's no need to check if that command is still running.[PROMPT]$ pkill -f blablabla [PROMPT]$ # see? nothing happens! :)
-
PID > 0 means it is running or not ;)
Okay than the approach is easy if pkill does not hurt :)pkill -f "$(sed -n 4p /dev/shm/runcommand.info)"
@hansolo77? There is a new toy ;)
Please instead ofpkill retroarch
use line above. Can you please test?
If all proper runs it can be pushed to version 1.3ES is not a victim, it behaves like a sqarehead but with a few tricks it can be calmed down ;)
Knowledge is power and thank you @meleu to share your knowledge with us.I think thats our passion not obsession, that would be bad!
-
Wow guys. My email inbox is spammed. :) I'm actually not too worried about getting it to save if I'm in the middle of a game. That situation rarely comes up, and to my memory only recently while troubleshooting all this. :)
I will test v1.3 (adding the retroarch pkill) here in a little while. I'm suffering a massive migraine. Have had it the last 3 days. Every now and then it act's like it's feeling a little better and I can get some work done with this. I'm honestly thrilled that I've got you guys pulling your hair out on all this and have a working solution already. :)
-
@hansolo77 said in Mausberry Shutdown Script Doesn't Save Metadata:
I'm honestly thrilled that I've got you guys pulling your hair out
Which hair? :-)
-
@hansolo77 Please test like you want
pkill retroarch
works just for libretro-cores, the sniplet of @meleu works with all things that were started throughruncommand.sh
- so it's the more versatile wayWhich hair :-)
nose hair! What an awful torture!
-
The 1.2 script is working great for me as well.
@hansolo77 I've solved the saving issue by having retroarch to check and write to disk the srm files every 10 seconds if its new. Its an option in retroarch under the saving menu. I learned a hard lesson powering off in the middle of a game and losing about an hours worth of gameplay. -
@lostless said in Mausberry Shutdown Script Doesn't Save Metadata:
I learned a hard lesson powering off in the middle of a game and losing about an hours worth of gameplay
Can you share with us what is the exact option for this? I'm highly interested.
I had a similar issue while playing Terranigma after freeing 4 continents. I was playing on my GPD XD (Android device) and left the device in standby but the battery was over. And then the srm file wasn't saved... :( You know, RPGs are very time consuming...
@cyperghost that's why you don't see me talking about Terranigma recently. But I'll try it again!
-
Can you share with us what is the exact option for this? I'm highly interested.
I'm also highly interested
@cyperghost that's why you don't see me talking about Terranigma recently. But I'll try it again!
Do that! I'm just stick in the middle of the game. You need so much time for RPG but it makes real fun.
-
@cyperghost I think I've found it!
The option is
autosave_interval
. Look here: https://github.com/libretro/RetroArch/blob/master/retroarch.cfg#L785300 should be a good value. 300 seconds = 5 minutes
EDIT: via menu it's Settings -> Saving -> SaveRAM Autosave Interval.
-
@meleu that's it. I did some testing a while ago and it only writes a new file if it's been changed. So 10 seconds works good for me.
-
Good stuff! So just to clarify, that's saving the nonvolatile RAM right? Not creating a Save State? Because of RetroAchievments, I typically just leave my RetroArch in Hardcore mode, which disables Saves States and Cheats.
Sorry about last night and my headache. I wasn't fully following the discussion between @cyperghost and @meleu. When I get a chance, I will try it with the command:
pkill -f "$(sed -n 4p /dev/shm/runcommand.info)"
-
@hansolo77 yes just the sram. Not savestates. By default the sram stays in RAM until you exit. This just checks the sram every x seconds and sees if there is a change. If so, it writes to disk.
-
That added line to the script seems to break the script. I added the 1.3 changes (using the original
pkill retroarch > /dev/null 2>&1
bit), then I changed it to thepkill -f "$(sed -n 4p /dev/shm/runcommand.info)"
. For some reason now, whenever I press the power button nothing happens. At first I thought it was because thepkill
command was nested inside theif
statement. When I SSH'd into the system and checkedtop
, ES was no longer running when RetroArch was. So the new additions to the script weren't getting picked up. I moved it (as a test) outsideif
functions. Still nothing happened. I've experimented with doingsudo reboot
from the SSH terminal as well as via ES shutdown (from the menu). In both cases, the power button still doesn't work. I can, however, power the system on from a complete power plug pull via the button, so I know the switch is still good. You sure that's the right command?
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.