[SCRIPT] Setup for an automatic savestate selector
-
@shavecat
Yeah, I excluded the AUTO savestate because I use that to be able to automatically load a save state from the script. But you can also configure RetroArch to automatically load that AUTO save state when starting the ROM.Alternatively, you could customize the script. Open
savestate_selector.sh
and navigate to line 203:done <<< $(find $statePath -type f -iname "${romfilebase}.state*" ! -iname "*.png" ! -iname "*.auto") # get all STATE files, exclude *.PNG and *.AUTO
Change that to
done <<< $(find $statePath -type f -iname "${romfilebase}.state*" ! -iname "*.png") # get all STATE files, exclude *.PNG
to not exclude the AUTO save state. Please note that I did not test this. There might (will) be some unexpected side effects...
-
@jandalf81
THANKS !!!! :))) -
@jandalf81 I know this is an old thread but just because something is old doesn't mean it isn't good. I just stumbled upon this while searching to see if anyone had come up with a more NES-Classic-like way of handling save states. I just wanted to say that this is excellent work and thank you.
-
@jandalf81 Again, I know this is an old thread and hopefully you haven't put this project behind you. I have been playing with your savestate selector and I've run into 2 issues.
The first is with the "Set delay to delete AUTO savestate" option. The default value is 10 seconds but I find that setting this to anything less than 15 will cause loading the selected savestate to fail. A message will show on screen stating that it loaded but in fact it does not. The rom just loads normally. I suspect it usually takes a little longer than 10 seconds for a rom and savestate to load and so the auto savestate is getting deleted before it can be loaded if the value is 10 seconds or less.
The other, bigger issue (because I haven't figured out a workaround) is that it seems like if a rom has a dot in the file name it's savestates will not be detected and the savestate selector dialog will not load. I've tested this with the NES roms 'Mr. Gimmick (Europe)', 'R.C. Pro-Am (USA)', 'Simpsons, The - Bart vs. the Space Mutants (USA)', and 'Super Mario Bros. (World)'. There are definitely savestaes for each of these roms but the savestate selector dialog does not load for any of them. The only common denominator I can see is that they all have dots in their file names.
I further tested this theory by making copies of these roms with the the dots removed from the filenames. I then created new savestates with the renamed roms and then savestate selector dialog came up as expected.
I also tested with roms that had other special characters in their file names like 'Pac-Man (USA) (Namco)' and 'Mike Tyson's Punch-Out!! (Japan, USA) (Rev A)'. These worked with no problem. Of course that isn't a comprehensive test of special characters but I've only experienced this issue with roms with dots in their filnames, not any other special characters.
I'm sure it's just a matter of putting something in quotes or adding an escape character somewhere in your script. Unfortunately I'm not proficient enough in Unix shell scripting to figure it out myself without diving pretty deep. Hopefully you can help me out.
-
@joelkolb That is easy to fix ... edit the script in line 80
changeromfilebase="${romfilename%%.*}" # filename of $rom, excluding extension
to
romfilebase="${romfilename%.*}" # filename of $rom, excluding extension
the double %% strips filename till last . and this is the R in R.C. PROAM
-
@cyperghost Awesome, thanks! It works like a charm. I knew something of this nature would be an easy fix for someone good with shell scripting.
-
@joelkolb
Is that fix the issue that some games dont load the save'd file's ?
and if so what file i need to fix.
thanks a lot :) -
@shavecat It could be the fix that some games do not load. In the case of
R.C.ProAM
the autosavestate was renamed wrong toR.autostate
In the case of the 10s time you need a possibility to detect file access. That can be made by
lsof -t | grep .autostate
or by inotify daemon. So the easiest solution imho here is to extend timer. -
@cyperghost
Im Confused :
so i need to change somthing in the files or update ?
how can i do it ?
just some games like in psx loade the save state and give me the loading screen state save , and some dont. -
@shavecat You need to change line 80 in the script and just remove one
%
If you ROM file contains additional dots in the filename then yes ... this will be fixed -
@cyperghost
Thanks a lot ! got it
still not reading the save's...
install it again works like charm ! thanks again ! :) -
Could the installation of this in theory be added to the Experimental RetroPie setup menu? Seems a real shame for this to not be widely advertised or available (give it a few months and this thread could be a few pages down in the forum)
-
this is very cool. im glad someone found this and got it back on the forum.
only questions am i the only one who the only previews that are coming up is on SNES?
i have tried a handful of games on different systems and the saves work, but no previews.if not no big. it was more me just wondering if im alone on this
-
@ExarKunIv This is a total shot in the dark but perhaps you have the RetroArch option for capturing a screenshot along with your savestate only enabled for SNES instead of globally.
If you turned that option on while playing an SNES game and then saved the config it would have modified 'opt/retropie/configs/snes/retroarch.cfg' with that setting which would only apply it to the SNES system.
Instead you would want to either manually edit 'opt/retropie/configs/all/retroarch.cfg' or run RetroArch from the RetroPie menu in EmulationStation and toggle the option on and then save the config. That would make it global for RetroArch.
That's just my guess. It's the only reason I can think of for why the thumbnails would only show for SNES.
-
@joelkolb ok ill take a look and see what i see. thanks
UPDATE
seems like that the script does it for you, but first game/save state will not have a preview.
i made a save state for one same, and nothing. but when i made a new one for a different game there is was. -
Sorry for the late reply... ;-(
@joelkolb I'm glad you like this. I did this more as a "proof of concept" since I don't really use save states. There will very likely be a whole batch of errors in this scripts... ;-)
Nevertheless, I corrected the script to work with games with dots in their names. If you install the script now, this should work out of the box.
As for the timer, that can be changed from inside RetroPie. The setup added a configuration script to the main RetroPie menu@cyperghost Thanks for helping with the quick fix!
@robertybob I have no intention of adding any of my scripts to the "official" RetroPie setup. This is more of a side project or hobby to me. Having more users means having more problems as my scripts have not been thoroughly tested. This would create frustrations on all sides. Now, if someone were to fork my projects and take over support for that fork... I wouldn't have a problem with that.
@ExarKunIv You either need to manually activate the setting to create a thumbnail on saving states or the first savestate won't have one. If you use my script to start a ROM with a savestate that setting will be set to TRUE by the script. This will be done per system, as @joelkolb said
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.