From 5a97075c957532113159879d576507e911ea849e Mon Sep 17 00:00:00 2001 From: Darren Alton Date: Wed, 4 Jul 2012 03:32:51 -0400 Subject: [PATCH] (Pandora) Remember last-selected ROM for each backend. --- pandora/scripts/retroarch.sh | 38 ++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/pandora/scripts/retroarch.sh b/pandora/scripts/retroarch.sh index 2ae4c31c01..0805da9939 100755 --- a/pandora/scripts/retroarch.sh +++ b/pandora/scripts/retroarch.sh @@ -3,40 +3,34 @@ export PATH="/mnt/utmp/retroarch/bin:${PATH:-"/usr/bin:/bin:/usr/local/bin"}" export LD_LIBRARY_PATH="/mnt/utmp/retroarch/lib:${LD_LIBRARY_PATH:-"/usr/lib:/lib"}" export HOME="/mnt/utmp/retroarch" XDG_CONFIG_HOME="/mnt/utmp/retroarch" -if [ -d /mnt/utmp/retroarch/share ];then +if [ -d /mnt/utmp/retroarch/share ] ; then export XDG_DATA_DIRS=/mnt/utmp/retroarch/share:$XDG_DATA_DIRS:/usr/share fi +# choose a libretro core. cd /mnt/utmp/retroarch/lib BACKEND=$(ls -1 libretro*.so | zenity --list --column=Backend) cd $HOME -if [ -z "$BACKEND" ] ; then - exit 0 -fi +# if user didn't select a libretro, bail out. +[ -z "$BACKEND" ] && exit 0 +# narrow down the available file formats for the file chooser. FILTER='All files (*)|*' -SDL_OMAP_LAYER_SIZE="640x480" case "$BACKEND" in libretro-fceu*.so) FILTER='NES (*.nes)|*.nes' - SDL_OMAP_LAYER_SIZE="512x448" ;; libretro-pocketsnes.so | libretro-snes9x*.so) FILTER='SNES (*.sfc)|*.sfc' - ## This still looks distorted for some reason... - ## Both for 512x448 and 512x478. - SDL_OMAP_LAYER_SIZE="512x448" ;; libretro-gambatte.so) FILTER='GBC (*.gb; *.gbc)|*.gb *.gbc' - SDL_OMAP_LAYER_SIZE="480x432" ;; libretro-meteor.so | libretro-vba.so ) FILTER='GBA (*.gba)|*.gba' - SDL_OMAP_LAYER_SIZE="720x480" ;; - libretro-imame4all.so | libretro-fba.so) + libretro-imame4all.so) # does libretro-fba.so belong here? FILTER='Arcade (*.zip)|*.zip' ;; libretro-genplus.so) @@ -47,12 +41,26 @@ case "$BACKEND" in ;; esac -export SDL_OMAP_LAYER_SIZE +# try to point the file chooser at the last used path, if there is one. +LASTROM= +if [ -r "${BACKEND}-lastrom.txt" ] ; then + LASTROM="--filename="$(head -1 "${BACKEND}-lastrom.txt") +fi +ROM=$(zenity --file-selection --file-filter="${FILTER}" "${LASTROM}") + +# if user didn't select a ROM, bail out. +[ -z "$ROM" ] && exit 0 + +echo "$ROM" > "${BACKEND}-lastrom.txt" + +# use notaz's optimized driver export SDL_VIDEODRIVER="omapdss" export SDL_AUDIODRIVER="alsa" -ROM=$(zenity --file-selection --file-filter="${FILTER}") +# integral scaling +export SDL_OMAP_LAYER_SIZE="pixelperfect" -exec retroarch "${ROM}" -L "/mnt/utmp/retroarch/lib/${BACKEND}" "${@}" +# preload my modified SDL that knows what "pixelperfect" is +exec env LD_PRELOAD=/mnt/utmp/retroarch/lib/libSDL-1.2.so.0.11.3 retroarch "${ROM}" -L "/mnt/utmp/retroarch/lib/${BACKEND}" "${@}"