• 0 Votes
    3 Posts
    6k Views
    johnodonJ

    Thanks @brandflake11

    I got this one figured out. It was a PITA! :)

    Long and short of it is this...

    xrandr treats both displays and one large one (extended). You can see below that Screen 0: is recognized as 5760x1080 (4K TV + 1080P monitor):

    Screen 0: minimum 320 x 200, current 5760 x 1080, maximum 16384 x 16384 VGA-1 disconnected (normal left inverted right x axis y axis) DP-1 disconnected (normal left inverted right x axis y axis) HDMI-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 800mm x 450mm 3840x2160 30.00 + 24.00 29.97 23.98 4096x2160 30.00 24.00 29.97 23.98 1920x1080 60.00* 59.94 30.00 24.00 29.97 23.98 1920x1080i 60.00 59.94 1680x1050 59.88 1280x1024 75.02 60.02 1440x900 59.90 1280x960 60.00 1280x800 59.91 1152x864 75.00 1280x720 60.00 30.00 59.94 29.97 24.00 23.98 1024x768 75.03 70.07 60.00 800x600 72.19 75.00 60.32 720x480 60.00 59.94 720x480i 60.00 59.94 640x480 75.00 72.81 60.00 59.94 720x400 70.08 DP-2 connected 1920x1080+3840+0 (normal left inverted right x axis y axis) 509mm x 286mm 1920x1080 60.00*+ 50.00 59.94 1920x1080i 60.00 50.00 59.94 1680x1050 59.88 1280x1024 60.02 1440x900 59.90 1280x800 59.91 1152x864 75.00 1280x720 60.00 50.00 59.94 1024x768 70.07 60.00 800x600 60.32 56.25 720x576 50.00 720x480 60.00 59.94 640x480 66.67 60.00 59.95 59.94 720x400 70.08 HDMI-2 disconnected (normal left inverted right x axis y axis)

    This is what my autostart.sh file looks like:

    #! /bin/bash #set primary display and resolution. xrandr --display :0 --output HDMI-1 --mode 1920x1080 --primary & #call cvlc to play a startup animation. Wait for it to end before continuing. cvlc --random --play-and-stop --play-and-exit --fullscreen --video-on-top --no-video-title-show --quiet --gl=any --preferred-resolution=1080 ~/RetroPie/splashscreens &> /dev/null #start ES in a terminal (openbox). gnome-terminal --full-screen --hide-menubar -- emulationstation --no-splash

    Naturally, feh sees the display the same way so you need to use the --geometry switch to identify the starting pixel on the 2nd monitor. This is what my runcommand-onstart.sh looks like:

    #! /bin/bash ROMPATH="$3" ROM_BN_EXT="${ROMPATH##*/}" ROM_BN="${ROM_BN_EXT%.*}" CONTROLSIMAGE="/home/pi/RetroPie/roms/$1/images/$ROM_BN-controls.png" feh --geometry +3840+0 "$CONTROLSIMAGE" &>/dev/null &

    This essentially gets the full path to the romfile and trims the extension to get the rom base name.
    It then builds the path to the controls image I need and displays at the starting position I tell it to (3840x0) which is the entire screen of the 2nd monitor. When I exit the game, and merely kill feh via runcommand-onend.sh:

    #! /bin/bash killall feh &

    This is working perfectly. Now I just need to find a fancy graphic to display on the 2nd monitor when it isn't showing controls. :)

    John

  • 0 Votes
    26 Posts
    2k Views
    KrakatoaK

    @WeirdH I fixed that issue by using brackets around the code.

  • Moves List Viewer

    Help and Support
    5
    0 Votes
    5 Posts
    2k Views
    K

    yep doing it as an overlay is a great idea,you have to sacrifice some screen space though,and it wont go well with games that have many characters such as King Of Fighters but it will work with most games..so thanks

  • 0 Votes
    20 Posts
    6k Views
    *

    @sinibomb

    This was just a simple change to the popular shutdown button script

    But this played two audio files and displays an image on Shutdown, change .wav and .PNG file names to suit

    shutdown.py

    #!/usr/bin/python import RPi.GPIO as GPIO import time import subprocess # we will use the pin numbering to match the pins on the Pi, instead of the # GPIO pin outs (makes it easier to keep track of things) GPIO.setmode(GPIO.BOARD) # use the same pin that is used for the reset button (one button to rule them all!) GPIO.setup(5, GPIO.IN, pull_up_down = GPIO.PUD_UP) oldButtonState1 = True while True: #grab the current button state buttonState1 = GPIO.input(5) # check to see if button has been pushed if buttonState1 != oldButtonState1 and buttonState1 == False: # start playing silence to keep audio channel open to prevent missing beginning audio myinput = open('/dev/zero') subprocess.Popen(['/usr/bin/aplay', '-c2', '-r48000', '-fS16_LE', '-N' ], stdin=myinput ) # start showing screen (underneath emulationstation) subprocess.call("/home/pi/scripts/showImg.sh", shell=True) time.sleep(1) # play audio 1
    subprocess.call("/usr/bin/aplay /home/pi/scripts/audio_1.wav", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) time.sleep(2) # quit emulation station subprocess.call("killall -SIGQUIT emulationstation", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) time.sleep(1) # play audio 2 subprocess.call("/usr/bin/aplay /home/pi/scripts/audio_2.wav", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) time.sleep(3) # shutdown subprocess.call("shutdown -h now", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) oldButtonState1 = buttonState1 time.sleep(.5)

    showImg.sh

    #!/bin/sh sudo /usr/bin/fbi -T 2 -once -t 30 -noverbose -a "/home/pi/scripts/image.png" &