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

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

          @supernature2k hey mate 🙂 not sure if I should open a new thread.
          I am using the RESET script you posted in this thread for a long time. But since I have updated to 4.1 stable, the script is somehow messing up retroarch.

          As soon as I press my Reset button on the console it works exactly 1 time. After this no retroarch special commands work anymore, not even on the controller (No Hotkey+Start to exit the game, reset, rewind, save, load etc.). I can still enter the RetroArch settings with Hotkey+A but then it freezes there and I have to turn off the Raspi by pull out the plug.

          I think it's a script problem because the Hotkey commands work flawlessly on the controller. But once I used the Hardware Reset button with this script, all is bad. Any idea on that? 🙂

          NintendoRS | Nintendo Adapter Box | Cardboard Recalbox

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

            @Substring hey pal 🙂 is @supernature2k not available these days? 🙂 Maybe you have an idea on the topic above?

            NintendoRS | Nintendo Adapter Box | Cardboard Recalbox

            Substring supernature2k 2 Replies Last reply Reply Quote 0
            • Substring
              Substring @lackyluuk last edited by

              @lackyluuk I'd also ask @OyyoDams who's been working on a much more global python script to handle any kind of "known" event (which would fit with the volume change for alsa you wrote in your wiki for example).

              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 @lackyluuk last edited by

                @lackyluuk

                Hi bro, I tested my script and it works fine, I can do several RESET, exit,re-enter the game and do it again.

                could you please try this:

                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"
                
                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.setmode(GPIO.BCM)
                GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP)
                
                def netcmd(channel):
                	retroarch(nwcommand)
                    
                GPIO.add_event_detect(3, GPIO.BOTH, callback=netcmd, bouncetime=500)
                
                while True:
                    time.sleep(0.2)
                

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

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

                  @supernature2k Thanks for your help. I tried as you proposed but it still doesn't work 😕
                  I replaced

                  def netcmd(channel):
                      retroarch(nwcommand)
                  

                  with

                  def netcmd(channel):
                        retroarch(COMMAND)
                  

                  I can use this script only once. Really no idea why it stucks..
                  I also tried to close the socket with s.close

                  NintendoRS | Nintendo Adapter Box | Cardboard Recalbox

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

                    @supernature2k Hi,

                    I do have the same issue. Even with the simple echo -n "RESET" | nc -u -w1 192.168.1.172 55355 command from my computer, retroarch only responds to one kind of each event. I can't send the same command twice...

                    supernature2k 2 Replies Last reply Reply Quote 0
                    • supernature2k
                      supernature2k @OyyoDams last edited by

                      @oyyodams Hi

                      I really can't say where the issue is. If you say this cmd doesn't work, it looks like a RA problem.

                      But I tested my script on my 17.10.2 recalbox and I can send multiple RESET, exit game re-enter game and it still works O_o

                      What if you send the cmd to localhost (127.0.0.1) ?

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

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

                        @oyyodams

                        Ok so I did more tests and got strange behaviors. With the command you provided or via a simple script, RESET works 1 time only but... if you throw a QUIT, it works O_o

                        then I did the following:

                        ~$ echo -n "LOAD_STATE" | nc -u -w1 192.168.1.30 55355
                        ~$ echo -n "RESET" | nc -u -w1 192.168.1.30 55355
                        ~$ echo -n "LOAD_STATE" | nc -u -w1 192.168.1.30 55355
                        

                        1st command: success
                        2nd command: success
                        3rd command: fail

                        O_o

                        This is definitely a strange behavior from RA.
                        I tested this on my X86_64 recalbox, I'll do more test tonite on the rpi3 one.

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

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

                          @supernature2k thanks for your effort.
                          for me it's also still the same. I use ocal host 127.0.0.1.
                          With the controller everything works fine.

                          NintendoRS | Nintendo Adapter Box | Cardboard Recalbox

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

                            @lackyluuk more to come tonite as I'm 100% sure it works on my 17.11.10.2 rpi3. Maybe smthg in the retroarch.cfg?

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

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

                              @supernature2k same thing with localhost. Even with a simple python script. Like with your last example, I can send several commands if they are different, but I cannot send the same command more than one time. RA doesn't accept the same command more than once. We can talk on IRC if you want 🙂

                              My retroarchcustom.cfg is simple, I've juste added network_cmd_enable = true. Maybe there is something else to add, but I can't find what. I tried stdin_cmd_enable = true but it doesn't change anything.

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

                                @OyyoDams @supernature2k
                                Many thanks to the recalbox developer team. The commands are working great again with the new release 🙂

                                NintendoRS | Nintendo Adapter Box | Cardboard Recalbox

                                supernature2k OyyoDams 2 Replies Last reply Reply Quote 0
                                • supernature2k
                                  supernature2k @lackyluuk last edited by

                                  @lackyluuk thanks to RA team that accepted our merge request with the fix very quickly and included it in their last release 🙂

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

                                  1 Reply Last reply Reply Quote 1
                                  • OyyoDams
                                    OyyoDams Staff @lackyluuk last edited by

                                    @lackyluuk thanks to @supernature2k who found the bug, and to the RA team for the quick fix 🙂

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

                                    Want to support us ?

                                    83
                                    Online

                                    99.6k
                                    Users

                                    28.1k
                                    Topics

                                    187.1k
                                    Posts

                                    Copyright © 2021 recalbox.com