jetekteam / picontrol

Pi Control
9 stars 7 forks source link

Support for Attract Mode. #7

Open SMIBoy opened 7 years ago

SMIBoy commented 7 years ago

Hi! Thanks a lot for all your work, It's really awesome! Making some changes I got your scripts working with Attract Mode (It's not hard to get it working thanks to your so clean code, just changing some "emulationstation" process calls to "attract"). Please, can you consider to add the Attract Mode Interface support to your scripts? I think It would be awesome if both (Attract Mode and EmulationStation) were supported by picontrol. I think you can dos this in a cleanest way than me. If you need some help to test, please don't hesitate to contact me.

Here's the changes I've made:

1. After decompressing the picontrol.tar.gz, edit /home/pi/scripts/picontrol/setup.sh and change the lines:

#update startup
echo "Updating Startup Commands............."
sed -i '\:emulationstation #auto:d' /opt/retropie/configs/all/autostart.sh
sed -i '\:emulationstation:d' /opt/retropie/configs/all/autostart.sh
sed -i '\:python /home/pi/scripts/picontrol/picontrol.py&:d' /opt/retropie/configs/all/autostart.sh
echo 'python /home/pi/scripts/picontrol/picontrol.py&' >> /opt/retropie/configs/all/autostart.sh
echo 'emulationstation' >> /opt/retropie/configs/all/autostart.sh

for the following lines:

#update startup
echo "Updating Startup Commands............."
sed -i '\:attract #auto:d' /opt/retropie/configs/all/autostart.sh
sed -i '\:attract:d' /opt/retropie/configs/all/autostart.sh
sed -i '\:python /home/pi/scripts/picontrol/picontrol.py&:d' /opt/retropie/configs/all/autostart.sh
echo 'python /home/pi/scripts/picontrol/picontrol.py&' >> /opt/retropie/configs/all/autostart.sh
echo 'attract' >> /opt/retropie/configs/all/autostart.sh

2. Execute sudo sh ./setup.sh from picontrol directory.

3. Take a look at the next files:

1st File: /home/pi/scripts/picontrol/picontrol_button_classic.py Add "attract" if It's not at the procnames list variable.

2nd File: /home/pi/scripts/picontrol/picontrol_gameend.py I commented/deleted the line "subprocess.call('attract', shell=True)" because I don't want to turn to the Attract Mode main User Interface page when exit a game. I want to only exit the emulator an return where I was when I load the game. If you want to exit to the main User Interface when exit a game, just leave these lines as they are.

3rd File: /home/pi/scripts/picontrol/picontrol_gameend.py Make sure you have these lines:

if procs.process_exists("attract") == True:
procs.killTasks('attract')

If instead of "attract" you have "emulationstation" change it.

4th File: /home/pi/scripts/picontrol/picontrol_processes.py Change:

emulationstationRunning = process_exists('emulationstation')

procnames = ["retroarch", "ags", "uae4all2", "uae4arm", "capricerpi", "linapple", "hatari", "stella",
"atari800", "xroar", "vice", "daphne", "reicast", "pifba", "osmose", "gpsp", "jzintv",
"basiliskll", "mame", "advmame", "dgen", "openmsx", "mupen64plus", "gngeo", "dosbox", "ppsspp",
"simcoupe", "scummvm", "snes9x", "pisnes", "frotz", "fbzx", "fuse", "gemrb", "cgenesis", "zdoom",
"eduke32", "lincity", "love", "alephone", "micropolis", "openbor", "openttd", "opentyrian",
"cannonball", "tyrquake", "ioquake3", "residualvm", "xrick", "sdlpop", "uqm", "stratagus",
"wolf4sdl", "solarus", "emulationstation"]
killTasks(procnames)

pid = os.fork()
if not pid:
try:
if ((emulationstationRunning == False and source == '') or console == ''):
subprocess.call('emulationstation', shell=True)

for:

attractRunning = process_exists('attract')

procnames = ["retroarch", "ags", "uae4all2", "uae4arm", "capricerpi", "linapple", "hatari", "stella",
"atari800", "xroar", "vice", "daphne", "reicast", "pifba", "osmose", "gpsp", "jzintv",
"basiliskll", "mame", "advmame", "dgen", "openmsx", "mupen64plus", "gngeo", "dosbox", "ppsspp",
"simcoupe", "scummvm", "snes9x", "pisnes", "frotz", "fbzx", "fuse", "gemrb", "cgenesis", "zdoom",
"eduke32", "lincity", "love", "alephone", "micropolis", "openbor", "openttd", "opentyrian",
"cannonball", "tyrquake", "ioquake3", "residualvm", "xrick", "sdlpop", "uqm", "stratagus",
"wolf4sdl", "solarus", "emulationstation", "attract"]
killTasks(procnames)

pid = os.fork()
if not pid:
try:
if ((attractRunning == False and source == '') or console == ''):
subprocess.call('attract', shell=True)
jetekteam commented 7 years ago

Thanks for your post. Jared will look into updating the code when he has time.

SMIBoy commented 7 years ago

Hi, I'm back from holidays! Thank you very much, if you need someone to test don't hesitate to contact me. I'm experiencing some problems with the "reset" button in Attract Mode, seems like it can't recall itself (process attract) without becoming unstable.

RetroAsylum79 commented 6 years ago

I too would love to see picontrol working with the Attract Mode frontend. Has any progress been made as of yet?