Getting the rom name and emulator
-
@daveyman123 got it. I'll try something when I get home (it means 4 or 5 hours).
-
@meleu
oh goshI may have it figured out by then ;)
-
@meleu @daveyman123 It's late here - going to sleep.
Good night mates@daveyman123
That's the wrong intention. The script should do the loop not a bash file. The bash file should only tell changes. Because you always load the python interpreter again and again and this will waste resources and even the python language gives you much much controll over strings. So I would rather use python intead of bash.@meleu will certainly find an easy and working solution ;)
-
@daveyman123 said in Getting the rom name and emulator:
I may have it figured out by then ;)
better yet!
-
@daveyman123 said in Getting the rom name and emulator:
I will look into cyperghost's loop.sh example again and see if that works to put the python script in there
The loop example is useless. You should look the
runcommand-onstart.sh
and how scripts are called and running in background. If you were able to readout files you can simply write the romname viaecho $3
to a file or you can directly call the python script with $3 command.I think @meleu will do a nice job but meanwhile you can also try to find a solution. I'm 100% sure you find one!
Good night -
@daveyman123 Here are some ideas to let you find the solution yourself...
Use this code as inspiration for your
runcommand-onstart.sh
:# getting the rom name with no full path and no extension rom_name="$(basename "${3%.*}")" # running the python script in background sudo /path/to/python/code.py "$rom_name" &
This one as inspiration for your
runcommand-onend.sh
:# killing the python script sudo pkill -f "/path/to/python/code.py"
And this one as inspiration for your python script:
#!/usr/bin/python # I don't know if it's right, just used @daveyman123 code as example from UHScroll import * import unicornhat as unicorn import time sys while True: # I have no idea if this command is right, I just used @daveyman123 code as example unicorn_scroll(sys.argv[1], 'white', 255, 0.2) # I have no idea if 5 seconds is OK, adapt it to your needs time.sleep(5)
-
@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 -
@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" &
-
@Sano
nohup was nohelp... lolsomething is happening at the level of the pins i believe
-
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... -
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
-
nah thats not it. The driver packages for GPIO controllers isnt installed
-
I got it to work with a different game "super mario for snes" so... the problem must be in the emulator settings
-
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
-
@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. -
@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. ;-)
-
will do!
-
@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! ...
-
-
@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 :)
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.