XBMC + ROM Collection Browser + retroarch: sound and joystick calibration

A new modification to applaunch.sh, so you calibrate and map the joystick and force mixer before launching the emulator.
Don’t take the arguments as is, they are just an example. Well, the amixer arguments force audio output to HDMI.


#!/bin/bash

# Check for arguments
if [ -z "$*" ]; then
echo "No arguments provided."
echo "Usage:"
echo "launcher.sh [/path/to/]executable [arguments]"
exit
fi

echo "Trying to stop xbmc "
sudo /etc/init.d/xbmc stop
# Deactivates HDMI output
sudo /opt/vc/bin/tvservice -o
# Activates HDMI output again
sudo /opt/vc/bin/tvservice -p

# Wait for the kill
sleep 1

# Joystick calibration and mapping
jscal -s 3,1,0,82,82,8388352,8134160,1,0,99,99,6882750,8388352,1,2,84,84,7254791,7063875 /dev/input/js0
jscal -u 3,0,1,6,4,288,289,290,291 /dev/input/js0
# Force audio output
amixer cset numid=3 2

echo "$@"

# Launch app - escaped!
"$@"

echo "Emulator terminated"

# Done? Restart XBMC
sudo /etc/init.d/xbmc start

Advertisements