Recalbox Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • recalbox.com
    • Gitlab repository
    • Documentation
    • Discord

    Exit emulator with one button press vía gpio

    GamePad/GPIO/USB encoder
    button press vía gpio
    9
    41
    16686
    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.
    • paradadf
      paradadf Staff @8bit_astronaut last edited by paradadf

      @8bit_astronaut I don't know what happened with that page (there was a spanish version too).
      But the creator of that script is @Phantis, so maybe he can clear things out.

      Edit: Hmmm, can't find him anymore.

      Update: @Bug why did you erase everything? You even changed your username!

      If your question was answered, please mark it as solved: Topic Tools -> Ask a question + Topic Tools -> Mark as Solved

      DjLeChuck 1 Reply Last reply Reply Quote 0
      • DjLeChuck
        DjLeChuck @paradadf last edited by

        @paradadf Nevermind, thanks Google Cache @8bit_astronaut : http://webcache.googleusercontent.com/search?q=cache:https://github.com/recalbox/recalbox-os/wiki/Enable-Gpio-button-to-close-emulator-with-only-one-button-press

        paradadf 1 Reply Last reply Reply Quote 0
        • paradadf
          paradadf Staff @DjLeChuck last edited by

          @DjLeChuck wow, didn't know about that. Can you also access the links for the scripts itself on that page?

          If your question was answered, please mark it as solved: Topic Tools -> Ask a question + Topic Tools -> Mark as Solved

          DjLeChuck 1 Reply Last reply Reply Quote 0
          • DjLeChuck
            DjLeChuck @paradadf last edited by

            @paradadf Sadly no, that's what I just see 😞

            DjLeChuck 1 Reply Last reply Reply Quote 0
            • DjLeChuck
              DjLeChuck @DjLeChuck last edited by

              Page restored: https://github.com/recalbox/recalbox-os/wiki/Enable-Gpio-button-to-close-emulator-with-only-one-button-press

              But scripts are always missing...

              1 Reply Last reply Reply Quote 0
              • 8bit_astronaut
                8bit_astronaut last edited by

                So....now we cant use that script?

                Gosh thats terrible....

                DjLeChuck 1 Reply Last reply Reply Quote 0
                • DjLeChuck
                  DjLeChuck @8bit_astronaut last edited by

                  @8bit_astronaut The terrible thing is that " @Bug " @Phantiss has closed his account and delete everything without any reason! ><

                  voljega 1 Reply Last reply Reply Quote 0
                  • 8bit_astronaut
                    8bit_astronaut last edited by

                    Thats even worst....

                    1 Reply Last reply Reply Quote 0
                    • 8bit_astronaut
                      8bit_astronaut last edited by

                      Any alternative to that script....?

                      1 Reply Last reply Reply Quote 0
                      • voljega
                        voljega Banned @DjLeChuck last edited by voljega

                        @DjLeChuck maybe @substring has still the scripts somewhere because I kinda remember to have read in a thread he tested it

                        1 Reply Last reply Reply Quote 0
                        • paradadf
                          paradadf Staff last edited by

                          I would rather ask @supernature2k, as he told me he was creating his own script to do that.

                          If your question was answered, please mark it as solved: Topic Tools -> Ask a question + Topic Tools -> Mark as Solved

                          1 Reply Last reply Reply Quote 0
                          • 8bit_astronaut
                            8bit_astronaut last edited by

                            Thank you! A lot of people would use it

                            1 Reply Last reply Reply Quote 0
                            • Substring
                              Substring last edited by

                              @supernature2k I SUMMON YOU !!!

                              Former dev - Please reply with @substring so that i am notified when you answer me
                              Ex dev - Merci de me répondre en utilisant @substring pour que je sois notifé

                              supernature2k 1 Reply Last reply Reply Quote 0
                              • supernature2k
                                supernature2k @Substring last edited by

                                @Substring Yep, how can I help?

                                Pi powered NES | Gameboy HD | RecalStation | RecalDrive
                                Upvote messages if it has been useful ;)

                                Substring 1 Reply Last reply Reply Quote 0
                                • Substring
                                  Substring @supernature2k last edited by

                                  @supernature2k where is your fringing script to kill emulators via GPIO ?

                                  Former dev - Please reply with @substring so that i am notified when you answer me
                                  Ex dev - Merci de me répondre en utilisant @substring pour que je sois notifé

                                  supernature2k 1 Reply Last reply Reply Quote 0
                                  • supernature2k
                                    supernature2k @Substring last edited by supernature2k

                                    @Substring try this:

                                    import RPi.GPIO as GPIO
                                    import time
                                    import os
                                    import thread
                                    import datetime
                                    import socket
                                    import sys
                                    from datetime import datetime
                                    from configgen import recalboxFiles
                                    # this last one retrieves emulators bin names
                                    
                                    IPADDR = "127.0.0.1"
                                    PORTNUM = 55355
                                    # IP and port for retroarch network commands
                                    
                                    QUIT = 3
                                    
                                    
                                    GPIO.setwarnings(False)		# no warnings
                                    GPIO.setmode(GPIO.BCM)		# set up BCM GPIO numbering 
                                     
                                    GPIO.setup(QUIT, GPIO.IN, pull_up_down=GPIO.PUD_UP)
                                    # GPIO on pin 3 is the GPIO 2 in BCM mode
                                    #to Reset+
                                    
                                      
                                    # Define a threaded callback function to run in another thread when events are detected  
                                    def button_pressed(channel):
                                    	
                                    	nwcommand="QUIT"
                                    	retroarch(nwcommand)
                                    	killthats&ast;&ast;t(channel)
                                    		
                                    	
                                    #	on quit press, trying to kill all listed emus 
                                    def killthats&ast;&ast;t(channel):
                                    	if channel == QUIT:
                                    		for bin in recalboxFiles.recalboxBins:
                                    				print bin
                                    				proc = os.path.basename(bin)
                                    				print proc
                                    				os.system("killall -9 "+proc)
                                    
                                    
                                    # 	sending network command to retroarch (only exit and reset atm)		
                                    def retroarch(nwcommand):
                                    	try:
                                    		s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
                                    	except socket.error:
                                    		print 'Failed to create socket'
                                    		sys.exit()
                                    	s.sendto(nwcommand, (IPADDR, PORTNUM))
                                    		
                                    
                                    GPIO.add_event_detect(QUIT, GPIO.BOTH, callback=button_pressed, bouncetime=2)
                                    while True:
                                    	time.sleep(0.2)
                                    

                                    Pi powered NES | Gameboy HD | RecalStation | RecalDrive
                                    Upvote messages if it has been useful ;)

                                    sevenx 1 Reply Last reply Reply Quote 0
                                    • sevenx
                                      sevenx @supernature2k last edited by

                                      @supernature2k
                                      Does this automaticly start ES again after killing the Emulator?

                                      supernature2k 1 Reply Last reply Reply Quote 0
                                      • supernature2k
                                        supernature2k @sevenx last edited by

                                        @sevenx no as ES is not killed when you launch an emu

                                        Pi powered NES | Gameboy HD | RecalStation | RecalDrive
                                        Upvote messages if it has been useful ;)

                                        sevenx 1 Reply Last reply Reply Quote 0
                                        • sevenx
                                          sevenx @supernature2k last edited by

                                          @supernature2k
                                          Do you have some time, to talk about a new project from me? Over PM?

                                          supernature2k 1 Reply Last reply Reply Quote 0
                                          • supernature2k
                                            supernature2k @sevenx last edited by

                                            @sevenx ok

                                            Pi powered NES | Gameboy HD | RecalStation | RecalDrive
                                            Upvote messages if it has been useful ;)

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

                                            Want to support us ?

                                            80
                                            Online

                                            99.6k
                                            Users

                                            28.1k
                                            Topics

                                            187.1k
                                            Posts

                                            Copyright © 2021 recalbox.com