RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Favorites will only save if shutdown by menu option and not via GPIO Shutdown Script

    Scheduled Pinned Locked Moved Help and Support
    favouritesshutdown script
    9 Posts 5 Posters 3.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.
    • C
      Chillimonster
      last edited by

      Bit of an issue, but not been able to find reference to it by searching.

      Just built a Retropie image from the 4.2 image and added my roms.

      I can add favourites from any system and they show in my favourites folder.

      If i use my GPIO connected switch that runs the shutdown script the favorites ate not saved, but it i use the 'Quit' option in the menu to shut down the favourites are saved.

      Is there a way to get them to save via the shutdown script

      Z 1 Reply Last reply Reply Quote 0
      • Z
        Zigurana @Chillimonster
        last edited by

        @chillimonster What is your shutdown script exactly?

        If tetris has thought me anything, it's that errors pile up and that accomplishments dissappear.

        1 Reply Last reply Reply Quote 0
        • C
          Chillimonster
          last edited by

          Its the 8BitJunkie script (unsure if he was the originator of it but i use that auto installer)

          https://pie.8bitjunkie.net/retropie-shutdown-and-startup-switch-the-easy-way

          mituM 1 Reply Last reply Reply Quote 0
          • mituM
            mitu Global Moderator @Chillimonster
            last edited by

            @chillimonster The shutdown script is no probably not closing EmulationStation properly and any modifications done within ES are not saved properly.
            Add the sudo killall emulationstation command in the shutdown script before the actual shutdown command and it should help.

            C 1 Reply Last reply Reply Quote 1
            • Z
              Zigurana
              last edited by

              @mitu is probably correct.
              If you use the python script mentioned in that website, you basically call sudo shutdown - haltwithout closing down EmulationStation properly. Not sure if doing a killallis any better though.
              Ideally, you'd want to send either F4 or sigint, to trigger the SDL_quit event.

              If tetris has thought me anything, it's that errors pile up and that accomplishments dissappear.

              1 Reply Last reply Reply Quote 1
              • C
                Chillimonster @mitu
                last edited by

                @mitu said in Favorites will only save if shutdown by menu option and not via GPIO Shutdown Script:

                @chillimonster The shutdown script is no probably not closing EmulationStation properly and any modifications done within ES are not saved properly.
                Add the sudo killall emulationstation command in the shutdown script before the actual shutdown command and it should help.

                @zigurana said in Favorites will only save if shutdown by menu option and not via GPIO Shutdown Script:

                @mitu is probably correct.
                If you use the python script mentioned in that website, you basically call sudo shutdown - haltwithout closing down EmulationStation properly. Not sure if doing a killallis any better though.
                Ideally, you'd want to send either F4 or sigint, to trigger the SDL_quit event.

                Will give it a go and report back later / over weekend.

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

                  @chillimonster @Zigurana @mitu

                  @meleu and me already got a solution through bash script to proper shutdown the Raspberry via button event.

                  I point to the usefull topic thread - category docs & guides

                  I see no sense in the usage of this python script... as it always polls for button event and sets no IRQ event, so it is as good as the bash script.

                  But if you want to use the python script then exchange line with shutdown with a call to the script that contains quit ES and shutdown routine :)
                  Feel free to ask if there is something unclear.

                  #!/usr/bin/python
                  import RPi.GPIO as GPIO
                  import time
                  import subprocess
                  
                  GPIO.setmode(GPIO.BOARD)
                  
                  # we will use the pin numbering to match the pins on the Pi, instead of the
                  # GPIO pin outs (makes it easier to keep track of things)
                  # use the same pin that is used for the reset button (one button to rule them all!)
                  GPIO.setup(5, GPIO.IN, pull_up_down = GPIO.PUD_UP)
                  
                  oldButtonState1 = True
                  
                  while True:
                      #grab the current button state
                      buttonState1 = GPIO.input(5)
                  
                      # check to see if button has been pushed
                      if buttonState1 != oldButtonState1 and buttonState1 == False:
                          # shutdown
                          subprocess.call("shutdown -h now", shell=True,
                            stdout=subprocess.PIPE, stderr=subprocess.PIPE)
                          oldButtonState1 = buttonState1
                  
                      time.sleep(.5)
                  
                  1 Reply Last reply Reply Quote 3
                  • meleuM
                    meleu
                    last edited by

                    Hello guys! I would like to suggest the solution I proposed here:
                    https://retropie.org.uk/forum/topic/12895/ensuring-es-gracefully-finish-and-save-metadata-in-every-system-shutdown

                    Let me know if you guys find some problem.

                    Cheers!

                    • Useful topics
                    • joystick-selection tool
                    • rpie-art tool
                    • achievements I made
                    C 1 Reply Last reply Reply Quote 1
                    • C
                      Chillimonster @meleu
                      last edited by

                      @meleu said in Favorites will only save if shutdown by menu option and not via GPIO Shutdown Script:

                      Hello guys! I would like to suggest the solution I proposed here:
                      https://retropie.org.uk/forum/topic/12895/ensuring-es-gracefully-finish-and-save-metadata-in-every-system-shutdown

                      Let me know if you guys find some problem.

                      Cheers!

                      Thanks for this - I'll give it a 'bash' later :-)

                      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.