I ran into a problem where XBMC would stay in windowed mode after exiting an emulator. The problem only seemed to occur if i played for a while.
I went over your code and watched the debug log and found out that it was screensaver related. It seems that XBMC ignores your first command after returning, it uses it to clear its screensaver state instead of actually taking the FullScreen command.
You can test it by setting the screensaver timeout in xbmc to 1 minute, wait until it's idle, and issue a JSON command to toggle fullscreen. The command will not execute while XBMC is in idle mode - you will have to execute it twice, once to clear the idle mode and once to actually toggle fullscreen.
I was able to fix this in my launch script by detecting if xbmc is idle and issuing an input, this serves to bring it out of idle mode before Advanced Launcher issues the toggle fullscreen command.
I just figured i would share my launch script in here - might help someone else who's seeing the same issue.
Code:
#!/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_genesis.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}'`
# Restart XBOX360 Controller Driver
# service xboxdrv-rc restart
# Launch zsnes with provided rom
/home/xbmc/Games/Sega\ Genesis/Emulator/mednafen -fs 1 "$1"
# Restart XBOX360 Controller Driver
#service xboxdrv-rc restart
# 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 xbmc:xbmc -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 xbmc:xbmc -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
Usage Requirements:
-
Enable JSON-RPC
- Replace the username/password (xbmc:xbmc) in the script curl commands with your own, or remove them completely (remember to remove the -u parameter too)
Hope this helps someone else