RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    Getting the rom name and emulator

    Scheduled Pinned Locked Moved General Discussion and Gaming
    pi model v3pythonscriptretropiesetup
    82 Posts 5 Posters 19.7k 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.
    • cyperghostC
      cyperghost @cyperghost
      last edited by cyperghost

      @daveyman123
      Well there could be a method that should work.

      You write the $3 argument to a file on runcommand-onstart.sh

      echo $3 > /home/pi/unicorn.txt
      sudo python onstart2.py &
      

      Open the file /home/pi/unicorn.txt in python for every loop and dispaly the string from written file to your program

      Then on runcommand-onend.sh

      echo "killterm" > /home/pi/unicorn.txt
      

      you write on killterm to the same file as on runcommand-onstart.sh
      Within python you analyse the content of unicorn.txt
      if it's not "killterm" then the unicorn flys, if it's killterm the python program ends

      BUT THAT'S A MESSY STYLE!!!

      D 1 Reply Last reply Reply Quote 0
      • D
        daveyman123 @cyperghost
        last edited by

        @cyperghost
        I use sudo because it wont run otherwise
        lol its ok that your code is sloppy im a newbie and cant tell the difference

        as for the python script. I think the problem lies in something to do with RetroPie being an experimental OS for the unicorn.

        here is my code in the python script

        
        from UHScroll import *
        import sys
        import time
        import os
        import unicornhat as unicorn
        
        rom_name = os.path.basename(os.path.normpath(sys.argv[3]))
        
        unicorn_scroll(rom_name,'white',255,0.2)
        

        this produces the result of freezing half way through writing "GOLDENEYE". e.g it prints "GOLDEN" then freezes.

        1 Reply Last reply Reply Quote 0
        • meleuM
          meleu @cyperghost
          last edited by

          @cyperghost said in Getting the rom name and emulator:

          Is there a better way to end a process running in background?

          My favorites are using pgrep/pkill.

          @daveyman123 I'm confused about this unicorn stuff. Can you explain what exactly you want to do and what info you need from runcommand?

          • Useful topics
          • joystick-selection tool
          • rpie-art tool
          • achievements I made
          cyperghostC 1 Reply Last reply Reply Quote 0
          • cyperghostC
            cyperghost @meleu
            last edited by cyperghost

            @meleu and what about the method here
            I thought killing processes by pkill/kill is bad style? Isn't it not?

            meleuM 1 Reply Last reply Reply Quote 0
            • SanoS
              Sano
              last edited by

              SIGKILL (-9) is bad, SIGTERM (-15) is totally normal.
              Default behaviour of kill/pkill is to send a SIGTERM.

              1 Reply Last reply Reply Quote 1
              • meleuM
                meleu @cyperghost
                last edited by

                @cyperghost said in Getting the rom name and emulator:

                I thought killing processes by pkill/kill is bad style? Isn't it not?

                IMHO this is THE method for killing processes. :)

                I think we can strongly simplify things here, but I don't know what exactly @daveyman123 wants to do nor what exact info his python script needs.

                • Useful topics
                • joystick-selection tool
                • rpie-art tool
                • achievements I made
                D cyperghostC 2 Replies Last reply Reply Quote 0
                • D
                  daveyman123 @meleu
                  last edited by

                  @meleu
                  you mean how can i replicate the scrolling text on the unicorn using bash?

                  Right now its done using a script i got off github https://github.com/topshed/UnicornHatScroll/blob/master/UHScroll.py

                  I think the problem is however that as soon as runcommand-onstart.sh exits the python script stops running

                  I will look into cyperghost's loop.sh example again and see if that works to put the python script in there

                  meleuM cyperghostC 2 Replies Last reply Reply Quote 0
                  • meleuM
                    meleu @daveyman123
                    last edited by

                    @daveyman123 do you want the text scrolling during all the time the emulator is running?

                    • Useful topics
                    • joystick-selection tool
                    • rpie-art tool
                    • achievements I made
                    1 Reply Last reply Reply Quote 0
                    • cyperghostC
                      cyperghost @meleu
                      last edited by

                      @meleu Now I'm surprised :D meleu the p-killer :)

                      I think @daveyman123 wants to scroll romname on the hat.

                      D 1 Reply Last reply Reply Quote 0
                      • D
                        daveyman123 @cyperghost
                        last edited by

                        @cyperghost

                        yes. and to be honest this is for a customer on freelancer paying me 20 bucks.
                        if you guys get it to work I will pay you each 10 dollars on paypal.

                        meleuM 1 Reply Last reply Reply Quote 2
                        • meleuM
                          meleu @daveyman123
                          last edited by

                          @daveyman123 damn! It can be a crazy thing, but when there is money involved part of the willing decreases... :)

                          I'll try to help you anyway... hold on a little.

                          • Useful topics
                          • joystick-selection tool
                          • rpie-art tool
                          • achievements I made
                          D 1 Reply Last reply Reply Quote 0
                          • D
                            daveyman123 @meleu
                            last edited by

                            @meleu
                            @cyperghost
                            where are you guys from? :)

                            cyperghostC meleuM 2 Replies Last reply Reply Quote 0
                            • cyperghostC
                              cyperghost @daveyman123
                              last edited by cyperghost

                              @daveyman123 I think you better give the 20 bucks to @meleu and he buys me a Caipirinha :).
                              img

                              @meleu Nice selfie!

                              meleuM 1 Reply Last reply Reply Quote 0
                              • meleuM
                                meleu @daveyman123
                                last edited by

                                @daveyman123 you may know my compatriot here:
                                blanka

                                • Useful topics
                                • joystick-selection tool
                                • rpie-art tool
                                • achievements I made
                                1 Reply Last reply Reply Quote 0
                                • D
                                  daveyman123
                                  last edited by

                                  https://gyazo.com/fdca868affb3ecd1f7c6f6accf2bd267
                                  gif showing progress so far

                                  1 Reply Last reply Reply Quote 0
                                  • meleuM
                                    meleu @cyperghost
                                    last edited by

                                    @cyperghost said in Getting the rom name and emulator:

                                    @daveyman123 I think you better give the 20 bucks to @meleu and he buys me a Caipirinha :)

                                    Let me know when you come to Rio de Janeiro and we'll drink some Caipirinhas and try to find some arcade to play Street Fighter or something. :)

                                    • Useful topics
                                    • joystick-selection tool
                                    • rpie-art tool
                                    • achievements I made
                                    cyperghostC 1 Reply Last reply Reply Quote 0
                                    • cyperghostC
                                      cyperghost @meleu
                                      last edited by cyperghost

                                      @meleu Don't make any jokes! My company got's a branch office in south america. For three or four weeks a company pal was in Rio to sell goods and he visited his girlfriend there. So it could happen I'm in :) It's unlikly but never say never :)

                                      SFII? I was more addicted to MK! But for the Caipis sake :)

                                      meleuM 1 Reply Last reply Reply Quote 1
                                      • SanoS
                                        Sano
                                        last edited by Sano

                                        You could try something like

                                        sleep 5
                                        while [$(pidof retroarch)]
                                            do
                                            *script to scroll once*
                                            sleep 5
                                        done
                                        

                                        Lauched in background by runcommand-onstart.

                                        cyperghostC 1 Reply Last reply Reply Quote 1
                                        • D
                                          daveyman123
                                          last edited by

                                          20 bucks to @meleu it is

                                          1 Reply Last reply Reply Quote 0
                                          • meleuM
                                            meleu @cyperghost
                                            last edited by

                                            @cyperghost it's not a joke! Consider yourself invited. Any game is fun with enough alcohol and friends. :-)

                                            • Useful topics
                                            • joystick-selection tool
                                            • rpie-art tool
                                            • achievements I made
                                            1 Reply Last reply Reply Quote 1
                                            • First post
                                              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.