4 de octubre de 2014

XBMC, Advanced Launcher y Mednafen

1) En la configuración de Advanced Launcher, habilitar la opción de minimizar xbmc al arranque y apuntar el comando a un script creado en algún lado, por ejemplo: MEDNAFEN.sh

2) Llenar el script con el siguiente contenido:


#!/bin/bash

#
# Script to launch emulators.
# For use with Advanced Launcher in XBMC
#
# v1.0 - Firas AlShafei - 02/05/2013
# - Initial Version
#


exec 3>&1 4>&2
trap 'exec 2>&4 1>&3' 0 1 2 3
exec 1>$(dirname $0)/mednafen.log 2>&1

# turn off dpms
xset -dpms

# turn off screensaver/screenblank
xset s off

# Pause XBMC
kill -STOP `ps aux | grep xbmc.bin | grep -v grep | awk '{print $2}'`

# Launch zsnes with provided rom
/ruta/a/mednafen/mednafen -fs 1 "$1"

# Resume XBMC Process
kill -CONT `ps aux | grep xbmc.bin | grep -v grep | awk '{print $2}'`

# Check id XBMC is in idle mode
isIdle=`curl -H "Content-Type: application/json" -i -u USUARIO:USUARIO -X POST -d '{"jsonrpc": "2.0", "method": "XBMC.GetInfoBooleans", "params": { "booleans": ["System.ScreenSaverActive "] }, "id": 1}' http://xbmc:8080/jsonrpc | grep result | awk '{print $2}' | sed 's/"\|:\|}//g'`
echo XBMC Returned System.ScreenSaverActive: $isIdle

# If XBMC is idle send a keypress to wake it so Advanced Launcher can issue the maximize command
if $isIdle ; then
   echo Detected ScreenSaver - Send input command to clear it
   curl -H "Content-Type: application/json" -i -u USUARIO:USUARIO -X POST -d '{"jsonrpc": "2.0", "method": "Input.Up"}' http://localhost:8080/jsonrpc
fi

# turn on dpms
xset +dpms

# turn on screensaver/screenblank
xset s on



Se puede habilitar las opciones comentadas con #. Cambiar USUARIO:USUARIO por el nombre de usuario correspondiente. Esto corrige problemas de protector de pantalla y evita que XBMC quede minimizado después de cerrar el emulador.