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.1k 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.
    • D
      daveyman123 @meleu
      last edited by

      @meleu
      there is still the problem of (i dont know if i mentioned it) the unicorn only scrolls through ONCE (even if i include a loop in python) then it will play a random sequence of lights. I.E. it reads "JIM" or "GOLDEN" in "GOLDENEYE". But as soon as the game launches it freezes or plays random lights.

      My fear is it has something to do with the pins being messed with by retropie. I have not tried to replicate the problem on raspbian.. but I may have to try that.

      What I have tried:
      making sure audio isnt interfering with the unicorn hat pins (i.e. setting the audio output to hdmi)
      and obviously have tried making the python script run in the background

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

        @meleu said in Getting the rom name and emulator:

        sudo /path/to/python/code.py "$rom_name" &

        Try to modify this line like this :

        sudo nohup /path/to/python/code.py "$rom_name" &
        
        1 Reply Last reply Reply Quote 0
        • D
          daveyman123
          last edited by

          @Sano
          nohup was nohelp... lol

          something is happening at the level of the pins i believe

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

            Ok sorry, could you try

            nohup sudo /path/to/python/code.py "$rom_name" &
            

            (possibly with quotes)
            I'm pretty sure it's because the parent process (runcommand-onstart) terminates before game launch, so the child are killed, including your script.
            This could be solved with the use of nohup, if I ever remember the correct syntax with sudo...

            D meleuM 3 Replies Last reply Reply Quote 0
            • D
              daveyman123 @Sano
              last edited by

              @sano

              does nothing when i do that

              my hunch is it has to do with the support for GPIO controllers in retropie. I could be wrong

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

                nah thats not it. The driver packages for GPIO controllers isnt installed

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

                  I got it to work with a different game "super mario for snes" so... the problem must be in the emulator settings

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

                    I think ive pretty much figured it out boys thanks to your help

                    first one to link their paypal gets 20 dollars when freelancer clears

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

                      @sano said in Getting the rom name and emulator:

                      I'm pretty sure it's because the parent process (runcommand-onstart) terminates before game launch, so the child are killed

                      I'm afraid this isn't true. Once a process is forked it doesn't depends on his parent life (oh these childrens of today...).

                      I didn't test with the actual -onstart script, but tested a similar scenario in command line before posting.

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

                        @daveyman123 said in Getting the rom name and emulator:

                        first one to link their paypal gets 20 dollars when freelancer clears

                        If you click on my name at right of my avatar you can see it on my profile page. ;-)

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

                          will do!

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

                            @sano Here is a way to prove what I said:

                            [PROMPT]$ cat father.sh
                            #!/bin/bash
                            echo "FATHER: Hello, I am the father."
                            echo "FATHER: Hey son, say hello to the world!"
                            bash son.sh &
                            sleep 10
                            echo "FATHER: Oh no! I am going to die! NOOOOOoooooo..."
                            sleep 1
                            echo "FATHER: bye!"
                            exit
                            
                            [PROMPT]$ cat son.sh
                            #!/bin/bash
                            while true; do
                                echo "SON: Hello World!"
                                sleep 2
                            done
                            
                            [PROMPT]$ bash father.sh
                            FATHER: Hello, I am the father.
                            FATHER: Hey son, say hello to the world!
                            SON: Hello World!
                            SON: Hello World!
                            SON: Hello World!
                            SON: Hello World!
                            SON: Hello World!
                            FATHER: Oh no! I am going to die! NOOOOOoooooo...
                            SON: Hello World!
                            FATHER: bye!
                            
                            [PROMPT]$ SON: Hello World!
                            SON: Hello World!
                            SON: Hello World!
                            SON: Hello World!
                            SON: Hello World!
                            SON: Hello World!
                            SON: Hello World!
                            SON: Hello World!
                            ...
                            
                            • Useful topics
                            • joystick-selection tool
                            • rpie-art tool
                            • achievements I made
                            cyperghostC 1 Reply Last reply Reply Quote 2
                            • cyperghostC
                              cyperghost @meleu
                              last edited by

                              @meleu I made same intention here
                              Every 5 seconds one entry is written in log file for 10 times. After a minute or of intensive gaming (Joust Arcade!) you can check tmp/counter.log voila... entry of used Arcade system is there 10 times :)

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

                                @meleu @cyperghost
                                My bad then, you're right of course ;)

                                Edit : my guess would only be valid (I think) if the user launching the script disconnects afterward, which is not the case here.
                                I was probably misled by the statement that the scrolling stops when the game launch.
                                It was late here anyway, I was drunk, and my cat was distracting me.
                                Well, enough justifications I think. I'm just obviously no good at this :)

                                cyperghostC 1 Reply Last reply Reply Quote 1
                                • cyperghostC
                                  cyperghost @Sano
                                  last edited by

                                  @sano The father & son example of @meleu is very reasonable.
                                  High laughter for this :)

                                  Where is grandma-bash? Will son-bash be father soon?

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

                                    @cyperghost @Sano
                                    One more note: the init process (the famous "PID 1") is the orphanage. When a parent process dies, its orphan children are "adopted" by init.

                                    Play a little with that father & son example and check the process table with the ps -alf. Look at the PPID column of the son.shprocess before and after the father.sh's death. ;)

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

                                      @meleu I see, so the PID changes after the father is dead. So it's necessary to check PID during run if I want to elemenate son.sh
                                      That's indeed interesting and I hopefully will remember if I'm in need to kill everlasting bash process!

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

                                        @cyperghost said in Getting the rom name and emulator:

                                        @meleu I see, so the PID changes after the father is dead. So it's necessary to check PID during run if I want to elemenate son.sh

                                        No, no! What changes is the PPID (Parent's PID)! The PID never changes!

                                        • 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 Thank you for clearance. But is the PPID in any way important or is there a usecase? (maybe dumb question?)

                                          EDIT:
                                          Answered myself. The PPID gives relationship of calls so you always know which programm started process x or process y. Helpfull indeed!

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

                                            @cyperghost it's not a dumb question at all :)

                                            You can commit a genocide with a Parent's PID.

                                            If a father's PID is 123, you can kill it and all its descendants with

                                            kill -9 -123
                                            

                                            But you wouldn't do such villainy, would you?

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