diff options
author | B. Watson <yalhcru@gmail.com> | 2018-07-31 09:06:42 -0400 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2018-08-04 08:40:08 +0700 |
commit | 6a96140598553329942e4324791cb310691d90c0 (patch) | |
tree | 3469ae99aafdfc96354ce7c652cfea916c9c9866 /games/snes9x | |
parent | 74cdff795bd9f800d3056319f3382eb845d307ac (diff) |
games/snes9x: Add RetroArch support.
Signed-off-by: B. Watson <yalhcru@gmail.com>
Diffstat (limited to 'games/snes9x')
-rw-r--r-- | games/snes9x/README | 2 | ||||
-rw-r--r-- | games/snes9x/libretro.diff | 104 | ||||
-rw-r--r-- | games/snes9x/snes9x.SlackBuild | 61 | ||||
-rw-r--r-- | games/snes9x/snes9x_libretro-info | 20 |
4 files changed, 174 insertions, 13 deletions
diff --git a/games/snes9x/README b/games/snes9x/README index aca2f90e54d08..7ecb15c3dae41 100644 --- a/games/snes9x/README +++ b/games/snes9x/README @@ -5,6 +5,8 @@ emulator. It basically allows you to play most games designed for the SNES and Super Famicom Nintendo game systems on your PC or Workstation. The games include some real gems that were only ever released in Japan. +RetroArch is an optional dependency to run the snes9x libretro core. + If you're upgrading from snes9x-1.55, you'll have to delete your old config file: diff --git a/games/snes9x/libretro.diff b/games/snes9x/libretro.diff new file mode 100644 index 0000000000000..8808654ed8b4c --- /dev/null +++ b/games/snes9x/libretro.diff @@ -0,0 +1,104 @@ +From abb4b4c39f75716c4e29017005996da9b3ad4d12 Mon Sep 17 00:00:00 2001 +From: Brandon Wright <bearoso@gmail.com> +Date: Sat, 28 Jul 2018 15:59:15 -0500 +Subject: [PATCH] Use Snes9x aliases instead of stdint types here. + +--- + apu/apu.cpp | 38 +++++++++++++++++++------------------- + 1 file changed, 19 insertions(+), 19 deletions(-) + +diff --git a/apu/apu.cpp b/apu/apu.cpp +index 50dec00f..63a35392 100644 +--- a/apu/apu.cpp ++++ b/apu/apu.cpp +@@ -783,7 +783,7 @@ static void to_var_from_buf (uint8 **buf, void *var, size_t size) + } + + #undef IF_0_THEN_256 +-#define IF_0_THEN_256( n ) ((uint8_t) ((n) - 1) + 1) ++#define IF_0_THEN_256( n ) ((uint8) ((n) - 1) + 1) + void S9xAPULoadBlarggState(uint8 *oldblock) + { + uint8 *ptr = oldblock; +@@ -792,26 +792,26 @@ void S9xAPULoadBlarggState(uint8 *oldblock) + + copier.copy(SNES::smp.apuram,0x10000); // RAM + +- uint8_t regs_in [0x10]; +- uint8_t regs [0x10]; +- uint16_t pc, spc_time, dsp_time; +- uint8_t a,x,y,psw,sp; ++ uint8 regs_in [0x10]; ++ uint8 regs [0x10]; ++ uint16 pc, spc_time, dsp_time; ++ uint8 a,x,y,psw,sp; + + copier.copy(regs,0x10); // REGS + copier.copy(regs_in,0x10); // REGS_IN + + // CPU Regs +- pc = copier.copy_int( 0, sizeof(uint16_t) ); +- a = copier.copy_int( 0, sizeof(uint8_t) ); +- x = copier.copy_int( 0, sizeof(uint8_t) ); +- y = copier.copy_int( 0, sizeof(uint8_t) ); +- psw = copier.copy_int( 0, sizeof(uint8_t) ); +- sp = copier.copy_int( 0, sizeof(uint8_t) ); ++ pc = copier.copy_int( 0, sizeof(uint16) ); ++ a = copier.copy_int( 0, sizeof(uint8) ); ++ x = copier.copy_int( 0, sizeof(uint8) ); ++ y = copier.copy_int( 0, sizeof(uint8) ); ++ psw = copier.copy_int( 0, sizeof(uint8) ); ++ sp = copier.copy_int( 0, sizeof(uint8) ); + copier.extra(); + + // times +- spc_time = copier.copy_int( 0, sizeof(uint16_t) ); +- dsp_time = copier.copy_int( 0, sizeof(uint16_t) ); ++ spc_time = copier.copy_int( 0, sizeof(uint16) ); ++ dsp_time = copier.copy_int( 0, sizeof(uint16) ); + + int cur_time = S9xAPUGetClock(CPU.Cycles); + +@@ -824,14 +824,14 @@ void S9xAPULoadBlarggState(uint8 *oldblock) + SNES::dsp.load_state(&ptr); + + // Timers +- uint16_t next_time[3]; +- uint8_t divider[3], counter[3]; ++ uint16 next_time[3]; ++ uint8 divider[3], counter[3]; + for ( int i = 0; i < 3; i++ ) + { +- next_time[i] = copier.copy_int( 0, sizeof(uint16_t) ); +- divider[i] = copier.copy_int( 0, sizeof(uint8_t) ); +- counter[i] = copier.copy_int( 0, sizeof(uint8_t) ); +- copier.extra(); ++ next_time[i] = copier.copy_int( 0, sizeof(uint16) ); ++ divider[i] = copier.copy_int( 0, sizeof(uint8) ); ++ counter[i] = copier.copy_int( 0, sizeof(uint8) ); ++ copier.extra(); + } + // construct timers out of available parts from blargg smp + SNES::smp.timer0.enable = regs[1] >> 0 & 1; // regs[1] = CONTROL +From a77b3b379b06e5e09723f65b63c9a045c71c3030 Mon Sep 17 00:00:00 2001 +From: orbea <orbea@fredslev.dk> +Date: Sat, 28 Jul 2018 15:48:08 -0700 +Subject: [PATCH] One moreSnes9x alias instead of stdint type. + +--- + spc7110dec.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/spc7110dec.cpp b/spc7110dec.cpp +index 6cc28670..ab7521b3 100644 +--- a/spc7110dec.cpp ++++ b/spc7110dec.cpp +@@ -498,7 +498,7 @@ void SPC7110Decomp::reset() { + } + + SPC7110Decomp::SPC7110Decomp() { +- decomp_buffer = new uint8_t[decomp_buffer_size]; ++ decomp_buffer = new uint8[decomp_buffer_size]; + reset(); + + //initialize reverse morton lookup tables diff --git a/games/snes9x/snes9x.SlackBuild b/games/snes9x/snes9x.SlackBuild index 231c5ff8bdf37..a3de7ffc59bf8 100644 --- a/games/snes9x/snes9x.SlackBuild +++ b/games/snes9x/snes9x.SlackBuild @@ -6,6 +6,18 @@ # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. +# 20180730 bkw: +# - BUILD=2. +# - add libretro/RetroArch, thanks to orbea. +# - add --without-portaudio to configure args. snes9x runs about +# 1 frame/sec if I start it up with the sound driver set to portaudio, +# and I've gotten a report of it blasting high-volume white noise +# thru the speakers if you switch to portaudio while a ROM is already +# running. I can't see any reason to use it in favor of pulse, alsa, +# oss, or sdl audio. +# - don't extract windows, mac, old-school unix stuff from tarball. +# uses 50% less $TMP space. + # 20180623 bkw: update for 1.56.2. # 20180611 bkw: # - update for 1.56.1. @@ -27,7 +39,7 @@ PRGNAM=snes9x VERSION=${VERSION:-1.56.2} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} if [ -z "$ARCH" ]; then @@ -63,14 +75,19 @@ rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM-$VERSION -tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +# Don't extract the stuff we don't need, this saves 7.9MB in $TMP. +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz \ + --wildcards --exclude '*/win32/*' \ + --exclude '*/macosx/*' --exclude '*/unix/*' cd $PRGNAM-$VERSION chown -R root:root . -find -L . \ - \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ - -o -perm 511 \) -exec chmod 755 {} \; -o \ - \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ - -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; +find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \ + \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+ + +# Fix the libretro build for 14.2. +# From upstream git: https://github.com/snes9xgit/snes9x.git +# commits abb4b4c39 and a77b3b379b +patch -p1 < $CWD/libretro.diff cd gtk ./autogen.sh @@ -91,26 +108,44 @@ CXXFLAGS="$SLKCFLAGS" \ --without-system-zip \ --with-gtk2 \ --without-gtk3 \ + --without-portaudio \ $PULSEOPT \ --build=$ARCH-slackware-linux make make install-strip DESTDIR=$PKG +# RetroArch support, contributed by orbea (Hunter Sezen). +# Note that the source here is self-contained, there's no build-time +# dependency on RetroArch or libretro or such. +# snes9x_libretro-info originally came from: +# https://raw.githubusercontent.com/libretro/libretro-super/383f18fd7c36ffd5fe76ebac58e9e596dde67e66/dist/info/snes9x_libretro.info +# Renamed .info => -info to avoid confusing SBo tools that deal with +# SBo's .info files. +( LIBNAM=${PRGNAM}_libretro + cd ../libretro + make + install -sDm0755 $LIBNAM.so $PKG/usr/lib${LIBDIRSUFFIX}/libretro/$LIBNAM.so + install -Dm0644 $CWD/$LIBNAM-info \ + $PKG/usr/lib${LIBDIRSUFFIX}/libretro/info/$LIBNAM.info +) + mkdir -p $PKG/usr/man/man6 gzip -9c $CWD/snes9x-gtk.6 > $PKG/usr/man/man6/snes9x-gtk.6.gz ln -s $PRGNAM-gtk.6.gz $PKG/usr/man/man6/$PRGNAM.6.gz ln -s $PRGNAM-gtk $PKG/usr/games/$PRGNAM -mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/${PRGNAM}_original_docs -cp doc/* $PKG/usr/doc/$PRGNAM-$VERSION -cp ../docs/* $CWD/README_docs.txt \ - $PKG/usr/doc/$PRGNAM-$VERSION/${PRGNAM}_original_docs -cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild +PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION +OLDDOC=$PKGDOC/${PRGNAM}_original_docs +mkdir -p $OLDDOC +cp -a doc/* $PKGDOC +cp -a ../docs/* $OLDDOC +cat $CWD/README_docs.txt > $PKGDOC/README_docs.txt +cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild # We don't need 3 copies of the LGPL v2.1 (we already have the GPL # and proprietary snes9x licenses...) -cd $PKG/usr/doc/$PRGNAM-$VERSION +cd $PKGDOC rm -f snes_ntsc_license.txt ${PRGNAM}_original_docs/lgpl-2.1.txt ln -s lgpl.txt snes_ntsc_license.txt ln -s ../lgpl.txt ${PRGNAM}_original_docs/lgpl-2.1.txt diff --git a/games/snes9x/snes9x_libretro-info b/games/snes9x/snes9x_libretro-info new file mode 100644 index 0000000000000..bcccb02e7edec --- /dev/null +++ b/games/snes9x/snes9x_libretro-info @@ -0,0 +1,20 @@ +display_name = "Nintendo - SNES / Famicom (Snes9x)" +authors = "Snes9x Team" +supported_extensions = "smc|sfc|swc|fig|bs" +corename = "Snes9x" +manufacturer = "Nintendo" +categories = "Emulator" +systemname = "Super Nintendo Entertainment System" +database = "Nintendo - Super Nintendo Entertainment System|Nintendo - Super Nintendo Entertainment System Hacks|Nintendo - Sufami Turbo|Nintendo - Satellaview" +license = "Non-commercial" +permissions = "" +display_version = "1.56" +supports_no_game = "false" +firmware_count = 2 +firmware0_desc = "BS-X.bin (BS-X - Sore wa Namae o Nusumareta Machi no Monogatari (Japan) (Rev 1))" +firmware0_path = "BS-X.bin" +firmware0_opt = "true" +firmware1_desc = "STBIOS.bin (Sufami Turbo (Japan))" +firmware1_path = "STBIOS.bin" +firmware1_opt = "true" +notes = "(!) BS-X.bin (md5): fed4d8242cfbed61343d53d48432aced|(!) STBIOS.bin (md5): d3a44ba7d42a74d3ac58cb9c14c6a5ca|(!) To start BS-X games from the RPG-like interface, go back into the house and select the 1st option." |