generator
Generator - The Sega Mega Drive Emulator
This is a modified version of Generator by James Ponder based on version 0.35. It is known to work on FreeBSD, NetBSD and Linux.
Additional features
Support for BZIP2, GZIP and ZIP compressed ROMs i.e., no more manual decompression or wasted disk space. Yay!
Support for X11's XVideo hardware acceleration by SDL for faster and smoother graphics.
Fullscreen support with or without the classic color frame.
SDL audio support (in favour of OSS Audio) which means you can use ESound and others for sharing the sound device among other applications.
Optional mute playing i.e., if you don't have a soundcard or the soundcard is busy you can still play.
Support for 48kHz sample rate (needs driver support).
Automagic CPU usage reduction which is especially cool for notebooks. The unpatched Generator uses more or less as much CPU as it can get even if needs far less than 10% on any modern system.
Working support for Game Genie codes.
Hints
ATTENTION: Some people reported that they get only a black window. This can usually be fixed by running this:
xvattr -a XV_AUTOPAINT_COLORKEY -v 1
Update: This problem is now fixed in SDL 1.2.8.
You can pause and resume the emulator by pressing <Pause> or <Control> + P.
To switch between fullscreen and window mode press <Control> + F.
Press <Control> + R to reset the emulator and <Control> + <Shift> + R for a hard reset.
The sound device is released and reacquired everytime the emulator is paused. This means if your sound drivers allow only exclusive mode, you can simply pause Generator if you need the sound device for something else. If you resume Generator while the sound device is busy, it will automagically switch to mute mode.
Use the command-line parameter -a to start Generator in arcade mode i.e., it goes into fullscreen mode and starts the emulation immediately.
You can use the command-line parameter -r to override the current region setting (Europe, Japan, USA) as convenient workaround for a few broken or otherwise strange ROMs.
Game Genie codes
You can either use the Game Genie dialog (Emulation->Game Genie codes) or manually edit a file with Game Genie codes. The format is as follows:
# The file may contain empty lines and comment lines. Comments start with
# a hash mark '#' and end at the end of the line.
# First the Game Genie code, next an optional comment
0123-ABCD # Tonic the Maddog, Invicibility
The comment after each code is optional but without them it'll be difficult to remember their uses or what game they are for. Once you've added some codes - or loaded a patch file - you have to select one or more of them to activate them. Merely loading a patch file or adding a code doesn't have any effect on the game. Click the "Apply" button to activate the codes. The selected codes will be active until you re-load the ROM.
Don't forget to save the codes you've added (File->Game Genie patch->Load) or they'll be lost when you quit the application.
Some codes must be loaded at certain stages i.e., the game might not work properly or even refuse to start otherwise.
Known problems
The patch version breaks the support for recording AVI files currently.
Your X11 drivers and hardware must support one of the following overlay formats in order to benefit from the Xvideo support: UYVY, YUY2, YVYU. You can check this by running xvinfo from your shell. For example, with my NVidia GeForce 440 MX I get the following output - which means the card supports everything necessary:
maximum XvImage size: 2046 x 2046
Number of image formats: 4
id: 0×32595559 (YUY2)
guid: 59555932-0000-0010-8000-00aa00389b71
bits per pixel: 16
number of planes: 1
type: YUV (packed)
id: 0×59565955 (UYVY)
guid: 55595659-0000-0010-8000-00aa00389b71
bits per pixel: 16
number of planes: 1
type: YUV (packed)
Even without XVideo support you can still use the new fullscreen mode.
When playing with sound disabled, the framerate is not horribly accurate. It might be somewhat faster or slower.
Use GCC 2.95.x or GCC 3.4.2 (or newer) to compile Generator (with or without my patch). Older GCC 3.x versions have bugs that will cause distorted graphics and crashes. The intro of Sonic 3 is a good check to see whether the compiled code is fine or broken.
Don't enable the frame rate counter at the bottom. It wastes a lot of CPU time as you can see with top.
If the sound lags you might want to re-compile using –without-sdl-audio as compiler flag. Usually SDL should be preferred but for some systems or drivers OSS audio just works better.
Downloads
The patched sources of Generator 0.35 revision 3:
generator-0.35-cbiere-r3.tar.bz2 [HTTP] [Signature]
Mirror [HTTP] [Signature]
If you use FreeBSD, you can simply use the port emulators/generator-cbiere which is maintained by Alejandro Pulver.
Users of NetBSD and pkgsrc can also use the package emulators/generator-cbiere.
You should use the following flags for configure:
–with-raze (x86 only) This should gain best performance.
–with-cmz80 (non-x86) Use this for architectures others than
x86. You also need this for x86-64 (AMD64).
–with-sdl-audio SDL audio is highly recommended.
–with-gtk The only frontend I used and tested.
or
–with-sdl The naked SDL user interface.
To gain maximum performance, set the CFLAGS environment variable by hand. Especially using an appropriate -march setting for your CPU type can speed-up the YUV<->RGB conversion code for the overlay mode. See GCC's manpage for available parameters to -march.
Latest changes
2007-01-18
Applied fix by Barry for the ABCD instruction. This fixes, for example, the odd characters in the score count of Streets of Rage as reported by bootsector.
Fixed soft reset so that the RAM is not cleared in this case. Thanks to Fibonacci for reporting this.
Reduced noisy blips that may happen whenever an underrun of the audio buffer occurs.
Fixed crash that would happen if the filename of the ROM did not contain a dot.
Fixed endian issue with big endian platforms introduced by previous changes.
Added simplistic support for reassigning joypad/joystick buttons. Look for joy[12]_{a,b,c,start} in ~/.genrc.
2005-09-02
Moved inclusion of most system header files to hdr/generator.h and added check for sys/param.h for less #include trouble.
Removed platform-specific versions of the SWAP16/SWAP32 macros as these were only used in two places.
2005-08-29
Applied another patch by Henry Prêcheur to fix compile errors and warnings using GCC 4.0.
Replaced strsep() for IRIX which doesn't provide this non-standard function. Thanks to Daichi Kawahata.
Fixed all compiler warnings that were left over. As a side-effect some unnecessary emulator code was eliminated. Generator should now compile cleanly with "-W -Wall -Wformat=2" when using GCC.
Replaced all code which used snprintf() and removed the replacement implementation of snprintf() because the few uses of it are better handled by far less complex code. (Just in case: no snprintf() was replaced with sprintf().)
Removed the GCC compiler flag -minline-all-stringops which was quite unnecessary and is not available on all platforms. The GCC flag -ffast-math is only used for x86 machines and for Alpha -mieee is added as a precaution by default. Thanks to Alejandro.
Got rid of all C++ style comments for better compatibility with older C compilers.
2005-05-03
Fixed another typo which caused compile errors on systems without BZIP2 support. Thanks to Henry Prêcheur.
2005-04-17
Fixed a few bugs in the image loader with respect to ZIP support.
Fixed a typo which caused compile errors on platforms where u_int64_t isn't defined. (Thanks to Alejandro Pulver.)
The configure flag –with-sdl-audio was only used when compiling for GTK+ or SDL. It's always used now. (Thanks to Julien.)
Fixed addressing of the VDP RAM which could cause crashes due to out-of-bounds read access with certain games. (Thanks to Tatu Kilappa.)
2005-02-05
Fixed a typo which caused compile errors on systems without BZIP2 support. Thanks to Dave Maxwell for reporting this.
2005-01-11
Fixed a problem with GTK+ and the overlay mode which could cause an immediate crash under some circumstances. Thanks again to Corwin for reporting this and helping me fix it.
2005-01-10
Fixed and improved the support for Game Genie codes. I've also changed the format of the Game Genie patch file. As this wasn't working at all before, this shouldn't be a problem. This is only supported when using the GTK+ front-end so far.
The dialogs appear at the position of the mouse cursor now. Previously, they appeared at a random position on the screen which was a little annoying.
Changed logic to select the screen mode again, so that the resolution isn't unnecessarily high if there's no overlay available.
2005-01-05
The emulator was reset to the configured video standard (PAL or NTSC) after pause and resume so that the detected value was overriden. This caused either a faster slower or faster emulation (depending on the configured setting) after pause and resume. Thanks to Corwin for reporting this and pointing me to the cause.
Changed the default resolution of 640×480 for the fullscreen to the default minimum resolution since some graphic drivers seem to have problems with 640×480 if the current resolution is 1280×1024.
configure doesn't add a -march flag for GCC any longer if CFLAGS contains already -march=… or -mcpu=….
2005-01-04 (evening)
Fixed a compile problem in generator.c for non-C99 compilers caused by the previous changes. Thanks to Corwin for reporting this.
2005-01-04 (morning)
Added support for loading ROMs straight from ZIP archives. This isn't perfect and it will just pick-up the next best file in the ZIP archive but it should work most of the time. Encrypted or otherwise exotic ZIP archives are not supported.
Set absolute maximum for the decompressed size of ROMs to 32 MiB to prevent swap/memory trashing with large bogus files.
Fixed an oversight in generator-sdl i.e., the configuration file wasn't used.
2005-01-02
Edited configure.ac to auto-detect GCC 2.x and GCC 3.x to allow better default compiler flags, pick-up appropriate -march value for x86 instead of just "pentium", enable compiler warnings by default.
Added new user interface type SDL. If you use –with-sdl instead of –with-gtk, generator-sdl is created which doesn't require GTK+ nor GLib, just SDL. There's no further user interface if you use this and maybe useful for consoles that support SDL. You might want to edit ~/.genrc by hand or use generator-gtk to edit the configuration. By using –with-sdl, –with-sdl-audio will be used by default as well.
2004-12-06
Applied patch from Tatu Kilappa that improves the region guessing. Almost all ROMs should automagically work without having to fiddle with the region settings now. His patch also adds the command-line switch -r to override the current region setting which might be more convenient than using the configuration dialog (although this should rarely be necessary). Special thanks also to Ville Vuorinen who helped with improving the region guessing.
2004-11-12
Fixed typo which caused compile failures if compiling for OSS audio instead of SDL audio. Thanks to Tatu Kilappa and dEpAz for reporting this.
Applied patch from Tatu Kilappa that fixes compile problems on big-endian systems and some macro definitions.
2004-09-14
Fixed bug causing a crash when using non-accelerated fullscreen mode with a overscan border.
2004-09-06
Fixed compile problems with GCC 2.95.x and a couple of warnings. Thanks to Sean Proctor.
2004-08-23
Fixed compile problem in uiplot.c caused by #ifdef within macro parameters for UNROLL().
2004-07-30
Modified CPU time reduction again: There was still a periodic blip in the background music.
2004-07-28
Simplified CPU time reduction: This should fix the emulation speed in mute mode and also prevent crackling sound. It's now less sensitive for the system load and CPU usage doesn't increase after a while as it did before.
Changed default fullscreen resolution to 640×480 as that's the unscaled frame resolution.
Fixed GTK+ <-> SDL translation of the numpad keys.
Contact
Don't ask me for ROMs, please. If you have any problems with the modified version or suggestions, let me know:
christianbiere at gmx dot de [encrypted mail is highly preferred: my OpenPGP key]
This page is also available at ghostwhitecrab.de/generator/.
[ Home | Crab | Guppy | Sardine | Socker | bitter ]
Last edited: 2006-01-18