From c9ace3bb33adb9670540b96d9dd0217c70bdf27a Mon Sep 17 00:00:00 2001 From: wiz Date: Sun, 13 Feb 2000 23:28:06 +0000 Subject: Initial import of DarcNES, a multi-system emulator. Currently emulates NES, SMS, and GG with sound, PCE without, and has basic support for some other systems (SMD, Coleco, Atari ][). This will not work on MSB-machines, for lack of access. The code should support it, so if anyone's willing... --- emulators/darcnes/Makefile | 29 ++++++++++ emulators/darcnes/files/md5 | 3 + emulators/darcnes/files/patch-sum | 5 ++ emulators/darcnes/patches/patch-aa | 27 +++++++++ emulators/darcnes/patches/patch-ab | 98 ++++++++++++++++++++++++++++++++ emulators/darcnes/patches/patch-ac | 112 +++++++++++++++++++++++++++++++++++++ emulators/darcnes/pkg/COMMENT | 1 + emulators/darcnes/pkg/DESCR | 13 +++++ emulators/darcnes/pkg/PLIST | 4 ++ 9 files changed, 292 insertions(+) create mode 100644 emulators/darcnes/Makefile create mode 100644 emulators/darcnes/files/md5 create mode 100644 emulators/darcnes/files/patch-sum create mode 100644 emulators/darcnes/patches/patch-aa create mode 100644 emulators/darcnes/patches/patch-ab create mode 100644 emulators/darcnes/patches/patch-ac create mode 100644 emulators/darcnes/pkg/COMMENT create mode 100644 emulators/darcnes/pkg/DESCR create mode 100644 emulators/darcnes/pkg/PLIST (limited to 'emulators/darcnes') diff --git a/emulators/darcnes/Makefile b/emulators/darcnes/Makefile new file mode 100644 index 00000000000..9fac0ae8d1b --- /dev/null +++ b/emulators/darcnes/Makefile @@ -0,0 +1,29 @@ +# $NetBSD: Makefile,v 1.1.1.1 2000/02/13 23:28:06 wiz Exp $ + +DISTNAME= dn9a0212 +PKGNAME= darcnes-20000212 +WRKSRC= ${WRKDIR}/darcnes +CATEGORIES= emulators +MASTER_SITES= http://www.netway.com/~nyef/ +EXTRACT_SUFX= .tgz + +MAINTAINER= wiz@netbsd.org +HOMEPAGE= http://www.netway.com/~nyef/ + +USE_X11= yes +USE_GMAKE= yes + +# make dependencies +do-configure: + cd ${WRKSRC} && ${GMAKE} + +do-install: + ${INSTALL_{PROGRAM} ${WRKSRC}/darcnes ${PREFIX}/bin + ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/darcnes + ${INSTALL_MAN} ${WRKSRC}/readme ${PREFIX}/share/doc/darcnes + +.include "../../mk/bsd.pkg.mk" + +.if ( ${OBJECT_FMT} == "a.out" ) +MAKE_FLAGS+= ASM_FLAGS=-DASM_UNDERBARS +.endif diff --git a/emulators/darcnes/files/md5 b/emulators/darcnes/files/md5 new file mode 100644 index 00000000000..147f632df5c --- /dev/null +++ b/emulators/darcnes/files/md5 @@ -0,0 +1,3 @@ +$NetBSD: md5,v 1.1.1.1 2000/02/13 23:28:06 wiz Exp $ + +MD5 (dn9a0212.tgz) = 63b03e250a8cf6bd8f21777c577a39a3 diff --git a/emulators/darcnes/files/patch-sum b/emulators/darcnes/files/patch-sum new file mode 100644 index 00000000000..7707f0c1e3a --- /dev/null +++ b/emulators/darcnes/files/patch-sum @@ -0,0 +1,5 @@ +$NetBSD: patch-sum,v 1.1.1.1 2000/02/13 23:28:06 wiz Exp $ + +MD5 (patch-aa) = 09de740fe064d8112f99bee861beb3cd +MD5 (patch-ab) = 86c37c0b40a33778df4180d135f3e9a5 +MD5 (patch-ac) = e823aec468bc2dd79f07d3552de191ec diff --git a/emulators/darcnes/patches/patch-aa b/emulators/darcnes/patches/patch-aa new file mode 100644 index 00000000000..e058c6a43de --- /dev/null +++ b/emulators/darcnes/patches/patch-aa @@ -0,0 +1,27 @@ +$NetBSD: patch-aa,v 1.1.1.1 2000/02/13 23:28:07 wiz Exp $ + +--- ./Makefile.orig Sat Feb 12 20:04:24 2000 ++++ ./Makefile Sun Feb 13 22:26:07 2000 +@@ -20,8 +20,8 @@ + + CDFLAGS=-DPCE_CD_SUPPORT + +-CD_SRC=cd_freebsd.c +-CD_OBJ=cd_freebsd.o ++CD_SRC=cd_netbsd.c ++CD_OBJ=cd_netbsd.o + #CD_SRC=cd_linux.c + #CD_OBJ=cd_linux.o + +@@ -53,9 +53,9 @@ + AS=gcc + LD=gcc + +-LDFLAGS=-L/usr/X11R6/lib ++LDFLAGS=-L/usr/X11R6/lib -Wl,-R/usr/X11R6/lib + CFLAGS=$(BASE_CFLAGS) -I/usr/X11R6/include +-SFLAGS=$(BASE_SFLAGS) -I/usr/X11R6/include ++SFLAGS=$(BASE_SFLAGS) -I/usr/X11R6/include ${ASM_FLAGS} + BINFILE=darcnes + LIBS=-lXext -lXaw -lXmu -lXt -lX11 + endif diff --git a/emulators/darcnes/patches/patch-ab b/emulators/darcnes/patches/patch-ab new file mode 100644 index 00000000000..906e50f6516 --- /dev/null +++ b/emulators/darcnes/patches/patch-ab @@ -0,0 +1,98 @@ +$NetBSD: patch-ab,v 1.1.1.1 2000/02/13 23:28:07 wiz Exp $ + +--- ./cd_netbsd.c.orig Sun Feb 13 22:28:03 2000 ++++ ./cd_netbsd.c Sun Feb 13 22:28:32 2000 +@@ -0,0 +1,93 @@ ++/* ++ * cd_netbsd.c ++ * ++ * NetBSD CDROM interface ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#include "types.h" ++#include "cd.h" ++ ++#define CDROM_DEVICE "/dev/rcd0d" ++ ++int pce_cd_drive; ++ ++struct ioc_read_toc_entry pce_cd_tocentry; ++ ++void cd_set_sector_address(u32 sector) ++{ ++ int result; ++ ++ result = lseek(pce_cd_drive, (sector) * 2048, SEEK_SET); ++ if (result < 0) { ++ perror("pce_cd: seeking to CD sector"); ++ } ++} ++ ++void cd_read_next_sector(u8 *buf) ++{ ++ int result; ++ ++ result = read(pce_cd_drive, buf, 2048); ++ if (result < 0) { ++ perror("pce_cd: reading CD data"); ++ } ++} ++ ++void cd_get_tocheader(u8 *start_track, u8 *stop_track) ++{ ++ struct ioc_toc_header toc_header; ++ int result; ++ ++ result = ioctl(pce_cd_drive, CDIOREADTOCHEADER, &toc_header); ++ if (result < 0) { ++ perror("pce_cd: reading tocheader"); ++ /* XXX: use dummy values? */ ++ *start_track = 1; ++ *stop_track = 4; ++ } else { ++ *start_track = toc_header.starting_track; ++ *stop_track = toc_header.ending_track; ++ } ++} ++ ++void cd_get_tocentry(u8 track, u32 *lba, u8 *flags) ++{ ++ int result; ++ struct cd_toc_entry toc_entry; ++ ++ pce_cd_tocentry.starting_track = track; ++ pce_cd_tocentry.address_format = CD_LBA_FORMAT; ++ pce_cd_tocentry.data_len = sizeof(toc_entry); ++ pce_cd_tocentry.data = &toc_entry; ++ ++ result = ioctl(pce_cd_drive, CDIOREADTOCENTRYS, &pce_cd_tocentry); ++ if (result < 0) { ++ perror("pce_cd: reading tocentry"); ++/* deb_printf("pce_cd: tocread failure.\n"); */ ++ } else { ++ /* is this what you want? */ ++ *lba = toc_entry.addr.lba; ++ *flags = toc_entry.control; ++ /* ???: FIXME: may want cdte.adr << 4 in here as well */ ++ } ++} ++ ++void cd_init(void) ++{ ++ pce_cd_drive = open(CDROM_DEVICE, O_RDONLY); ++ if (pce_cd_drive < 0) { ++ perror("pce_cd: opening CD drive"); ++ pce_cd_drive = 0; ++ } else { ++ /* Do something? */ ++ } ++} diff --git a/emulators/darcnes/patches/patch-ac b/emulators/darcnes/patches/patch-ac new file mode 100644 index 00000000000..66519a9eda7 --- /dev/null +++ b/emulators/darcnes/patches/patch-ac @@ -0,0 +1,112 @@ +$NetBSD: patch-ac,v 1.1.1.1 2000/02/13 23:28:07 wiz Exp $ + +--- ./snd_unix.c.orig Wed Jan 26 21:22:18 2000 ++++ ./snd_unix.c Sun Feb 13 22:27:06 2000 +@@ -8,13 +8,21 @@ + + /* #define SOUND_LINUX */ /* use linux sound header */ +-#define SOUND_FREEBSD /* use freebsd sound header */ ++/* #define SOUND_FREEBSD */ /* use freebsd sound header */ ++#define SOUND_NETBSD /* use netbsd sound system */ + + #ifdef SOUND_LINUX + #define SOUND_HEADER ++#define SOUND_DEVICE "/dev/dsp" + #endif + + #ifdef SOUND_FREEBSD + #define SOUND_HEADER ++#define SOUND_DEVICE "/dev/dsp" ++#endif ++ ++#ifdef SOUND_NETBSD ++#define SOUND_HEADER ++#define SOUND_DEVICE "/dev/sound" + #endif + + #include +@@ -66,16 +74,21 @@ + + int snd_open(int samples_per_sync, int sample_rate) + { +- int tmp; + int result; ++#if defined(SOUND_LINUX) || defined(SOUND_FREEBSD) ++ int tmp; + int sound_rate; + int sound_frag; ++#endif ++#ifdef SOUND_NETBSD ++ audio_info_t info; ++#endif + + waveptr = 0; + wavflag = 0; + +- printf("opening /dev/dsp..."); +- sound_fd = open("/dev/dsp", O_WRONLY); ++ printf("opening "SOUND_DEVICE"..."); ++ sound_fd = open(SOUND_DEVICE, O_WRONLY); + if (sound_fd < 0) { + perror("failed"); + sound_fd = 0; +@@ -83,7 +96,8 @@ + } else { + printf("done.\n"); + } +- ++ ++#if defined(SOUND_LINUX) || defined(SOUND_FREEBSD) + printf("setting unsigned 8-bit format..."); + tmp = AFMT_U8; + result = ioctl(sound_fd, SNDCTL_DSP_SETFMT, &tmp); +@@ -132,7 +146,41 @@ + } else { + printf("done.\n"); + } ++#endif ++#ifdef SOUND_NETBSD ++ AUDIO_INITINFO(&info); ++ printf("setting unsigned 8-bit format..."); ++ info.play.encoding = AUDIO_ENCODING_ULINEAR; ++ /* this doesn't work for me, so ignore results */ ++ result = ioctl(sound_fd, AUDIO_SETINFO, &info); ++ if (result < 0) ++ { ++ perror("warning: unsigned linear mode failed, using signed"); ++ info.play.encoding = AUDIO_ENCODING_SLINEAR; ++ } + ++ printf("setting sound rate to %dHz...", sample_rate); ++ info.play.sample_rate = sample_rate; ++ /* 8 bits per sample */ ++ info.play.precision = 8; ++ printf("setting mono mode..."); ++ info.play.channels = 1; ++ info.mode = AUMODE_PLAY_ALL; ++ /* "frag size" */ ++ info.blocksize = 1 << 8; ++ /* "number of frags", hiwater mark */ ++ info.hiwat = 8; ++ result = ioctl(sound_fd, AUDIO_SETINFO, &info); ++ if (result < 0) { ++ perror("initializing sound failed"); ++ close(sound_fd); ++ sound_fd = 0; ++ return 0; ++ } else { ++ printf("done.\n"); ++ } ++#endif ++ + return 1; + } + +@@ -141,6 +189,7 @@ + if (sound_fd) { + close(sound_fd); + } ++ sound_fd = 0; + } + + /* diff --git a/emulators/darcnes/pkg/COMMENT b/emulators/darcnes/pkg/COMMENT new file mode 100644 index 00000000000..47050668bc4 --- /dev/null +++ b/emulators/darcnes/pkg/COMMENT @@ -0,0 +1 @@ +multi-system emulator (NES, SMS, GG, PCE, and others) diff --git a/emulators/darcnes/pkg/DESCR b/emulators/darcnes/pkg/DESCR new file mode 100644 index 00000000000..79ec1913038 --- /dev/null +++ b/emulators/darcnes/pkg/DESCR @@ -0,0 +1,13 @@ +DarcNES is a multi-system emulator. Some of the systems it emulates +are + o Sega Master System, Sega Game Gear (with sound) + o Nintende Entertainment System (with sound) + o PC-Engine +and in development is support for + o Colecovision + o Sega Megadrive, also known as Sega Genesis + o Apple ][ + +The keys are: 'A', 'S', '[', ']', arrows, and escape. + +By Nyef (Alastair Bridgewater). diff --git a/emulators/darcnes/pkg/PLIST b/emulators/darcnes/pkg/PLIST new file mode 100644 index 00000000000..40898d48e33 --- /dev/null +++ b/emulators/darcnes/pkg/PLIST @@ -0,0 +1,4 @@ +@comment $NetBSD: PLIST,v 1.1.1.1 2000/02/13 23:28:07 wiz Exp $ +bin/darcnes +share/doc/darcnes/readme +@dirrm share/doc/darcnes -- cgit v1.2.3