Actions

Gens/GS II

From Sega Retro

Gens/GS II is a partial rewrite of Gens/GS written by GerbilSoft. Gens/GS II improves the basic framework of the emulator, which will allow for the addition of many new features.

New features in Gens/GS II

Emulation

  • The UI and emulation code are split into separate internal projects: libgens (for emulation) and gens-qt4 (for Qt4 UI). Additional UIs can be added later for other platforms, e.g. gens-win32 (for a minimal Win32 UI for Win9x, since Qt4 doesn't work on 9x) and gens-wii.
  • ZOMG savestate format. Compared to the previous GSX-extended format, the ZOMG savestate format has much more comprehensive documentation and is extensible in a well-defined manner.
  • Support for more types of input devices. 3-button and 6-button gamepads are supported, but in addition, 2-button (SMS) gamepads are now supported. Teamplayer and 4WP support is much improved, and there's initial Sega Mouse support.
  • Improved I/O tristate control. If a controller bit is set to input, then that bit shows up as a 1 on the controller side. Gens and Gens/GS do not properly implement this, but Gens/GS II does.
  • The VDP emulator has been ported from x86 assembly language to C++. (This was partially done in Gens/GS r7+, but Gens/GS II finishes it.) Among other things, it now passes all tests in Nemesis' Sprite Masking & Overflow Test ROM.
  • A few more VDP bugs have been implemented, including the Shadow/Highlight bug for colors $0E, $1E, $2E; the Left Window bug; and the 2-cell VScroll + HScroll bug.
  • Interlaced mode is now displayed using "flickering" interlaced (like Regen). That is, even fields are shown on one frame, and odd fields are shown on the next. This is a configurable option, and can be switched to flickering, even only (Gens-style), and odd only. 2x resolution mode (Kega-style) will be added later.
  • Support for I2C EEPROM save chips. Some games use Atmel I2C EEPROM chips instead of SRAM chips (e.g. NBA Jam), resulting in non-functional game save support on Gens/GS. With EEPROM support, game saving now works.
  • Automatic SRAM/EEPROM saving. The SRAM/EEPROM contents is automatically saved to disk approximately one second after the game writes any data to the SRAM/EEPROM chip. This ensures that the internal save game is saved in case the emulator is shut down improperly (e.g. due to a crash or a power failure). Autosave is also triggered if the emulation is paused (by pressing Escape) or if a savestate with SRAM/EEPROM is loaded.
  • Z80 can no longer read from M68K memory. Reads result in 0xFF. (Writes still function normally.) This matches the behavior of the original hardware.
  • ROM cartridge handling has been abstracted into a new class, RomCartridgeMD. This class handles quirks for various ROMs:
    • Puggsy: SRAM is automatically disabled. (Presence of SRAM triggers a copy-protection screen.)
    • Psy-O-Blade: SRAM header is incorrect.
    • HardBall '95: SRAM is located at $300000 with no $A130F1 register.
    • Super Street Fighter II: Reworked the bankswitching system.
    • Various unlicensed ROMs: Added read-only registers at $400000.
    • Flat addressing: If no mapper is in use, ROMs up to 10 MB can be mapped from $000000 - $9FFFFF. This may fix some game hacks that use flat addressing instead of bankswitching. (This will not work for Sega CD "cartridge boot" or 32X games.)
  • The Genesis TMSS system has been implemented. If a valid TMSS ROM is provided and TMSS is enabled, the "PRODUCED BY..." license screen will be displayed on Genesis (and 32X) startup. Note that enabling TMSS may break some early unlicensed titles. The $A14000 register is present, but doesn't function.
  • VDP sprite attribute table caching is implemented. The VDP caches a few fields from each sprite entry (Y position, size, link) in internal memory. This cache is not updated if the Sprite Attribute Table Base Address register is changed; it's only updated on VRAM write (using either MMIO or DMA). Other fields (X position, attributes) are always fetched from VRAM.
  • Several tests from Nemesis' VDPFIFOTesting ROM have been fixed. (31/122 now pass; still not that great, but it was 23/122 previously, and 20/122 on Gens/GS r7.)

UI and video rendering

  • The UI now uses the Qt 4 library instead of GTK+ on Linux and Win32 on Windows. This means only one UI needs to be maintained for all platforms, instead of maintaining two separate UIs. It also means that Mac OS X is now supported natively.
  • Full Unicode support provided by the Qt 4 library. (The onscreen display is still limited to cp1252; I may extend this later, but it's unlikely.)
    • libgens does not use Qt, though it handles strings using UTF-8 natively. For full compatibility, it has parts of Gens/GS r7+'s Win32 Unicode Translation Layer in order to convert strings to/from ANSI and UTF-16 as necessary.
  • OpenGL rendering. Gens/GS had OpenGL rendering on Linux, but Gens/GS II uses OpenGL rendering on all supported platforms.
  • OpenGL shaders. Shader programs are used to provide certain effects, such as fast blur and the paused tint. Software fallbacks are still provided for systems that don't have the GL_ARB_fragment_program extension.
  • 1x and 2x renderers are removed in favor of simply blitting to the OpenGL texture. 2x support is emulated by setting 640x480 output with nearest-neighbor interpolation.
  • Screenshots are now always saved in PNG format.
  • Sega CD Boot ROM configuration. The boot ROMs are examined when they are selected to determine their version and region code, and information is displayed regarding their compatibility. (Sega CD emulation hasn't been reimplemented yet.)
  • Configuration is saved in ~/.config/gens-gs-ii/gens-gs-ii.conf (Unix, Linux, Mac OS X) or %APPDATA%\gens-gs-ii\gens-gs-ii.conf (Win32). A "portable" option will be added later for Win32, which will save the configuration in the executable's directory.
  • Removed all palette customizations. The palette is now calculated to look as close to the original system as possible. Adjustments may reappear later as pluggable renderers or OpenGL shaders.
  • Configuration changes are applied immediately on some systems. (currently only Mac OS X)
  • Fully-customizable keyboard shortcuts. There's no UI for it yet, but keyboard shortcuts can be customized in the configuration file.
  • Internationalization. The user interface can be localized using Qt's translation system, which allows the UI text to be translated into multiple languages. Currently, US English and British English are fully supported, and there's an initial Japanese translation. More translations will probably be added once 1.0_beta1 nears completion.

Host System

  • Initial 64-bit and PowerPC ports. Compiling on these platforms currently results in a "no-emulation" build; that is, the CPU cores are not compiled, since they're still written in x86 assembly language. This does let me test the other components on these platforms, though. (DEBUGGING PURPOSES ONLY!)
  • Initial CD-ROM drive detection. Four backends are currently available: UDisks2, UDisks1, Unix, and Win32. As of the libgenscd rewrite, none of the backends have automatic disc detection. This will be re-added when Sega CD support is reimplemented.
  • libgenscd: New CD-ROM abstraction library. This currently supports basic CD identification using SCSI/MMC commands on Linux (using SG_IO and other ioctls) and Windows (using SPTI). Future plans include support for Mac OS X and disc images. BIN/CUE and ISO/WAV will be implemented initially; ISO/FLAC and ISO/MP3 may be added later.

Planned Features

  • Standalone savestate viewer, which will allow users to view tiles, scroll planes, and sprites. This will later be integrated into an MDP plugin for real-time debugging functionality. Both ZOMG and GST savestates will be supported.
  • Possibly a built-in "Credits Roll" ROM that displays the libgens credits in a fancy way.
  • Automatic savestate option when closing an emulator. When reopening the emulator, the ROM and savestate would automatically be reloaded. (Suggested by gold_lightning in #retro.)
  • Rewritten PCM emulator with proper support for the Envelope register.
  • Compressed CD-ROM image support. Initial plans for a new format "MCDZ" have been written, though nothing has been published yet. Primary features of "MCDZ" will be lossless conversion to/from BIN/CUE (byte-identical BIN, parse-identical CUE) and support for gzip compression for data tracks and FLAC compression for audio tracks. (UPDATE: This may be cancelled in favor of using MAME's CHD format, which supports CD-ROM images.)
  • Gamepad support is planned for 1.0_beta2. This includes the ability to map gamepad buttons to Gens actions, e.g. Quit, Save State, and Load State. Also planned is built-in Wii remote support via libcwiid. (Linux only)
  • Switch to Musashi for 68000 emulation.
  • Rewritten clocking subsystem using Machine Clock cycles instead of per-CPU clock cycles.
  • Rewritten audio subsystem using Blip_Buffer.
  • Sega Master System, Game Gear, SG-1000, and ColecoVision support.

Known Issues

  • Framedropping doesn't work yet. If the system slows down for any reason, the emulator will stutter instead of dropping frames.

Features not ported from Gens/GS yet

  • MDP plugin support.
  • Sega CD and 32X emulation.
  • Gamepad support.
  • Command line parsing.

Compatibility List

See also: Gens/GS II Compatibility List

Preliminary Version Schedule

  • 0.1: Technical preview using SDL. Will support Mega Drive and Pico (partial implementation; no ADPCM). Expected release date is "October 2015".
  • 0.2: Sega 8-bit preview. New Z80 emulator (CZ80) with improved accuracy; clocking infrastructure rework; PSG rewrite and Blip_Buffer implementation.
  • 0.3: Qt UI release using the new framedropping algorithm from gens-sdl. Switch 68000 core to Musashi for better accuracy. ZOMG 0.8 will be finalized at this point.
  • 0.4: MDP release. Will include MDP rendering plugins, some other plugins, and more complete MDP. Possibly a libmdp for ease of host and plugin development as well.
  • 0.5: Sega CD emulation implemented with ISO/WAV, BIN/CUE, physical disc drive (Linux and Windows), and possibly CHD support, along with ZOMG 0.9.
  • 0.6: 32X emulation implemented, along with ZOMG 1.0.
  • 1.0: Finalization of everything.

This schedule is subject to change. Among other things, Sega CD and 32X may be swapped.

Git Repository