From 94b83252442b2789cb10bb38818205210922fc3e Mon Sep 17 00:00:00 2001 From: Darren Alton Date: Tue, 3 Jul 2012 22:16:27 -0400 Subject: [PATCH 1/3] (Pandora) More emulator-specific resolutions for whole-number scaling. Also added ".zip" for the arcade emulators' file choosers. --- pandora/scripts/retroarch.sh | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/pandora/scripts/retroarch.sh b/pandora/scripts/retroarch.sh index a78607c762..2ae4c31c01 100755 --- a/pandora/scripts/retroarch.sh +++ b/pandora/scripts/retroarch.sh @@ -6,9 +6,6 @@ export HOME="/mnt/utmp/retroarch" XDG_CONFIG_HOME="/mnt/utmp/retroarch" if [ -d /mnt/utmp/retroarch/share ];then export XDG_DATA_DIRS=/mnt/utmp/retroarch/share:$XDG_DATA_DIRS:/usr/share fi -export SDL_OMAP_LAYER_SIZE="640x480" -export SDL_VIDEODRIVER="omapdss" -export SDL_AUDIODRIVER="alsa" cd /mnt/utmp/retroarch/lib BACKEND=$(ls -1 libretro*.so | zenity --list --column=Backend) @@ -19,20 +16,28 @@ if [ -z "$BACKEND" ] ; then fi 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' - ;; - libretro-meteor.so | libretro-vba.so ) - FILTER='GBA (*.gba)|*.gba' - export SDL_OMAP_LAYER_SIZE="720x480" + ## 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' - export SDL_OMAP_LAYER_SIZE="534x480" + 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) + FILTER='Arcade (*.zip)|*.zip' ;; libretro-genplus.so) FILTER='Genesis/MegaDrive (*.md; *.gen)|*.md *.gen' @@ -42,6 +47,11 @@ case "$BACKEND" in ;; esac +export SDL_OMAP_LAYER_SIZE + +export SDL_VIDEODRIVER="omapdss" +export SDL_AUDIODRIVER="alsa" + ROM=$(zenity --file-selection --file-filter="${FILTER}") exec retroarch "${ROM}" -L "/mnt/utmp/retroarch/lib/${BACKEND}" "${@}" From 2213a4d97785975e841036f45ed4e994f84f28b9 Mon Sep 17 00:00:00 2001 From: Darren Alton Date: Tue, 3 Jul 2012 22:17:27 -0400 Subject: [PATCH 2/3] (Pandora) Tweaks to default cfg file. - Enable on-screen text with DejaVuSansMono.ttf. - Let libretro decide the aspect ratio (TODO: determine whether this is good) - Comments above settings specifically chosen for Pandora. --- pandora/retroarch/retroarch.cfg | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/pandora/retroarch/retroarch.cfg b/pandora/retroarch/retroarch.cfg index 057dbfdc1e..1c6ebdf4a4 100644 --- a/pandora/retroarch/retroarch.cfg +++ b/pandora/retroarch/retroarch.cfg @@ -1,12 +1,15 @@ ## Skeleton config file for RetroArch +## with default values appropriate for Pandora -# Save all save files (*.srm) to this directory. This includes related files like .bsv, .rtc, .psrm, etc ... +# Save all save files (*.srm) to this directory. +# This includes related files like .bsv, .rtc, .psrm, etc ... # This will be overridden by explicit command line options. +# Defaults to the same directory as the ROM. # savefile_directory = # Save all save states (*.state) to this directory. # This will be overridden by explicit command line options. -# savestate_directory = +savestate_directory = /mnt/utmp/retroarch/retroarch # Automatically saves a savestate at the end of RetroArch's lifetime. # The path is $SRAM_PATH.auto. @@ -15,6 +18,7 @@ # Load libretro from a dynamic location for dynamically built RetroArch. # This option is mandatory. +# On Pandora, it's usually overridden by the launcher script. libretro_path = "/mnt/utmp/retroarch/lib/libretro-fceumm.so" # Environment variables internally in RetroArch. @@ -28,11 +32,13 @@ libretro_path = "/mnt/utmp/retroarch/lib/libretro-fceumm.so" # Sets the "system" directory. # Implementations can query for this directory to load BIOSes, system-specific configs, etc. -# system_directory = +system_directory = /mnt/utmp/retroarch/ #### Video # Video driver to use. "gl", "xvideo", "sdl" or "ext" (external API driver) +# On Pandora, "xvideo" and "sdl" are available, and "sdl" is preferred +# if using notaz's SDL omapdss. video_driver = "sdl" # Path to external video driver using the RetroArch driver API. @@ -48,7 +54,9 @@ video_yscale = 1.0 # video_fullscreen_y = 0 # Start in fullscreen. Can be changed at runtime. -#video_fullscreen = true +# On Pandora, this should be false, because notaz's SDL is always fullscreen, +# and the hardware scaling only helps if RetroArch doesn't software scale. +video_fullscreen = false # Force 16-bit colors. Apparently some video cards in use today have troubles with 32-bit ... #video_force_16bit = true @@ -63,7 +71,7 @@ video_yscale = 1.0 video_smooth = false # Forces rendering area to stay equal to SNES aspect ratio 4:3 or as defined in video_aspect_ratio. -# video_force_aspect = true +video_force_aspect = false # A floating point value for video aspect ratio (width / height). # If this is not set, aspect ratio is assumed to be automatic. @@ -73,7 +81,7 @@ video_smooth = false # If this is true and video_aspect_ratio is not set, # aspect ratio is decided by libretro implementation. # If this is false, 1:1 PAR will always be assumed if video_aspect_ratio is not set. -# video_aspect_ratio_auto = false +video_aspect_ratio_auto = true # Forces cropping of overscanned frames. Crops away top 7 scanlines and 8 bottom scanlines. (15/15 for interlaced frames). # video_crop_overscan = false @@ -110,10 +118,10 @@ video_smooth = false # Path to a TTF font used for rendering messages. This path must be defined to enable fonts. # Do note that the _full_ path of the font is necessary! -# video_font_path = +video_font_path = /usr/share/fonts/truetype/DejaVuSansMono.ttf # Size of the TTF font rendered. -# video_font_size = 48 +video_font_size = 10 # Attempt to scale the font to fit better for multiple window sizes. # video_font_scale = true @@ -186,6 +194,9 @@ audio_driver = alsa # Keyboard input. Will recognize normal keypresses and special keys like "left", "right", and so on. # Keyboard input, Joypad and Joyaxis will all obey the "nul" bind, which disables the bind completely, # rather than relying on a default. +# On Pandora, the included mappings below match the gpio-keys +# to the SNES-style controller layout typically used in libretro. +# TODO: Decide on good l2/r2/l3/r3 mappings; map analog axes to nubs. input_player1_a = end input_player1_b = pagedown input_player1_y = home From 5a97075c957532113159879d576507e911ea849e Mon Sep 17 00:00:00 2001 From: Darren Alton Date: Wed, 4 Jul 2012 03:32:51 -0400 Subject: [PATCH 3/3] (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}" "${@}"