Recalbox Forum

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

    Solved Game Reset

    Recalbox General
    reset
    4
    34
    15203
    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.
    • lackyluuk
      lackyluuk Translator last edited by

      Hello 🙂

      I have a question regarding the reset of a game. While playing a game you can reset the game (only the game) with hotkey + A.
      Is it possible to call this command bia a GPIO input? Because I do not want to reset the whole system when I push my reset button.

      Thank you 🙂
      Cheers lackyluuk

      NintendoRS | Nintendo Adapter Box | Cardboard Recalbox

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

        Hi,

        It may be possible by creating a python script but I don't know what command should be sent to retroarch for this.

        @subs ?

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

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

          Mmmhhhhh there is a way : retroarch network commands ! Tjat's basically sending a command on a specific port that retroech listens. The available commands are listed on the retroach do

          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é

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

            then it should be easily sent via a python script listening to GPIOs 🙂

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

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

              I should upvote myself for such clever ideas ^^

              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é

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

                Okay 😄 thank you for your answers. I will have a look at the retroarch commands and if I have a solution i will tell you

                NintendoRS | Nintendo Adapter Box | Cardboard Recalbox

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

                  Yes please keep us informed 🙂

                  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é

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

                    I think I have found something. But due to holidays I am not able to test it next week. There will be an updaye the week after 🙂

                    NintendoRS | Nintendo Adapter Box | Cardboard Recalbox

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

                      import socket
                      
                      s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
                      s.connect(('127.0.0.1', 55355))
                      print s.send("RESET")
                      s.close()
                      

                      This works. Gotta embed it in a gpio handling stuff. @supernature2k will do that, i can't test such things

                      you need to add network_cmd_enable = "true" in your retroarcdh config files to be sure

                      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é

                      1 Reply Last reply Reply Quote 1
                      • supernature2k
                        supernature2k last edited by

                        full python script with GPIO: (pin 5 and 6)

                        import RPi.GPIO as GPIO
                        import time
                        import socket
                        # addressing information of target
                        IPADDR = "127.0.0.1"
                        PORTNUM = 55355
                         
                        # enter the data content of the UDP packet
                        COMMAND = "RESET"
                         
                        # initialize a socket, think of it as a cable
                        # SOCK_DGRAM specifies that this is UDP
                        try:
                            s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
                        except socket.error:
                            print 'Failed to create socket'
                            sys.exit()
                        
                        GPIO.setmode(GPIO.BCM)
                        GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP)
                        
                        def exitEmulator(channel):
                        	s.sendto(COMMAND, (IPADDR, PORTNUM))
                            
                        GPIO.add_event_detect(3, GPIO.FALLING, callback=exitEmulator, bouncetime=500)
                        
                        while True:
                            time.sleep(10)
                        

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

                        1 Reply Last reply Reply Quote 3
                        • lackyluuk
                          lackyluuk Translator last edited by

                          D**n, you two are unbelievable GREAT! I am still on holidays 😞
                          Today in the morning I read about the "Exit Emulator GPIO" thread and thought "That's it" 😄

                          What about a nerdy Wiki article about network commands via console and python? Would it be worth to write @supernature2k @subs ? (I could do it).

                          NintendoRS | Nintendo Adapter Box | Cardboard Recalbox

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

                            Yes sure, you can create a new wiki entry.

                            Network commands are detailed here:

                            https://github.com/libretro/RetroArch/wiki/Network-Commands

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

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

                              @lackyluuk so far it's still some nerdy fun on one's side, but things can get REALLY better and in that case, it would be worth a wiki

                              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é

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

                                @supernature2k I am working on a wiki page and I am currently implementing the solution to my N64 Mod 🙂 But somehow it does not work. In retroarch config I changed the line to network_cmd_enable = "true" and the script is running (Command is sent). But nothing happens if i press the reset button.

                                NintendoRS | Nintendo Adapter Box | Cardboard Recalbox

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

                                  I am sorry for the trouble. I had a config mess. Now it works. I accessed the config with the hotkey and then turned the commands on and saved. It works now. Thanky anyway for all your help 🙂

                                  NintendoRS | Nintendo Adapter Box | Cardboard Recalbox

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

                                    glad it works pal 🙂 Anyway, i think we gotta make it "nicer" fr 4.1, or 4.2

                                    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é

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

                                      @subs and @supernature2k : Wiki pages in english and german are done 🙂
                                      Since english is not my native language, could you please review the english version and correct it if needed? Thank you

                                      https://github.com/recalbox/recalbox-os/wiki/RetroArch-Network-Commands-(EN)

                                      https://github.com/recalbox/recalbox-os/wiki/RetroArch-Network-Commands-(DE)

                                      NintendoRS | Nintendo Adapter Box | Cardboard Recalbox

                                      Substring 1 Reply Last reply Reply Quote 1
                                      • Substring
                                        Substring @lackyluuk last edited by Substring

                                        @lackyluuk That's some very good work, thank you for the time you spent on it 🙂

                                        But i wouldn't call it "retroarch network commands" since it's definitely not "appealling". The aim is to make a gpio button "interact" with the emulators, so i think the title could be somethink like "map a GPIO button for various emulators interactions". Most of times, as you said in the wiki, it's for some original cases modding ... Remember we can also kill any running emulator, which is not part of your wiki (need a forum link ?)

                                        Or something like "mod an original case : map buttons to GPIO and make them interact with recalbox" ? And add a link to the start stop button wiki ?

                                        Maybe it should even be a new section ? Knowing that there has been some huge steps forward concernaning the RGB output ...

                                        @supernature2k still working on a nice and "easy to setup" gpio handling for retroach network commands + killing emulators ?

                                        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é

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

                                          @subs: Thanks for the feedback. Sure, I can change it and add also other stuff to have all the belonging things in one place.
                                          I just thinking about the title since it is actually not just about the gpio pins, but also just about sending network commands to RetroArch e.g. via the command line. I will think about it 🙂

                                          Could you please provide me all necessary links which should be referred or mentioned in this topic?

                                          NintendoRS | Nintendo Adapter Box | Cardboard Recalbox

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

                                            https://forum.recalbox.com/topic/3504/emulator-exit-button-gpio/7 the other link i thought about

                                            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é

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

                                            Want to support us ?

                                            89
                                            Online

                                            99.6k
                                            Users

                                            28.1k
                                            Topics

                                            187.1k
                                            Posts

                                            Copyright © 2021 recalbox.com