aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2014-01-14 23:15:36 +0700
committerErik Hanson <erik@slackbuilds.org>2014-01-29 23:21:01 -0600
commit8f4f40dc37c0553293567fe33a87a6d26762cd81 (patch)
tree0ae069615fc6aa61530191363bb4d473a98ba6f4
parentad722f51d0dc2d2b4bc7f3142ad4acbb90499a72 (diff)
games/sms_sdl: Added (A Sega Master System and Game Gear Emulator).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r--games/sms_sdl/README15
-rw-r--r--games/sms_sdl/doinst.sh8
-rw-r--r--games/sms_sdl/mime/doinst.mime5
-rw-r--r--games/sms_sdl/mime/mime_types2
-rw-r--r--games/sms_sdl/mime/sms_sdl.xml17
-rw-r--r--games/sms_sdl/patches/cflags_and_libz.diff25
-rw-r--r--games/sms_sdl/patches/fix_option_parsing.diff83
-rw-r--r--games/sms_sdl/patches/japan_and_fm.diff29
-rw-r--r--games/sms_sdl/patches/x86_64.diff29
-rw-r--r--games/sms_sdl/sample_config37
-rw-r--r--games/sms_sdl/slack-desc19
-rw-r--r--games/sms_sdl/sms_sdl.1146
-rw-r--r--games/sms_sdl/sms_sdl.SlackBuild135
-rw-r--r--games/sms_sdl/sms_sdl.desktop11
-rw-r--r--games/sms_sdl/sms_sdl.info10
-rw-r--r--games/sms_sdl/sms_sdl.pngbin0 -> 3752 bytes
-rw-r--r--games/sms_sdl/sms_sdl.sh68
17 files changed, 639 insertions, 0 deletions
diff --git a/games/sms_sdl/README b/games/sms_sdl/README
new file mode 100644
index 0000000000000..83595ad7a0d5a
--- /dev/null
+++ b/games/sms_sdl/README
@@ -0,0 +1,15 @@
+sms_sdl (A Sega Master System and Game Gear Emulator)
+
+SMS Plus is Sega Master System and Game Gear emulator. Originally,
+it was written to run under DOS. Since Charles Mac Donald released
+his emulator under the GPL terms, this emulator has been ported to
+different platforms.
+
+This package includes desktop integration for KDE4. IF you do not want
+this, specify MIME_TYPES=no in the environment before running the script.
+The desktop integration associates *.sms and *.gg files with the emulator,
+so they will be displayed with a Sega Master System icon, and can be
+launched from within KDE by clicking on them in the file manager.
+
+The sms_sdl.png icon is by finite, from
+http://www.pixeljoint.com/pixelart/2312.htm
diff --git a/games/sms_sdl/doinst.sh b/games/sms_sdl/doinst.sh
new file mode 100644
index 0000000000000..6dabb61160b43
--- /dev/null
+++ b/games/sms_sdl/doinst.sh
@@ -0,0 +1,8 @@
+if [ -x /usr/bin/update-desktop-database ]; then
+ /usr/bin/update-desktop-database -q usr/share/applications
+fi
+
+if [ -x /usr/bin/update-mime-database ]; then
+ /usr/bin/update-mime-database usr/share/mime > /dev/null 2>&1
+fi
+
diff --git a/games/sms_sdl/mime/doinst.mime b/games/sms_sdl/mime/doinst.mime
new file mode 100644
index 0000000000000..8542d1c18e4c0
--- /dev/null
+++ b/games/sms_sdl/mime/doinst.mime
@@ -0,0 +1,5 @@
+if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then
+ if [ -x /usr/bin/gtk-update-icon-cache ]; then
+ /usr/bin/gtk-update-icon-cache usr/share/icons/hicolor >/dev/null 2>&1
+ fi
+fi
diff --git a/games/sms_sdl/mime/mime_types b/games/sms_sdl/mime/mime_types
new file mode 100644
index 0000000000000..88a8585f1987e
--- /dev/null
+++ b/games/sms_sdl/mime/mime_types
@@ -0,0 +1,2 @@
+application/x-sega-master-system-rom
+application/x-sega-game-gear-rom
diff --git a/games/sms_sdl/mime/sms_sdl.xml b/games/sms_sdl/mime/sms_sdl.xml
new file mode 100644
index 0000000000000..e0815ee2a35da
--- /dev/null
+++ b/games/sms_sdl/mime/sms_sdl.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
+ <mime-type type="application/x-sega-master-system-rom">
+ <icon name="sms_sdl" />
+ <comment>Sega Master System ROM</comment>
+ <acronym>SMS</acronym>
+ <expanded-acronym>Sega Master System</expanded-acronym>
+ <glob pattern="*.sms"/>
+ </mime-type>
+ <mime-type type="application/x-sega-game-gear-rom">
+ <icon name="sms_sdl" />
+ <comment>Sega Game Gear ROM</comment>
+ <acronym>GG</acronym>
+ <expanded-acronym>Game Gear</expanded-acronym>
+ <glob pattern="*.gg"/>
+ </mime-type>
+</mime-info>
diff --git a/games/sms_sdl/patches/cflags_and_libz.diff b/games/sms_sdl/patches/cflags_and_libz.diff
new file mode 100644
index 0000000000000..cf74397198ce0
--- /dev/null
+++ b/games/sms_sdl/patches/cflags_and_libz.diff
@@ -0,0 +1,25 @@
+diff -Naur sms_sdl-0.9.4a-r7.1/sdl/Makefile sms_sdl-0.9.4a-r7.1.patched/sdl/Makefile
+--- sms_sdl-0.9.4a-r7.1/sdl/Makefile 2003-07-16 23:37:38.000000000 -0400
++++ sms_sdl-0.9.4a-r7.1.patched/sdl/Makefile 2009-02-05 17:39:28.000000000 -0500
+@@ -12,7 +12,7 @@
+ NAME = sms_sdl
+
+ CC = gcc
+-CFLAGS = `sdl-config --cflags` -O2
++CFLAGS = `sdl-config --cflags` $(OPTFLAGS)
+ DEFINES = -DLSB_FIRST -DX86_ASM
+ INCLUDES = -I. -I.. -I../cpu -I../sound
+ LIBS = `sdl-config --libs`
+@@ -22,9 +22,9 @@
+ ../cpu/z80.o ../sound/emu2413.o ../sound/sn76496.o
+
+ # (un)comment to enable ZIP support
+-#DEFINES += -DUSE_ZLIB
+-#LIBS += -Lz
+-#OBJECTS += unzip.o
++DEFINES += -DUSE_ZLIB
++LIBS += -lz
++OBJECTS += unzip.o
+
+
+ all: $(NAME)
diff --git a/games/sms_sdl/patches/fix_option_parsing.diff b/games/sms_sdl/patches/fix_option_parsing.diff
new file mode 100644
index 0000000000000..ee91ec487df53
--- /dev/null
+++ b/games/sms_sdl/patches/fix_option_parsing.diff
@@ -0,0 +1,83 @@
+diff -x tags -Naur sms_sdl-0.9.4a-r7.1/sdl/main.c sms_sdl-0.9.4a-r7.1.patched/sdl/main.c
+--- sms_sdl-0.9.4a-r7.1/sdl/main.c 2009-10-11 21:49:18.000000000 -0400
++++ sms_sdl-0.9.4a-r7.1.patched/sdl/main.c 2009-10-12 01:41:24.000000000 -0400
+@@ -42,17 +42,20 @@
+
+ static int parse_args(int argc, char **argv)
+ {
+- int i;
++ int i, name_set = 0;
+
+ /* default virtual console emulation settings */
+ cfg.fm = 0;
+ cfg.japan = 0;
+
+ cfg.filter = -1;
+- strcpy(cfg.game_name, argv[1]);
+
+- for(i = 2; i < argc; ++i) {
+- if(strcasecmp(argv[i], "--fm") == 0)
++ for(i = 1; i < argc; ++i) {
++ if(!name_set && argv[i][0] != '-') {
++ strcpy(cfg.game_name, argv[i]);
++ name_set++;
++ }
++ else if(strcasecmp(argv[i], "--fm") == 0)
+ cfg.fm = 1;
+ else if(strcasecmp(argv[i], "--japan") == 0)
+ cfg.japan = 1;
+@@ -86,6 +89,11 @@
+ else
+ printf("WARNING: unknown option '%s'.\n", argv[i]);
+ }
++ if(!name_set) {
++ printf("ERROR: no ROM filename given\n");
++ return 0;
++ }
++
+ return 1;
+ }
+
+@@ -112,13 +120,13 @@
+ printf(" --filter <mode>\t render using a filter: ");
+ for(i = 0; i < sizeof(filters) / sizeof(filters[0]) - 1; ++i)
+ printf("%s,", filters[i].name);
+- printf("%s.", filters[i].name);
++ printf("%s.\n", filters[i].name);
+ return 1;
+ }
+
+ memset(&cfg, 0, sizeof(cfg));
+ if(!parse_args(argc, argv))
+- return 0;
++ return 1;
+
+ if(sdlsms_init(&cfg)) {
+ sdlsms_emulate();
+diff -x tags -Naur sms_sdl-0.9.4a-r7.1/sdl/saves.c sms_sdl-0.9.4a-r7.1.patched/sdl/saves.c
+--- sms_sdl-0.9.4a-r7.1/sdl/saves.c 2003-07-16 23:20:24.000000000 -0400
++++ sms_sdl-0.9.4a-r7.1.patched/sdl/saves.c 2009-10-11 22:04:10.000000000 -0400
+@@ -88,6 +88,11 @@
+ unzCloseCurrentFile(zf);
+ unzClose(zf);
+
++ /* 20091011 bkw: avoid segfaulting if filename contains no dot */
++ if(!strrchr(romfile, '.')) {
++ printf("Invalid filename '%s' (no extension), giving up\n", romfile);
++ return 0;
++ }
+ if(strcasecmp(strrchr(romfile, '.'), ".gg") == 0)
+ cart.type = TYPE_GG;
+ else
+@@ -126,6 +131,11 @@
+
+ fclose(fd);
+
++ /* 20091011 bkw: avoid segfaulting if filename contains no dot */
++ if(!strrchr(filename, '.')) {
++ printf("Invalid filename '%s' (no extension), giving up\n", filename);
++ return 0;
++ }
+ /* Figure out game image type */
+ if(strcasecmp(strrchr(filename, '.'), ".gg") == 0)
+ cart.type = TYPE_GG;
diff --git a/games/sms_sdl/patches/japan_and_fm.diff b/games/sms_sdl/patches/japan_and_fm.diff
new file mode 100644
index 0000000000000..d33f405e68895
--- /dev/null
+++ b/games/sms_sdl/patches/japan_and_fm.diff
@@ -0,0 +1,29 @@
+--- sms_sdl-0.9.4a-r7.1/sdl/main.c 2003-07-21 12:40:56.000000000 -0300
++++ sms_sdl-0.9.4a-r7.1.patched/sdl/main.c 2009-05-12 17:42:29.362768285 -0300
+@@ -45,21 +45,19 @@
+ int i;
+
+ /* default virtual console emulation settings */
+- sms.use_fm = 0;
+- sms.country = TYPE_OVERSEAS;
++ cfg.fm = 0;
++ cfg.japan = 0;
+
+ cfg.filter = -1;
+ strcpy(cfg.game_name, argv[1]);
+
+ for(i = 2; i < argc; ++i) {
+ if(strcasecmp(argv[i], "--fm") == 0)
+- sms.use_fm = 1;
++ cfg.fm = 1;
+ else if(strcasecmp(argv[i], "--japan") == 0)
+- sms.country = TYPE_DOMESTIC;
+- else if(strcasecmp(argv[i], "--usesram") == 0) {
++ cfg.japan = 1;
++ else if(strcasecmp(argv[i], "--usesram") == 0)
+ cfg.usesram = 1;
+- sms.save = 1;
+- }
+ else if(strcasecmp(argv[i], "--fskip") == 0) {
+ if(++i<argc) {
+ cfg.frameskip = atoi(argv[i]);
diff --git a/games/sms_sdl/patches/x86_64.diff b/games/sms_sdl/patches/x86_64.diff
new file mode 100644
index 0000000000000..d18a49910f5b6
--- /dev/null
+++ b/games/sms_sdl/patches/x86_64.diff
@@ -0,0 +1,29 @@
+diff -Naur sms_sdl-0.9.4a-r7.1/sdl/Makefile sms_sdl-0.9.4a-r7.1.patched/sdl/Makefile
+--- sms_sdl-0.9.4a-r7.1/sdl/Makefile 2009-09-30 18:39:29.000000000 -0400
++++ sms_sdl-0.9.4a-r7.1.patched/sdl/Makefile 2009-09-30 18:40:10.000000000 -0400
+@@ -13,7 +13,7 @@
+
+ CC = gcc
+ CFLAGS = `sdl-config --cflags` $(OPTFLAGS)
+-DEFINES = -DLSB_FIRST -DX86_ASM
++DEFINES = -DLSB_FIRST
+ INCLUDES = -I. -I.. -I../cpu -I../sound
+ LIBS = `sdl-config --libs`
+
+diff -Naur sms_sdl-0.9.4a-r7.1/types.h sms_sdl-0.9.4a-r7.1.patched/types.h
+--- sms_sdl-0.9.4a-r7.1/types.h 2003-01-07 12:37:58.000000000 -0500
++++ sms_sdl-0.9.4a-r7.1.patched/types.h 2009-09-30 18:40:19.000000000 -0400
+@@ -4,11 +4,11 @@
+
+ typedef unsigned char uint8;
+ typedef unsigned short int uint16;
+-typedef unsigned long int uint32;
++typedef unsigned int uint32;
+
+ typedef signed char int8;
+ typedef signed short int int16;
+-typedef signed long int int32;
++typedef signed int int32;
+
+ #endif /* _TYPES_H_ */
+
diff --git a/games/sms_sdl/sample_config b/games/sms_sdl/sample_config
new file mode 100644
index 0000000000000..c333cb75168cd
--- /dev/null
+++ b/games/sms_sdl/sample_config
@@ -0,0 +1,37 @@
+# sms_sdl sample config - copy to ~/.sms_sdl/config and edit as desired.
+
+# This file contains the default command-line options to be passed to
+# sms_sdl, every time it's run. Place each option on a line by itself.
+# The leading -- is optional.
+
+# Comments and blank lines are ignored.
+
+# Enable YM2413 sound? Default is disabled; uncomment next line to enable.
+#fm
+
+# Set the machine type as DOMESTIC (aka Japanese) instead of OVERSEAS.
+# The default is overseas (aka US), uncomment next line for Japanese.
+#japan
+
+# Uncomment next line to load/save SRAM contents before starting/exiting.
+# The SRAM contents will be saved in ~/.sms_sdl/<romname>.sav
+#usesram
+
+# Specify the number of frames to skip. The default is 0 (no frameskip)
+#fskip 1
+
+# do not limit to 60 frames per second?
+#fullspeed
+
+# start in fullscreen mode?
+#fullscreen
+
+# use joystick?
+#joystick
+
+# disable sound?
+#nosound
+
+# Render using a filter? Default is no filter. Choices are:
+# 2xsai super2xsai supereagle advmame2x tv2x 2x bilinear dotmatrix
+#filter 2x
diff --git a/games/sms_sdl/slack-desc b/games/sms_sdl/slack-desc
new file mode 100644
index 0000000000000..76f0e459ca7ea
--- /dev/null
+++ b/games/sms_sdl/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+sms_sdl: sms_sdl (A Sega Master System and Game Gear Emulator)
+sms_sdl:
+sms_sdl: SMS Plus is Sega Master System and Game Gear emulator. Originally,
+sms_sdl: it was written to run under DOS. Since Charles Mac Donald released
+sms_sdl: his emulator under the GPL terms, this emulator has been ported to
+sms_sdl: different platforms.
+sms_sdl:
+sms_sdl:
+sms_sdl:
+sms_sdl:
+sms_sdl:
diff --git a/games/sms_sdl/sms_sdl.1 b/games/sms_sdl/sms_sdl.1
new file mode 100644
index 0000000000000..0c056efa63e30
--- /dev/null
+++ b/games/sms_sdl/sms_sdl.1
@@ -0,0 +1,146 @@
+.TH SMS_SDL "1" "February 2009" "SMS Plus/SDL v0.9.4aR7" "User Commands"
+.SH NAME
+sms_sdl \- Sega Master System and Game Gear emulator.
+.SH SYNOPSIS
+.B sms_sdl
+\fR[\fI--options\fR] \fI<filename.<SMS|GG>>
+.SH DESCRIPTION
+SMS Plus/SDL v0.9.4aR7
+.br
+(C) Charles Mac Donald in 1998, 1999, 2000
+.br
+SDL Version by Gregory Montoir (cyx@frenchkiss.net)
+.SH OPTIONS
+.PP
+\fINote:\fR The filename may appear anywhere on the command line.
+.TP
+\fB\-\-fm\fR
+Enable YM2413 sound.
+.TP
+\fB\-\-japan\fR
+Set the machine type as DOMESTIC instead of OVERSEAS.
+.TP
+\fB\-\-usesram\fR
+Load/save SRAM contents before starting/exiting.
+.TP
+\fB\-\-fskip\fR <n>
+Specify the number of frames to skip.
+.TP
+\fB\-\-fullspeed\fR
+Do not limit to 60 frames per second.
+.TP
+\fB\-\-fullscreen\fR
+Start in fullscreen mode.
+.TP
+\fB\-\-joystick\fR
+Use joystick.
+.TP
+\fB\-\-nosound\fR
+Disable sound.
+.TP
+\fB\-\-filter\fR <mode>
+Render using a filter. Available modes:
+.RS
+.IP "2xsai"
+.PD 0
+.IP "super2xsai"
+.IP "supereagle"
+.IP "advmame2x"
+.IP "tv2x"
+.IP "2x"
+.IP "bilinear"
+.IP "dotmatrix"
+.RE
+.PD 1
+.SH CONFIG FILE
+\fBsms_sdl\fR is launched by a shell script wrapper which reads the
+file \fI~/.sms_sdl/config\fR if it exists. Any of the options above may
+be placed in this file (one option per line, with or without the leading \fB--\fR characters). These options
+will be passed as command\-line arguments to the real \fBsms_sdl\fR
+binary every time it runs.
+.PP
+See \fB/usr/doc/sms_sdl-@VERSION@/sample_config\fR for further information.
+.SH KEYBOARD
+.TP
+\fBF1\fR
+Screenshot in BMP format
+.TP
+\fBF2\fR
+Save state
+.TP
+\fBF3\fR
+Load state
+.TP
+\fBF4/F5\fR
+Dec/inc frame skip value
+.TP
+\fBF6/F7\fR
+Dec/inc state slot
+.TP
+\fB1..8\fR
+Switch rendering filter
+.TP
+\fBC\fR
+Button 1
+.TP
+\fBV\fR
+Button 2
+.TP
+\fBENTER\fR
+Start (GG) / pause (SMS)
+.TP
+\fBARROWS\fR
+Directional pad
+.TP
+\fBTAB\fR
+Console hard reset
+.PP
+The key bindings may not be remapped.
+.SH FILES
+.PP
+ROM image files may be in raw dump format, or may have a header (details
+are system-specific). Also, ROM images may be zipped (not gzipped), in
+which case the first file in the zip file's directory must be the
+ROM image (any other files are ignored).
+.PP
+\fBsms_sdl\fR looks at the filename to determine the type of ROM image
+in use. Any file whose name ends in \fI.gg\fR (case-insensitive match)
+is considered to be a Game Gear ROM. Any other file is treated as a
+Sega Master System ROM. In the case of a zipped image, this refers to the
+file inside the zip file; the zip file itself doesn't have any special
+naming requirements.
+.PP
+Screenshot filenames (F1 key) are generated by replacing the filename
+extension with \fI-NNN.bmp\fR, where NNN is a 3-digit number (000 for
+the first screenshot, 001 for the second, etc). The numbering starts
+at 000 every time the emulator is started, and existing files will be
+overwritten without confirmation.
+.PP
+State save filenames (F2 key) are generated by replacing the filename
+extension with \fI.stN\fR, where N is the number of the save slot (one
+or more digits). Again, existing files are overwritten without confirmation.
+.PP
+For both types of file, the filename is considered to be the entire
+path to the ROM image file. This means that the emulator expects to
+be able to write savestate and screenshot files in the directory where
+the ROM files reside. If the directory is not writable, no files will
+be created.
+.SH BUGS
+.PP
+\fBsms_sdl\fR will exit with failure status if it's given a filename that
+contains no . (dot/period) characters (in other words, a filename
+without an extension). So don't do that. (This applies to the file
+inside the zip file, for zipped images)
+.PP
+Screenshot and state-save files should really be written in the
+current directory, or else a hypothetical ~/.sms_sdl directory.
+.PP
+There should be a config file, so the user doesn't have to pass his
+favorite set of options on the command line every time (of course,
+a shell alias, wrapper script, or GUI file manager
+can work around this easily enough).
+.SH AUTHORS
+.PP
+(C) Charles Mac Donald in 1998, 1999, 2000
+.br
+SDL Version by Gregory Montoir (cyx@frenchkiss.net)
diff --git a/games/sms_sdl/sms_sdl.SlackBuild b/games/sms_sdl/sms_sdl.SlackBuild
new file mode 100644
index 0000000000000..2b9dcbef557bd
--- /dev/null
+++ b/games/sms_sdl/sms_sdl.SlackBuild
@@ -0,0 +1,135 @@
+#!/bin/sh
+
+# Slackware build script for sms_sdl
+# Written by B. Watson (yalhcru@gmail.com)
+
+PRGNAM=sms_sdl
+VERSION=${VERSION:-0.9.4a_r7.1}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i486 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+SRCVER=$(echo $VERSION | sed 's/_/-/')
+
+# If $MIME_TYPES is set to `yes' it will include MIME types for KDE and
+# automagically associate *.sms and *.gg files with sms_sdl.
+MIME_TYPES=${MIME_TYPES:-"yes"}
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$SRCVER
+unzip $CWD/$PRGNAM-$SRCVER-src.zip
+cd $PRGNAM-$SRCVER
+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 {} \;
+
+# Sorry for all the patches, upstream has been unmaintained since 2001 or so.
+
+# Support OPTFLAGS in build process
+patch -p1 --verbose < $CWD/patches/cflags_and_libz.diff
+
+# Thanks to Ellington Santos (necropresto) for this patch that makes
+# the --fm and --japan options actually work:
+patch -p1 --verbose < $CWD/patches/japan_and_fm.diff
+
+# x86_64 needs this patch to disable x86 asm + fix the int32, uint32 typedefs
+# (but x86 doesn't need this!)
+if [ "$ARCH" = "x86_64" ]; then
+ patch -p1 --verbose < $CWD/patches/x86_64.diff
+fi
+
+# Allow the ROM filename to appear anywhere on the command line, and
+# avoid segfaulting on filenames that don't contain a dot.
+patch -p1 --verbose < $CWD/patches/fix_option_parsing.diff
+
+cd sdl
+
+# need to link with -lm
+sed -i '/^LIBS/s,$, -lm,' Makefile
+
+make OPTFLAGS="$SLKCFLAGS"
+
+# There's no 'make install', plus we have this wrapper script...
+mkdir -p $PKG/usr/bin $PKG/usr/libexec
+install -m0755 $CWD/$PRGNAM.sh $PKG/usr/bin/$PRGNAM
+install -s -m0755 $PRGNAM $PKG/usr/libexec/$PRGNAM
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a README.TXT $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+cat $CWD/sample_config > $PKG/usr/doc/$PRGNAM-$VERSION/sample_config
+
+# man page is part of this SlackBuild. If you're packaging for
+# some other distribution, feel free to snag it.
+mkdir -p $PKG/usr/man/man1
+sed "s/@VERSION@/$VERSION/g" < $CWD/$PRGNAM.1 | gzip -9c > $PKG/usr/man/man1/$PRGNAM.1.gz
+
+# Desktop integration stuff: Icon and .desktop file always present,
+# regardless of $MIME_TYPES
+mkdir -p $PKG/usr/share/applications $PKG/usr/share/pixmaps
+cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
+cat $CWD/$PRGNAM.png > $PKG/usr/share/pixmaps/$PRGNAM.png
+
+mkdir -p $PKG/install
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+# MIME type and icon stuff updated for KDE 4.
+# For KDE4, we need the freedesktop XML file that defines the MIME types,
+# the icon(s) in /usr/share/icons/hicolor/<size>/mimetypes,
+# the MimeType= line in the app's .desktop file,
+# and the gtk-update-icon-cache lines in doinst.sh
+if [ "$MIME_TYPES" = "yes" ]; then
+ mimedir=$PKG/usr/share/mime/packages/
+ icondir=$PKG/usr/share/icons/hicolor/128x128/mimetypes
+ desktop_types="MimeType="
+
+ mkdir -p $mimedir $icondir
+ cat $CWD/mime/$PRGNAM.xml > $mimedir/$PRGNAM.xml
+
+ cd $icondir
+ for type in $( cat $CWD/mime/mime_types ); do
+ icon=$( echo $type | sed 's,/,-,g' ).png
+ ln -s ../../../../pixmaps/$PRGNAM.png $icon
+ desktop_types="$desktop_types$type;"
+ done
+
+ cat $CWD/mime/doinst.mime >> $PKG/install/doinst.sh
+ echo "$desktop_types" >> $PKG/usr/share/applications/$PRGNAM.desktop
+fi
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/games/sms_sdl/sms_sdl.desktop b/games/sms_sdl/sms_sdl.desktop
new file mode 100644
index 0000000000000..7a09638c093b9
--- /dev/null
+++ b/games/sms_sdl/sms_sdl.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Version=1.0
+Name=SMS Plus/SDL
+GenericName=Sega Master System Emulator
+Type=Application
+Exec=sms_sdl
+Icon=sms_sdl
+Terminal=false
+StartupNotify=false
+Hidden=true
+Categories=Game;Emulator;
diff --git a/games/sms_sdl/sms_sdl.info b/games/sms_sdl/sms_sdl.info
new file mode 100644
index 0000000000000..6063dfcb824fc
--- /dev/null
+++ b/games/sms_sdl/sms_sdl.info
@@ -0,0 +1,10 @@
+PRGNAM="sms_sdl"
+VERSION="0.9.4a_r7.1"
+HOMEPAGE="http://pkgsrc.se/emulators/sms_sdl"
+DOWNLOAD="ftp://ftp.netbsd.org/pub/pkgsrc/distfiles/sms_sdl-0.9.4a-r7.1-src.zip"
+MD5SUM="985e979dbd38336909894a40c42a8e56"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="B. Watson"
+EMAIL="yalhcru@gmail.com"
diff --git a/games/sms_sdl/sms_sdl.png b/games/sms_sdl/sms_sdl.png
new file mode 100644
index 0000000000000..bec3123a780cf
--- /dev/null
+++ b/games/sms_sdl/sms_sdl.png
Binary files differ
diff --git a/games/sms_sdl/sms_sdl.sh b/games/sms_sdl/sms_sdl.sh
new file mode 100644
index 0000000000000..8efb438fa8be9
--- /dev/null
+++ b/games/sms_sdl/sms_sdl.sh
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+# 20091011 bkw: Wrapper script for sms_sdl, does the following:
+
+# - Savestates and screenshots will be saved in ~/.sms_sdl/
+# - A ~/.sms_sdl/config file will be read if present, and converted to
+# command-line options for the real sms_sdl binary.
+
+# To make things work properly, we have to run the real emulator binary
+# with its cwd set to ~/.sms_sdl/, and create a symlink to the ROM file
+# in the same directory. After the emu exits, we remove the symlink.
+
+sms_exe="/usr/libexec/sms_sdl"
+sms_userdir=~/.sms_sdl
+conf_file="$sms_userdir/config"
+
+romfile=""
+conf_args=""
+
+set -e
+
+mkdir -p $sms_userdir
+
+if [ -e "$conf_file" ]; then
+ while read line; do
+ # remove comments
+ line="${line/\#*/}"
+ case "$line" in
+ "") ;; # ignore empty lines
+ -*)
+ conf_args="$conf_args $line"
+ ;;
+ *)
+ conf_args="$conf_args --$line"
+ ;;
+ esac
+ done < "$conf_file"
+fi
+
+for arg; do
+ case "$arg" in
+ -h|-help|--help|-\?)
+ $sms_exe
+ exit 0
+ ;;
+
+ --*)
+ conf_args="$conf_args $arg"
+ ;;
+
+ *)
+ if [ -z "$romfile" ]; then
+ arg="$( readlink -f "$arg" )"
+ romfile="$( basename "$arg" )"
+ ( cd $sms_userdir ; rm -f "$romfile" ; ln -s "$arg" . )
+ fi
+ ;;
+ esac
+done
+
+set +e
+if [ -z "$romfile" ]; then
+ $sms_exe
+else
+ cd $sms_userdir
+ $sms_exe $conf_args "$romfile"
+ rm -f "$romfile"
+fi