From 514cae73d16868eef5f9808e4e3a23097745f065 Mon Sep 17 00:00:00 2001 From: dillo Date: Mon, 26 Jul 2004 18:23:22 +0000 Subject: import gens 2.12rc3 from pkgsrc-wip: Gens is an emulator of Sega's 16 bit consoles: Genesis (a.k.a Megadrive) and Sega CD (a.k.a Mega CD). For Sega CD, you will need BIOS ROM images. --- emulators/gens/DESCR | 3 + emulators/gens/Makefile | 30 +++ emulators/gens/PLIST | 39 ++++ emulators/gens/distinfo | 15 ++ emulators/gens/patches/patch-aa | 73 ++++++++ emulators/gens/patches/patch-ab | 43 +++++ emulators/gens/patches/patch-ac | 118 ++++++++++++ emulators/gens/patches/patch-ad | 133 +++++++++++++ emulators/gens/patches/patch-ae | 21 +++ emulators/gens/patches/patch-af | 405 ++++++++++++++++++++++++++++++++++++++++ emulators/gens/patches/patch-ag | 99 ++++++++++ emulators/gens/patches/patch-ah | 51 +++++ emulators/gens/patches/patch-ai | 15 ++ emulators/gens/patches/patch-aj | 35 ++++ emulators/gens/patches/patch-ak | 19 ++ 15 files changed, 1099 insertions(+) create mode 100644 emulators/gens/DESCR create mode 100644 emulators/gens/Makefile create mode 100644 emulators/gens/PLIST create mode 100644 emulators/gens/distinfo create mode 100644 emulators/gens/patches/patch-aa create mode 100644 emulators/gens/patches/patch-ab create mode 100644 emulators/gens/patches/patch-ac create mode 100644 emulators/gens/patches/patch-ad create mode 100644 emulators/gens/patches/patch-ae create mode 100644 emulators/gens/patches/patch-af create mode 100644 emulators/gens/patches/patch-ag create mode 100644 emulators/gens/patches/patch-ah create mode 100644 emulators/gens/patches/patch-ai create mode 100644 emulators/gens/patches/patch-aj create mode 100644 emulators/gens/patches/patch-ak (limited to 'emulators/gens') diff --git a/emulators/gens/DESCR b/emulators/gens/DESCR new file mode 100644 index 00000000000..c2954770d5d --- /dev/null +++ b/emulators/gens/DESCR @@ -0,0 +1,3 @@ +Gens is an emulator of Sega's 16 bit consoles: Genesis (a.k.a +Megadrive) and Sega CD (a.k.a Mega CD). For Sega CD, you will need +BIOS ROM images. diff --git a/emulators/gens/Makefile b/emulators/gens/Makefile new file mode 100644 index 00000000000..3fbf51adc37 --- /dev/null +++ b/emulators/gens/Makefile @@ -0,0 +1,30 @@ +# $NetBSD: Makefile,v 1.1.1.1 2004/07/26 18:23:22 dillo Exp $ +# + +DISTNAME= gens-rc3 +PKGNAME= gens-2.12rc3 +CATEGORIES= emulators +MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=gens/} + +MAINTAINER= dillo@NetBSD.org +HOMEPAGE= http://gens.consolemul.com/ +COMMENT= Sega Genesis emulator with Sega CD support + +BUILD_DEPENDS+= nasm-[0-9]*:../../devel/nasm + +# contains i386 assembler sources +ONLY_FOR_PLATFORM= *-i386 + +WRKSRC= ${WRKDIR}/GensForLinux +USE_BUILDLINK3= yes +GNU_CONFIGURE= yes +USE_GNU_TOOLS+= make + +.include "../../devel/SDL/buildlink3.mk" +.include "../../x11/gtk2/buildlink3.mk" + +post-install: + ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/gens + ${INSTALL_DATA} ${WRKSRC}/gens.txt ${PREFIX}/share/doc/gens + +.include "../../mk/bsd.pkg.mk" diff --git a/emulators/gens/PLIST b/emulators/gens/PLIST new file mode 100644 index 00000000000..cccd4417336 --- /dev/null +++ b/emulators/gens/PLIST @@ -0,0 +1,39 @@ +@comment $NetBSD: PLIST,v 1.1.1.1 2004/07/26 18:23:22 dillo Exp $ +bin/gens +share/doc/gens/gens.txt +share/gens/Gens2.ico +share/gens/bitmap1.png +share/gens/bmp00000.png +share/gens/bmp00001.png +share/gens/bmp00002.png +share/gens/bmp00003.png +share/gens/bmp00004.png +share/gens/bmp00005.png +share/gens/bmp00006.png +share/gens/gens.ico +share/gens/gens_big.bmp +share/gens/gens_small.png +share/gens/sonic.ico +share/gens/sonic2.ico +share/gens/file_text.png +share/gens/2rightarrow.png +share/gens/Modem.png +share/gens/binary.png +share/gens/cdrom2_unmount.png +share/gens/editcopy.png +share/gens/filleclose.png +share/gens/folder_slin_open.png +share/gens/history.png +share/gens/kmix.png +share/gens/ksysguard.png +share/gens/memory.png +share/gens/package_games.png +share/gens/package_settings.png +share/gens/password.png +share/gens/reload.png +share/gens/resource.png +share/gens/viewmag.png +share/gens/viewmag1.png +share/gens/xpaint.png +@dirrm share/gens +@dirrm share/doc/gens diff --git a/emulators/gens/distinfo b/emulators/gens/distinfo new file mode 100644 index 00000000000..4094cdd2d61 --- /dev/null +++ b/emulators/gens/distinfo @@ -0,0 +1,15 @@ +$NetBSD: distinfo,v 1.1.1.1 2004/07/26 18:23:22 dillo Exp $ + +SHA1 (gens-rc3.tar.gz) = 6057564665007686c9ea8df364be3220499f9917 +Size (gens-rc3.tar.gz) = 658729 bytes +SHA1 (patch-aa) = e6a4768963e9da1799b80e775f0637eb07b2ca5c +SHA1 (patch-ab) = cb5e049b813016aec6cd7b4c67560953a04e5bc6 +SHA1 (patch-ac) = 7c3f17c59727365ff4cf11d1a5d1c3da19943872 +SHA1 (patch-ad) = dae2ad294272f18067a640d88286ddfeb7775aaf +SHA1 (patch-ae) = 6902f4e2abd38b2dcd946309c1321a95c3ded2b4 +SHA1 (patch-af) = 5acae2a597166b3948a56bb24b712ea49d114c8d +SHA1 (patch-ag) = d16015ffd9e2e2d33ed229dbaa41a18c44968f47 +SHA1 (patch-ah) = a72c19bb5a521f4c26604131ff4245be4968835d +SHA1 (patch-ai) = 596fe718e5c38091a06198413bcf29b3c668571f +SHA1 (patch-aj) = 87d2f4001bf16469430d955d7e58ffe6316595af +SHA1 (patch-ak) = 4b06340b3702dafea12d78841f379b5255a1a74f diff --git a/emulators/gens/patches/patch-aa b/emulators/gens/patches/patch-aa new file mode 100644 index 00000000000..0b1d78ecc95 --- /dev/null +++ b/emulators/gens/patches/patch-aa @@ -0,0 +1,73 @@ +$NetBSD: patch-aa,v 1.1.1.1 2004/07/26 18:23:22 dillo Exp $ + +--- src/gens/Makefile.in.orig 2004-05-19 22:48:47.000000000 +0200 ++++ src/gens/Makefile.in +@@ -199,6 +199,8 @@ gens_SOURCES = \ + util/gym.h \ + util/scrshot.c \ + util/scrshot.h \ ++ util/chd.c \ ++ util/chd.h \ + util/unzip.c \ + util/unzip.h \ + util/wave.c \ +@@ -284,6 +286,7 @@ am_gens_OBJECTS = gens_core/cpu/68k/gens + sdllayer/gens-g_sdlsound.$(OBJEXT) util/gens-rom.$(OBJEXT) \ + util/gens-save.$(OBJEXT) util/gens-ggenie.$(OBJEXT) \ + util/gens-gym.$(OBJEXT) util/gens-scrshot.$(OBJEXT) \ ++ util/gens-chd.$(OBJEXT) \ + util/gens-unzip.$(OBJEXT) util/gens-wave.$(OBJEXT) \ + port/gens-port.$(OBJEXT) port/gens-timer.$(OBJEXT) \ + emulator/gens-ui_proxy.$(OBJEXT) emulator/gens-g_main.$(OBJEXT) \ +@@ -343,6 +346,7 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp + @AMDEP_TRUE@ $(DEPDIR)/util/gens-rom.Po \ + @AMDEP_TRUE@ $(DEPDIR)/util/gens-save.Po \ + @AMDEP_TRUE@ $(DEPDIR)/util/gens-scrshot.Po \ ++@AMDEP_TRUE@ $(DEPDIR)/util/gens-chd.Po \ + @AMDEP_TRUE@ $(DEPDIR)/util/gens-unzip.Po \ + @AMDEP_TRUE@ $(DEPDIR)/util/gens-wave.Po + COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ +@@ -502,6 +506,8 @@ util/gens-gym.$(OBJEXT): util/gym.c util + $(DEPDIR)/util/.dirstamp + util/gens-scrshot.$(OBJEXT): util/scrshot.c util/.dirstamp \ + $(DEPDIR)/util/.dirstamp ++util/gens-chd.$(OBJEXT): util/chd.c util/.dirstamp \ ++ $(DEPDIR)/util/.dirstamp + util/gens-unzip.$(OBJEXT): util/unzip.c util/.dirstamp \ + $(DEPDIR)/util/.dirstamp + util/gens-wave.$(OBJEXT): util/wave.c util/.dirstamp \ +@@ -609,6 +615,7 @@ mostlyclean-compile: + -rm -f util/gens-rom.$(OBJEXT) + -rm -f util/gens-save.$(OBJEXT) + -rm -f util/gens-scrshot.$(OBJEXT) ++ -rm -f util/gens-chd.$(OBJEXT) + -rm -f util/gens-unzip.$(OBJEXT) + -rm -f util/gens-wave.$(OBJEXT) + +@@ -684,6 +691,7 @@ distclean-compile: + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/util/gens-rom.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/util/gens-save.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/util/gens-scrshot.Po@am__quote@ ++@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/util/gens-chd.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/util/gens-unzip.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/util/gens-wave.Po@am__quote@ + +@@ -1038,6 +1046,18 @@ util/gens-scrshot.obj: util/scrshot.c + @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gens_CFLAGS) $(CFLAGS) -c -o util/gens-scrshot.obj `cygpath -w util/scrshot.c` + ++util/gens-chd.o: util/chd.c ++@AMDEP_TRUE@ source='util/chd.c' object='util/gens-chd.o' libtool=no @AMDEPBACKSLASH@ ++@AMDEP_TRUE@ depfile='$(DEPDIR)/util/gens-chd.Po' tmpdepfile='$(DEPDIR)/util/gens-chd.TPo' @AMDEPBACKSLASH@ ++@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gens_CFLAGS) $(CFLAGS) -c -o util/gens-chd.o `test -f util/chd.c || echo '$(srcdir)/'`util/chd.c ++ ++util/gens-chd.obj: util/chd.c ++@AMDEP_TRUE@ source='util/chd.c' object='util/gens-chd.obj' libtool=no @AMDEPBACKSLASH@ ++@AMDEP_TRUE@ depfile='$(DEPDIR)/util/gens-chd.Po' tmpdepfile='$(DEPDIR)/util/gens-chd.TPo' @AMDEPBACKSLASH@ ++@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ ++ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gens_CFLAGS) $(CFLAGS) -c -o util/gens-chd.obj `cygpath -w util/chd.c` ++ + util/gens-unzip.o: util/unzip.c + @AMDEP_TRUE@ source='util/unzip.c' object='util/gens-unzip.o' libtool=no @AMDEPBACKSLASH@ + @AMDEP_TRUE@ depfile='$(DEPDIR)/util/gens-unzip.Po' tmpdepfile='$(DEPDIR)/util/gens-unzip.TPo' @AMDEPBACKSLASH@ diff --git a/emulators/gens/patches/patch-ab b/emulators/gens/patches/patch-ab new file mode 100644 index 00000000000..e84b5c60f26 --- /dev/null +++ b/emulators/gens/patches/patch-ab @@ -0,0 +1,43 @@ +$NetBSD: patch-ab,v 1.1.1.1 2004/07/26 18:23:23 dillo Exp $ + +--- src/gens/gtkui/support.c.orig 2004-05-18 20:04:29.000000000 +0200 ++++ src/gens/gtkui/support.c +@@ -783,12 +783,14 @@ addIsoFilter(GtkWidget* widget) + // "SegaCD image file\0*.bin;*.iso;*.raw\0All files\0*.*\0\0" + const char* bin = "*.[bb][iI][nN]"; + const char* iso = "*.[iI][sS][oO]"; ++ const char* chd = "*.[cC][hH][dD]"; + const char* raw = "*.[rR][aA][wW]"; + + filter = gtk_file_filter_new (); + gtk_file_filter_set_name (filter, "SegaCD image file"); + gtk_file_filter_add_pattern (filter, bin); + gtk_file_filter_add_pattern (filter, iso); ++ gtk_file_filter_add_pattern (filter, chd); + gtk_file_filter_add_pattern (filter, raw); + gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (widget), filter); + } +@@ -803,6 +805,7 @@ addRomsFilter(GtkWidget* widget) + const char* gen = "*.[gG][eE][nN]"; + const char* _32x = "*.32[xX]"; + const char* iso = "*.[iI][sS][oO]"; ++ const char* chd = "*.[cC][hH][dD]"; + const char* raw = "*.[rR][aA][wW]"; + const char* zip = "*.[zZ][iI][pP]"; + const char* gz ="*.[gG][zZ]"; +@@ -816,6 +819,7 @@ addRomsFilter(GtkWidget* widget) + gtk_file_filter_add_pattern (filter, gen); + gtk_file_filter_add_pattern (filter, _32x); + gtk_file_filter_add_pattern (filter, iso); ++ gtk_file_filter_add_pattern (filter, chd); + gtk_file_filter_add_pattern (filter, raw); + gtk_file_filter_add_pattern (filter, zip); + gtk_file_filter_add_pattern (filter, gz); +@@ -842,6 +846,7 @@ addRomsFilter(GtkWidget* widget) + filter = gtk_file_filter_new (); + gtk_file_filter_set_name (filter, "SegaCD image"); + gtk_file_filter_add_pattern (filter, iso); ++ gtk_file_filter_add_pattern (filter, chd); + gtk_file_filter_add_pattern (filter, raw); + gtk_file_filter_add_pattern (filter, bin); + gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (widget), filter); diff --git a/emulators/gens/patches/patch-ac b/emulators/gens/patches/patch-ac new file mode 100644 index 00000000000..f4cbadf9e79 --- /dev/null +++ b/emulators/gens/patches/patch-ac @@ -0,0 +1,118 @@ +$NetBSD: patch-ac,v 1.1.1.1 2004/07/26 18:23:23 dillo Exp $ + +--- src/gens/segacd/cd_aspi.c.orig 2004-05-18 22:34:00.000000000 +0200 ++++ src/gens/segacd/cd_aspi.c +@@ -8,6 +8,8 @@ + #include "cd_aspi.h" + #include "mem_s68k.h" + ++#ifdef linux ++ + #define HIBYTE(x) x >> 8 + #define LOBYTE(x) x & 0xff + void Sleep (int i); +@@ -2878,3 +2880,104 @@ Fill_SCD_TOC_Zero (void) + + CD_Present = 0; + } ++ ++#else ++ ++int CUR_DEV; ++int Num_CD_Drive; ++ ++int ++ASPI_Close_Tray_CDD_cC_COMP (SRB_ExecSCSICmd * s) ++{ ++ return -1; ++} ++ ++int ++ASPI_End (void) ++{ ++ return 1; ++} ++ ++int ++ASPI_Fast_Seek_COMP (SRB_ExecSCSICmd * s) ++{ ++ return 0; ++} ++ ++void ++ASPI_Flush_Cache_CDC (void) ++{ ++ return; ++} ++ ++int ++ASPI_Init (void) ++{ ++ Num_CD_Drive = 0; ++ return 0; ++} ++ ++int ++ASPI_Lock (int flock) ++{ ++ return 5; ++} ++ ++int ++ASPI_Open_Tray_CDD_cD_COMP (SRB_ExecSCSICmd * s) ++{ ++ return -1; ++} ++ ++void ++ASPI_Read_One_LBA_CDC (void) ++{ ++ return; ++} ++ ++void ++ASPI_Reset_Drive (char *buf) ++{ ++ return; ++} ++ ++int ++ASPI_Seek (int pos, int async, ++ int (*PostProc) (struct tagSRB32_ExecSCSICmd *)) ++{ ++ return 5; ++} ++ ++int ++ASPI_Seek_CDD_c4_COMP (SRB_ExecSCSICmd * s) ++{ ++ return -1; ++} ++ ++int ++ASPI_Star_Stop_Unit (int op, int imm, int async, ++ int (*PostProc) (struct tagSRB32_ExecSCSICmd *)) ++{ ++ return 5; ++} ++ ++int ++ASPI_Stop_CDD_c1_COMP (SRB_ExecSCSICmd * s) ++{ ++ return 0; ++} ++ ++int ++ASPI_Stop_Play_Scan (int async, ++ int (*PostProc) (struct tagSRB32_ExecSCSICmd *)) ++{ ++ return 5; ++} ++ ++void ++Wait_Read_Complete (void) ++{ ++ return; ++} ++ ++#endif diff --git a/emulators/gens/patches/patch-ad b/emulators/gens/patches/patch-ad new file mode 100644 index 00000000000..094ada2d687 --- /dev/null +++ b/emulators/gens/patches/patch-ad @@ -0,0 +1,133 @@ +$NetBSD: patch-ad,v 1.1.1.1 2004/07/26 18:23:25 dillo Exp $ + +--- src/gens/segacd/cd_file.c.orig 2004-05-18 22:34:00.000000000 +0200 ++++ src/gens/segacd/cd_file.c +@@ -39,7 +39,7 @@ FILE_End (void) + int + Load_ISO (char *buf, char *iso_name) + { +- FILE *File_Size; ++ int fmt; + int i, j, num_track, Cur_LBA; + FILE *tmp_file; + char tmp_name[1024], tmp_ext[10]; +@@ -52,41 +52,62 @@ Load_ISO (char *buf, char *iso_name) + + Unload_ISO (); + +- if (Detect_Format (iso_name) == SEGACD_IMAGE + 1) ++ fmt = Detect_Format (iso_name); ++ if (fmt == SEGACD_IMAGE + 1) + Tracks[0].Type = TYPE_BIN; +- else if (Detect_Format (iso_name) == SEGACD_IMAGE) ++ else if (fmt == SEGACD_IMAGE) + Tracks[0].Type = TYPE_ISO; + else + return -2; + +- File_Size = fopen (iso_name, "rb"); +- fseek (File_Size, 0, SEEK_END); +- Tracks[0].Lenght = ftell (File_Size); +- fseek (File_Size, 0, SEEK_SET); ++ if (!stricmp (".chd", &iso_name[strlen (iso_name) -4])) ++ { ++ Tracks[0].F = NULL; ++ Tracks[0].chd = chd_open(iso_name, NULL); ++ ++ if (Tracks[0].chd == NULL) ++ { ++ Tracks[0].Type = 0; ++ Tracks[0].Lenght = 0; ++ return -1; ++ } + +- if (Tracks[0].Type == TYPE_ISO) +- Tracks[0].Lenght >>= 11; // size in sectors ++ Tracks[0].Lenght = Tracks[0].chd->total_len; ++ ++ if (Tracks[0].Type == TYPE_ISO) ++ chd_read_range(Tracks[0].chd, buf, 0x100, 0x200); ++ else ++ chd_read_range(Tracks[0].chd, buf, 0x110, 0x200); ++ } + else +- Tracks[0].Lenght /= 2352; // size in sectors ++ { ++ Tracks[0].F = fopen (iso_name, "rb"); ++ Tracks[0].chd = NULL; ++ ++ if (Tracks[0].F == NULL) ++ { ++ Tracks[0].Type = 0; ++ Tracks[0].Lenght = 0; ++ return -1; ++ } + +- fclose (File_Size); ++ fseek (Tracks[0].F, 0, SEEK_END); ++ Tracks[0].Lenght = ftell (Tracks[0].F); + +- Tracks[0].F = fopen (iso_name, "rb"); ++ if (Tracks[0].Type == TYPE_ISO) ++ fseek (Tracks[0].F, 0x100, SEEK_SET); ++ else ++ fseek (Tracks[0].F, 0x110, SEEK_SET); ++ ++ fread (buf, 1, 0x200, Tracks[0].F); ++ fseek (Tracks[0].F, 0, SEEK_SET); + +- if (Tracks[0].F == NULL) +- { +- Tracks[0].Type = 0; +- Tracks[0].Lenght = 0; +- return -1; + } + + if (Tracks[0].Type == TYPE_ISO) +- fseek (Tracks[0].F, 0x100, SEEK_SET); ++ Tracks[0].Lenght >>= 11; // size in sectors + else +- fseek (Tracks[0].F, 0x110, SEEK_SET); +- +- fread (buf, 1, 0x200, Tracks[0].F); +- fseek (Tracks[0].F, 0, SEEK_SET); ++ Tracks[0].Lenght /= 2352; // size in sectors + + SCD.TOC.First_Track = 1; + +@@ -219,6 +240,10 @@ Unload_ISO (void) + + Track_Played = 99; + ++ if (Tracks[0].chd) ++ chd_close(Tracks[0].chd); ++ Tracks[0].chd = NULL; ++ + for (i = 0; i < 100; i++) + { + if (Tracks[i].F) +@@ -237,7 +262,7 @@ FILE_Read_One_LBA_CDC (void) + + if (CDD.Control & 0x0100) // DATA + { +- if (Tracks[0].F == NULL) ++ if (Tracks[0].F == NULL && Tracks[0].chd == NULL) + return -1; + + if (SCD.Cur_LBA < 0) +@@ -254,8 +279,13 @@ FILE_Read_One_LBA_CDC (void) + + // memset(cp_buf, 0, 2048); + +- fseek (Tracks[0].F, where_read, SEEK_SET); +- fread (cp_buf, 1, 2048, Tracks[0].F); ++ if (Tracks[0].chd != NULL) ++ chd_read_range(Tracks[0].chd, cp_buf, where_read, 2048); ++ else ++ { ++ fseek (Tracks[0].F, where_read, SEEK_SET); ++ fread (cp_buf, 1, 2048, Tracks[0].F); ++ } + + #ifdef DEBUG_CD + fprintf (debug_SCD_file, "\n\nRead file CDC 1 data sector :\n"); diff --git a/emulators/gens/patches/patch-ae b/emulators/gens/patches/patch-ae new file mode 100644 index 00000000000..ef7cba4e74e --- /dev/null +++ b/emulators/gens/patches/patch-ae @@ -0,0 +1,21 @@ +$NetBSD: patch-ae,v 1.1.1.1 2004/07/26 18:23:25 dillo Exp $ + +--- src/gens/segacd/cd_file.h.orig 2004-03-14 15:34:33.000000000 +0100 ++++ src/gens/segacd/cd_file.h +@@ -1,6 +1,8 @@ + #ifndef _CD_FILE_H + #define _CD_FILE_H + ++#include "chd.h" ++ + #define TYPE_ISO 1 + #define TYPE_BIN 2 + #define TYPE_MP3 3 +@@ -9,6 +11,7 @@ + + struct _file_track { + FILE *F; ++ struct chd *chd; + int Lenght; + int Type; + }; diff --git a/emulators/gens/patches/patch-af b/emulators/gens/patches/patch-af new file mode 100644 index 00000000000..18500bba7f4 --- /dev/null +++ b/emulators/gens/patches/patch-af @@ -0,0 +1,405 @@ +$NetBSD: patch-af,v 1.1.1.1 2004/07/26 18:23:25 dillo Exp $ + +--- src/gens/util/chd.c.orig 2004-06-25 19:55:16.000000000 +0200 ++++ src/gens/util/chd.c +@@ -0,0 +1,400 @@ ++/* ++ NiH: chd.c,v 1.6 2004/06/25 23:31:08 dillo Exp ++ ++ chd.c -- accessing chd files ++ Copyright (C) 2004 Dieter Baron and Thomas Klausner ++ ++ This file is part of ckmame, a program to check rom sets for MAME. ++ The authors can be contacted at ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++*/ ++ ++ ++ ++#include ++#include ++#include ++#include ++ ++#include "chd.h" ++ ++ ++ ++#define MAX_HEADERLEN 120 /* maximum header length */ ++#define TAG "MComprHD" ++#define TAG_LEN 8 /* length of tag */ ++#define TAG_AND_LEN 12 /* length of tag + header length */ ++ ++#define MAP_ENTRY_SIZE_V12 8 /* size of map entry, versions 1 & 2 */ ++#define MAP_ENTRY_SIZE_V3 16 /* size of map entry, version 3 */ ++ ++#define GET_LONG(b) (b+=4,((b)[-4]<<24)|((b)[-3]<<16)|((b)[-2]<<8)|(b)[-1]) ++#define GET_QUAD(b) (b+=8,((uint64_t)(b)[-8]<<56)|((uint64_t)(b)[-7]<<48) \ ++ |((uint64_t)(b)[-6]<<40)|((uint64_t)(b)[-5]<<32) \ ++ |((uint64_t)(b)[-4]<<24)|((uint64_t)(b)[-3]<<16) \ ++ |((uint64_t)(b)[-2]<<8)|((uint64_t)(b)[-1])) ++#define GET_SHORT(b) (b+=2,((b)[-2]<<8)|(b)[-1]) ++ ++static int read_header(struct chd *); ++static int read_map(struct chd *); ++ ++ ++ ++void ++chd_close(struct chd *chd) ++{ ++ fclose(chd->f); ++ free(chd->name); ++ free(chd->map); ++ free(chd->buf); ++ free(chd->hbuf); ++ free(chd); ++} ++ ++ ++ ++struct chd * ++chd_open(const char *name, int *errp) ++{ ++ struct chd *chd; ++ FILE *f; ++ ++ if ((f=fopen(name, "rb")) == NULL) { ++ if (errp) ++ *errp = CHD_ERR_OPEN; ++ return NULL; ++ } ++ ++ if ((chd=malloc(sizeof(*chd))) == NULL) { ++ if (errp) ++ *errp = CHD_ERR_NOMEM; ++ return NULL; ++ } ++ chd->f = f; ++ if ((chd->name=strdup(name)) == NULL) { ++ if (errp) ++ *errp = CHD_ERR_NOMEM; ++ chd_close(chd); ++ return NULL; ++ } ++ chd->error = 0; ++ chd->map = NULL; ++ chd->buf = NULL; ++ chd->hno = -1; ++ chd->hbuf = NULL; ++ ++ if (read_header(chd) < 0) { ++ if (errp) ++ *errp = chd->error; ++ chd_close(chd); ++ return NULL; ++ } ++ ++ return chd; ++} ++ ++ ++ ++int ++chd_read_hunk(struct chd *chd, int idx, char *b) ++{ ++ int i, n, err; ++ ++ if (idx < 0 || idx > chd->total_hunks) { ++ chd->error = CHD_ERR_INVAL; ++ return -1; ++ } ++ ++ if (chd->map == NULL) { ++ if (read_map(chd) < 0) ++ return -1; ++ } ++ ++ if (chd->map[idx].length > chd->hunk_len) { ++ chd->error = CHD_ERR_NOTSUP; ++ return -1; ++ } ++ ++ switch (chd->map[idx].flags & CHD_MAP_TYPE_MASK) { ++ case CHD_MAP_TYPE_COMPRESSED: ++ /* XXX: CHD_COMP_NONE? */ ++ if (chd->compression != CHD_COMP_ZLIB ++ && chd->compression != CHD_COMP_ZLIB_PLUS) { ++ chd->error = CHD_ERR_NOTSUP; ++ return -1; ++ } ++ ++ if (chd->buf == NULL) { ++ if ((chd->buf=malloc(chd->hunk_len)) == NULL) { ++ chd->error = CHD_ERR_NOMEM; ++ return -1; ++ } ++ chd->z.avail_in = 0; ++ chd->z.zalloc = Z_NULL; ++ chd->z.zfree = Z_NULL; ++ chd->z.opaque = NULL; ++ err = inflateInit2(&chd->z, -MAX_WBITS); ++ } ++ else ++ err = inflateReset(&chd->z); ++ if (err != Z_OK) { ++ chd->error = CHD_ERR_ZLIB; ++ return -1; ++ } ++ ++ if (fseek(chd->f, chd->map[idx].offset, SEEK_SET) == -1) { ++ chd->error = CHD_ERR_SEEK; ++ return -1; ++ } ++ if ((n=fread(chd->buf, 1, chd->map[idx].length, chd->f)) < 0) { ++ chd->error = CHD_ERR_READ; ++ return -1; ++ } ++ ++ chd->z.next_in = chd->buf; ++ chd->z.avail_in = n; ++ chd->z.next_out = b; ++ chd->z.avail_out = chd->hunk_len; ++ /* XXX: should use Z_FINISH, but that returns Z_BUF_ERROR */ ++ if ((err=inflate(&chd->z, 0)) != Z_OK && err != Z_STREAM_END) { ++ chd->error = CHD_ERR_ZLIB; ++ return -1; ++ } ++ /* XXX: chd->z.avail_out should be 0 */ ++ n = chd->hunk_len - chd->z.avail_out; ++ break; ++ ++ case CHD_MAP_TYPE_UNCOMPRESSED: ++ if (fseek(chd->f, chd->map[idx].offset, SEEK_SET) == -1) { ++ chd->error = CHD_ERR_SEEK; ++ return -1; ++ } ++ /* XXX: use chd->hunk_len instead? */ ++ if ((n=fread(b, 1, chd->map[idx].length, chd->f)) < 0) { ++ chd->error = CHD_ERR_READ; ++ return -1; ++ } ++ break; ++ ++ case CHD_MAP_TYPE_MINI: ++ b[0] = (chd->map[idx].offset >> 56) & 0xff; ++ b[1] = (chd->map[idx].offset >> 48) & 0xff; ++ b[2] = (chd->map[idx].offset >> 40) & 0xff; ++ b[3] = (chd->map[idx].offset >> 32) & 0xff; ++ b[4] = (chd->map[idx].offset >> 24) & 0xff; ++ b[5] = (chd->map[idx].offset >> 16) & 0xff; ++ b[6] = (chd->map[idx].offset >> 8) & 0xff; ++ b[7] = chd->map[idx].offset & 0xff; ++ n = chd->hunk_len; ++ for (i=8; imap[idx].offset, b); ++ ++ case CHD_MAP_TYPE_PARENT_HUNK: ++ chd->error = CHD_ERR_NOTSUP; ++ return -1; ++ ++ default: ++ chd->error = CHD_ERR_NOTSUP; /* XXX: wrong error */ ++ return -1; ++ } ++ ++ if ((chd->map[idx].flags & CHD_MAP_FL_NOCRC) == 0) { ++ if (crc32(0, b, n) != chd->map[idx].crc) { ++ chd->error = CHD_ERR_CRC; ++ return -1; ++ } ++ } ++ ++ return n; ++} ++ ++ ++ ++int ++chd_read_range(struct chd *chd, char *b, int off, int len) ++{ ++ int i, s, n; ++ int copied, o2, l2; ++ ++ /* XXX: error handling */ ++ ++ s = off/chd->hunk_len; ++ n = (off+len+chd->hunk_len-1)/chd->hunk_len - s; ++ ++ copied = 0; ++ o2 = off % chd->hunk_len; ++ l2 = chd->hunk_len - o2; ++ ++ for (i=0; ihunk_len; ++ } ++ if (i == n-1) { ++ if (l2 > len-copied) ++ l2 = len-copied; ++ } ++ if (o2 == 0 && l2 == chd->hunk_len && s+i != chd->hno) { ++ if (chd_read_hunk(chd, s+i, b+copied) < 0) ++ return -1; ++ copied += chd->hunk_len; ++ } ++ else { ++ if (chd->hbuf == NULL) ++ if ((chd->hbuf=malloc(chd->hunk_len)) == NULL) { ++ chd->error = CHD_ERR_NOMEM; ++ return -1; ++ } ++ if (s+i != chd->hno) { ++ if (chd_read_hunk(chd, s+i, chd->hbuf) < 0) ++ return -1; ++ chd->hno = s+i; ++ } ++ memcpy(b+copied, chd->hbuf+o2, l2); ++ copied += l2; ++ } ++ } ++ ++ return len; ++} ++ ++ ++ ++static int ++read_header(struct chd *chd) ++{ ++ uint32_t len; ++ ++ unsigned char b[MAX_HEADERLEN], *p; ++ ++ if (fread(b, TAG_AND_LEN, 1, chd->f) != 1) { ++ chd->error = CHD_ERR_READ; ++ return -1; ++ } ++ ++ if (memcmp(b, TAG, TAG_LEN) != 0) { ++ chd->error = CHD_ERR_NO_CHD; ++ return -1; ++ } ++ ++ p = b+TAG_LEN; ++ len = GET_LONG(p); ++ if (len > MAX_HEADERLEN) { ++ chd->error = CHD_ERR_NO_CHD; ++ return -1; ++ } ++ if (fread(p, len-TAG_AND_LEN, 1, chd->f) != 1) { ++ chd->error = CHD_ERR_READ; ++ return -1; ++ } ++ ++ chd->hdr_length = len; ++ chd->version = GET_LONG(p); ++ chd->flags = GET_LONG(p); ++ chd->compression = GET_LONG(p); ++ ++ if (chd->version > 3) { ++ chd->error = CHD_ERR_VERSION; ++ return -1; ++ } ++ /* XXX: check chd->hdr_length against expected value for version */ ++ ++ if (chd->version < 3) { ++ chd->hunk_len = GET_LONG(p); ++ chd->total_hunks = GET_LONG(p); ++ p += 12; /* skip c/h/s */ ++ memcpy(chd->md5, p, sizeof(chd->md5)); ++ p += sizeof(chd->md5); ++ memcpy(chd->parent_md5, p, sizeof(chd->parent_md5)); ++ p += sizeof(chd->parent_md5); ++ ++ if (chd->version == 1) ++ chd->hunk_len *= 512; ++ else ++ chd->hunk_len *= GET_LONG(p); ++ chd->total_len = chd->hunk_len * chd->total_hunks; ++ chd->meta_offset = 0; ++ memset(chd->sha1, 0, sizeof(chd->sha1)); ++ memset(chd->parent_sha1, 0, sizeof(chd->parent_sha1)); ++ } ++ else { ++ chd->total_hunks = GET_LONG(p); ++ chd->total_len = GET_QUAD(p); ++ chd->meta_offset = GET_QUAD(p); ++ memcpy(chd->md5, p, sizeof(chd->md5)); ++ p += sizeof(chd->md5); ++ memcpy(chd->parent_md5, p, sizeof(chd->parent_md5)); ++ p += sizeof(chd->parent_md5); ++ chd->hunk_len = GET_LONG(p); ++ memcpy(chd->sha1, p, sizeof(chd->sha1)); ++ p += sizeof(chd->sha1); ++ } ++ ++ return 0; ++} ++ ++ ++ ++static int ++read_map(struct chd *chd) ++{ ++ unsigned char b[MAP_ENTRY_SIZE_V3], *p; ++ int i, len; ++ uint64_t v; ++ ++ if ((chd->map=malloc(sizeof(*chd->map)*chd->total_hunks)) == NULL) { ++ chd->error = CHD_ERR_NOMEM; ++ return -1; ++ } ++ ++ if (chd->version < 3) ++ len = MAP_ENTRY_SIZE_V12; ++ else ++ len = MAP_ENTRY_SIZE_V3; ++ ++ for (i=0; itotal_hunks; i++) { ++ if (fread(b, len, 1, chd->f) != 1) { ++ chd->error = CHD_ERR_READ; ++ return -1; ++ } ++ p = b; ++ ++ if (i == 1832) ++ chd->version = 3; ++ ++ if (chd->version < 3) { ++ v = GET_QUAD(p); ++ chd->map[i].offset = v & 0xFFFFFFFFFFFLL; ++ chd->map[i].crc = 0; ++ chd->map[i].length = v >> 44; ++ chd->map[i].flags = CHD_MAP_FL_NOCRC ++ | (chd->map[i].length == chd->hunk_len ++ ? CHD_MAP_TYPE_UNCOMPRESSED : CHD_MAP_TYPE_COMPRESSED); ++ } ++ else { ++ chd->map[i].offset = GET_QUAD(p); ++ chd->map[i].crc = GET_LONG(p); ++ chd->map[i].length = GET_SHORT(p); ++ chd->map[i].flags = GET_SHORT(p); ++ } ++ } ++ ++ return 0; ++} diff --git a/emulators/gens/patches/patch-ag b/emulators/gens/patches/patch-ag new file mode 100644 index 00000000000..07c28b62645 --- /dev/null +++ b/emulators/gens/patches/patch-ag @@ -0,0 +1,99 @@ +$NetBSD: patch-ag,v 1.1.1.1 2004/07/26 18:23:25 dillo Exp $ + +--- src/gens/util/chd.h.orig 2004-06-25 19:55:16.000000000 +0200 ++++ src/gens/util/chd.h +@@ -0,0 +1,94 @@ ++#ifndef HAD_CHD_H ++ ++/* ++ NiH: chd.h,v 1.3 2004/06/25 23:31:08 dillo Exp ++ ++ chd.h -- accessing chd files ++ Copyright (C) 2004 Dieter Baron and Thomas Klausner ++ ++ This file is part of ckmame, a program to check rom sets for MAME. ++ The authors can be contacted at ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++*/ ++ ++#include ++#include ++ ++#define CHD_ERR_NONE 0 /* N no error */ ++#define CHD_ERR_OPEN 1 /* S cannot open file */ ++#define CHD_ERR_READ 2 /* S read error */ ++#define CHD_ERR_NO_CHD 3 /* N not a CHD file */ ++#define CHD_ERR_VERSION 4 /* N unsupported version */ ++#define CHD_ERR_INVAL 5 /* N invalid argument */ ++#define CHD_ERR_SEEK 6 /* S seek error */ ++#define CHD_ERR_NOTSUP 7 /* N unsupported chd feature */ ++#define CHD_ERR_ZLIB 8 /* Z zlib error */ ++#define CHD_ERR_CRC 9 /* N CRC mismatch */ ++#define CHD_ERR_NOMEM 10 /* N out of memory */ ++ ++#define CHD_MAP_TYPE_COMPRESSED 0x01 ++#define CHD_MAP_TYPE_UNCOMPRESSED 0x02 ++#define CHD_MAP_TYPE_MINI 0x03 ++#define CHD_MAP_TYPE_SELF_HUNK 0x04 ++#define CHD_MAP_TYPE_PARENT_HUNK 0x05 ++#define CHD_MAP_TYPE_MASK 0x0f ++#define CHD_MAP_FL_NOCRC 0x10 ++ ++#define CHD_COMP_NONE 0x0 ++#define CHD_COMP_ZLIB 0x1 ++#define CHD_COMP_ZLIB_PLUS 0x2 ++ ++ ++ ++struct chd_map_entry { ++ uint64_t offset; /* offse t within the file of the data */ ++ uint32_t crc; /* 32-bit CRC of the data */ ++ uint16_t length; /* length of the data */ ++ uint16_t flags; /* misc flags */ ++}; ++ ++struct chd { ++ FILE *f; ++ char *name; ++ int error; ++ ++ uint32_t hdr_length; /* length of header data */ ++ uint32_t version; /* drive format version */ ++ uint32_t flags; /* flags field */ ++ uint32_t compression; /* compression type */ ++ uint32_t hunk_len; /* number of bytes per hunk */ ++ uint32_t total_hunks; /* total # of hunks represented */ ++ uint64_t total_len; /* logical size of the data */ ++ uint64_t meta_offset; /* offset in file of first metadata */ ++ uint8_t md5[16]; /* MD5 checksum of raw data */ ++ uint8_t parent_md5[16]; /* MD5 checksum of parent file */ ++ uint8_t sha1[20]; /* SHA1 checksum of raw data */ ++ uint8_t parent_sha1[20]; /* SHA1 checksum of parent file */ ++ ++ struct chd_map_entry *map; /* hunk map */ ++ char *buf; /* decompression buffer */ ++ z_stream z; /* decompressor */ ++ int hno; /* hunk currently in hbuf */ ++ char *hbuf; /* hunk data buffer */ ++}; ++ ++ ++ ++void chd_close(struct chd *); ++struct chd *chd_open(const char *, int *); ++int chd_read_hunk(struct chd *, int, char *); ++int chd_read_range(struct chd *, char *, int, int); ++ ++#endif /* chd.h */ diff --git a/emulators/gens/patches/patch-ah b/emulators/gens/patches/patch-ah new file mode 100644 index 00000000000..d333f9252a7 --- /dev/null +++ b/emulators/gens/patches/patch-ah @@ -0,0 +1,51 @@ +$NetBSD: patch-ah,v 1.1.1.1 2004/07/26 18:23:25 dillo Exp $ + +--- src/gens/util/rom.c.orig 2004-05-18 22:33:59.000000000 +0200 ++++ src/gens/util/rom.c +@@ -17,6 +17,7 @@ + #include "ccnet.h" + #include "misc.h" + #include "unzip.h" ++#include "chd.h" + #include "wave.h" + #include "gym.h" + #include +@@ -168,6 +169,7 @@ Detect_Format (char *Name) + FILE *f; + unzFile zf; + unz_file_info zinf; ++ struct chd *cf; + int i; + char buf[1024], zname[256]; + +@@ -225,6 +227,19 @@ Detect_Format (char *Name) + gzread (f, buf, 1024); + gzclose (f); + } ++ else if (!stricmp (".chd", &Name[strlen (Name) -4])) ++ { ++ char *p; ++ int n; ++ ++ cf = chd_open(Name, NULL); ++ if (cf == NULL) ++ return -1; ++ ++ chd_read_range(cf, buf, 0, 1024); ++ ++ chd_close(cf); ++ } + else + { + strcpy (zname, Name); +@@ -402,6 +417,10 @@ Get_Rom () + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget)); + } + gtk_widget_destroy (widget); ++ if (res != GTK_RESPONSE_OK) ++ { ++ return; ++ } + + strncpy (Name, filename, 2048); + g_free (filename); diff --git a/emulators/gens/patches/patch-ai b/emulators/gens/patches/patch-ai new file mode 100644 index 00000000000..cfdfaa171b4 --- /dev/null +++ b/emulators/gens/patches/patch-ai @@ -0,0 +1,15 @@ +$NetBSD: patch-ai,v 1.1.1.1 2004/07/26 18:23:25 dillo Exp $ + +--- src/gens/util/unzip.h.orig 2004-03-14 15:33:14.000000000 +0100 ++++ src/gens/util/unzip.h +@@ -59,6 +59,10 @@ typedef voidp unzFile; + #endif + + ++#ifndef OF ++# define OF(args) args ++#endif ++ + #define UNZ_OK (0) + #define UNZ_END_OF_LIST_OF_FILE (-100) + #define UNZ_ERRNO (Z_ERRNO) diff --git a/emulators/gens/patches/patch-aj b/emulators/gens/patches/patch-aj new file mode 100644 index 00000000000..600dad1e217 --- /dev/null +++ b/emulators/gens/patches/patch-aj @@ -0,0 +1,35 @@ +$NetBSD: patch-aj,v 1.1.1.1 2004/07/26 18:23:25 dillo Exp $ + +--- src/gens/emulator/g_main.c.orig 2004-05-18 22:34:00.000000000 +0200 ++++ src/gens/emulator/g_main.c +@@ -394,6 +394,13 @@ update_SDL_events () + + break; + ++ case SDLK_q: ++ if (KMOD_CTRL & mod) ++ { ++ close_gens (); ++ } ++ break; ++ + case SDLK_v: + if (KMOD_CTRL & mod) + { +@@ -429,14 +436,14 @@ update_SDL_events () + case SDL_JOYAXISMOTION: + if (event.jaxis.axis < 2) + { +- if (event.jaxis.value < -500) ++ if (event.jaxis.value < -10922) + { + joystate[0x100 * event.jaxis.which + + ((event.jaxis.axis == 0) ? 0x3 : 0x1)] = 1; + joystate[0x100 * event.jaxis.which + + ((event.jaxis.axis == 0) ? 0x4 : 0x2)] = 0; + } +- else if (event.jaxis.value > 500) ++ else if (event.jaxis.value > 10922) + { + joystate[0x100 * event.jaxis.which + + ((event.jaxis.axis == 0) ? 0x4 : 0x2)] = 1; diff --git a/emulators/gens/patches/patch-ak b/emulators/gens/patches/patch-ak new file mode 100644 index 00000000000..b4add7f97d9 --- /dev/null +++ b/emulators/gens/patches/patch-ak @@ -0,0 +1,19 @@ +$NetBSD: patch-ak,v 1.1.1.1 2004/07/26 18:23:22 dillo Exp $ + +--- src/gens/gtkui/glade/interface.c.orig 2004-05-19 21:49:28.000000000 +0200 ++++ src/gens/gtkui/glade/interface.c +@@ -486,10 +486,13 @@ create_gens_window (void) + gtk_container_add (GTK_CONTAINER (item15_menu), separator16); + gtk_widget_set_sensitive (separator16, FALSE); + +- quit = gtk_image_menu_item_new_with_mnemonic ("Quit"); ++ quit = gtk_image_menu_item_new_with_mnemonic ("_Quit"); + gtk_widget_set_name (quit, "quit"); + gtk_widget_show (quit); + gtk_container_add (GTK_CONTAINER (item15_menu), quit); ++ gtk_widget_add_accelerator (quit, "activate", accel_group, ++ GDK_Q, GDK_CONTROL_MASK, ++ GTK_ACCEL_VISIBLE); + + image2789 = gtk_image_new_from_stock ("gtk-quit", GTK_ICON_SIZE_MENU); + gtk_widget_set_name (image2789, "image2789"); -- cgit v1.2.3