RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    [SCRIPT] Setup for an automatic savestate selector

    Scheduled Pinned Locked Moved Projects and Themes
    savestatesscript
    47 Posts 13 Posters 9.2k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • shavecatS
      shavecat @shavecat
      last edited by

      Try again
      and it worked better.
      Why is not auto save ? do i need to change in the
      'retroarch.cfg'
      the autosave = false , to true ?

      1 Reply Last reply Reply Quote 0
      • S
        SuperPitendo
        last edited by SuperPitendo

        Hi,
        due to some issues I had to make a fresh install of RetroPie. After setting up my system from scratch, I couldn't get your script to work again (completely)...
        IMAGEMAGICK is not found and it skips the installation. I tried to install it manually via commandline but still with no success.
        I think this causes the "no-thumbnails-problem" of @shavecat

        shavecatS 1 Reply Last reply Reply Quote 0
        • shavecatS
          shavecat @SuperPitendo
          last edited by shavecat

          @SuperPitendo
          Try- sudo apt-get update
          think it will help.
          like u said start again , and it worked with the - thumbnails-problem like should be.
          getting the thumbnails working great ! .
          but still no auto save ,
          Is it spouse to auto save by him self on slot 0?
          or i need to config it ?
          Cant see on the loading saves stae the auto save state.
          everything else works great !

          1 Reply Last reply Reply Quote 0
          • jandalf81J
            jandalf81
            last edited by

            @SuperPitendo
            As @shavecat said, try sudo apt-get update before you start my setup script. Imagemagick should still be installable via apt-get which is exactly what my script tries to do... You might have one binary installed still which makes the setup script skip the installation of Imagemagick. Can you check if the file /usr/bin/convert exists?

            If you still have problems, please post the setup log from ~/scripts/savestate_selector/savestate_selector-install.log

            @shavecat
            What do you mean by

            cant get to auto save after 10sec by him self

            Are you trying to make RetroArch create a savestate every 10 seconds? If so, that would have to be configured within RetroArch itself, there should be a fitting setting in the "Saving" menu...

            and dont see the thumbnails pics save on the savesate load screen

            Are you sure you created a save state? Without them, there's no thumbnail to show as well...

            shavecatS 1 Reply Last reply Reply Quote 0
            • shavecatS
              shavecat @jandalf81
              last edited by

              @jandalf81
              Sorry im stupid got confused a bit .
              it works great jandalf81 thanks alot with thumbnails works great !
              love your code Thanks!
              I have last Q , about the auto save state in the RetroArch with the autosave when i quit i have an auto save with pic' in the folder and all,
              but cant get it too see in on the load state thumbnails (think cause it look in the code for state, and not auto) im getting like $SRAM_PATH.auto. (for auto saving)
              is that right ?

              jandalf81J 1 Reply Last reply Reply Quote 0
              • jandalf81J
                jandalf81 @shavecat
                last edited by

                @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...

                shavecatS 1 Reply Last reply Reply Quote 0
                • shavecatS
                  shavecat @jandalf81
                  last edited by

                  @jandalf81
                  THANKS !!!! :)))

                  1 Reply Last reply Reply Quote 0
                  • J
                    joelkolb
                    last edited by

                    @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.

                    1 Reply Last reply Reply Quote 1
                    • J
                      joelkolb
                      last edited by

                      @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.

                      cyperghostC 1 Reply Last reply Reply Quote 0
                      • cyperghostC
                        cyperghost @joelkolb
                        last edited by cyperghost

                        @joelkolb That is easy to fix ... edit the script in line 80
                        change romfilebase="${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

                        J 1 Reply Last reply Reply Quote 1
                        • J
                          joelkolb @cyperghost
                          last edited by

                          @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.

                          shavecatS 1 Reply Last reply Reply Quote 0
                          • shavecatS
                            shavecat @joelkolb
                            last edited by

                            @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 :)

                            1 Reply Last reply Reply Quote 0
                            • cyperghostC
                              cyperghost
                              last edited by cyperghost

                              @shavecat It could be the fix that some games do not load. In the case of R.C.ProAM the autosavestate was renamed wrong to R.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.

                              shavecatS 1 Reply Last reply Reply Quote 0
                              • shavecatS
                                shavecat @cyperghost
                                last edited by shavecat

                                @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.

                                cyperghostC 1 Reply Last reply Reply Quote 0
                                • cyperghostC
                                  cyperghost @shavecat
                                  last edited by cyperghost

                                  @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

                                  shavecatS 1 Reply Last reply Reply Quote 0
                                  • shavecatS
                                    shavecat @cyperghost
                                    last edited by shavecat

                                    @cyperghost
                                    Thanks a lot ! got it
                                    still not reading the save's...
                                    install it again works like charm ! thanks again ! :)

                                    1 Reply Last reply Reply Quote 0
                                    • R
                                      robertybob
                                      last edited by

                                      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)

                                      1 Reply Last reply Reply Quote 0
                                      • ExarKunIvE
                                        ExarKunIv
                                        last edited by

                                        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

                                        RPi3B+ / 200GB/ RetroPie v4.5.14, RPi4 Model B 4gb / 256gb / RetroPie 4.8.2
                                        RPi5 4gb / 512gb / RetroPie 4.8.9 -Basic
                                        Maintainer of RetroPie-Extra .

                                        J 1 Reply Last reply Reply Quote 0
                                        • J
                                          joelkolb @ExarKunIv
                                          last edited by

                                          @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.

                                          ExarKunIvE 1 Reply Last reply Reply Quote 1
                                          • ExarKunIvE
                                            ExarKunIv @joelkolb
                                            last edited by ExarKunIv

                                            @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.

                                            RPi3B+ / 200GB/ RetroPie v4.5.14, RPi4 Model B 4gb / 256gb / RetroPie 4.8.2
                                            RPi5 4gb / 512gb / RetroPie 4.8.9 -Basic
                                            Maintainer of RetroPie-Extra .

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            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.