From f68c028e33fb9fb0d3267cd72fe26f432b1ea643 Mon Sep 17 00:00:00 2001 From: B. Watson Date: Thu, 17 Feb 2011 22:50:54 -0600 Subject: games/o2em: Added (Magnavox Odyssey II/VideoPac+ emulator) Signed-off-by: Robby Workman --- games/o2em/README | 10 +++ games/o2em/compile_fix.diff | 54 ++++++++++++ games/o2em/doinst.sh | 6 ++ games/o2em/o2em.1 | 207 ++++++++++++++++++++++++++++++++++++++++++++ games/o2em/o2em.SlackBuild | 108 +++++++++++++++++++++++ games/o2em/o2em.info | 12 +++ games/o2em/o2em.sh | 33 +++++++ games/o2em/slack-desc | 19 ++++ games/o2em/wordsize.diff | 47 ++++++++++ 9 files changed, 496 insertions(+) create mode 100644 games/o2em/README create mode 100644 games/o2em/compile_fix.diff create mode 100644 games/o2em/doinst.sh create mode 100644 games/o2em/o2em.1 create mode 100644 games/o2em/o2em.SlackBuild create mode 100644 games/o2em/o2em.info create mode 100644 games/o2em/o2em.sh create mode 100644 games/o2em/slack-desc create mode 100644 games/o2em/wordsize.diff diff --git a/games/o2em/README b/games/o2em/README new file mode 100644 index 0000000000..5786b623f2 --- /dev/null +++ b/games/o2em/README @@ -0,0 +1,10 @@ +o2em is an emulator for the Magnavox Odyssey II and VideoPac+ systems. + +This requires allegro. + +The Odyssey2 BIOS ROM image is required for emulation. To include it in +the package, get either the odyssey2.zip used with MESS, or else the ROM +image itself, called either o2rom.bin or o2bios.rom, and place it in the +build directory before running the SlackBuild. The ROM will be installed +in /usr/share/o2em/bios/o2rom.bin; if you build the package without the +ROM, just place a copy of the ROM there after installing the package. diff --git a/games/o2em/compile_fix.diff b/games/o2em/compile_fix.diff new file mode 100644 index 0000000000..127967c09c --- /dev/null +++ b/games/o2em/compile_fix.diff @@ -0,0 +1,54 @@ +diff -Naur o2em118src/src/debug.c o2em118src.patched//src/debug.c +--- o2em118src/src/debug.c 2006-11-24 05:41:34.000000000 -0500 ++++ o2em118src.patched//src/debug.c 2011-01-12 16:02:24.000000000 -0500 +@@ -16,6 +16,7 @@ + + #include + #include ++#include + #include "cpu.h" + #include "keyboard.h" + #include "vmachine.h" +@@ -1042,4 +1043,4 @@ + + printf("\n"); + return 1; +-} +\ No newline at end of file ++} +diff -Naur o2em118src/src/makefile.linux o2em118src.patched//src/makefile.linux +--- o2em118src/src/makefile.linux 2006-05-05 16:45:14.000000000 -0400 ++++ o2em118src.patched//src/makefile.linux 2011-01-12 16:07:46.000000000 -0500 +@@ -1,8 +1,8 @@ + CC = gcc + +-CFLAGS = -O3 -Wall -fomit-frame-pointer -I/usr/include ++CFLAGS = -Wall $(SLKCFLAGS) `allegro-config --cflags` + LFLAGS = -s +-LIBALLEG = /usr/lib/liballeg.so.4.2 -lalleg_unsharable ++LIBALLEG = `allegro-config --libs` + + + all: o2em dis48 +diff -Naur o2em118src/src/score.c o2em118src.patched//src/score.c +--- o2em118src/src/score.c 2006-05-01 01:58:08.000000000 -0400 ++++ o2em118src.patched//src/score.c 2011-01-12 16:02:35.000000000 -0500 +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include "vmachine.h" + #include "types.h" + #include "score.h" +diff -Naur o2em118src/src/vmachine.c o2em118src.patched//src/vmachine.c +--- o2em118src/src/vmachine.c 2006-11-24 11:59:26.000000000 -0500 ++++ o2em118src.patched//src/vmachine.c 2011-01-12 16:02:43.000000000 -0500 +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + #include "audio.h" + #include "types.h" + #include "cpu.h" diff --git a/games/o2em/doinst.sh b/games/o2em/doinst.sh new file mode 100644 index 0000000000..30eb690936 --- /dev/null +++ b/games/o2em/doinst.sh @@ -0,0 +1,6 @@ +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/o2em/o2em.1 b/games/o2em/o2em.1 new file mode 100644 index 0000000000..f065163635 --- /dev/null +++ b/games/o2em/o2em.1 @@ -0,0 +1,207 @@ +.TH O2EM "1" "January 2011" "SlackBuilds.org" "User Commands" +.SH NAME +o2em \- Emulator for Odyssey II and VideoPac+ systems +.SH SYNOPSIS +.B o2em +<\fIfile\fR> +[\fI-options\fR] +.SH DESCRIPTION +O2EM is an open source Odyssey2 / Videopac console emulator. +.SH OPTIONS +.TP +\fBfile\fR +Cartridge ROM image. +.br +\fINOTE:\fR Unlike most programs, o2em requires the file argument +first, before any options. +.TP +\fB\-help\fR +Help display +.TP +\fB\-wsize\fR=n +Window size (1\-4) +.TP +\fB\-fullscreen\fR +Full screen mode +.TP +\fB\-help\fR +Show help +.TP +\fB\-scanlines\fR +Enable scanlines +.TP +\fB\-nosound\fR +Turn off sound emulation +.TP +\fB\-novoice\fR +Turn off voice emulation +.TP +\fB\-svolume\fR=n +Set sound volume (0\-100) +.TP +\fB\-vvolume\fR=n +Set voice volume (0\-100) +.TP +\fB\-filter\fR +Enable low-pass audio filter +.TP +\fB\-debug\fR +Start the emulator in +debug mode +.TP +\fB\-speed\fR=n +Relative speed +(100 = original) +.TP +\fB\-nolimit\fR +Turn off speed limiter +.TP +\fB\-bios\fR=file +Set the O2 bios file name/dir +.TP +\fB\-biosdir\fR=path +Set the O2 bios path +(default= bios/) +.TP +\fB\-romdir\fR=path +Set the O2 roms Path +(default= roms/) +.TP +\fB\-scshot\fR=file +Set the screenshot file +name/template +.TP +\fB\-euro\fR +Use European timing / +50Hz mode +.TP +\fB\-exrom\fR +Use special 3K program/ +1K data ROM mode +Use 3K rom mapping mode +.TP +\fB\-s\fR=mode/keys +Define stick n mode/keys (n=1\-2, see \fBo2em.txt\fR) +.TP +\fB\-c52\fR +Start the emulator with +french Odyssey 2 BIOS +.TP +\fB\-g7400\fR +Start the emulator +with VP+ BIOS +.TP +\fB\-jopac\fR +Start the emulator with +french VP+ bios +.TP +\fB\-scoretype\fR=m +Set Scoretype to m (see \fBo2em.txt\fR) +.TP +\fB\-scoreadr\fR=n +Set Scoreaddress to n +(decimal value) +.TP +\fB\-scorefile\fR=file +Set Output-Scorefile to +file (highscore.txt) +.TP +\fB\-score\fR=n +Set Highscore to n +.TP +\fB\-savefile\fR=file +Load/Save State +from/to file +.SH KEY BINDINGS +These are the default key bindings, and can be changed +on the command line or in the config file. +.TP +\fBArrow keys + L\fR +Default joystick 1 emulation +.TP +\fBW,D,S,A + Space\fR +Default joystick 2 emulation +.TP +\fBESC or F12\fR +Leave the emulator +.TP +\fBF1\fR +Pause/Information +.TP +\fBF2\fR +Save State\-File +.TP +\fBF3\fR +Load State\-File +.TP +\fBF4\fR +Enter debugger +.TP +\fBF5\fR +Reset emulator (same as pressing the reset on the O2 keyboard) +.TP +\fBF6\fR +Inject Highscore +.TP +\fBF8\fR +Make a screen shot +.TP +\fBCaps Lock\fR +Enables/Disables the O2 keyboard input of the keys used by +joystick emulation +.SH FILES +.TP +\fB/usr/bin/o2em\fR +Shell script wrapper. Sets up ~/.o2em if needed, runs the actual +binary. This is required because o2em was ported from DOS, and +expects to be run in its own directory; with the wrapper, it +behaves like a proper UNIX program (run anywhere, writes only +to ~/.o2em). +.TP +\fB/usr/libexec/o2em.bin\fR +The actual o2em binary. Normally, you don't want to run this +directly (let the wrapper run it for you). +.TP +\fB/usr/share/o2em/bios\fR +BIOS ROM images. At minimum, \fBo2rom.bin\fR must exist. To use the +\fB\-c52\fR, +\fB\-jopac\fR, or +\fB\-g7400\fR +options, the appropriate BIOS image must be located here (see below). +The emulator checks the CRC of the ROM images, +and will refuse to start with an image it doesn't recognize. The correct +files are: +.PP +c52.bin (md5sum f1071cdb0b6b10dde94d3bc8a6146387) +.br +g7400.bin (md5sum c500ff71236068e0dc0d0603d265ae76) +.br +jopac.bin (md5sum 279008e4a0db2dc5f1c048853b033828) +.br +o2rom.bin (md5sum 562d5ebf9e030a40d6fabfc2f33139fd) +.PP +These are the same files used by MESS, except o2rom.bin is called +o2bios.rom by MESS. +.TP +\fB/usr/share/o2em/voice\fR +Voice samples, used to emulate the Odyssey2's speech synthesis chip. +.TP +\fB~/.o2em/\fR +Working directory for o2em. Will be created by shell script wrapper +the first time it's run. All save\-state and screenshot files will be +written here. The BIOS image, cartridge images, and voice samples will +be symlinked into this directory by the wrapper script. +.TP +\fB~/.o2em/o2em_def.cfg\fR +Config file (optional). See o2em.txt for details. +.TP +\fB/usr/doc/o2em\-\fR\fI$VERSION\fR\fB/o2em.txt\fR +Full documentation for o2em. +.SH AUTHORS +o2em was originally created by Daniel Boris, and has been developed by +Andre de la Rocha since version 0.80 and Arlindo M. de Oliveira since version 1.16. +.PP +This manual page was written by B. Watson for the SlackBuilds.org project (but +may be used by anyone for any reason). +.PP +Wrapper script also by B. Watson. diff --git a/games/o2em/o2em.SlackBuild b/games/o2em/o2em.SlackBuild new file mode 100644 index 0000000000..6916f0bb39 --- /dev/null +++ b/games/o2em/o2em.SlackBuild @@ -0,0 +1,108 @@ +#!/bin/bash + +# Slackware build script for o2em + +# Written by B. Watson (yalhcru@gmail.com) + +PRGNAM=o2em +VERSION=${VERSION:-1.18} +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} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" +else + SLKCFLAGS="-O2" +fi + +set -e + +SRC=${PRGNAM}${VERSION/./}src + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $SRC +unzip -L $CWD/$SRC.zip +cd $SRC +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; + +# Patch does this: +# make makefile.linux use allegro-config to find cflags/libs for allegro +# make various source files #include +# add SLKCFLAGS support to makefile.linux +patch -p1 < $CWD/compile_fix.diff + +# Patch fixes wordsize assumptions on x86_64 and makes no difference on x86 +patch -p1 < $CWD/wordsize.diff + +cd src +make -f makefile.linux SLKCFLAGS="$SLKCFLAGS" + +mkdir -p $PKG/usr/bin $PKG/usr/libexec $PKG/usr/share/pixmaps +install -s -m0755 -oroot -groot dis48 $PKG/usr/bin +install -s -m0755 -oroot -groot $PRGNAM $PKG/usr/libexec/$PRGNAM.bin +install -m0755 -oroot -groot $CWD/$PRGNAM.sh $PKG/usr/bin/$PRGNAM +install -m0644 -oroot -groot $PRGNAM.png $PKG/usr/share/pixmaps + +# There is no .desktop file because the emulator lacks a UI (if we +# launch it from the K menu, it prints an error on stdout and exits), +# and because ".bin" isn't much of a MIME type so we can't really +# do association (there's no magic header for the ROMs either). + +mkdir -p $PKG/usr/man/man1 +gzip -9c < $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz + +mkdir -p $PKG/usr/share/$PRGNAM/{bios,voice} +if [ -e "$CWD/o2mainsamp.zip" ]; then + unzip -L $CWD/o2mainsamp.zip -d $PKG/usr/share/$PRGNAM/voice +fi + +if [ -e $CWD/odyssey2.zip ]; then + unzip $CWD/odyssey2.zip + ROMFILE=o2bios.rom +elif [ -e $CWD/o2bios.rom ]; then + ROMFILE=$CWD/o2bios.rom +elif [ -e $CWD/o2rom.bin ]; then + ROMFILE=$CWD/o2rom.bin +fi + +if [ -n "$ROMFILE" ]; then + cat $ROMFILE > $PKG/usr/share/$PRGNAM/bios/o2rom.bin +fi + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cd ../docs +for file in *; do + sed 's/\r//g' < $file > $PKG/usr/doc/$PRGNAM-$VERSION/$file +done +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/games/o2em/o2em.info b/games/o2em/o2em.info new file mode 100644 index 0000000000..c5f623121a --- /dev/null +++ b/games/o2em/o2em.info @@ -0,0 +1,12 @@ +PRGNAM="o2em" +VERSION="1.18" +HOMEPAGE="http://o2em.sourceforge.net/" +DOWNLOAD="http://downloads.sourceforge.net/project/o2em/o2em/1.18/o2em118src.zip \ + http://o2em.sourceforge.net/files/o2mainsamp.zip" +MD5SUM="be96af886370df337fe8584827717627 \ + 9910ecb7d87fcd5696dd4dd00c792e33" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +MAINTAINER="B. Watson" +EMAIL="yalhcru@gmail.com" +APPROVED="rworkman" diff --git a/games/o2em/o2em.sh b/games/o2em/o2em.sh new file mode 100644 index 0000000000..5c0d75163c --- /dev/null +++ b/games/o2em/o2em.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Wrapper script for SBo o2em package, by B. Watson + +# Emulator expects to find ./roms, ./bios, ./voice, +# and its config file in the current dir at runtime. + +# Also, it expects the ROM it's running, to reside in +# ./roms, so we have to symlink it there :( + +# All of this could have been done by hacking up the +# source, but we want to avoid massive amounts of patching. + +EXE=/usr/libexec/o2em.bin +SHAREDIR=/usr/share/o2em +DIR=~/.o2em + +if [ ! -d $DIR ]; then + mkdir -p $DIR/roms + ln -s $SHAREDIR/{bios,voice} $DIR +fi + +rom="$1" +if [ ! -e "$rom" ]; then + exec $EXE "$@" +fi + +shift +shortrom="$( basename "$rom" )" +ln -sf "$( readlink -f "$rom" )" $DIR/roms/"$shortrom" + +cd $DIR +exec $EXE "$shortrom" "$@" diff --git a/games/o2em/slack-desc b/games/o2em/slack-desc new file mode 100644 index 0000000000..0be68d9407 --- /dev/null +++ b/games/o2em/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 ':'. + + |-----handy-ruler------------------------------------------------------| +o2em: o2em (Magnavox Odyssey II/VideoPac+ emulator) +o2em: +o2em: o2em is an emulator for the Magnavox Odyssey II and VideoPac+ systems. +o2em: +o2em: +o2em: +o2em: +o2em: +o2em: +o2em: +o2em: diff --git a/games/o2em/wordsize.diff b/games/o2em/wordsize.diff new file mode 100644 index 0000000000..f62b1574f8 --- /dev/null +++ b/games/o2em/wordsize.diff @@ -0,0 +1,47 @@ +diff -Naur o2em118src/src/crc32.c o2em118src.patched//src/crc32.c +--- o2em118src/src/crc32.c 2006-10-08 10:46:16.000000000 -0400 ++++ o2em118src.patched//src/crc32.c 2011-01-13 17:40:03.000000000 -0500 +@@ -20,7 +20,7 @@ + #include "crc32.h" + + +-static unsigned long crc32tab[256] = { ++static unsigned int crc32tab[256] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, + 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, + 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, +@@ -88,8 +88,8 @@ + }; + + +-unsigned long crc32_buf(const void *buf, long len){ +- unsigned long crc = ~0; ++unsigned int crc32_buf(const void *buf, int len){ ++ unsigned int crc = ~0; + unsigned char *p = (unsigned char*)buf; + + while (len--) crc = (crc >> 8) ^ crc32tab[(crc ^ (*p++)) & 0xff]; +@@ -97,8 +97,8 @@ + } + + +-unsigned long crc32_file(const char *filename){ +- unsigned long crc = ~0; ++unsigned int crc32_file(const char *filename){ ++ unsigned int crc = ~0; + FILE *f; + int c; + f = fopen(filename,"rb"); +diff -Naur o2em118src/src/crc32.h o2em118src.patched//src/crc32.h +--- o2em118src/src/crc32.h 2004-12-28 01:53:00.000000000 -0500 ++++ o2em118src.patched//src/crc32.h 2011-01-13 17:40:12.000000000 -0500 +@@ -1,7 +1,7 @@ + #ifndef __CRC32_H + #define __CRC32_H + +-unsigned long crc32_buf(const void *buf, long len); +-unsigned long crc32_file(const char *filename); ++unsigned int crc32_buf(const void *buf, int len); ++unsigned int crc32_file(const char *filename); + + #endif -- cgit v1.2.3