osmose: update to 0.9.96 and overhaul a number of things

1) Osmose’s 0.8.0 source archive is nowhere to be found, and
   it took quite a bit of effort to find Osmose-0-9-96-QT.zip,
   so the version had to be bumped out of necessity.

2) Specify the LICENSE as gnu-gpl-v3.

3) Osmose switched from SDL to Qt, so Qt has been hooked in.

4) The old patches have been removed sinced they didn't apply
   cleanly.

5) Patch an error related to pthreads, and add -lpthread.

6) Osmose also uses a few Linux-specific libraries such as
   Linux Joystick and ALSA, so their usage has been #ifdef’d out.

   It’s far from ideal, and probably breaks a few things, but it’d
   take a lot of work to replace them with platform-neutral libraries.

This is still very much a work-in-progress, but at the very least Osmose
now compiles and can run SMS ROMs seemingly without any issues.
This commit is contained in:
Dean Matzkov 2016-02-23 16:48:06 -07:00
parent f866391d2d
commit 54bc2e9f04
14 changed files with 267 additions and 87 deletions

View file

@ -1,26 +1,33 @@
# $NetBSD: Makefile,v 1.2 2012/10/03 21:29:14 asau Exp $
# $NetBSD$
#
DISTNAME= Osmose_0-8-0_src
PKGNAME= osmose-0.8.0
DISTNAME= Osmose-${PKGVERSION_NOREV:S/./-/g}-QT
PKGNAME= osmose-0.9.96
CATEGORIES= emulators
MASTER_SITES= http://bcz.emu-france.com/osmose/
MASTER_SITES= http://bcz.asterope.fr/osmose/
EXTRACT_SUFX= .zip
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= http://bcz.emu-france.com/index.htm
COMMENT= Sega Master System/Game Gear emulator
LICENSE= gnu-gpl-v3
WRKSRC= ${WRKDIR}/Osmose
USE_TOOLS+= gmake
USE_LANGUAGES= c c++
INSTALLATION_DIRS= bin
INSTALLATION_DIRS+= share/doc/${PKGBASE}
QMAKE=${QTDIR}/bin/qmake
do-configure:
cd ${WRKSRC} && \
env QTDIR=${QTDIR} ${QMAKE}
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/osmose ${DESTDIR}${PREFIX}/bin
${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX}/share/doc/osmose
${INSTALL_DATA} ${WRKSRC}/readme.txt ${DESTDIR}${PREFIX}/share/doc/osmose
${INSTALL_PROGRAM} ${WRKSRC}/${DISTNAME} ${DESTDIR}${PREFIX}/bin/osmose
${INSTALL_DATA} ${WRKSRC}/Readme.txt ${DESTDIR}${PREFIX}/share/doc/${PKGBASE}
.include "../../devel/SDL/buildlink3.mk"
.include "../../x11/qt4-libs/buildlink3.mk"
.include "../../x11/qt4-tools/buildlink3.mk"
.include "../../devel/zlib/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

View file

@ -1,3 +1,3 @@
@comment $NetBSD: PLIST,v 1.2 2009/10/11 10:45:03 thomasklausner Exp $
@comment $NetBSD$
bin/osmose
share/doc/osmose/readme.txt
share/doc/osmose/Readme.txt

View file

@ -1,2 +1,9 @@
Awfully awfully slow -- massive frameskipping on a fast machine
(1 in 100 displayed).
Osmose uses Linux-only libraries for dealing with sound and
joystick input, so they've been gutted so that Osmose can at
least compile and run.
The Preferences screen also seems to be broken, and the File
Select window acts a bit funny too.
At the very least, ROMs seem to load and run fine, as well as
as the rest of the UI controls. Not seeing any performance issues.

View file

@ -1,8 +1,13 @@
$NetBSD: distinfo,v 1.1.1.1 2006/12/13 18:34:02 thomasklausner Exp $
SHA1 (Osmose_0-8-0_src.zip) = 5eb4a64002bd52e2a235faa0c21a46f8315f1d3d
RMD160 (Osmose_0-8-0_src.zip) = c88dd515689a5a243e92dee93e0a8ef4d4b51bcb
Size (Osmose_0-8-0_src.zip) = 332579 bytes
SHA1 (patch-aa) = a5875ae5b9cb31aa7f0592d99211ffa3749ace0b
SHA1 (patch-ab) = 93b260b12d6b830ea57e0d22b3b67e0aa2c3b76e
SHA1 (patch-ac) = 114838b9b0d7bc78d56ecf4fff362f0fcbabfc81
SHA1 (Osmose-0-9-96-QT.zip) = 49f41e3babb4e48e8b0f095533a13e3ba2e1d97a
RMD160 (Osmose-0-9-96-QT.zip) = bacdebb2e077e3e08b51c973da3f52fe8f582d67
SHA512 (Osmose-0-9-96-QT.zip) = 0c2b8ec71edd567afdbee7d7347be2a854cd424c37daec4336987e749bd325739c6d7294213e5ed988b3dd4af11d548afd5601c0e6e74b27e481559b085c9e19
Size (Osmose-0-9-96-QT.zip) = 194671 bytes
SHA1 (patch-EmulationThread.h) = 2acf9935b6068f940c9d12beba13aca6a818c093
SHA1 (patch-Osmose-0-9-96-QT.pro) = 725547b5d2c0bf9015ca9ac1a02b54fc1661fe58
SHA1 (patch-OsmoseCore.cpp) = 384adc7aa8ae61ff256a27bcfe1b04f086b025e2
SHA1 (patch-OsmoseCore.h) = f678a6ee0ed688d71a3061c80077cd86c9274f4e
SHA1 (patch-OsmoseGUI.cpp) = ef0e611dc2c2bbb70ad26a4f57317b56c51cb07d
SHA1 (patch-OsmoseGUI.h) = e8dc4130c0ab33c9854566ee8012ab09f1fbb9a5
SHA1 (patch-QOsmoseConfiguration.h) = 8d194c2c685ca8f189b7435ee94d5026ca1238c9

View file

@ -0,0 +1,12 @@
$NetBSD$
--- EmulationThread.h.orig 2011-06-06 14:39:18.000000000 +0000
+++ EmulationThread.h
@@ -33,7 +33,7 @@
#include <iostream>
#include <sys/time.h>
-#include <QThread>
+#include <QtCore/QThread>
#include <QReadWriteLock>
#include "QGLImage.h"
#include "OsmoseConfigurationFile.h"

View file

@ -0,0 +1,45 @@
$NetBSD$
Add -lpthread, and remove Linux Joystick and ALSA-related stuff from
the build.
--- Osmose-0-9-96-QT.pro.orig 2011-04-30 13:23:22.000000000 +0000
+++ Osmose-0-9-96-QT.pro
@@ -6,12 +6,11 @@ TEMPLATE = app
TARGET =
DEPENDPATH += . cpu osmose unzip
INCLUDEPATH += . cpu osmose unzip
-LIBS += -lz -lasound
+LIBS += -lz -lpthread
QT+=opengl
# Input
HEADERS += EmulationThread.h \
- Joystick.h \
KeyMapper.h \
OsmoseConfigurationFile.h \
OsmoseEmulationThread.h \
@@ -40,7 +39,6 @@ HEADERS += EmulationThread.h \
osmose/SmsDebugger.h \
osmose/SmsEnvironment.h \
osmose/SN76489.h \
- osmose/SoundThread.h \
osmose/VDP.h \
osmose/VDP_GG.h \
osmose/Version.h \
@@ -50,7 +48,6 @@ HEADERS += EmulationThread.h \
unzip/unzip.h
FORMS += Configuration.ui LogWindow.ui
SOURCES += EmulationThread.cpp \
- Joystick.cpp \
KeyMapper.cpp \
main.cpp \
OsmoseConfigurationFile.cpp \
@@ -80,7 +77,6 @@ SOURCES += EmulationThread.cpp \
osmose/RomSpecificOption.cpp \
osmose/SmsEnvironment.cpp \
osmose/SN76489.cpp \
- osmose/SoundThread.cpp \
osmose/VDP.cpp \
osmose/VDP_GG.cpp \
osmose/WaveWriter.cpp \

View file

@ -0,0 +1,40 @@
$NetBSD$
--- osmose/OsmoseCore.cpp.orig 2011-06-06 15:24:54.000000000 +0000
+++ osmose/OsmoseCore.cpp
@@ -108,6 +108,7 @@ OsmoseCore::OsmoseCore(const char *rom_f
if (emu_opt.sound == true)
{
+#ifdef USE_SOUND
try
{
sndThread = new SoundThread("plughw:0,0", p->getFIFOSoundBuffer());
@@ -122,6 +123,7 @@ OsmoseCore::OsmoseCore(const char *rom_f
sndThread = NULL;
emu_opt.sound = false;
}
+#endif // USE_SOUND
}
}
@@ -131,7 +133,9 @@ OsmoseCore::OsmoseCore(const char *rom_f
OsmoseCore::~OsmoseCore()
{
if (wavW != NULL) delete wavW;
+#ifdef USE_SOUND
if (sndThread != NULL) delete sndThread;
+#endif
save_bbr(); /* Save Battery backed memory if needed. */
delete v;
delete mem;
@@ -218,7 +222,9 @@ void OsmoseCore::run_frame()
if (!p->getFIFOSoundBuffer()->spaceAvailable())
{
snd_started = true;
+#ifdef USE_SOUND
sndThread->resume();
+#endif
}
}

View file

@ -0,0 +1,25 @@
$NetBSD$
--- osmose/OsmoseCore.h.orig 2011-06-06 15:25:26.000000000 +0000
+++ osmose/OsmoseCore.h
@@ -56,7 +56,10 @@
#include "TGAWriter.h"
#include "QLogWindow.h"
#include "Pthreadcpp.h"
+
+#ifdef USE_SOUND
#include "SoundThread.h"
+#endif
using namespace std;
@@ -136,7 +139,9 @@ class OsmoseCore : public DebugEventThro
void save_bbr(); // Save Battery Backed Ram.
void displayTiles(unsigned int *s, VDP *vd, int tile, int x, int y);
+#ifdef USE_SOUND
SoundThread *sndThread;
+#endif
OsmoseConfigurationFile *configuration;
pthread_mutex_t *osmose_core_mutex;
};

View file

@ -0,0 +1,49 @@
$NetBSD$
Fix pthread-related build errors.
--- OsmoseGUI.cpp.orig 2011-06-06 15:07:12.000000000 +0000
+++ OsmoseGUI.cpp
@@ -40,7 +40,9 @@ OsmoseGUI::OsmoseGUI(QWidget * parent, Q
rom_name = NULL;
osmoseCore = NULL;
saveStateSlot = 0;
- osmose_core_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+ pthread_mutex_t osmose_core_mutex;
+ pthread_mutex_init(&osmose_core_mutex, NULL);
QLogWindow::getInstance()->appendLog("Starting Osmose emulator.");
@@ -347,6 +349,7 @@ OsmoseGUI::OsmoseGUI(QWidget * parent, Q
}
/* Try to find a Joystick*/
+#ifdef USE_JOYSTICK
js0 = NULL;
try
{
@@ -363,6 +366,7 @@ OsmoseGUI::OsmoseGUI(QWidget * parent, Q
msg = msg + ").";
QLogWindow::getInstance()->appendLog(msg);
}
+#endif // USE_JOYSTICK
// Enable Drop events.
setAcceptDrops(true);
@@ -381,6 +385,7 @@ OsmoseGUI::~OsmoseGUI()
void OsmoseGUI::configure()
{
+#ifdef USE_JOYSTICK
QOsmoseConfiguration *configWindow;
if (js0 == NULL)
@@ -394,6 +399,7 @@ void OsmoseGUI::configure()
}
configWindow->exec();
if (js0 != NULL) js0->setListener(this);
+#endif
}
void OsmoseGUI::sizeX1()

View file

@ -0,0 +1,30 @@
$NetBSD$
--- OsmoseGUI.h.orig 2011-06-06 15:07:18.000000000 +0000
+++ OsmoseGUI.h
@@ -49,11 +49,14 @@
#include "OsmoseCore.h"
#include "MemoryMapper.h"
#include "QLogWindow.h"
+
+#ifdef USE_JOYSTICK
#include "Joystick.h"
+#endif // USE_JOYSTICK
#define MENU_HEIGHT 20
-class OsmoseGUI : public QMainWindow, JoystickListener
+class OsmoseGUI : public QMainWindow
{
Q_OBJECT;
@@ -131,7 +134,9 @@ private:
void updateMachineMenu();
void loadTheROM(QString name);
bool isFullscreen;
+#ifdef USE_JOYSTICK
Joystick *js0;
+#endif
};
#endif // OsmoseGUI

View file

@ -0,0 +1,27 @@
$NetBSD$
--- QOsmoseConfiguration.h.orig 2011-06-06 15:07:54.000000000 +0000
+++ QOsmoseConfiguration.h
@@ -36,7 +36,11 @@
#include <QMessageBox>
#include "ui_Configuration.h"
#include "KeyMapper.h"
+
+#ifdef USE_JOYSTICK
#include "Joystick.h"
+#endif
+
#include "OsmoseConfigurationFile.h"
class KeyGrabber : public QDialog
@@ -53,7 +57,9 @@ protected:
unsigned int keyPressed;
};
-class QOsmoseConfiguration : public QDialog, public JoystickListener, private Ui::Configuration
+class QOsmoseConfiguration :
+ public QDialog,
+ private Ui::Configuration
{
Q_OBJECT

View file

@ -1,13 +0,0 @@
$NetBSD: patch-aa,v 1.1.1.1 2006/12/13 18:34:02 thomasklausner Exp $
--- PrecisionTimer.h.orig 2006-11-06 12:08:38.000000000 +0100
+++ PrecisionTimer.h
@@ -39,7 +39,7 @@ using namespace std;
#include <iostream>
#ifndef _RDTSC_TIMER_H
#define _RDTSC_TIMER_H
-#ifdef linux
+#ifdef __USE_UNIX98
#define PORTABLE_SLEEP_FUNC sleep( s );
#include <unistd.h>
#else

View file

@ -1,22 +0,0 @@
$NetBSD: patch-ab,v 1.1.1.1 2006/12/13 18:34:02 thomasklausner Exp $
--- SmsDebugger.cpp.orig 2006-11-20 20:41:30.000000000 +0100
+++ SmsDebugger.cpp
@@ -37,7 +37,7 @@ SmsDebugger::SmsDebugger()
void SmsDebugger::enter()
{
char *line;
- size_t n_byte = 256;
+ size_t n_byte = 8192;
char cmd[32];
int param1;
int param2;
@@ -52,7 +52,7 @@ void SmsDebugger::enter()
cout << endl << "Cmd:";
line = (char *) malloc(n_byte+1);
- getline(&line,&n_byte,stdin);
+ fgets(line,n_byte,stdin);
par_nbr = sscanf(line,"%s %x %x %x", cmd, &param1, &param2, &param3);
free(line);
switch(par_nbr)

View file

@ -1,32 +0,0 @@
$NetBSD: patch-ac,v 1.1.1.1 2006/12/13 18:34:02 thomasklausner Exp $
--- Makefile.orig 2006-11-22 12:13:01.000000000 +0000
+++ Makefile
@@ -1,6 +1,7 @@
#Zlib
Z_LIB_DIR= ./zlib/
-Z_LIB = $(Z_LIB_DIR)libz.a
+#Z_LIB = $(Z_LIB_DIR)libz.a
+Z_LIB = -lz
#unzip based on zlib.
UNZIP_DIR= ./unzip/
@@ -54,8 +55,8 @@ OSM_EXE = osmose
# Compiler/Linker Flags
# add -O3 to CFLAGS for speedup -pg on LFLAGS and CFLAGS for gprof
-CFLAGS = -Wall -D__USE_UNIX98 -O3
-LFLAGS = -lSDL
+CFLAGS += -Wall -D__USE_UNIX98 -O3
+LFLAGS += -lSDL
AFLAGS = -f elf
CC = g++
C_COMP = gcc
@@ -98,7 +99,6 @@ miniclean:
rm -f *.o core $(OSM_EXE)
libs:
- cd $(Z_LIB_DIR) && make libz.a
cd $(UNZIP_DIR) && make unzip.a