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.
    • 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
                                  • lackyluuk
                                    lackyluuk Translator last edited by

                                    @8bit_astronaut maybe this article I wrote some time ago can help. I use the script to reset the emulator. But with replacing the RESET with QUIT you should be able to quit it and return to ES.

                                    https://github.com/recalbox/recalbox-os/wiki/Emulator-interactions-via-GPIO-mapping-(EN)

                                    NintendoRS | Nintendo Adapter Box | Cardboard Recalbox

                                    8bit_astronaut 2 Replies Last reply Reply Quote 0
                                    • 8bit_astronaut
                                      8bit_astronaut @lackyluuk last edited by

                                      @lackyluuk that looks great! Ill check it in a moment, thank you so much!

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

                                        @lackyluuk its necesary to have an internet conection for recalbox???

                                        DjLeChuck 1 Reply Last reply Reply Quote 0
                                        • lackyluuk
                                          lackyluuk Translator last edited by

                                          @8bit_astronaut No, I think it should also work without. But it is highly recommended 🙂

                                          NintendoRS | Nintendo Adapter Box | Cardboard Recalbox

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

                                            @8bit_astronaut Not at all. The internet connection is only useful for scraping directly with your recalbox or for accessing you share folder through your network.

                                            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