debian/0000755000000000000000000000000011551042403007161 5ustar debian/rules0000755000000000000000000000051611546562374010265 0ustar #!/usr/bin/make -f %: dh $@ workdir=debian/dgen install: build dh install # Renamed this binary. mv $(workdir)/usr/bin/tobin $(workdir)/usr/bin/dgen_tobin mv $(workdir)/usr/share/man/man1/tobin.1.gz \ $(workdir)/usr/share/man/man1/dgen_tobin.1.gz binary-arch: build install dh binary-arch binary: binary-indep binary-arch debian/patches/0000755000000000000000000000000011551037202010611 5ustar debian/patches/sdl-segfault.diff0000644000000000000000000000302311551040235014033 0ustar Description: It solves sdl struct that causes a segfault on OpenGL Author: Trevour Crow --- a/sdl/sdl.cpp +++ b/sdl/sdl.cpp @@ -457,6 +457,9 @@ // If you need to do any sort of locking before writing to the buffer, do so // here. +#ifdef SDL_OPENGL_SUPPORT + if(!opengl) /*Don't do this in OpenGL mode; it crashes the emu*/ +#endif if(SDL_MUSTLOCK(screen)) SDL_LockSurface(screen); @@ -597,6 +600,9 @@ q += mdscr.pitch; } // Unlock when you're done! +#ifdef SDL_OPENGL_SUPPORT + if(!opengl) +#endif if(SDL_MUSTLOCK(screen)) SDL_UnlockSurface(screen); // Update the screen #ifdef SDL_OPENGL_SUPPORT @@ -917,6 +923,9 @@ #ifdef HAVE_SDL_WM_TOGGLEFULLSCREEN int fullscreen = 0; // Switch out of fullscreen mode (assuming this is supported) +#ifdef SDL_OPENGL_SUPPORT + if(!opengl) +#endif if(screen->flags & SDL_FULLSCREEN) { fullscreen = 1; SDL_WM_ToggleFullScreen(screen); @@ -1085,7 +1094,6 @@ inline void pd_clear_message() { int i, j; - long *p = (long*)((char*)screen->pixels + (screen->pitch * ys)); #ifdef SDL_OPENGL_SUPPORT if(opengl) { @@ -1096,6 +1104,9 @@ else { #endif + /*This line causes the problems in OpenGL mode, so we put it here*/ + /*This is actually makes more sense, since it's not used up there*/ + long *p = (long *)((char *)screen->pixels + (screen->pitch * ys)); for(i = 0; i < 16; ++i, p += (screen->pitch >> 2)) for(j = 0; j < 80 * screen->format->BytesPerPixel; ++j) p[j] = 0; debian/patches/series0000644000000000000000000000005711551035046012034 0ustar old-patches sdl-segfault.diff zip-support.diff debian/patches/zip-support.diff0000644000000000000000000000066511551037346013777 0ustar Description: Some zipped files send warnings. Only if there's a error stop. Author: Edgar Antonio Palma de la Cruz --- a/romload.c +++ b/romload.c @@ -150,8 +150,8 @@ perror("dup2"); return -1; } - sprintf(temp, "zcat > %s", temp2); - if (system(temp)) { + sprintf(temp, "zcat -q > %s", temp2); + if (system(temp)==1) { perror("system"); return -1; } debian/patches/old-patches0000644000000000000000000002175511547210765012765 0ustar Description: Upstream changes introduced in version 1.23-12 This patch has been created by dpkg-source during the package build. Here's the last changelog entry, hopefully it gives details on why those changes were made: . dgen (1.23-12) unstable; urgency=low . * Readded the makefiles * debian/rules. Removed the clean rule. * Switch to dpkg-source 3.0 (quilt) format * Switch to quilt for manage the patches. * debian/control: Switch any to i386 on arch field. * Fix for some warnings about the dgenrc.5 manpage . The person named in the Author field signed this changelog entry. Author: Edgar Antonio Palma de la Cruz --- The information above should follow the Patch Tagging Guidelines, please checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here are templates for supplementary fields that you might want to add: Origin: , Bug: Bug-Debian: http://bugs.debian.org/ Bug-Ubuntu: https://launchpad.net/bugs/ Forwarded: Reviewed-By: Last-Update: --- a/pd.h +++ b/pd.h @@ -52,6 +52,8 @@ // This should be a list of all the command-line options specific to this // platform, in the form given to getopt(3), i.e "a:b::c". extern char *pd_options; +// This is called once, during startup, before pd_option is. +void pd_initoptions(); // And, this is called to handle platform-specific stuff. void pd_option(char c, const char *optarg); --- a/dgen.1 +++ b/dgen.1 @@ -35,7 +35,7 @@ .It Fl P Emulate 50Hz PAL mode (as used in European models of the MegaDrive). .It Fl R -If running with root priviledges, set priority to -20, so no other processes +If running with root priviledges, set priority to \-20, so no other processes interrupt (including the X server, which can be a Bad Thing). .It Fl f Run fullscreen, if possible. --- a/romload.c +++ b/romload.c @@ -7,6 +7,10 @@ #include #include #include +#include +#include +#include +#include static int load_bin_into(char *name,unsigned char *into) { @@ -126,13 +130,32 @@ (magicbuf[0] == 037 && magicbuf[1] == 0240) || /* LZH (?) */ (magicbuf[0] == 'P' && magicbuf[1] == 'K')) /* ZIP (.zip ;) */ { - char temp[0x100], temp2[0x80]; - srand(time(NULL)); + char temp[0x100], *temp2; + int f; /* Run it through gzip (I know this is cheap ;) */ - sprintf(temp2, "/tmp/dgenrom_%d_%d", rand(), rand()); - sprintf(temp, "gzip -S \"\" -cdq %s > %s", name, temp2); - /* If gzip returned an error, stop */ - if(system(temp)) { remove(temp2); return -1; }; + asprintf(&temp2, "/tmp/dgenrom_XXXXXX"); + f = mkstemp(temp2); + if (f == -1) { + perror("mkstemp"); + return -1; + } + close(f); + + f = open(name, O_RDONLY); + if (f == -1) { + perror("open"); + return -1; + } + if (dup2(f, 0) == -1) { + perror("dup2"); + return -1; + } + sprintf(temp, "zcat > %s", temp2); + if (system(temp)) { + perror("system"); + return -1; + } + /* Recurse with the new file */ len = load_rom_into(temp2, into); remove(temp2); @@ -142,14 +165,32 @@ /* Do bzip2 also */ if(magicbuf[0] == 'B' && magicbuf[1] == 'Z' && magicbuf[2] == 'h') { + char temp[0x100], *temp2; + int f; /* Damn, this looks almost like the gzip stuff above. *lol* :) */ - char temp[0x100], temp2[0x80]; - srand(time(NULL)); - /* Go through bzip2 */ - sprintf(temp2, "/tmp/dgenrom_%d_%d", rand(), rand()); - sprintf(temp, "bzip2 -cd %s > %s", name, temp2); - /* If we got an error, stop */ - if(system(temp)) { remove(temp2); return -1; }; + asprintf(&temp2, "/tmp/dgenrom_XXXXXX"); + f = mkstemp(temp2); + if (f == -1) { + perror("mkstemp"); + return -1; + } + close(f); + + f = open(name, O_RDONLY); + if (f == -1) { + perror("open"); + return -1; + } + if (dup2(f, 0) == -1) { + perror("dup2"); + return -1; + } + sprintf(temp, "bzcat > %s", temp2); + if (system(temp)) { + perror("system"); + return -1; + } + /* Recurse with the uncompressed file */ len = load_rom_into(temp2, into); remove(temp2); @@ -161,7 +202,7 @@ format = 1; /* Otherwise we can only hope it's binary */ else format = 0; - + switch (format) { case 1: return load_smd_into(name,into); --- a/main.cpp +++ b/main.cpp @@ -92,7 +92,7 @@ { /* Need to strip extension */ p = strtok(buf, "."); } - + if(strchr(buf, '/')) { /* Need to strip /path/name */ p = strtok(buf, "/"); @@ -169,7 +169,7 @@ sprintf(temp, "Saved state to slot %d.", slot); pd_message(temp); } - else + else { sprintf(temp, "Couldn't save state to slot %d!", slot); pd_message(temp); @@ -193,7 +193,7 @@ pd_message(temp); } } - + // Load/save states from file static void ram_save(md& megad) { @@ -236,6 +236,8 @@ // Parse the RC file parse_rc(NULL); + pd_initoptions(); + // Check all our options strcpy(temp, "s:hvr:n:p:RPjd:D:"); strcat(temp, pd_options); @@ -326,7 +328,7 @@ // BeOS snooze() sleeps in milliseconds, not microseconds dgen_nice /= 1000; #endif - + // There should be a romname after all those options. If not, show help and // exit. if(optind >= argc) @@ -388,7 +390,7 @@ megad.reset(); // Set PAL mode megad.pal = pal_mode; - + // Make sure the .dgen hierarchy is setup mk_dgendir(); // Load up save RAM @@ -483,7 +485,7 @@ gettimeofday(&endclk, NULL); printf("%d frames per second (optimal %d)\n", (unsigned)(f / (endclk.tv_sec - startclk.tv_sec)), (pal_mode? 50 : 60)); - + // Cleanup if(demo) fclose(demo); ram_save(megad); @@ -493,5 +495,5 @@ YM2612Shutdown(); // Come back anytime :) - return 0; + return 0; } --- a/mkinstalldirs +++ b/mkinstalldirs @@ -4,7 +4,7 @@ # Created: 1993-05-16 # Public domain -# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $ +# $Id: mkinstalldirs,v 1.1 2002/04/10 19:46:28 joey Rel $ errstatus=0 --- a/tobin.1 +++ b/tobin.1 @@ -1,10 +1,10 @@ .Dd February 21, 2001 .Dt DGEN 1 .Sh NAME -.Nm tobin +.Nm dgen_tobin .Nd Convert SMD-format Genesis/Megadrive image to raw (BIN) format .Sh SYNOPSIS -.Nm tobin +.Nm dgen_tobin .Ar FROMSMD .Ar TOBIN .Sh DESCRIPTION @@ -27,4 +27,3 @@ .An Joe Groff Aq joe@pknet.com . .Sh BUGS None (yet :-) - --- a/dgenrc.5 +++ b/dgenrc.5 @@ -13,7 +13,7 @@ is parsed by .Xr dgen 1 when the emuator is started. It is used to set controller keys, as well as other -characteristics of the emulation. The contents of this file may be overriden +characteristics of the emulation. The contents of this file may be overridden with the contents of another similarly-formatted file, via the .Fl r commandline switch. @@ -170,7 +170,7 @@ or any combination thereof, to require that the specified modifier be pressed in combination with the key. For example, the identifier "alt-enter" would correspond to holding down the Alt key while pressing Enter. - +.Pp The numbers "0" through "9" ("kp_0" through "kp_9" for the numeric keypad), letters "A" through "Z", and function keys "F1" through "F12" map to their key equivalents. @@ -223,18 +223,18 @@ kp_multiply kp_plus -` ~ -- _ -= + -\ | -[ { -] } -: ; -' " -, < -\. > -/ ? - + ` ~ + - _ + = + + \\ | + [ { + ] } + : ; + ' " + , < + . > + / ? +.Ed .Sh SEE ALSO .Xr dgen 1 .Sh AUTHORS --- a/musa/m68kmake.c +++ b/musa/m68kmake.c @@ -1029,9 +1029,10 @@ fprintf(filep, "/* ========================= OPCODE TABLE BUILDER ========================= */\n"); fprintf(filep, "/* ======================================================================== */\n\n"); + fprintf(filep, "#include \n\n"); /* moved here for gcc 4.0 */ fprintf(filep, "#include \"m68kops.h\"\n"); fprintf(filep, "#include \"m68kcpu.h\"\n"); - fprintf(filep, "#include \n\n"); + /*fprintf(filep, "#include \n\n");*/ fprintf(filep, "#include \n\n"); fprintf(filep, "extern void (*m68k_instruction_jump_table[])(void); /* opcode handler jump table */\n\n"); --- a/star/star.c +++ b/star/star.c @@ -1931,7 +1931,6 @@ case aind: case ainc: case adec: case adsp: case axdp: usereg(); - default: } } --- a/sdl/sdl.cpp +++ b/sdl/sdl.cpp @@ -157,13 +157,15 @@ ); } +void pd_initoptions() +{ + fullscreen = dgen_fullscreen; + x_scale = y_scale = dgen_scale; +} + // Handle the switches void pd_option(char c, const char *) { - // Set stuff up from the rcfile first, so we can override it with commandline - // options - fullscreen = dgen_fullscreen; - x_scale = y_scale = dgen_scale; #ifdef SDL_OPENGL_SUPPORT opengl = dgen_opengl; if(opengl) debian/copyright0000644000000000000000000001426111546562374011142 0ustar This is a Debian prepackaged version of the DGen emulator. This package was put together by Joey Hess , using sources from: http://www.pknet.com/~joe/dgen-sdl.html The following copyright applies to this package: # Copyright (c) 1998, 1999 Dave # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. Neither the name of the authors nor the names of their contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. The following files do not allow for commercial redistribution: --------------------------------------------------------------------------- musa/*, m68k.h * A portable Motorola M680x0 processor emulation engine. * Copyright 1999 Karl Stenerud. All rights reserved. * * This code may be freely used for non-commercial purpooses as long as this * copyright notice remains unaltered in the source code and any binary files * containing this code in compiled form. * * Any commercial ventures wishing to use this code must contact the author * (Karl Stenerud) to negotiate commercial licensing terms. --------------------------------------------------------------------------- zz80.c: /* Copyright 1996-2000 Neil Bradley, All rights reserved * * License agreement: * * (MZ80 Refers to both the assembly code emitted by makeZ80.c and makeZ80.c * itself) * * MZ80 May be distributed in unmodified form to any medium. * * MZ80 May not be sold, or sold as a part of a commercial package without * the express written permission of Neil Bradley (neil@synthcom.com). This * includes shareware. * * Modified versions of MZ80 may not be publicly redistributed without author * approval (neil@synthcom.com). This includes distributing via a publicly * accessible LAN. You may make your own source modifications and distribute * MZ80 in source or object form, but if you make modifications to MZ80 * then it should be noted in the top as a comment in makeZ80.c. * * MZ80 Licensing for commercial applications is available. Please email * neil@synthcom.com for details. * * Synthcom Systems, Inc, and Neil Bradley will not be held responsible for * any damage done by the use of MZ80. It is purely "as-is". * * If you use MZ80 in a freeware application, credit in the following text: * * "Multi-Z80 CPU emulator by Neil Bradley (neil@synthcom.com)" * * must accompany the freeware application within the application itself or * in the documentation. --------------------------------------------------------------------------- star/*: Copyright 1997, 1998, 1999 Neill Corlett "Starscream" refers to the following files: * STAR.C * STARCPU.H * CPUDEBUG.C * CPUDEBUG.H * STARDOC.TXT * any object file or executable compiled from the above * any source code generated from STAR.C, or object file assembled from such code Starscream may be distributed freely in unmodified form, as long as this documentation is included. No money, goods, or services may be charged or solicited for Starscream, or any emulator or other program which includes Starscream, in whole or in part. Using Starscream in a shareware or commercial application is forbidden. Contact Neill Corlett (corlett@elwha.nrrc.ncsu.edu) if you'd like to license Starscream for commercial use. Any program which uses Starscream must include the following credit text, in its documentation or in the program itself: "Starscream 680x0 emulation library by Neill Corlett (corlett@elwha.nrrc.ncsu.edu)" --------------------------------------------------------------------------- mz80/*: Copyright 1996, 1997, 1998, 1999, 2000 - Neil Bradley, All rights reserved MZ80 License agreement ----------------------- (MZ80 Refers to both the assembly code emitted by makez80.c and makez80.c itself) MZ80 May be distributed in unmodified form to any medium. MZ80 May not be sold, or sold as a part of a commercial package without the express written permission of Neil Bradley (neil@synthcom.com). This includes shareware. Modified versions of MZ80 may not be publicly redistributed without author approval (neil@synthcom.com). This includes distributing via a publicly accessible LAN. You may make your own source modifications and distribute MZ80 in source or object form, but if you make modifications to MZ80 then it should be noted in the top as a comment in makez80.c. MZ80 Licensing for commercial applications is available. Please email neil@synthcom.com for details. Synthcom Systems, Inc, and Neil Bradley will not be held responsible for any damage done by the use of MZ80. It is purely "as-is". If you use MZ80 in a freeware application, credit in the following text: "Multi-Z80 CPU emulator by Neil Bradley (neil@synthcom.com)" must accompany the freeware application within the application itself or in the documentation. --------------------------------------------------------------------------- Open-source replacements for the above modules would be appreciated, if you have the time and ability. debian/watch0000644000000000000000000000011211546624155010222 0ustar version=3 http://tamentis.com/projects/dgen/files/dgen-sdl-(.*)\.tar\.gz debian/compat0000644000000000000000000000000211546562374010401 0ustar 7 debian/source/0000755000000000000000000000000011546624430010473 5ustar debian/source/format0000644000000000000000000000001411546624430011701 0ustar 3.0 (quilt) debian/docs0000644000000000000000000000001711546562374010054 0ustar AUTHORS README debian/examples0000644000000000000000000000001611546562374010741 0ustar sample.dgenrc debian/changelog0000644000000000000000000000661711551042176011054 0ustar dgen (1.23-12) unstable; urgency=low * Readded the makefiles * debian/rules. Removed the clean rule. * Switch to dpkg-source 3.0 (quilt) format * Switch to quilt for manage the patches. * debian/control: Switch any to i386 on arch field. Closes: #559847, #620208 * Fix for some warnings about the dgenrc.5 manpage * Zip files support. Closes: #618596, #263160 * Added info about the patches. -- Edgar Antonio Palma de la Cruz Tue, 12 Apr 2011 06:56:18 -0500 dgen (1.23-11) unstable; urgency=low * New maintainer. Closes: #487479 * debian/control. Bump Standards-Version. * Add a debian/watch file. * Change xlibmesa-gl-dev to libgl1-mesa-dev in build-depends * Patch to prevent a segfault in opengl mode. Thanks to Trevour Crow. Closes: #512264 * Fix for some warnings in manpage dgenrc.5 * Add Clean rule to debian/rules * Remove an unnecessary Makefiles. -- Tony Palma Mon, 17 Aug 2009 05:53:14 -0500 dgen (1.23-10) unstable; urgency=low * debhelper v7, rules file minimisation * Orphaned the package. -- Joey Hess Sat, 21 Jun 2008 22:13:55 -0400 dgen (1.23-9) unstable; urgency=low * Remove an unnecessary build dependency on xlibs-dev. * Switch to xlibmesa-gl-dev build dep. * Debhelper v5. * Fix man warning on dgenrc(5). -- Joey Hess Wed, 30 Nov 2005 20:13:46 -0500 dgen (1.23-8) unstable; urgency=low * Patch from Andreas Jochens to build with gcc 4.0. Closes: #297272 * Remove "label at end of compound statement" from star.c. * Remove build dep on build-essential g++ * New standards version. -- Joey Hess Fri, 15 Jul 2005 17:41:14 +0300 dgen (1.23-7) unstable; urgency=low * Rename tobin to dgen_tobin; there is also a tobin program in fondu. Closes: #308847 * Remove blank line at end of tobin.1 to quiet mdoc. -- Joey Hess Fri, 13 May 2005 12:52:47 -0400 dgen (1.23-6) unstable; urgency=medium * Fix file-in-tmp security hole in gzip/bzip rom extraction code. Closes: #263282 * Rewrite gzip/bzipped file code to not use unsafe system calls. Closes: #263158 * Put in a hack to avoid automake being run, since current versions won't work. -- Joey Hess Tue, 3 Aug 2004 12:11:26 -0400 dgen (1.23-5) unstable; urgency=low * Introduced a pd_initoptions() function, that is called after rc file parsing, and before option parsing and pd_option(). It allows the SDL interface to set the fullscreen and scale values using the values from the RC file, even if there are no command-line options. (1.23-4 broke using int_scale and bool_fullscreen from the RC file). Pushed upstream. * Shorten package description. -- Joey Hess Fri, 4 Jul 2003 19:39:11 -0400 dgen (1.23-4) unstable; urgency=low * Patch from Malcolm Parsons to keep options from clobbering. Closes: #195733 -- Joey Hess Mon, 2 Jun 2003 11:01:12 -0400 dgen (1.23-3) unstable; urgency=low * Rebuild for gcc 3.2 and c++ transition. -- Joey Hess Wed, 12 Feb 2003 12:20:12 -0500 dgen (1.23-2) unstable; urgency=low * Debhelper v4. * Support DEB_BUILD_OPTIONS -- Joey Hess Sat, 16 Nov 2002 22:15:28 -0500 dgen (1.23-1) unstable; urgency=low * First release. -- Joey Hess Wed, 10 Apr 2002 14:27:28 -0400 debian/control0000644000000000000000000000141011547207740010574 0ustar Source: dgen Section: non-free/otherosfs Priority: optional Build-Depends: debhelper (>= 7), libsdl1.2-dev, nasm [i386], libgl1-mesa-dev, dpkg-dev (>= 1.9.0) Maintainer: Edgar Antonio Palma de la Cruz Standards-Version: 3.9.1 Vcs-Git: git://git.kitenet.net/joey/packages/dgen Homepage: http://tamentis.com/projects/dgen/ Package: dgen Architecture: i386 Depends: ${shlibs:Depends}, ${misc:Depends}, unzip Conflicts: dgen-sdl Replaces: dgen-sdl Description: Sega Genesis/MegaDrive emulator DGen/SDL is an emulator for the Sega Genesis/MegaDrive game console. It can be used to play many games, none of which are included in this package. It supports save states, full screen mode, interlace mode, Game Genie, joystick, compressed ROM images, and more.