• Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
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

Unable to control shell script with controller if the script is in "Ports"

Scheduled Pinned Locked Moved Help and Support
shell scriptcontrollerdialogkeyboardmapping
7 Posts 4 Posters 1.3k 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.
  • M
    madmodder123
    last edited by madmodder123 11 Aug 2017, 04:57 8 Nov 2017, 04:25

    RetroPie 4.3.4
    Raspberry Pi 3

    So whenever I have a shell script with a dialog menu (multiple options to choose from) it works just fine with my controller when I have it in the /home/pi/RetroPie/retropimenu folder, but when I move the same shell script to the /home/pi/RetroPie/roms/ports folder I am only able to navigate the dialog using the keyboard.

    What I have tried:
    creating a symlink from the working script to the ports folder (ln -s source_file destination_file)
    messing with permissions/ownership
    "resetromdirs" from retropie script
    trying different scripts
    creating a blank script with only the menu in it

    Is this some kind of "security feature"? Is there any way I can fix this? I don't want to have to move all my shell scripts that require input into the retropiemenu section.

    Thanks guys!

    M C 2 Replies Last reply 8 Nov 2017, 05:19 Reply Quote 0
    • M
      mitu Global Moderator @madmodder123
      last edited by 8 Nov 2017, 05:19

      @madmodder123 I think the RP dialog scripts are called after a 'joystick to keyboard' wrapper so that the controller can navigate/give input.
      See https://github.com/RetroPie/RetroPie-Setup/blob/08f9fc026a1d6718aba15d2f2a5b70be0195336b/scriptmodules/helpers.sh#L1003

      M 1 Reply Last reply 8 Nov 2017, 06:06 Reply Quote 1
      • M
        madmodder123 @mitu
        last edited by 8 Nov 2017, 06:06

        @mitu That would make sense. Now I am trying to figure out how to use that code with my script. I tried copying the functions and then calling them in my script but the controller remained unresponsive. If anyone has any ideas I would love some help.

        ~ Thanks again

        1 Reply Last reply Reply Quote 0
        • M
          madmodder123
          last edited by 11 Nov 2017, 07:04

          @psyke83
          I saw that you have done some stuff on GitHub on the code listed above, could you please help me with this? I tried using using:

          source "/home/pi/RetroPie-Setup/scriptmodules/helpers.sh" and then calling "joy2keyStart" & "joy2keyStop" functions within my script.
          I also tried copying both the joy2key functions from the helpers.sh file and calling then calling the functions but neither of these methods worked for me.
          Just to reiterate the script works fine when in the retropiemenu folder, but the same working script does not work in the RetroPie/roms/ports folder.

          Thanks!

          P 1 Reply Last reply 11 Nov 2017, 21:58 Reply Quote 0
          • C
            cyperghost @madmodder123
            last edited by 11 Nov 2017, 10:04

            @madmodder123 Can you post your script to github or pastebin?

            1 Reply Last reply Reply Quote 0
            • P
              psyke83 Global Moderator @madmodder123
              last edited by psyke83 11 Nov 2017, 22:16 11 Nov 2017, 21:58

              @madmodder123 said in Unable to control shell script with controller if the script is in "Ports":

              @psyke83
              I saw that you have done some stuff on GitHub on the code listed above, could you please help me with this? I tried using using:

              source "/home/pi/RetroPie-Setup/scriptmodules/helpers.sh" and then calling "joy2keyStart" & "joy2keyStop" functions within my script.
              I also tried copying both the joy2key functions from the helpers.sh file and calling then calling the functions but neither of these methods worked for me.
              Just to reiterate the script works fine when in the retropiemenu folder, but the same working script does not work in the RetroPie/roms/ports folder.

              Thanks!

              Unfortunately, the joy2key functions aren't available when launching a "port" script. I recently identified a few scripts that display dialog messages (that require input to dismiss), and worked around the issue by adding a timeout: https://github.com/RetroPie/RetroPie-Setup/pull/2183

              Take a look at my comment here to see what's necessary to get joy2key working in an external script: https://github.com/RetroPie/RetroPie-Setup/pull/2183#issue-270510263

              It's vital that the $scriptdir variable is correctly set (by default, it should be "/home/pi/RetroPie-Setup"), otherwise joy2KeyStart will not work as expected.

              As for the "retropiemenu", the reason why joy2key works is because your script is launched from here: https://github.com/RetroPie/RetroPie-Setup/blob/master/scriptmodules/supplementary/retropiemenu.sh#L163

              As you can see, joy2key will be running at this stage.

              M 1 Reply Last reply 11 Nov 2017, 23:54 Reply Quote 0
              • M
                madmodder123 @psyke83
                last edited by 11 Nov 2017, 23:54

                @psyke83 You are awesome, thanks a lot :)

                1 Reply Last reply Reply Quote 0
                7 out of 7
                • First post
                  7/7
                  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.

                  This community forum collects and processes your personal information.
                  consent.not_received